Code Monkey home page Code Monkey logo

html5shiv's Introduction

The HTML5 Shiv

The HTML5 Shiv enables use of HTML5 sectioning elements in legacy Internet Explorer and provides basic HTML5 styling for Internet Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.

What do these files do?

html5shiv.js

  • This includes the basic createElement() shiv technique, along with monkeypatches for document.createElement and document.createDocumentFragment for IE6-8. It also applies basic styling for HTML5 elements for IE6-9, Safari 4.x and FF 3.x.

html5shiv-printshiv.js

  • This includes all of the above, as well as a mechanism allowing HTML5 elements to be styled and contain children while being printed in IE 6-8.

Who can I get mad at now?

HTML5 Shiv is maintained by Alexander Farkas, Jonathan Neal and Paul Irish, with many contributions from John-David Dalton. It is also distributed with Modernizr.

If you have any issues in these implementations, you can report them here! :)

For the full story of HTML5 Shiv and all of the people involved in making it, read The Story of the HTML5 Shiv.

Installation

Using Bower

bower install html5shiv --save

This will clone the latest version of the HTML5 shiv into the bower_components directory at the root of your project and also create or update the file bower.json which specifies your projects dependencies.

Include the HTML5 shiv in the <head> of your page in a conditional comment and after any stylesheets.

<!--[if lt IE 9]>
	<script src="bower_components/html5shiv/dist/html5shiv.js"></script>
<![endif]-->

Manual installation

Download and extract the latest zip package from this repositiory and copy the two files dist/html5shiv.js and dist/html5shiv-printshiv.js into your project. Then include one of them into your <head> as above.

HTML5 Shiv API

HTML5 Shiv works as a simple drop-in solution. In most cases there is no need to configure HTML5 Shiv or use methods provided by HTML5 Shiv.

html5.elements option

The elements option is a space separated string or array, which describes the full list of the elements to shiv. see also addElements.

Configuring elements before html5shiv.js is included.

//create a global html5 options object
window.html5 = {
  'elements': 'mark section customelement' 
};

Configuring elements after html5shiv.js is included.

//change the html5shiv options object 
window.html5.elements = 'mark section customelement';
//and re-invoke the `shivDocument` method
html5.shivDocument(document);

html5.shivCSS

If shivCSS is set to true HTML5 Shiv will add basic styles (mostly display: block) to sectioning elements (like section, article). In most cases a webpage author should include those basic styles in his normal stylesheet to ensure older browser support (i.e. Firefox 3.6) without JavaScript.

The shivCSS is true by default and can be set false, only before html5shiv.js is included:

//create a global html5 options object
window.html5 = {
	'shivCSS': false
};

html5.shivMethods

If the shivMethods option is set to true (by default) HTML5 Shiv will override document.createElement/document.createDocumentFragment in Internet Explorer 6-8 to allow dynamic DOM creation of HTML5 elements.

Known issue: If an element is created using the overridden createElement method this element returns a document fragment as its parentNode, but should be normally null. If a script relies on this behavior, shivMethodsshould be set to false. Note: jQuery 1.7+ has implemented his own HTML5 DOM creation fix for Internet Explorer 6-8. If all your scripts (including Third party scripts) are using jQuery's manipulation and DOM creation methods, you might want to set this option to false.

Configuring shivMethods before html5shiv.js is included.

//create a global html5 options object
window.html5 = {
	'shivMethods': false
};

Configuring elements after html5shiv.js is included.

//change the html5shiv options object 
window.html5.shivMethods = false;

html5.addElements( newElements [, document] )

The html5.addElements method extends the list of elements to shiv. The newElements argument can be a whitespace separated list or an array.

//extend list of elements to shiv
html5.addElements('element content');

html5.createElement( nodeName [, document] )

The html5.createElement method creates a shived element, even if shivMethods is set to false.

var container = html5.createElement('div');
//container is shived so we can add HTML5 elements using `innerHTML`
container.innerHTML = '<section>This is a section</section>';

