Closed
Bug 259332
Opened 21 years ago
Closed 18 years ago
.all isn't fully implemented (document.all, element.all)
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.9
People
(Reporter: fick_el, Assigned: sicking)
References
Details
Attachments
(2 files)
|
13.10 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
|
372 bytes,
text/html
|
Details |
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
Build Identifier:
The newly implemented document.all is a blessed change, but it is far from
being a proper emulation of the IE/Opera 'all' property. I'm a firm believer in
doing things properly if they are done at all.
'all' in Mozilla is currently missing:
* Same-id grouping to array (two elements with the same id will yield the
result '2' for document.all.myId.length).
* .all should be available for for any element on the document, not just the
document itself (myElement.all.myId).
* .all should contain elements with the 'name' attribute as well, not only 'id'.
Reproducible: Always
Steps to Reproduce:
Comment 1•21 years ago
|
||
> * .all should contain elements with the 'name' attribute as well, not only 'id'.
hmm, you sure this isn't done yet?
Comment 2•21 years ago
|
||
> * Same-id grouping to array (two elements with the same id will yield the
> result '2' for document.all.myId.length).
Documents with duplicate id violate SGML and (we believe) are very rare. We do
not plan to support this quirk.
> * .all should be available for for any element on the document, not just the
> document itself (myElement.all.myId).
This is also rare, I think -- bclary can confirm. We are not trying to emulate
every last IE quirk -- that's a fool's errand.
biesi's right about name, please retest with something current. You filed this
bug using IE, so I can't tell what you were using to test.
/be
Sorry, I didn't quite manage to phrase the problem I was seeing, Christian.
The problem is that when there is both a name and id of equal value, id is
always preferred over the name regardless of which of the two is higher up in
the document hierarchy.
This will be solved along with the first item (arraying similar names/ids),
just need to watch the order in which they are collected (IE maintains document
order in the array).
> Documents with duplicate id violate SGML and (we believe) are very rare. We
> do not plan to support this quirk.
However, .all contains groups of names too, duplicate names are fine, and as
far as I know, used often (in the form element 'elements' collection for
example). The .all form of it may be a little less common, I'm not sure about
the statistics, but it's not a big fix and it will be much more complete.
> This is also rare, I think -- bclary can confirm. We are not trying to
> emulate every last IE quirk -- that's a fool's errand.
I've seen this used quite a bit, especially on forms instead of using the
elements collection. Regardless, I would have liked to see an implementation
that most closely resembles the IE/Opera implementation just for the sake of
completeness. This isn't much work and will surely fix quite a few sites.
Comment 5•21 years ago
|
||
> duplicate names are fine
Of coures -- I specifically sayd "duplicate ids". Supporting duplicate names is
not an argument for supporting duplicate ids, and the whole point of the emulate
document.all exercise is to avoid too much code bloat and opportunity cost in
chasing IE crap.
> I've seen this used quite a bit
We relied on spidering a large number of sites (thanks, bclary!) in order to
have a meaningul public-web sample from which to reason. That's how we decide
what to emulate, not based on a goal of complete IE (or Opera, which operates
badly with many sites because it also spoofs IE's user-agent, I'm told) emulation.
So we need more spidering results to decide what to do here. Quantification is
good. In parallel, if you hack C++ and are inclined to help, feel free to work
on a patch, but there's no guarantee it'll go in without numbers backing up the
sufficiently-broad utility of it. If it's *really* small, and works just like
IE as far as anyone can tell, I doubt we'd refuse it. ;-)
/be
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 6•21 years ago
|
||
Adding the magic property reference to the summary.
/be
Summary: .all isn't fully implemented → .all isn't fully implemented (document.all, element.all)
Comment 7•21 years ago
|
||
Ish,
First, let me outline the purpose of this extension. It was intended to help
improve support for sites which are primarily written for MSIE and which are
unlikely to be updated to support Non-MSIE browsers.
*It is not intended to be intentionally used.*
If you find that some features are missing which affect a significant number of
sites then the feature could be considered for addition, but I think more than
anecdotal evidence would be required.
I believe the compatibility issues you have identified do not appear in a
significant population of web sites. Admittedly I have only scanned 2300+ sites
which were listed in open tech evangelism bugs, but I found these issues to be
rather rare if the appeared at all. A summary of my last test run is:
2472 pages loaded
89 Network errors
====
2383 total loaded
2138 quirks mode
====
245 standards mode
15366 total js errors
618 unique js errors
7490 total uses of document.all
285 unique uses of document.all
65424 total uses of ID/NAME
204 unique uses of ID/NAME
5760 total uses 'not defined' js errors
222 unique uses of 'not defined'
240 total js errors containing document.all
7 unique js errors containing document.all
Errors were determined by recording all javascript console messages to a file
through the page load event and after sending mouseover/mouseout events to each
"leaf" element in the page. "total" counts included all occurences of an error
message including source file/line/col info. "unique" counts were sorted and
uniqed. The testing did not cover filling in form input elements or submitting
forms.
Of the errors containing \.all, some are due to our incomplete emulation of
MSIE's DHTML object model while others are plain bugs in the page content. A
summary is:
JavaScript Exception: MenuGlobalDiv.all is not a function. Source File:
http://www.yashir1.co.il/ysh/front/document.asp, Line: 1236.
JavaScript Exception: document.all is not a function. Source File:
http://msdn.microsoft.com/subscriptions/index/default.aspx, Line:
115.
JavaScript Exception: document.all("AvataMenu") has no properties. Source File:
http://home.freechal.com/js/FcMain20/AvataMenuTopBar.js, Line: 34.
JavaScript Exception: document.all.divCont has no properties. Source File:
http://www.scee.com/corporate/jobs.jhtml, Line: 183.
JavaScript Exception: document.all.showTitle.item is not a function. Source
File: http://www.optorite.com/_english/web/1_product/0_overview.php, Line: 370.
JavaScript Exception: document.all.tabZ.rows is not a function. Source File:
http://www.ynetcenter.co.il/bottom_bar.htm, Line: 103.
JavaScript Exception: document.all.tags("SELECT") has no properties. Source
File: http://www.vapormatic.com/common/includes/popouttext.js, Line: 5.
JavaScript Exception: document.forms.Login.all has no properties. Source File:
http://www.madrid2012.es/Amigos2M12/Voluntarios.asp,
Line: 23.
JavaScript Exception: document[document.all ? "all" : "layers"] has no
properties. Source File:
http://adserv.sapo.pt/js.ng/site=www.sapo.pt&chan=gameover&estilo=120x600, Line: 58.
If you are interested in helping scan additional sites, I would be happy to help
get you started. One thing I have wanted to do but have not been able to do is
scan the top 70 web sites and the pages linked from their homepages looking for
the benefits and costs of the undetected document.all support.
| Assignee | ||
Comment 8•18 years ago
|
||
This implements document.all such that document.all.foo returns a list of all the nodes with the id or name 'foo'. If that list has no nodes null is returned, and if the list has one that node is returned.
Assignee: general → jonas
Status: NEW → ASSIGNED
Attachment #273871 -
Flags: superreview?(jst)
Attachment #273871 -
Flags: review?(jst)
Comment 9•18 years ago
|
||
Comment on attachment 273871 [details] [diff] [review]
Implement document.all better
r+sr=jst
Attachment #273871 -
Flags: superreview?(jst)
Attachment #273871 -
Flags: superreview+
Attachment #273871 -
Flags: review?(jst)
Attachment #273871 -
Flags: review+
Comment 10•18 years ago
|
||
Comment on attachment 273871 [details] [diff] [review]
Implement document.all better
nsIHTMLDocument.h needs a new IID...
Comment 11•18 years ago
|
||
Apparently the patch was checked in at 2007-07-25 17:36.
Does this mean this bug can be marked fixed?
Was the suggestion of comment 10 done?
Comment 12•18 years ago
|
||
Apparently, document.all by name stopped working when the patch was checked in, see testcase.
This came from Hendrix feedback: http://groups.google.com/group/mozilla.feedback/browse_thread/thread/2b001eb03ecd2f17/7c5cbbdb9c658c0c?lnk=st
Or should I file a new bug on this issue?
| Assignee | ||
Comment 13•18 years ago
|
||
That testcase doesn't appear to work in IE, so I think the new code is more correct. Name-matching in IE only happens on a certain set of elements, I made it happen on <img> <form> <applet> <embed> <object> and <input>, however it is possible that that list doesn't match IE. If you do find differences between our matching and IEs, please do file a new bug.
I wonder for example if <a> should be in that list?
| Assignee | ||
Comment 14•18 years ago
|
||
Closing this one as fixed even though element.all isn't implemented yet. If anyone wants element.all implemented feel free to open a new bug at it. However the reason we didn't implement it for now was that we simply couldn't find any sites that depended on it, so if you do open a bug, please provide pointers to such sites.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 15•18 years ago
|
||
Ah, ok, thanks. The site in question uses it on a select, so I guess that works in IE. I'll test some further and file a new bug about this.
Comment 16•18 years ago
|
||
Ok, I filed this now as bug 393629.
| Assignee | ||
Updated•17 years ago
|
Updated•12 years ago
|
Target Milestone: --- → mozilla1.9
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•