OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 */ | 182 */ |
183 Element.prototype.enableStyleClass = function(className, enable) | 183 Element.prototype.enableStyleClass = function(className, enable) |
184 { | 184 { |
185 if (enable) | 185 if (enable) |
186 this.addStyleClass(className); | 186 this.addStyleClass(className); |
187 else | 187 else |
188 this.removeStyleClass(className); | 188 this.removeStyleClass(className); |
189 } | 189 } |
190 | 190 |
191 /** | 191 /** |
192 * @param {string} className | |
193 * @return {boolean} true iff className was added | |
194 */ | |
195 Element.prototype.toggleStyleClass = function(className) | |
196 { | |
197 return this.classList.toggle(className); | |
pfeldman
2013/10/23 13:05:38
Lets use classList, we already use it for multiple
aandrey
2013/10/23 13:35:59
Done.
| |
198 } | |
199 | |
200 /** | |
192 * @param {number|undefined} x | 201 * @param {number|undefined} x |
193 * @param {number|undefined} y | 202 * @param {number|undefined} y |
194 */ | 203 */ |
195 Element.prototype.positionAt = function(x, y) | 204 Element.prototype.positionAt = function(x, y) |
196 { | 205 { |
197 if (typeof x === "number") | 206 if (typeof x === "number") |
198 this.style.setProperty("left", x + "px"); | 207 this.style.setProperty("left", x + "px"); |
199 else | 208 else |
200 this.style.removeProperty("left"); | 209 this.style.removeProperty("left"); |
201 | 210 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
604 | 613 |
605 disconnect: function() | 614 disconnect: function() |
606 { | 615 { |
607 if (this._observer) | 616 if (this._observer) |
608 this._observer.disconnect(); | 617 this._observer.disconnect(); |
609 NonLeakingMutationObserver._instances.remove(this); | 618 NonLeakingMutationObserver._instances.remove(this); |
610 delete this._observer; | 619 delete this._observer; |
611 } | 620 } |
612 } | 621 } |
613 | 622 |
OLD | NEW |