2010-05-31
Firefox に outerHTML を実装する
outerHTML について
outerHTML とは Mozilla 系のブラウザ以外のすべてのブラウザで使える要素の HTML が文字列として取得できるプロパティです。
alert(document.body.outerHTML); // => body の HTML がすべて見える(例:<body><h1>It works!</h1></body>)
というわけで
以下のコードを書いてみました。
if (!('outerHTML' in document.createElement('div'))) { HTMLElement.prototype.__defineGetter__('outerHTML', function() { return this.ownerDocument.createElement('div').appendChild(this.cloneNode(true)).parentNode.innerHTML }) }
トラックバック - http://d.hatena.ne.jp/amachang/20100531/1275270877
リンク元
- 156 http://twitter.com/amachang
- 135 http://nplll.com/mutter/archives/2009/03/ie8ie8ie7ie6.php
- 115 http://reader.livedoor.com/reader/
- 100 http://pipes.yahoo.com/pipes/pipe.info?_id=3eebace824bb60a10f13c841c2c64478
- 95 http://kawama.jp/archives/2007/02/javascriptforea.html
- 84 http://www.google.co.jp/search?q=javascript+連想配列&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&hl=ja&client=firefox-a
- 75 http://b.hatena.ne.jp/articles/201001/743
- 68 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rlz=1T4GGIH_jaJP277JP277&q=ie8+ie7 共存
- 57 http://b.hatena.ne.jp/hotentry/it
- 53 http://www.google.co.jp/search?hl=ja&source=hp&q=javascript+連想配列&aq=f&aqi=g9g-cr1&aql=&oq=&gs_rfai=