Permalink
Browse files

addElements option (fixes #142)

  • Loading branch information...
aFarkas committed May 3, 2014
1 parent 3ba560f commit 40df868a76f1f19ea23b123d1480d44a7195f349
Showing with 115 additions and 22 deletions.
  1. +1 −1 bower.json
  2. +24 −3 dist/html5shiv-printshiv.js
  3. +2 −2 dist/html5shiv-printshiv.min.js
  4. +25 −4 dist/html5shiv.js
  5. +2 −2 dist/html5shiv.min.js
  6. +1 −1 package.json
  7. +10 −1 readme.md
  8. +24 −3 src/html5shiv-printshiv.js
  9. +25 −4 src/html5shiv.js
  10. +1 −1 test/index.html
View
@@ -1,6 +1,6 @@
{
"name": "html5shiv",
"version": "3.7.1",
"version": "3.7.2",
"main": [
"dist/html5shiv.js"
],
@@ -1,10 +1,10 @@
/**
* @preserve HTML5 Shiv 3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
;(function(window, document) {
/*jshint evil:true */
/** version */
var version = '3.7.1';
var version = '3.7.2';
/** Preset options */
var options = window.html5 || {};
@@ -82,6 +82,24 @@
return typeof elements == 'string' ? elements.split(' ') : elements;
}
/**
* Extends the built-in list of html5 elements
* @memberOf html5
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
* @param {Document} ownerDocument The context document.
*/
function addElements(newElements, ownerDocument) {
var elements = html5.elements;
if(typeof elements != 'string'){
elements = elements.join(' ');
}
if(typeof newElements != 'string'){
newElements = newElements.join(' ');
}
html5.elements = elements +' '+ newElements;
shivDocument(ownerDocument);
}
/**
* Returns the data associated to the given document
* @private
@@ -287,7 +305,10 @@
createElement: createElement,
//creates a shived documentFragment
createDocumentFragment: createDocumentFragment
createDocumentFragment: createDocumentFragment,
//extends list of elements
addElements: addElements
};
/*--------------------------------------------------------------------------*/

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,10 +1,10 @@
/**
* @preserve HTML5 Shiv 3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
;(function(window, document) {
/*jshint evil:true */
/** version */
var version = '3.7.1';
var version = '3.7.2';
/** Preset options */
var options = window.html5 || {};
@@ -82,7 +82,25 @@
return typeof elements == 'string' ? elements.split(' ') : elements;
}
/**
/**
* Extends the built-in list of html5 elements
* @memberOf html5
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
* @param {Document} ownerDocument The context document.
*/
function addElements(newElements, ownerDocument) {
var elements = html5.elements;
if(typeof elements != 'string'){
elements = elements.join(' ');
}
if(typeof newElements != 'string'){
newElements = newElements.join(' ');
}
html5.elements = elements +' '+ newElements;
shivDocument(ownerDocument);
}
/**
* Returns the data associated to the given document
* @private
* @param {Document} ownerDocument The document.
@@ -287,7 +305,10 @@
createElement: createElement,
//creates a shived documentFragment
createDocumentFragment: createDocumentFragment
createDocumentFragment: createDocumentFragment,
//extends list of elements
addElements: addElements
};
/*--------------------------------------------------------------------------*/
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "html5shiv",
"version": "3.7.0",
"version": "3.7.2",
"repository": {
"type": "git",
"url": "https://github.com/aFarkas/html5shiv.git"
View
@@ -44,7 +44,7 @@ HTML5 Shiv works as a simple drop-in solution. In most cases there is no need to
### `html5.elements` option
The `elements` option is a space separated string or array, which describes the **full** list of the elements to shiv.
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.**
@@ -98,6 +98,15 @@ window.html5 = {
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.
```js
//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.
View
@@ -1,10 +1,10 @@
/**
* @preserve HTML5 Shiv 3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
;(function(window, document) {
/*jshint evil:true */
/** version */
var version = '3.7.1';
var version = '3.7.2';
/** Preset options */
var options = window.html5 || {};
@@ -82,6 +82,24 @@
return typeof elements == 'string' ? elements.split(' ') : elements;
}
/**
* Extends the built-in list of html5 elements
* @memberOf html5
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
* @param {Document} ownerDocument The context document.
*/
function addElements(newElements, ownerDocument) {
var elements = html5.elements;
if(typeof elements != 'string'){
elements = elements.join(' ');
}
if(typeof newElements != 'string'){
newElements = newElements.join(' ');
}
html5.elements = elements +' '+ newElements;
shivDocument(ownerDocument);
}
/**
* Returns the data associated to the given document
* @private
@@ -287,7 +305,10 @@
createElement: createElement,
//creates a shived documentFragment
createDocumentFragment: createDocumentFragment
createDocumentFragment: createDocumentFragment,
//extends list of elements
addElements: addElements
};
/*--------------------------------------------------------------------------*/
Oops, something went wrong.

0 comments on commit 40df868

Please sign in to comment.