Bug 92264 - Implement outerHTML. Part of the patch by Ms2ger. r=smaug.

This commit is contained in:
Henri Sivonen 2011-11-10 14:02:22 +02:00
Родитель 24a2faffc5
Коммит f5d6964a1a
70 изменённых файлов: 332 добавлений и 83 удалений

Просмотреть файл

@ -51,7 +51,7 @@ class nsIDocument;
[ptr] native nsINodePtr(nsINode);
[ptr] native nsIDocumentPtr(nsIDocument);
[scriptable, uuid(c0da5b87-0ba7-4d7c-8cb3-fcb02af4253d)]
[scriptable, uuid(82adaeca-63ee-44eb-830a-e1678bb8745e)]
interface nsIDocumentEncoderNodeFixup : nsISupports
{
/**
@ -272,6 +272,7 @@ interface nsIDocumentEncoder : nsISupports
* @param aNode The node to encode.
*/
void setNode(in nsIDOMNode aNode);
[noscript] void setNativeNode(in nsINodePtr aNode);
/**
* If the container is set to a non-null value, then its

Просмотреть файл

@ -301,6 +301,14 @@ nsDocumentEncoder::SetNode(nsIDOMNode* aNode)
return NS_OK;
}
NS_IMETHODIMP
nsDocumentEncoder::SetNativeNode(nsINode* aNode)
{
mNodeIsContainer = false;
mNode = aNode;
return NS_OK;
}
NS_IMETHODIMP
nsDocumentEncoder::SetContainerNode(nsIDOMNode *aContainer)
{

Просмотреть файл

@ -120,6 +120,7 @@
#include "nsPLDOMEvent.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/FromParser.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -665,15 +666,13 @@ nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
return NS_OK;
}
NS_IMETHODIMP
nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
nsresult
nsGenericHTMLElement::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
{
aInnerHTML.Truncate();
aMarkup.Truncate();
nsIDocument* doc = OwnerDoc();
nsresult rv = NS_OK;
nsAutoString contentType;
if (IsInHTMLDocument()) {
contentType.AssignLiteral("text/html");
@ -698,21 +697,37 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
rv = docEncoder->NativeInit(doc, contentType,
nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines
nsIDocumentEncoder::OutputLFLineBreak |
// Don't do linebreaking that's not present in
// the source
nsIDocumentEncoder::OutputRaw);
nsresult rv = docEncoder->NativeInit(doc, contentType,
nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines
nsIDocumentEncoder::OutputLFLineBreak |
// Don't do linebreaking that's not present in
// the source
nsIDocumentEncoder::OutputRaw);
NS_ENSURE_SUCCESS(rv, rv);
docEncoder->SetNativeContainerNode(this);
rv = docEncoder->EncodeToString(aInnerHTML);
doc->SetCachedEncoder(docEncoder.forget());
if (aIncludeSelf) {
docEncoder->SetNativeNode(this);
} else {
docEncoder->SetNativeContainerNode(this);
}
rv = docEncoder->EncodeToString(aMarkup);
if (!aIncludeSelf) {
doc->SetCachedEncoder(docEncoder.forget());
}
return rv;
}
nsresult
nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML) {
return GetMarkup(false, aInnerHTML);
}
NS_IMETHODIMP
nsGenericHTMLElement::GetOuterHTML(nsAString& aOuterHTML) {
return GetMarkup(true, aOuterHTML);
}
void
nsGenericHTMLElement::FireMutationEventsForDirectParsing(nsIDocument* aDoc,
nsIContent* aDest,
@ -740,8 +755,6 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
{
nsIDocument* doc = OwnerDoc();
nsresult rv = NS_OK;
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(doc, nsnull);
@ -758,8 +771,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
nsAutoScriptLoaderDisabler sld(doc);
nsCOMPtr<nsIDOMDocumentFragment> df;
nsresult rv = NS_OK;
if (doc->IsHTML()) {
PRInt32 oldChildCount = GetChildCount();
rv = nsContentUtils::ParseFragmentHTML(aInnerHTML,
@ -772,6 +784,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
// HTML5 parser has notified, but not fired mutation events.
FireMutationEventsForDirectParsing(doc, this, oldChildCount);
} else {
nsCOMPtr<nsIDOMDocumentFragment> df;
rv = nsContentUtils::CreateContextualFragment(this, aInnerHTML,
true,
getter_AddRefs(df));
@ -789,6 +802,71 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML)
return rv;
}
NS_IMETHODIMP
nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
{
nsINode* parent = GetNodeParent();
if (!parent) {
return NS_OK;
}
if (parent->NodeType() == nsIDOMNode::DOCUMENT_NODE) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
if (OwnerDoc()->IsHTML()) {
nsIAtom* localName;
PRInt32 namespaceID;
if (parent->IsElement()) {
localName = static_cast<nsIContent*>(parent)->Tag();
namespaceID = static_cast<nsIContent*>(parent)->GetNameSpaceID();
} else {
NS_ASSERTION(parent->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE,
"How come the parent isn't a document, a fragment or an element?");
localName = nsGkAtoms::body;
namespaceID = kNameSpaceID_XHTML;
}
nsCOMPtr<nsIDOMDocumentFragment> df;
nsresult rv = NS_NewDocumentFragment(getter_AddRefs(df),
OwnerDoc()->NodeInfoManager());
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> fragment = do_QueryInterface(df);
nsContentUtils::ParseFragmentHTML(aOuterHTML,
fragment,
localName,
namespaceID,
OwnerDoc()->GetCompatibilityMode() ==
eCompatibility_NavQuirks,
PR_TRUE);
parent->ReplaceChild(fragment, this, &rv);
return rv;
}
nsCOMPtr<nsINode> context;
if (parent->IsElement()) {
context = parent;
} else {
NS_ASSERTION(parent->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE,
"How come the parent isn't a document, a fragment or an element?");
nsCOMPtr<nsINodeInfo> info =
OwnerDoc()->NodeInfoManager()->GetNodeInfo(nsGkAtoms::body,
nsnull,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
context = NS_NewHTMLBodyElement(info.forget(), FROM_PARSER_FRAGMENT);
}
nsCOMPtr<nsIDOMDocumentFragment> df;
nsresult rv = nsContentUtils::CreateContextualFragment(context,
aOuterHTML,
PR_TRUE,
getter_AddRefs(df));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsINode> fragment = do_QueryInterface(df);
parent->ReplaceChild(fragment, this, &rv);
return rv;
}
enum nsAdjacentPosition {
eBeforeBegin,
eAfterBegin,

Просмотреть файл

@ -132,6 +132,8 @@ public:
nsresult GetOffsetParent(nsIDOMElement** aOffsetParent);
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML);
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML);
NS_IMETHOD InsertAdjacentHTML(const nsAString& aPosition,
const nsAString& aText);
nsresult ScrollIntoView(bool aTop, PRUint8 optional_argc);
@ -161,6 +163,10 @@ public:
nsresult ClearDataset();
nsresult GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu);
protected:
nsresult GetMarkup(bool aIncludeSelf, nsAString& aMarkup);
public:
// Implementation for nsIContent
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -1571,6 +1577,12 @@ protected:
NS_SCRIPTABLE NS_IMETHOD SetSpellcheck(bool aSpellcheck) { \
return _to SetSpellcheck(aSpellcheck); \
} \
NS_SCRIPTABLE NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) { \
return _to GetOuterHTML(aOuterHTML); \
} \
NS_SCRIPTABLE NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) { \
return _to SetOuterHTML(aOuterHTML); \
} \
NS_SCRIPTABLE NS_IMETHOD InsertAdjacentHTML(const nsAString& position, const nsAString& text) { \
return _to InsertAdjacentHTML(position, text); \
} \

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(2da904fa-83da-426d-a320-a6868192583e)]
[scriptable, uuid(bcb54394-d9f8-4bcb-bbbb-eca9826cdbca)]
interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement
{
attribute DOMString href;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(c874e500-a185-4d69-96dd-474d1137e21f)]
[scriptable, uuid(a06bca18-791f-474e-a031-bf6c2bd14994)]
interface nsIDOMHTMLAppletElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(d88c8515-5a27-4955-8ca5-18c908433cfd)]
[scriptable, uuid(7e607c36-aecc-4dee-a93a-95e22a374bfb)]
interface nsIDOMHTMLAreaElement : nsIDOMHTMLElement
{
attribute DOMString alt;

Просмотреть файл

@ -52,7 +52,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(f4115c13-bc51-4c3b-a5c0-9106af9f7368)]
[scriptable, uuid(756e2792-b937-4a70-bd1f-9d6820473e7e)]
interface nsIDOMHTMLAudioElement : nsIDOMHTMLMediaElement
{
// Setup the audio stream for writing

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(a4f319d7-442d-4154-8c60-b9acdca87523)]
[scriptable, uuid(7eefd466-7c4d-499a-a076-e33204e69dc3)]
interface nsIDOMHTMLBRElement : nsIDOMHTMLElement
{
attribute DOMString clear;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(1ba4957f-629e-4410-b5fd-64f2b7eeb32c)]
[scriptable, uuid(e55cd224-b603-4976-892a-20b11d469394)]
interface nsIDOMHTMLBaseElement : nsIDOMHTMLElement
{
attribute DOMString href;

Просмотреть файл

@ -54,7 +54,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(dcf343a9-fa7f-4e16-b122-0ece0d8bdea9)]
[scriptable, uuid(6c377d44-a5d1-4f0f-860a-9858d2cb5679)]
interface nsIDOMHTMLBodyElement : nsIDOMHTMLElement
{
attribute DOMString aLink;

Просмотреть файл

@ -52,7 +52,7 @@
interface nsIDOMValidityState;
[scriptable, uuid(4b48e075-a05b-480f-9e37-fcd88e7aebdd)]
[scriptable, uuid(79f034f0-5c13-4101-9598-412e1eac1986)]
interface nsIDOMHTMLButtonElement : nsIDOMHTMLElement
{
attribute boolean autofocus;

Просмотреть файл

@ -55,7 +55,7 @@
interface nsIDOMFile;
interface nsIVariant;
[scriptable, uuid(e1ea26e6-4141-487f-a9cf-d7e9344b571c)]
[scriptable, uuid(dbbeeba1-3c20-4d9d-ac82-98b69fd819a9)]
interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
{
attribute unsigned long width;

Просмотреть файл

@ -46,7 +46,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(4c466da8-5c6d-427f-95f5-bba96ab99c96)]
[scriptable, uuid(13032f74-4150-4768-ab5e-51f4de39a300)]
interface nsIDOMHTMLCommandElement : nsIDOMHTMLElement
{
attribute DOMString type;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(f3e65e2b-e079-4970-bb5d-f96ac9cd18c5)]
[scriptable, uuid(50e9ff30-0982-4074-bc65-313f41be8624)]
interface nsIDOMHTMLDListElement : nsIDOMHTMLElement
{
attribute boolean compact;

Просмотреть файл

@ -49,7 +49,7 @@
interface nsIDOMHTMLCollection;
[scriptable, uuid(312ed7c1-8c62-4d80-bbd9-99d7ea4377e6)]
[scriptable, uuid(3bace78b-9eca-4990-a5d6-9c2b8c32cc8a)]
interface nsIDOMHTMLDataListElement : nsIDOMHTMLElement
{
readonly attribute nsIDOMHTMLCollection options;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(1e04cd43-edc0-4658-bd77-d67661af6c9c)]
[scriptable, uuid(a99e86ae-7761-4145-b8a4-5a91186051f1)]
interface nsIDOMHTMLDirectoryElement : nsIDOMHTMLElement
{
attribute boolean compact;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(771be9ee-b883-4556-bf90-2d7c904fe94d)]
[scriptable, uuid(6815b902-8e04-49dd-977b-0a8785e5ffaf)]
interface nsIDOMHTMLDivElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -53,7 +53,7 @@ interface nsIDOMHTMLMenuElement;
* with changes from the work-in-progress WHATWG HTML specification:
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(0a21bb68-d8bd-4b2a-a3db-048a02e81c62)]
[scriptable, uuid(4eccf8a3-8bf5-43f3-a728-f5b632f7db3a)]
interface nsIDOMHTMLElement : nsIDOMElement
{
// metadata attributes
@ -86,6 +86,7 @@ interface nsIDOMHTMLElement : nsIDOMElement
// DOM Parsing and Serialization
attribute DOMString innerHTML;
attribute DOMString outerHTML;
void insertAdjacentHTML(in DOMString position,
in DOMString text);

Просмотреть файл

@ -47,7 +47,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element
*/
[scriptable, uuid(d6309fc7-e9d2-4087-b452-490ed84f2dc2)]
[scriptable, uuid(940a15c2-0d48-4186-b4d8-067fa1ce5675)]
interface nsIDOMHTMLEmbedElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -52,7 +52,7 @@
interface nsIDOMValidityState;
[scriptable, uuid(e153c20e-7a3d-4184-865c-ee7c6d9b65df)]
[scriptable, uuid(781ae103-b030-4aad-b2d5-96e5c2317dec)]
interface nsIDOMHTMLFieldSetElement : nsIDOMHTMLElement
{
attribute boolean disabled;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(8a205975-86cb-44db-b20e-df7f2d200580)]
[scriptable, uuid(1c9778ee-a49c-40ee-9b93-c0ff15630431)]
interface nsIDOMHTMLFontElement : nsIDOMHTMLElement
{
attribute DOMString color;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(8fe67952-6f7b-4d6e-b17b-79a454687e5f)]
[scriptable, uuid(d873b251-6f96-4e70-baf5-aaa935aabe59)]
interface nsIDOMHTMLFormElement : nsIDOMHTMLElement
{
attribute DOMString acceptCharset;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(6de9d59d-42fd-44df-bb41-22cd64a85d4f)]
[scriptable, uuid(318fdc4a-3fca-4099-94aa-c9a1c30ca2b9)]
interface nsIDOMHTMLFrameElement : nsIDOMHTMLElement
{
attribute DOMString frameBorder;

Просмотреть файл

@ -54,7 +54,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(a9423392-0f92-4b25-8700-49d28752c092)]
[scriptable, uuid(6eefbe6d-182c-42e9-9850-af1892b6f2e4)]
interface nsIDOMHTMLFrameSetElement : nsIDOMHTMLElement
{
attribute DOMString cols;

Просмотреть файл

@ -51,7 +51,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(a6950d69-a376-4ad5-a911-8f91abb2b15d)]
[scriptable, uuid(b94bff8f-dfa7-4dd8-8d97-c301dd9de729)]
interface nsIDOMHTMLHRElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(6d049c37-2cee-4c04-816c-270973e58ccf)]
[scriptable, uuid(628fe597-6408-4387-9fcb-75381e2b2dd0)]
interface nsIDOMHTMLHeadElement : nsIDOMHTMLElement
{
};

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(c3c30a05-1dc0-413a-85f6-3c4d5af5f2b6)]
[scriptable, uuid(964c94b0-5571-44e7-9b29-f81c6ea7828a)]
interface nsIDOMHTMLHeadingElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(84825a7d-d5c7-4b1a-9d2a-b3e5df055824)]
[scriptable, uuid(4bafbc15-aa88-4021-9ad6-e14189b7227b)]
interface nsIDOMHTMLHtmlElement : nsIDOMHTMLElement
{
attribute DOMString version;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(166c1cdb-9af5-4217-9a2f-f9dae0923e85)]
[scriptable, uuid(5ef30718-fe45-43a2-a478-a9e3cbf3a118)]
interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(02dbe3c7-e75e-4a35-989c-b6f6d7a3108f)]
[scriptable, uuid(56d9191f-5a94-432f-af70-6fccdeaf614b)]
interface nsIDOMHTMLImageElement : nsIDOMHTMLElement
{
attribute DOMString alt;

Просмотреть файл

@ -54,7 +54,7 @@ interface nsIDOMValidityState;
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(81cc1b30-02e1-4779-ac9e-0091933478a4)]
[scriptable, uuid(7330cd35-c930-4f45-ae61-f5380c30222d)]
interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
{
attribute DOMString accept;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(cb9bbac6-3198-4159-9ee9-262eef35f265)]
[scriptable, uuid(85b15d13-be6d-4653-9c70-22a13d510247)]
interface nsIDOMHTMLLIElement : nsIDOMHTMLElement
{
attribute DOMString type;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(0c36c887-04e3-4926-a916-8e3596130f9a)]
[scriptable, uuid(ddbca449-625d-467c-a22d-7887474f9eb9)]
interface nsIDOMHTMLLabelElement : nsIDOMHTMLElement
{
readonly attribute nsIDOMHTMLFormElement form;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(cabacc5f-5179-4c97-be60-0af8feafb4c9)]
[scriptable, uuid(dac72753-6919-414b-b771-9e1e86e7749c)]
interface nsIDOMHTMLLegendElement : nsIDOMHTMLElement
{
readonly attribute nsIDOMHTMLFormElement form;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(2f238f84-1b45-4ef9-9cda-bd1430ce9304)]
[scriptable, uuid(2ece79f4-83d7-499c-946f-ae9ab93147b7)]
interface nsIDOMHTMLLinkElement : nsIDOMHTMLElement
{
attribute boolean disabled;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(3fb8ec10-8778-418d-9c83-556e46f115a9)]
[scriptable, uuid(c919bc49-bd49-4b89-ba70-5c74c4ef504a)]
interface nsIDOMHTMLMapElement : nsIDOMHTMLElement
{
readonly attribute nsIDOMHTMLCollection areas;

Просмотреть файл

@ -57,7 +57,7 @@
#endif
%}
[scriptable, uuid(85baaa10-73ab-4a48-a57a-b3951b67e494)]
[scriptable, uuid(642a3b85-4edb-4c01-a162-06b5d88171e7)]
interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement
{
// error state

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(12de9196-b164-43e0-9347-f23e1bffbede)]
[scriptable, uuid(06d48250-45e0-4f26-9a07-d9b5a3f08bb6)]
interface nsIDOMHTMLMenuElement : nsIDOMHTMLElement
{
attribute boolean compact;

Просмотреть файл

@ -43,7 +43,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(e0469d92-a137-4329-9d4b-9f2ba5ce8e77)]
[scriptable, uuid(4680ec24-94f0-4eb7-9413-98f9a857de72)]
interface nsIDOMHTMLMenuItemElement : nsIDOMHTMLCommandElement
{
};

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(c883b92b-5ae0-4563-894a-fa7f0e9aacda)]
[scriptable, uuid(db476657-5f59-4e29-84a6-50afe6f85ac7)]
interface nsIDOMHTMLMetaElement : nsIDOMHTMLElement
{
attribute DOMString content;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(417626fa-191c-41e5-aed5-f6157b408e72)]
[scriptable, uuid(170733d4-aad5-4f6e-86c0-94845ea6116d)]
interface nsIDOMHTMLModElement : nsIDOMHTMLElement
{
attribute DOMString cite;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(11e66686-b1ef-47be-9025-ffc20b875e4a)]
[scriptable, uuid(31a5f083-59a6-41c3-8a0b-e58e484c6516)]
interface nsIDOMHTMLOListElement : nsIDOMHTMLElement
{
attribute boolean compact;

Просмотреть файл

@ -52,7 +52,7 @@
interface nsIDOMValidityState;
[scriptable, uuid(5d873128-d4e3-4e89-8900-599155167105)]
[scriptable, uuid(40037f4a-5bae-476f-977b-bbd8e78aaefe)]
interface nsIDOMHTMLObjectElement : nsIDOMHTMLElement
{
readonly attribute nsIDOMHTMLFormElement form;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(7b585d49-1da3-4fc6-a50c-b661063c2edc)]
[scriptable, uuid(ab55d67a-aabb-4441-b182-8ff2bd7d157e)]
interface nsIDOMHTMLOptGroupElement : nsIDOMHTMLElement
{
attribute boolean disabled;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(c20ead8a-cb89-43b1-89ed-8f4713bf8452)]
[scriptable, uuid(7c5bf0ac-6230-4ee0-8b82-e7ebf211af03)]
interface nsIDOMHTMLOptionElement : nsIDOMHTMLElement
{
attribute boolean disabled;

Просмотреть файл

@ -50,7 +50,7 @@
interface nsIDOMDOMSettableTokenList;
interface nsIDOMValidityState;
[scriptable, uuid(7d1fb2a9-7678-409e-8eb5-9216c47c233b)]
[scriptable, uuid(f2074cdb-19cb-447a-935c-9f4402dc1b5e)]
interface nsIDOMHTMLOutputElement : nsIDOMHTMLElement
{
readonly attribute nsIDOMDOMSettableTokenList htmlFor;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(d5d3eb33-0925-4555-be2f-4078dec49f59)]
[scriptable, uuid(e4f498f4-e3c5-46fe-92d0-c9957ccab530)]
interface nsIDOMHTMLParagraphElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(ccffedb8-f234-474e-9af4-576eba766023)]
[scriptable, uuid(d832b1ac-9bb6-4df0-9d9e-f7c040759672)]
interface nsIDOMHTMLParamElement : nsIDOMHTMLElement
{
attribute DOMString name;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(c9d9b45a-e7d9-4dfb-abae-f3b9e6addbaa)]
[scriptable, uuid(f4088dff-649c-4eff-a3a4-dbd6333cdc44)]
interface nsIDOMHTMLPreElement : nsIDOMHTMLElement
{
attribute long width;

Просмотреть файл

@ -47,7 +47,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(aa830aa2-a4ea-455e-8285-8344cadb4c6d)]
[scriptable, uuid(9b1d2263-b60f-4d18-b4d1-66e8c3867c79)]
interface nsIDOMHTMLProgressElement : nsIDOMHTMLElement
{
attribute double value;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(820ccd14-2479-4e4a-99d3-76d138caf7ec)]
[scriptable, uuid(55643647-2eda-4a45-af55-b2ba6c40c5f5)]
interface nsIDOMHTMLQuoteElement : nsIDOMHTMLElement
{
attribute DOMString cite;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(e6252d3b-521a-4f79-9d57-2721a81e7cc2)]
[scriptable, uuid(4b6a0957-5466-4134-8a0a-dd7e4675c106)]
interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement
{
attribute DOMString src;

Просмотреть файл

@ -53,7 +53,7 @@
interface nsIDOMValidityState;
[scriptable, uuid(30a948a3-61a0-453c-a1e4-de67a1664746)]
[scriptable, uuid(98f111e0-2b7e-4abd-984b-2cc1d174fe44)]
interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
{
attribute boolean autofocus;

Просмотреть файл

@ -48,7 +48,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(dcac4414-37e2-409f-b0a6-8231007e585b)]
[scriptable, uuid(c49d9a78-fa02-49c9-b239-9cd51e99f866)]
interface nsIDOMHTMLSourceElement : nsIDOMHTMLElement
{
attribute DOMString src;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(e72a6069-4987-480b-a349-ffd5fbebd59f)]
[scriptable, uuid(247fc8c4-92f3-427b-af6f-41b13f28287d)]
interface nsIDOMHTMLStyleElement : nsIDOMHTMLElement
{
attribute boolean disabled;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(cbd44d29-3120-470d-a7fb-fac4730c8b4b)]
[scriptable, uuid(db0e641f-ba2b-4c67-8da1-4e418cc5fbf7)]
interface nsIDOMHTMLTableCaptionElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(03dd5118-7eaf-4bd3-a4a7-77f3f7eb8539)]
[scriptable, uuid(4caa7af0-fec4-44c1-9a81-e1f14166e60c)]
interface nsIDOMHTMLTableCellElement : nsIDOMHTMLElement
{
readonly attribute long cellIndex;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(d221534a-d13c-43b2-9ba0-7e0dd7452856)]
[scriptable, uuid(9a4d1f6a-fb19-4886-b0d8-dcd201566580)]
interface nsIDOMHTMLTableColElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(bba4b8b2-d01c-4c9b-abc8-3df28d048e68)]
[scriptable, uuid(0f809b97-9311-45c4-a44e-7145f354438b)]
interface nsIDOMHTMLTableElement : nsIDOMHTMLElement
{
// Modified in DOM Level 2:

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(b0199f36-9e76-4ec6-867f-850e388d6244)]
[scriptable, uuid(d24a80d4-491d-4e36-9349-afd3c6999b3e)]
interface nsIDOMHTMLTableRowElement : nsIDOMHTMLElement
{
// Modified in DOM Level 2:

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(ac2e2719-71f1-4485-ac1e-694e7e49bd2a)]
[scriptable, uuid(6acc106e-96a2-4519-8f3a-142ebbdc1bb1)]
interface nsIDOMHTMLTableSectionElement : nsIDOMHTMLElement
{
attribute DOMString align;

Просмотреть файл

@ -53,7 +53,7 @@ interface nsIDOMValidityState;
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(88d09917-d2da-4737-a887-277a2f9750c7)]
[scriptable, uuid(16db703d-4816-440c-bcb3-c1ae0cae6532)]
interface nsIDOMHTMLTextAreaElement : nsIDOMHTMLElement
{
attribute boolean autofocus;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(5cb8cfaf-7551-422b-9b03-58d756e54339)]
[scriptable, uuid(e20fd651-6240-4f20-b8f0-6cc25cb699b7)]
interface nsIDOMHTMLTitleElement : nsIDOMHTMLElement
{
attribute DOMString text;

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(1f409357-8cea-4f69-9f0c-4149886b63a1)]
[scriptable, uuid(2467d39c-2c30-407e-9b67-ea5f231b7809)]
interface nsIDOMHTMLUListElement : nsIDOMHTMLElement
{
attribute boolean compact;

Просмотреть файл

@ -43,7 +43,7 @@
*
* @see <http://www.whatwg.org/html/#htmlunknownelement>
*/
[scriptable, uuid(0d69049f-8181-47f1-a7f7-e5417dd54136)]
[scriptable, uuid(5f922c13-c2c1-4c49-b7c2-0e4e5c8e6860)]
interface nsIDOMHTMLUnknownElement : nsIDOMHTMLElement
{
};

Просмотреть файл

@ -48,7 +48,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(5e1e4453-96fe-4cc0-9c32-7e9355b4f917)]
[scriptable, uuid(390b974b-1c3a-4700-8001-5ef832c4b4bf)]
interface nsIDOMHTMLVideoElement : nsIDOMHTMLMediaElement
{
attribute long width;

Просмотреть файл

@ -45,6 +45,8 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_outerHTML.html \
test_outerHTML.xhtml \
497633.html \
489127.html \
historyframes.html \

Просмотреть файл

@ -0,0 +1,73 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=92264
-->
<head>
<title>Test for Bug 92264</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="runTest();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=92264">Mozilla Bug 92264</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="wrap"><dl></dl><p id="thep">foo<span>bar</span></p><ol></ol></div>
<table id="thetable"><tbody><tr><td>1</td></tr><tr id="thetr"><td>2</td></tr><tr><td>3</td></tr></tbody></table>
<iframe></iframe>
<div id="fragmentwrap"></div>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 92264 **/
SimpleTest.waitForExplicitFinish();
function runTest() {
var thep = document.getElementById("thep");
var wrap = document.getElementById("wrap");
is(thep.outerHTML, '<p id="thep">foo<span>bar</span></p>', "Unexpected thep outerHTML");
thep.outerHTML = "<ul></ul><tr></tr><p></p>";
is(wrap.innerHTML, "<dl></dl><ul></ul><p></p><ol></ol>", "Bad outerHTML parsing inside wrap");
var thetr = document.getElementById("thetr");
thetr.outerHTML = "<tr><td>a</td></tr><div></div><tr><td>b</td></tr>";
var thetable = document.getElementById("thetable");
is(thetable.innerHTML, "<tbody><tr><td>1</td></tr><tr><td>a</td></tr><div></div><tr><td>b</td></tr><tr><td>3</td></tr></tbody>", "Wrong outerHTML parsing inside table");
var iframe = document.getElementsByTagName("iframe")[0];
var oldbody = iframe.contentDocument.body;
iframe.contentDocument.body.outerHTML = "<body></body>";
isnot(oldbody, iframe.contentDocument.body, "Failed to replace body");
is(iframe.contentDocument.getElementsByTagName("body").length, 1, "Should have gotten one body");
// Yes, two heads per spec. Also Ragnarök and Chrome produce two heads.
is(iframe.contentDocument.getElementsByTagName("head").length, 2, "Should have gotten two heads");
try {
document.documentElement.outerHTML = "<html></html>";
ok(false, "Should have thrown an exception");
} catch(e) {
is(e.code, 7, "outerHTML should throw NO_MODIFICATION_ALLOWED_ERR");
}
var f = document.createDocumentFragment();
var dl = document.createElement("dl");
var p = document.createElement("p");
var ol = document.createElement("ol");
f.appendChild(dl);
f.appendChild(p);
f.appendChild(ol);
p.outerHTML = "<ul></ul><tr></tr><body></body><p></p>";
var fragmentwrap = document.getElementById("fragmentwrap");
fragmentwrap.appendChild(f);
is(fragmentwrap.innerHTML, "<dl></dl><ul></ul><p></p><ol></ol>", "Bad outerHTML parsing in fragment");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,74 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=92264
-->
<head>
<title>Test for Bug 92264</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="runTest();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=92264">Mozilla Bug 92264</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="wrap"><dl></dl><p id="thep">foo<span>bar</span></p><ol></ol></div>
<table id="thetable"><tbody><tr><td>1</td></tr><tr id="thetr"><td>2</td></tr><tr><td>3</td></tr></tbody></table>
<iframe></iframe>
<div id="fragmentwrap"></div>
</div>
<pre id="test">
<script type="application/javascript">
<![CDATA[
/** Test for Bug 92264 **/
SimpleTest.waitForExplicitFinish();
function runTest() {
var thep = document.getElementById("thep");
var wrap = document.getElementById("wrap");
is(thep.outerHTML, '<p xmlns="http://www.w3.org/1999/xhtml" id="thep">foo<span>bar</span></p>', "Unexpected thep outerHTML");
thep.outerHTML = "<ul></ul><tr></tr><p></p>";
is(wrap.innerHTML, '<dl xmlns="http://www.w3.org/1999/xhtml"></dl><ul xmlns="http://www.w3.org/1999/xhtml"></ul><tr xmlns="http://www.w3.org/1999/xhtml"></tr><p xmlns="http://www.w3.org/1999/xhtml"></p><ol xmlns="http://www.w3.org/1999/xhtml"></ol>', "Bad outerHTML parsing inside wrap");
var thetr = document.getElementById("thetr");
thetr.outerHTML = "<tr><td>a</td></tr><div></div><tr><td>b</td></tr>";
var thetable = document.getElementById("thetable");
is(thetable.innerHTML, '<tbody xmlns="http://www.w3.org/1999/xhtml"><tr><td>1</td></tr><tr><td>a</td></tr><div></div><tr><td>b</td></tr><tr><td>3</td></tr></tbody>', "Wrong outerHTML parsing inside table");
var iframe = document.getElementsByTagName("iframe")[0];
var oldbody = iframe.contentDocument.body;
iframe.contentDocument.body.outerHTML = "<body></body>";
isnot(oldbody, iframe.contentDocument.body, "Failed to replace body");
is(iframe.contentDocument.getElementsByTagName("body").length, 1, "Should have gotten one body");
// Yes, two heads per spec. Also Ragnarök and Chrome produce two heads.
is(iframe.contentDocument.getElementsByTagName("head").length, 2, "Should have gotten two heads");
try {
document.documentElement.outerHTML = "<html></html>";
ok(false, "Should have thrown an exception");
} catch(e) {
is(e.code, 7, "outerHTML should throw NO_MODIFICATION_ALLOWED_ERR");
}
var f = document.createDocumentFragment();
var dl = document.createElement("dl");
var p = document.createElement("p");
var ol = document.createElement("ol");
f.appendChild(dl);
f.appendChild(p);
f.appendChild(ol);
p.outerHTML = "<ul></ul><tr></tr><body></body><p></p>";
var fragmentwrap = document.getElementById("fragmentwrap");
fragmentwrap.appendChild(f);
is(fragmentwrap.innerHTML, '<dl xmlns="http://www.w3.org/1999/xhtml"></dl><ul xmlns="http://www.w3.org/1999/xhtml"></ul><tr xmlns="http://www.w3.org/1999/xhtml"></tr><body xmlns="http://www.w3.org/1999/xhtml"></body><p xmlns="http://www.w3.org/1999/xhtml"></p><ol xmlns="http://www.w3.org/1999/xhtml"></ol>', "Bad outerHTML parsing in fragment");
SimpleTest.finish();
}
]]>
</script>
</pre>
</body>
</html>