- From: Jirka Kosek <jirka@kosek.cz>
- Date: Mon, 17 Mar 2014 11:18:50 +0100
- To: www-dom@w3.org
- Message-ID: <5326CC0A.8060708@kosek.cz>
Hi, if I haven't missed anything there is serious omission in methods related to selectors -- query(), queryAll(), querySelector() and querySelectorAll(). Selectors specs (http://dev.w3.org/csswg/selectors4/#namespaces) says that language that uses selectors should define mechanism by which namespace prefixes are declared. This is important for working with elements in non-HTML namespace. For example using selectors you can easily select all circles in SVG document by using "svg|circle", given "svg" prefix is correctly declared. Currently DOM4 doesn't offer mechanism for declaring namespace prefixes which can be used in selector strings passed to API. All four methods (query(), queryAll(), querySelector() and querySelectorAll()) should provide second signature with optional object, which will hold mapping between namespaces and prefixes. What is needed is something similar to the following methods/classes available in another programming environments: http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathNSResolver http://www.php.net/manual/en/domxpath.registernamespace.php So it would be possible to declare prefixes before issuing query, for example like: document.querySelectorAll("svg|circle", { svg: "http://www.w3.org/2000/svg"} ) Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep. ------------------------------------------------------------------ Bringing you XML Prague conference http://xmlprague.cz ------------------------------------------------------------------
Received on Monday, 17 March 2014 10:19:15 UTC