Changed from using outerHTML to innerHTML with a wrapper since Firefox has no support what so ever for outerHTML.

This commit is contained in:
remy 2011-08-18 09:30:57 +01:00
parent 2eab09e9b9
commit ac56470856
1 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@ pre {
</section>
<p id="status">Not connected</p>
<section>
<div id="test" data-name="rem" data-height="short">This element has data</div>
<div id="testWrapper"><div id="test" data-name="rem" data-height="short">This element has data</div></div>
<input type="button" value="Show data" id="show" />
<input type="button" value="Change data via dataset" id="change1" />
<input type="button" value="change data via setAttribute" id="change2" />
@ -31,7 +31,7 @@ pre {
(function () {
function show() {
code.innerHTML = test.outerHTML.replace(/[<>]/g, function (m) {
code.innerHTML = testWrapper.innerHTML.replace(/[<>]/g, function (m) {
return { '<': '&lt;', '>': '&gt;' }[m];
});
@ -43,7 +43,8 @@ function show() {
var state = document.getElementById('status'),
code = document.getElementById('element');
var test = window.element = document.getElementById('test');
var test = document.getElementById('test'),
testWrapper = document.getElementById('testWrapper');
if (test.dataset === undefined) {
state.innerHTML = 'dataset not supported';