Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typed-dom

Package Overview
Dependencies
Maintainers
1
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-dom - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

40

dist/typed-dom.js

@@ -1,2 +0,2 @@

/*! typed-dom v0.0.2 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */
/*! typed-dom v0.0.3 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */
define = typeof define === 'function' && define.amd

@@ -937,19 +937,4 @@ ? define

});
if (children instanceof Array === false) {
var c_1 = children;
children = Object.keys(children).reduce(function (obj, k) {
Object.defineProperty(obj, k, {
get: function () {
return c_1[k];
},
set: function (newElt) {
var oldElt = c_1[k];
c_1[k] = newElt;
raw.replaceChild(newElt.raw, oldElt.raw);
}
});
return obj;
}, {});
}
return {
children = children instanceof Array ? Object.freeze(children) : observe(children);
return Object.freeze({
raw: raw,

@@ -961,2 +946,3 @@ get contents() {

if (children instanceof Array) {
void Object.freeze(cs);
raw.innerHTML = '';

@@ -970,6 +956,22 @@ void cs.forEach(function (c) {

});
cs = observe(cs);
}
children = cs;
}
};
});
function observe(children) {
return Object.keys(children).reduce(function (obj, k) {
Object.defineProperty(obj, k, {
get: function () {
return children[k];
},
set: function (newElt) {
var oldElt = children[k];
children[k] = newElt;
raw.replaceChild(newElt.raw, oldElt.raw);
}
});
return obj;
}, {});
}
}

@@ -976,0 +978,0 @@ });

@@ -1,2 +0,2 @@