html5.createDocumentFragment( [document] )

The html5.createDocumentFragment method creates a shived document fragment, even if shivMethods is set to false.

var fragment = html5.createDocumentFragment();
var container = document.createElement('div');
fragment.appendChild(container);
//fragment is shived so we can add HTML5 elements using `innerHTML`
container.innerHTML = '<section>This is a section</section>';

HTML5 Shiv Known Issues and Limitations

  • The shivMethods option (overriding document.createElement) and the html5.createElement method create elements, which are not disconnected and have a parentNode (see also issue #64)
  • The cloneNode problem is currently not addressed by HTML5 Shiv. HTML5 elements can be dynamically created, but can't be cloned in all cases.
  • The printshiv version of HTML5 Shiv has to alter the print styles and the whole DOM for printing. In case of complex websites and or a lot of print styles this might cause performance and/or styling issues. A possible solution could be the htc-branch of HTML5 Shiv, which uses another technique to implement print styles for Internet Explorer 6-8.

What about the other HTML5 element projects?

  • The original conception and community collaboration story of the project is described at The History of the HTML5 Shiv.
  • IEPP, by Jon Neal, addressed the printing fault of the original html5shiv. It was merged into html5shiv.
  • Shimprove, in April 2010, patched cloneNode and createElement was later merged into html5shiv
  • innerShiv, introduced in August 2010 by JD Barlett, addressed dynamically adding new HTML5 elements into the DOM. jQuery added support that made innerShiv redundant and html5shiv addressed the same issues as well, so the project was completed.
  • The html5shim and html5shiv sites on Google Code are maintained by Remy Sharp and are identical distribution points of this html5shiv project.
  • Modernizr is developed by the same people as html5shiv and can include the latest version in any custom builds created at modernizr.com
  • This html5shiv repo now contains tests for all the edge cases pursued by the above libraries and has been extensively tested, both in development and production.

A detailed changelog of html5shiv is available.

Why is it called a shiv?

The term shiv originates from John Resig, who was thought to have used the word for its slang meaning, a sharp object used as a knife-like weapon, intended for Internet Explorer. Truth be known, John probably intended to use the word shim, which in computing means an application compatibility workaround. Rather than correct his mispelling, most developers familiar with Internet Explorer appreciated the visual imagery. And that, kids, is etymology.

html5shiv's People

Contributors

96radhikajadhav avatar addyosmani avatar afarkas avatar brianblakely avatar cebor avatar daiscog avatar davidhund avatar davidl avatar drzax avatar enigmatic-user avatar fakundo avatar ferrybig avatar gravatalonga avatar imjoshdean avatar j15e avatar javiercejudo avatar jdalton avatar jonathantneal avatar justinbmeyer avatar kidwm avatar mathiasbynens avatar maxmillion avatar paulirish avatar robloach avatar slavanga avatar thomaswelton avatar vlakoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html5shiv's Issues

< IE9 display issues with Cufon.

A few sites using the HTML5shiv have suddenly (over the weekend 18th, 19th Feb) started displaying rendering problems. Cufon replaces the text, but system text is still visible behind.

Appears to be anything below IE9.

Only common denominator appears to be the html5shiv.

No JS errors.

check on potential problem with OBJECT elements.

I know jQuery, MooTools, Prototype have IE bugs associated with OBJECT elements.
It may be a good thing to avoid shiving them as well, but I would like a failing test first.

Anyways, this is here as a place holder.

iepp global not being created

In modernizr the iepp global isnt being created in any browser but IE.

I think it has to do with the funky assignments at the beginning.

if (styleSheetList+'' === undefined) what da eff

I was reading through the source when I noticed line 31:

if(styleSheetList+'' === undefined){return '';}

WTF? This looks like a combination of typos or something, unless I’m missing something of course :) Anyone care to explain?

change innerHTML setting from array to string concating better minification

So this:

