This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25244 - What do Attr objects serialize?
Summary: What do Attr objects serialize?
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM Parsing and Serialization (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-03 07:20 UTC by Travis Leithead [MSFT]
Modified: 2014-04-03 18:24 UTC (History)
4 users (show)

See Also:


Attachments

Description Travis Leithead [MSFT] 2014-04-03 07:20:20 UTC
For XMLSerializer.serializeToString--

In IE, these serialize the Attr's value only

In Firefox, these serialize the empty string all the time

It usually does not make sense to serialize an Attr object on its own, and it certainly wouldn't constitute a well-formed internal general parsed entity.

So, make the spec return the empty string (or throw) on a serialization of this object type.
Comment 1 Simon Pieters 2014-04-03 12:41:08 UTC
Blink serializes the value also (and escapes &<> but not "').
Comment 2 Anne 2014-04-03 16:30:54 UTC
Note that per DOM Attr is not a Node and therefore it would throw.
Comment 3 Travis Leithead [MSFT] 2014-04-03 18:14:03 UTC
Hmm, yes, I had forgotten that.

WebIDL validation against the Node type would cause the API to throw a TypeError. So, I guess this case is already handled for me.
Comment 4 Travis Leithead [MSFT] 2014-04-03 18:24:58 UTC
I noted this condition in the spec to avoid any future questions (and to remind myself later when I forget again).

Fixed in commit:
https://dvcs.w3.org/hg/innerhtml/rev/de442ae4cc27