xmldom icon indicating copy to clipboard operation
xmldom copied to clipboard

Implement the selectors API

Open ntninja opened this issue 9 years ago • 5 comments

It would be nice if xmldom could implement the W3C Selectors API (http://www.w3.org/TR/selectors-api/). Support can be easily added using an existing library such as nwmatcher.

Example of using nwmatchers selector implementation with xmldom:

    global.document = api.loadSource().ownerDocument || api.loadSource(); // Set `document` object in fake "browser window" (node.js environment)
    global.document.addEventListener = function() {}; // Workaround since `nwmatcher` otherwise thinks that the document was created by IE<9 and only supports `document.all` API
    var matcher = nwmatcher(global);  // Initialize `nwmatcher` for document

    // Example of `.querySelector()`
    var match = matcher.first(pattern, element);

ntninja avatar Sep 05 '14 21:09 ntninja

:+1:

n1k0 avatar Mar 25 '15 07:03 n1k0

Indeed! I really would like to be able to use querySelector !

AlexDmr avatar Apr 18 '15 12:04 AlexDmr

and querySelectorAll

codler avatar Jul 17 '17 21:07 codler

This has been open for several years... no interest from the devs? These functions are really convenient.

raffazizzi avatar Oct 30 '17 21:10 raffazizzi

xmlData.querySelector is not a function;

💔

coder-free avatar Mar 07 '20 16:03 coder-free