Re: [selectors4] Proposal for extending Selectors Level 4 with possibility to select attributes

On 10.11.2013 8:00, Simon Sapin wrote:
> So in addition to a new feature in Selectors, you’ll need to get
> Selector API (now defined in the DOM spec) updated, as it explicitly
> defines that the return values (either NodeList or Elements) can only be
> elements and not other types of nodes.

Yes. Actually I wasn't aware that Selectors API restrict NodeList to
contain only elements. IMHO this is not very good design -- some
existing selectors implementations are also supporting different kind of
nodes and for CSS paged media similar additions will be also likely
needed. So restricting selectors and related APIs only to return
elements is shortsighted -- selectors operate on DOM and all reasonable
types of DOM nodes should be supported.

> Additionally, Attr is not a Node anymore and therefore can not be part
> of a NodeList. (Note in [1] the lack of interface inheritance compared
> to [2].)
> 
> [1] http://dom.spec.whatwg.org/#attr
> [2] http://dom.spec.whatwg.org/#element

Hmm, those living standards -- one can't track all of them during single
life :-)

DOM has many issues. I'm not sure that stopping inheriting Attr from
Node will save us.

> Today you can already use these API to select elements, then use
> .getAttribute()

You are not getting my point. What is needed is a simple high level
declarative query language for selecting nodes from HTML document.
Calling additional DOM method doesn't bring here anything else.

> How would the APIs work with your proposal?

They will return node or sequence of nodes -- I'm neither JS nor WebIDL
expert so I will left this exercise to others. With the old status where
Attr was inherited from Node already existing NodeList can be used.

    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 Sunday, 10 November 2013 11:42:43 UTC