Open Bug 821530 Opened 12 years ago Updated 2 years ago

Treat null and undefined as empty strings in XUL property setters that set attributes

Categories

(Toolkit :: UI Widgets, defect)

defect

Tracking

()

People

(Reporter: dao, Unassigned)

Details

+++ This bug was initially created as a clone of Bug #820799 +++

Recently setAttribute's behaviour was "corrected" to match the spec which says that null should stringify to "null", however preferences.xml contains the following code block:

var lastPane = null;
if (this.lastSelected) {
  lastPane = document.getElementById(this.lastSelected);
  if (!lastPane) {
    this.lastSelected = null;
  }
}

The lastSelected XBL property wraps an attribute and the code clearly is trying to clear out an invalid lastSelected attribute, however with the new behaviour this fails because the attribute gets set to "null" instead.

(the above case was fixed in bug 820799 by replacing null with "")
Actually undefined always stringified as "undefined", it's only null's behaviour that's changed.
Right, but treating undefined differently from null here doesn't seem to make sense beyond this historic reason, which doesn't seem compelling to me.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.