@slickgrid-universal/binding
Advanced tools
Comparing version 2.6.3 to 2.6.4
@@ -6,2 +6,6 @@ "use strict"; | ||
class BindingHelper { | ||
constructor() { | ||
this._observers = []; | ||
this._querySelectorPrefix = ''; | ||
} | ||
get querySelectorPrefix() { | ||
@@ -16,6 +20,2 @@ return this._querySelectorPrefix || ''; | ||
} | ||
constructor() { | ||
this._observers = []; | ||
this._querySelectorPrefix = ''; | ||
} | ||
dispose() { | ||
@@ -22,0 +22,0 @@ let observer = this._observers.pop(); |
"use strict"; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BindingService = void 0; | ||
/* eslint-disable no-bitwise */ | ||
const DOMPurify_ = require("dompurify"); | ||
const DOMPurify = ((_a = DOMPurify_ === null || DOMPurify_ === void 0 ? void 0 : DOMPurify_['default']) !== null && _a !== void 0 ? _a : DOMPurify_); // patch for rollup | ||
/** | ||
@@ -23,6 +19,6 @@ * Create 2 way Bindings for any variable that are primitive or object types, when it's an object type it will watch for property changes | ||
if (binding.property && binding.variable && (binding.variable.hasOwnProperty(binding.property) || binding.property in binding.variable)) { | ||
this._value = typeof binding.variable[binding.property] === 'string' ? this.sanitizeText(binding.variable[binding.property]) : binding.variable[binding.property]; | ||
this._value = binding.variable[binding.property]; | ||
} | ||
else { | ||
this._value = typeof binding.variable === 'string' ? this.sanitizeText(binding.variable) : binding.variable; | ||
this._value = binding.variable; | ||
} | ||
@@ -54,7 +50,7 @@ if (typeof binding.variable === 'object') { | ||
valueSetter(val) { | ||
this._value = typeof val === 'string' ? this.sanitizeText(val) : val; | ||
this._value = val; | ||
if (Array.isArray(this._elementBindings)) { | ||
for (const binding of this._elementBindings) { | ||
if ((binding === null || binding === void 0 ? void 0 : binding.element) && (binding === null || binding === void 0 ? void 0 : binding.attribute)) { | ||
binding.element[binding.attribute] = typeof val === 'string' ? this.sanitizeText(val) : val; | ||
binding.element[binding.attribute] = val; | ||
} | ||
@@ -130,3 +126,3 @@ } | ||
this._elementBindings.push(binding); | ||
element[attribute] = typeof this._value === 'string' ? this.sanitizeText(this._value) : this._value; | ||
element[attribute] = this._value; | ||
} | ||
@@ -137,2 +133,3 @@ } | ||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { | ||
/* eslint-disable no-bitwise */ | ||
const r = Math.random() * 16 | 0; | ||
@@ -146,7 +143,4 @@ const v = c === 'x' ? r : (r & 0x3 | 0x8); | ||
} | ||
sanitizeText(dirtyText) { | ||
return (DOMPurify === null || DOMPurify === void 0 ? void 0 : DOMPurify.sanitize) ? DOMPurify.sanitize(dirtyText, {}) : dirtyText; | ||
} | ||
} | ||
exports.BindingService = BindingService; | ||
//# sourceMappingURL=binding.service.js.map |
import { BindingService } from './binding.service'; | ||
export class BindingHelper { | ||
constructor() { | ||
this._observers = []; | ||
this._querySelectorPrefix = ''; | ||
} | ||
get querySelectorPrefix() { | ||
@@ -12,6 +16,2 @@ return this._querySelectorPrefix || ''; | ||
} | ||
constructor() { | ||
this._observers = []; | ||
this._querySelectorPrefix = ''; | ||
} | ||
dispose() { | ||
@@ -18,0 +18,0 @@ let observer = this._observers.pop(); |
@@ -1,5 +0,1 @@ | ||
var _a; | ||
/* eslint-disable no-bitwise */ | ||
import * as DOMPurify_ from 'dompurify'; | ||
const DOMPurify = ((_a = DOMPurify_ === null || DOMPurify_ === void 0 ? void 0 : DOMPurify_['default']) !== null && _a !== void 0 ? _a : DOMPurify_); // patch for rollup | ||
/** | ||
@@ -20,6 +16,6 @@ * Create 2 way Bindings for any variable that are primitive or object types, when it's an object type it will watch for property changes | ||
if (binding.property && binding.variable && (binding.variable.hasOwnProperty(binding.property) || binding.property in binding.variable)) { | ||
this._value = typeof binding.variable[binding.property] === 'string' ? this.sanitizeText(binding.variable[binding.property]) : binding.variable[binding.property]; | ||
this._value = binding.variable[binding.property]; | ||
} | ||
else { | ||
this._value = typeof binding.variable === 'string' ? this.sanitizeText(binding.variable) : binding.variable; | ||
this._value = binding.variable; | ||
} | ||
@@ -51,7 +47,7 @@ if (typeof binding.variable === 'object') { | ||
valueSetter(val) { | ||
this._value = typeof val === 'string' ? this.sanitizeText(val) : val; | ||
this._value = val; | ||
if (Array.isArray(this._elementBindings)) { | ||
for (const binding of this._elementBindings) { | ||
if ((binding === null || binding === void 0 ? void 0 : binding.element) && (binding === null || binding === void 0 ? void 0 : binding.attribute)) { | ||
binding.element[binding.attribute] = typeof val === 'string' ? this.sanitizeText(val) : val; | ||
binding.element[binding.attribute] = val; | ||
} | ||
@@ -127,3 +123,3 @@ } | ||
this._elementBindings.push(binding); | ||
element[attribute] = typeof this._value === 'string' ? this.sanitizeText(this._value) : this._value; | ||
element[attribute] = this._value; | ||
} | ||
@@ -134,2 +130,3 @@ } | ||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { | ||
/* eslint-disable no-bitwise */ | ||
const r = Math.random() * 16 | 0; | ||
@@ -143,6 +140,3 @@ const v = c === 'x' ? r : (r & 0x3 | 0x8); | ||
} | ||
sanitizeText(dirtyText) { | ||
return (DOMPurify === null || DOMPurify === void 0 ? void 0 : DOMPurify.sanitize) ? DOMPurify.sanitize(dirtyText, {}) : dirtyText; | ||
} | ||
} | ||
//# sourceMappingURL=binding.service.js.map |
@@ -8,3 +8,2 @@ import { BindingService } from './binding.service'; | ||
get observers(): BindingService[]; | ||
constructor(); | ||
dispose(): void; | ||
@@ -11,0 +10,0 @@ addElementBinding<T extends Element = Element>(variable: any, property: string, selector: string, attribute: string, events?: string | string[], callback?: (val: any) => void): void; |
@@ -1,2 +0,2 @@ | ||
import { Binding, BoundedEventWithListener, ElementBinding, ElementBindingWithListener } from './interfaces'; | ||
import type { Binding, BoundedEventWithListener, ElementBinding, ElementBindingWithListener } from './interfaces'; | ||
/** | ||
@@ -42,4 +42,3 @@ * Create 2 way Bindings for any variable that are primitive or object types, when it's an object type it will watch for property changes | ||
protected hasData(value: any): boolean; | ||
protected sanitizeText(dirtyText: string): string; | ||
} | ||
//# sourceMappingURL=binding.service.d.ts.map |
{ | ||
"name": "@slickgrid-universal/binding", | ||
"version": "2.6.3", | ||
"version": "2.6.4", | ||
"description": "Simple Vanilla Implementation of a Binding Engine & Helper to add properties/events 2 way bindings", | ||
@@ -45,6 +45,3 @@ "main": "dist/commonjs/index.js", | ||
], | ||
"dependencies": { | ||
"dompurify": "^3.0.1" | ||
}, | ||
"gitHead": "31fda0f0276c7834e58de9d776f4e4c6cf7fee01" | ||
"gitHead": "e906a95b58d12c99b9f8514d11ef9be10ba4045a" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
0
72211
513
- Removeddompurify@^3.0.1
- Removed@types/trusted-types@2.0.7(transitive)
- Removeddompurify@3.2.4(transitive)