/*! typed-dom v0.0.2 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */
define="function"==typeof define&&define.amd?define:function(){"use strict";var n="typed-dom",e={};return function t(r,u,o){return o?void o.apply(this,u.map(function(n){switch(n){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===r.indexOf("/")?e[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:e[r]=e.hasOwnProperty(r)?e[r]:{};default:return".d"===n.slice(-2)&&{}||e.hasOwnProperty(n)&&e[n]||"function"==typeof require&&require(n)||self[n]}})):void t(n,r,u)}}(),define("src/builder",["require","exports"],function(n,e){"use strict";function t(n,e){void 0===e&&(e=[]);var t=n();if(void Object.keys(e).forEach(function(n){return void t.appendChild(e[n].raw)}),e instanceof Array==!1){var r=e;e=Object.keys(e).reduce(function(n,e){return Object.defineProperty(n,e,{get:function(){return r[e]},set:function(n){var u=r[e];r[e]=n,t.replaceChild(n.raw,u.raw)}}),n},{})}return{raw:t,get contents(){return e},set contents(n){e instanceof Array?(t.innerHTML="",void n.forEach(function(n){return void t.appendChild(n.raw)})):void Object.keys(n).forEach(function(r){return void t.replaceChild(n[r].raw,e[r].raw)}),e=n}}}e.TypedHTML={a:function(n,e){return void 0===e&&(e=function(){return document.createElement("a")}),t(e,n)},abbr:function(n,e){return void 0===e&&(e=function(){return document.createElement("abbr")}),t(e,n)},acronym:function(n,e){return void 0===e&&(e=function(){return document.createElement("acronym")}),t(e,n)},address:function(n,e){return void 0===e&&(e=function(){return document.createElement("address")}),t(e,n)},applet:function(n,e){return void 0===e&&(e=function(){return document.createElement("applet")}),t(e,n)},area:function(n,e){return void 0===e&&(e=function(){return document.createElement("area")}),t(e,n)},audio:function(n,e){return void 0===e&&(e=function(){return document.createElement("audio")}),t(e,n)},b:function(n,e){return void 0===e&&(e=function(){return document.createElement("b")}),t(e,n)},base:function(n,e){return void 0===e&&(e=function(){return document.createElement("base")}),t(e,n)},basefont:function(n,e){return void 0===e&&(e=function(){return document.createElement("basefont")}),t(e,n)},bdo:function(n,e){return void 0===e&&(e=function(){return document.createElement("bdo")}),t(e,n)},big:function(n,e){return void 0===e&&(e=function(){return document.createElement("big")}),t(e,n)},blockquote:function(n,e){return void 0===e&&(e=function(){return document.createElement("blockquote")}),t(e,n)},body:function(n,e){return void 0===e&&(e=function(){return document.createElement("body")}),t(e,n)},br:function(n,e){return void 0===e&&(e=function(){return document.createElement("br")}),t(e,n)},button:function(n,e){return void 0===e&&(e=function(){return document.createElement("button")}),t(e,n)},canvas:function(n,e){return void 0===e&&(e=function(){return document.createElement("canvas")}),t(e,n)},caption:function(n,e){return void 0===e&&(e=function(){return document.createElement("caption")}),t(e,n)},center:function(n,e){return void 0===e&&(e=function(){return document.createElement("center")}),t(e,n)},cite:function(n,e){return void 0===e&&(e=function(){return document.createElement("cite")}),t(e,n)},code:function(n,e){return void 0===e&&(e=function(){return document.createElement("code")}),t(e,n)},col:function(n,e){return void 0===e&&(e=function(){return document.createElement("col")}),t(e,n)},colgroup:function(n,e){return void 0===e&&(e=function(){return document.createElement("colgroup")}),t(e,n)},datalist:function(n,e){return void 0===e&&(e=function(){return document.createElement("datalist")}),t(e,n)},dd:function(n,e){return void 0===e&&(e=function(){return document.createElement("dd")}),t(e,n)},del:function(n,e){return void 0===e&&(e=function(){return document.createElement("del")}),t(e,n)},dfn:function(n,e){return void 0===e&&(e=function(){return document.createElement("dfn")}),t(e,n)},dir:function(n,e){return void 0===e&&(e=function(){return document.createElement("dir")}),t(e,n)},div:function(n,e){return void 0===e&&(e=function(){return document.createElement("div")}),t(e,n)},dl:function(n,e){return void 0===e&&(e=function(){return document.createElement("dl")}),t(e,n)},dt:function(n,e){return void 0===e&&(e=function(){return document.createElement("dt")}),t(e,n)},em:function(n,e){return void 0===e&&(e=function(){return document.createElement("em")}),t(e,n)},embed:function(n,e){return void 0===e&&(e=function(){return document.createElement("embed")}),t(e,n)},fieldset:function(n,e){return void 0===e&&(e=function(){return document.createElement("fieldset")}),t(e,n)},font:function(n,e){return void 0===e&&(e=function(){return document.createElement("font")}),t(e,n)},form:function(n,e){return void 0===e&&(e=function(){return document.createElement("form")}),t(e,n)},frame:function(n,e){return void 0===e&&(e=function(){return document.createElement("frame")}),t(e,n)},frameset:function(n,e){return void 0===e&&(e=function(){return document.createElement("frameset")}),t(e,n)},h1:function(n,e){return void 0===e&&(e=function(){return document.createElement("h1")}),t(e,n)},h2:function(n,e){return void 0===e&&(e=function(){return document.createElement("h2")}),t(e,n)},h3:function(n,e){return void 0===e&&(e=function(){return document.createElement("h3")}),t(e,n)},h4:function(n,e){return void 0===e&&(e=function(){return document.createElement("h4")}),t(e,n)},h5:function(n,e){return void 0===e&&(e=function(){return document.createElement("h5")}),t(e,n)},h6:function(n,e){return void 0===e&&(e=function(){return document.createElement("h6")}),t(e,n)},head:function(n,e){return void 0===e&&(e=function(){return document.createElement("head")}),t(e,n)},hr:function(n,e){return void 0===e&&(e=function(){return document.createElement("hr")}),t(e,n)},html:function(n,e){return void 0===e&&(e=function(){return document.createElement("html")}),t(e,n)},i:function(n,e){return void 0===e&&(e=function(){return document.createElement("i")}),t(e,n)},iframe:function(n,e){return void 0===e&&(e=function(){return document.createElement("iframe")}),t(e,n)},img:function(n,e){return void 0===e&&(e=function(){return document.createElement("img")}),t(e,n)},input:function(n,e){return void 0===e&&(e=function(){return document.createElement("input")}),t(e,n)},ins:function(n,e){return void 0===e&&(e=function(){return document.createElement("ins")}),t(e,n)},isindex:function(n,e){return void 0===e&&(e=function(){return document.createElement("isindex")}),t(e,n)},kbd:function(n,e){return void 0===e&&(e=function(){return document.createElement("kbd")}),t(e,n)},keygen:function(n,e){return void 0===e&&(e=function(){return document.createElement("keygen")}),t(e,n)},label:function(n,e){return void 0===e&&(e=function(){return document.createElement("label")}),t(e,n)},legend:function(n,e){return void 0===e&&(e=function(){return document.createElement("legend")}),t(e,n)},li:function(n,e){return void 0===e&&(e=function(){return document.createElement("li")}),t(e,n)},link:function(n,e){return void 0===e&&(e=function(){return document.createElement("link")}),t(e,n)},listing:function(n,e){return void 0===e&&(e=function(){return document.createElement("listing")}),t(e,n)},map:function(n,e){return void 0===e&&(e=function(){return document.createElement("map")}),t(e,n)},marquee:function(n,e){return void 0===e&&(e=function(){return document.createElement("marquee")}),t(e,n)},menu:function(n,e){return void 0===e&&(e=function(){return document.createElement("menu")}),t(e,n)},meta:function(n,e){return void 0===e&&(e=function(){return document.createElement("meta")}),t(e,n)},nextid:function(n,e){return void 0===e&&(e=function(){return document.createElement("nextid")}),t(e,n)},nobr:function(n,e){return void 0===e&&(e=function(){return document.createElement("nobr")}),t(e,n)},object:function(n,e){return void 0===e&&(e=function(){return document.createElement("object")}),t(e,n)},ol:function(n,e){return void 0===e&&(e=function(){return document.createElement("ol")}),t(e,n)},optgroup:function(n,e){return void 0===e&&(e=function(){return document.createElement("optgroup")}),t(e,n)},option:function(n,e){return void 0===e&&(e=function(){return document.createElement("option")}),t(e,n)},p:function(n,e){return void 0===e&&(e=function(){return document.createElement("p")}),t(e,n)},param:function(n,e){return void 0===e&&(e=function(){return document.createElement("param")}),t(e,n)},picture:function(n,e){return void 0===e&&(e=function(){return document.createElement("picture")}),t(e,n)},plaintext:function(n,e){return void 0===e&&(e=function(){return document.createElement("plaintext")}),t(e,n)},pre:function(n,e){return void 0===e&&(e=function(){return document.createElement("pre")}),t(e,n)},progress:function(n,e){return void 0===e&&(e=function(){return document.createElement("progress")}),t(e,n)},q:function(n,e){return void 0===e&&(e=function(){return document.createElement("q")}),t(e,n)},rt:function(n,e){return void 0===e&&(e=function(){return document.createElement("rt")}),t(e,n)},ruby:function(n,e){return void 0===e&&(e=function(){return document.createElement("ruby")}),t(e,n)},s:function(n,e){return void 0===e&&(e=function(){return document.createElement("s")}),t(e,n)},samp:function(n,e){return void 0===e&&(e=function(){return document.createElement("samp")}),t(e,n)},script:function(n,e){return void 0===e&&(e=function(){return document.createElement("script")}),t(e,n)},select:function(n,e){return void 0===e&&(e=function(){return document.createElement("select")}),t(e,n)},small:function(n,e){return void 0===e&&(e=function(){return document.createElement("small")}),t(e,n)},source:function(n,e){return void 0===e&&(e=function(){return document.createElement("source")}),t(e,n)},span:function(n,e){return void 0===e&&(e=function(){return document.createElement("span")}),t(e,n)},strike:function(n,e){return void 0===e&&(e=function(){return document.createElement("strike")}),t(e,n)},strong:function(n,e){return void 0===e&&(e=function(){return document.createElement("strong")}),t(e,n)},style:function(n,e){return void 0===e&&(e=function(){return document.createElement("style")}),t(e,n)},sub:function(n,e){return void 0===e&&(e=function(){return document.createElement("sub")}),t(e,n)},sup:function(n,e){return void 0===e&&(e=function(){return document.createElement("sup")}),t(e,n)},table:function(n,e){return void 0===e&&(e=function(){return document.createElement("table")}),t(e,n)},tbody:function(n,e){return void 0===e&&(e=function(){return document.createElement("tbody")}),t(e,n)},td:function(n,e){return void 0===e&&(e=function(){return document.createElement("td")}),t(e,n)},textarea:function(n,e){return void 0===e&&(e=function(){return document.createElement("textarea")}),t(e,n)},tfoot:function(n,e){return void 0===e&&(e=function(){return document.createElement("tfoot")}),t(e,n)},th:function(n,e){return void 0===e&&(e=function(){return document.createElement("th")}),t(e,n)},thead:function(n,e){return void 0===e&&(e=function(){return document.createElement("thead")}),t(e,n)},title:function(n,e){return void 0===e&&(e=function(){return document.createElement("title")}),t(e,n)},tr:function(n,e){return void 0===e&&(e=function(){return document.createElement("tr")}),t(e,n)},track:function(n,e){return void 0===e&&(e=function(){return document.createElement("track")}),t(e,n)},tt:function(n,e){return void 0===e&&(e=function(){return document.createElement("tt")}),t(e,n)},u:function(n,e){return void 0===e&&(e=function(){return document.createElement("u")}),t(e,n)},ul:function(n,e){return void 0===e&&(e=function(){return document.createElement("ul")}),t(e,n)},"var":function(n,e){return void 0===e&&(e=function(){return document.createElement("var")}),t(e,n)},video:function(n,e){return void 0===e&&(e=function(){return document.createElement("video")}),t(e,n)},xmp:function(n,e){return void 0===e&&(e=function(){return document.createElement("xmp")}),t(e,n)},article:function(n,e){return void 0===e&&(e=function(){return document.createElement("article")}),t(e,n)},aside:function(n,e){return void 0===e&&(e=function(){return document.createElement("aside")}),t(e,n)},nav:function(n,e){return void 0===e&&(e=function(){return document.createElement("nav")}),t(e,n)},section:function(n,e){return void 0===e&&(e=function(){return document.createElement("section")}),t(e,n)},untyped:function(n,e){return t(e,n)}}}),define("src/export",["require","exports","src/builder"],function(n,e,t){"use strict";e["default"]=t.TypedHTML}),define("typed-dom",["require","exports","src/export","src/export"],function(n,e,t,r){"use strict";function u(n){for(var t in n)e.hasOwnProperty(t)||(e[t]=n[t])}u(t),e["default"]=r["default"]});
/*! typed-dom v0.0.3 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */
define="function"==typeof define&&define.amd?define:function(){"use strict";var n="typed-dom",e={};return function t(r,u,o){return o?void o.apply(this,u.map(function(n){switch(n){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===r.indexOf("/")?e[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:e[r]=e.hasOwnProperty(r)?e[r]:{};default:return".d"===n.slice(-2)&&{}||e.hasOwnProperty(n)&&e[n]||"function"==typeof require&&require(n)||self[n]}})):void t(n,r,u)}}(),define("src/builder",["require","exports"],function(n,e){"use strict";function t(n,e){function t(n){return Object.keys(n).reduce(function(e,t){return Object.defineProperty(e,t,{get:function(){return n[t]},set:function(e){var u=n[t];n[t]=e,r.replaceChild(e.raw,u.raw)}}),e},{})}void 0===e&&(e=[]);var r=n();return void Object.keys(e).forEach(function(n){return void r.appendChild(e[n].raw)}),e=e instanceof Array?Object.freeze(e):t(e),Object.freeze({raw:r,get contents(){return e},set contents(n){e instanceof Array?(void Object.freeze(n),r.innerHTML="",void n.forEach(function(n){return void r.appendChild(n.raw)})):(void Object.keys(n).forEach(function(t){return void r.replaceChild(n[t].raw,e[t].raw)}),n=t(n)),e=n}})}e.TypedHTML={a:function(n,e){return void 0===e&&(e=function(){return document.createElement("a")}),t(e,n)},abbr:function(n,e){return void 0===e&&(e=function(){return document.createElement("abbr")}),t(e,n)},acronym:function(n,e){return void 0===e&&(e=function(){return document.createElement("acronym")}),t(e,n)},address:function(n,e){return void 0===e&&(e=function(){return document.createElement("address")}),t(e,n)},applet:function(n,e){return void 0===e&&(e=function(){return document.createElement("applet")}),t(e,n)},area:function(n,e){return void 0===e&&(e=function(){return document.createElement("area")}),t(e,n)},audio:function(n,e){return void 0===e&&(e=function(){return document.createElement("audio")}),t(e,n)},b:function(n,e){return void 0===e&&(e=function(){return document.createElement("b")}),t(e,n)},base:function(n,e){return void 0===e&&(e=function(){return document.createElement("base")}),t(e,n)},basefont:function(n,e){return void 0===e&&(e=function(){return document.createElement("basefont")}),t(e,n)},bdo:function(n,e){return void 0===e&&(e=function(){return document.createElement("bdo")}),t(e,n)},big:function(n,e){return void 0===e&&(e=function(){return document.createElement("big")}),t(e,n)},blockquote:function(n,e){return void 0===e&&(e=function(){return document.createElement("blockquote")}),t(e,n)},body:function(n,e){return void 0===e&&(e=function(){return document.createElement("body")}),t(e,n)},br:function(n,e){return void 0===e&&(e=function(){return document.createElement("br")}),t(e,n)},button:function(n,e){return void 0===e&&(e=function(){return document.createElement("button")}),t(e,n)},canvas:function(n,e){return void 0===e&&(e=function(){return document.createElement("canvas")}),t(e,n)},caption:function(n,e){return void 0===e&&(e=function(){return document.createElement("caption")}),t(e,n)},center:function(n,e){return void 0===e&&(e=function(){return document.createElement("center")}),t(e,n)},cite:function(n,e){return void 0===e&&(e=function(){return document.createElement("cite")}),t(e,n)},code:function(n,e){return void 0===e&&(e=function(){return document.createElement("code")}),t(e,n)},col:function(n,e){return void 0===e&&(e=function(){return document.createElement("col")}),t(e,n)},colgroup:function(n,e){return void 0===e&&(e=function(){return document.createElement("colgroup")}),t(e,n)},datalist:function(n,e){return void 0===e&&(e=function(){return document.createElement("datalist")}),t(e,n)},dd:function(n,e){return void 0===e&&(e=function(){return document.createElement("dd")}),t(e,n)},del:function(n,e){return void 0===e&&(e=function(){return document.createElement("del")}),t(e,n)},dfn:function(n,e){return void 0===e&&(e=function(){return document.createElement("dfn")}),t(e,n)},dir:function(n,e){return void 0===e&&(e=function(){return document.createElement("dir")}),t(e,n)},div:function(n,e){return void 0===e&&(e=function(){return document.createElement("div")}),t(e,n)},dl:function(n,e){return void 0===e&&(e=function(){return document.createElement("dl")}),t(e,n)},dt:function(n,e){return void 0===e&&(e=function(){return document.createElement("dt")}),t(e,n)},em:function(n,e){return void 0===e&&(e=function(){return document.createElement("em")}),t(e,n)},embed:function(n,e){return void 0===e&&(e=function(){return document.createElement("embed")}),t(e,n)},fieldset:function(n,e){return void 0===e&&(e=function(){return document.createElement("fieldset")}),t(e,n)},font:function(n,e){return void 0===e&&(e=function(){return document.createElement("font")}),t(e,n)},form:function(n,e){return void 0===e&&(e=function(){return document.createElement("form")}),t(e,n)},frame:function(n,e){return void 0===e&&(e=function(){return document.createElement("frame")}),t(e,n)},frameset:function(n,e){return void 0===e&&(e=function(){return document.createElement("frameset")}),t(e,n)},h1:function(n,e){return void 0===e&&(e=function(){return document.createElement("h1")}),t(e,n)},h2:function(n,e){return void 0===e&&(e=function(){return document.createElement("h2")}),t(e,n)},h3:function(n,e){return void 0===e&&(e=function(){return document.createElement("h3")}),t(e,n)},h4:function(n,e){return void 0===e&&(e=function(){return document.createElement("h4")}),t(e,n)},h5:function(n,e){return void 0===e&&(e=function(){return document.createElement("h5")}),t(e,n)},h6:function(n,e){return void 0===e&&(e=function(){return document.createElement("h6")}),t(e,n)},head:function(n,e){return void 0===e&&(e=function(){return document.createElement("head")}),t(e,n)},hr:function(n,e){return void 0===e&&(e=function(){return document.createElement("hr")}),t(e,n)},html:function(n,e){return void 0===e&&(e=function(){return document.createElement("html")}),t(e,n)},i:function(n,e){return void 0===e&&(e=function(){return document.createElement("i")}),t(e,n)},iframe:function(n,e){return void 0===e&&(e=function(){return document.createElement("iframe")}),t(e,n)},img:function(n,e){return void 0===e&&(e=function(){return document.createElement("img")}),t(e,n)},input:function(n,e){return void 0===e&&(e=function(){return document.createElement("input")}),t(e,n)},ins:function(n,e){return void 0===e&&(e=function(){return document.createElement("ins")}),t(e,n)},isindex:function(n,e){return void 0===e&&(e=function(){return document.createElement("isindex")}),t(e,n)},kbd:function(n,e){return void 0===e&&(e=function(){return document.createElement("kbd")}),t(e,n)},keygen:function(n,e){return void 0===e&&(e=function(){return document.createElement("keygen")}),t(e,n)},label:function(n,e){return void 0===e&&(e=function(){return document.createElement("label")}),t(e,n)},legend:function(n,e){return void 0===e&&(e=function(){return document.createElement("legend")}),t(e,n)},li:function(n,e){return void 0===e&&(e=function(){return document.createElement("li")}),t(e,n)},link:function(n,e){return void 0===e&&(e=function(){return document.createElement("link")}),t(e,n)},listing:function(n,e){return void 0===e&&(e=function(){return document.createElement("listing")}),t(e,n)},map:function(n,e){return void 0===e&&(e=function(){return document.createElement("map")}),t(e,n)},marquee:function(n,e){return void 0===e&&(e=function(){return document.createElement("marquee")}),t(e,n)},menu:function(n,e){return void 0===e&&(e=function(){return document.createElement("menu")}),t(e,n)},meta:function(n,e){return void 0===e&&(e=function(){return document.createElement("meta")}),t(e,n)},nextid:function(n,e){return void 0===e&&(e=function(){return document.createElement("nextid")}),t(e,n)},nobr:function(n,e){return void 0===e&&(e=function(){return document.createElement("nobr")}),t(e,n)},object:function(n,e){return void 0===e&&(e=function(){return document.createElement("object")}),t(e,n)},ol:function(n,e){return void 0===e&&(e=function(){return document.createElement("ol")}),t(e,n)},optgroup:function(n,e){return void 0===e&&(e=function(){return document.createElement("optgroup")}),t(e,n)},option:function(n,e){return void 0===e&&(e=function(){return document.createElement("option")}),t(e,n)},p:function(n,e){return void 0===e&&(e=function(){return document.createElement("p")}),t(e,n)},param:function(n,e){return void 0===e&&(e=function(){return document.createElement("param")}),t(e,n)},picture:function(n,e){return void 0===e&&(e=function(){return document.createElement("picture")}),t(e,n)},plaintext:function(n,e){return void 0===e&&(e=function(){return document.createElement("plaintext")}),t(e,n)},pre:function(n,e){return void 0===e&&(e=function(){return document.createElement("pre")}),t(e,n)},progress:function(n,e){return void 0===e&&(e=function(){return document.createElement("progress")}),t(e,n)},q:function(n,e){return void 0===e&&(e=function(){return document.createElement("q")}),t(e,n)},rt:function(n,e){return void 0===e&&(e=function(){return document.createElement("rt")}),t(e,n)},ruby:function(n,e){return void 0===e&&(e=function(){return document.createElement("ruby")}),t(e,n)},s:function(n,e){return void 0===e&&(e=function(){return document.createElement("s")}),t(e,n)},samp:function(n,e){return void 0===e&&(e=function(){return document.createElement("samp")}),t(e,n)},script:function(n,e){return void 0===e&&(e=function(){return document.createElement("script")}),t(e,n)},select:function(n,e){return void 0===e&&(e=function(){return document.createElement("select")}),t(e,n)},small:function(n,e){return void 0===e&&(e=function(){return document.createElement("small")}),t(e,n)},source:function(n,e){return void 0===e&&(e=function(){return document.createElement("source")}),t(e,n)},span:function(n,e){return void 0===e&&(e=function(){return document.createElement("span")}),t(e,n)},strike:function(n,e){return void 0===e&&(e=function(){return document.createElement("strike")}),t(e,n)},strong:function(n,e){return void 0===e&&(e=function(){return document.createElement("strong")}),t(e,n)},style:function(n,e){return void 0===e&&(e=function(){return document.createElement("style")}),t(e,n)},sub:function(n,e){return void 0===e&&(e=function(){return document.createElement("sub")}),t(e,n)},sup:function(n,e){return void 0===e&&(e=function(){return document.createElement("sup")}),t(e,n)},table:function(n,e){return void 0===e&&(e=function(){return document.createElement("table")}),t(e,n)},tbody:function(n,e){return void 0===e&&(e=function(){return document.createElement("tbody")}),t(e,n)},td:function(n,e){return void 0===e&&(e=function(){return document.createElement("td")}),t(e,n)},textarea:function(n,e){return void 0===e&&(e=function(){return document.createElement("textarea")}),t(e,n)},tfoot:function(n,e){return void 0===e&&(e=function(){return document.createElement("tfoot")}),t(e,n)},th:function(n,e){return void 0===e&&(e=function(){return document.createElement("th")}),t(e,n)},thead:function(n,e){return void 0===e&&(e=function(){return document.createElement("thead")}),t(e,n)},title:function(n,e){return void 0===e&&(e=function(){return document.createElement("title")}),t(e,n)},tr:function(n,e){return void 0===e&&(e=function(){return document.createElement("tr")}),t(e,n)},track:function(n,e){return void 0===e&&(e=function(){return document.createElement("track")}),t(e,n)},tt:function(n,e){return void 0===e&&(e=function(){return document.createElement("tt")}),t(e,n)},u:function(n,e){return void 0===e&&(e=function(){return document.createElement("u")}),t(e,n)},ul:function(n,e){return void 0===e&&(e=function(){return document.createElement("ul")}),t(e,n)},"var":function(n,e){return void 0===e&&(e=function(){return document.createElement("var")}),t(e,n)},video:function(n,e){return void 0===e&&(e=function(){return document.createElement("video")}),t(e,n)},xmp:function(n,e){return void 0===e&&(e=function(){return document.createElement("xmp")}),t(e,n)},article:function(n,e){return void 0===e&&(e=function(){return document.createElement("article")}),t(e,n)},aside:function(n,e){return void 0===e&&(e=function(){return document.createElement("aside")}),t(e,n)},nav:function(n,e){return void 0===e&&(e=function(){return document.createElement("nav")}),t(e,n)},section:function(n,e){return void 0===e&&(e=function(){return document.createElement("section")}),t(e,n)},untyped:function(n,e){return t(e,n)}}}),define("src/export",["require","exports","src/builder"],function(n,e,t){"use strict";e["default"]=t.TypedHTML}),define("typed-dom",["require","exports","src/export","src/export"],function(n,e,t,r){"use strict";function u(n){for(var t in n)e.hasOwnProperty(t)||(e[t]=n[t])}u(t),e["default"]=r["default"]});
{
"name": "typed-dom",
"version": "0.0.2",
"version": "0.0.3",
"description": "Typed html dom structs.",

@@ -5,0 +5,0 @@ "private": false,

@@ -682,22 +682,8 @@ import {default as Builder, TypedHTMLElement, TypedHTMLElementChildren} from 'typed-dom';

.forEach(k => void raw.appendChild(children[k].raw));
if (children instanceof Array === false) {
const c = children;
children = Object.keys(children)
.reduce((obj, k) => {
Object.defineProperty(obj, k, {
get() {
return c[k];
},
set(newElt) {
const oldElt = c[k];
c[k] = newElt;
raw.replaceChild(newElt.raw, oldElt.raw);
}
});
return obj;
}, <typeof children>{});
}
return {
children = children instanceof Array
? Object.freeze(children)
: observe(children);
return Object.freeze({
raw,
get contents(): typeof children {
get contents(): U {
return children;

@@ -707,2 +693,3 @@ },

if (children instanceof Array) {
void Object.freeze(cs);
raw.innerHTML = '';

@@ -715,6 +702,24 @@ void (<any[]><any>cs)

.forEach(k => void raw.replaceChild(cs[k].raw, children[k].raw));
cs = observe(cs);
}
children = cs;
}
};
});
function observe(children: U): U {
return Object.keys(children)
.reduce((obj, k) => {
Object.defineProperty(obj, k, {
get() {
return children[k];
},
set(newElt) {
const oldElt = children[k];
children[k] = newElt;
raw.replaceChild(newElt.raw, oldElt.raw);
}
});
return obj;
}, <U>{});
}
}
import TypedHTML from 'typed-dom';
describe('Integration: TypedHTML', function () {
describe('usage', function () {
describe('spec', function () {
it('struct', function () {
const struct = TypedHTML.div({
const struct = TypedHTML.article({
title: TypedHTML.h1(),
list: TypedHTML.ul([TypedHTML.li()])
content: TypedHTML.p()
});
assert(struct.raw.nodeName === 'DIV');
assert(struct.raw.firstChild === struct.contents.title.raw);
assert(struct.raw.nodeName === 'ARTICLE');
assert(struct.contents.title.raw === struct.raw.firstChild);
assert(struct.contents.title.raw.nodeName === 'H1');
assert(struct.contents.list.raw.nodeName === 'UL');
assert(struct.contents.list.contents[0].raw.nodeName === 'LI');
assert(struct.contents.content.raw.nodeName === 'P');
});
struct.contents.title = TypedHTML.h2();
assert(struct.raw.children[0].nodeName === 'H2');
assert(struct.contents.title.raw.nodeName === 'H2');
it('struct contents update', function () {
const struct = TypedHTML.article({
title: TypedHTML.h1()
});
struct.contents = {
title: TypedHTML.h1(),
list: TypedHTML.ul([TypedHTML.li()])
title: TypedHTML.h2()
};
assert(struct.raw.children[0].nodeName === 'H1');
assert(struct.contents.title.raw.nodeName === 'H1');
assert(struct.raw.children[0].nodeName === 'H2');
assert(struct.contents.title.raw === struct.raw.children[0]);
});
it('struct contents partial update', function () {
const struct = TypedHTML.article({
title: TypedHTML.h1()
});
struct.contents.title = TypedHTML.h2();
assert(struct.raw.children[0].nodeName === 'H2');
assert(struct.contents.title.raw === struct.raw.children[0]);
});
it('list', function () {
const list = TypedHTML.p([TypedHTML.a()]);
assert(list.raw.nodeName === 'P');
assert(list.contents[0].raw.nodeName === 'A');
assert(list.contents[0].contents[0] === void 0);
assert(list.contents[1] === void 0);
const list = TypedHTML.ul([
TypedHTML.li(),
TypedHTML.li()
]);
assert(list.raw.nodeName === 'UL');
assert(list.raw.children[0].nodeName === 'LI');
assert(list.contents[0].raw === list.raw.children[0]);
assert(list.raw.children[1].nodeName === 'LI');
assert(list.contents[1].raw === list.raw.children[1]);
assert(list.contents[2] === void 0 && list.raw.children[2] === void 0);
});
list.contents = [TypedHTML.a(), TypedHTML.a()];
assert(list.raw.children[1].nodeName === 'A');
assert(list.contents[1].raw.nodeName === 'A');
it('list contents update', function () {
const list = TypedHTML.ul([
TypedHTML.li(),
TypedHTML.li()
]);
list.contents = [
TypedHTML.li()
];
assert(list.raw.children[0].nodeName === 'LI');
assert(list.contents[0].raw === list.raw.children[0]);
assert(list.contents[1] === void 0 && list.raw.children[1] === void 0);
});

@@ -38,0 +61,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc