OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 if (!newChild) { | 499 if (!newChild) { |
500 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception
alternative. | 500 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception
alternative. |
501 exceptionState.throwTypeError("The node provided is null."); | 501 exceptionState.throwTypeError("The node provided is null."); |
502 return 0; | 502 return 0; |
503 } | 503 } |
504 | 504 |
505 Node* returnValue = insertAdjacent(where, newChild, exceptionState); | 505 Node* returnValue = insertAdjacent(where, newChild, exceptionState); |
506 return toElement(returnValue); | 506 return toElement(returnValue); |
507 } | 507 } |
508 | 508 |
509 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in
-html-documents.html#insertadjacenthtml() | 509 // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml() |
510 static Element* contextElementForInsertion(const String& where, Element* element
, ExceptionState& exceptionState) | 510 static Element* contextElementForInsertion(const String& where, Element* element
, ExceptionState& exceptionState) |
511 { | 511 { |
512 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft
erEnd")) { | 512 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft
erEnd")) { |
513 ContainerNode* parent = element->parentNode(); | 513 ContainerNode* parent = element->parentNode(); |
514 if (parent && !parent->isElementNode()) { | 514 if (!parent || !parent->isElementNode()) { |
515 exceptionState.throwDOMException(NoModificationAllowedError, "The el
ement has no parent."); | 515 exceptionState.throwDOMException(NoModificationAllowedError, "The el
ement has no parent."); |
516 return 0; | 516 return 0; |
517 } | 517 } |
518 return toElement(parent); | 518 return toElement(parent); |
519 } | 519 } |
520 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo
reEnd")) | 520 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo
reEnd")) |
521 return element; | 521 return element; |
522 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher
e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.")
; | 522 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher
e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.")
; |
523 return 0; | 523 return 0; |
524 } | 524 } |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 #ifndef NDEBUG | 1075 #ifndef NDEBUG |
1076 | 1076 |
1077 // For use in the debugger | 1077 // For use in the debugger |
1078 void dumpInnerHTML(WebCore::HTMLElement*); | 1078 void dumpInnerHTML(WebCore::HTMLElement*); |
1079 | 1079 |
1080 void dumpInnerHTML(WebCore::HTMLElement* element) | 1080 void dumpInnerHTML(WebCore::HTMLElement* element) |
1081 { | 1081 { |
1082 printf("%s\n", element->innerHTML().ascii().data()); | 1082 printf("%s\n", element->innerHTML().ascii().data()); |
1083 } | 1083 } |
1084 #endif | 1084 #endif |
OLD | NEW |