div.innerHTML = ['x<style>',
    'article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}', // Corrects block display not defined in IE6/7/8/9
    'audio{display:none}', // Corrects audio display not defined in IE6/7/8/9
    'canvas,video{display:inline-block;*display:inline;*zoom:1}', // Corrects canvas and video display not defined in IE6/7/8/9 (audio[controls] in IE7)
    '[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}', // Corrects 'hidden' attribute and audio[controls] display not present in IE7/8/9
    'mark{background:#FF0;color:#000}', // Addresses styling not present in IE6/7/8/9
    '</style>'].join('');

should be changed to this:

div.innerHTML = 'x<style>' +
    'article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}' + // Corrects block display not defined in IE6/7/8/9
    'audio{display:none}' + // Corrects audio display not defined in IE6/7/8/9
    'canvas,video{display:inline-block;*display:inline;*zoom:1}' + // Corrects canvas and video display not defined in IE6/7/8/9 (audio[controls] in IE7)
    '[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}' + // Corrects 'hidden' attribute and audio[controls] display not present in IE7/8/9
    'mark{background:#FF0;color:#000}' + // Addresses styling not present in IE6/7/8/9
    '</style>';

Minifiers will pick up it and turn it into 1 string.

document.createElement() shim creates elements with non-null siblings in IE < 9

Example code (run in IE < 9):

var div1 = document.createElement("div");
var div2 = document.createElement("div");
alert(div2.previousSibling); // Should be null, is actually a reference to div1

nextSibling and previousSibling (and possibly other properties) should be null for a newly created element, which should effectively live in its own little vacuum until being attached to the document. I would suggest doing a thorough review of the document.createElement() shim to ensure this is the case.

This bug prevents my Rangy library working properly in IE < 9 when Modernizr is also present and is not easily worked around within Rangy code. Actually, it wouldn't be that hard to work around but I'd rather not have to, since the presence of other libraries in the page really shouldn't break the environment.

Drop the HTML5 element styles

Please reconsider the inclusion of CSS rules. Reasons:

  1. The existing CSS is out-of-date and missing elements like summary.
  2. The existing CSS is not being updating (and wasn't prior to being included in a stable release).
  3. The [hidden] rule should not be in the JS at all. It deviates from the expected behaviour of modern browser defaults by increasing the experienced specificity, meaning that IE's "hidden" will interact with other selectors slightly differently to modern browsers. This is fine if it's packaged in something like normalize.css because all browsers are on the same page and it can easily be stripped from the CSS if there is a problem. That is not the case when it is bundled in a JS lib.
  4. A JS lib is not the place to include CSS that many others many not know is packaged in the lib.
  5. Any changes to the CSS in the future could have substantial knock-on effects for sites that link to the Google Code CDN and build their HTML5-based sites (knowingly or unknowingly) upon the foundational CSS bundled with this lib.

Thanks.

Can't print iframes

When printing webpages using IEPP (as included in modernizr or as stand alone), iframes are blank.

It seems the src of the iframes is changed to a local url when the body content is swapped with protected version...

version used : 2.2
IE version : 8.0.6001.18702

I also created a gist for the test case : https://gist.github.com/1264354

Last html5shiv.js doesn't work in ieTester

Hello,

Sorry, but I'm not used to use github, so I don't know if this is the right place to submit this issue.
I inserted the script by using the following lines in my header :

<!--[if lt IE 9]>
    <script src="https ://github.com/aFarkas/html5shiv/blob/master/dist/html5shiv.js"></script>
<![endif]>

It didn't work...

I tried it another way by uploading the script and doing it this way:

<!--[if lt IE 9]>
    <script src="path_to_file/html5shiv.js"></script>
<![endif]>

It didn't work either... :(
IETester gave me an error message pointing to the line 4, character 1.

Line 3 :

m=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,i,j;(function(){var a=b.createElement("a");a.innerHTML="<xyz></xyz>";i="hidden"in a;if(!(a=1==a.childNodes.length))a:{try{b.createElement("a")}catch(c){a=!0;break a}a=b.createDocumentFragment();a="undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}j=

Line 4 :

a})();var e={elements:d.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==d.shivCSS,shivMethods:!1!==d.shivMethods,type:"default",shivDocument:h};g.html5=e;h(b)})(this,document);

