chore(core): proper camelcasing for `styleName` and `styleValue`

This commit is contained in:
Matias Niemelä 2015-11-18 15:59:25 -08:00
parent fad354904d
commit 87549c77d4
5 changed files with 27 additions and 27 deletions

View File

@ -332,21 +332,21 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
bool hasClass(Element element, String classname) =>
element.classes.contains(classname);
void setStyle(Element element, String stylename, String stylevalue) {
element.style.setProperty(stylename, stylevalue);
void setStyle(Element element, String styleName, String styleValue) {
element.style.setProperty(styleName, styleValue);
}
bool hasStyle(Element element, String stylename, [String stylevalue]) {
var value = this.getStyle(element, stylename);
return isPresent(stylevalue) ? value == stylevalue : value.length > 0;
bool hasStyle(Element element, String styleName, [String styleValue]) {
var value = this.getStyle(element, styleName);
return isPresent(styleValue) ? value == styleValue : value.length > 0;
}
void removeStyle(Element element, String stylename) {
element.style.removeProperty(stylename);
void removeStyle(Element element, String styleName) {
element.style.removeProperty(styleName);
}
String getStyle(Element element, String stylename) {
return element.style.getPropertyValue(stylename);
String getStyle(Element element, String styleName) {
return element.style.getPropertyValue(styleName);
}
String tagName(Element element) => element.tagName;

View File

@ -207,9 +207,9 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
}
removeStyle(element, stylename: string) { element.style[stylename] = null; }
getStyle(element, stylename: string): string { return element.style[stylename]; }
hasStyle(element, stylename: string, stylevalue: string = null): boolean {
var value = this.getStyle(element, stylename) || '';
return stylevalue ? value == stylevalue : value.length > 0;
hasStyle(element, styleName: string, styleValue: string = null): boolean {
var value = this.getStyle(element, styleName) || '';
return styleValue ? value == styleValue : value.length > 0;
}
tagName(element): string { return element.tagName; }
attributeMap(element): Map<string, string> {

View File

@ -86,10 +86,10 @@ export abstract class DomAdapter {
abstract addClass(element, classname: string);
abstract removeClass(element, classname: string);
abstract hasClass(element, classname: string): boolean;
abstract setStyle(element, stylename: string, stylevalue: string);
abstract removeStyle(element, stylename: string);
abstract getStyle(element, stylename: string): string;
abstract hasStyle(element, stylename: string, stylevalue?: string): boolean;
abstract setStyle(element, styleName: string, styleValue: string);
abstract removeStyle(element, styleName: string);
abstract getStyle(element, styleName: string): string;
abstract hasStyle(element, styleName: string, styleValue?: string): boolean;
abstract tagName(element): string;
abstract attributeMap(element): Map<string, string>;
abstract hasAttribute(element, attribute: string): boolean;

View File

@ -263,7 +263,7 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter {
hasClass(element, String classname) => element.classes.contains(classname);
setStyle(element, String stylename, String stylevalue) {
setStyle(element, String styleName, String styleValue) {
throw 'not implemented';
}
@ -271,11 +271,11 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter {
throw 'not implemented';
}
removeStyle(element, String stylename) {
removeStyle(element, String styleName) {
throw 'not implemented';
}
getStyle(element, String stylename) {
getStyle(element, String styleName) {
throw 'not implemented';
}

View File

@ -371,9 +371,9 @@ export class Parse5DomAdapter extends DomAdapter {
hasClass(element, classname: string): boolean {
return ListWrapper.contains(this.classList(element), classname);
}
hasStyle(element, stylename: string, stylevalue: string = null): boolean {
var value = this.getStyle(element, stylename) || '';
return stylevalue ? value == stylevalue : value.length > 0;
hasStyle(element, styleName: string, styleValue: string = null): boolean {
var value = this.getStyle(element, styleName) || '';
return styleValue ? value == styleValue : value.length > 0;
}
/** @internal */
_readStyleAttribute(element) {
@ -402,15 +402,15 @@ export class Parse5DomAdapter extends DomAdapter {
}
element.attribs["style"] = styleAttrValue;
}
setStyle(element, stylename: string, stylevalue: string) {
setStyle(element, styleName: string, styleValue: string) {
var styleMap = this._readStyleAttribute(element);
styleMap[stylename] = stylevalue;
styleMap[styleName] = styleValue;
this._writeStyleAttribute(element, styleMap);
}
removeStyle(element, stylename: string) { this.setStyle(element, stylename, null); }
getStyle(element, stylename: string): string {
removeStyle(element, styleName: string) { this.setStyle(element, styleName, null); }
getStyle(element, styleName: string): string {
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; }
attributeMap(element): Map<string, string> {