Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22651

Re: Reading outerHTML

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: Reading outerHTML
Date 2014-01-17 08:55 +0200
Organization A noiseless patient Spider
Message-ID <lbak5l$sg$1@dont-email.me> (permalink)
References <4ZydnTNcnrnRy0XPnZ2dnUVZ_h6dnZ2d@westnet.com.au>

Show all headers | View raw


2014-01-16 23:58, Andrew Poulos wrote:

> I have some HTML which is written as
>    <select style="width:80%;"
>
> When I get the outerHTML of the element in IE9+ and other non-IE
> browsers I get
>    <select style="width:80%;"

Yes. And you would get the same if your markup had
<SELECT Style="width:80%;"
since serialization canonicalizes tag and attribute names to lower case. 
This is common browser practice and being standardized in HTML5.

> In IE7 and 8 I get
>    <SELECT style="WIDTH:80%;"

They apply their own, messy canonicalization. This usually isn't a 
problem, since if you need to work on the serialized format, you can do 
that in a case-insensitive manner.

> Yet if I do a string replace like
>    el.outerHTML = el.outerHTML.replace("<\/SELECT>", a + "<\/SELECT>");
> It "works" in all browsers except IE9+.

This relates to the serialization of the end tag, which you did not mention.

You must be misinterpreting the results.

It is canonicalized to </select>, except in old versions of IE, which 
canonicalize to </SELECT>. Therefore, the code above does not do 
anything, except in IE 8 and older. Tested on Chrome, Firefox, IE 9.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Reading outerHTML Andrew Poulos <ap_prog@hotmail.com> - 2014-01-17 08:58 +1100
  Re: Reading outerHTML "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2014-01-17 08:55 +0200
    Re: Reading outerHTML "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-17 11:20 +0100
      Re: Reading outerHTML Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-17 12:58 +0000
        Re: Reading outerHTML "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-17 15:44 +0100
      Re: Reading outerHTML Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-17 22:26 +0100
  Re: Reading outerHTML Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-17 16:27 +0100
    Re: Reading outerHTML Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-17 22:21 +0100
      Re: Reading outerHTML Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-17 23:32 +0100
        Re: Reading outerHTML Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-18 02:02 +0100
          Re: Reading outerHTML "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-18 11:55 +0100
          Re: Reading outerHTML Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-18 12:06 +0100

csiph-web