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


Groups > comp.lang.javascript > #22651

Re: Reading outerHTML

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: Reading outerHTML
Date Fri, 17 Jan 2014 08:55:51 +0200
Organization A noiseless patient Spider
Lines 35
Message-ID <lbak5l$sg$1@dont-email.me> (permalink)
References <4ZydnTNcnrnRy0XPnZ2dnUVZ_h6dnZ2d@westnet.com.au>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 17 Jan 2014 06:55:49 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="ad9d9996ed56b0226e850b84acbddfdf"; logging-data="912"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+obuBMxFWmd07ii6EWNcQp"
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To <4ZydnTNcnrnRy0XPnZ2dnUVZ_h6dnZ2d@westnet.com.au>
X-Antivirus-Status Clean
X-Antivirus avast! (VPS 140116-1, 16.01.2014), Outbound message
Cancel-Lock sha1:TAVvANZgrW5ydE8F8y7/rFwCcCo=
Xref csiph.com comp.lang.javascript:22651

Show key headers only | 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