Opened 12 years ago
Closed 12 years ago
#11831 closed defect (fixed)
dojo.byId returns null or undefined depending on path
Reported by: | miketaylr | Owned by: | anonymous |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | General | Version: | 1.5 |
Keywords: | Cc: | dante | |
Blocked By: | Blocking: |
Description
The comments on lines 5282 and 5283, for dojo.byId say:
Returns DOM node with matching id
attribute or null
if not found. If id
is a DomNode?, this function is a no-op.
From what I can tell, it returns undefined
or null
depending on the code path. The IE/Opera path returns undefined, while the getElementById path returns null, per spec.
There's some code on wsj.com that breaks due to someone testing for null rather than truthiness
this.osectionFooterNonSub = dojo.byId("hrefSubId");
followed by:
if (this.osectionFooterNonSub !== null) { dojo.connect( this.osectionFooterNonSub, "onclick", this, function(ev) { dojo.stopEvent(ev); window.location = this.osectionFooterNonSub.href; });
Change History (2)
comment:1 Changed 12 years ago by
Milestone: | tbd → 1.6 |
---|
comment:2 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
(In [22972]) Fixes #11831 and #11832. Make sure byId consistently returns null, and use the standards path for Opera, confirmed that it works for what we support by an Opera person, and the change does not affect Core test results. \!strict