@devexpress/utils
Advanced tools
Comparing version 1.0.0-alpha-009 to 1.0.0-alpha-010
@@ -1,2 +0,2 @@ | ||
export declare class Attr { | ||
export declare class AttrUtils { | ||
static setElementAttribute(obj: HTMLElement, attrName: string, value: string): void; | ||
@@ -8,4 +8,4 @@ static setStyleAttribute(obj: CSSStyleDeclaration, attrName: string, value: string): void; | ||
static removeStyleAttribute(obj: CSSStyleDeclaration, attrName: string): void; | ||
static changeStyleAttribute(obj: HTMLElement, attrName: string, newValue: string): void; | ||
static restoreStyleAttribute(obj: HTMLElement, attrName: string): boolean; | ||
static changeElementAttribute(obj: HTMLElement, attrName: string, newValue: string): void; | ||
static restoreElementAttribute(obj: HTMLElement, attrName: string): boolean; | ||
private static saveAttribute; | ||
@@ -12,0 +12,0 @@ private static isExistsAttributeInElement; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Attr = void 0; | ||
exports.AttrUtils = void 0; | ||
var browser_1 = require("../browser"); | ||
var Attr = (function () { | ||
function Attr() { | ||
var AttrUtils = (function () { | ||
function AttrUtils() { | ||
} | ||
Attr.setElementAttribute = function (obj, attrName, value) { | ||
AttrUtils.setElementAttribute = function (obj, attrName, value) { | ||
if (obj.setAttribute) { | ||
@@ -15,10 +15,10 @@ if (browser_1.Browser.IE && browser_1.Browser.MajorVersion >= 11 && attrName.toLowerCase() === 'src') | ||
}; | ||
Attr.setStyleAttribute = function (obj, attrName, value) { | ||
AttrUtils.setStyleAttribute = function (obj, attrName, value) { | ||
if (obj.setProperty) | ||
obj.setProperty(attrName, value, ''); | ||
}; | ||
Attr.getElementAttribute = function (obj, attrName) { | ||
AttrUtils.getElementAttribute = function (obj, attrName) { | ||
return obj.getAttribute(attrName); | ||
}; | ||
Attr.getStyleAttribute = function (obj, attrName) { | ||
AttrUtils.getStyleAttribute = function (obj, attrName) { | ||
if (obj.getPropertyValue) { | ||
@@ -37,23 +37,23 @@ if (browser_1.Browser.Firefox) { | ||
}; | ||
Attr.removeElementAttribute = function (obj, attrName) { | ||
AttrUtils.removeElementAttribute = function (obj, attrName) { | ||
if (obj.removeAttribute) | ||
obj.removeAttribute(attrName); | ||
}; | ||
Attr.removeStyleAttribute = function (obj, attrName) { | ||
AttrUtils.removeStyleAttribute = function (obj, attrName) { | ||
if (obj.removeProperty) | ||
obj.removeProperty(attrName); | ||
}; | ||
Attr.changeStyleAttribute = function (obj, attrName, newValue) { | ||
Attr.saveAttribute(obj, attrName); | ||
Attr.setElementAttribute(obj, attrName, newValue); | ||
AttrUtils.changeElementAttribute = function (obj, attrName, newValue) { | ||
AttrUtils.saveAttribute(obj, attrName); | ||
AttrUtils.setElementAttribute(obj, attrName, newValue); | ||
}; | ||
Attr.restoreStyleAttribute = function (obj, attrName) { | ||
AttrUtils.restoreElementAttribute = function (obj, attrName) { | ||
var savedAttrName = "saved" + attrName; | ||
if (Attr.isExistsAttributeInElement(obj, savedAttrName)) { | ||
var oldValue = Attr.getElementAttribute(obj, savedAttrName); | ||
if (AttrUtils.isExistsAttributeInElement(obj, savedAttrName)) { | ||
var oldValue = AttrUtils.getElementAttribute(obj, savedAttrName); | ||
if (oldValue !== '' && oldValue !== null) | ||
Attr.setElementAttribute(obj, attrName, oldValue); | ||
AttrUtils.setElementAttribute(obj, attrName, oldValue); | ||
else | ||
Attr.removeElementAttribute(obj, attrName); | ||
Attr.removeElementAttribute(obj, savedAttrName); | ||
AttrUtils.removeElementAttribute(obj, attrName); | ||
AttrUtils.removeElementAttribute(obj, savedAttrName); | ||
return true; | ||
@@ -63,15 +63,15 @@ } | ||
}; | ||
Attr.saveAttribute = function (obj, attrName) { | ||
AttrUtils.saveAttribute = function (obj, attrName) { | ||
var savedAttrName = "saved" + attrName; | ||
if (!Attr.isExistsAttributeInElement(obj, savedAttrName)) { | ||
var oldValue = Attr.getElementAttribute(obj, attrName); | ||
Attr.setElementAttribute(obj, savedAttrName, oldValue === null ? '' : oldValue); | ||
if (!AttrUtils.isExistsAttributeInElement(obj, savedAttrName)) { | ||
var oldValue = AttrUtils.getElementAttribute(obj, attrName); | ||
AttrUtils.setElementAttribute(obj, savedAttrName, oldValue === null ? '' : oldValue); | ||
} | ||
}; | ||
Attr.isExistsAttributeInElement = function (obj, attrName) { | ||
var value = Attr.getElementAttribute(obj, attrName); | ||
AttrUtils.isExistsAttributeInElement = function (obj, attrName) { | ||
var value = AttrUtils.getElementAttribute(obj, attrName); | ||
return value !== null && value !== ''; | ||
}; | ||
return Attr; | ||
return AttrUtils; | ||
}()); | ||
exports.Attr = Attr; | ||
exports.AttrUtils = AttrUtils; |
@@ -173,3 +173,3 @@ "use strict"; | ||
function getAbsolutePositionY_IE(element) { | ||
return element === null || browser_1.Browser.IE && element.parentNode === null ? | ||
return browser_1.Browser.IE && element.parentNode === null ? | ||
0 : | ||
@@ -179,5 +179,3 @@ element.getBoundingClientRect().top + DomUtils.getDocumentScrollTop(); | ||
function getAbsolutePositionY_FF3(element) { | ||
return element === null ? | ||
0 : | ||
Math.round(element.getBoundingClientRect().top + DomUtils.getDocumentScrollTop()); | ||
return Math.round(element.getBoundingClientRect().top + DomUtils.getDocumentScrollTop()); | ||
} | ||
@@ -228,2 +226,4 @@ function getAbsolutePositionY_Opera(curEl) { | ||
} | ||
if (!element) | ||
return 0; | ||
if (browser_1.Browser.IE) | ||
@@ -243,3 +243,3 @@ return getAbsolutePositionY_IE(element); | ||
function getAbsolutePositionX_IE(element) { | ||
return element === null || browser_1.Browser.IE && element.parentNode === null ? | ||
return browser_1.Browser.IE && element.parentNode === null ? | ||
0 : | ||
@@ -249,5 +249,3 @@ element.getBoundingClientRect().left + DomUtils.getDocumentScrollLeft(); | ||
function getAbsolutePositionX_FF3(element) { | ||
return element == null ? | ||
0 : | ||
Math.round(element.getBoundingClientRect().left + DomUtils.getDocumentScrollLeft()); | ||
return Math.round(element.getBoundingClientRect().left + DomUtils.getDocumentScrollLeft()); | ||
} | ||
@@ -296,2 +294,4 @@ function getAbsolutePositionX_Opera(curEl) { | ||
} | ||
if (!element) | ||
return 0; | ||
if (browser_1.Browser.IE) | ||
@@ -298,0 +298,0 @@ return getAbsolutePositionX_IE(element); |
@@ -22,4 +22,2 @@ "use strict"; | ||
TouchUtils.isTouchEvent = function (evt) { | ||
if (!evt) | ||
return false; | ||
return browser_1.Browser.WebKitTouchUI && common_1.isDefined(evt.changedTouches); | ||
@@ -26,0 +24,0 @@ }; |
{ | ||
"name": "@devexpress/utils", | ||
"version": "1.0.0-alpha-009", | ||
"version": "1.0.0-alpha-010", | ||
"description": "DevExpress utils", | ||
@@ -5,0 +5,0 @@ "author": "DevExpress Inc.", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
804342
146
16548