I deleted the space between line 3 and 4 and then it worked...

Could you fix this?

Thanks in advance.

Jojaba

Potential problem with `documentCreateElement`

I noticed in Chrome and Firefox that:

var c = document.createElement;
c('div'); // throws an error

This means that an environment may error with how html5shiv stores document.createElement in its documentCreateElement variable.

A way around it is:

// grab Function.prototype.call in case the host method doesn't have it
var call = Date.call;
call.call(documentCreateElement, scopeDocument, tag);

Excanvas & html5shiv doesn't work together

No matter in which order you write next two lines, IE < 9 will prompt an error and fail.

`

`

However, a little temporary fix is:
excanvas and html5shim are not compatible as far as i've been testing. I just replaced the shim with:

<!--[if lt IE 9]><script type="text/javascript">var e="article,aside,figure,footer,header,hgroup,menu,nav,section".split(",");for(var i=0,l=e.length;i<l;i++){document.createElement(e)};</script><![endif]-->

I have been debugging the shiv and seems that canvas is messing up. I don't know the best solution.

optimize condition

this

if (html5.shivMethods && element.canHaveChildren && !(element.xmlns || element.tagUrn)) {

can be reworked to exit earlier

if (!html5.shivMethods || !element.canHaveChildren || element.xmlns || element.tagUrn) {
  return element;
}

checking for `html5.elements` is buggy.

The current code that checks for html5.elements is incorrect and won't ever be truthy has var html5 is local and undefined at the time of the check.

It should be something like

elements: window.html5 && window.html5.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ')

IE8 and after print

I was getting a strange behaviour when using the print version (on a complex page with dynamic content scrolling - instead of page reload) I guess .. probably because of the page complexity, but after print preview in IE8 a blank page was show instead of the content. Sorry I cannot provide the page itself. But to make it 'work' I had to execute 'after print' code with a delay.

ownerWindow.attachEvent('onafterprint', function() {
  var fnc = function(){
    // remove wrappers, leaving the original elements, and remove the shived style sheet
    removeWrappers(wrappers);
    shivedSheet.removeNode(true);
   // my code >>
    if (_g_after_print)
        {
            _g_after_print();
        }
    // << my code
  };
  window.setTimeout(fnc, 500);
});

This was a quick 'fix', did not try to see why (and when) this can happen .. but it just worked for me.
I used there '_g_after_print' just to scroll the content to the right position as It was changed by the 'html5shiv' on the way.

iepp causes window.print to print out all frames

Have a look at the two pages in this gist.

Each page has a Print link that attempts to only print out the contents of child document.

If iepp.js is included in both documents, or only in parent document, the parent document is incorrectly printed out with an empty iframe where the child document appears when clicking on either Print link.

If iepp.js is included in only the child document the parent document is incorrectly printed out with the child document appearing in the iframe when clicking either Print link.

If iepp.js is removed from both documents both Print links will result in only the child document being printed as expected.

I have observed this behaviour in Internet Explorer 6 through 9.

tweak iepp.restoreHTML

No need to clear bodyElement innerHTML before removing, and use IE's swapNode method.

iepp.restoreHTML = function(){
  bodyElem.swapNode(body);
};

Documentation

Hey there,

I’ve been following the development of HTML5 shiv, shimprove, innerShiv, IEPP etc. right from the beginning but stopped when jQuery integrated the innerShiv. Since we had problems with jQuery’s approach, today I tried to catch up and dive into the current html5shiv again. I have to admit I found it very hard to get a clue about the project. While html5shiv originally started as a one-liner several years ago, it grew to a complex and sophisticated project.

Compared to the innerShiv, additional checks, caches and exceptions were added. Don’t get me wrong, I do not want to question them, I trust your decisions. I’m sure they are necessary for robustness and performance. I also know the problem itself is complex and the html5shiv is basically a clever but ugly hack. But for me it’s difficult to evaluate this script for production use given there is little explanation of implementation details. It took me long to figure out how the basics of the script works. Sure, I see what it’s doing, but I’m wondering why it’s done like this. A feature list and a good code documentation would definitely help.

Stupid question, but which cases does this script try to cover and which are not covered? There are several code comments which allude to the problems you faced. For example, I saw that some elements are skipped. In practise, var form = document.createElement('form'); form.innerHTML = '<section>…</section>;' won’t work as expected. That’s okay, I’m sure you did this for good reasons. I just would have expected to be informed about that in the README because I would likely run into such issues in production code.

While the original innerShiv is an “unobtrusive” helper function, this project overwrites createElement and createDocumentFragment. I consider myself an experienced JavaScripter, but I cannot estimate the possible consequences. Apparently this has a performance impact you already try to address by caching, loop unrolling etc. Nonetheless I’m wondering whether I really want to overwrite these natives. This seems to solve some problems while introducing new ones. It’s hard to make an informed decision given that there are no in-depth articles about that topic. (Are there any?)

I took me some time to figure out that the original html5shiv which “registers” HTML5 element types via document.createElement (and frag.createElement) is located at the point where createDocumentFragment is overwritten (correct me if I’m wrong). Of course it’s your decision to write dense and highly-optimized code. I know this is jdalton’s performance optimization style as seen on lodash, for example. This is great for browser engines and end users who just link to the script without having a clue about what it actually does. But this “code obsfuscation” is practically unreadable for other JavaScript devs who need to know what this script is doing under the hood. This conflict could be solved by better code comments and additional documentation, I think.

Regards,
Mathias

Review possible `cloneNode()` bugs

Now that html5shiv uses cloneNode I think we should just review possible issues:

I know that cloneNode has some issues, we should check the jQuery source for a round up. I believe many of the issues with cloneNode may have been avoided because these are fresh elements being cloned as part of the create step instead of attempting to clone elements with attributes and things already set.

ship version 3.2

tracker: just to make we are running all tests, after closing all 3.2 issues and before calling it final 3.2.

Downloads seem to be HTML documents

I have tried downloading the recent HTML5 shiv and they appear to be copies of the GitHub page with the file embedded in a text box.

I cannot download direct using wget?

html5 elements cant be styled by @media print

Not really a bug in html5 shiv but figure its worth documenting..

just got an email from Jonathan Thérien

I just append to found a little annoying bug that people don't seem to be aware.

IE 7-8 doesn't allow HTML5 element to be styled by a @media print

@media print {
   html body #side, html body footer, html body header, html body div.filler {
    display:none;
   }
} 

