| 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 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return static_cast<ElementRareData*>(Node::ensureRareData()); | 81 return static_cast<ElementRareData*>(Node::ensureRareData()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 NodeRareData* Element::createRareData() | 84 NodeRareData* Element::createRareData() |
| 85 { | 85 { |
| 86 return new ElementRareData; | 86 return new ElementRareData; |
| 87 } | 87 } |
| 88 | 88 |
| 89 PassRefPtr<Node> Element::cloneNode(bool deep) | 89 PassRefPtr<Node> Element::cloneNode(bool deep) |
| 90 { | 90 { |
| 91 ExceptionCode ec = 0; | 91 RefPtr<Element> clone = document()->createElement(tagQName(), false); |
| 92 RefPtr<Element> clone = document()->createElementNS(namespaceURI(), nodeName
(), ec); | 92 // This will catch HTML elements in the wrong namespace that are not correct
ly copied. |
| 93 ASSERT(!ec); | 93 // This is a sanity check as HTML overloads some of the DOM methods. |
| 94 | 94 ASSERT(isHTMLElement() == clone->isHTMLElement()); |
| 95 // clone attributes | 95 |
| 96 // Clone attributes. |
| 96 if (namedAttrMap) | 97 if (namedAttrMap) |
| 97 clone->attributes()->setAttributes(*namedAttrMap); | 98 clone->attributes()->setAttributes(*namedAttrMap); |
| 98 | 99 |
| 99 clone->copyNonAttributeProperties(this); | 100 clone->copyNonAttributeProperties(this); |
| 100 | 101 |
| 101 if (deep) | 102 if (deep) |
| 102 cloneChildNodes(clone.get()); | 103 cloneChildNodes(clone.get()); |
| 103 | 104 |
| 104 return clone.release(); | 105 return clone.release(); |
| 105 } | 106 } |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 unsigned count = 0; | 1278 unsigned count = 0; |
| 1278 Node* n = firstChild(); | 1279 Node* n = firstChild(); |
| 1279 while (n) { | 1280 while (n) { |
| 1280 count += n->isElementNode(); | 1281 count += n->isElementNode(); |
| 1281 n = n->nextSibling(); | 1282 n = n->nextSibling(); |
| 1282 } | 1283 } |
| 1283 return count; | 1284 return count; |
| 1284 } | 1285 } |
| 1285 | 1286 |
| 1286 } | 1287 } |
| OLD | NEW |