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

dom-render

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-render - npm Package Compare versions

Comparing version 1.0.17 to 1.0.18

38

dist/dom-render.js

@@ -160,3 +160,3 @@ 'use strict';

try {
Function("\"use strict\"; " + script + " ").bind(destUser)();
Function("\"use strict\"; " + script + "; ").bind(destUser)();
}

@@ -213,7 +213,8 @@ catch (e) {

this.procAttr(childNodes, this.attrPrefix + 'value', function (it, attribute) {
var _a;
var script = attribute;
var data = (_a = Function("\"use strict\"; " + script + " ").bind(Object.assign(obj))()) !== null && _a !== void 0 ? _a : {};
if (it.value !== data) {
it.value = data;
if (script) {
var data = ScriptUtils.evalReturn(script, obj);
if (it.value !== data) {
it.value = data;
}
}

@@ -233,3 +234,2 @@ });

if (varName) {
console.log('-->', _this.getValue(obj, varName));
var value = _this.getValue(obj, varName);

@@ -278,5 +278,7 @@ if (typeof value === 'function' && value) {

var script = attribute;
if (_this.isUsingThisVar(attribute, varName) || varName === undefined) {
if (script) {
script = 'return ' + script;
}
if (_this.isUsingThisVar(script, varName) || varName === undefined) {
var data = (_a = Function("\"use strict\"; const $target=this.$target; " + script + " ").bind(Object.assign({ $target: it }, obj))()) !== null && _a !== void 0 ? _a : {};
console.log('--', data);
for (var _i = 0, _b = Object.entries(data); _i < _b.length; _i++) {

@@ -291,3 +293,6 @@ var _c = _b[_i], key = _c[0], value = _c[1];

var script = attribute;
if (_this.isUsingThisVar(attribute, varName) || varName === undefined) {
if (script) {
script = 'return ' + script;
}
if (_this.isUsingThisVar(script, varName) || varName === undefined) {
var data = (_a = Function("\"use strict\"; const $target = this.$target; " + script + " ").bind(Object.assign({ $target: it }, obj))()) !== null && _a !== void 0 ? _a : {};

@@ -339,6 +344,8 @@ for (var _i = 0, _b = Object.entries(data); _i < _b.length; _i++) {

class_1.prototype.setValue = function (obj, name, value) {
ScriptUtils.eval("this." + name + " = this.value", { this: obj, value: value });
ScriptUtils.eval("this." + name + " = this.value", {
this: obj,
value: value
});
};
class_1.prototype.isUsingThisVar = function (raws, varName) {
console.log('isUsingV', raws, varName, ScriptUtils.getVariablePaths(raws !== null && raws !== void 0 ? raws : ''));
if (varName && raws) {

@@ -812,3 +819,2 @@ if (varName.startsWith('this.')) {

}
console.log('---targets->', fullPathStr_1);
this._targets.forEach(function (it) {

@@ -823,3 +829,2 @@ if (it.nodeType === Node.DOCUMENT_FRAGMENT_NODE || it.nodeType === Node.ELEMENT_NODE) {

DomRenderProxy.prototype.set = function (target, p, value, receiver) {
console.log('set-->', p, target, value, receiver);
if (typeof p === 'string') {

@@ -845,3 +850,8 @@ value = this.proxy(target, value, p);

else {
return target[p];
try {
return (p in target) ? target[p].bind(target) : undefined;
}
catch (e) {
return target[p];
}
}

@@ -848,0 +858,0 @@ };

@@ -99,3 +99,2 @@ "use strict";

}
console.log('---targets->', fullPathStr_1);
this._targets.forEach(function (it) {

@@ -110,3 +109,2 @@ if (it.nodeType === Node.DOCUMENT_FRAGMENT_NODE || it.nodeType === Node.ELEMENT_NODE) {

DomRenderProxy.prototype.set = function (target, p, value, receiver) {
console.log('set-->', p, target, value, receiver);
if (typeof p === 'string') {

@@ -132,3 +130,8 @@ value = this.proxy(target, value, p);

else {
return target[p];
try {
return (p in target) ? target[p].bind(target) : undefined;
}
catch (e) {
return target[p];
}
}

@@ -135,0 +138,0 @@ };

@@ -38,7 +38,8 @@ "use strict";

this.procAttr(childNodes, this.attrPrefix + 'value', function (it, attribute) {
var _a;
var script = attribute;
var data = (_a = Function("\"use strict\"; " + script + " ").bind(Object.assign(obj))()) !== null && _a !== void 0 ? _a : {};
if (it.value !== data) {
it.value = data;
if (script) {
var data = ScriptUtils_1.ScriptUtils.evalReturn(script, obj);
if (it.value !== data) {
it.value = data;
}
}

@@ -58,3 +59,2 @@ });

if (varName) {
console.log('-->', _this.getValue(obj, varName));
var value = _this.getValue(obj, varName);

@@ -103,5 +103,7 @@ if (typeof value === 'function' && value) {

var script = attribute;
if (_this.isUsingThisVar(attribute, varName) || varName === undefined) {
if (script) {
script = 'return ' + script;
}
if (_this.isUsingThisVar(script, varName) || varName === undefined) {
var data = (_a = Function("\"use strict\"; const $target=this.$target; " + script + " ").bind(Object.assign({ $target: it }, obj))()) !== null && _a !== void 0 ? _a : {};
console.log('--', data);
for (var _i = 0, _b = Object.entries(data); _i < _b.length; _i++) {

@@ -116,3 +118,6 @@ var _c = _b[_i], key = _c[0], value = _c[1];

var script = attribute;
if (_this.isUsingThisVar(attribute, varName) || varName === undefined) {
if (script) {
script = 'return ' + script;
}
if (_this.isUsingThisVar(script, varName) || varName === undefined) {
var data = (_a = Function("\"use strict\"; const $target = this.$target; " + script + " ").bind(Object.assign({ $target: it }, obj))()) !== null && _a !== void 0 ? _a : {};

@@ -164,6 +169,8 @@ for (var _i = 0, _b = Object.entries(data); _i < _b.length; _i++) {

class_1.prototype.setValue = function (obj, name, value) {
ScriptUtils_1.ScriptUtils.eval("this." + name + " = this.value", { this: obj, value: value });
ScriptUtils_1.ScriptUtils.eval("this." + name + " = this.value", {
this: obj,
value: value
});
};
class_1.prototype.isUsingThisVar = function (raws, varName) {
console.log('isUsingV', raws, varName, ScriptUtils_1.ScriptUtils.getVariablePaths(raws !== null && raws !== void 0 ? raws : ''));
if (varName && raws) {

@@ -170,0 +177,0 @@ if (varName.startsWith('this.')) {

{
"name": "dom-render",
"version": "1.0.17",
"version": "1.0.18",
"main": "DomRender.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -11,54 +11,54 @@ dom-render

<meta name="description" content="">
<title>simple-boot-front</title>
<title>dom-render</title>
</head>
<body id="app">
<h1>template</h1>
<h2>print</h2>
<div>${this.name}</div>
<div>${this.office.addr.first}, ${this.office.addr.last}, ${this.office.addr.street} (${this.office.name})</div>
<div>${this.getOfficeFullAddr()}</div>
<h2>df-if</h2>
<div dr-if="true"> true</div>
<div dr-if="this.gender==='M'"> gender: M</div>
<h2>df-for, of</h2>
<div dr-for="var i = 0; i < this.friends.length; i++"> friend</div>
<div dr-for-of="this.friends"> ${#it#.name}</div>
<div dr-for="var i = 1 ; i <= 9 ; i++" dr-it="i">
${#it#} *
<scope dr-for="var y = 1 ; y <= 9 ; y++" dr-it="y" dr-var="superIt=#it#" dr-strip="true">
#it# = ${var.superIt * #it#}
</scope>
</div>
<h1>event</h1>
<h2>dr-event, click, change, input, keyup, keydown</h2>
<div>
click: <button dr-event-click="this.name = 'name' + new Date()">click</button> <br>
change: <input type="text" dr-event-change="this.name = $target.value"> <br>
input: <input type="text" dr-event-input="this.name = $target.value"> <br>
keyup: <input type="text" dr-event-keyup="this.name = $target.value"> <br>
keydown: <input type="text" dr-event-keydown="this.name = $target.value">
</div>
<h2>dr-value, value-link</h2>
<div>
dr-value: <input type="text" dr-value="return this.office.name"> <br>
dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
</div>
<h1>attribute</h1>
<h2>dr-attr</h2>
<textarea dr-attr="return {rows: this.age/2, cols: this.age}"></textarea>
<h2>dr-style</h2>
<div dr-style="return {fontSize: this.age+'px'}"> style </div>
<button dr-event-click="this.age = Math.floor(Math.random() * 20)"> change age</button>
<h1>lifeCycle</h1>
<h2>dr-on-init</h2>
<div>
<input dr-on-init="this.onInitElement" value="init-test-value">
</div>
<script src="./src/index.ts"></script>
<h1>template</h1>
<h2>print</h2>
<div>${this.name}</div>
<div>${this.office.addr.first}, ${this.office.addr.last}, ${this.office.addr.street} (${this.office.name})</div>
<div dr="this.office.addr.street">${this.getOfficeFullAddr()}</div>
<h2>df-if</h2>
<div dr-if="true"> true</div>
<div dr-if="this.gender==='M'"> gender: M</div>
<h2>df-for, of</h2>
<div dr-for="var i = 0; i < this.friends.length; i++"> friend</div>
<div dr-for-of="this.friends"> ${#it#.name}</div>
<div dr-for="var i = 1 ; i <= 9 ; i++" dr-it="i">
${#it#} *
<scope dr-for="var y = 1 ; y <= 9 ; y++" dr-it="y" dr-var="superIt=#it#" dr-strip="true">
#it# = ${var.superIt * #it#}
</scope>
</div>
<h1>event</h1>
<h2>dr-event, click, change, input, keyup, keydown</h2>
<div>
click: <button dr-event-click="this.name = 'name' + new Date()">click</button> <br>
change: <input type="text" dr-event-change="this.name = $target.value"> <br>
input: <input type="text" dr-event-input="this.name = $target.value"> <br>
keyup: <input type="text" dr-event-keyup="this.name = $target.value"> <br>
keydown: <input type="text" dr-event-keydown="this.name = $target.value">
</div>
<h2>dr-value, value-link</h2>
<div>
dr-value: <input type="text" dr-value="this.office.name"> <br>
dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
</div>
<h1>attribute</h1>
<h2>dr-attr</h2>
<textarea dr-attr="{rows: this.age/2, cols: this.age}"></textarea>
<h2>dr-style</h2>
<div dr-style="{fontSize: this.age+'px'}"> style </div>
<button dr-event-click="this.age = Math.floor(Math.random() * 20)"> change age</button>
<h1>lifeCycle</h1>
<h2>dr-on-init</h2>
<div>
<input dr-on-init="this.onInitElement" value="init-test-value">
</div>
<script src="./src/index.ts"></script>
</body>

@@ -65,0 +65,0 @@ </html>

@@ -31,3 +31,3 @@ "use strict";

try {
Function("\"use strict\"; " + script + " ").bind(destUser)();
Function("\"use strict\"; " + script + "; ").bind(destUser)();
}

@@ -34,0 +34,0 @@ catch (e) {

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