My header and footer were still visible in IE 7-8. Didn't test IE6. Works well in IE9 and other browsers

I changed to normal DIV are now it work fine.

Demo: http://eld.zoop.net/HTML5_Not_Yet/

If this is true, we should document it somewhere as a limitation that will likely not be worked around.

Suggestion: Make iepp usable in footer

As we all know, adding javascript to the head is always a bad idea because it blocks the browser until the scripts are loaded. Iepp and modernizr are important for old and bad browsers ... or both. In my opinion it makes no sense to decrease performance for modern and fast browsers especially mobile devices because of browsers, that will never feel fast.

Therefor wether iepp nor modernizr should not be loaded in the head of a document. The only reason to do so is the creation of the html5 elements. Wouldn't it be useful, adding something like this, to make the shim also usable in the footer?

function shim(doc) {
    var a = -1;
    while (++a < elemsArrLen) {
        // Use createElement so IE allows HTML5-named elements in a document
        doc.createElement(elemsArr[a]);
    }
    // Reload the source of the body if necessary
    if(!!doc.body) doc.body.innerHTML=doc.body.innerHTML;
}

Effective try/catch?

I noticed this code (cropped version):

var a = document.createElement('a');
//...
supportsUnknownElements = a.childNodes.length === 1 || (function() {
  try {
    (document.createElement)('a');
  } catch(e) {
    return true;
  }
}());

