Skip to content

Commit

Permalink
chore(core): rename classname to className
Browse files Browse the repository at this point in the history
  • Loading branch information
matsko committed Nov 23, 2015
1 parent 87549c7 commit 564642d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions modules/angular2/src/platform/browser/browser_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,16 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
List<Node> getElementsByTagName(Element element, String name) =>
element.querySelectorAll(name);
List<String> classList(Element element) => element.classes.toList();
void addClass(Element element, String classname) {
element.classes.add(classname);
void addClass(Element element, String className) {
element.classes.add(className);
}

void removeClass(Element element, String classname) {
element.classes.remove(classname);
void removeClass(Element element, String className) {
element.classes.remove(className);
}

bool hasClass(Element element, String classname) =>
element.classes.contains(classname);
bool hasClass(Element element, String className) =>
element.classes.contains(className);

void setStyle(Element element, String styleName, String styleValue) {
element.style.setProperty(styleName, styleValue);
Expand Down
10 changes: 5 additions & 5 deletions modules/angular2/src/platform/browser/browser_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
return element.getElementsByTagName(name);
}
classList(element): any[] { return <any[]>Array.prototype.slice.call(element.classList, 0); }
addClass(element, classname: string) { element.classList.add(classname); }
removeClass(element, classname: string) { element.classList.remove(classname); }
hasClass(element, classname: string): boolean { return element.classList.contains(classname); }
setStyle(element, stylename: string, stylevalue: string) {
element.style[stylename] = stylevalue;
addClass(element, className: string) { element.classList.add(className); }
removeClass(element, className: string) { element.classList.remove(className); }
hasClass(element, className: string): boolean { return element.classList.contains(className); }
setStyle(element, styleName: string, styleValue: string) {
element.style[styleName] = styleValue;
}
removeStyle(element, stylename: string) { element.style[stylename] = null; }
getStyle(element, stylename: string): string { return element.style[stylename]; }
Expand Down
6 changes: 3 additions & 3 deletions modules/angular2/src/platform/dom/dom_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export abstract class DomAdapter {
abstract getElementsByClassName(element, name: string): HTMLElement[];
abstract getElementsByTagName(element, name: string): HTMLElement[];
abstract classList(element): any[];
abstract addClass(element, classname: string);
abstract removeClass(element, classname: string);
abstract hasClass(element, classname: string): boolean;
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter {

List classList(element) => element.classes.toList();

addClass(element, String classname) {
element.classes.add(classname);
addClass(element, String className) {
element.classes.add(className);
}

removeClass(element, String classname) {
removeClass(element, String className) {
throw 'not implemented';
}

hasClass(element, String classname) => element.classes.contains(classname);
hasClass(element, String className) => element.classes.contains(className);

setStyle(element, String styleName, String styleValue) {
throw 'not implemented';
Expand Down
14 changes: 7 additions & 7 deletions modules/angular2/src/platform/server/parse5_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,24 +352,24 @@ export class Parse5DomAdapter extends DomAdapter {
}
return classAttrValue ? classAttrValue.trim().split(/\s+/g) : [];
}
addClass(element, classname: string) {
addClass(element, className: string) {
var classList = this.classList(element);
var index = classList.indexOf(classname);
var index = classList.indexOf(className);
if (index == -1) {
classList.push(classname);
classList.push(className);
element.attribs["class"] = element.className = classList.join(" ");
}
}
removeClass(element, classname: string) {
removeClass(element, className: string) {
var classList = this.classList(element);
var index = classList.indexOf(classname);
var index = classList.indexOf(className);
if (index > -1) {
classList.splice(index, 1);
element.attribs["class"] = element.className = classList.join(" ");
}
}
hasClass(element, classname: string): boolean {
return ListWrapper.contains(this.classList(element), classname);
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) || '';
Expand Down

0 comments on commit 564642d

Please sign in to comment.