Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence of xmlns attribute causes HTML5Shiv to Fail in IE8 #167

Open
zacharybrady opened this issue Aug 21, 2014 · 3 comments
Open

Presence of xmlns attribute causes HTML5Shiv to Fail in IE8 #167

zacharybrady opened this issue Aug 21, 2014 · 3 comments

Comments

@zacharybrady
Copy link

Presence of the xmlns attribute causes the HTML5Shiv to fail.

Example instance:
In the

element I have an element with the attribute xmlns="http://www.w3.org/2000/svg" . When testing in IE8 that line causes the HTML5Shiv to fail after that point. Removing that attribute "fixes" the shiv.

Issue only appeared in Internet Explorer 8 but fine in IE6 and IE7. Didn't test in other non-HTML5 supported browsers.

Found a similar bug report in stack overflow here: http://stackoverflow.com/questions/12619875/html5-block-level-elements-failing-in-ie-with-html5shiv-or-modernizr

@Volker-E
Copy link

The SO question seems different, as the Operator stated

one of the nav elements had an odd attribute xmlns="http://www.w3.org/1999/html" assigned to it
causing the error.

Putting xmlns attributes on HTML5 elements aside of root and assuming that they'll work as intended doesn't look like a great idea. But this haven't caused your issue, right?

@aFarkas
Copy link
Owner

aFarkas commented Aug 22, 2014

Unfortunaley, I can't really replicate this issue using standard conform markup. This is my HTML:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
        section {
            margin: 10px;
            padding: 10px;
            border: 3px solid #000;
        }

        svg section,
        section section {
            border-color: red;
        }
    </style>
    <script src="../src/html5shiv-printshiv.js"></script>
</head>
<body>
<section>
    test
</section>
<section>
    test
<svg width="400" height="110" xmlns="http://www.w3.org/2000/svg">
     <rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
</svg>
</section>
<section>test</section>
<script>
    if(document.querySelectorAll){
        var section = document.querySelectorAll('section');
        for(var i = 0; i < section.length; i++){
            console.log(section[i].parentNode)
        }
    }
</script>
</body>
</html>

The only way I can replicate that something is going wrong is by using a) a namespace (polyglot HTML5) and b) do not explicitly close the rect element.

@jessekeyes
Copy link

I had the same issue and it was the xmlns attribute in an inline SVG file (in the ). Even though IE8 isn't supposed to recognize SVGs... removing xmlns from the allowed the shiv to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants