Last active
August 29, 2015 14:20
-
-
Save patrickkettner/6639d92d51c1cea8dd90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
// ⬇⬇ view the source of the below svg file ⬇⬇ | |
<object type="image/svg+xml" data="foo.svg"></object> | |
</body> | |
</html> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg width="400px" height="300px" viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg"> | |
<foreignObject width="300" height="500"> | |
<body xmlns="http://www.w3.org/1999/xhtml"> | |
<div id="foo">view the source, luke</div> | |
</body> | |
</foreignObject> | |
<div id="bar"></div> | |
<script> | |
// the style element exists on a div... | |
// in all browsers when element is inside of a foreignObject (and it supports foreign object) | |
console.log('style' in document.getElementById('foo')); | |
// in all browsers except (I)E(dge) when it is outside of a foreignObject | |
console.log('style' in document.getElementById('bar')); | |
// in all browsers except (I)E(dge) when it is created in the svg namespace | |
console.log('style' in document.createElementNS('http://www.w3.org/2000/svg', 'div')); | |
// in chrome, safari and firefox, all three of the above log out `true`. in (I)E(dge), it logs out `true`, `false`, `false` | |
</script> | |
</svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment