Let the style function to the unknown element in IE

Source: Internet
Author: User

Sjoerd Visscher found a neat way to make styles work on unknown elements in IE-just JS to create this unknown element:

Document.createelement (ElementName)

Similarly (for IE, the HTML5 element is an unknown element), the method can also be postponed to the HTML5 element (see: John Resig wrote "HTML5 Shiv"):

<style>section {color:red;} </style>
<script>document.createelement ("section") </script>
<body>
<section>hello world!</section>
</body>

In IE, in order to make it easier to use the HTML5 element, we can introduce such a script:

Details of the specific application of the case is as follows:

    • "Moving markup towards HTML5"
    • "Test new HTML 5 Elements"

popularity:5% [?]

(function () {
from:http://dean.edwards.name/weblog/2007/03/sniff/
if (!/* @cc_on!@*/0) return;

var HTML5 = "Abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,
Eventsource,figure,footer,hgroup,header,mark,menu,meter,nav,output,
Progress,section,time,video ". Split (', ');
for (var i = 0, len = html5.length i < len; i++)
Document.createelement (Html5[i]);
}
})();



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.