#59 ✓hold
ragaskar

Inconsistencies with innerHTML setting and getting?

Reported by ragaskar | March 18th, 2009 @ 07:20 PM

Sample Firefox console session:


>>> var foo = document.createElement('div');
>>> foo.innerHTML = '"& BAR"';
""& BAR""
>>> foo.innerHTML
""& BAR""
>>> foo.innerHTML = '"BAR"';
""BAR""
>>> foo.innerHTML;
""BAR""

Sample Rhino/env-js session:


js> var foo = document.createElement('div');
js> foo.innerHTML = '"& BAR"';
ERROR! : Fatal Error: Entity: missing closing sequence
Line: 1
Column: 6


ERROR! : [object Object]

"& BAR"
js> foo.innerHTML = '"BAR"';
"BAR"
js> foo.innerHTML;
"BAR"
js> 

I would mostly expect the Rhino behavior to be consistent with the FF behavior, but I don't know enough to tell which is more correct. It certainly seems like & and " should not be considered valid HTML, but maybe I'm too used to the forgiveness of transitional to expect a document element to blow up if I hand it a & (and escape my " for me). Sorry not to provide more details at the moment -- I'll try and take a look at the test suite and implementation and see if I can provide anything more useful than some scribbly example code.

btw, thanks for an awesome project!! love it!

Comments and changes to this ticket

  • Thatcher

    Thatcher March 24th, 2009 @ 04:03 PM

    • State changed from “new” to “open”
    • Assigned user set to “Thatcher”

    this is on the table for 1.0 and we are just releasing 0.9. This is a valid issue and I've put enough elbow grease into John's html parser to know we have a solution around the corner, but it's going to take enough work I want to leave it for 1.0.

    Thanks for documenting this.

  • Thatcher

    Thatcher September 9th, 2009 @ 05:22 PM

    • State changed from “open” to “hold”

    extra id is resolved and I believe extra space. looking into the treatment of the text node output we have to push this ticket to 1.1 as the unescaped xml characters would break the parser if the innerHTML was read in again.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

a javascript browser environment

People watching this ticket

Pages