My point is: if there is the possiblity of an exception, according to this try/catch, then the code would nevertheless cause a JS error, because of the above same instruction document.createElement('a').

So, when could document.createElement('a') throw an exception, if ever?

Bonus question: why the parens around (document.createElement)?

IE debug error appears when printing a page using Google Code's HTML5shiv

I keep getting debug errors with the latest version of Google Code's HTML5shiv. Here's how to reproduce the problem.

  1. Use Minify for your CSS and put @media print & @media screen queries inside (e.g. )
  2. Use the built-in script debugger in Internet Explorer.
  3. Attempt to the print the page. The following error appears:

"Line: 3
Error: Unable to get value of the property 'media': object is null or undefined"

I expect to be able to print the page properly, HTML5 elements included! 'Cause I haven't figured out that last part yet...

I'm using a native IE8 browser, Windows XP. Tried it on IE8 browsers with Vista: same error.

changelog

I'd love to see a changelog summary of whats in v3.
it could go here https://github.com/aFarkas/html5shiv/wiki

http://sandbox.thewikies.com/html5shim/changes.txt captured the v2 -> v3 changes.. can we coalesce in the 3.3 changes into a single list?

and once that's done let's ship 3.3.

For shipping I'd like:

  • changelog on the wiki
  • updates to the two downstream projects: remy's googlecode and modernizr (2.5.2)
  • tweets and fanfare!
  • my "story of" blog post updated with the past 3 months of activity.

@aFarkas can you kick this off?

Permission denied error on Internet Explorer 9

The second time the Print link is clicked on this test page in Internet Explorer 9 the following error triggers:

Line: 31
Error: Permission denied

Launching the debugger highlights the following code in iepp.js:

if(styleSheetList+'' === undefined)

Bump version number

javascript/iepp.js still says:

// iepp v1.6.2 MIT @jon_neal

…at the top. Two suggestions:

  1. Bump the version number (v2.0.0, right?)
  2. Use /*! foo */ instead of // foo since that way YUI Compressor preserves the comment.

Provide pre-minified code

Let's be honest, most web devs are going to copy and paste. I'm in the process of updating the googlecode repos to the latest code (I kinda thought I was supposed to hold off releasing "pre" - but it sounds like it's stable).

Anyway, I've remove the hotlinking, forcing users to now download - but we're lazy users and they'll want the easiest solution otherwise a lot will not bother. I'm offering up a pre-minified version of the code here, but it strikes me if I can link directly to pre-minified code on this repo - then if the user hits download from the googlecode site - it'll land here (a good thing I think we can agree).

IE8: `document.createElement` creates HTML5 elements without HTML namespace

Execute in IE8:

n = document.createElement('nav');
console.log(n.outerHTML);
// <:nav></:nav>

n = document.createElement('NAV');
console.log(n.outerHTML);
// <NAV></NAV>

The latter result is desirable; the former, undesirable. Further inspection shows that the former element has an empty scopeName, whereas the latter has HTML for its scopeName.

This seems to be an issue with calling cloneNode() on the cached copy of the nav element. cloneNode() inexplicably loses the namespace in IE8 (and I can't seem to find documentation showing that this is by design). Making the tag name all-caps bypasses the cache and produces the correct result.

I tried going through the blame/history to see when this issue may have been introduced, but it seems to have been around for a while...

JSHint: Confusing use of !

I know this is a minor nit, but I'm trying to get Modernizr to pass JSHint, and one thing it complains about is:

!(options.shivCSS === false)

This is a confusing use of '!'. Is there any reason that the code isn't just:

options.shivCSS !== false

I mean, I may just be brain dead, or there may be a great reason, or it may be nothing. I just want JSHint to shut up. Thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.