This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17195 - Definition of .properties does not match implementation reality
Summary: Definition of .properties does not match implementation reality
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
Depends on:
Reported: 2012-05-25 19:33 UTC by contributor
Modified: 2013-02-08 01:36 UTC (History)
5 users (show)

See Also:


Description contributor 2012-05-25 19:33:00 UTC

Definition of .properties does not match implementation reality

Posted from: by
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/15.0 Firefox/15.0a1
Comment 1 Boris Zbarsky 2012-05-25 19:35:18 UTC
Specifically, this part:

  The properties IDL attribute on HTML elements must return an
  HTMLPropertiesCollection rooted at the Document node

combined with the fact that all the properties are in the element's home subtree would mean that elements that are not in the document should always have an empty .properties.

That doesn't seem to be terribly useful, and as far as I can tell Opera doesn't implement that.  Neither does the upcoming Gecko implementation.

See upcoming testcase: it would alert 0, then 2, if the spec was actually followed here.  In Opera it alerts 1, then 2.
Comment 2 contributor 2012-07-18 17:38:02 UTC
This bug was cloned to create bug 18194 as part of operation convergence.
Comment 3 Ian 'Hixie' Hickson 2012-09-21 20:09:49 UTC
It's intentional that .properties on elements not in a Document would be empty... not my fault y'all can't follow the spec. :-P
Comment 4 Ian 'Hixie' Hickson 2012-09-21 20:16:58 UTC
bz: Do you still have the aforementioned testcase, by any chance?
Comment 5 Boris Zbarsky 2012-11-26 05:04:36 UTC
I don't have the testcase anymore, sorry.  It was just doing basic testing of what happens in a disconnected subtree.

I think the reason people didn't follow the spec as you wrote is threefold:

1) "It doesn't seem to be terribly useful".  
2) The action-at-a-distance due to the implications of "rooted at" involving
   digging up a separate (unlinked, too) spec bit, combined with the fact that
   actually sharing implementations between HTMLPropertiesCollection and other
   HTMLCollections didn't happen at least in Gecko for various reasons, so the
   rooting didn't give behavior for free.
3) Whoever wrote the tests implementors used to verify their implementations
   didn't follow the spec either.

with #3 being likely most important in practice.

We could probably change Gecko to do what the spec says if you really think that's a better approach.  Why is it better?
Comment 6 Ian 'Hixie' Hickson 2012-11-26 20:48:29 UTC
I'm not sure it's really better — I don't really know what it means to be checking for the properties of a node that's not in a Document. But I can root it at the home subtree's root element, or something? I'll have to test to see what implementations actually do.
Comment 7 Boris Zbarsky 2012-11-26 22:24:27 UTC
It's worth seeing if Opera is willing to change.  I'd really much rather root at the document in Gecko, for what it's worth.  Speccing the other is a pain, since the home subtreee's root obviously changes over time.

Of course the owner document also changes over time (see adoptNode), so things are a bit annoying no matter what.
Comment 8 Simon Pieters 2012-11-27 05:32:42 UTC
I don't have a strong opinion, but Opera's behavior seems more useful than the spec's.
Comment 9 Ian 'Hixie' Hickson 2013-02-08 01:01:24 UTC

Gecko and Opera do a remarkable job of implementing what the spec doesn't say, so I guess I'll change the spec to match them... :-)
Comment 10 contributor 2013-02-08 01:03:33 UTC
Checked in as WHATWG revision r7705.
Check-in comment: Match reality. It's a bit more useful anyway, arguably.
Comment 11 contributor 2013-02-08 01:36:04 UTC
Checked in as WHATWG revision r7706.
Check-in comment: Clarify that the collection's root might change during the collection's lifetime.