Skip to content

Commit

Permalink
Added enhance function to allow a already loaded polyfill to be added…
Browse files Browse the repository at this point in the history
… to objects dynamically added to the DOM.
  • Loading branch information
Paul Jackson authored and Paul Jackson committed Oct 13, 2012
1 parent de492c3 commit 1b8bb97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build/js/pe-ap-min.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/js/pe-ap.js
Expand Up @@ -1076,6 +1076,21 @@
pe.add._load_arr(js, msg, payload);
},
/**
* Enhances one or more elements with an already loaded polyfill
* @memberof pe.polyfills
* @param {string} poly_name Name of the polyfill
* @param {jQuery object|DOM object} objs Objects to enhance
* @function
*/
enhance: function (poly_name, objs) {
objs = (typeof objs.jquery !== 'undefined' ? objs.get() : objs);
var polyobj = this.polyfill[poly_name],
objs_len = objs.length;
while (objs_len--) {
polyobj.update($(objs[objs_len]).addClass('polyfill'));
}
},
/**
* Details for each of the polyfills.
* selector: Selector used to find elements that would be affected by the polyfill
* supported: Check for determining if polyfill is needed (false = polyfill needed). Can be either a function or a property.
Expand Down

0 comments on commit 1b8bb97

Please sign in to comment.