Skip to content

Instantly share code, notes, and snippets.

@kangax
Created November 10, 2011 19:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kangax/1355781 to your computer and use it in GitHub Desktop.
Save kangax/1355781 to your computer and use it in GitHub Desktop.
<p class=">">
// outerHTML in Chrome (17): <p class="&gt;">
// outerHTML in Opera (12): <p class=">">
<input disabled>
// outerHTML in Chrome (17) and Opera (12): <input disabled="">
<input />
// outerHTML in Chrome (17) and Opera (12): <input>
// etc.
@mathiasbynens
Copy link

Nice find! These inconsistencies are interesting, but in which scenario would they actually break stuff?

@kangax
Copy link
Author

kangax commented Nov 10, 2011

I guess if you tried to parse attribute values from outerHTML, you'd need to account for all these inconsistencies. I never had a need for this though. I'm sure HTML5 defines representation, doesn't it?

Quick test case — http://kangax.github.com/jstests/outerHTML_test/

@charettes
Copy link

FF is just about to land outerHTML [1]. I wonder what the result will be [2].
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=92264
[2] https://hg.mozilla.org/integration/mozilla-inbound/rev/14903b2f3f45#l69.3

@kangax
Copy link
Author

kangax commented Nov 11, 2011

Yeah, that commit is what prompted this discussion in the first place :) I'll check nightly FF as soon as that change is propagated.

@charettes
Copy link

Guh, should have look at the bug CC's :)

@hsivonen
Copy link

// outerHTML in Opera (12): <p class=">">

That looks like the only bug in your findings above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment