-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use forked dialog-polyfill window.CSS bug contains && isConnected polyfills toggleAttribvute correction
- Loading branch information
Showing
6 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,8 @@ document.addEventListener('DOMContentLoaded', function () { | |
var polyfills = { | ||
dialog: { | ||
supports: 'HTMLDialogElement' in window, | ||
js: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.min.js', | ||
js: 'https://cdn.jsdelivr.net/gh/nuxodin/[email protected]/dist/dialog-polyfill.min.js', | ||
//js: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.min.js', | ||
//css: 'https://cdn.jsdelivr.net/npm/[email protected]/dialog-polyfill.css', | ||
onfound: function(el){ | ||
dialogPolyfill.registerDialog(el); | ||
|
@@ -114,4 +115,4 @@ function loadScript(path, cb, eb) { | |
|
||
|
||
|
||
}(window, document); | ||
}(window, document); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,14 +54,14 @@ addCombo('cdn.jsdelivr.net/gh/nuxodin/[email protected]/polyfills/Element/combo.js' | |
remove:1, | ||
blur:1, // to use in SVGElement: | ||
focus:1, | ||
contains:1, | ||
// contains:1, // moved to Node.prototype | ||
classList:1, | ||
getElementsByClassName:1, | ||
children:1, | ||
}, Element.prototype); | ||
|
||
/* blank object "CSS" needed */ | ||
if (!window.CSS) CSS = {}; | ||
if (!window.CSS) window.CSS = {}; | ||
var lazyfills = { | ||
Array:{ | ||
from:1, | ||
|
@@ -90,8 +90,16 @@ var lazyfills = { | |
currentScript:1, | ||
caretRangeFromPoint:1, | ||
}, | ||
Node:{ | ||
prototype:{ | ||
contains:1, | ||
isConnected:1, | ||
}, | ||
}, | ||
Element:{ | ||
toggleAttribute:1 | ||
prototype:{ | ||
toggleAttribute:1 | ||
} | ||
}, | ||
HTMLFormElement:{ | ||
prototype:{ | ||
|
@@ -237,6 +245,30 @@ function loadScriptSync(path) { | |
} | ||
} | ||
|
||
|
||
/* | ||
if (!('contains' in Node.prototype)) { | ||
Node.prototype.contains = function(el){ | ||
if (el instanceof CharacterData) { | ||
if (!el.parentNode) return false; | ||
el = el.parentNode; | ||
} | ||
if (this === el) return true; | ||
if (this instanceof Document) { | ||
return this.documentElement.contains(el) | ||
} | ||
return HTMLElement.prototype.contains.call(this, el); | ||
} | ||
} | ||
if (!('isConnected' in Node.prototype)) { | ||
Object.defineProperty(Node.prototype, 'isConnected',{ | ||
get:function(){ | ||
return this.ownerDocument.contains(this); | ||
} | ||
}) | ||
} | ||
*/ | ||
|
||
/* very small polyfills, they are not worth adding to the service */ | ||
if (!NodeList.prototype.forEach) NodeList.prototype.forEach = Array.prototype.forEach; // ie11 | ||
if (!document.scrollingElement) document.scrollingElement = document.documentElement; // ie11 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
if (!('contains' in Node.prototype)) { | ||
Node.prototype.contains = function(el){ | ||
if (el instanceof CharacterData) { | ||
if (!el.parentNode) return false; | ||
el = el.parentNode; | ||
} | ||
if (this === el) return true; | ||
if (this instanceof Document) { | ||
return this.documentElement.contains(el) | ||
} | ||
return HTMLElement.prototype.contains.call(this, el); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if (!('isConnected' in Node.prototype)) { | ||
Object.defineProperty(Node.prototype, 'isConnected',{ | ||
get:function(){ | ||
return this.ownerDocument.contains(this); | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters