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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 var node = this.traverseNextTextNode(this); | 149 var node = this.traverseNextTextNode(this); |
150 while (node && offset > node.nodeValue.length) { | 150 while (node && offset > node.nodeValue.length) { |
151 offset -= node.nodeValue.length; | 151 offset -= node.nodeValue.length; |
152 node = node.traverseNextTextNode(this); | 152 node = node.traverseNextTextNode(this); |
153 } | 153 } |
154 if (!node) | 154 if (!node) |
155 return { container: this, offset: 0 }; | 155 return { container: this, offset: 0 }; |
156 return { container: node, offset: offset }; | 156 return { container: node, offset: offset }; |
157 } | 157 } |
158 | 158 |
159 Element.prototype.removeMatchingStyleClasses = function(classNameRegex) | |
160 { | |
161 var regex = new RegExp("(^|\\s+)" + classNameRegex + "($|\\s+)"); | |
162 if (regex.test(this.className)) | |
163 this.className = this.className.replace(regex, " "); | |
164 } | |
165 | |
166 /** | 159 /** |
167 * @param {number|undefined} x | 160 * @param {number|undefined} x |
168 * @param {number|undefined} y | 161 * @param {number|undefined} y |
169 * @param {!Element=} relativeTo | 162 * @param {!Element=} relativeTo |
170 */ | 163 */ |
171 Element.prototype.positionAt = function(x, y, relativeTo) | 164 Element.prototype.positionAt = function(x, y, relativeTo) |
172 { | 165 { |
173 var shift = {x: 0, y: 0}; | 166 var shift = {x: 0, y: 0}; |
174 if (relativeTo) | 167 if (relativeTo) |
175 shift = relativeTo.boxInWindow(this.ownerDocument.defaultView); | 168 shift = relativeTo.boxInWindow(this.ownerDocument.defaultView); |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 */ | 745 */ |
753 function isEnterKey(event) { | 746 function isEnterKey(event) { |
754 // Check if in IME. | 747 // Check if in IME. |
755 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; | 748 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; |
756 } | 749 } |
757 | 750 |
758 function consumeEvent(e) | 751 function consumeEvent(e) |
759 { | 752 { |
760 e.consume(); | 753 e.consume(); |
761 } | 754 } |
OLD | NEW |