Comparing version 0.2.0 to 0.2.1
@@ -84,4 +84,4 @@ (function (global, factory) { | ||
var TextNode = (function (Node) { | ||
function TextNode(text) { | ||
var Text = (function (Node) { | ||
function Text(text) { | ||
Node.call(this, 3, '#text'); // TEXT_NODE | ||
@@ -91,7 +91,7 @@ this.textContent = this.nodeValue = text; | ||
if ( Node ) TextNode.__proto__ = Node; | ||
TextNode.prototype = Object.create( Node && Node.prototype ); | ||
TextNode.prototype.constructor = TextNode; | ||
if ( Node ) Text.__proto__ = Node; | ||
Text.prototype = Object.create( Node && Node.prototype ); | ||
Text.prototype.constructor = Text; | ||
return TextNode; | ||
return Text; | ||
}(Node)); | ||
@@ -200,3 +200,3 @@ | ||
function createTextNode(text) { | ||
return new TextNode(text); | ||
return new Text(text); | ||
} | ||
@@ -207,3 +207,3 @@ | ||
var document = new Document(); | ||
assign(document, document.defaultView = { document: document, Document: Document, Node: Node, TextNode: TextNode, Element: Element, Event: Event }); | ||
assign(document, document.defaultView = { document: document, Document: Document, Node: Node, Text: Text, Element: Element, Event: Event }); | ||
assign(document, { documentElement:document, createElement: createElement, createElementNS: createElementNS, createTextNode: createTextNode }); | ||
@@ -210,0 +210,0 @@ document.appendChild(document.body = createElement('body')); |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.undom=e()}(this,function(){function t(t,e){for(var n in e)t[n]=e[n]}function e(t){return String(t).toLowerCase()}function n(t,n){return function(o){return o.ns===t&&o.name===e(n)}}function o(t,e,n,o){var i=t?r(t,e,!0,o):-1;return~i&&(n?t.splice(i,0,n):t.splice(i,1)),i}function r(t,e,n,o){for(var r=t.length;r--&&("function"!=typeof e||o?t[r]!==e:!e(t[r])););return n?r:t[r]}function i(){function i(t){return new d(null,String(t).toUpperCase())}function u(t,e){var n=i(e);return n.namespace=t,n}function p(t){return new h(t)}function s(){var e=new a;return t(e,e.defaultView={document:e,Document:a,Node:c,TextNode:h,Element:d,Event:l}),t(e,{documentElement:e,createElement:i,createElementNS:u,createTextNode:p}),e.appendChild(e.body=i("body")),e}var c=function(t,e){this.nodeType=t,this.nodeName=e,this.childNodes=[]};c.prototype.appendChild=function(t){t.remove(),t.parentNode=this,this.childNodes.push(t),this.children&&1===t.nodeType&&this.children.push(t)},c.prototype.insertBefore=function(t,e){t.remove();var n=o(this.childNodes,e,t);if(e){if(~n&&1===t.nodeType){for(;n<this.childNodes.length&&1!==(e=this.childNodes[n]).nodeType||e===t;)n++;e&&o(this.children,e,t)}}else this.appendChild(t)},c.prototype.replaceChild=function(t,e){e.parentNode===this&&(this.insertBefore(t,e),e.remove())},c.prototype.removeChild=function(t){o(this.childNodes,t),1===t.nodeType&&o(this.children,t)},c.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)};var h=function(t){function e(e){t.call(this,3,"#text"),this.textContent=this.nodeValue=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(c),d=function(t){function i(e,n){t.call(this,e||1,n),this.attributes=[],this.children=[],this.__handlers={}}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.setAttribute=function(t,e){this.setAttributeNS(null,t,e)},i.prototype.getAttribute=function(t){return this.getAttributeNS(null,t)},i.prototype.removeAttribute=function(t){this.removeAttributeNS(null,t)},i.prototype.setAttributeNS=function(t,e,o){var i=r(this.attributes,n(t,e));i||this.attributes.push(i={ns:t,name:e}),i.value=String(o)},i.prototype.getAttributeNS=function(t,e){var o=r(this.attributes,n(t,e));return o&&o.value},i.prototype.removeAttributeNS=function(t,e){o(this.attributes,n(t,e))},i.prototype.addEventListener=function(t,n){(this.__handlers[e(t)]||(this.__handlers[e(t)]=[])).push(n)},i.prototype.removeEventListener=function(t,n){o(this.__handlers[e(t)],n,0,!0)},i.prototype.dispatchEvent=function(t){var n,o,r=t.currentTarget=this,i=t.cancelable;do if(n=r.__handlers[e(t.type)])for(o=n.length;o--&&(n[o](t)!==!1&&!t._end||!i););while(t.bubbles&&(!i||!t._stop)&&(t.target=r=r.parentNode));return!t.defaultPrevented},i}(c),a=function(t){function e(){t.call(this,9,"#document")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(d),l=function(t,e){this.type=t,this.bubbles=!!e.bubbles,this.cancelable=!!e.cancelable};return l.prototype.stopPropagation=function(){this._stop=!0},l.prototype.stopImmediatePropagation=function(){this._end=this._stop=!0},l.prototype.preventDefault=function(){this.defaultPrevented=!0},s()}return i}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.undom=e()}(this,function(){function t(t,e){for(var n in e)t[n]=e[n]}function e(t){return String(t).toLowerCase()}function n(t,n){return function(o){return o.ns===t&&o.name===e(n)}}function o(t,e,n,o){var i=t?r(t,e,!0,o):-1;return~i&&(n?t.splice(i,0,n):t.splice(i,1)),i}function r(t,e,n,o){for(var r=t.length;r--&&("function"!=typeof e||o?t[r]!==e:!e(t[r])););return n?r:t[r]}function i(){function i(t){return new d(null,String(t).toUpperCase())}function u(t,e){var n=i(e);return n.namespace=t,n}function p(t){return new h(t)}function s(){var e=new a;return t(e,e.defaultView={document:e,Document:a,Node:c,Text:h,Element:d,Event:l}),t(e,{documentElement:e,createElement:i,createElementNS:u,createTextNode:p}),e.appendChild(e.body=i("body")),e}var c=function(t,e){this.nodeType=t,this.nodeName=e,this.childNodes=[]};c.prototype.appendChild=function(t){t.remove(),t.parentNode=this,this.childNodes.push(t),this.children&&1===t.nodeType&&this.children.push(t)},c.prototype.insertBefore=function(t,e){t.remove();var n=o(this.childNodes,e,t);if(e){if(~n&&1===t.nodeType){for(;n<this.childNodes.length&&1!==(e=this.childNodes[n]).nodeType||e===t;)n++;e&&o(this.children,e,t)}}else this.appendChild(t)},c.prototype.replaceChild=function(t,e){e.parentNode===this&&(this.insertBefore(t,e),e.remove())},c.prototype.removeChild=function(t){o(this.childNodes,t),1===t.nodeType&&o(this.children,t)},c.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)};var h=function(t){function e(e){t.call(this,3,"#text"),this.textContent=this.nodeValue=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(c),d=function(t){function i(e,n){t.call(this,e||1,n),this.attributes=[],this.children=[],this.__handlers={}}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.setAttribute=function(t,e){this.setAttributeNS(null,t,e)},i.prototype.getAttribute=function(t){return this.getAttributeNS(null,t)},i.prototype.removeAttribute=function(t){this.removeAttributeNS(null,t)},i.prototype.setAttributeNS=function(t,e,o){var i=r(this.attributes,n(t,e));i||this.attributes.push(i={ns:t,name:e}),i.value=String(o)},i.prototype.getAttributeNS=function(t,e){var o=r(this.attributes,n(t,e));return o&&o.value},i.prototype.removeAttributeNS=function(t,e){o(this.attributes,n(t,e))},i.prototype.addEventListener=function(t,n){(this.__handlers[e(t)]||(this.__handlers[e(t)]=[])).push(n)},i.prototype.removeEventListener=function(t,n){o(this.__handlers[e(t)],n,0,!0)},i.prototype.dispatchEvent=function(t){var n,o,r=t.currentTarget=this,i=t.cancelable;do if(n=r.__handlers[e(t.type)])for(o=n.length;o--&&(n[o](t)!==!1&&!t._end||!i););while(t.bubbles&&(!i||!t._stop)&&(t.target=r=r.parentNode));return!t.defaultPrevented},i}(c),a=function(t){function e(){t.call(this,9,"#document")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(d),l=function(t,e){this.type=t,this.bubbles=!!e.bubbles,this.cancelable=!!e.cancelable};return l.prototype.stopPropagation=function(){this._stop=!0},l.prototype.stopImmediatePropagation=function(){this._end=this._stop=!0},l.prototype.preventDefault=function(){this.defaultPrevented=!0},s()}return i}); | ||
//# sourceMappingURL=undom.min.js.map |
{ | ||
"name": "undom", | ||
"amdName": "undom", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Minimally viable DOM Document implementation.", | ||
@@ -6,0 +6,0 @@ "main": "dist/undom.js", |
@@ -64,3 +64,3 @@ import { | ||
class TextNode extends Node { | ||
class Text extends Node { | ||
constructor(text) { | ||
@@ -163,3 +163,3 @@ super(3, '#text'); // TEXT_NODE | ||
function createTextNode(text) { | ||
return new TextNode(text); | ||
return new Text(text); | ||
} | ||
@@ -170,3 +170,3 @@ | ||
let document = new Document(); | ||
assign(document, document.defaultView = { document, Document, Node, TextNode, Element, Event }); | ||
assign(document, document.defaultView = { document, Document, Node, Text, Element, Event }); | ||
assign(document, { documentElement:document, createElement, createElementNS, createTextNode }); | ||
@@ -173,0 +173,0 @@ document.appendChild(document.body = createElement('body')); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47437