dom-render
Advanced tools
Comparing version 1.0.27 to 1.0.28
@@ -693,33 +693,5 @@ 'use strict'; | ||
}; | ||
RawSet.drDVarEncoding = function (element, drVarOption) { | ||
var _a; | ||
var vars = ((_a = drVarOption === null || drVarOption === void 0 ? void 0 : drVarOption.split(',')) !== null && _a !== void 0 ? _a : []).map(function (it) { | ||
var s = it.trim().split('='); | ||
return { | ||
name: s[0], | ||
value: s[1], | ||
regex: RegExp('(?<!(dr-|\\.))var\\.' + s[0] + '(?=.?)', 'g'), | ||
random: RandomUtils.uuid() | ||
}; | ||
}); | ||
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) { | ||
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) { | ||
it.innerHTML = it.innerHTML.replace(vit.regex, vit.random); | ||
}); | ||
}); | ||
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) { | ||
element.innerHTML = element.innerHTML.replace(vit.regex, vit.value); | ||
}); | ||
return vars; | ||
}; | ||
RawSet.drDVarDecoding = function (element, vars) { | ||
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) { | ||
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) { | ||
it.innerHTML = it.innerHTML.replace(RegExp(vit.random, 'g'), vit.value); | ||
}); | ||
}); | ||
}; | ||
RawSet.drThisEncoding = function (element, drThis) { | ||
var thisRandom = RandomUtils.uuid(); | ||
var thisRegex = /(?<!(dr-|\.))this(?=.?)/g; | ||
var thisRegex = /[^(dr\-)]this(?=.?)/g; | ||
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) { | ||
@@ -729,2 +701,3 @@ it.innerHTML = it.innerHTML.replace(thisRegex, thisRandom); | ||
element.innerHTML = element.innerHTML.replace(thisRegex, drThis); | ||
alert(1); | ||
return thisRandom; | ||
@@ -744,3 +717,3 @@ }; | ||
value: s[1], | ||
regex: RegExp('(?<!(dr-|\\.))var\\.' + s[0] + '(?=.?)', 'g'), | ||
regex: RegExp('var\\.' + s[0] + '(?=.?)', 'g'), | ||
random: RandomUtils.uuid() | ||
@@ -794,2 +767,8 @@ }; | ||
var Shield = (function () { | ||
function Shield() { | ||
} | ||
return Shield; | ||
}()); | ||
var DomRenderProxy = (function () { | ||
@@ -824,3 +803,3 @@ function DomRenderProxy(_domRender_origin, target, config) { | ||
var target = obj[it]; | ||
if (target !== undefined && target !== null && typeof target === 'object' && !DomRenderProxy.isFinal(target) && !Object.isFrozen(target)) { | ||
if (target !== undefined && target !== null && typeof target === 'object' && !DomRenderProxy.isFinal(target) && !Object.isFrozen(target) && !(obj instanceof Shield)) { | ||
var filter = (_c = (_b = (_a = _this.config) === null || _a === void 0 ? void 0 : _a.proxyExcludeTyps) === null || _b === void 0 ? void 0 : _b.filter(function (it) { return target instanceof it; })) !== null && _c !== void 0 ? _c : []; | ||
@@ -942,3 +921,3 @@ if (filter.length === 0) { | ||
DomRenderProxy.prototype.proxy = function (parentProxy, obj, p) { | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && !('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj)) { | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && !('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj) && !(obj instanceof Shield)) { | ||
var domRender = new DomRenderProxy(obj, undefined, this.config); | ||
@@ -950,3 +929,3 @@ domRender.addRef(parentProxy, p); | ||
} | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && ('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj)) { | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && ('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj) && !(obj instanceof Shield)) { | ||
var d = obj._DomRender_proxy; | ||
@@ -953,0 +932,0 @@ d.addRef(this._domRender_proxy, p); |
@@ -7,2 +7,3 @@ "use strict"; | ||
var ScriptUtils_1 = require("./utils/script/ScriptUtils"); | ||
var Shield_1 = require("./Shield"); | ||
var DomRenderProxy = (function () { | ||
@@ -37,3 +38,3 @@ function DomRenderProxy(_domRender_origin, target, config) { | ||
var target = obj[it]; | ||
if (target !== undefined && target !== null && typeof target === 'object' && !DomRenderProxy.isFinal(target) && !Object.isFrozen(target)) { | ||
if (target !== undefined && target !== null && typeof target === 'object' && !DomRenderProxy.isFinal(target) && !Object.isFrozen(target) && !(obj instanceof Shield_1.Shield)) { | ||
var filter = (_c = (_b = (_a = _this.config) === null || _a === void 0 ? void 0 : _a.proxyExcludeTyps) === null || _b === void 0 ? void 0 : _b.filter(function (it) { return target instanceof it; })) !== null && _c !== void 0 ? _c : []; | ||
@@ -155,3 +156,3 @@ if (filter.length === 0) { | ||
DomRenderProxy.prototype.proxy = function (parentProxy, obj, p) { | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && !('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj)) { | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && !('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj) && !(obj instanceof Shield_1.Shield)) { | ||
var domRender = new DomRenderProxy(obj, undefined, this.config); | ||
@@ -163,3 +164,3 @@ domRender.addRef(parentProxy, p); | ||
} | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && ('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj)) { | ||
if (obj !== undefined && obj !== null && typeof obj === 'object' && ('_DomRender_isProxy' in obj) && !DomRenderProxy.isFinal(obj) && !Object.isFrozen(obj) && !(obj instanceof Shield_1.Shield)) { | ||
var d = obj._DomRender_proxy; | ||
@@ -166,0 +167,0 @@ d.addRef(this._domRender_proxy, p); |
{ | ||
"name": "dom-render", | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"main": "DomRender.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -32,14 +32,2 @@ import { Config } from './Config'; | ||
static drItOtherDecoding(element: Element | DocumentFragment, random: string): void; | ||
static drDVarEncoding(element: Element, drVarOption: string): { | ||
name: string; | ||
value: string; | ||
regex: RegExp; | ||
random: string; | ||
}[]; | ||
static drDVarDecoding(element: Element, vars: { | ||
name: string; | ||
value: string; | ||
regex: RegExp; | ||
random: string; | ||
}[]): void; | ||
static drThisEncoding(element: Element, drThis: string): string; | ||
@@ -46,0 +34,0 @@ static drThisDecoding(element: Element, thisRandom: string): void; |
@@ -279,33 +279,5 @@ "use strict"; | ||
}; | ||
RawSet.drDVarEncoding = function (element, drVarOption) { | ||
var _a; | ||
var vars = ((_a = drVarOption === null || drVarOption === void 0 ? void 0 : drVarOption.split(',')) !== null && _a !== void 0 ? _a : []).map(function (it) { | ||
var s = it.trim().split('='); | ||
return { | ||
name: s[0], | ||
value: s[1], | ||
regex: RegExp('(?<!(dr-|\\.))var\\.' + s[0] + '(?=.?)', 'g'), | ||
random: RandomUtils_1.RandomUtils.uuid() | ||
}; | ||
}); | ||
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) { | ||
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) { | ||
it.innerHTML = it.innerHTML.replace(vit.regex, vit.random); | ||
}); | ||
}); | ||
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) { | ||
element.innerHTML = element.innerHTML.replace(vit.regex, vit.value); | ||
}); | ||
return vars; | ||
}; | ||
RawSet.drDVarDecoding = function (element, vars) { | ||
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) { | ||
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) { | ||
it.innerHTML = it.innerHTML.replace(RegExp(vit.random, 'g'), vit.value); | ||
}); | ||
}); | ||
}; | ||
RawSet.drThisEncoding = function (element, drThis) { | ||
var thisRandom = RandomUtils_1.RandomUtils.uuid(); | ||
var thisRegex = /(?<!(dr-|\.))this(?=.?)/g; | ||
var thisRegex = /[^(dr\-)]this(?=.?)/g; | ||
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) { | ||
@@ -315,2 +287,3 @@ it.innerHTML = it.innerHTML.replace(thisRegex, thisRandom); | ||
element.innerHTML = element.innerHTML.replace(thisRegex, drThis); | ||
alert(1); | ||
return thisRandom; | ||
@@ -330,3 +303,3 @@ }; | ||
value: s[1], | ||
regex: RegExp('(?<!(dr-|\\.))var\\.' + s[0] + '(?=.?)', 'g'), | ||
regex: RegExp('var\\.' + s[0] + '(?=.?)', 'g'), | ||
random: RandomUtils_1.RandomUtils.uuid() | ||
@@ -333,0 +306,0 @@ }; |
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
31
112188
2271