[Bug 13249] New: Allow [TreatNullAs=EmptyString] for DOMString?, not just DOMString


           Summary: Allow [TreatNullAs=EmptyString] for DOMString?, not
                    just DOMString
           Product: WebAppsWG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: WebIDL
        AssignedTo: cam@mcc.id.au
        ReportedBy: Simetrical+w3cbug@gmail.com
         QAContact: member-webapi-cvs@w3.org
                CC: mike@w3.org, public-script-coord@w3.org

The [TreatNullAs] extended attribute must not be specified on an operation
argument, attribute or operation return value whose type is not DOMString.

This means it can't be specified on "DOMString?" (cf. [TreatUndefinedAs] which
allows that).  But it might be useful to allow it for "DOMString?" too.  The
effect should be that it doesn't change how getting works, but for setting it
converts null to the empty string.  Specifically, this would be useful for
textContent and nodeValue in DOM Core:

The textContent attribute must, on setting, if the new value is null, act as if
it was the empty string instead, and then do as described below, depending on
the context object:

That behaves like [TreatNullAs=EmptyString], but it can sometimes return null,
so it has to be DOMString? and not DOMString.  nodeValue is the same.

Admittedly this would be a little weird, since then you'd have to specify the
effect in prose if you wanted null to be treated like "null" but not if you
wanted it treated like "".  But timeless thought this was weird when he was
reviewing the spec, so if this isn't allowed, there should at least be some
note explaining why not.

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Thursday, 14 July 2011 15:10:20 UTC