chore(core): proper camelcasing for `styleName` and `styleValue`
This commit is contained in:
parent
fad354904d
commit
87549c77d4
|
@ -332,21 +332,21 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
bool hasClass(Element element, String classname) =>
|
bool hasClass(Element element, String classname) =>
|
||||||
element.classes.contains(classname);
|
element.classes.contains(classname);
|
||||||
|
|
||||||
void setStyle(Element element, String stylename, String stylevalue) {
|
void setStyle(Element element, String styleName, String styleValue) {
|
||||||
element.style.setProperty(stylename, stylevalue);
|
element.style.setProperty(styleName, styleValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasStyle(Element element, String stylename, [String stylevalue]) {
|
bool hasStyle(Element element, String styleName, [String styleValue]) {
|
||||||
var value = this.getStyle(element, stylename);
|
var value = this.getStyle(element, styleName);
|
||||||
return isPresent(stylevalue) ? value == stylevalue : value.length > 0;
|
return isPresent(styleValue) ? value == styleValue : value.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeStyle(Element element, String stylename) {
|
void removeStyle(Element element, String styleName) {
|
||||||
element.style.removeProperty(stylename);
|
element.style.removeProperty(styleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getStyle(Element element, String stylename) {
|
String getStyle(Element element, String styleName) {
|
||||||
return element.style.getPropertyValue(stylename);
|
return element.style.getPropertyValue(styleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
String tagName(Element element) => element.tagName;
|
String tagName(Element element) => element.tagName;
|
||||||
|
|
|
@ -207,9 +207,9 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
}
|
}
|
||||||
removeStyle(element, stylename: string) { element.style[stylename] = null; }
|
removeStyle(element, stylename: string) { element.style[stylename] = null; }
|
||||||
getStyle(element, stylename: string): string { return element.style[stylename]; }
|
getStyle(element, stylename: string): string { return element.style[stylename]; }
|
||||||
hasStyle(element, stylename: string, stylevalue: string = null): boolean {
|
hasStyle(element, styleName: string, styleValue: string = null): boolean {
|
||||||
var value = this.getStyle(element, stylename) || '';
|
var value = this.getStyle(element, styleName) || '';
|
||||||
return stylevalue ? value == stylevalue : value.length > 0;
|
return styleValue ? value == styleValue : value.length > 0;
|
||||||
}
|
}
|
||||||
tagName(element): string { return element.tagName; }
|
tagName(element): string { return element.tagName; }
|
||||||
attributeMap(element): Map<string, string> {
|
attributeMap(element): Map<string, string> {
|
||||||
|
|
|
@ -86,10 +86,10 @@ export abstract class DomAdapter {
|
||||||
abstract addClass(element, classname: string);
|
abstract addClass(element, classname: string);
|
||||||
abstract removeClass(element, classname: string);
|
abstract removeClass(element, classname: string);
|
||||||
abstract hasClass(element, classname: string): boolean;
|
abstract hasClass(element, classname: string): boolean;
|
||||||
abstract setStyle(element, stylename: string, stylevalue: string);
|
abstract setStyle(element, styleName: string, styleValue: string);
|
||||||
abstract removeStyle(element, stylename: string);
|
abstract removeStyle(element, styleName: string);
|
||||||
abstract getStyle(element, stylename: string): string;
|
abstract getStyle(element, styleName: string): string;
|
||||||
abstract hasStyle(element, stylename: string, stylevalue?: string): boolean;
|
abstract hasStyle(element, styleName: string, styleValue?: string): boolean;
|
||||||
abstract tagName(element): string;
|
abstract tagName(element): string;
|
||||||
abstract attributeMap(element): Map<string, string>;
|
abstract attributeMap(element): Map<string, string>;
|
||||||
abstract hasAttribute(element, attribute: string): boolean;
|
abstract hasAttribute(element, attribute: string): boolean;
|
||||||
|
|
|
@ -263,7 +263,7 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter {
|
||||||
|
|
||||||
hasClass(element, String classname) => element.classes.contains(classname);
|
hasClass(element, String classname) => element.classes.contains(classname);
|
||||||
|
|
||||||
setStyle(element, String stylename, String stylevalue) {
|
setStyle(element, String styleName, String styleValue) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,11 +271,11 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
removeStyle(element, String stylename) {
|
removeStyle(element, String styleName) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getStyle(element, String stylename) {
|
getStyle(element, String styleName) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,9 +371,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
hasClass(element, classname: string): boolean {
|
hasClass(element, classname: string): boolean {
|
||||||
return ListWrapper.contains(this.classList(element), classname);
|
return ListWrapper.contains(this.classList(element), classname);
|
||||||
}
|
}
|
||||||
hasStyle(element, stylename: string, stylevalue: string = null): boolean {
|
hasStyle(element, styleName: string, styleValue: string = null): boolean {
|
||||||
var value = this.getStyle(element, stylename) || '';
|
var value = this.getStyle(element, styleName) || '';
|
||||||
return stylevalue ? value == stylevalue : value.length > 0;
|
return styleValue ? value == styleValue : value.length > 0;
|
||||||
}
|
}
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_readStyleAttribute(element) {
|
_readStyleAttribute(element) {
|
||||||
|
@ -402,15 +402,15 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
}
|
}
|
||||||
element.attribs["style"] = styleAttrValue;
|
element.attribs["style"] = styleAttrValue;
|
||||||
}
|
}
|
||||||
setStyle(element, stylename: string, stylevalue: string) {
|
setStyle(element, styleName: string, styleValue: string) {
|
||||||
var styleMap = this._readStyleAttribute(element);
|
var styleMap = this._readStyleAttribute(element);
|
||||||
styleMap[stylename] = stylevalue;
|
styleMap[styleName] = styleValue;
|
||||||
this._writeStyleAttribute(element, styleMap);
|
this._writeStyleAttribute(element, styleMap);
|
||||||
}
|
}
|
||||||
removeStyle(element, stylename: string) { this.setStyle(element, stylename, null); }
|
removeStyle(element, styleName: string) { this.setStyle(element, styleName, null); }
|
||||||
getStyle(element, stylename: string): string {
|
getStyle(element, styleName: string): string {
|
||||||
var styleMap = this._readStyleAttribute(element);
|
var styleMap = this._readStyleAttribute(element);
|
||||||
return styleMap.hasOwnProperty(stylename) ? styleMap[stylename] : "";
|
return styleMap.hasOwnProperty(styleName) ? styleMap[styleName] : "";
|
||||||
}
|
}
|
||||||
tagName(element): string { return element.tagName == "style" ? "STYLE" : element.tagName; }
|
tagName(element): string { return element.tagName == "style" ? "STYLE" : element.tagName; }
|
||||||
attributeMap(element): Map<string, string> {
|
attributeMap(element): Map<string, string> {
|
||||||
|
|
Loading…
Reference in New Issue