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

Added ability to extend the default html5shiv list of elements #142

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added ability to extend the default html5shiv list of elements
In order to e.g. run html5shiv over svg elements as well as the default html5 ones without having to know anything about the default list's contents.

I've left the code changes deliberately verbose in order to make it clear what's going on, but it could easily be cut down to something more concise (a couple of ternary operators should do it)
  • Loading branch information
wheresrhys committed Jan 28, 2014
commit 25fb95a1e479ea06f8d5fecf58a631589b8b16c8
14 changes: 12 additions & 2 deletions src/html5shiv.js
Original file line number Diff line number Diff line change
@@ -244,8 +244,18 @@
* @memberOf html5
* @type Array|String
*/
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',

'elements': (function () {
var elements = 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video';
if (options.elements) {
if (options.extendElementsList) {
elements = elements + ' ' + options.elements;
} else {
elements = options.elements;
}
}
return elements;
})(),

/**
* current version of html5shiv
*/