Skip to content

Commit da94aa3

Browse files
committed
remove() polyfill for IE
1 parent 5f7d740 commit da94aa3

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

dist/jquery.scheletrone.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@
7878
7979
*/
8080

81+
//A small Element.remove() polyfill for IE
82+
//https://stackoverflow.com/questions/20428877/javascript-remove-doesnt-work-in-ie
83+
//
84+
if (!('remove' in Element.prototype)) {
85+
Element.prototype['remove'] = function () {
86+
if (this.parentNode) {
87+
this.parentNode.removeChild(this);
88+
}
89+
};
90+
}
91+
8192
var Scheletrone = function(element, options) {
8293

8394
IdElement = $(element).attr('id');

example/index3.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="container2">
2-
<img class="avatar" src="https://picsum.photos/seed/picsum/200/300">
2+
<img class="avatar" src="http://picsum.photos/id/237/255/200/">
33
<div class="content">
44
<h1 class="firstName">
55
<span>The simpsons</span>

jquery.scheletrone.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,17 @@
248248
};
249249

250250

251+
//A small Element.remove() polyfill for IE
252+
//https://stackoverflow.com/questions/20428877/javascript-remove-doesnt-work-in-ie
253+
//
254+
if (!('remove' in Element.prototype)) {
255+
Element.prototype['remove'] = function () {
256+
if (this.parentNode) {
257+
this.parentNode.removeChild(this);
258+
}
259+
};
260+
}
261+
251262

252263
////////////////////////////////////
253264
// Public methods //

src/jquery.scheletrone.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@
7878
7979
*/
8080

81+
//A small Element.remove() polyfill for IE
82+
//https://stackoverflow.com/questions/20428877/javascript-remove-doesnt-work-in-ie
83+
//
84+
if (!('remove' in Element.prototype)) {
85+
Element.prototype['remove'] = function () {
86+
if (this.parentNode) {
87+
this.parentNode.removeChild(this);
88+
}
89+
};
90+
}
91+
8192
var Scheletrone = function(element, options) {
8293

8394
IdElement = $(element).attr('id');

0 commit comments

Comments
 (0)