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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 { | 327 { |
328 return this.ownerDocument.evaluate(query, this, null, XPathResult.FIRST_ORDE
RED_NODE_TYPE, null).singleNodeValue; | 328 return this.ownerDocument.evaluate(query, this, null, XPathResult.FIRST_ORDE
RED_NODE_TYPE, null).singleNodeValue; |
329 } | 329 } |
330 | 330 |
331 Element.prototype.removeChildren = function() | 331 Element.prototype.removeChildren = function() |
332 { | 332 { |
333 if (this.firstChild) | 333 if (this.firstChild) |
334 this.textContent = ""; | 334 this.textContent = ""; |
335 } | 335 } |
336 | 336 |
| 337 Element.prototype.appendChildren = function(children) |
| 338 { |
| 339 for (var i = 0; i < children.length; ++i) |
| 340 this.appendChild(children[i]); |
| 341 } |
| 342 |
| 343 Element.prototype.setChildren = function(children) |
| 344 { |
| 345 this.removeChildren(); |
| 346 this.appendChildren(children); |
| 347 } |
| 348 |
337 Element.prototype.isInsertionCaretInside = function() | 349 Element.prototype.isInsertionCaretInside = function() |
338 { | 350 { |
339 var selection = window.getSelection(); | 351 var selection = window.getSelection(); |
340 if (!selection.rangeCount || !selection.isCollapsed) | 352 if (!selection.rangeCount || !selection.isCollapsed) |
341 return false; | 353 return false; |
342 var selectionRange = selection.getRangeAt(0); | 354 var selectionRange = selection.getRangeAt(0); |
343 return selectionRange.startContainer.isSelfOrDescendant(this); | 355 return selectionRange.startContainer.isSelfOrDescendant(this); |
344 } | 356 } |
345 | 357 |
346 /** | 358 /** |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 */ | 673 */ |
662 function isEnterKey(event) { | 674 function isEnterKey(event) { |
663 // Check if in IME. | 675 // Check if in IME. |
664 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; | 676 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; |
665 } | 677 } |
666 | 678 |
667 function consumeEvent(e) | 679 function consumeEvent(e) |
668 { | 680 { |
669 e.consume(); | 681 e.consume(); |
670 } | 682 } |
OLD | NEW |