Bug 1244328 - Merge the functionality of DOMSettableTokenList into DOMTokenList and make everything that used to refer to DOMSettableTokenList refer to DOMTokenList instead. r=bzbarsky

This commit is contained in:
Deepthi Venkitaramanan 2016-02-11 17:50:42 -05:00
parent c039df4f0e
commit 008e6b8991
39 changed files with 96 additions and 176 deletions

View File

@ -45,7 +45,6 @@
#include "nsNameSpaceManager.h"
#include "nsContentList.h"
#include "nsVariant.h"
#include "nsDOMSettableTokenList.h"
#include "nsDOMTokenList.h"
#include "nsXBLPrototypeBinding.h"
#include "nsError.h"
@ -3066,11 +3065,11 @@ Element::GetLinkTarget(nsAString& aTarget)
}
static void
nsDOMSettableTokenListPropertyDestructor(void *aObject, nsIAtom *aProperty,
void *aPropertyValue, void *aData)
nsDOMTokenListPropertyDestructor(void *aObject, nsIAtom *aProperty,
void *aPropertyValue, void *aData)
{
nsDOMSettableTokenList* list =
static_cast<nsDOMSettableTokenList*>(aPropertyValue);
nsDOMTokenList* list =
static_cast<nsDOMTokenList*>(aPropertyValue);
NS_RELEASE(list);
}
@ -3092,7 +3091,7 @@ Element::HTMLSVGPropertiesToTraverseAndUnlink()
return sPropertiesToTraverseAndUnlink;
}
nsDOMSettableTokenList*
nsDOMTokenList*
Element::GetTokenList(nsIAtom* aAtom)
{
#ifdef DEBUG
@ -3108,14 +3107,14 @@ Element::GetTokenList(nsIAtom* aAtom)
MOZ_ASSERT(found, "Trying to use an unknown tokenlist!");
#endif
nsDOMSettableTokenList* list = nullptr;
nsDOMTokenList* list = nullptr;
if (HasProperties()) {
list = static_cast<nsDOMSettableTokenList*>(GetProperty(aAtom));
list = static_cast<nsDOMTokenList*>(GetProperty(aAtom));
}
if (!list) {
list = new nsDOMSettableTokenList(this, aAtom);
list = new nsDOMTokenList(this, aAtom);
NS_ADDREF(list);
SetProperty(aAtom, list, nsDOMSettableTokenListPropertyDestructor);
SetProperty(aAtom, list, nsDOMTokenListPropertyDestructor);
}
return list;
}
@ -3132,7 +3131,7 @@ Element::GetTokenList(nsIAtom* aAtom, nsIVariant** aResult)
nsresult
Element::SetTokenList(nsIAtom* aAtom, nsIVariant* aValue)
{
nsDOMSettableTokenList* itemType = GetTokenList(aAtom);
nsDOMTokenList* itemType = GetTokenList(aAtom);
nsAutoString string;
aValue->GetAsAString(string);
ErrorResult rv;

View File

@ -44,7 +44,6 @@ class nsIURI;
class nsIScrollableFrame;
class nsAttrValueOrString;
class nsContentList;
class nsDOMSettableTokenList;
class nsDOMTokenList;
struct nsRect;
class nsFocusManager;
@ -1298,7 +1297,7 @@ protected:
*/
virtual void GetLinkTarget(nsAString& aTarget);
nsDOMSettableTokenList* GetTokenList(nsIAtom* aAtom);
nsDOMTokenList* GetTokenList(nsIAtom* aAtom);
void GetTokenList(nsIAtom* aAtom, nsIVariant** aResult);
nsresult SetTokenList(nsIAtom* aAtom, nsIVariant* aValue);

View File

@ -281,7 +281,6 @@ UNIFIED_SOURCES += [
'nsDOMNavigationTiming.cpp',
'nsDOMScriptObjectFactory.cpp',
'nsDOMSerializer.cpp',
'nsDOMSettableTokenList.cpp',
'nsDOMTokenList.cpp',
'nsDOMWindowList.cpp',
'nsFocusManager.cpp',

View File

@ -1,29 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Implementation of DOMSettableTokenList specified by HTML5.
*/
#include "nsDOMSettableTokenList.h"
#include "mozilla/dom/DOMSettableTokenListBinding.h"
#include "mozilla/dom/Element.h"
void
nsDOMSettableTokenList::SetValue(const nsAString& aValue, mozilla::ErrorResult& rv)
{
if (!mElement) {
return;
}
rv = mElement->SetAttr(kNameSpaceID_None, mAttrAtom, aValue, true);
}
JSObject*
nsDOMSettableTokenList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
{
return mozilla::dom::DOMSettableTokenListBinding::Wrap(cx, this, aGivenProto);
}

View File

@ -1,35 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Implementation of DOMSettableTokenList specified by HTML5.
*/
#ifndef nsDOMSettableTokenList_h___
#define nsDOMSettableTokenList_h___
#include "nsDOMTokenList.h"
class nsIAtom;
// nsISupports must be on the primary inheritance chain
// because nsDOMSettableTokenList is traversed by Element.
class nsDOMSettableTokenList final : public nsDOMTokenList
{
public:
nsDOMSettableTokenList(mozilla::dom::Element* aElement, nsIAtom* aAttrAtom)
: nsDOMTokenList(aElement, aAttrAtom) {}
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
// WebIDL
void GetValue(nsAString& aResult) { Stringify(aResult); }
void SetValue(const nsAString& aValue, mozilla::ErrorResult& rv);
};
#endif // nsDOMSettableTokenList_h___

View File

@ -9,7 +9,6 @@
*/
#include "nsDOMTokenList.h"
#include "nsAttrValue.h"
#include "nsContentUtils.h"
#include "nsError.h"
@ -74,6 +73,16 @@ nsDOMTokenList::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aResult)
}
}
void
nsDOMTokenList::SetValue(const nsAString& aValue, mozilla::ErrorResult& rv)
{
if (!mElement) {
return;
}
rv = mElement->SetAttr(kNameSpaceID_None, mAttrAtom, aValue, true);
}
nsresult
nsDOMTokenList::CheckToken(const nsAString& aStr)
{

View File

@ -26,7 +26,7 @@ class nsAttrValue;
class nsIAtom;
// nsISupports must be on the primary inheritance chain
// because nsDOMSettableTokenList is traversed by Element.
class nsDOMTokenList : public nsISupports,
public nsWrapperCache
{
@ -66,6 +66,9 @@ public:
bool Toggle(const nsAString& aToken,
const mozilla::dom::Optional<bool>& force,
mozilla::ErrorResult& aError);
void GetValue(nsAString& aResult) { Stringify(aResult); }
void SetValue(const nsAString& aValue, mozilla::ErrorResult& rv);
void Stringify(nsAString& aResult);
protected:

View File

@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=346485
/** Test for Bug 346485 **/
/**
* This test is testing DOMSettableTokenList used by the output element.
* This test is testing DOMTokenList used by the output element.
*/
function checkHtmlFor(htmlFor, list, msg) {

View File

@ -98,15 +98,20 @@ function assignToClassListStrict(e) {
"use strict";
try {
e.classList = "foo";
ok(false, "assigning to classList didn't throw");
} catch (e) { }
ok(true, "assigning to classList didn't throw");
e.removeAttribute("class");
} catch (e) {
ok(false, "assigning to classList threw");
}
}
function assignToClassList(e) {
try {
var expect = e.classList;
e.classList = "foo";
ok(true, "assigning to classList didn't throw");
is(e.classList, expect, "classList should be unchanged after assignment");
e.removeAttribute("class");
} catch (e) {
ok(false, "assigning to classList threw");
}
@ -160,8 +165,6 @@ function testClassList(e) {
ok(DOMTokenList.prototype.hasOwnProperty("toString"),
"Should have own toString on DOMTokenList")
ok(!DOMSettableTokenList.prototype.hasOwnProperty("toString"),
"Should not have own toString on DOMSettableTokenList")
e.removeAttribute("class");
is(e.classList.toString(), "", "wrong classList.toString() value");

View File

@ -437,10 +437,6 @@ DOMInterfaces = {
'implicitJSContext': [ 'then' ],
},
'DOMSettableTokenList': {
'nativeType': 'nsDOMSettableTokenList',
},
'DOMStringMap': {
'nativeType': 'nsDOMStringMap'
},

View File

@ -10,7 +10,7 @@
#include "mozilla/Attributes.h"
#include "nsGenericHTMLFrameElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsDOMSettableTokenList.h"
#include "nsDOMTokenList.h"
namespace mozilla {
namespace dom {
@ -84,7 +84,7 @@ public:
{
SetHTMLAttr(nsGkAtoms::name, aName, aError);
}
nsDOMSettableTokenList* Sandbox()
nsDOMTokenList* Sandbox()
{
return GetTokenList(nsGkAtoms::sandbox);
}

View File

@ -119,7 +119,7 @@ public:
{
SetHTMLAttr(nsGkAtoms::hreflang, aHreflang, aRv);
}
nsDOMSettableTokenList* Sizes()
nsDOMTokenList* Sizes()
{
return GetTokenList(nsGkAtoms::sizes);
}

View File

@ -11,7 +11,7 @@
#include "mozilla/dom/HTMLFormElement.h"
#include "mozilla/dom/HTMLOutputElementBinding.h"
#include "nsContentUtils.h"
#include "nsDOMSettableTokenList.h"
#include "nsDOMTokenList.h"
#include "nsFormSubmission.h"
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Output)
@ -166,11 +166,11 @@ HTMLOutputElement::SetDefaultValue(const nsAString& aDefaultValue, ErrorResult&
}
}
nsDOMSettableTokenList*
nsDOMTokenList*
HTMLOutputElement::HtmlFor()
{
if (!mTokenList) {
mTokenList = new nsDOMSettableTokenList(this, nsGkAtoms::_for);
mTokenList = new nsDOMTokenList(this, nsGkAtoms::_for);
}
return mTokenList;
}

View File

@ -64,7 +64,7 @@ public:
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// WebIDL
nsDOMSettableTokenList* HtmlFor();
nsDOMTokenList* HtmlFor();
// nsGenericHTMLFormElement::GetForm is fine.
void GetName(nsAString& aName)
{
@ -108,7 +108,7 @@ protected:
ValueModeFlag mValueModeFlag;
bool mIsDoneAddingChildren;
nsString mDefaultValue;
RefPtr<nsDOMSettableTokenList> mTokenList;
RefPtr<nsDOMTokenList> mTokenList;
};
} // namespace dom

View File

@ -9,7 +9,7 @@
#include "nsContentUtils.h"
#include "nsGenericHTMLElement.h"
#include "nsVariant.h"
#include "nsDOMSettableTokenList.h"
#include "nsDOMTokenList.h"
#include "nsAttrValue.h"
#include "nsWrapperCacheInlines.h"
#include "mozilla/dom/HTMLPropertiesCollectionBinding.h"

View File

@ -47,7 +47,7 @@ public:
{
SetHTMLIntAttr(nsGkAtoms::rowspan, aRowSpan, aError);
}
//already_AddRefed<nsDOMSettableTokenList> Headers() const;
//already_AddRefed<nsDOMTokenList> Headers() const;
void GetHeaders(DOMString& aHeaders)
{
GetHTMLAttr(nsGkAtoms::headers, aHeaders);

View File

@ -96,7 +96,7 @@
#include "HTMLPropertiesCollection.h"
#include "nsVariant.h"
#include "nsDOMSettableTokenList.h"
#include "nsDOMTokenList.h"
#include "nsThreadUtils.h"
#include "nsTextFragment.h"
#include "mozilla/dom/BindingUtils.h"

View File

@ -20,7 +20,7 @@
#include "mozilla/dom/ValidityState.h"
#include "mozilla/dom/ElementInlines.h"
class nsDOMSettableTokenList;
class nsDOMTokenList;
class nsIDOMHTMLMenuElement;
class nsIEditor;
class nsIFormControlFrame;
@ -104,7 +104,7 @@ public:
{
SetHTMLBoolAttr(nsGkAtoms::itemscope, aItemScope, aError);
}
nsDOMSettableTokenList* ItemType()
nsDOMTokenList* ItemType()
{
return GetTokenList(nsGkAtoms::itemtype);
}
@ -116,11 +116,11 @@ public:
{
SetHTMLAttr(nsGkAtoms::itemid, aItemID, aError);
}
nsDOMSettableTokenList* ItemRef()
nsDOMTokenList* ItemRef()
{
return GetTokenList(nsGkAtoms::itemref);
}
nsDOMSettableTokenList* ItemProp()
nsDOMTokenList* ItemProp()
{
return GetTokenList(nsGkAtoms::itemprop);
}

View File

@ -109,7 +109,7 @@ function checkHtmlForIDLAttribute(element)
is(String(element.htmlFor), 'a b',
"htmlFor IDL attribute should reflect the for content attribute");
// DOMSettableTokenList is tested in another bug so we just test assignation
// DOMTokenList is tested in another bug so we just test assignation
element.htmlFor.value = 'a b c';
is(String(element.htmlFor), 'a b c', "htmlFor should have changed");
}

View File

@ -26,8 +26,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=845057
return ((a+'').split(" ").sort()+'') == ((b+'').split(" ").sort()+'');
}
ok(attr instanceof DOMSettableTokenList,
"Iframe sandbox attribute is instace of DOMSettableTokenList");
ok(attr instanceof DOMTokenList,
"Iframe sandbox attribute is instace of DOMTokenList");
ok(eq(attr, "allow-scripts") &&
eq(iframe.getAttribute("sandbox"), "allow-scripts"),
"Stringyfied sandbox attribute is same as that of the DOM element");

View File

@ -33,8 +33,7 @@ var interfaces = [
"HTMLCollection",
"DOMStringList",
"DOMTokenList",
"DOMSettableTokenList"
];
];
test(function() {
for (var p in window) {
interfaces.forEach(function(i) {

View File

@ -249,6 +249,7 @@ interface Element : Node {
attribute DOMString id;
attribute DOMString className;
[PutForwards=value]
readonly attribute DOMTokenList classList;
readonly attribute Attr[] attributes;
@ -414,10 +415,7 @@ interface DOMTokenList {
void remove(DOMString... tokens);
boolean toggle(DOMString token, optional boolean force);
stringifier;
};
interface DOMSettableTokenList : DOMTokenList {
attribute DOMString value;
attribute DOMString value;
};
</script>
<script>

View File

@ -32,7 +32,7 @@ interface nsIDOMHTMLElement : nsIDOMElement
attribute nsIVariant itemType;
attribute DOMString itemId;
readonly attribute nsISupports properties;
// The following attributes are really nsDOMSettableTokenList, which has
// The following attributes are really nsDOMTokenList, which has
// PutForwards, so we express them as nsIVariants to deal with this.
attribute nsIVariant itemValue;
attribute nsIVariant itemProp;

View File

@ -449,8 +449,6 @@ var interfaceNamesInGlobalScope =
"DOMRectReadOnly",
// IMPORTANT: Do not change this list without review from a DOM peer!
"DOMRequest",
// IMPORTANT: Do not change this list without review from a DOM peer!
"DOMSettableTokenList",
// IMPORTANT: Do not change this list without review from a DOM peer!
"DOMStringList",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -1,16 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/2012/WD-dom-20120105/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface DOMSettableTokenList : DOMTokenList {
[SetterThrows]
attribute DOMString value;
};

View File

@ -21,5 +21,7 @@ interface DOMTokenList {
void remove(DOMString... tokens);
[Throws]
boolean toggle(DOMString token, optional boolean force);
[SetterThrows]
attribute DOMString value;
stringifier DOMString ();
};

View File

@ -30,7 +30,7 @@ interface Element : Node {
attribute DOMString id;
[Pure]
attribute DOMString className;
[Constant]
[Constant, PutForwards=value]
readonly attribute DOMTokenList classList;
[SameObject]

View File

@ -23,6 +23,7 @@ interface HTMLAnchorElement : HTMLElement {
attribute DOMString rel;
[SetterThrows, Pref="network.http.enablePerElementReferrer"]
attribute DOMString referrerPolicy;
[PutForwards=value]
readonly attribute DOMTokenList relList;
[SetterThrows]
attribute DOMString hreflang;

View File

@ -30,6 +30,7 @@ interface HTMLAreaElement : HTMLElement {
attribute DOMString rel;
[SetterThrows, Pref="network.http.enablePerElementReferrer"]
attribute DOMString referrerPolicy;
[PutForwards=value]
readonly attribute DOMTokenList relList;
};

View File

@ -28,11 +28,11 @@ interface HTMLElement : Element {
// microdata
[SetterThrows, Pure]
attribute boolean itemScope;
[PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemType;
[PutForwards=value,Constant] readonly attribute DOMTokenList itemType;
[SetterThrows, Pure]
attribute DOMString itemId;
[PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemRef;
[PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemProp;
[PutForwards=value,Constant] readonly attribute DOMTokenList itemRef;
[PutForwards=value,Constant] readonly attribute DOMTokenList itemProp;
[Constant]
readonly attribute HTMLPropertiesCollection properties;
[Throws]
@ -54,7 +54,7 @@ interface HTMLElement : Element {
readonly attribute DOMString accessKeyLabel;
[SetterThrows, Pure]
attribute boolean draggable;
//[PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
//[PutForwards=value] readonly attribute DOMTokenList dropzone;
[SetterThrows, Pure]
attribute DOMString contentEditable;
[Pure]

View File

@ -18,7 +18,7 @@ interface HTMLIFrameElement : HTMLElement {
attribute DOMString srcdoc;
[SetterThrows, Pure]
attribute DOMString name;
[PutForwards=value] readonly attribute DOMSettableTokenList sandbox;
[PutForwards=value] readonly attribute DOMTokenList sandbox;
// attribute boolean seamless;
[SetterThrows, Pure]
attribute boolean allowFullscreen;

View File

@ -21,6 +21,7 @@ interface HTMLLinkElement : HTMLElement {
attribute DOMString? crossOrigin;
[SetterThrows, Pure]
attribute DOMString rel;
[PutForwards=value]
readonly attribute DOMTokenList relList;
[SetterThrows, Pure]
attribute DOMString media;
@ -28,7 +29,7 @@ interface HTMLLinkElement : HTMLElement {
attribute DOMString hreflang;
[SetterThrows, Pure]
attribute DOMString type;
[PutForwards=value] readonly attribute DOMSettableTokenList sizes;
[PutForwards=value] readonly attribute DOMTokenList sizes;
};
HTMLLinkElement implements LinkStyle;

View File

@ -14,7 +14,7 @@
// http://www.whatwg.org/specs/web-apps/current-work/#the-output-element
interface HTMLOutputElement : HTMLElement {
[PutForwards=value, Constant]
readonly attribute DOMSettableTokenList htmlFor;
readonly attribute DOMTokenList htmlFor;
readonly attribute HTMLFormElement? form;
[SetterThrows, Pure]
attribute DOMString name;

View File

@ -16,7 +16,7 @@ interface HTMLTableCellElement : HTMLElement {
attribute unsigned long colSpan;
[SetterThrows]
attribute unsigned long rowSpan;
//[PutForwards=value] readonly attribute DOMSettableTokenList headers;
//[PutForwards=value] readonly attribute DOMTokenList headers;
[SetterThrows]
attribute DOMString headers;
readonly attribute long cellIndex;

View File

@ -135,7 +135,6 @@ WEBIDL_FILES = [
'DOMRect.webidl',
'DOMRectList.webidl',
'DOMRequest.webidl',
'DOMSettableTokenList.webidl',
'DOMStringList.webidl',
'DOMStringMap.webidl',
'DOMTokenList.webidl',

View File

@ -32,8 +32,7 @@ var interfaces = [
"NodeList",
"HTMLCollection",
"DOMTokenList",
"DOMSettableTokenList"
];
];
test(function() {
for (var p in window) {
interfaces.forEach(function(i) {

View File

@ -283,7 +283,7 @@ interface Element : Node {
attribute DOMString id;
attribute DOMString className;
[SameObject] readonly attribute DOMTokenList classList;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
@ -463,10 +463,6 @@ interface DOMTokenList {
stringifier;
// iterable<DOMString>;
};
interface DOMSettableTokenList : DOMTokenList {
attribute DOMString value;
};
</script>
<script>
"use strict";

View File

@ -285,7 +285,7 @@ interface Element : Node {
attribute DOMString id;
attribute DOMString className;
[SameObject] readonly attribute DOMTokenList classList;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
@ -462,13 +462,10 @@ interface DOMTokenList {
void add(DOMString... tokens);
void remove(DOMString... tokens);
boolean toggle(DOMString token, optional boolean force);
attribute DOMString value;
stringifier;
// iterable<DOMString>;
};
interface DOMSettableTokenList : DOMTokenList {
attribute DOMString value;
};
</script>
<!-- UI Events IDLs -->
<script type=text/plain class=untested>
@ -998,10 +995,10 @@ interface HTMLElement : Element {
// microdata
attribute boolean itemScope;
[PutForwards=value] readonly attribute DOMSettableTokenList itemType;
[PutForwards=value] readonly attribute DOMTokenList itemType;
attribute DOMString itemId;
[PutForwards=value] readonly attribute DOMSettableTokenList itemRef;
[PutForwards=value] readonly attribute DOMSettableTokenList itemProp;
[PutForwards=value] readonly attribute DOMTokenList itemRef;
[PutForwards=value] readonly attribute DOMTokenList itemProp;
readonly attribute HTMLPropertiesCollection properties;
attribute any itemValue; // acts as DOMString on setting
@ -1014,7 +1011,7 @@ interface HTMLElement : Element {
attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
attribute boolean draggable;
[PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
[PutForwards=value] readonly attribute DOMTokenList dropzone;
attribute DOMString contentEditable;
readonly attribute boolean isContentEditable;
attribute HTMLMenuElement? contextMenu;
@ -1052,11 +1049,12 @@ interface HTMLLinkElement : HTMLElement {
attribute DOMString href;
attribute DOMString crossOrigin;
attribute DOMString rel;
[PutForwards=value]
readonly attribute DOMTokenList relList;
attribute DOMString media;
attribute DOMString hreflang;
attribute DOMString type;
[PutForwards=value] readonly attribute DOMSettableTokenList sizes;
[PutForwards=value] readonly attribute DOMTokenList sizes;
// also has obsolete members
};
@ -1132,9 +1130,9 @@ interface HTMLDivElement : HTMLElement {
interface HTMLAnchorElement : HTMLElement {
attribute DOMString target;
attribute DOMString download;
[PutForwards=value] readonly attribute DOMSettableTokenList ping;
[PutForwards=value] readonly attribute DOMTokenList ping;
attribute DOMString rel;
readonly attribute DOMTokenList relList;
[PutForwards=value] readonly attribute DOMTokenList relList;
attribute DOMString hreflang;
attribute DOMString type;
@ -1192,7 +1190,7 @@ interface HTMLIFrameElement : HTMLElement {
attribute DOMString src;
attribute DOMString srcdoc;
attribute DOMString name;
[PutForwards=value] readonly attribute DOMSettableTokenList sandbox;
[PutForwards=value] readonly attribute DOMTokenList sandbox;
attribute boolean seamless;
attribute boolean allowFullscreen;
attribute DOMString width;
@ -1502,9 +1500,9 @@ interface HTMLAreaElement : HTMLElement {
attribute DOMString shape;
attribute DOMString target;
attribute DOMString download;
[PutForwards=value] readonly attribute DOMSettableTokenList ping;
[PutForwards=value] readonly attribute DOMTokenList ping;
attribute DOMString rel;
readonly attribute DOMTokenList relList;
[PutForwards=value] readonly attribute DOMTokenList relList;
// hreflang and type are not reflected
};
HTMLAreaElement implements HTMLHyperlinkElementUtils;
@ -1572,7 +1570,7 @@ interface HTMLTableHeaderCellElement : HTMLTableCellElement {
interface HTMLTableCellElement : HTMLElement {
attribute unsigned long colSpan;
attribute unsigned long rowSpan;
[PutForwards=value] readonly attribute DOMSettableTokenList headers;
[PutForwards=value] readonly attribute DOMTokenList headers;
readonly attribute long cellIndex;
// also has obsolete members
@ -1816,7 +1814,7 @@ interface HTMLKeygenElement : HTMLElement {
};
interface HTMLOutputElement : HTMLElement {
[PutForwards=value] readonly attribute DOMSettableTokenList htmlFor;
[PutForwards=value] readonly attribute DOMTokenList htmlFor;
readonly attribute HTMLFormElement? form;
attribute DOMString name;

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: iframe sandbox attribute value support DOMSettableTokenList interface.</title>
<title>HTML5 Sandbox: iframe sandbox attribute value support DOMTokenList interface.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#the-iframe-element" />
<meta name="assert" content="iframe sandbox attribute value support DOMSettableTokenList interface." />
<meta name="assert" content="iframe sandbox attribute value support DOMTokenList interface." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -17,29 +17,29 @@
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_equals(iframeEle.sandbox.length, 3)
}, "DOMSettableTokenList length")
}, "DOMTokenList length")
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_equals(iframeEle.sandbox.item(1), "allow-same-origin")
}, "DOMSettableTokenList item(index)")
}, "DOMTokenList item(index)")
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_true(iframeEle.sandbox.contains("allow-forms"))
}, "DOMSettableTokenList contains(DomString)")
}, "DOMTokenList contains(DomString)")
test(function() {
var iframeEle = document.getElementById("iframe1");
iframeEle.sandbox.add("ALLOW-SANDBOX");
assert_true(iframeEle.sandbox.contains("ALLOW-SANDBOX"))
}, "DOMSettableTokenList add(DomString)")
}, "DOMTokenList add(DomString)")
test(function() {
var iframeEle = document.getElementById("iframe1");
iframeEle.sandbox.remove("ALLOW-SANDBOX");
assert_false(iframeEle.sandbox.contains("ALLOW-SANDBOX"))
}, "DOMSettableTokenList remove(DomString)")
}, "DOMTokenList remove(DomString)")
test(function() {
var iframeEle = document.getElementById("iframe1");
@ -48,18 +48,18 @@
iframeEle.sandbox.toggle("allow-top-navigation") && iframeEle.sandbox.contains("allow-top-navigation") &&
!iframeEle.sandbox.toggle("allow-top-navigation") && !iframeEle.sandbox.contains("allow-top-navigation")
)
}, "DOMSettableTokenList toggle(DomString) - Returns true if token is now present (it was added); returns false if it is not (it was removed).")
}, "DOMTokenList toggle(DomString) - Returns true if token is now present (it was added); returns false if it is not (it was removed).")
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_equals(iframeEle.sandbox.value, iframeEle.sandbox.toString())
}, "DOMSettableTokenList sandbox.toString()")
}, "DOMTokenList sandbox.toString()")
test(function() {
var iframeEle = document.getElementById("iframe1");
iframeEle.sandbox.remove("ALLOW-SANDBOX");
assert_true(iframeEle.sandbox.contains("allow-scripts") != iframeEle.sandbox.contains("Allow-SCRIPTS"))
}, "DOMSettableTokenList case sensitivity")
}, "DOMTokenList case sensitivity")
</script>
</body>
</html>