W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

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

From: <bugzilla@jessica.w3.org>
Date: Thu, 14 Jul 2011 15:10:15 +0000
To: public-script-coord@w3.org
Message-ID: <bug-13249-3890@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13249

           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:
"""
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-textcontent

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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC