Re: Serialization of PI misses ending question mark

On Sat, 19 Sep 2009 18:06:26 -0400, Ian Hickson <ian@hixie.ch> wrote:

> On Sat, 19 Sep 2009, Michael A. Puls II wrote:
>> On Sat, 19 Sep 2009 16:45:05 -0400, Ian Hickson <ian@hixie.ch> wrote:
>> > On Sat, 19 Sep 2009, Krzysztof Maczy�~Dski wrote:
>> > >
>> > > The ED says in section 9.4:
>> > > > If current node is a ProcessingInstruction
>> > > >
>> > > >     Append the literal string <? (U+003C LESS-THAN SIGN, U+003F  
>> QUESTION
>> > > MARK), followed by the value of current node's target IDL attribute,
>> > > followed by a single U+0020 SPACE character, followed by the value  
>> of
>> > > current node's data IDL attribute, followed by a single U+003E
>> > > GREATER-THAN SIGN character ('>').
>> > > It should rather say:
>> > > > If current node is a ProcessingInstruction
>> > > >
>> > > >     Append the literal string <? (U+003C LESS-THAN SIGN, U+003F  
>> QUESTION
>> > > MARK), followed by the value of current node's target IDL attribute,
>> > > followed by a single U+0020 SPACE character, followed by the value  
>> of
>> > > current node's data IDL attribute, followed by the literal string ?>
>> > > (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN).
>> >
>> > Why? This is simulating PIs from HTML4, not from XML.
>>
>> When PIs in the page are parsed into bogus comments, should the  
>> resulting
>> comment value simulate PIs from HTML4 too by not having the end '?'?
>>
>> <?xml-stylesheet type="text/css? href="file.css"?> ->  
>> <!--?xml-stylesheet
>> type="text/css? href="file.css"--> instead of <!--?xml-stylesheet
>> type="text/css? href="file.css"?-->?
>>
>> If not, then parse(pi_node_markup_from_source_of_page) will return a  
>> different
>> bogus comment than parse(real_pi_dom_node.innerHTML). The difference  
>> being the
>> end '?' in the comment value will be missing from the latter.
>
> If you're only dealing with HTML4-style PIs, there's no trailing ? at  
> all.
> That's only an XML thing.
>

Well, I figured in the DOM, a PI node is a PI node regardless of the type  
of its ownerDocument. Meaning, that if you used  
htmldocument.createProcessingInstruction(), grabbing the PI's innerHTML  
would have the end '?' on it like it would if its ownerDocument was an xml  
document. But, you're saying that, as far as innerHTML is concerned, a PI  
node with an html document as its ownerDocument will return an .innerHTML  
that simulates an HTML4 PI.

If so, that's cool. I just didn't expect that at first.

-- 
Michael

Received on Sunday, 20 September 2009 06:38:39 UTC