jim-jim-jim / base2

Automatically exported from code.google.com/p/base2
0 stars 0 forks source link

In IE, getAttribute returns wrong results within a querySelectorAll(...).forEach(...) construct #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
<!DOCTYPE HTML PUBLIC  "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<body>

<div>
    <a href="http://google.com">Google</a>
    <a href="http://yahoo.com">Yahoo</a>
</div

<br><br>

<a onclick="test()" href="#">Test</a>

<br><br>

<div id="results"></div>

<script type="text/javascript"
src="client_side_includes/base2/1.0-beta2/base2-dom-fp.js"></script>
<script type="text/javascript">

base2.DOM.bind(document);

function test(){
    document.querySelectorAll("div a").forEach(function(item){
        document.querySelector("#results").innerHTML += "<strong>Inner
HTML:</strong> " + item.innerHTML + "<br>" +
                                                                                         "<strong>href via getattribute:</strong> " +
item.getAttribute("href") + "<br>" + 
                                                                                         "<strong>href via item.href:</strong> " + item.href
+ "<br><br>";
    });
};

</script>

</body>
</html>

When the test() function is called it outputs the results of
item.getAttribute("href") and item.href to the browser. These should be the
same but in IE 6 and 7, the getAttribute call returns incorrect results.

Both browsers were running on Windows XP in Parallels desktop on Mac OS.

Original issue reported on code.google.com by gregplay...@gmail.com on 11 Jul 2008 at 3:38

Attachments:

GoogleCodeExporter commented 9 years ago
Also, I got these results using base2 beta 2 and beta 3.

Original comment by gregplay...@gmail.com on 11 Jul 2008 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by dean.edw...@gmail.com on 29 Jul 2008 at 6:14

GoogleCodeExporter commented 9 years ago
Cheers Dean :)

Original comment by gregplay...@gmail.com on 30 Jul 2008 at 1:07