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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 | 146 |
147 Element.prototype.removeMatchingStyleClasses = function(classNameRegex) | 147 Element.prototype.removeMatchingStyleClasses = function(classNameRegex) |
148 { | 148 { |
149 var regex = new RegExp("(^|\\s+)" + classNameRegex + "($|\\s+)"); | 149 var regex = new RegExp("(^|\\s+)" + classNameRegex + "($|\\s+)"); |
150 if (regex.test(this.className)) | 150 if (regex.test(this.className)) |
151 this.className = this.className.replace(regex, " "); | 151 this.className = this.className.replace(regex, " "); |
152 } | 152 } |
153 | 153 |
154 /** | 154 /** |
155 * @param {string} className | |
156 * @param {*} enable | |
157 */ | |
158 Element.prototype.enableStyleClass = function(className, enable) | |
159 { | |
160 if (enable) | |
161 this.classList.add(className); | |
162 else | |
163 this.classList.remove(className); | |
164 } | |
165 | |
166 /** | |
167 * @param {number|undefined} x | 155 * @param {number|undefined} x |
168 * @param {number|undefined} y | 156 * @param {number|undefined} y |
169 * @param {!Element=} relativeTo | 157 * @param {!Element=} relativeTo |
170 */ | 158 */ |
171 Element.prototype.positionAt = function(x, y, relativeTo) | 159 Element.prototype.positionAt = function(x, y, relativeTo) |
172 { | 160 { |
173 var shift = {x: 0, y: 0}; | 161 var shift = {x: 0, y: 0}; |
174 if (relativeTo) | 162 if (relativeTo) |
175 shift = relativeTo.boxInWindow(this.ownerDocument.defaultView); | 163 shift = relativeTo.boxInWindow(this.ownerDocument.defaultView); |
176 | 164 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 */ | 562 */ |
575 function isEnterKey(event) { | 563 function isEnterKey(event) { |
576 // Check if in IME. | 564 // Check if in IME. |
577 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; | 565 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; |
578 } | 566 } |
579 | 567 |
580 function consumeEvent(e) | 568 function consumeEvent(e) |
581 { | 569 { |
582 e.consume(); | 570 e.consume(); |
583 } | 571 } |
OLD | NEW |