summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-05-26 10:11:43 +0100
committerSteve Block <steveblock@google.com>2010-05-27 11:14:42 +0100
commite78cbe89e6f337f2f1fe40315be88f742b547151 (patch)
treed778000b84a04f24bbad50c7fa66244365e960e9
parent7b582e96e4e909ed7dba1e07153d20fbddaec3f7 (diff)
downloadexternal_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.zip
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.gz
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.bz2
Merge WebKit at r60074: Initial merge by git
Change-Id: I18a2dc5439e36c928351ea829d8fb4e39b062fc7
-rw-r--r--JavaScriptCore/API/JSCallbackConstructor.cpp4
-rw-r--r--JavaScriptCore/API/JSCallbackConstructor.h6
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.cpp4
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.h2
-rw-r--r--JavaScriptCore/API/JSCallbackObject.cpp4
-rw-r--r--JavaScriptCore/API/JSCallbackObject.h4
-rw-r--r--JavaScriptCore/API/JSCallbackObjectFunctions.h11
-rw-r--r--JavaScriptCore/API/JSClassRef.cpp2
-rw-r--r--JavaScriptCore/API/JSContextRef.cpp2
-rw-r--r--JavaScriptCore/API/JSObjectRef.cpp26
-rw-r--r--JavaScriptCore/API/JSStringRefBSTR.cpp2
-rw-r--r--JavaScriptCore/API/JSValueRef.cpp4
-rw-r--r--JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp2
-rw-r--r--JavaScriptCore/Android.mk1
-rw-r--r--JavaScriptCore/CMakeLists.txt2
-rw-r--r--JavaScriptCore/ChangeLog1199
-rw-r--r--JavaScriptCore/Configurations/FeatureDefines.xcconfig3
-rw-r--r--JavaScriptCore/Configurations/Version.xcconfig2
-rw-r--r--JavaScriptCore/GNUmakefile.am2
-rw-r--r--JavaScriptCore/JavaScriptCore.exp21
-rw-r--r--JavaScriptCore/JavaScriptCore.gypi4
-rw-r--r--JavaScriptCore/JavaScriptCore.pro2
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def13
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj12
-rw-r--r--JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj44
-rw-r--r--JavaScriptCore/bytecode/CodeBlock.cpp43
-rw-r--r--JavaScriptCore/bytecode/CodeBlock.h44
-rw-r--r--JavaScriptCore/bytecode/Opcode.h19
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.cpp88
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.h34
-rw-r--r--JavaScriptCore/bytecompiler/NodesCodegen.cpp34
-rw-r--r--JavaScriptCore/interpreter/CallFrame.h12
-rw-r--r--JavaScriptCore/interpreter/CallFrameClosure.h2
-rw-r--r--JavaScriptCore/interpreter/Interpreter.cpp443
-rw-r--r--JavaScriptCore/interpreter/Interpreter.h9
-rw-r--r--JavaScriptCore/interpreter/Register.h2
-rw-r--r--JavaScriptCore/interpreter/RegisterFile.h19
-rw-r--r--JavaScriptCore/jit/JIT.cpp54
-rw-r--r--JavaScriptCore/jit/JIT.h41
-rw-r--r--JavaScriptCore/jit/JITArithmetic.cpp8
-rw-r--r--JavaScriptCore/jit/JITArithmetic32_64.cpp10
-rw-r--r--JavaScriptCore/jit/JITCall.cpp475
-rw-r--r--JavaScriptCore/jit/JITCall32_64.cpp427
-rw-r--r--JavaScriptCore/jit/JITInlineMethods.h62
-rw-r--r--JavaScriptCore/jit/JITOpcodes.cpp136
-rw-r--r--JavaScriptCore/jit/JITOpcodes32_64.cpp331
-rw-r--r--JavaScriptCore/jit/JITPropertyAccess.cpp17
-rw-r--r--JavaScriptCore/jit/JITPropertyAccess32_64.cpp26
-rw-r--r--JavaScriptCore/jit/JITStubCall.h10
-rw-r--r--JavaScriptCore/jit/JITStubs.cpp119
-rw-r--r--JavaScriptCore/jit/JITStubs.h25
-rw-r--r--JavaScriptCore/jit/JSInterfaceJIT.h23
-rw-r--r--JavaScriptCore/jit/SpecializedThunkJIT.h6
-rw-r--r--JavaScriptCore/jit/ThunkGenerators.cpp31
-rw-r--r--JavaScriptCore/jit/ThunkGenerators.h15
-rw-r--r--JavaScriptCore/jsc.cpp22
-rw-r--r--JavaScriptCore/profiler/ProfileNode.cpp2
-rw-r--r--JavaScriptCore/profiler/Profiler.cpp3
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro4
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h2
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp1922
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp165
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp567
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp1763
-rw-r--r--JavaScriptCore/runtime/Arguments.h12
-rw-r--r--JavaScriptCore/runtime/ArrayConstructor.cpp6
-rw-r--r--JavaScriptCore/runtime/ArrayConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ArrayPrototype.cpp3
-rw-r--r--JavaScriptCore/runtime/ArrayPrototype.h10
-rw-r--r--JavaScriptCore/runtime/BooleanConstructor.cpp4
-rw-r--r--JavaScriptCore/runtime/BooleanConstructor.h2
-rw-r--r--JavaScriptCore/runtime/BooleanPrototype.cpp6
-rw-r--r--JavaScriptCore/runtime/BooleanPrototype.h2
-rw-r--r--JavaScriptCore/runtime/DateConstructor.cpp10
-rw-r--r--JavaScriptCore/runtime/DateConstructor.h2
-rw-r--r--JavaScriptCore/runtime/DatePrototype.cpp3
-rw-r--r--JavaScriptCore/runtime/DatePrototype.h2
-rw-r--r--JavaScriptCore/runtime/ErrorConstructor.cpp4
-rw-r--r--JavaScriptCore/runtime/ErrorConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ErrorPrototype.cpp4
-rw-r--r--JavaScriptCore/runtime/ErrorPrototype.h2
-rw-r--r--JavaScriptCore/runtime/Executable.h37
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.cpp4
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.h2
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.cpp24
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.h4
-rw-r--r--JavaScriptCore/runtime/GlobalEvalFunction.cpp4
-rw-r--r--JavaScriptCore/runtime/GlobalEvalFunction.h2
-rw-r--r--JavaScriptCore/runtime/InternalFunction.cpp14
-rw-r--r--JavaScriptCore/runtime/InternalFunction.h10
-rw-r--r--JavaScriptCore/runtime/JSActivation.cpp34
-rw-r--r--JavaScriptCore/runtime/JSActivation.h2
-rw-r--r--JavaScriptCore/runtime/JSCell.h8
-rw-r--r--JavaScriptCore/runtime/JSFunction.cpp66
-rw-r--r--JavaScriptCore/runtime/JSFunction.h59
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.cpp11
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.h6
-rw-r--r--JavaScriptCore/runtime/JSGlobalObject.cpp98
-rw-r--r--JavaScriptCore/runtime/JSGlobalObject.h15
-rw-r--r--JavaScriptCore/runtime/JSONObject.cpp6
-rw-r--r--JavaScriptCore/runtime/JSONObject.h9
-rw-r--r--JavaScriptCore/runtime/JSObject.cpp11
-rw-r--r--JavaScriptCore/runtime/JSObject.h11
-rw-r--r--JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp46
-rw-r--r--JavaScriptCore/runtime/JSObjectWithGlobalObject.h58
-rw-r--r--JavaScriptCore/runtime/JSString.cpp3
-rw-r--r--JavaScriptCore/runtime/JSString.h9
-rw-r--r--JavaScriptCore/runtime/JSValue.cpp5
-rw-r--r--JavaScriptCore/runtime/JSValue.h1
-rw-r--r--JavaScriptCore/runtime/Lookup.cpp10
-rw-r--r--JavaScriptCore/runtime/MathObject.cpp4
-rw-r--r--JavaScriptCore/runtime/MathObject.h6
-rw-r--r--JavaScriptCore/runtime/NativeErrorConstructor.cpp11
-rw-r--r--JavaScriptCore/runtime/NativeErrorConstructor.h2
-rw-r--r--JavaScriptCore/runtime/NativeErrorPrototype.cpp11
-rw-r--r--JavaScriptCore/runtime/NativeErrorPrototype.h7
-rw-r--r--JavaScriptCore/runtime/NumberConstructor.cpp4
-rw-r--r--JavaScriptCore/runtime/NumberConstructor.h2
-rw-r--r--JavaScriptCore/runtime/NumberPrototype.cpp14
-rw-r--r--JavaScriptCore/runtime/NumberPrototype.h2
-rw-r--r--JavaScriptCore/runtime/ObjectConstructor.cpp18
-rw-r--r--JavaScriptCore/runtime/ObjectConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ObjectPrototype.cpp22
-rw-r--r--JavaScriptCore/runtime/ObjectPrototype.h2
-rw-r--r--JavaScriptCore/runtime/PrototypeFunction.cpp8
-rw-r--r--JavaScriptCore/runtime/PrototypeFunction.h4
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.cpp6
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.h2
-rw-r--r--JavaScriptCore/runtime/RegExpObject.cpp4
-rw-r--r--JavaScriptCore/runtime/RegExpObject.h10
-rw-r--r--JavaScriptCore/runtime/RegExpPrototype.cpp10
-rw-r--r--JavaScriptCore/runtime/RegExpPrototype.h2
-rw-r--r--JavaScriptCore/runtime/StringConstructor.cpp10
-rw-r--r--JavaScriptCore/runtime/StringConstructor.h2
-rw-r--r--JavaScriptCore/runtime/StringPrototype.cpp5
-rw-r--r--JavaScriptCore/runtime/StringPrototype.h2
-rw-r--r--JavaScriptCore/runtime/UString.cpp2
-rw-r--r--JavaScriptCore/wtf/CurrentTime.cpp1
-rw-r--r--JavaScriptCore/wtf/ListHashSet.h206
-rw-r--r--JavaScriptCore/wtf/MainThread.cpp2
-rw-r--r--JavaScriptCore/wtf/Platform.h10
-rw-r--r--JavaScriptCore/wtf/SizeLimits.cpp56
-rw-r--r--JavaScriptCore/wtf/StringExtras.h2
-rw-r--r--JavaScriptCore/wtf/text/StringImpl.cpp2
-rw-r--r--JavaScriptCore/yarr/RegexInterpreter.cpp2
-rw-r--r--JavaScriptGlue/Configurations/Version.xcconfig2
-rw-r--r--LayoutTests/fast/dom/Geolocation/argument-types.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/callback-exception.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/enabled.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/error-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/error.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/maximum-age.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/notimer-after-unload-expected.txt3
-rw-r--r--LayoutTests/fast/dom/Geolocation/notimer-after-unload.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/ongoing-request-leak-expected.txt1
-rw-r--r--LayoutTests/fast/dom/Geolocation/ongoing-request-leak.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/position-string-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/position-string.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-error.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-success.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/js-test-post.js4
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/TEMPLATE.html (renamed from LayoutTests/fast/dom/Geolocation/resources/TEMPLATE.html)2
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js (renamed from LayoutTests/fast/dom/Geolocation/resources/argument-types.js)4
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js (renamed from LayoutTests/fast/dom/Geolocation/resources/callback-exception.js)13
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/enabled.js (renamed from LayoutTests/fast/dom/Geolocation/resources/enabled.js)4
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/error.js (renamed from LayoutTests/fast/dom/Geolocation/resources/error.js)10
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js (renamed from LayoutTests/fast/dom/Geolocation/resources/maximum-age.js)15
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js21
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/ongoing-request-leak.js13
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js (renamed from LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js)15
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js (renamed from LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-error.js)11
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js (renamed from LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-success.js)11
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js (renamed from LayoutTests/fast/dom/Geolocation/resources/permission-denied-stops-watches.js)15
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js (renamed from LayoutTests/fast/dom/Geolocation/resources/permission-denied.js)9
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/position-string.js (renamed from LayoutTests/fast/dom/Geolocation/resources/position-string.js)9
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js (renamed from LayoutTests/fast/dom/Geolocation/resources/reentrant-error.js)13
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js (renamed from LayoutTests/fast/dom/Geolocation/resources/reentrant-success.js)13
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/success.js (renamed from LayoutTests/fast/dom/Geolocation/resources/success.js)9
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js (renamed from LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js)13
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js (renamed from LayoutTests/fast/dom/Geolocation/resources/timeout-zero.js)9
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/timeout.js (renamed from LayoutTests/fast/dom/Geolocation/resources/timeout.js)9
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/watch.js (renamed from LayoutTests/fast/dom/Geolocation/resources/watch.js)11
-rw-r--r--LayoutTests/fast/dom/Geolocation/success-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/success.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-zero.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout.html4
-rw-r--r--LayoutTests/fast/dom/Geolocation/watch-expected.txt2
-rw-r--r--LayoutTests/fast/dom/Geolocation/watch.html4
-rw-r--r--WebCore/Android.derived.jscbindings.mk6
-rw-r--r--WebCore/Android.derived.v8bindings.mk6
-rw-r--r--WebCore/Android.jscbindings.mk1
-rw-r--r--WebCore/Android.mk10
-rw-r--r--WebCore/Android.v8bindings.mk1
-rw-r--r--WebCore/CMakeLists.txt95
-rw-r--r--WebCore/ChangeLog4623
-rw-r--r--WebCore/Configurations/FeatureDefines.xcconfig3
-rw-r--r--WebCore/Configurations/Version.xcconfig2
-rw-r--r--WebCore/Configurations/WebCore.xcconfig6
-rw-r--r--WebCore/DerivedSources.cpp2
-rw-r--r--WebCore/DerivedSources.make2
-rw-r--r--WebCore/English.lproj/localizedStrings.jsbin41678 -> 40130 bytes
-rw-r--r--WebCore/ForwardingHeaders/runtime/JSObjectWithGlobalObject.h4
-rw-r--r--WebCore/GNUmakefile.am36
-rw-r--r--WebCore/WebCore.PluginHostProcess.exp5
-rw-r--r--WebCore/WebCore.base.exp9
-rw-r--r--WebCore/WebCore.gyp/WebCore.gyp2
-rw-r--r--WebCore/WebCore.gypi31
-rw-r--r--WebCore/WebCore.pri2
-rw-r--r--WebCore/WebCore.pro23
-rw-r--r--WebCore/WebCore.vcproj/WebCore.vcproj298
-rw-r--r--WebCore/WebCore.vcproj/WebCoreCommon.vsprops2
-rw-r--r--WebCore/WebCore.xcodeproj/project.pbxproj144
-rw-r--r--WebCore/WebCorePrefix.h2
-rw-r--r--WebCore/accessibility/AccessibilityRenderObject.cpp24
-rw-r--r--WebCore/accessibility/AccessibilityTable.cpp4
-rw-r--r--WebCore/accessibility/mac/AccessibilityObjectWrapper.mm4
-rw-r--r--WebCore/benchmarks/parser/html-parser.html78
-rw-r--r--WebCore/benchmarks/parser/resources/html5.html85096
-rw-r--r--WebCore/bindings/ScriptControllerBase.cpp14
-rw-r--r--WebCore/bindings/js/GCController.cpp2
-rw-r--r--WebCore/bindings/js/JSAttrCustom.cpp17
-rw-r--r--WebCore/bindings/js/JSBindingsAllInOne.cpp1
-rw-r--r--WebCore/bindings/js/JSCallbackData.cpp5
-rw-r--r--WebCore/bindings/js/JSDOMBinding.cpp2
-rw-r--r--WebCore/bindings/js/JSDOMBinding.h12
-rw-r--r--WebCore/bindings/js/JSDOMWindowCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSDOMWindowShell.cpp3
-rw-r--r--WebCore/bindings/js/JSDOMWindowShell.h6
-rw-r--r--WebCore/bindings/js/JSDOMWrapper.h10
-rw-r--r--WebCore/bindings/js/JSEventCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSEventListener.cpp15
-rw-r--r--WebCore/bindings/js/JSHistoryCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSInjectedScriptHostCustom.cpp3
-rw-r--r--WebCore/bindings/js/JSLocationCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSMainThreadExecState.cpp33
-rw-r--r--WebCore/bindings/js/JSMainThreadExecState.h84
-rw-r--r--WebCore/bindings/js/JSNamedNodeMapCustom.cpp32
-rw-r--r--WebCore/bindings/js/JSNodeCustom.cpp57
-rw-r--r--WebCore/bindings/js/ScheduledAction.cpp12
-rw-r--r--WebCore/bindings/js/ScheduledAction.h2
-rw-r--r--WebCore/bindings/js/ScriptCallStack.cpp10
-rw-r--r--WebCore/bindings/js/ScriptCallStack.h2
-rw-r--r--WebCore/bindings/js/ScriptController.cpp33
-rw-r--r--WebCore/bindings/js/ScriptController.h19
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.cpp3
-rw-r--r--WebCore/bindings/js/WorkerScriptController.cpp10
-rw-r--r--WebCore/bindings/objc/ObjCEventListener.mm1
-rw-r--r--WebCore/bindings/objc/WebScriptObject.mm5
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm22
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorObjC.pm6
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm13
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestInterface.cpp24
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestObj.cpp24
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm5
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm1
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm50
-rw-r--r--WebCore/bindings/v8/NPV8Object.cpp58
-rw-r--r--WebCore/bindings/v8/NPV8Object.h14
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp11
-rw-r--r--WebCore/bindings/v8/ScriptController.h16
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp4
-rw-r--r--WebCore/bindings/v8/V8NPObject.h4
-rw-r--r--WebCore/bindings/v8/V8NPUtils.cpp54
-rw-r--r--WebCore/bindings/v8/V8NPUtils.h20
-rw-r--r--WebCore/bindings/v8/custom/V8EventCustom.cpp5
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp42
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8NodeCustom.cpp63
-rw-r--r--WebCore/bindings/v8/npruntime.cpp2
-rw-r--r--WebCore/bridge/c/CRuntimeObject.cpp4
-rw-r--r--WebCore/bridge/c/CRuntimeObject.h2
-rw-r--r--WebCore/bridge/c/c_instance.cpp8
-rw-r--r--WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp8
-rw-r--r--WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp4
-rw-r--r--WebCore/bridge/jni/jsc/JavaRuntimeObject.h2
-rw-r--r--WebCore/bridge/jsc/BridgeJSC.cpp2
-rw-r--r--WebCore/bridge/objc/ObjCRuntimeObject.h2
-rw-r--r--WebCore/bridge/objc/ObjCRuntimeObject.mm4
-rw-r--r--WebCore/bridge/objc/objc_class.mm2
-rw-r--r--WebCore/bridge/objc/objc_instance.mm8
-rw-r--r--WebCore/bridge/objc/objc_runtime.h5
-rw-r--r--WebCore/bridge/objc/objc_runtime.mm4
-rw-r--r--WebCore/bridge/qt/qt_instance.cpp10
-rw-r--r--WebCore/bridge/qt/qt_pixmapruntime.cpp10
-rw-r--r--WebCore/bridge/qt/qt_runtime.cpp4
-rw-r--r--WebCore/bridge/runtime_method.cpp4
-rw-r--r--WebCore/bridge/runtime_method.h2
-rw-r--r--WebCore/bridge/runtime_object.cpp8
-rw-r--r--WebCore/bridge/runtime_object.h7
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.cpp8
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.h5
-rw-r--r--WebCore/css/CSSCursorImageValue.cpp2
-rw-r--r--WebCore/css/CSSGrammar.y25
-rw-r--r--WebCore/css/CSSParser.cpp345
-rw-r--r--WebCore/css/CSSParser.h18
-rw-r--r--WebCore/css/CSSPropertyNames.in1
-rw-r--r--WebCore/css/CSSSelector.cpp15
-rw-r--r--WebCore/css/CSSSelector.h7
-rw-r--r--WebCore/css/CSSStyleSelector.cpp31
-rw-r--r--WebCore/css/CSSStyleSheet.cpp21
-rw-r--r--WebCore/css/SVGCSSStyleSelector.cpp10
-rw-r--r--WebCore/dom/Attr.cpp6
-rw-r--r--WebCore/dom/Attr.idl2
-rw-r--r--WebCore/dom/Attribute.cpp52
-rw-r--r--WebCore/dom/Attribute.h59
-rw-r--r--WebCore/dom/CrossThreadTask.h (renamed from WebCore/workers/GenericWorkerTask.h)190
-rw-r--r--WebCore/dom/DOMStringList.cpp44
-rw-r--r--WebCore/dom/DOMStringList.h63
-rw-r--r--WebCore/dom/DOMStringList.idl38
-rw-r--r--WebCore/dom/DeviceOrientation.cpp54
-rw-r--r--WebCore/dom/DeviceOrientation.h49
-rw-r--r--WebCore/dom/DeviceOrientationClient.h42
-rw-r--r--WebCore/dom/DeviceOrientationEvent.cpp62
-rw-r--r--WebCore/dom/DeviceOrientationEvent.h63
-rw-r--r--WebCore/dom/DeviceOrientationEvent.idl37
-rw-r--r--WebCore/dom/Document.cpp27
-rw-r--r--WebCore/dom/Document.h8
-rw-r--r--WebCore/dom/Element.cpp2
-rw-r--r--WebCore/dom/Element.h2
-rw-r--r--WebCore/dom/Event.cpp7
-rw-r--r--WebCore/dom/Event.h3
-rw-r--r--WebCore/dom/EventNames.h1
-rw-r--r--WebCore/dom/InputElement.cpp6
-rw-r--r--WebCore/dom/InputElement.h6
-rw-r--r--WebCore/dom/MappedAttribute.h68
-rw-r--r--WebCore/dom/NamedAttrMap.h151
-rw-r--r--WebCore/dom/NamedMappedAttrMap.cpp87
-rw-r--r--WebCore/dom/NamedMappedAttrMap.h62
-rw-r--r--WebCore/dom/NamedNodeMap.cpp (renamed from WebCore/dom/NamedAttrMap.cpp)61
-rw-r--r--WebCore/dom/NamedNodeMap.h167
-rw-r--r--WebCore/dom/NamedNodeMap.idl4
-rw-r--r--WebCore/dom/Node.cpp15
-rw-r--r--WebCore/dom/Node.idl4
-rw-r--r--WebCore/dom/Position.h1
-rw-r--r--WebCore/dom/ScriptElement.cpp18
-rw-r--r--WebCore/dom/SelectElement.cpp6
-rw-r--r--WebCore/dom/SelectElement.h4
-rw-r--r--WebCore/dom/StyleElement.cpp2
-rw-r--r--WebCore/dom/StyledElement.cpp47
-rw-r--r--WebCore/dom/StyledElement.h24
-rw-r--r--WebCore/dom/Tokenizer.h3
-rw-r--r--WebCore/editing/ApplyStyleCommand.cpp18
-rw-r--r--WebCore/editing/ApplyStyleCommand.h13
-rw-r--r--WebCore/editing/CompositeEditCommand.cpp4
-rw-r--r--WebCore/editing/DeleteButtonController.cpp2
-rw-r--r--WebCore/editing/DeleteSelectionCommand.cpp4
-rw-r--r--WebCore/editing/IndentOutdentCommand.cpp8
-rw-r--r--WebCore/editing/InsertParagraphSeparatorCommand.cpp2
-rw-r--r--WebCore/editing/RemoveFormatCommand.cpp2
-rw-r--r--WebCore/editing/ReplaceNodeWithSpanCommand.cpp1
-rw-r--r--WebCore/editing/ReplaceSelectionCommand.cpp8
-rw-r--r--WebCore/editing/SelectionController.cpp2
-rw-r--r--WebCore/editing/VisiblePosition.h1
-rw-r--r--WebCore/editing/brew/EditorBrew.cpp39
-rw-r--r--WebCore/editing/markup.cpp16
-rw-r--r--WebCore/editing/markup.h2
-rw-r--r--WebCore/html/FileReader.cpp66
-rw-r--r--WebCore/html/FileReader.h18
-rw-r--r--WebCore/html/FileStreamProxy.cpp2
-rw-r--r--WebCore/html/HTML5Lexer.cpp1319
-rw-r--r--WebCore/html/HTML5Lexer.h162
-rw-r--r--WebCore/html/HTML5Token.h206
-rw-r--r--WebCore/html/HTML5Tokenizer.cpp82
-rw-r--r--WebCore/html/HTML5Tokenizer.h67
-rw-r--r--WebCore/html/HTML5TreeBuilder.cpp117
-rw-r--r--WebCore/html/HTML5TreeBuilder.h66
-rw-r--r--WebCore/html/HTMLAnchorElement.cpp6
-rw-r--r--WebCore/html/HTMLAnchorElement.h2
-rw-r--r--WebCore/html/HTMLAppletElement.cpp4
-rw-r--r--WebCore/html/HTMLAppletElement.h2
-rw-r--r--WebCore/html/HTMLAreaElement.cpp4
-rw-r--r--WebCore/html/HTMLAreaElement.h2
-rw-r--r--WebCore/html/HTMLBRElement.cpp4
-rw-r--r--WebCore/html/HTMLBRElement.h2
-rw-r--r--WebCore/html/HTMLBaseElement.cpp4
-rw-r--r--WebCore/html/HTMLBaseElement.h2
-rw-r--r--WebCore/html/HTMLBodyElement.cpp4
-rw-r--r--WebCore/html/HTMLBodyElement.h2
-rw-r--r--WebCore/html/HTMLButtonElement.cpp6
-rw-r--r--WebCore/html/HTMLButtonElement.h2
-rw-r--r--WebCore/html/HTMLCanvasElement.cpp15
-rw-r--r--WebCore/html/HTMLCanvasElement.h2
-rw-r--r--WebCore/html/HTMLDataGridColElement.cpp6
-rw-r--r--WebCore/html/HTMLDataGridColElement.h2
-rw-r--r--WebCore/html/HTMLDivElement.cpp4
-rw-r--r--WebCore/html/HTMLDivElement.h2
-rw-r--r--WebCore/html/HTMLDocument.cpp7
-rw-r--r--WebCore/html/HTMLElement.cpp12
-rw-r--r--WebCore/html/HTMLElement.h8
-rw-r--r--WebCore/html/HTMLEmbedElement.cpp4
-rw-r--r--WebCore/html/HTMLEmbedElement.h2
-rw-r--r--WebCore/html/HTMLFontElement.cpp4
-rw-r--r--WebCore/html/HTMLFontElement.h2
-rw-r--r--WebCore/html/HTMLFormControlElement.cpp6
-rw-r--r--WebCore/html/HTMLFormControlElement.h4
-rw-r--r--WebCore/html/HTMLFormElement.cpp6
-rw-r--r--WebCore/html/HTMLFormElement.h2
-rw-r--r--WebCore/html/HTMLFrameElement.cpp4
-rw-r--r--WebCore/html/HTMLFrameElement.h2
-rw-r--r--WebCore/html/HTMLFrameElementBase.cpp13
-rw-r--r--WebCore/html/HTMLFrameElementBase.h2
-rw-r--r--WebCore/html/HTMLFrameSetElement.cpp6
-rw-r--r--WebCore/html/HTMLFrameSetElement.h2
-rw-r--r--WebCore/html/HTMLHRElement.cpp4
-rw-r--r--WebCore/html/HTMLHRElement.h2
-rw-r--r--WebCore/html/HTMLIFrameElement.cpp6
-rw-r--r--WebCore/html/HTMLIFrameElement.h2
-rw-r--r--WebCore/html/HTMLImageElement.cpp4
-rw-r--r--WebCore/html/HTMLImageElement.h2
-rw-r--r--WebCore/html/HTMLInputElement.cpp38
-rw-r--r--WebCore/html/HTMLInputElement.h2
-rw-r--r--WebCore/html/HTMLIsIndexElement.cpp4
-rw-r--r--WebCore/html/HTMLIsIndexElement.h2
-rw-r--r--WebCore/html/HTMLKeygenElement.cpp4
-rw-r--r--WebCore/html/HTMLKeygenElement.h4
-rw-r--r--WebCore/html/HTMLLIElement.cpp4
-rw-r--r--WebCore/html/HTMLLIElement.h2
-rw-r--r--WebCore/html/HTMLLinkElement.cpp4
-rw-r--r--WebCore/html/HTMLLinkElement.h2
-rw-r--r--WebCore/html/HTMLMapElement.cpp4
-rw-r--r--WebCore/html/HTMLMapElement.h2
-rw-r--r--WebCore/html/HTMLMarqueeElement.cpp4
-rw-r--r--WebCore/html/HTMLMarqueeElement.h2
-rw-r--r--WebCore/html/HTMLMediaElement.cpp14
-rw-r--r--WebCore/html/HTMLMediaElement.h3
-rw-r--r--WebCore/html/HTMLMetaElement.cpp4
-rw-r--r--WebCore/html/HTMLMetaElement.h2
-rw-r--r--WebCore/html/HTMLMeterElement.cpp4
-rw-r--r--WebCore/html/HTMLMeterElement.h2
-rw-r--r--WebCore/html/HTMLOListElement.cpp4
-rw-r--r--WebCore/html/HTMLOListElement.h2
-rw-r--r--WebCore/html/HTMLObjectElement.cpp6
-rw-r--r--WebCore/html/HTMLObjectElement.h2
-rw-r--r--WebCore/html/HTMLOptGroupElement.cpp2
-rw-r--r--WebCore/html/HTMLOptGroupElement.h2
-rw-r--r--WebCore/html/HTMLOptionElement.cpp4
-rw-r--r--WebCore/html/HTMLOptionElement.h6
-rw-r--r--WebCore/html/HTMLParagraphElement.cpp4
-rw-r--r--WebCore/html/HTMLParagraphElement.h2
-rw-r--r--WebCore/html/HTMLParamElement.cpp4
-rw-r--r--WebCore/html/HTMLParamElement.h2
-rw-r--r--WebCore/html/HTMLParser.cpp189
-rw-r--r--WebCore/html/HTMLPlugInElement.cpp4
-rw-r--r--WebCore/html/HTMLPlugInElement.h2
-rw-r--r--WebCore/html/HTMLPreElement.cpp4
-rw-r--r--WebCore/html/HTMLPreElement.h2
-rw-r--r--WebCore/html/HTMLProgressElement.cpp4
-rw-r--r--WebCore/html/HTMLProgressElement.h4
-rw-r--r--WebCore/html/HTMLScriptElement.cpp4
-rw-r--r--WebCore/html/HTMLScriptElement.h2
-rw-r--r--WebCore/html/HTMLSelectElement.cpp4
-rw-r--r--WebCore/html/HTMLSelectElement.h2
-rw-r--r--WebCore/html/HTMLStyleElement.cpp4
-rw-r--r--WebCore/html/HTMLStyleElement.h2
-rw-r--r--WebCore/html/HTMLTableCaptionElement.cpp4
-rw-r--r--WebCore/html/HTMLTableCaptionElement.h2
-rw-r--r--WebCore/html/HTMLTableCellElement.cpp4
-rw-r--r--WebCore/html/HTMLTableCellElement.h2
-rw-r--r--WebCore/html/HTMLTableColElement.cpp4
-rw-r--r--WebCore/html/HTMLTableColElement.h2
-rw-r--r--WebCore/html/HTMLTableElement.cpp4
-rw-r--r--WebCore/html/HTMLTableElement.h2
-rw-r--r--WebCore/html/HTMLTablePartElement.cpp4
-rw-r--r--WebCore/html/HTMLTablePartElement.h2
-rw-r--r--WebCore/html/HTMLTextAreaElement.cpp6
-rw-r--r--WebCore/html/HTMLTextAreaElement.h2
-rw-r--r--WebCore/html/HTMLTokenizer.cpp282
-rw-r--r--WebCore/html/HTMLTokenizer.h13
-rw-r--r--WebCore/html/HTMLUListElement.cpp4
-rw-r--r--WebCore/html/HTMLUListElement.h2
-rw-r--r--WebCore/html/HTMLVideoElement.cpp8
-rw-r--r--WebCore/html/HTMLVideoElement.h2
-rw-r--r--WebCore/html/HTMLViewSourceDocument.cpp27
-rw-r--r--WebCore/html/canvas/CanvasRenderingContext2D.cpp59
-rw-r--r--WebCore/html/canvas/CanvasRenderingContext2D.h3
-rw-r--r--WebCore/html/canvas/CanvasStyle.cpp200
-rw-r--r--WebCore/html/canvas/CanvasStyle.h42
-rw-r--r--WebCore/inspector/InspectorController.cpp36
-rw-r--r--WebCore/inspector/InspectorDOMAgent.cpp12
-rw-r--r--WebCore/inspector/front-end/AuditRules.js12
-rw-r--r--WebCore/inspector/front-end/ConsoleView.js8
-rw-r--r--WebCore/inspector/front-end/HelpScreen.js15
-rw-r--r--WebCore/inspector/front-end/ImageView.js2
-rw-r--r--WebCore/inspector/front-end/ProfileDataGridTree.js2
-rw-r--r--WebCore/inspector/front-end/ResourcesPanel.js8
-rw-r--r--WebCore/inspector/front-end/ScriptsPanel.js10
-rw-r--r--WebCore/inspector/front-end/SourceFrame.js4
-rw-r--r--WebCore/inspector/front-end/TimelineOverviewPane.js3
-rw-r--r--WebCore/inspector/front-end/TimelinePanel.js59
-rw-r--r--WebCore/inspector/front-end/inspector.js10
-rw-r--r--WebCore/loader/DocLoader.cpp15
-rw-r--r--WebCore/loader/DocLoader.h5
-rw-r--r--WebCore/loader/DocumentWriter.cpp6
-rw-r--r--WebCore/loader/FrameLoader.cpp37
-rw-r--r--WebCore/loader/FrameLoader.h5
-rw-r--r--WebCore/loader/HistoryController.cpp9
-rw-r--r--WebCore/loader/PluginDocument.h3
-rw-r--r--WebCore/loader/SinkDocument.cpp71
-rw-r--r--WebCore/loader/SinkDocument.h49
-rw-r--r--WebCore/loader/WorkerThreadableLoader.cpp2
-rw-r--r--WebCore/loader/icon/IconDatabase.cpp4
-rw-r--r--WebCore/manual-tests/crash-and-no-repaint-after-wake-from-sleep.html186
-rw-r--r--WebCore/manual-tests/divx-plugin-fails-to-draw.html12
-rw-r--r--WebCore/manual-tests/ime-keydown-preventdefault.html27
-rw-r--r--WebCore/manual-tests/style-keypress-events.html38
-rw-r--r--WebCore/notifications/Notification.h8
-rw-r--r--WebCore/notifications/Notification.idl3
-rw-r--r--WebCore/page/DOMWindow.h4
-rw-r--r--WebCore/page/DOMWindow.idl12
-rw-r--r--WebCore/page/EventHandler.cpp2
-rw-r--r--WebCore/page/Frame.cpp3
-rw-r--r--WebCore/page/Page.cpp11
-rw-r--r--WebCore/page/Page.h10
-rw-r--r--WebCore/page/SecurityOrigin.h1
-rw-r--r--WebCore/page/Settings.cpp4
-rw-r--r--WebCore/page/Settings.h7
-rw-r--r--WebCore/page/animation/AnimationBase.cpp2
-rw-r--r--WebCore/page/animation/AnimationBase.h3
-rw-r--r--WebCore/page/brew/DragControllerBrew.cpp70
-rw-r--r--WebCore/page/mac/FrameMac.mm8
-rw-r--r--WebCore/page/qt/EventHandlerQt.cpp4
-rw-r--r--WebCore/platform/ContextMenu.cpp21
-rw-r--r--WebCore/platform/DragData.h2
-rw-r--r--WebCore/platform/FileSystem.cpp40
-rw-r--r--WebCore/platform/FileSystem.h7
-rw-r--r--WebCore/platform/GeolocationService.cpp10
-rw-r--r--WebCore/platform/GeolocationService.h4
-rw-r--r--WebCore/platform/brew/DragDataBrew.cpp96
-rw-r--r--WebCore/platform/brew/LocalizedStringsBrew.cpp10
-rw-r--r--WebCore/platform/brew/SSLKeyGeneratorBrew.cpp (renamed from WebCore/dom/MappedAttribute.cpp)20
-rw-r--r--WebCore/platform/brew/ScrollbarThemeBrew.cpp42
-rw-r--r--WebCore/platform/brew/ScrollbarThemeBrew.h39
-rw-r--r--WebCore/platform/chromium/ChromiumBridge.h2
-rw-r--r--WebCore/platform/chromium/ClipboardChromium.cpp1
-rw-r--r--WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp12
-rw-r--r--WebCore/platform/chromium/ClipboardUtilitiesChromium.h2
-rw-r--r--WebCore/platform/chromium/DragDataChromium.cpp5
-rw-r--r--WebCore/platform/chromium/GeolocationServiceChromium.cpp2
-rw-r--r--WebCore/platform/efl/LocalizedStringsEfl.cpp63
-rw-r--r--WebCore/platform/graphics/Color.cpp12
-rw-r--r--WebCore/platform/graphics/Color.h6
-rw-r--r--WebCore/platform/graphics/Font.cpp6
-rw-r--r--WebCore/platform/graphics/Font.h3
-rw-r--r--WebCore/platform/graphics/MediaPlayer.cpp11
-rw-r--r--WebCore/platform/graphics/MediaPlayer.h6
-rw-r--r--WebCore/platform/graphics/brew/IconBrew.cpp51
-rw-r--r--WebCore/platform/graphics/chromium/FontCacheLinux.cpp7
-rw-r--r--WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp14
-rw-r--r--WebCore/platform/graphics/chromium/LayerChromium.cpp88
-rw-r--r--WebCore/platform/graphics/chromium/LayerChromium.h17
-rw-r--r--WebCore/platform/graphics/chromium/LayerRendererChromium.cpp669
-rw-r--r--WebCore/platform/graphics/chromium/LayerRendererChromium.h85
-rw-r--r--WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp44
-rw-r--r--WebCore/platform/graphics/gstreamer/GStreamerGWorld.h49
-rw-r--r--WebCore/platform/graphics/gstreamer/ImageGStreamer.h4
-rw-r--r--WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm57
-rw-r--r--WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp12
-rw-r--r--WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h3
-rw-r--r--WebCore/platform/graphics/gtk/ImageGtk.cpp2
-rw-r--r--WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp15
-rw-r--r--WebCore/platform/graphics/mac/GraphicsLayerCA.h2
-rw-r--r--WebCore/platform/graphics/mac/GraphicsLayerCA.mm30
-rw-r--r--WebCore/platform/graphics/openvg/PainterOpenVG.cpp2
-rw-r--r--WebCore/platform/graphics/openvg/PathOpenVG.cpp4
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContextQt.cpp57
-rw-r--r--WebCore/platform/graphics/qt/GraphicsLayerQt.cpp507
-rw-r--r--WebCore/platform/graphics/qt/ImageBufferQt.cpp14
-rw-r--r--WebCore/platform/graphics/qt/PathQt.cpp7
-rw-r--r--WebCore/platform/graphics/skia/SkiaFontWin.cpp8
-rw-r--r--WebCore/platform/graphics/win/GraphicsLayerCACF.cpp185
-rw-r--r--WebCore/platform/graphics/win/GraphicsLayerCACF.h3
-rw-r--r--WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp72
-rw-r--r--WebCore/platform/graphics/win/QTMovieVisualContext.h1
-rw-r--r--WebCore/platform/graphics/win/QTPixelBuffer.cpp5
-rw-r--r--WebCore/platform/graphics/win/QTPixelBuffer.h2
-rw-r--r--WebCore/platform/graphics/win/WKCACFContextFlusher.cpp4
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayer.cpp69
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayer.h52
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp142
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayerRenderer.h14
-rwxr-xr-xWebCore/platform/graphics/win/WebLayer.cpp143
-rwxr-xr-xWebCore/platform/graphics/win/WebLayer.h62
-rwxr-xr-xWebCore/platform/graphics/win/WebTiledLayer.cpp274
-rwxr-xr-xWebCore/platform/graphics/win/WebTiledLayer.h80
-rw-r--r--WebCore/platform/graphics/wx/FontCacheWx.cpp27
-rw-r--r--WebCore/platform/graphics/wx/FontPlatformDataWx.cpp1
-rw-r--r--WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp56
-rw-r--r--WebCore/platform/gtk/ClipboardUtilitiesGtk.h32
-rw-r--r--WebCore/platform/image-decoders/openvg/ImageDecoderOpenVG.cpp77
-rw-r--r--WebCore/platform/mac/EmptyProtocolDefinitions.h6
-rw-r--r--WebCore/platform/network/qt/ResourceRequestQt.cpp8
-rw-r--r--WebCore/platform/posix/SharedBufferPOSIX.cpp74
-rw-r--r--WebCore/platform/qt/QWebPageClient.h2
-rw-r--r--WebCore/platform/qt/SharedBufferQt.cpp15
-rw-r--r--WebCore/platform/text/CharacterNames.h1
-rw-r--r--WebCore/platform/text/SegmentedString.h27
-rw-r--r--WebCore/platform/text/transcoder/FontTranscoder.cpp105
-rw-r--r--WebCore/platform/text/transcoder/FontTranscoder.h (renamed from WebCore/bindings/v8/custom/V8AttrCustom.cpp)50
-rw-r--r--WebCore/platform/win/ClipboardUtilitiesWin.cpp11
-rw-r--r--WebCore/platform/win/ClipboardUtilitiesWin.h1
-rw-r--r--WebCore/platform/win/SystemTimeWin.cpp2
-rw-r--r--WebCore/platform/win/WebCoreInstanceHandle.h82
-rw-r--r--WebCore/plugins/PluginView.cpp8
-rw-r--r--WebCore/plugins/PluginView.h5
-rw-r--r--WebCore/plugins/win/PluginMessageThrottlerWin.cpp4
-rw-r--r--WebCore/plugins/win/PluginViewWin.cpp17
-rw-r--r--WebCore/rendering/EllipsisBox.cpp4
-rw-r--r--WebCore/rendering/InlineFlowBox.cpp6
-rw-r--r--WebCore/rendering/InlineTextBox.cpp4
-rw-r--r--WebCore/rendering/RenderBlock.cpp169
-rw-r--r--WebCore/rendering/RenderBlock.h29
-rw-r--r--WebCore/rendering/RenderBox.cpp35
-rw-r--r--WebCore/rendering/RenderBoxModelObject.cpp4
-rw-r--r--WebCore/rendering/RenderButton.h4
-rw-r--r--WebCore/rendering/RenderDataGrid.h2
-rw-r--r--WebCore/rendering/RenderFieldset.cpp2
-rw-r--r--WebCore/rendering/RenderFileUploadControl.cpp2
-rw-r--r--WebCore/rendering/RenderFileUploadControl.h2
-rw-r--r--WebCore/rendering/RenderFrameSet.cpp4
-rw-r--r--WebCore/rendering/RenderImage.cpp2
-rw-r--r--WebCore/rendering/RenderInline.cpp14
-rw-r--r--WebCore/rendering/RenderInline.h7
-rw-r--r--WebCore/rendering/RenderLayer.cpp332
-rw-r--r--WebCore/rendering/RenderLayer.h37
-rw-r--r--WebCore/rendering/RenderLayerBacking.cpp67
-rw-r--r--WebCore/rendering/RenderLayerBacking.h6
-rw-r--r--WebCore/rendering/RenderListBox.cpp4
-rw-r--r--WebCore/rendering/RenderListItem.h2
-rw-r--r--WebCore/rendering/RenderListMarker.cpp8
-rw-r--r--WebCore/rendering/RenderMedia.h2
-rw-r--r--WebCore/rendering/RenderMediaControlsChromium.cpp31
-rw-r--r--WebCore/rendering/RenderMenuList.cpp10
-rw-r--r--WebCore/rendering/RenderMenuList.h2
-rw-r--r--WebCore/rendering/RenderObject.cpp14
-rw-r--r--WebCore/rendering/RenderObject.h18
-rw-r--r--WebCore/rendering/RenderObjectChildList.cpp4
-rw-r--r--WebCore/rendering/RenderProgress.h4
-rw-r--r--WebCore/rendering/RenderRubyBase.cpp4
-rw-r--r--WebCore/rendering/RenderSVGResource.cpp6
-rw-r--r--WebCore/rendering/RenderSVGResource.h4
-rw-r--r--WebCore/rendering/RenderSlider.h2
-rw-r--r--WebCore/rendering/RenderTable.cpp2
-rw-r--r--WebCore/rendering/RenderTable.h3
-rw-r--r--WebCore/rendering/RenderTableCell.cpp2
-rw-r--r--WebCore/rendering/RenderText.cpp20
-rw-r--r--WebCore/rendering/RenderTextControl.cpp2
-rw-r--r--WebCore/rendering/RenderTextControl.h2
-rw-r--r--WebCore/rendering/RenderTextControlSingleLine.cpp2
-rw-r--r--WebCore/rendering/RenderTextFragment.cpp4
-rw-r--r--WebCore/rendering/RenderTheme.cpp2
-rw-r--r--WebCore/rendering/RenderThemeChromiumSkia.cpp4
-rw-r--r--WebCore/rendering/RenderThemeChromiumWin.cpp30
-rw-r--r--WebCore/rendering/RenderThemeMac.mm2
-rw-r--r--WebCore/rendering/RenderThemeSafari.cpp2
-rw-r--r--WebCore/rendering/RenderTreeAsText.cpp4
-rw-r--r--WebCore/rendering/RenderTreeAsText.h8
-rw-r--r--WebCore/rendering/SVGInlineTextBox.cpp2
-rw-r--r--WebCore/rendering/SVGRenderTreeAsText.cpp4
-rw-r--r--WebCore/rendering/style/RenderStyle.cpp38
-rw-r--r--WebCore/rendering/style/RenderStyle.h49
-rw-r--r--WebCore/rendering/style/StyleMultiColData.cpp10
-rw-r--r--WebCore/rendering/style/StyleMultiColData.h3
-rw-r--r--WebCore/storage/DatabaseSync.cpp3
-rw-r--r--WebCore/storage/IndexedDatabase.h3
-rw-r--r--WebCore/storage/IndexedDatabaseImpl.cpp3
-rw-r--r--WebCore/storage/IndexedDatabaseImpl.h2
-rw-r--r--WebCore/storage/IndexedDatabaseRequest.cpp3
-rw-r--r--WebCore/svg/SVGAElement.cpp4
-rw-r--r--WebCore/svg/SVGAElement.h2
-rw-r--r--WebCore/svg/SVGAnimateMotionElement.cpp4
-rw-r--r--WebCore/svg/SVGAnimateMotionElement.h2
-rw-r--r--WebCore/svg/SVGAnimateTransformElement.cpp21
-rw-r--r--WebCore/svg/SVGAnimateTransformElement.h2
-rw-r--r--WebCore/svg/SVGAnimationElement.cpp8
-rw-r--r--WebCore/svg/SVGAnimationElement.h2
-rw-r--r--WebCore/svg/SVGCircleElement.cpp4
-rw-r--r--WebCore/svg/SVGCircleElement.h2
-rw-r--r--WebCore/svg/SVGClipPathElement.cpp4
-rw-r--r--WebCore/svg/SVGClipPathElement.h2
-rw-r--r--WebCore/svg/SVGComponentTransferFunctionElement.cpp4
-rw-r--r--WebCore/svg/SVGComponentTransferFunctionElement.h2
-rw-r--r--WebCore/svg/SVGCursorElement.cpp3
-rw-r--r--WebCore/svg/SVGCursorElement.h2
-rw-r--r--WebCore/svg/SVGElement.cpp4
-rw-r--r--WebCore/svg/SVGElement.h2
-rw-r--r--WebCore/svg/SVGEllipseElement.cpp4
-rw-r--r--WebCore/svg/SVGEllipseElement.h2
-rw-r--r--WebCore/svg/SVGExternalResourcesRequired.cpp3
-rw-r--r--WebCore/svg/SVGExternalResourcesRequired.h4
-rw-r--r--WebCore/svg/SVGFEBlendElement.cpp4
-rw-r--r--WebCore/svg/SVGFEBlendElement.h2
-rw-r--r--WebCore/svg/SVGFEColorMatrixElement.cpp4
-rw-r--r--WebCore/svg/SVGFEColorMatrixElement.h2
-rw-r--r--WebCore/svg/SVGFEComponentTransferElement.cpp3
-rw-r--r--WebCore/svg/SVGFEComponentTransferElement.h2
-rw-r--r--WebCore/svg/SVGFECompositeElement.cpp4
-rw-r--r--WebCore/svg/SVGFECompositeElement.h2
-rw-r--r--WebCore/svg/SVGFEDiffuseLightingElement.cpp3
-rw-r--r--WebCore/svg/SVGFEDiffuseLightingElement.h2
-rw-r--r--WebCore/svg/SVGFEDisplacementMapElement.cpp4
-rw-r--r--WebCore/svg/SVGFEDisplacementMapElement.h2
-rw-r--r--WebCore/svg/SVGFEFloodElement.cpp2
-rw-r--r--WebCore/svg/SVGFEGaussianBlurElement.cpp4
-rw-r--r--WebCore/svg/SVGFEGaussianBlurElement.h2
-rw-r--r--WebCore/svg/SVGFEImageElement.cpp3
-rw-r--r--WebCore/svg/SVGFEImageElement.h2
-rw-r--r--WebCore/svg/SVGFELightElement.cpp4
-rw-r--r--WebCore/svg/SVGFELightElement.h2
-rw-r--r--WebCore/svg/SVGFEMergeNodeElement.cpp4
-rw-r--r--WebCore/svg/SVGFEMergeNodeElement.h2
-rw-r--r--WebCore/svg/SVGFEMorphologyElement.cpp12
-rw-r--r--WebCore/svg/SVGFEMorphologyElement.h2
-rw-r--r--WebCore/svg/SVGFEOffsetElement.cpp3
-rw-r--r--WebCore/svg/SVGFEOffsetElement.h2
-rw-r--r--WebCore/svg/SVGFESpecularLightingElement.cpp4
-rw-r--r--WebCore/svg/SVGFESpecularLightingElement.h2
-rw-r--r--WebCore/svg/SVGFETileElement.cpp3
-rw-r--r--WebCore/svg/SVGFETileElement.h2
-rw-r--r--WebCore/svg/SVGFETurbulenceElement.cpp4
-rw-r--r--WebCore/svg/SVGFETurbulenceElement.h2
-rw-r--r--WebCore/svg/SVGFilterElement.cpp3
-rw-r--r--WebCore/svg/SVGFilterElement.h2
-rw-r--r--WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp4
-rw-r--r--WebCore/svg/SVGFilterPrimitiveStandardAttributes.h2
-rw-r--r--WebCore/svg/SVGFitToViewBox.cpp3
-rw-r--r--WebCore/svg/SVGFitToViewBox.h2
-rw-r--r--WebCore/svg/SVGFontFaceElement.cpp4
-rw-r--r--WebCore/svg/SVGFontFaceElement.h2
-rw-r--r--WebCore/svg/SVGFontFaceUriElement.cpp4
-rw-r--r--WebCore/svg/SVGFontFaceUriElement.h2
-rw-r--r--WebCore/svg/SVGForeignObjectElement.cpp4
-rw-r--r--WebCore/svg/SVGForeignObjectElement.h2
-rw-r--r--WebCore/svg/SVGGElement.cpp2
-rw-r--r--WebCore/svg/SVGGElement.h2
-rw-r--r--WebCore/svg/SVGGlyphElement.cpp4
-rw-r--r--WebCore/svg/SVGGlyphElement.h2
-rw-r--r--WebCore/svg/SVGGradientElement.cpp4
-rw-r--r--WebCore/svg/SVGGradientElement.h2
-rw-r--r--WebCore/svg/SVGImageElement.cpp4
-rw-r--r--WebCore/svg/SVGImageElement.h2
-rw-r--r--WebCore/svg/SVGLangSpace.cpp4
-rw-r--r--WebCore/svg/SVGLangSpace.h4
-rw-r--r--WebCore/svg/SVGLineElement.cpp4
-rw-r--r--WebCore/svg/SVGLineElement.h2
-rw-r--r--WebCore/svg/SVGLinearGradientElement.cpp4
-rw-r--r--WebCore/svg/SVGLinearGradientElement.h2
-rw-r--r--WebCore/svg/SVGMPathElement.cpp2
-rw-r--r--WebCore/svg/SVGMPathElement.h2
-rw-r--r--WebCore/svg/SVGMarkerElement.cpp4
-rw-r--r--WebCore/svg/SVGMarkerElement.h2
-rw-r--r--WebCore/svg/SVGMaskElement.cpp4
-rw-r--r--WebCore/svg/SVGMaskElement.h2
-rw-r--r--WebCore/svg/SVGPathElement.cpp4
-rw-r--r--WebCore/svg/SVGPathElement.h2
-rw-r--r--WebCore/svg/SVGPatternElement.cpp4
-rw-r--r--WebCore/svg/SVGPatternElement.h2
-rw-r--r--WebCore/svg/SVGPolyElement.cpp4
-rw-r--r--WebCore/svg/SVGPolyElement.h2
-rw-r--r--WebCore/svg/SVGRadialGradientElement.cpp4
-rw-r--r--WebCore/svg/SVGRadialGradientElement.h2
-rw-r--r--WebCore/svg/SVGRectElement.cpp4
-rw-r--r--WebCore/svg/SVGRectElement.h2
-rw-r--r--WebCore/svg/SVGSVGElement.cpp6
-rw-r--r--WebCore/svg/SVGSVGElement.h2
-rw-r--r--WebCore/svg/SVGScriptElement.cpp4
-rw-r--r--WebCore/svg/SVGScriptElement.h2
-rw-r--r--WebCore/svg/SVGStopElement.cpp4
-rw-r--r--WebCore/svg/SVGStopElement.h2
-rw-r--r--WebCore/svg/SVGStyleElement.cpp4
-rw-r--r--WebCore/svg/SVGStyleElement.h2
-rw-r--r--WebCore/svg/SVGStyledElement.cpp5
-rw-r--r--WebCore/svg/SVGStyledElement.h2
-rw-r--r--WebCore/svg/SVGStyledTransformableElement.cpp3
-rw-r--r--WebCore/svg/SVGStyledTransformableElement.h2
-rw-r--r--WebCore/svg/SVGSymbolElement.cpp2
-rw-r--r--WebCore/svg/SVGSymbolElement.h2
-rw-r--r--WebCore/svg/SVGTRefElement.cpp2
-rw-r--r--WebCore/svg/SVGTRefElement.h2
-rw-r--r--WebCore/svg/SVGTests.cpp4
-rw-r--r--WebCore/svg/SVGTests.h8
-rw-r--r--WebCore/svg/SVGTextContentElement.cpp4
-rw-r--r--WebCore/svg/SVGTextContentElement.h2
-rw-r--r--WebCore/svg/SVGTextElement.cpp4
-rw-r--r--WebCore/svg/SVGTextElement.h2
-rw-r--r--WebCore/svg/SVGTextPathElement.cpp4
-rw-r--r--WebCore/svg/SVGTextPathElement.h2
-rw-r--r--WebCore/svg/SVGTextPositioningElement.cpp4
-rw-r--r--WebCore/svg/SVGTextPositioningElement.h2
-rw-r--r--WebCore/svg/SVGURIReference.cpp4
-rw-r--r--WebCore/svg/SVGURIReference.h4
-rw-r--r--WebCore/svg/SVGUseElement.cpp6
-rw-r--r--WebCore/svg/SVGUseElement.h2
-rw-r--r--WebCore/svg/SVGViewElement.cpp3
-rw-r--r--WebCore/svg/SVGViewElement.h2
-rw-r--r--WebCore/svg/SVGZoomAndPan.cpp4
-rw-r--r--WebCore/svg/SVGZoomAndPan.h4
-rw-r--r--WebCore/svg/animation/SVGSMILElement.cpp4
-rw-r--r--WebCore/svg/animation/SVGSMILElement.h2
-rw-r--r--WebCore/svg/graphics/SVGImage.cpp2
-rw-r--r--WebCore/svg/graphics/filters/SVGFELighting.cpp3
-rw-r--r--WebCore/websockets/WebSocketHandshake.cpp276
-rw-r--r--WebCore/websockets/WebSocketHandshake.h9
-rw-r--r--WebCore/websockets/WorkerThreadableWebSocketChannel.cpp2
-rw-r--r--WebCore/wml/WMLAElement.cpp6
-rw-r--r--WebCore/wml/WMLAElement.h2
-rw-r--r--WebCore/wml/WMLAccessElement.cpp4
-rw-r--r--WebCore/wml/WMLAccessElement.h2
-rw-r--r--WebCore/wml/WMLBRElement.cpp4
-rw-r--r--WebCore/wml/WMLBRElement.h2
-rw-r--r--WebCore/wml/WMLCardElement.cpp6
-rw-r--r--WebCore/wml/WMLCardElement.h2
-rw-r--r--WebCore/wml/WMLDoElement.cpp8
-rw-r--r--WebCore/wml/WMLDoElement.h2
-rw-r--r--WebCore/wml/WMLElement.cpp4
-rw-r--r--WebCore/wml/WMLElement.h2
-rw-r--r--WebCore/wml/WMLFieldSetElement.cpp2
-rw-r--r--WebCore/wml/WMLGoElement.cpp4
-rw-r--r--WebCore/wml/WMLGoElement.h2
-rw-r--r--WebCore/wml/WMLImageElement.cpp4
-rw-r--r--WebCore/wml/WMLImageElement.h2
-rw-r--r--WebCore/wml/WMLInputElement.cpp4
-rw-r--r--WebCore/wml/WMLInputElement.h2
-rw-r--r--WebCore/wml/WMLMetaElement.cpp4
-rw-r--r--WebCore/wml/WMLMetaElement.h2
-rw-r--r--WebCore/wml/WMLOnEventElement.cpp4
-rw-r--r--WebCore/wml/WMLOnEventElement.h2
-rw-r--r--WebCore/wml/WMLOptGroupElement.cpp4
-rw-r--r--WebCore/wml/WMLOptGroupElement.h2
-rw-r--r--WebCore/wml/WMLOptionElement.cpp4
-rw-r--r--WebCore/wml/WMLOptionElement.h2
-rw-r--r--WebCore/wml/WMLPElement.cpp4
-rw-r--r--WebCore/wml/WMLPElement.h2
-rw-r--r--WebCore/wml/WMLSelectElement.cpp5
-rw-r--r--WebCore/wml/WMLSelectElement.h2
-rw-r--r--WebCore/wml/WMLSetvarElement.cpp4
-rw-r--r--WebCore/wml/WMLSetvarElement.h2
-rw-r--r--WebCore/wml/WMLTableElement.cpp6
-rw-r--r--WebCore/wml/WMLTableElement.h2
-rw-r--r--WebCore/wml/WMLTemplateElement.cpp4
-rw-r--r--WebCore/wml/WMLTemplateElement.h2
-rw-r--r--WebCore/wml/WMLTimerElement.cpp4
-rw-r--r--WebCore/wml/WMLTimerElement.h2
-rw-r--r--WebCore/workers/DefaultSharedWorkerRepository.cpp2
-rw-r--r--WebCore/workers/WorkerMessagingProxy.cpp2
-rw-r--r--WebCore/workers/WorkerScriptLoader.cpp2
-rw-r--r--WebKit/chromium/ChangeLog362
-rw-r--r--WebKit/chromium/DEPS2
-rw-r--r--WebKit/chromium/WebKit.gyp23
-rw-r--r--WebKit/chromium/public/WebAccessibilityObject.h2
-rw-r--r--WebKit/chromium/public/WebBindings.h11
-rw-r--r--WebKit/chromium/public/WebGeolocationServiceMock.h60
-rw-r--r--WebKit/chromium/public/WebIndexedDatabase.h15
-rw-r--r--WebKit/chromium/public/WebKitClient.h17
-rw-r--r--WebKit/chromium/public/WebNotification.h3
-rw-r--r--WebKit/chromium/public/WebSecurityOrigin.h6
-rw-r--r--WebKit/chromium/public/WebSettings.h6
-rw-r--r--WebKit/chromium/public/WebThemeEngine.h4
-rw-r--r--WebKit/chromium/src/AssertMatchingEnums.cpp5
-rw-r--r--WebKit/chromium/src/ChromeClientImpl.cpp2
-rw-r--r--WebKit/chromium/src/ChromiumBridge.cpp53
-rw-r--r--WebKit/chromium/src/ContextMenuClientImpl.cpp4
-rw-r--r--WebKit/chromium/src/IDBCallbacksProxy.cpp22
-rw-r--r--WebKit/chromium/src/IDBCallbacksProxy.h24
-rw-r--r--WebKit/chromium/src/IndexedDatabaseProxy.cpp9
-rw-r--r--WebKit/chromium/src/IndexedDatabaseProxy.h2
-rw-r--r--WebKit/chromium/src/WebAccessibilityObject.cpp15
-rw-r--r--WebKit/chromium/src/WebBindings.cpp11
-rw-r--r--WebKit/chromium/src/WebGeolocationServiceMock.cpp170
-rw-r--r--WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp15
-rw-r--r--WebKit/chromium/src/WebIDBCallbacksImpl.cpp74
-rw-r--r--WebKit/chromium/src/WebIDBCallbacksImpl.h65
-rw-r--r--WebKit/chromium/src/WebIDBDatabaseImpl.cpp50
-rw-r--r--WebKit/chromium/src/WebIDBDatabaseImpl.h55
-rw-r--r--WebKit/chromium/src/WebIndexedDatabaseImpl.cpp16
-rw-r--r--WebKit/chromium/src/WebIndexedDatabaseImpl.h9
-rw-r--r--WebKit/chromium/src/WebNotification.cpp10
-rw-r--r--WebKit/chromium/src/WebSecurityOrigin.cpp8
-rw-r--r--WebKit/chromium/src/WebSettingsImpl.cpp5
-rw-r--r--WebKit/chromium/src/WebSettingsImpl.h1
-rw-r--r--WebKit/chromium/src/WebSharedWorkerImpl.cpp2
-rw-r--r--WebKit/chromium/src/WebViewImpl.cpp146
-rw-r--r--WebKit/chromium/src/WebViewImpl.h3
-rw-r--r--WebKit/chromium/src/WebWorkerBase.cpp2
-rw-r--r--WebKit/chromium/src/WebWorkerClientImpl.cpp2
-rw-r--r--WebKit/chromium/src/WebWorkerImpl.cpp2
-rw-r--r--WebKit/gtk/ChangeLog101
-rw-r--r--WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp2
-rw-r--r--WebKit/gtk/WebCoreSupport/DragClientGtk.cpp15
-rw-r--r--WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp20
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp9
-rw-r--r--WebKit/gtk/webkit/webkitprivate.h30
-rw-r--r--WebKit/gtk/webkit/webkitwebview.cpp213
-rw-r--r--WebKit/mac/ChangeLog195
-rw-r--r--WebKit/mac/Configurations/FeatureDefines.xcconfig3
-rw-r--r--WebKit/mac/Configurations/Version.xcconfig2
-rw-r--r--WebKit/mac/Misc/WebNSAttributedStringExtras.mm8
-rw-r--r--WebKit/mac/Misc/WebNSPasteboardExtras.mm11
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm8
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h2
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm4
-rw-r--r--WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm23
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.mm25
-rw-r--r--WebKit/mac/WebView/WebDynamicScrollBarsView.mm9
-rw-r--r--WebKit/mac/WebView/WebFrame.mm14
-rw-r--r--WebKit/mac/WebView/WebFrameInternal.h1
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm5
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h2
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm21
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h11
-rw-r--r--WebKit/mac/WebView/WebView.mm5
-rw-r--r--WebKit/qt/Api/qgraphicswebview.cpp21
-rw-r--r--WebKit/qt/Api/qwebhistory.cpp2
-rw-r--r--WebKit/qt/Api/qwebpage.cpp78
-rw-r--r--WebKit/qt/ChangeLog200
-rw-r--r--WebKit/qt/WebCoreSupport/ChromeClientQt.cpp6
-rw-r--r--WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp25
-rw-r--r--WebKit/qt/WebCoreSupport/PageClientQt.cpp19
-rw-r--r--WebKit/qt/WebCoreSupport/PageClientQt.h5
-rw-r--r--WebKit/qt/symbian/bwins/QtWebKitu.def1
-rw-r--r--WebKit/qt/symbian/eabi/QtWebKitu.def47
-rw-r--r--WebKit/qt/tests/qwebframe/tst_qwebframe.cpp37
-rw-r--r--WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp21
-rw-r--r--WebKit/qt/tests/qwebpage/tst_qwebpage.cpp92
-rw-r--r--WebKit/win/ChangeLog136
-rw-r--r--WebKit/win/Interfaces/IWebPreferences.idl9
-rw-r--r--WebKit/win/WebCoreSupport/WebContextMenuClient.cpp3
-rw-r--r--WebKit/win/WebFrame.cpp135
-rw-r--r--WebKit/win/WebPreferenceKeysPrivate.h1
-rw-r--r--WebKit/win/WebPreferences.cpp15
-rw-r--r--WebKit/win/WebPreferences.h6
-rw-r--r--WebKit/win/WebView.cpp25
-rw-r--r--WebKit/win/WebView.h8
-rw-r--r--WebKitLibraries/ChangeLog12
-rw-r--r--WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops7
-rw-r--r--WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops7
-rw-r--r--WebKitTools/ChangeLog665
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.cpp29
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.h1
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp3
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp59
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.h13
-rw-r--r--WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp14
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.cpp8
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.h2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellMac.mm4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp48
-rw-r--r--WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp9
-rw-r--r--WebKitTools/DumpRenderTree/chromium/WebViewHost.h5
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp12
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm4
-rw-r--r--WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm16
-rw-r--r--WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp3
-rw-r--r--WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h4
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp5
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h2
-rw-r--r--WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp1
-rw-r--r--WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp2
-rw-r--r--WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp17
-rw-r--r--WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp5
-rw-r--r--WebKitTools/QtTestBrowser/QtTestBrowser.pro2
-rw-r--r--WebKitTools/QtTestBrowser/main.cpp8
-rw-r--r--WebKitTools/QtTestBrowser/mainwindow.cpp2
-rw-r--r--WebKitTools/QtTestBrowser/useragentlist.txt4
-rw-r--r--WebKitTools/QtTestBrowser/webpage.cpp44
-rw-r--r--WebKitTools/QtTestBrowser/webpage.h1
-rw-r--r--WebKitTools/QueueStatusServer/handlers/statusbubble.py1
-rw-r--r--WebKitTools/QueueStatusServer/handlers/updateworkitems.py17
-rw-r--r--WebKitTools/Scripts/VCSUtils.pm78
-rwxr-xr-xWebKitTools/Scripts/check-webkit-style2
-rw-r--r--WebKitTools/Scripts/new-run-webkit-websocketserver2
-rwxr-xr-xWebKitTools/Scripts/update-webkit10
-rwxr-xr-xWebKitTools/Scripts/webkit-patch12
-rw-r--r--WebKitTools/Scripts/webkitdirs.pm10
-rw-r--r--WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl348
-rw-r--r--WebKitTools/Scripts/webkitpy/common/checkout/scm.py43
-rw-r--r--WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py18
-rw-r--r--WebKitTools/Scripts/webkitpy/common/config/committers.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/common/net/bugzilla.py28
-rw-r--r--WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py4
-rw-r--r--WebKitTools/Scripts/webkitpy/common/net/statusserver.py17
-rw-r--r--WebKitTools/Scripts/webkitpy/common/system/executive.py17
-rw-r--r--WebKitTools/Scripts/webkitpy/common/system/executive_unittest.py9
-rw-r--r--WebKitTools/Scripts/webkitpy/common/system/user.py1
-rw-r--r--WebKitTools/Scripts/webkitpy/common/thread/threadedmessagequeue.py21
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-bg.html22
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.checksum1
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.pngbin0 -> 17110 bytes
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.txt22
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom.html15
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash-expected.txt1
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash.html5
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/misc/missing-expectation.html5
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing-expected.txt1
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing.html5
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.checksum1
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.pngbin0 -> 30259 bytes
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.txt6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/test_expectations.txt1
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element-expected.txt20
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element.html13
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py2
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py71
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/base.py2
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py11
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py18
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py17
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py5
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py74
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py2
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/test.py39
-rwxr-xr-xWebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py4
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py83
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py16
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py28
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py5
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checker.py40
-rwxr-xr-xWebKitTools/Scripts/webkitpy/style/checker_unittest.py51
-rw-r--r--WebKitTools/Scripts/webkitpy/style/patchreader.py75
-rw-r--r--WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py85
-rw-r--r--WebKitTools/Scripts/webkitpy/style_references.py8
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/bot/patchcollection.py26
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py1
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/queues.py14
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py25
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/upload.py2
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py2
-rwxr-xr-xWebKitTools/Scripts/webkitpy/tool/main.py1
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/mocktool.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/options.py1
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/postdiff.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/runtests.py5
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py2
-rw-r--r--WebKitTools/WebKitAPITest/WebKitAPITest.vcproj63
1055 files changed, 110820 insertions, 8109 deletions
diff --git a/JavaScriptCore/API/JSCallbackConstructor.cpp b/JavaScriptCore/API/JSCallbackConstructor.cpp
index 9c5f6d7..2948932 100644
--- a/JavaScriptCore/API/JSCallbackConstructor.cpp
+++ b/JavaScriptCore/API/JSCallbackConstructor.cpp
@@ -37,8 +37,8 @@ namespace JSC {
const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 };
-JSCallbackConstructor::JSCallbackConstructor(NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
- : JSObject(structure)
+JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
+ : JSObjectWithGlobalObject(globalObject, structure)
, m_class(jsClass)
, m_callback(callback)
{
diff --git a/JavaScriptCore/API/JSCallbackConstructor.h b/JavaScriptCore/API/JSCallbackConstructor.h
index e529947..a6d64cc 100644
--- a/JavaScriptCore/API/JSCallbackConstructor.h
+++ b/JavaScriptCore/API/JSCallbackConstructor.h
@@ -27,13 +27,13 @@
#define JSCallbackConstructor_h
#include "JSObjectRef.h"
-#include <runtime/JSObject.h>
+#include <runtime/JSObjectWithGlobalObject.h>
namespace JSC {
-class JSCallbackConstructor : public JSObject {
+class JSCallbackConstructor : public JSObjectWithGlobalObject {
public:
- JSCallbackConstructor(NonNullPassRefPtr<Structure>, JSClassRef, JSObjectCallAsConstructorCallback);
+ JSCallbackConstructor(JSGlobalObject*, NonNullPassRefPtr<Structure>, JSClassRef, JSObjectCallAsConstructorCallback);
virtual ~JSCallbackConstructor();
JSClassRef classRef() const { return m_class; }
JSObjectCallAsConstructorCallback callback() const { return m_callback; }
diff --git a/JavaScriptCore/API/JSCallbackFunction.cpp b/JavaScriptCore/API/JSCallbackFunction.cpp
index 63c8add..4953010 100644
--- a/JavaScriptCore/API/JSCallbackFunction.cpp
+++ b/JavaScriptCore/API/JSCallbackFunction.cpp
@@ -41,8 +41,8 @@ ASSERT_CLASS_FITS_IN_CELL(JSCallbackFunction);
const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunction::info, 0, 0 };
-JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSObjectCallAsFunctionCallback callback, const Identifier& name)
- : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject()->callbackFunctionStructure(), name)
+JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name)
+ : InternalFunction(&exec->globalData(), globalObject, globalObject->callbackFunctionStructure(), name)
, m_callback(callback)
{
}
diff --git a/JavaScriptCore/API/JSCallbackFunction.h b/JavaScriptCore/API/JSCallbackFunction.h
index 10dae6b..b0dc425 100644
--- a/JavaScriptCore/API/JSCallbackFunction.h
+++ b/JavaScriptCore/API/JSCallbackFunction.h
@@ -33,7 +33,7 @@ namespace JSC {
class JSCallbackFunction : public InternalFunction {
public:
- JSCallbackFunction(ExecState*, JSObjectCallAsFunctionCallback, const Identifier& name);
+ JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name);
static const ClassInfo info;
diff --git a/JavaScriptCore/API/JSCallbackObject.cpp b/JavaScriptCore/API/JSCallbackObject.cpp
index b36c194..abd2adc 100644
--- a/JavaScriptCore/API/JSCallbackObject.cpp
+++ b/JavaScriptCore/API/JSCallbackObject.cpp
@@ -32,11 +32,11 @@
namespace JSC {
-ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSObject>);
+ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSObjectWithGlobalObject>);
ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSGlobalObject>);
// Define the two types of JSCallbackObjects we support.
-template <> const ClassInfo JSCallbackObject<JSObject>::info = { "CallbackObject", 0, 0, 0 };
+template <> const ClassInfo JSCallbackObject<JSObjectWithGlobalObject>::info = { "CallbackObject", 0, 0, 0 };
template <> const ClassInfo JSCallbackObject<JSGlobalObject>::info = { "CallbackGlobalObject", 0, 0, 0 };
} // namespace JSC
diff --git a/JavaScriptCore/API/JSCallbackObject.h b/JavaScriptCore/API/JSCallbackObject.h
index 1cf7a02..0660b45 100644
--- a/JavaScriptCore/API/JSCallbackObject.h
+++ b/JavaScriptCore/API/JSCallbackObject.h
@@ -114,8 +114,8 @@ struct JSCallbackObjectData {
template <class Base>
class JSCallbackObject : public Base {
public:
- JSCallbackObject(ExecState*, NonNullPassRefPtr<Structure>, JSClassRef, void* data);
- JSCallbackObject(JSClassRef);
+ JSCallbackObject(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, JSClassRef, void* data);
+ JSCallbackObject(JSClassRef, NonNullPassRefPtr<Structure>);
virtual ~JSCallbackObject();
void setPrivate(void* data);
diff --git a/JavaScriptCore/API/JSCallbackObjectFunctions.h b/JavaScriptCore/API/JSCallbackObjectFunctions.h
index 6c83eb4..6573ed9 100644
--- a/JavaScriptCore/API/JSCallbackObjectFunctions.h
+++ b/JavaScriptCore/API/JSCallbackObjectFunctions.h
@@ -48,8 +48,8 @@ inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue
}
template <class Base>
-JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, void* data)
- : Base(structure)
+JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, void* data)
+ : Base(globalObject, structure)
, m_callbackObjectData(new JSCallbackObjectData(data, jsClass))
{
init(exec);
@@ -58,8 +58,8 @@ JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, NonNullPassRefPtr<Stru
// Global object constructor.
// FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one.
template <class Base>
-JSCallbackObject<Base>::JSCallbackObject(JSClassRef jsClass)
- : Base()
+JSCallbackObject<Base>::JSCallbackObject(JSClassRef jsClass, NonNullPassRefPtr<Structure> structure)
+ : Base(structure)
, m_callbackObjectData(new JSCallbackObjectData(0, jsClass))
{
ASSERT(Base::isGlobalObject());
@@ -560,7 +560,8 @@ JSValue JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSValue sl
if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) {
if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
- JSObject* o = new (exec) JSCallbackFunction(exec, callAsFunction, propertyName);
+
+ JSObject* o = new (exec) JSCallbackFunction(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName);
thisObj->putDirect(propertyName, o, entry->attributes);
return o;
}
diff --git a/JavaScriptCore/API/JSClassRef.cpp b/JavaScriptCore/API/JSClassRef.cpp
index 3e65b75..d8393f1 100644
--- a/JavaScriptCore/API/JSClassRef.cpp
+++ b/JavaScriptCore/API/JSClassRef.cpp
@@ -256,7 +256,7 @@ JSObject* OpaqueJSClass::prototype(ExecState* exec)
if (!jsClassData.cachedPrototype) {
// Recursive, but should be good enough for our purposes
- jsClassData.cachedPrototype = new (exec) JSCallbackObject<JSObject>(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction
+ jsClassData.cachedPrototype = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction
if (parentClass) {
if (JSObject* prototype = parentClass->prototype(exec))
jsClassData.cachedPrototype->setPrototype(prototype);
diff --git a/JavaScriptCore/API/JSContextRef.cpp b/JavaScriptCore/API/JSContextRef.cpp
index b97ceda..926badc 100644
--- a/JavaScriptCore/API/JSContextRef.cpp
+++ b/JavaScriptCore/API/JSContextRef.cpp
@@ -97,7 +97,7 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass
return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec()));
}
- JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass);
+ JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(jsNull()));
ExecState* exec = globalObject->globalExec();
JSValue prototype = globalObjectClass->prototype(exec);
if (!prototype)
diff --git a/JavaScriptCore/API/JSObjectRef.cpp b/JavaScriptCore/API/JSObjectRef.cpp
index 8fdbdab..73bba67 100644
--- a/JavaScriptCore/API/JSObjectRef.cpp
+++ b/JavaScriptCore/API/JSObjectRef.cpp
@@ -81,7 +81,7 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data)
if (!jsClass)
return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient
- JSCallbackObject<JSObject>* object = new (exec) JSCallbackObject<JSObject>(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
+ JSCallbackObject<JSObjectWithGlobalObject>* object = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
if (JSObject* prototype = jsClass->prototype(exec))
object->setPrototype(prototype);
@@ -95,7 +95,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name,
Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous");
- return toRef(new (exec) JSCallbackFunction(exec, callAsFunction, nameID));
+ return toRef(new (exec) JSCallbackFunction(exec, exec->lexicalGlobalObject(), callAsFunction, nameID));
}
JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor)
@@ -107,7 +107,7 @@ JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObje
if (!jsPrototype)
jsPrototype = exec->lexicalGlobalObject()->objectPrototype();
- JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);
+ JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);
constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
return toRef(constructor);
}
@@ -343,8 +343,8 @@ void* JSObjectGetPrivate(JSObjectRef object)
if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info))
return static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
- else if (jsObject->inherits(&JSCallbackObject<JSObject>::info))
- return static_cast<JSCallbackObject<JSObject>*>(jsObject)->getPrivate();
+ else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
+ return static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivate();
return 0;
}
@@ -356,8 +356,8 @@ bool JSObjectSetPrivate(JSObjectRef object, void* data)
if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivate(data);
return true;
- } else if (jsObject->inherits(&JSCallbackObject<JSObject>::info)) {
- static_cast<JSCallbackObject<JSObject>*>(jsObject)->setPrivate(data);
+ } else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivate(data);
return true;
}
@@ -373,8 +373,8 @@ JSValueRef JSObjectGetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSSt
Identifier name(propertyName->identifier(&exec->globalData()));
if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info))
result = static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
- else if (jsObject->inherits(&JSCallbackObject<JSObject>::info))
- result = static_cast<JSCallbackObject<JSObject>*>(jsObject)->getPrivateProperty(name);
+ else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
+ result = static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivateProperty(name);
return toRef(exec, result);
}
@@ -389,8 +389,8 @@ bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRe
static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(name, jsValue);
return true;
}
- if (jsObject->inherits(&JSCallbackObject<JSObject>::info)) {
- static_cast<JSCallbackObject<JSObject>*>(jsObject)->setPrivateProperty(name, jsValue);
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivateProperty(name, jsValue);
return true;
}
return false;
@@ -406,8 +406,8 @@ bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStrin
static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->deletePrivateProperty(name);
return true;
}
- if (jsObject->inherits(&JSCallbackObject<JSObject>::info)) {
- static_cast<JSCallbackObject<JSObject>*>(jsObject)->deletePrivateProperty(name);
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->deletePrivateProperty(name);
return true;
}
return false;
diff --git a/JavaScriptCore/API/JSStringRefBSTR.cpp b/JavaScriptCore/API/JSStringRefBSTR.cpp
index a7d3e99..70f4254 100644
--- a/JavaScriptCore/API/JSStringRefBSTR.cpp
+++ b/JavaScriptCore/API/JSStringRefBSTR.cpp
@@ -24,7 +24,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+ */
#include "config.h"
#include "JSStringRefBSTR.h"
diff --git a/JavaScriptCore/API/JSValueRef.cpp b/JavaScriptCore/API/JSValueRef.cpp
index f5dcccc..a29a207 100644
--- a/JavaScriptCore/API/JSValueRef.cpp
+++ b/JavaScriptCore/API/JSValueRef.cpp
@@ -131,8 +131,8 @@ bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsCla
if (JSObject* o = jsValue.getObject()) {
if (o->inherits(&JSCallbackObject<JSGlobalObject>::info))
return static_cast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
- else if (o->inherits(&JSCallbackObject<JSObject>::info))
- return static_cast<JSCallbackObject<JSObject>*>(o)->inherits(jsClass);
+ else if (o->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
+ return static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(o)->inherits(jsClass);
}
return false;
}
diff --git a/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp b/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
index 7e6bb63..9beeb82 100644
--- a/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
+++ b/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
@@ -58,7 +58,7 @@ void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSO
JSObject* obj = toJS(object);
if (!obj)
return;
- ASSERT(obj->inherits(&JSCallbackObject<JSGlobalObject>::info) || obj->inherits(&JSCallbackObject<JSObject>::info));
+ ASSERT(obj->inherits(&JSCallbackObject<JSGlobalObject>::info) || obj->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info));
map->map().set(key, obj);
}
diff --git a/JavaScriptCore/Android.mk b/JavaScriptCore/Android.mk
index 211cea9..60ce27f 100644
--- a/JavaScriptCore/Android.mk
+++ b/JavaScriptCore/Android.mk
@@ -52,6 +52,7 @@ LOCAL_SRC_FILES := \
jit/JITArithmetic.cpp \
jit/JITArithmetic32_64.cpp \
jit/JITCall.cpp \
+ jit/JITCall32_64.cpp \
jit/JITOpcodes.cpp \
jit/JITPropertyAccess.cpp \
jit/JITStubs.cpp \
diff --git a/JavaScriptCore/CMakeLists.txt b/JavaScriptCore/CMakeLists.txt
index f0281e4..da7e119 100644
--- a/JavaScriptCore/CMakeLists.txt
+++ b/JavaScriptCore/CMakeLists.txt
@@ -61,6 +61,7 @@ SET(JavaScriptCore_SOURCES
jit/JITPropertyAccess32_64.cpp
jit/JITArithmetic.cpp
jit/JITCall.cpp
+ jit/JITCall32_64.cpp
jit/JIT.cpp
parser/Lexer.cpp
@@ -122,6 +123,7 @@ SET(JavaScriptCore_SOURCES
runtime/JSNotAnObject.cpp
runtime/JSNumberCell.cpp
runtime/JSObject.cpp
+ runtime/JSObjectWithGlobalObject.cpp
runtime/JSONObject.cpp
runtime/JSPropertyNameIterator.cpp
runtime/JSStaticScopeObject.cpp
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 85755cc..83076da 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,1202 @@
+2010-05-23 Sam Weinig <sam@webkit.org>
+
+ Fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=39575
+ Make JS DOMObject inherit from JSObjectWithGlobalObject instead of JSObject
+
+ Expose the global object stored in JSObjectWithGlobalObject.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSObjectWithGlobalObject.cpp:
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ (JSC::JSObjectWithGlobalObject::globalObject):
+ * runtime/JSObjectWithGlobalObject.h:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ "asm volatile" isn't valid outside of functions.
+
+ Reviewed by Gavin Barraclough.
+
+ * jit/JITStubs.cpp:
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Unreviewed build fix.
+
+ Interpreter fix following r59974.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSPropertyNameIterator.h:
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Interpreter fix following r59939.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-05-21 David Levin <levin@chromium.org>
+
+ Unreviewed build fix.
+
+ * wtf/SizeLimits.cpp: Removed a check while I figure out how to write it properly.
+
+2010-05-21 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Enforce size constraints on various data structures in JavaScriptCore/wtf.
+ https://bugs.webkit.org/show_bug.cgi?id=39327
+
+ I only modified the default build for OSX and Chromium's build file to include WTFCompileAsserts.cpp
+ as those should be sufficient to catch regressions on the size of the data structures.
+
+ * JavaScriptCore.gypi: Added the WTFCompileAsserts.cpp file.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added the WTFCompileAsserts.cpp file.
+ * runtime/UString.cpp: Added a compile assert for UString size.
+ * wtf/SizeLimits.cpp: Added compile asserts for data structures that didn't have cpp files.
+ * wtf/text/StringImpl.cpp: Added a compile assert for StringImpl size.
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39509 - Exceptions raised when JSString::value() is called not always properly thrown.
+ Missing some CHECK_FOR_EXCEPTION()s, cleanup NativeError construction (adding a property
+ via the prototype was inefficient, and whilst trivially true that the property is is not
+ a rope - and thus couldn't except - it would be hard to prove this).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::name):
+ (JSC::InternalFunction::displayName):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::name):
+ (JSC::JSFunction::displayName):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSPropertyNameIterator.cpp:
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::tryGetValue):
+ (JSC::JSString::getIndex):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NativeErrorPrototype.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Fix interpreter build.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Split out JITCall32_64.cpp, and tightened up some #ifdefs in the hopes
+ of improving compile times.
+ https://bugs.webkit.org/show_bug.cgi?id=39507
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.cpp:
+ * jit/JITArithmetic.cpp:
+ * jit/JITArithmetic32_64.cpp:
+ * jit/JITCall.cpp:
+ * jit/JITCall32_64.cpp: Copied from jit/JITCall.cpp.
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp:
+ * jit/JITPropertyAccess.cpp:
+ * jit/JITPropertyAccess32_64.cpp:
+ * jit/JITStubs.cpp:
+
+2010-05-21 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed buildfix for Qt after r59941.
+
+ * JavaScriptCore.pro: missing runtime/JSObjectWithGlobalObject.cpp added to SOURCES.
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix #3
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix #2
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix #1
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ All callable objects should have a global object reference
+ https://bugs.webkit.org/show_bug.cgi?id=39495
+
+ All objects that may ever return a value other CallTypeNone
+ or ConstructTypeNone now get a global object in their constructor
+ and store that in their first anonymous slot. We add a new type
+ JSObjectWithGlobalObject to allow us to share this logic as much
+ as possible, however some objects have specific inheritance
+ requirements so we can't just use it universally.
+
+ To enforce this requirement JSValue::getCallData and getConstructData
+ make use of a new "isValidCallee" function to assert that any object
+ that returns a value other than CallType/ConstructTypeNone has a
+ global object in anonymous slot 0.
+
+ In order to ensure that static function slots are converted into
+ function objects with the correct global object, all prototype objects
+ and other classes with static function slots also gain a global object
+ reference. Happily this fixes the long standing issue where host
+ function objects get a prototype from the lexical global object of the
+ first function that calls them, instead of the global object that they
+ are defined on.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::JSCallbackConstructor::JSCallbackConstructor):
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::JSCallbackFunction):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.cpp:
+ (JSC::):
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::JSCallbackObject):
+ (JSC::::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype):
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectGetPrivate):
+ (JSObjectSetPrivate):
+ (JSObjectGetPrivateProperty):
+ (JSObjectSetPrivateProperty):
+ (JSObjectDeletePrivateProperty):
+ * API/JSValueRef.cpp:
+ (JSValueIsObjectOfClass):
+ * API/JSWeakObjectMapRefPrivate.cpp:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * runtime/ArrayConstructor.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ * runtime/ArrayPrototype.h:
+ (JSC::ArrayPrototype::createStructure):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/BooleanPrototype.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateConstructor.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * runtime/DatePrototype.h:
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ErrorPrototype.h:
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionConstructor.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ (JSC::FunctionPrototype::addFunctionProperties):
+ * runtime/FunctionPrototype.h:
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ * runtime/GlobalEvalFunction.h:
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/InternalFunction.h:
+ * runtime/JSCell.h:
+ (JSC::JSValue::getCallData):
+ (JSC::JSValue::getConstructData):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ * runtime/JSONObject.cpp:
+ (JSC::JSONObject::JSONObject):
+ * runtime/JSONObject.h:
+ * runtime/JSObject.h:
+ * runtime/JSObjectWithGlobalObject.cpp: Added.
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSObjectWithGlobalObject.h: Added.
+ (JSC::JSObjectWithGlobalObject::createStructure):
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::isValidCallee):
+ * runtime/JSValue.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/MathObject.h:
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NativeErrorPrototype.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * runtime/NumberConstructor.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/NumberPrototype.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/ObjectConstructor.h:
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PrototypeFunction.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ (JSC::constructRegExp):
+ * runtime/RegExpConstructor.h:
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::RegExpObject):
+ * runtime/RegExpObject.h:
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * runtime/RegExpPrototype.h:
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringConstructor.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/StringPrototype.h:
+
+2010-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed the unused entry in the CallFrame
+ https://bugs.webkit.org/show_bug.cgi?id=39470
+
+ Removed the unused entry in the CallFrame, and reordered CallFrame
+ writes on the hot path to be in forwards order.
+
+ SunSpider says 0.3% faster.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+
+2010-05-21 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Split the QScriptValue autotest into smaller chunks.
+
+ File tst_qscriptvalue_generated.cpp was huge and it was difficult to compile
+ it with MSVS2008, because of the code optimization.
+
+ Tests were splited into a few files for better use of distributed
+ compilation.
+ Repeated calls to insert() and operator<<() where replaced by loops,
+ that should reduce time of code optimizing.
+
+ New files were generated by the same application, test logic wasn't changed.
+
+ [Qt] The QScriptValue autotest should be refactored.
+ https://bugs.webkit.org/show_bug.cgi?id=38987
+
+ * qt/tests/qscriptvalue/qscriptvalue.pro:
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: Removed.
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp: Added.
+ (tst_QScriptValue::initScriptValues):
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp: Added.
+ (tst_QScriptValue::isValid_initData):
+ (tst_QScriptValue::isValid_makeData):
+ (tst_QScriptValue::isValid_test):
+ (tst_QScriptValue::isBool_initData):
+ (tst_QScriptValue::isBool_makeData):
+ (tst_QScriptValue::isBool_test):
+ (tst_QScriptValue::isBoolean_initData):
+ (tst_QScriptValue::isBoolean_makeData):
+ (tst_QScriptValue::isBoolean_test):
+ (tst_QScriptValue::isNumber_initData):
+ (tst_QScriptValue::isNumber_makeData):
+ (tst_QScriptValue::isNumber_test):
+ (tst_QScriptValue::isFunction_initData):
+ (tst_QScriptValue::isFunction_makeData):
+ (tst_QScriptValue::isFunction_test):
+ (tst_QScriptValue::isNull_initData):
+ (tst_QScriptValue::isNull_makeData):
+ (tst_QScriptValue::isNull_test):
+ (tst_QScriptValue::isString_initData):
+ (tst_QScriptValue::isString_makeData):
+ (tst_QScriptValue::isString_test):
+ (tst_QScriptValue::isUndefined_initData):
+ (tst_QScriptValue::isUndefined_makeData):
+ (tst_QScriptValue::isUndefined_test):
+ (tst_QScriptValue::isObject_initData):
+ (tst_QScriptValue::isObject_makeData):
+ (tst_QScriptValue::isObject_test):
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp: Added.
+ (tst_QScriptValue::toString_initData):
+ (tst_QScriptValue::toString_makeData):
+ (tst_QScriptValue::toString_test):
+ (tst_QScriptValue::toNumber_initData):
+ (tst_QScriptValue::toNumber_makeData):
+ (tst_QScriptValue::toNumber_test):
+ (tst_QScriptValue::toBool_initData):
+ (tst_QScriptValue::toBool_makeData):
+ (tst_QScriptValue::toBool_test):
+ (tst_QScriptValue::toBoolean_initData):
+ (tst_QScriptValue::toBoolean_makeData):
+ (tst_QScriptValue::toBoolean_test):
+ (tst_QScriptValue::toInteger_initData):
+ (tst_QScriptValue::toInteger_makeData):
+ (tst_QScriptValue::toInteger_test):
+ (tst_QScriptValue::toInt32_initData):
+ (tst_QScriptValue::toInt32_makeData):
+ (tst_QScriptValue::toInt32_test):
+ (tst_QScriptValue::toUInt32_initData):
+ (tst_QScriptValue::toUInt32_makeData):
+ (tst_QScriptValue::toUInt32_test):
+ (tst_QScriptValue::toUInt16_initData):
+ (tst_QScriptValue::toUInt16_makeData):
+ (tst_QScriptValue::toUInt16_test):
+
+2010-05-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Add COMPILER(MSVC) guard for strnstr
+ https://bugs.webkit.org/show_bug.cgi?id=39397
+
+ BREWMP uses MSVC for simulator build, but it is not OS(WINDOWS).
+ Add COMPILER(MSVC) guard for strnstr.
+
+ * wtf/StringExtras.h:
+
+2010-05-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add !PLATFORM(BREWMP) guard for isMainThread
+ https://bugs.webkit.org/show_bug.cgi?id=39396
+
+ BREWMP sets ENABLE(SINGLE_THREADED), so it uses isMainThread from ThreadingNone.cpp.
+ Exclude isMainThread in MainThread.cpp.
+
+ * wtf/MainThread.cpp:
+
+2010-05-20 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Use skia as BREW MP's graphics backend.
+ https://bugs.webkit.org/show_bug.cgi?id=39407
+
+ Define WTF_PLATFORM_SKIA=1 for BREW MP.
+
+ * wtf/Platform.h:
+
+2010-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Fixed naming mixup: it's op_call_put_result, not ret_result.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Whittling away at CodeBlock use: Removed a little wonkiness in closure lookup
+ https://bugs.webkit.org/show_bug.cgi?id=39444
+
+ Calculate all lookup depths at compile time. I'm not sure why we couldn't
+ do this before, but whatever the reason, it seems to be gone now.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::findScopedProperty):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_resolve_skip):
+ (JSC::JIT::emit_op_resolve_global_dynamic):
+ (JSC::JIT::emitSlow_op_resolve_global_dynamic):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_resolve_skip):
+
+2010-05-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix warnings seen on the buildbots today
+ https://bugs.webkit.org/show_bug.cgi?id=39368
+
+ * profiler/ProfileNode.cpp:
+ (JSC::getCount): Removed unneeded initialization of global variable.
+ These are all initialized to zero anyway, so no need to try to initialize
+ it and get a warning.
+
+ * wtf/CurrentTime.cpp:
+ (WTF::currentTime): Removed unused global variable.
+
+2010-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed some reliance on callFame[CodeBlock] by storing CodeBlock in a
+ local variable in the Interpreter.
+ https://bugs.webkit.org/show_bug.cgi?id=39447
+
+ Small speedup on SunSpider in Interpreter mode.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jsc.cpp:
+ * wtf/Platform.h:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39408 - Unify JIT/interpreter return behaviour.
+
+ Presently the JIT and the interpreter have differing implementations in how
+ they handle storing the result of a function call back to the register file.
+ In both cases the op_call ( / _eval / _varargs / op_construct) opcode has an
+ operand indicating the VM register in which the result should be stored.
+ The JIT plants code after the call to store the result, so the value will be
+ stored as soon as the callee has returned. In the interpreter the call
+ passes the return value register id into the callee via the callee callframe,
+ and the callee is responsible for writing the result back into its callers
+ register file after it has restored the parents callframe pointer, but before
+ returning.
+
+ Instead, move the task of writing the call result to the register file into a
+ new opcode (op_call_put_result), and after returning the callee should leave
+ the return value in a canonical location. In the case of the interpreter,
+ this canonical location is a local variable in privateExecute
+ (functionReturnValue), in the case of the JIT this is the normal return value
+ registers (regT0, or regT1:regT0 in JSVALUE32_64). op_call_put_result stores
+ the result from the canonical location to the registerfile.
+
+ In addition to unifying JIT & interpreter behaviour this change allows us to
+ remove a slot from the callframe, omit the write of the result where the
+ return value from the call is not used, and provides a 2% speedup on sunspider
+ in the interpreter.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallVarargs):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::finalDestinationOrIgnored):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::NewExprNode::emitBytecode):
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::FunctionCallBracketNode::emitBytecode):
+ (JSC::FunctionCallDotNode::emitBytecode):
+ (JSC::CallFunctionCallDotNode::emitBytecode):
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::init):
+ (JSC::ExecState::noCaller):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::emit_op_call_put_result):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+
+2010-05-20 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Provide bindings for DeviceOrientation
+ https://bugs.webkit.org/show_bug.cgi?id=39210
+
+ Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Errk! rename op_constructor_ret as requested in review of Bug 39399.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitReturn):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::emit_op_ret_object_or_this):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_ret_object_or_this):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 39399 - Move responsibility for verifying constructors return objects from the caller to the callee.
+
+ This is a necessary step to move object creation from caller to callee.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitReturn):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::isConstructor):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::FunctionBodyNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::emit_op_constructor_ret):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_constructor_ret):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Fix windows build II.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39393 - JSFunction need not be a subclass of InternalFunction.
+
+ re-landing r59800.
+
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ * interpreter/Interpreter.h:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::):
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::name):
+ (JSC::JSFunction::displayName):
+ (JSC::JSFunction::calculatedDisplayName):
+ * runtime/JSFunction.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ * runtime/JSObject.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Reverting r59800, this b0rked stuff.
+
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ * interpreter/Interpreter.h:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::):
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSObject.cpp:
+ * runtime/JSObject.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39393 - JSFunction need not be a subclass of InternalFunction.
+
+ This may prevent us from introducing a more useful parent class to
+ JSFunction, e.g. a JSObject that holds an executable, which could
+ also reference an eval or program executable.
+
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ * interpreter/Interpreter.h:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::):
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::name):
+ (JSC::JSFunction::displayName):
+ (JSC::JSFunction::calculatedDisplayName):
+ * runtime/JSFunction.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ * runtime/JSObject.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+
+2010-05-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ emitJumpIfNotJSCell should special case constant immediate values
+ https://bugs.webkit.org/show_bug.cgi?id=39392
+ <rdar://problem/8001324>
+
+ Make emitJumpSlowCaseIfNotJSCell special case constant immediate
+ values, in addition to the immediate JSCell optimisation.
+
+ Also add assertions to make sure no one else produces code that
+ attempts to load constants from the register file.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::emitJumpIfNotJSCell):
+ (JSC::JSInterfaceJIT::emitLoadInt32):
+ (JSC::JSInterfaceJIT::tagFor):
+ (JSC::JSInterfaceJIT::payloadFor):
+ (JSC::JSInterfaceJIT::emitLoadDouble):
+ (JSC::JSInterfaceJIT::addressFor):
+ * jit/ThunkGenerators.cpp:
+
+2010-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Slight refactoring to CodeBlock bytecode access
+ https://bugs.webkit.org/show_bug.cgi?id=39384
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::returnPC):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::retrieveLastCaller): Moved bytecode access into a
+ CodeBlock helper function. Changed CallFrame to accurately represent
+ how the returnPC is stored in JIT vs Interpreter.
+
+2010-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Don't build the Interpreter into JIT builds.
+ https://bugs.webkit.org/show_bug.cgi?id=39373
+
+ SunSpider says no change.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * wtf/Platform.h:
+
+2010-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Standardized naming: "bytecode offset" wins; "bytecode index" loses.
+
+ Also renamed getBytecodeOffset to bytecodeOffset, to match the WebKit
+ naming style.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CallReturnOffsetToBytecodeOffset::CallReturnOffsetToBytecodeOffset):
+ (JSC::getCallReturnOffset):
+ (JSC::CodeBlock::bytecodeOffset):
+ (JSC::CodeBlock::callReturnIndexVector):
+ * interpreter/Interpreter.cpp:
+ (JSC::bytecodeOffsetForPC):
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileLinkPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JumpTable::JumpTable):
+ (JSC::SwitchRecord::SwitchRecord):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::addSlowCase):
+ (JSC::JIT::addJump):
+ (JSC::JIT::emitJumpSlowToHot):
+ (JSC::JIT::isLabeled):
+ (JSC::JIT::map):
+ (JSC::JIT::unmap):
+ (JSC::JIT::isMapped):
+ (JSC::JIT::getMappedPayload):
+ (JSC::JIT::getMappedTag):
+ (JSC::JIT::emitGetVirtualRegister):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emit_op_switch_char):
+ (JSC::JIT::emit_op_switch_string):
+ (JSC::JIT::emit_op_new_error):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_mov):
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emit_op_switch_char):
+ (JSC::JIT::emit_op_switch_string):
+ (JSC::JIT::emit_op_new_error):
+ (JSC::JIT::emit_op_convert_this):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emitSlow_op_method_check):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emitSlow_op_method_check):
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emit_op_get_by_pname):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::call):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-05-19 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ The backtrackParenthesesOnceEnd function should store the start position
+ of the subpattern's non-greedy match at the place of the subpattern's
+ start index in the output array instead of the place of the
+ subpattern's end index.
+ Add layout test for checking of non-greedy matching of subpattern in
+ regular expressions.
+ https://bugs.webkit.org/show_bug.cgi?id=39289
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
+
+2010-05-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 39343 - Dynamically generate a native call thunk per NativeFunction
+
+ https://bugs.webkit.org/show_bug.cgi?id=39252 regressed performance on i386,
+ by adding an extra indirection to making a native call. By introducing per-
+ NativeFunction thunks we can hard code the function pointer into the thunk
+ so that it need not be loaded from the callee.
+
+ * jit/JIT.h:
+ (JSC::JIT::compileCTINativeCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::ctiStub):
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITStubs.h:
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * jit/ThunkGenerators.cpp:
+ (JSC::charCodeAtThunkGenerator):
+ (JSC::charAtThunkGenerator):
+ (JSC::fromCharCodeThunkGenerator):
+ (JSC::sqrtThunkGenerator):
+ (JSC::powThunkGenerator):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::getHostFunction):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::getCTIStub):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * wtf/Platform.h:
+
+2010-05-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Simplified handling of 'arguments' -- 1.2% SunSpider speedup
+ https://bugs.webkit.org/show_bug.cgi?id=39200
+
+ Removed the reserved OptionalCalleeArguments slot from the CallFrame.
+ Now, slots for 'arguments' are allocated and initialized only by
+ functions that might need them.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Updated for new bytecode operands.
+
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::unmodifiedArgumentsRegister): Added a helper function for mapping
+ from the arguments register to its unmodified counterpart.
+
+ (JSC::CodeBlock::setArgumentsRegister):
+ (JSC::CodeBlock::argumentsRegister):
+ (JSC::CodeBlock::usesArguments): Changed from a "usesArguments" bool to
+ an optional int index representing the arguments register.
+
+ * bytecode/Opcode.h: Updated for new bytecode operands.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::addVar): Factored out a helper function for
+ allocating an anonymous var.
+
+ (JSC::BytecodeGenerator::BytecodeGenerator): Merged / simplified some
+ arguments vs activation logic, and added code to allocate the arguments
+ registers when needed.
+
+ (JSC::BytecodeGenerator::createArgumentsIfNecessary): Updated for new bytecode operands.
+
+ (JSC::BytecodeGenerator::emitCallEval): No need to create the arguments
+ object before calling eval; the activation object will lazily create the
+ arguments object if eval resolves it.
+
+ (JSC::BytecodeGenerator::emitReturn): Updated for new bytecode operands.
+
+ (JSC::BytecodeGenerator::emitPushScope):
+ (JSC::BytecodeGenerator::emitPushNewScope): Ditto emitCallEval.
+
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::addVar): Factored out a helper function for
+ allocating an anonymous var.
+
+ (JSC::BytecodeGenerator::registerFor): No more need for special handling
+ of the arguments registers; they're allocated just like normal registers
+ now.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::callerFrame):
+ (JSC::ExecState::init):
+ * interpreter/CallFrameClosure.h:
+ (JSC::CallFrameClosure::resetCallFrame): Nixed optionalCalleeArguments.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments): Opcodes accessing 'arguments' now
+ take operands specifying registers, just like all other opcodes.
+ JSActivation::copyRegisters is no longer responsible for tearing off the
+ arguments object; instead, the VM is responsible for both.
+
+ Also, a behavior change: Each access to f.arguments creates a new object,
+ unless f itself uses 'arguments'. This matches Chrome, and is necessary
+ for the optimization. f.arguments is a nonstandard, deprecated feature,
+ so high fidelity to a given implementation is not necessarily a goal.
+ Also, as illustrated by the new test case, the identity of f.arguments
+ has been broken since 2008, except in the case where f itself accesses
+ f.arguments -- but nobody seemed to notice. So, hopefully this change won't
+ break the web.
+
+ * interpreter/Register.h: Nixed the special arguments accessor. It's no
+ longer needed.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_tear_off_arguments):
+ (JSC::JIT::emit_op_create_arguments):
+ (JSC::JIT::emit_op_init_arguments):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_tear_off_arguments):
+ (JSC::JIT::emit_op_create_arguments):
+ (JSC::JIT::emit_op_init_arguments): The actual optimization: Removed
+ OptionalCalleeArguments from the callframe slot. Now, it doesn't need
+ to be initialized for most calls.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::): Updated stubs to support arbitrary 'arguments' registers,
+ instead of hard-coding something in the call frame.
+
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters): Removed some obfuscatory abstraction.
+
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::generatedByteCode): Added a helper for accessing
+ the 'arguments' register. In a future patch, that kind of data should
+ probably move out of CodeBlock and into Executable.
+
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::getOwnPropertySlot):
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h: Simplified / fixed access to 'arguments' via
+ the activation object. It now implements the same behavior implemented
+ by optimized variable access in the VM. This simplifies some other
+ things, too -- like eval code generation.
+
+2010-05-18 Sam Weinig <sam@webkit.org>
+
+ Try to fix the windows build.
+
+ * API/JSStringRefBSTR.cpp:
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set.
+ https://bugs.webkit.org/show_bug.cgi?id=39304
+ <rdar://problem/7998366>
+
+ Add an inlineCapacity template parameter to ListHashSet.
+
+ * wtf/ListHashSet.h:
+ (WTF::::ListHashSet):
+ (WTF::::operator):
+ (WTF::::swap):
+ (WTF::::~ListHashSet):
+ (WTF::::size):
+ (WTF::::capacity):
+ (WTF::::isEmpty):
+ (WTF::::begin):
+ (WTF::::end):
+ (WTF::::find):
+ (WTF::::contains):
+ (WTF::::add):
+ (WTF::::insertBefore):
+ (WTF::::remove):
+ (WTF::::clear):
+ (WTF::::unlinkAndDelete):
+ (WTF::::appendNode):
+ (WTF::::insertNodeBefore):
+ (WTF::::deleteAllNodes):
+ (WTF::::makeIterator):
+ (WTF::::makeConstIterator):
+ (WTF::deleteAllValues):
+
+2010-05-18 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Fix the interpreter after r59637
+ https://bugs.webkit.org/show_bug.cgi?id=39287
+
+ * runtime/Executable.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getCallData):
+ * runtime/JSGlobalData.cpp:
+ * runtime/JSGlobalData.h:
+
+2010-05-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Oops, meant ebx not eax there. Fix Qt (and probably Win too).
+
+ * jit/JITOpcodes32_64.cpp:
+
+2010-05-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 39252 - Move host/native JSFunction's NativeFunction onto NativeExecutable.
+
+ Currently host functions reuse JSFunction's ScopeChain as storage for their
+ NativeFunction (the C function pointer to the host function implementation).
+ Instead, move this onto NativeExecutable. This will allow host functions to
+ have a scopechain (which will be implemented as a separate patch).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::specializedThunk):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiNativeCall):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * jit/ThunkGenerators.cpp:
+ (JSC::charCodeAtThunkGenerator):
+ (JSC::charAtThunkGenerator):
+ (JSC::fromCharCodeThunkGenerator):
+ (JSC::sqrtThunkGenerator):
+ (JSC::powThunkGenerator):
+ * jit/ThunkGenerators.h:
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::create):
+ (JSC::NativeExecutable::function):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::JSFunction::nativeFunction):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::markChildren):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::getOwnPropertySlot):
+ (JSC::JSFunction::getConstructData):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::scope):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::getThunk):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+
2010-05-17 Patrick Gansterer <paroga@paroga.com>
Reviewed by Laszlo Gombos.
diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
index 947f371..c64d94c 100644
--- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig
+++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
@@ -47,6 +47,7 @@ ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
ENABLE_DATABASE = ENABLE_DATABASE;
ENABLE_DATAGRID = ;
ENABLE_DATALIST = ENABLE_DATALIST;
+ENABLE_DEVICE_ORIENTATION = ;
ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
ENABLE_FILTERS = ENABLE_FILTERS;
@@ -78,4 +79,4 @@ ENABLE_XHTMLMP = ;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/JavaScriptCore/Configurations/Version.xcconfig b/JavaScriptCore/Configurations/Version.xcconfig
index daa79a9..6f999af 100644
--- a/JavaScriptCore/Configurations/Version.xcconfig
+++ b/JavaScriptCore/Configurations/Version.xcconfig
@@ -22,7 +22,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MAJOR_VERSION = 534;
-MINOR_VERSION = 0;
+MINOR_VERSION = 1;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am
index 8ed23e5..2c924ef 100644
--- a/JavaScriptCore/GNUmakefile.am
+++ b/JavaScriptCore/GNUmakefile.am
@@ -86,6 +86,7 @@ javascriptcore_sources += \
JavaScriptCore/jit/JITOpcodes.cpp \
JavaScriptCore/jit/JITOpcodes32_64.cpp \
JavaScriptCore/jit/JITCall.cpp \
+ JavaScriptCore/jit/JITCall32_64.cpp \
JavaScriptCore/jit/JITCode.h \
JavaScriptCore/jit/JITPropertyAccess.cpp \
JavaScriptCore/jit/JITPropertyAccess32_64.cpp \
@@ -463,6 +464,7 @@ javascriptcore_sources += \
JavaScriptCore/runtime/JSNumberCell.cpp \
JavaScriptCore/runtime/JSNumberCell.h \
JavaScriptCore/runtime/JSObject.cpp \
+ JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp \
JavaScriptCore/runtime/JSObject.h \
JavaScriptCore/runtime/JSStaticScopeObject.cpp \
JavaScriptCore/runtime/JSStaticScopeObject.h \
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 51850da..e14af7f 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -1,5 +1,3 @@
-__ZN7WebCore10StringImpl6createEPKcj
-__ZN7WebCore12AtomicString11addSlowCaseEPNS_10StringImplE
_JSCheckScriptSyntax
_JSClassCreate
_JSClassRelease
@@ -109,7 +107,9 @@ __ZN3JSC10Identifier3addEPNS_9ExecStateEPKc
__ZN3JSC10Identifier4fromEPNS_9ExecStateEi
__ZN3JSC10Identifier4fromEPNS_9ExecStateEj
__ZN3JSC10Identifier5equalEPKN7WebCore10StringImplEPKc
-__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE
+__ZN3JSC10JSFunction4infoE
+__ZN3JSC10JSFunction4nameEPNS_9ExecStateE
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESC_RKNS_7ArgListEE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
@@ -167,15 +167,14 @@ __ZN3JSC15createTypeErrorEPNS_9ExecStateEPKc
__ZN3JSC15toInt32SlowCaseEdRb
__ZN3JSC16InternalFunction4infoE
__ZN3JSC16InternalFunction4nameEPNS_9ExecStateE
-__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_10IdentifierE
+__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_10IdentifierE
__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
__ZN3JSC16toUInt32SlowCaseEdRb
__ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb
__ZN3JSC17PropertyNameArray3addEPN7WebCore10StringImplE
-__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE
-__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectES6_RKNS_7ArgListEE
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESC_RKNS_7ArgListEE
__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
__ZN3JSC18DebuggerActivationC1EPNS_8JSObjectE
__ZN3JSC18PropertyDescriptor11setWritableEb
@@ -192,6 +191,7 @@ __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
__ZN3JSC23AbstractSamplingCounter4dumpEv
__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC24JSObjectWithGlobalObjectC2EPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEE
__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
@@ -238,6 +238,7 @@ __ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7ArgListE
__ZN3JSC7JSArrayC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE
__ZN3JSC7JSArrayD2Ev
+__ZN3JSC7JSValue13isValidCalleeEv
__ZN3JSC7Profile10restoreAllEv
__ZN3JSC7Profile5focusEPKNS_11ProfileNodeE
__ZN3JSC7Profile7excludeEPKNS_11ProfileNodeE
@@ -264,6 +265,7 @@ __ZN3JSC8JSObject15unwrappedObjectEv
__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
__ZN3JSC8JSObject17createInheritorIDEv
__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
+__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj
__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
@@ -392,6 +394,7 @@ __ZN7WebCore10StringImpl5lowerEv
__ZN7WebCore10StringImpl5toIntEPb
__ZN7WebCore10StringImpl5upperEv
__ZN7WebCore10StringImpl6createEPKc
+__ZN7WebCore10StringImpl6createEPKcj
__ZN7WebCore10StringImpl6createEPKtj
__ZN7WebCore10StringImpl6createEPKtjN3WTF10PassRefPtrINS3_21CrossThreadRefCountedINS3_16OwnFastMallocPtrIS1_EEEEEE
__ZN7WebCore10StringImpl6secureEt
@@ -403,6 +406,7 @@ __ZN7WebCore10StringImpl8endsWithEPS0_b
__ZN7WebCore10StringImpl9substringEjj
__ZN7WebCore10StringImplD1Ev
__ZN7WebCore11commentAtomE
+__ZN7WebCore12AtomicString11addSlowCaseEPNS_10StringImplE
__ZN7WebCore12AtomicString3addEPKc
__ZN7WebCore12AtomicString3addEPKt
__ZN7WebCore12AtomicString3addEPKtj
@@ -452,7 +456,7 @@ __ZN7WebCoreplEPKcRKNS_6StringE
__ZN7WebCoreplERKNS_6StringEPKc
__ZN7WebCoreplERKNS_6StringES2_
__ZNK3JSC10JSFunction23isHostFunctionNonInlineEv
-__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE
+__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_10JSFunctionE
__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
__ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE
__ZNK3JSC14JSGlobalObject14isDynamicScopeERb
@@ -470,9 +474,10 @@ __ZNK3JSC18PropertyDescriptor20isAccessorDescriptorEv
__ZNK3JSC18PropertyDescriptor6getterEv
__ZNK3JSC18PropertyDescriptor6setterEv
__ZNK3JSC18PropertyDescriptor8writableEv
-__ZNK3JSC4Heap4sizeEv
+__ZNK3JSC24JSObjectWithGlobalObject12globalObjectEv
__ZNK3JSC4Heap10statisticsEv
__ZNK3JSC4Heap11objectCountEv
+__ZNK3JSC4Heap4sizeEv
__ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
__ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
__ZNK3JSC6JSCell14isGetterSetterEv
diff --git a/JavaScriptCore/JavaScriptCore.gypi b/JavaScriptCore/JavaScriptCore.gypi
index 2d1f20a..c54ff17 100644
--- a/JavaScriptCore/JavaScriptCore.gypi
+++ b/JavaScriptCore/JavaScriptCore.gypi
@@ -117,6 +117,7 @@
'jit/JITArithmetic.cpp',
'jit/JITArithmetic32_64.cpp',
'jit/JITCall.cpp',
+ 'jit/JITCall32_64.cpp',
'jit/JITCode.h',
'jit/JITInlineMethods.h',
'jit/JITOpcodes.cpp',
@@ -247,6 +248,8 @@
'runtime/JSNumberCell.h',
'runtime/JSObject.cpp',
'runtime/JSObject.h',
+ 'runtime/JSObjectWithGlobalObject.cpp',
+ 'runtime/JSObjectWithGlobalObject.h',
'runtime/JSONObject.cpp',
'runtime/JSONObject.h',
'runtime/JSPropertyNameIterator.cpp',
@@ -400,6 +403,7 @@
'wtf/RefPtrHashMap.h',
'wtf/RetainPtr.h',
'wtf/SegmentedVector.h',
+ 'wtf/SizeLimits.cpp',
'wtf/StaticConstructors.h',
'wtf/StdLibExtras.h',
'wtf/StringExtras.h',
diff --git a/JavaScriptCore/JavaScriptCore.pro b/JavaScriptCore/JavaScriptCore.pro
index 5378857..a3d8358 100644
--- a/JavaScriptCore/JavaScriptCore.pro
+++ b/JavaScriptCore/JavaScriptCore.pro
@@ -101,6 +101,7 @@ SOURCES += \
jit/JITArithmetic.cpp \
jit/JITArithmetic32_64.cpp \
jit/JITCall.cpp \
+ jit/JITCall32_64.cpp \
jit/JIT.cpp \
jit/JITOpcodes.cpp \
jit/JITOpcodes32_64.cpp \
@@ -159,6 +160,7 @@ SOURCES += \
runtime/JSNotAnObject.cpp \
runtime/JSNumberCell.cpp \
runtime/JSObject.cpp \
+ runtime/JSObjectWithGlobalObject.cpp \
runtime/JSONObject.cpp \
runtime/JSPropertyNameIterator.cpp \
runtime/JSStaticScopeObject.cpp \
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
index afd1ca0..e7d7eda 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
@@ -6,15 +6,14 @@ EXPORTS
??0DateInstance@JSC@@QAE@PAVExecState@1@N@Z
??0DateInstance@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@N@Z
??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z
- ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
+ ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVArgList@1@@Z
??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
- ??0JSFunction@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
+ ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V71@ABVArgList@1@@Z@Z
+ ??0JSObjectWithGlobalObject@JSC@@IAE@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
??0MD5@WTF@@QAE@XZ
??0Mutex@WTF@@QAE@XZ
- ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V41@ABVArgList@1@@Z@Z
- ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
??0StringObject@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@I@Z
@@ -175,6 +174,7 @@ EXPORTS
?getter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
?globalExec@JSGlobalObject@JSC@@UAEPAVExecState@2@XZ
?globalObjectCount@Heap@JSC@@QAEIXZ
+ ?globalObject@JSObjectWithGlobalObject@JSC@@QBEPAVJSGlobalObject@2@XZ
?hasInstance@JSObject@JSC@@UAE_NPAVExecState@2@VJSValue@2@1@Z
?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@ABVIdentifier@2@@Z
?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@I@Z
@@ -194,6 +194,7 @@ EXPORTS
?isGetterSetter@JSCell@JSC@@UBE_NXZ
?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ
?isMainThread@WTF@@YA_NXZ
+ ?isValidCallee@JSValue@JSC@@QAE_NXZ
?isVariableObject@JSVariableObject@JSC@@UBE_NXZ
?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z
?jsOwnedString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z
@@ -214,6 +215,7 @@ EXPORTS
?monthFromDayInYear@WTF@@YAHH_N@Z
?msToYear@WTF@@YAHN@Z
?name@InternalFunction@JSC@@QAEABVUString@2@PAVExecState@2@@Z
+ ?name@JSFunction@JSC@@QAEABVUString@2@PAVExecState@2@@Z
?newUninitialized@CString@WTF@@SA?AV12@IAAPAD@Z
?nonInlineNaN@JSC@@YANXZ
?objectCount@Heap@JSC@@QBEIXZ
@@ -232,6 +234,7 @@ EXPORTS
?put@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@@Z
?put@StringObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z
?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVInternalFunction@2@I@Z
+ ?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVJSFunction@2@I@Z
?putWithAttributes@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z
@@ -245,7 +248,7 @@ EXPORTS
?resetDateCache@JSGlobalData@JSC@@QAEXXZ
?resolveRope@JSString@JSC@@ABEXPAVExecState@2@@Z
?restoreAll@Profile@JSC@@QAEXXZ
- ?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVInternalFunction@2@@Z
+ ?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVJSFunction@2@@Z
?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z
?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index 5ace49c..effce51 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -853,6 +853,14 @@
>
</File>
<File
+ RelativePath="..\..\runtime\JSObjectWithGlobalObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSObjectWithGlobalObject.h"
+ >
+ </File>
+ <File
RelativePath="..\..\runtime\JSONObject.cpp"
>
</File>
@@ -1645,6 +1653,10 @@
>
</File>
<File
+ RelativePath="..\..\jit\JITCall32_64.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\jit\JITCode.h"
>
</File>
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 1edb0af..8d10ab3 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -43,6 +43,7 @@
0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BDFFAE00FC6192900D69EF4 /* CrossThreadRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BDFFAE10FC6193100D69EF4 /* OwnFastMallocPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0BF28A2911A33DC300638F84 /* SizeLimits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */; };
14035DB110DBFB2A00FFFFE7 /* WeakGCPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
140566C4107EC255005DBC8D /* JSAPIValueWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */; };
140566D1107EC267005DBC8D /* JSStaticScopeObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */; };
@@ -111,6 +112,7 @@
14469DED107EC7E700650446 /* StringPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C50E16EE3300B34460 /* StringPrototype.cpp */; };
14469DEE107EC7E700650446 /* UString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8850255597D01FF60F7 /* UString.cpp */; };
146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */; };
+ 146FE51211A710430087AE66 /* JITCall32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146FE51111A710430087AE66 /* JITCall32_64.cpp */; };
147B83AC0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */; };
147B84630E6DE6B1004775A4 /* PutPropertySlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */; settings = {ATTRIBUTES = (Private, ); }; };
147F39BD107EC37600427A48 /* ArgList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF605110E203EF800B9A64D /* ArgList.cpp */; };
@@ -222,6 +224,9 @@
86B99AE3117E578100DF5A90 /* StringBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99AE1117E578100DF5A90 /* StringBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
86B99AE4117E578100DF5A90 /* StringImplBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99AE2117E578100DF5A90 /* StringImplBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */; };
+ 86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86C568DD11A213EE0007F7F0 /* MacroAssemblerARM.cpp */; };
+ 86C568E111A213EE0007F7F0 /* MacroAssemblerMIPS.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */; };
+ 86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */; };
86CA032E1038E8440028A609 /* Executable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CA032D1038E8440028A609 /* Executable.cpp */; };
86CAFEE31035DDE60028A609 /* Executable.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CAFEE21035DDE60028A609 /* Executable.h */; settings = {ATTRIBUTES = (); }; };
86CC85A10EE79A4700288682 /* JITInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CC85A00EE79A4700288682 /* JITInlineMethods.h */; };
@@ -306,13 +311,14 @@
A76EE6590FAE59D5003F069A /* NativeFunctionWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7795590101A74D500114E55 /* MarkStack.h in Headers */ = {isa = PBXBuildFile; fileRef = A779558F101A74D500114E55 /* MarkStack.h */; settings = {ATTRIBUTES = (Private, ); }; };
A782F1A50EEC9FA20036273F /* ExecutableAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A782F1A40EEC9FA20036273F /* ExecutableAllocatorPosix.cpp */; };
+ A783A0D111A36DCA00563D20 /* JSObjectWithGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A783A2AB11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */; };
A791EF280F11E07900AE1F68 /* JSByteArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A791EF260F11E07900AE1F68 /* JSByteArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
A791EF290F11E07900AE1F68 /* JSByteArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A791EF270F11E07900AE1F68 /* JSByteArray.cpp */; };
A7A1F7AC0F252B3C00E184E2 /* ByteArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A1F7AA0F252B3C00E184E2 /* ByteArray.cpp */; };
A7A1F7AD0F252B3C00E184E2 /* ByteArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */; };
A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */; };
- A7C2217810C7479400F97913 /* JSZombie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C2216B10C7469C00F97913 /* JSZombie.cpp */; };
A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */; };
A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D649A91015224E009B2E1B /* PossiblyNull.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E2EA690FB460CF00601F06 /* LiteralParser.h */; };
@@ -321,6 +327,8 @@
A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */; };
A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */; };
A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC01D4F111A8F1FF00A54B2A /* JSZombie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC01D4EF11A8F1FF00A54B2A /* JSZombie.cpp */; };
+ BC01D4F211A8F1FF00A54B2A /* JSZombie.h in Headers */ = {isa = PBXBuildFile; fileRef = BC01D4F011A8F1FF00A54B2A /* JSZombie.h */; };
BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; };
BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; };
BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */; };
@@ -589,6 +597,7 @@
0B4D7E620F319AC800AD7E58 /* TypeTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = "<group>"; };
0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnFastMallocPtr.h; sourceTree = "<group>"; };
0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadRefCounted.h; sourceTree = "<group>"; };
+ 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SizeLimits.cpp; sourceTree = "<group>"; };
14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCPtr.h; sourceTree = "<group>"; };
140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBasePrivate.h; sourceTree = "<group>"; };
141211020A48780900480255 /* minidom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = minidom.c; path = tests/minidom.c; sourceTree = "<group>"; };
@@ -626,6 +635,7 @@
145C507F0D9DF63B0088F6B9 /* CallData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallData.h; sourceTree = "<group>"; };
146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStringRefCF.h; sourceTree = "<group>"; };
146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRefCF.cpp; sourceTree = "<group>"; };
+ 146FE51111A710430087AE66 /* JITCall32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall32_64.cpp; sourceTree = "<group>"; };
14760863099C633800437128 /* JSImmediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImmediate.cpp; sourceTree = "<group>"; };
147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BatchedTransitionOptimizer.h; sourceTree = "<group>"; };
147B84620E6DE6B1004775A4 /* PutPropertySlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutPropertySlot.h; sourceTree = "<group>"; };
@@ -777,6 +787,9 @@
86B99AE1117E578100DF5A90 /* StringBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringBuffer.h; path = text/StringBuffer.h; sourceTree = "<group>"; };
86B99AE2117E578100DF5A90 /* StringImplBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringImplBase.h; path = text/StringImplBase.h; sourceTree = "<group>"; };
86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssembler.h; sourceTree = "<group>"; };
+ 86C568DD11A213EE0007F7F0 /* MacroAssemblerARM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerARM.cpp; sourceTree = "<group>"; };
+ 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerMIPS.h; sourceTree = "<group>"; };
+ 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIPSAssembler.h; sourceTree = "<group>"; };
86CA032D1038E8440028A609 /* Executable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Executable.cpp; sourceTree = "<group>"; };
86CAFEE21035DDE60028A609 /* Executable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Executable.h; sourceTree = "<group>"; };
86CC85A00EE79A4700288682 /* JITInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITInlineMethods.h; sourceTree = "<group>"; };
@@ -892,6 +905,8 @@
A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeFunctionWrapper.h; sourceTree = "<group>"; };
A779558F101A74D500114E55 /* MarkStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkStack.h; sourceTree = "<group>"; };
A782F1A40EEC9FA20036273F /* ExecutableAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorPosix.cpp; sourceTree = "<group>"; };
+ A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectWithGlobalObject.h; sourceTree = "<group>"; };
+ A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObjectWithGlobalObject.cpp; sourceTree = "<group>"; };
A791EF260F11E07900AE1F68 /* JSByteArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSByteArray.h; sourceTree = "<group>"; };
A791EF270F11E07900AE1F68 /* JSByteArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSByteArray.cpp; sourceTree = "<group>"; };
A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRefPrivate.h; sourceTree = "<group>"; };
@@ -900,8 +915,6 @@
A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutableAllocator.h; sourceTree = "<group>"; };
A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocator.cpp; sourceTree = "<group>"; };
A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess32_64.cpp; sourceTree = "<group>"; };
- A7C2216810C745E000F97913 /* JSZombie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSZombie.h; sourceTree = "<group>"; };
- A7C2216B10C7469C00F97913 /* JSZombie.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSZombie.cpp; sourceTree = "<group>"; };
A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStackPosix.cpp; sourceTree = "<group>"; };
A7D649A91015224E009B2E1B /* PossiblyNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PossiblyNull.h; sourceTree = "<group>"; };
A7E2EA690FB460CF00601F06 /* LiteralParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiteralParser.h; sourceTree = "<group>"; };
@@ -916,6 +929,8 @@
A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyDescriptor.cpp; sourceTree = "<group>"; };
A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
+ BC01D4EF11A8F1FF00A54B2A /* JSZombie.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSZombie.cpp; sourceTree = "<group>"; };
+ BC01D4F011A8F1FF00A54B2A /* JSZombie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSZombie.h; sourceTree = "<group>"; };
BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorConstructor.cpp; sourceTree = "<group>"; };
BC02E9050E1839DB000F9297 /* ErrorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorConstructor.h; sourceTree = "<group>"; };
BC02E9060E1839DB000F9297 /* ErrorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorPrototype.cpp; sourceTree = "<group>"; };
@@ -1231,6 +1246,7 @@
86A90ECF0EE7D51F00AB350D /* JITArithmetic.cpp */,
A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */,
86CC85A20EE79B7400288682 /* JITCall.cpp */,
+ 146FE51111A710430087AE66 /* JITCall32_64.cpp */,
86CCEFDD0F413F8900FD7F9E /* JITCode.h */,
86CC85A00EE79A4700288682 /* JITInlineMethods.h */,
BCDD51E90FB8DF74004A8BDC /* JITOpcodes.cpp */,
@@ -1427,6 +1443,7 @@
65C647B3093EF8D60022C380 /* RefPtr.h */,
148A1ECD0D10C23B0069A47C /* RefPtrHashMap.h */,
51F648D60BB4E2CA0033D760 /* RetainPtr.h */,
+ 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */,
969A07290ED1CE6900F1F681 /* SegmentedVector.h */,
868BFA5F117D048200B908B1 /* StaticConstructors.h */,
FE1B44790ECCD73B004F4DD1 /* StdLibExtras.h */,
@@ -1604,6 +1621,8 @@
BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */,
BC22A3980E16E14800AF21C8 /* JSObject.cpp */,
BC22A3990E16E14800AF21C8 /* JSObject.h */,
+ A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */,
+ A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */,
A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */,
A7F9935D0FD7325100A0B2D0 /* JSONObject.h */,
A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */,
@@ -1621,10 +1640,8 @@
14F252560D08DD8D004ECFFF /* JSVariableObject.h */,
65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */,
65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */,
- A7C2216B10C7469C00F97913 /* JSZombie.cpp */,
- A7C2216B10C7469C00F97913 /* JSZombie.cpp */,
- A7C2216810C745E000F97913 /* JSZombie.h */,
- A7C2216810C745E000F97913 /* JSZombie.h */,
+ BC01D4EF11A8F1FF00A54B2A /* JSZombie.cpp */,
+ BC01D4F011A8F1FF00A54B2A /* JSZombie.h */,
A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */,
A7E2EA690FB460CF00601F06 /* LiteralParser.h */,
F692A8680255597D01FF60F7 /* Lookup.cpp */,
@@ -1784,12 +1801,15 @@
86E116B00FE75AC800B512BC /* CodeLocation.h */,
86D3B3C110159D7F002865E7 /* LinkBuffer.h */,
86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */,
+ 86C568DD11A213EE0007F7F0 /* MacroAssemblerARM.cpp */,
86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */,
86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */,
863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */,
+ 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */,
860161E00F3A83C100F84710 /* MacroAssemblerX86.h */,
860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */,
860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */,
+ 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */,
86D3B3C210159D7F002865E7 /* RepatchBuffer.h */,
9688CB140ED12B4E001D649F /* X86Assembler.h */,
);
@@ -2136,6 +2156,10 @@
A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */,
A7386556118697B400540279 /* ThunkGenerators.h in Headers */,
869D04AF1193B54D00803475 /* CachedTranscendentalFunction.h in Headers */,
+ 86C568E111A213EE0007F7F0 /* MacroAssemblerMIPS.h in Headers */,
+ 86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */,
+ A783A0D111A36DCA00563D20 /* JSObjectWithGlobalObject.h in Headers */,
+ BC01D4F211A8F1FF00A54B2A /* JSZombie.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2511,7 +2535,6 @@
14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */,
147F39D7107EC37600427A48 /* JSVariableObject.cpp in Sources */,
14280870107EC1340013E7B2 /* JSWrapperObject.cpp in Sources */,
- A7C2217810C7479400F97913 /* JSZombie.cpp in Sources */,
BCFD8C920EEB2EE700283848 /* JumpTable.cpp in Sources */,
148F21B0107EC5410042EC2C /* Lexer.cpp in Sources */,
A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */,
@@ -2578,6 +2601,7 @@
E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
86565742115BE3DA00291F40 /* CString.cpp in Sources */,
A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */,
+ 0BF28A2911A33DC300638F84 /* SizeLimits.cpp in Sources */,
86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */,
868BFA08117CEFD100B908B1 /* AtomicString.cpp in Sources */,
868BFA0E117CEFD100B908B1 /* StringImpl.cpp in Sources */,
@@ -2588,6 +2612,10 @@
A75706DE118A2BCF0057F88F /* JITArithmetic32_64.cpp in Sources */,
8626BECF11928E3900782FAB /* StringStatics.cpp in Sources */,
A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */,
+ 86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */,
+ 146FE51211A710430087AE66 /* JITCall32_64.cpp in Sources */,
+ A783A2AB11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp in Sources */,
+ BC01D4F111A8F1FF00A54B2A /* JSZombie.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp
index 01b06a4..d0132cf 100644
--- a/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -490,11 +490,13 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
break;
}
case op_create_arguments: {
- printf("[%4d] create_arguments\n", location);
+ int r0 = (++it)->u.operand;
+ printf("[%4d] create_arguments\t %s\n", location, registerName(exec, r0).data());
break;
}
case op_init_arguments: {
- printf("[%4d] init_arguments\n", location);
+ int r0 = (++it)->u.operand;
+ printf("[%4d] init_arguments\t %s\n", location, registerName(exec, r0).data());
break;
}
case op_convert_this: {
@@ -1026,27 +1028,24 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
break;
}
case op_call: {
- int dst = (++it)->u.operand;
int func = (++it)->u.operand;
int argCount = (++it)->u.operand;
int registerOffset = (++it)->u.operand;
- printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), argCount, registerOffset);
+ printf("[%4d] call\t\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
break;
}
case op_call_eval: {
- int dst = (++it)->u.operand;
int func = (++it)->u.operand;
int argCount = (++it)->u.operand;
int registerOffset = (++it)->u.operand;
- printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), argCount, registerOffset);
+ printf("[%4d] call_eval\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
break;
}
case op_call_varargs: {
- int dst = (++it)->u.operand;
int func = (++it)->u.operand;
int argCount = (++it)->u.operand;
int registerOffset = (++it)->u.operand;
- printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), registerName(exec, argCount).data(), registerOffset);
+ printf("[%4d] call_varargs\t %s, %s, %d\n", location, registerName(exec, func).data(), registerName(exec, argCount).data(), registerOffset);
break;
}
case op_load_varargs: {
@@ -1055,11 +1054,13 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
}
case op_tear_off_activation: {
int r0 = (++it)->u.operand;
- printf("[%4d] tear_off_activation\t %s\n", location, registerName(exec, r0).data());
+ int r1 = (++it)->u.operand;
+ printf("[%4d] tear_off_activation\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
break;
}
case op_tear_off_arguments: {
- printf("[%4d] tear_off_arguments\n", location);
+ int r0 = (++it)->u.operand;
+ printf("[%4d] tear_off_arguments\t %s\n", location, registerName(exec, r0).data());
break;
}
case op_ret: {
@@ -1067,20 +1068,24 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
printf("[%4d] ret\t\t %s\n", location, registerName(exec, r0).data());
break;
}
+ case op_call_put_result: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] op_call_put_result\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_ret_object_or_this: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] constructor_ret\t\t %s %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
+ break;
+ }
case op_construct: {
- int dst = (++it)->u.operand;
int func = (++it)->u.operand;
int argCount = (++it)->u.operand;
int registerOffset = (++it)->u.operand;
int proto = (++it)->u.operand;
int thisRegister = (++it)->u.operand;
- printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(exec, dst).data(), registerName(exec, func).data(), argCount, registerOffset, registerName(exec, proto).data(), registerName(exec, thisRegister).data());
- break;
- }
- case op_construct_verify: {
- int r0 = (++it)->u.operand;
- int r1 = (++it)->u.operand;
- printf("[%4d] construct_verify\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
+ printf("[%4d] construct\t %s, %d, %d, %s, %s\n", location, registerName(exec, func).data(), argCount, registerOffset, registerName(exec, proto).data(), registerName(exec, thisRegister).data());
break;
}
case op_strcat: {
@@ -1340,9 +1345,9 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassR
#ifndef NDEBUG
, m_instructionCount(0)
#endif
+ , m_argumentsRegister(-1)
, m_needsFullScopeChain(ownerExecutable->needsActivation())
, m_usesEval(ownerExecutable->usesEval())
- , m_usesArguments(false)
, m_isNumericCompareFunction(false)
, m_codeType(codeType)
, m_source(sourceProvider)
diff --git a/JavaScriptCore/bytecode/CodeBlock.h b/JavaScriptCore/bytecode/CodeBlock.h
index 13956df..e5da2b2 100644
--- a/JavaScriptCore/bytecode/CodeBlock.h
+++ b/JavaScriptCore/bytecode/CodeBlock.h
@@ -62,6 +62,8 @@ namespace JSC {
enum CodeType { GlobalCode, EvalCode, FunctionCode };
+ inline int unmodifiedArgumentsRegister(int argumentsRegister) { return argumentsRegister - 1; }
+
static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); }
struct HandlerInfo {
@@ -107,7 +109,7 @@ namespace JSC {
{
}
- unsigned bytecodeIndex;
+ unsigned bytecodeOffset;
CodeLocationNearCall callReturnLocation;
CodeLocationDataLabelPtr hotPathBegin;
CodeLocationNearCall hotPathOther;
@@ -189,15 +191,15 @@ namespace JSC {
// (given as an offset in bytes into the JIT code) back to
// the bytecode index of the corresponding bytecode operation.
// This is then used to look up the corresponding handler.
- struct CallReturnOffsetToBytecodeIndex {
- CallReturnOffsetToBytecodeIndex(unsigned callReturnOffset, unsigned bytecodeIndex)
+ struct CallReturnOffsetToBytecodeOffset {
+ CallReturnOffsetToBytecodeOffset(unsigned callReturnOffset, unsigned bytecodeOffset)
: callReturnOffset(callReturnOffset)
- , bytecodeIndex(bytecodeIndex)
+ , bytecodeOffset(bytecodeOffset)
{
}
unsigned callReturnOffset;
- unsigned bytecodeIndex;
+ unsigned bytecodeOffset;
};
// valueAtPosition helpers for the binaryChop algorithm below.
@@ -217,7 +219,7 @@ namespace JSC {
return methodCallLinkInfo->callReturnLocation.executableAddress();
}
- inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeIndex* pc)
+ inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeOffset* pc)
{
return pc->callReturnOffset;
}
@@ -265,7 +267,7 @@ namespace JSC {
Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo;
#if ENABLE(JIT)
- Vector<CallReturnOffsetToBytecodeIndex> m_callReturnIndexVector;
+ Vector<CallReturnOffsetToBytecodeOffset> m_callReturnIndexVector;
#endif
};
@@ -347,13 +349,18 @@ namespace JSC {
return *(binaryChop<MethodCallLinkInfo, void*, getMethodCallLinkInfoReturnLocation>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress.value()));
}
- unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress)
+ unsigned bytecodeOffset(CallFrame* callFrame, ReturnAddressPtr returnAddress)
{
reparseForExceptionInfoIfNecessary(callFrame);
- return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), getJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
+ return binaryChop<CallReturnOffsetToBytecodeOffset, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), getJITCode().offsetOf(returnAddress.value()))->bytecodeOffset;
}
bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex);
+#else
+ unsigned bytecodeOffset(CallFrame*, Instruction* returnAddress)
+ {
+ return static_cast<Instruction*>(returnAddress) - instructions().begin();
+ }
#endif
void setIsNumericCompareFunction(bool isNumericCompareFunction) { m_isNumericCompareFunction = isNumericCompareFunction; }
@@ -383,8 +390,19 @@ namespace JSC {
bool needsFullScopeChain() const { return m_needsFullScopeChain; }
void setUsesEval(bool usesEval) { m_usesEval = usesEval; }
bool usesEval() const { return m_usesEval; }
- void setUsesArguments(bool usesArguments) { m_usesArguments = usesArguments; }
- bool usesArguments() const { return m_usesArguments; }
+
+ void setArgumentsRegister(int argumentsRegister)
+ {
+ ASSERT(argumentsRegister != -1);
+ m_argumentsRegister = argumentsRegister;
+ ASSERT(usesArguments());
+ }
+ int argumentsRegister()
+ {
+ ASSERT(usesArguments());
+ return m_argumentsRegister;
+ }
+ bool usesArguments() const { return m_argumentsRegister != -1; }
CodeType codeType() const { return m_codeType; }
@@ -437,7 +455,7 @@ namespace JSC {
LineInfo& lastLineInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_lineInfo.last(); }
#if ENABLE(JIT)
- Vector<CallReturnOffsetToBytecodeIndex>& callReturnIndexVector() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_callReturnIndexVector; }
+ Vector<CallReturnOffsetToBytecodeOffset>& callReturnIndexVector() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_callReturnIndexVector; }
#endif
// Constant Pool
@@ -520,10 +538,10 @@ namespace JSC {
#endif
int m_thisRegister;
+ int m_argumentsRegister;
bool m_needsFullScopeChain;
bool m_usesEval;
- bool m_usesArguments;
bool m_isNumericCompareFunction;
CodeType m_codeType;
diff --git a/JavaScriptCore/bytecode/Opcode.h b/JavaScriptCore/bytecode/Opcode.h
index db54782..30472d5 100644
--- a/JavaScriptCore/bytecode/Opcode.h
+++ b/JavaScriptCore/bytecode/Opcode.h
@@ -40,8 +40,8 @@ namespace JSC {
#define FOR_EACH_OPCODE_ID(macro) \
macro(op_enter, 1) \
macro(op_enter_with_activation, 2) \
- macro(op_init_arguments, 1) \
- macro(op_create_arguments, 1) \
+ macro(op_init_arguments, 2) \
+ macro(op_create_arguments, 2) \
macro(op_convert_this, 2) \
\
macro(op_new_object, 2) \
@@ -153,17 +153,18 @@ namespace JSC {
\
macro(op_new_func, 3) \
macro(op_new_func_exp, 3) \
- macro(op_call, 5) \
- macro(op_call_eval, 5) \
- macro(op_call_varargs, 5) \
+ macro(op_call, 4) \
+ macro(op_call_eval, 4) \
+ macro(op_call_varargs, 4) \
macro(op_load_varargs, 3) \
- macro(op_tear_off_activation, 2) \
- macro(op_tear_off_arguments, 1) \
+ macro(op_tear_off_activation, 3) \
+ macro(op_tear_off_arguments, 2) \
macro(op_ret, 2) \
+ macro(op_call_put_result, 2) \
+ macro(op_ret_object_or_this, 3) \
macro(op_method_check, 1) \
\
- macro(op_construct, 7) \
- macro(op_construct_verify, 3) \
+ macro(op_construct, 6) \
macro(op_strcat, 4) \
macro(op_to_primitive, 3) \
\
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index e5f3d15..cdf87d2 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -174,8 +174,7 @@ bool BytecodeGenerator::addVar(const Identifier& ident, bool isConstant, Registe
return false;
}
- ++m_codeBlock->m_numVars;
- r0 = newRegister();
+ r0 = addVar();
return true;
}
@@ -295,6 +294,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
, m_symbolTable(symbolTable)
, m_scopeNode(functionBody)
, m_codeBlock(codeBlock)
+ , m_activationRegister(0)
, m_finallyDepth(0)
, m_dynamicScopeDepth(0)
, m_baseScopeDepth(0)
@@ -312,29 +312,35 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
codeBlock->setGlobalData(m_globalData);
- bool usesArguments = functionBody->usesArguments();
- codeBlock->setUsesArguments(usesArguments);
- if (usesArguments) {
- m_argumentsRegister.setIndex(RegisterFile::OptionalCalleeArguments);
- addVar(propertyNames().arguments, false);
- }
-
if (m_codeBlock->needsFullScopeChain()) {
- ++m_codeBlock->m_numVars;
- m_activationRegisterIndex = newRegister()->index();
+ m_activationRegister = addVar();
emitOpcode(op_enter_with_activation);
- instructions().append(m_activationRegisterIndex);
+ instructions().append(m_activationRegister->index());
} else
emitOpcode(op_enter);
- if (usesArguments) {
+ // Both op_tear_off_activation and op_tear_off_arguments tear off the 'arguments'
+ // object, if created.
+ if (m_codeBlock->needsFullScopeChain() || functionBody->usesArguments()) {
+ RegisterID* unmodifiedArgumentsRegister = addVar(); // Anonymous, so it can't be modified by user code.
+ RegisterID* argumentsRegister = addVar(propertyNames().arguments, false); // Can be changed by assigning to 'arguments'.
+
+ // We can save a little space by hard-coding the knowledge that the two
+ // 'arguments' values are stored in consecutive registers, and storing
+ // only the index of the assignable one.
+ codeBlock->setArgumentsRegister(argumentsRegister->index());
+ ASSERT_UNUSED(unmodifiedArgumentsRegister, unmodifiedArgumentsRegister->index() == JSC::unmodifiedArgumentsRegister(codeBlock->argumentsRegister()));
+
emitOpcode(op_init_arguments);
+ instructions().append(argumentsRegister->index());
// The debugger currently retrieves the arguments object from an activation rather than pulling
// it from a call frame. In the long-term it should stop doing that (<rdar://problem/6911886>),
// but for now we force eager creation of the arguments object when debugging.
- if (m_shouldEmitDebugHooks)
+ if (m_shouldEmitDebugHooks) {
emitOpcode(op_create_arguments);
+ instructions().append(argumentsRegister->index());
+ }
}
const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack();
@@ -359,7 +365,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
++m_nextParameterIndex;
++m_codeBlock->m_numParameters;
- if (functionBody->usesThis() || m_shouldEmitDebugHooks) {
+ if (!isConstructor() && (functionBody->usesThis() || m_shouldEmitDebugHooks)) {
emitOpcode(op_convert_this);
instructions().append(m_thisRegister.index());
}
@@ -1025,7 +1031,7 @@ bool BytecodeGenerator::findScopedProperty(const Identifier& property, int& inde
globalObject = currentVariableObject;
return false;
}
- stackDepth = depth;
+ stackDepth = depth + m_codeBlock->needsFullScopeChain();
index = entry.getIndex();
if (++iter == end)
globalObject = currentVariableObject;
@@ -1037,7 +1043,7 @@ bool BytecodeGenerator::findScopedProperty(const Identifier& property, int& inde
requiresDynamicChecks |= scopeRequiresDynamicChecks;
}
// Can't locate the property but we're able to avoid a few lookups.
- stackDepth = depth;
+ stackDepth = depth + m_codeBlock->needsFullScopeChain();
index = missingSymbolMarker();
JSObject* scope = *iter;
if (++iter == end)
@@ -1385,7 +1391,6 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp)
return dst;
}
-
RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n)
{
FunctionBodyNode* function = n->body();
@@ -1404,13 +1409,16 @@ RegisterID* BytecodeGenerator::emitCall(RegisterID* dst, RegisterID* func, Regis
void BytecodeGenerator::createArgumentsIfNecessary()
{
- if (m_codeBlock->usesArguments() && m_codeType == FunctionCode)
- emitOpcode(op_create_arguments);
+ if (m_codeType != FunctionCode)
+ return;
+ ASSERT(m_codeBlock->usesArguments());
+
+ emitOpcode(op_create_arguments);
+ instructions().append(m_codeBlock->argumentsRegister());
}
RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
{
- createArgumentsIfNecessary();
return emitCall(op_call_eval, dst, func, thisRegister, argumentsNode, divot, startOffset, endOffset);
}
@@ -1466,10 +1474,13 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi
// Emit call.
emitOpcode(opcodeID);
- instructions().append(dst->index()); // dst
instructions().append(func->index()); // func
instructions().append(argv.size()); // argCount
instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset
+ if (dst != ignoredResult()) {
+ emitOpcode(op_call_put_result);
+ instructions().append(dst->index()); // dst
+ }
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_did_call);
@@ -1511,10 +1522,13 @@ RegisterID* BytecodeGenerator::emitCallVarargs(RegisterID* dst, RegisterID* func
// Emit call.
emitOpcode(op_call_varargs);
- instructions().append(dst->index()); // dst
instructions().append(func->index()); // func
instructions().append(argCountRegister->index()); // arg count
instructions().append(thisRegister->index() + RegisterFile::CallFrameHeaderSize); // initial registerOffset
+ if (dst != ignoredResult()) {
+ emitOpcode(op_call_put_result);
+ instructions().append(dst->index()); // dst
+ }
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_did_call);
instructions().append(func->index());
@@ -1526,10 +1540,22 @@ RegisterID* BytecodeGenerator::emitReturn(RegisterID* src)
{
if (m_codeBlock->needsFullScopeChain()) {
emitOpcode(op_tear_off_activation);
- instructions().append(m_activationRegisterIndex);
- } else if (m_codeBlock->usesArguments() && m_codeBlock->m_numParameters > 1)
+ instructions().append(m_activationRegister->index());
+ instructions().append(m_codeBlock->argumentsRegister());
+ } else if (m_codeBlock->usesArguments() && m_codeBlock->m_numParameters > 1) { // If there are no named parameters, there's nothing to tear off, since extra / unnamed parameters get copied to the arguments object at construct time.
emitOpcode(op_tear_off_arguments);
+ instructions().append(m_codeBlock->argumentsRegister());
+ }
+ // Constructors use op_ret_object_or_this to check the result is an
+ // object, unless we can trivially determine the check is not
+ // necessary (currently, if the return value is 'this').
+ if (isConstructor() && (src->index() != m_thisRegister.index())) {
+ emitOpcode(op_ret_object_or_this);
+ instructions().append(src->index());
+ instructions().append(m_thisRegister.index());
+ return src;
+ }
return emitUnaryNoDstOp(op_ret, src);
}
@@ -1589,16 +1615,15 @@ RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func,
#endif
emitOpcode(op_construct);
- instructions().append(dst->index()); // dst
instructions().append(func->index()); // func
instructions().append(argv.size()); // argCount
instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset
instructions().append(funcProto->index()); // proto
instructions().append(argv[0]->index()); // thisRegister
-
- emitOpcode(op_construct_verify);
- instructions().append(dst->index());
- instructions().append(argv[0]->index());
+ if (dst != ignoredResult()) {
+ emitOpcode(op_call_put_result);
+ instructions().append(dst->index()); // dst
+ }
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_did_call);
@@ -1635,7 +1660,6 @@ RegisterID* BytecodeGenerator::emitPushScope(RegisterID* scope)
context.isFinallyBlock = false;
m_scopeContextStack.append(context);
m_dynamicScopeDepth++;
- createArgumentsIfNecessary();
return emitUnaryNoDstOp(op_push_scope, scope);
}
@@ -1899,8 +1923,6 @@ void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& prop
context.isFinallyBlock = false;
m_scopeContextStack.append(context);
m_dynamicScopeDepth++;
-
- createArgumentsIfNecessary();
emitOpcode(op_push_new_scope);
instructions().append(dst->index());
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
index 0a49392..7626bf4 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -83,6 +83,8 @@ namespace JSC {
JSGlobalData* globalData() const { return m_globalData; }
const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; }
+ bool isConstructor() { return m_codeBlock->m_isConstructor; }
+
void generate();
// Returns the register corresponding to a local variable, or 0 if no
@@ -103,9 +105,6 @@ namespace JSC {
// VariableObject that defines the property. If the property cannot be found
// statically, depth will contain the depth of the scope chain where dynamic
// lookup must begin.
- //
- // NB: depth does _not_ include the local scope. eg. a depth of 0 refers
- // to the scope containing this codeblock.
bool findScopedProperty(const Identifier&, int& index, size_t& depth, bool forWriting, bool& includesDynamicScopes, JSObject*& globalObject);
// Returns the register storing "this"
@@ -150,6 +149,17 @@ namespace JSC {
return newTemporary();
}
+ // Returns the place to write the final output of an operation.
+ RegisterID* finalDestinationOrIgnored(RegisterID* originalDst, RegisterID* tempDst = 0)
+ {
+ if (originalDst)
+ return originalDst;
+ ASSERT(tempDst != ignoredResult());
+ if (tempDst && tempDst->isTemporary())
+ return tempDst;
+ return newTemporary();
+ }
+
RegisterID* destinationForAssignResult(RegisterID* dst)
{
if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain())
@@ -404,15 +414,23 @@ namespace JSC {
RegisterID* newRegister();
- // Returns the RegisterID corresponding to ident.
+ // Adds a var slot and maps it to the name ident in symbolTable().
RegisterID* addVar(const Identifier& ident, bool isConstant)
{
RegisterID* local;
addVar(ident, isConstant, local);
return local;
}
- // Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
+
+ // Ditto. Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
bool addVar(const Identifier&, bool isConstant, RegisterID*&);
+
+ // Adds an anonymous var slot. To give this slot a name, add it to symbolTable().
+ RegisterID* addVar()
+ {
+ ++m_codeBlock->m_numVars;
+ return newRegister();
+ }
// Returns the RegisterID corresponding to ident.
RegisterID* addGlobalVar(const Identifier& ident, bool isConstant)
@@ -433,9 +451,6 @@ namespace JSC {
if (index >= 0)
return m_calleeRegisters[index];
- if (index == RegisterFile::OptionalCalleeArguments)
- return m_argumentsRegister;
-
if (m_parameters.size()) {
ASSERT(!m_globals.size());
return m_parameters[index + m_parameters.size() + RegisterFile::CallFrameHeaderSize];
@@ -482,8 +497,7 @@ namespace JSC {
HashSet<RefPtr<UString::Rep>, IdentifierRepHash> m_functions;
RegisterID m_ignoredResultRegister;
RegisterID m_thisRegister;
- RegisterID m_argumentsRegister;
- int m_activationRegisterIndex;
+ RegisterID* m_activationRegister;
SegmentedVector<RegisterID, 32> m_constantPoolRegisters;
SegmentedVector<RegisterID, 32> m_calleeRegisters;
SegmentedVector<RegisterID, 32> m_parameters;
diff --git a/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/JavaScriptCore/bytecompiler/NodesCodegen.cpp
index cfd00da..c514b7a 100644
--- a/JavaScriptCore/bytecompiler/NodesCodegen.cpp
+++ b/JavaScriptCore/bytecompiler/NodesCodegen.cpp
@@ -316,7 +316,7 @@ RegisterID* ArgumentListNode::emitBytecode(BytecodeGenerator& generator, Registe
RegisterID* NewExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
RefPtr<RegisterID> func = generator.emitNode(m_expr);
- return generator.emitConstruct(generator.finalDestination(dst), func.get(), m_args, divot(), startOffset(), endOffset());
+ return generator.emitConstruct(generator.finalDestinationOrIgnored(dst), func.get(), m_args, divot(), startOffset(), endOffset());
}
// ------------------------------ EvalFunctionCallNode ----------------------------------
@@ -336,7 +336,7 @@ RegisterID* FunctionCallValueNode::emitBytecode(BytecodeGenerator& generator, Re
{
RefPtr<RegisterID> func = generator.emitNode(m_expr);
RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
// ------------------------------ FunctionCallResolveNode ----------------------------------
@@ -345,7 +345,7 @@ RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator,
{
if (RefPtr<RegisterID> local = generator.registerFor(m_ident)) {
RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestination(dst, thisRegister.get()), local.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, thisRegister.get()), local.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
int index = 0;
@@ -355,7 +355,7 @@ RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator,
if (generator.findScopedProperty(m_ident, index, depth, false, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) {
RefPtr<RegisterID> func = generator.emitGetScopedVar(generator.newTemporary(), depth, index, globalObject);
RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
RefPtr<RegisterID> func = generator.newTemporary();
@@ -363,7 +363,7 @@ RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator,
int identifierStart = divot() - startOffset();
generator.emitExpressionInfo(identifierStart + m_ident.size(), m_ident.size(), 0);
generator.emitResolveWithBase(thisRegister.get(), func.get(), m_ident);
- return generator.emitCall(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
// ------------------------------ FunctionCallBracketNode ----------------------------------
@@ -375,7 +375,7 @@ RegisterID* FunctionCallBracketNode::emitBytecode(BytecodeGenerator& generator,
generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
RefPtr<RegisterID> function = generator.emitGetByVal(generator.tempDestination(dst), base.get(), property);
RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- return generator.emitCall(generator.finalDestination(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
// ------------------------------ FunctionCallDotNode ----------------------------------
@@ -388,7 +388,7 @@ RegisterID* FunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, Regi
generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
generator.emitMethodCheck();
generator.emitGetById(function.get(), thisRegister.get(), m_ident);
- return generator.emitCall(generator.finalDestination(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
@@ -398,7 +398,7 @@ RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
RefPtr<RegisterID> base = generator.emitNode(m_base);
generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
RefPtr<RegisterID> function = generator.emitGetById(generator.tempDestination(dst), base.get(), m_ident);
- RefPtr<RegisterID> finalDestination = generator.finalDestination(dst, function.get());
+ RefPtr<RegisterID> finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get());
generator.emitJumpIfNotFunctionCall(function.get(), realCall.get());
{
RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
@@ -410,17 +410,17 @@ RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
} else
generator.emitLoad(thisRegister.get(), jsNull());
- generator.emitCall(finalDestination.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
generator.emitJump(end.get());
m_args->m_listNode = oldList;
}
generator.emitLabel(realCall.get());
{
RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- generator.emitCall(finalDestination.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ generator.emitCall(finalDestinationOrIgnored.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
generator.emitLabel(end.get());
- return finalDestination.get();
+ return finalDestinationOrIgnored.get();
}
static bool areTrivialApplyArguments(ArgumentsNode* args)
@@ -441,7 +441,7 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
RefPtr<RegisterID> base = generator.emitNode(m_base);
generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
RefPtr<RegisterID> function = generator.emitGetById(generator.tempDestination(dst), base.get(), m_ident);
- RefPtr<RegisterID> finalDestination = generator.finalDestination(dst, function.get());
+ RefPtr<RegisterID> finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get());
generator.emitJumpIfNotFunctionApply(function.get(), realCall.get());
{
if (mayBeCall) {
@@ -458,7 +458,7 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
}
} else
generator.emitLoad(thisRegister.get(), jsNull());
- generator.emitCall(finalDestination.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
m_args->m_listNode = oldList;
} else {
ASSERT(m_args->m_listNode && m_args->m_listNode->m_next);
@@ -481,17 +481,17 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
generator.emitNode(args->m_expr);
generator.emitLoadVarargs(argsCountRegister.get(), argsRegister.get());
- generator.emitCallVarargs(finalDestination.get(), realFunction.get(), thisRegister.get(), argsCountRegister.get(), divot(), startOffset(), endOffset());
+ generator.emitCallVarargs(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), argsCountRegister.get(), divot(), startOffset(), endOffset());
}
generator.emitJump(end.get());
}
generator.emitLabel(realCall.get());
{
RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- generator.emitCall(finalDestination.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ generator.emitCall(finalDestinationOrIgnored.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
}
generator.emitLabel(end.get());
- return finalDestination.get();
+ return finalDestinationOrIgnored.get();
}
// ------------------------------ PostfixResolveNode ----------------------------------
@@ -1979,7 +1979,7 @@ RegisterID* FunctionBodyNode::emitBytecode(BytecodeGenerator& generator, Registe
return 0;
}
- RegisterID* r0 = generator.emitLoad(0, jsUndefined());
+ RegisterID* r0 = generator.isConstructor() ? generator.thisRegister() : generator.emitLoad(0, jsUndefined());
generator.emitDebugHook(WillLeaveCallFrame, firstLine(), lastLine());
generator.emitReturn(r0);
return 0;
diff --git a/JavaScriptCore/interpreter/CallFrame.h b/JavaScriptCore/interpreter/CallFrame.h
index e3ea689..a875119 100644
--- a/JavaScriptCore/interpreter/CallFrame.h
+++ b/JavaScriptCore/interpreter/CallFrame.h
@@ -24,6 +24,7 @@
#define CallFrame_h
#include "JSGlobalData.h"
+#include "MacroAssemblerCodeRef.h"
#include "RegisterFile.h"
#include "ScopeChain.h"
@@ -107,15 +108,17 @@ namespace JSC {
CallFrame& operator=(const Register& r) { *static_cast<Register*>(this) = r; return *this; }
CallFrame* callerFrame() const { return this[RegisterFile::CallerFrame].callFrame(); }
- Arguments* optionalCalleeArguments() const { return this[RegisterFile::OptionalCalleeArguments].arguments(); }
+#if ENABLE(JIT)
+ ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[RegisterFile::ReturnPC].vPC()); }
+#else
Instruction* returnPC() const { return this[RegisterFile::ReturnPC].vPC(); }
+#endif
- void setCalleeArguments(JSValue arguments) { static_cast<Register*>(this)[RegisterFile::OptionalCalleeArguments] = arguments; }
void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[RegisterFile::CallerFrame] = callerFrame; }
void setScopeChain(ScopeChainNode* scopeChain) { static_cast<Register*>(this)[RegisterFile::ScopeChain] = scopeChain; }
ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain,
- CallFrame* callerFrame, int returnValueRegister, int argc, JSFunction* function)
+ CallFrame* callerFrame, int, int argc, JSFunction* function)
{
ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
@@ -123,17 +126,14 @@ namespace JSC {
setScopeChain(scopeChain);
setCallerFrame(callerFrame);
static_cast<Register*>(this)[RegisterFile::ReturnPC] = vPC; // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
- static_cast<Register*>(this)[RegisterFile::ReturnValueRegister] = Register::withInt(returnValueRegister);
setArgumentCount(argc); // original argument count (for the sake of the "arguments" object)
setCallee(function);
- setCalleeArguments(JSValue());
}
// Read a register from the codeframe (or constant from the CodeBlock).
inline Register& r(int);
static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }
- int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); }
bool hasHostCallFrameFlag() const { return reinterpret_cast<intptr_t>(this) & HostCallFrameFlag; }
CallFrame* addHostCallFrameFlag() const { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) | HostCallFrameFlag); }
diff --git a/JavaScriptCore/interpreter/CallFrameClosure.h b/JavaScriptCore/interpreter/CallFrameClosure.h
index a301060..b4b7efd 100644
--- a/JavaScriptCore/interpreter/CallFrameClosure.h
+++ b/JavaScriptCore/interpreter/CallFrameClosure.h
@@ -46,10 +46,10 @@ struct CallFrameClosure {
else
newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams - providedParams] = value;
}
+
void resetCallFrame()
{
newCallFrame->setScopeChain(scopeChain);
- newCallFrame->setCalleeArguments(JSValue());
for (int i = providedParams; i < expectedParams; ++i)
newCallFrame[i - RegisterFile::CallFrameHeaderSize - expectedParams] = jsUndefined();
}
diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp
index 7548cf9..1fbc9b7 100644
--- a/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/JavaScriptCore/interpreter/Interpreter.cpp
@@ -71,16 +71,6 @@ using namespace std;
namespace JSC {
-static ALWAYS_INLINE unsigned bytecodeOffsetForPC(CallFrame* callFrame, CodeBlock* codeBlock, void* pc)
-{
-#if ENABLE(JIT)
- return codeBlock->getBytecodeIndex(callFrame, ReturnAddressPtr(pc));
-#else
- UNUSED_PARAM(callFrame);
- return static_cast<Instruction*>(pc) - codeBlock->instructions().begin();
-#endif
-}
-
// Returns the depth of the scope chain within a given call frame.
static int depth(CodeBlock* codeBlock, ScopeChain& sc)
{
@@ -89,7 +79,7 @@ static int depth(CodeBlock* codeBlock, ScopeChain& sc)
return sc.localDepth();
}
-#if USE(INTERPRETER)
+#if !ENABLE(JIT)
NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
{
int dst = vPC[1].u.operand;
@@ -124,7 +114,7 @@ NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vP
int dst = vPC[1].u.operand;
int property = vPC[2].u.operand;
- int skip = vPC[3].u.operand + codeBlock->needsFullScopeChain();
+ int skip = vPC[3].u.operand;
ScopeChainNode* scopeChain = callFrame->scopeChain();
ScopeChainIterator iter = scopeChain->begin();
@@ -200,7 +190,7 @@ NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instru
Structure* structure = vPC[4].u.structure;
int offset = vPC[5].u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
- int skip = vPC[6].u.operand + codeBlock->needsFullScopeChain();
+ int skip = vPC[6].u.operand;
ScopeChainNode* scopeChain = callFrame->scopeChain();
ScopeChainIterator iter = scopeChain->begin();
@@ -304,7 +294,7 @@ NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Inst
return false;
}
-#endif // USE(INTERPRETER)
+#endif // !ENABLE(JIT)
ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newCodeBlock, RegisterFile* registerFile, CallFrame* callFrame, size_t registerOffset, int argc)
{
@@ -343,7 +333,7 @@ ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newC
return CallFrame::create(r);
}
-#if USE(INTERPRETER)
+#if !ENABLE(JIT)
static NEVER_INLINE bool isInvalidParamForIn(CallFrame* callFrame, CodeBlock* codeBlock, const Instruction* vPC, JSValue value, JSValue& exceptionData)
{
if (value.isObject())
@@ -372,6 +362,8 @@ NEVER_INLINE JSValue Interpreter::callEval(CallFrame* callFrame, RegisterFile* r
return program;
UString programSource = asString(program)->value(callFrame);
+ if (callFrame->hadException())
+ return JSValue();
LiteralParser preparser(callFrame, programSource, LiteralParser::NonStrictJSON);
if (JSValue parsedObject = preparser.tryLiteralParse())
@@ -464,10 +456,9 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
printf("[ScopeChain] | %10p | %p \n", it, (*it).scopeChain()); ++it;
printf("[CallerRegisters] | %10p | %d \n", it, (*it).i()); ++it;
printf("[ReturnPC] | %10p | %p \n", it, (*it).vPC()); ++it;
- printf("[ReturnValueRegister] | %10p | %d \n", it, (*it).i()); ++it;
+ ++it;
printf("[ArgumentCount] | %10p | %d \n", it, (*it).i()); ++it;
printf("[Callee] | %10p | %p \n", it, (*it).function()); ++it;
- printf("[OptionalCalleeArguments] | %10p | %p \n", it, (*it).arguments()); ++it;
printf("-----------------------------------------------------------------------------\n");
int registerCount = 0;
@@ -540,22 +531,25 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue ex
if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
while (!scopeChain->object->inherits(&JSActivation::info))
scopeChain = scopeChain->pop();
- static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments());
- } else if (Arguments* arguments = callFrame->optionalCalleeArguments()) {
- if (!arguments->isTornOff())
- arguments->copyRegisters();
+ JSActivation* activation = asActivation(scopeChain->object);
+ activation->copyRegisters();
+ if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue())
+ asArguments(arguments)->setActivation(activation);
+ } else if (oldCodeBlock->usesArguments()) {
+ if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue())
+ asArguments(arguments)->copyRegisters();
}
if (oldCodeBlock->needsFullScopeChain())
scopeChain->deref();
- void* returnPC = callFrame->returnPC();
- callFrame = callFrame->callerFrame();
- if (callFrame->hasHostCallFrameFlag())
+ CallFrame* callerFrame = callFrame->callerFrame();
+ if (callerFrame->hasHostCallFrameFlag())
return false;
- codeBlock = callFrame->codeBlock();
- bytecodeOffset = bytecodeOffsetForPC(callFrame, codeBlock, returnPC);
+ codeBlock = callerFrame->codeBlock();
+ bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
+ callFrame = callerFrame;
return true;
}
@@ -614,10 +608,11 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
// we'll never reach the relevant op_profile_did_call.
if (Profiler* profiler = *Profiler::enabledProfilerReference()) {
#if !ENABLE(JIT)
+ // FIXME: Why 8? - work out what this magic value is, replace the constant with something more helpful.
if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode))
- profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 2].u.operand).jsValue());
+ profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 1].u.operand).jsValue());
else if (codeBlock->instructions().size() > (bytecodeOffset + 8) && codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct))
- profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 10].u.operand).jsValue());
+ profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 9].u.operand).jsValue());
#else
int functionRegisterIndex;
if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex))
@@ -1020,7 +1015,7 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHook
}
}
-#if USE(INTERPRETER)
+#if !ENABLE(JIT)
NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFrame, const Instruction* vPC)
{
int dst = vPC[1].u.operand;
@@ -1256,7 +1251,7 @@ NEVER_INLINE void Interpreter::uncacheGetByID(CodeBlock* codeBlock, Instruction*
vPC[4] = 0;
}
-#endif // USE(INTERPRETER)
+#endif // !ENABLE(JIT)
JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, CallFrame* callFrame, JSValue* exception)
{
@@ -1277,7 +1272,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
// Mixing Interpreter + JIT is not supported.
ASSERT_NOT_REACHED();
#endif
-#if !USE(INTERPRETER)
+#if !!ENABLE(JIT)
UNUSED_PARAM(registerFile);
UNUSED_PARAM(callFrame);
UNUSED_PARAM(exception);
@@ -1288,9 +1283,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSValue exceptionValue;
HandlerInfo* handler = 0;
- Instruction* vPC = callFrame->codeBlock()->instructions().begin();
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ Instruction* vPC = codeBlock->instructions().begin();
Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
unsigned tickCount = globalData->timeoutChecker.ticksUntilNextCheck();
+ JSValue functionReturnValue;
#define CHECK_FOR_EXCEPTION() \
do { \
@@ -1320,7 +1317,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#endif
#if HAVE(COMPUTED_GOTO)
- #define NEXT_INSTRUCTION() SAMPLE(callFrame->codeBlock(), vPC); goto *vPC->u.opcode
+ #define NEXT_INSTRUCTION() SAMPLE(codeBlock, vPC); goto *vPC->u.opcode
#if ENABLE(OPCODE_STATS)
#define DEFINE_OPCODE(opcode) opcode: OpcodeStats::recordInstruction(opcode);
#else
@@ -1328,7 +1325,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#endif
NEXT_INSTRUCTION();
#else
- #define NEXT_INSTRUCTION() SAMPLE(callFrame->codeBlock(), vPC); goto interpreterLoopStart
+ #define NEXT_INSTRUCTION() SAMPLE(codeBlock, vPC); goto interpreterLoopStart
#if ENABLE(OPCODE_STATS)
#define DEFINE_OPCODE(opcode) case opcode: OpcodeStats::recordInstruction(opcode);
#else
@@ -1377,7 +1374,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = vPC[1].u.operand;
int regExp = vPC[2].u.operand;
- callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject->regExpStructure(), callFrame->codeBlock()->regexp(regExp)));
+ callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->lexicalGlobalObject(), callFrame->scopeChain()->globalObject->regExpStructure(), codeBlock->regexp(regExp)));
vPC += OPCODE_LENGTH(op_new_regexp);
NEXT_INSTRUCTION();
@@ -1484,7 +1481,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = vPC[1].u.operand;
JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
- callFrame->r(dst) = jsBoolean(JSValue::strictEqual(callFrame, src1, src2));
+ bool result = JSValue::strictEqual(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+ callFrame->r(dst) = jsBoolean(result);
vPC += OPCODE_LENGTH(op_stricteq);
NEXT_INSTRUCTION();
@@ -1499,7 +1498,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = vPC[1].u.operand;
JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
- callFrame->r(dst) = jsBoolean(!JSValue::strictEqual(callFrame, src1, src2));
+ bool result = !JSValue::strictEqual(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+ callFrame->r(dst) = jsBoolean(result);
vPC += OPCODE_LENGTH(op_nstricteq);
NEXT_INSTRUCTION();
@@ -1951,7 +1952,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSValue baseVal = callFrame->r(base).jsValue();
- if (isInvalidParamForInstanceOf(callFrame, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
+ if (isInvalidParamForInstanceOf(callFrame, codeBlock, vPC, baseVal, exceptionValue))
goto vm_throw;
bool result = asObject(baseVal)->hasInstance(callFrame, callFrame->r(value).jsValue(), callFrame->r(baseProto).jsValue());
@@ -2073,7 +2074,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int base = vPC[3].u.operand;
JSValue baseVal = callFrame->r(base).jsValue();
- if (isInvalidParamForIn(callFrame, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
+ if (isInvalidParamForIn(callFrame, codeBlock, vPC, baseVal, exceptionValue))
goto vm_throw;
JSObject* baseObj = asObject(baseVal);
@@ -2184,11 +2185,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
/* get_scoped_var dst(r) index(n) skip(n)
Loads the contents of the index-th local from the scope skip nodes from
- the top of the scope chain, and places it in register dst
+ the top of the scope chain, and places it in register dst.
*/
int dst = vPC[1].u.operand;
int index = vPC[2].u.operand;
- int skip = vPC[3].u.operand + callFrame->codeBlock()->needsFullScopeChain();
+ int skip = vPC[3].u.operand;
ScopeChainNode* scopeChain = callFrame->scopeChain();
ScopeChainIterator iter = scopeChain->begin();
@@ -2209,7 +2210,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int index = vPC[1].u.operand;
- int skip = vPC[2].u.operand + callFrame->codeBlock()->needsFullScopeChain();
+ int skip = vPC[2].u.operand;
int value = vPC[3].u.operand;
ScopeChainNode* scopeChain = callFrame->scopeChain();
@@ -2268,7 +2269,6 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int base = vPC[2].u.operand;
int property = vPC[3].u.operand;
- CodeBlock* codeBlock = callFrame->codeBlock();
Identifier& ident = codeBlock->identifier(property);
JSValue baseValue = callFrame->r(base).jsValue();
PropertySlot slot(baseValue);
@@ -2301,7 +2301,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = vPC[1].u.operand;
int offset = vPC[5].u.operand;
- ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
+ ASSERT(baseObject->get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
callFrame->r(dst) = JSValue(baseObject->getDirectOffset(offset));
vPC += OPCODE_LENGTH(op_get_by_id_self);
@@ -2309,7 +2309,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_get_by_id_proto) {
@@ -2335,8 +2335,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = vPC[1].u.operand;
int offset = vPC[6].u.operand;
- ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
- ASSERT(baseValue.get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
+ ASSERT(protoObject->get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
+ ASSERT(baseValue.get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
callFrame->r(dst) = JSValue(protoObject->getDirectOffset(offset));
vPC += OPCODE_LENGTH(op_get_by_id_proto);
@@ -2345,7 +2345,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2387,7 +2387,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2418,7 +2418,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (LIKELY(protoObject->structure() == prototypeStructure)) {
int dst = vPC[1].u.operand;
int property = vPC[3].u.operand;
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
PropertySlot::GetValueFunc getter = vPC[6].u.getterFunc;
JSValue result = getter(callFrame, protoObject, ident);
@@ -2429,7 +2429,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2506,8 +2506,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int dst = vPC[1].u.operand;
int offset = vPC[7].u.operand;
- ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- ASSERT(baseValue.get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
+ ASSERT(baseObject->get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
+ ASSERT(baseValue.get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
callFrame->r(dst) = JSValue(baseObject->getDirectOffset(offset));
vPC += OPCODE_LENGTH(op_get_by_id_chain);
@@ -2520,7 +2520,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2560,7 +2560,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
NEXT_INSTRUCTION();
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2587,7 +2587,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ASSERT(baseCell->isObject());
int dst = vPC[1].u.operand;
int property = vPC[3].u.operand;
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
PropertySlot::GetValueFunc getter = vPC[5].u.getterFunc;
JSValue result = getter(callFrame, baseValue, ident);
@@ -2597,7 +2597,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
NEXT_INSTRUCTION();
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2613,7 +2613,7 @@ skip_id_custom_self:
int base = vPC[2].u.operand;
int property = vPC[3].u.operand;
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
JSValue baseValue = callFrame->r(base).jsValue();
PropertySlot slot(baseValue);
JSValue result = baseValue.get(callFrame, ident, slot);
@@ -2672,7 +2672,7 @@ skip_id_custom_self:
}
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2709,7 +2709,7 @@ skip_id_custom_self:
if (++it == end) {
int dst = vPC[1].u.operand;
int property = vPC[3].u.operand;
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
PropertySlot::GetValueFunc getter = vPC[7].u.getterFunc;
JSValue result = getter(callFrame, baseObject, ident);
@@ -2724,7 +2724,7 @@ skip_id_custom_self:
}
}
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
@@ -2747,7 +2747,7 @@ skip_id_custom_self:
NEXT_INSTRUCTION();
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_get_string_length) {
@@ -2767,7 +2767,7 @@ skip_id_custom_self:
NEXT_INSTRUCTION();
}
- uncacheGetByID(callFrame->codeBlock(), vPC);
+ uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_put_by_id) {
@@ -2784,7 +2784,6 @@ skip_id_custom_self:
int property = vPC[2].u.operand;
int value = vPC[3].u.operand;
- CodeBlock* codeBlock = callFrame->codeBlock();
JSValue baseValue = callFrame->r(base).jsValue();
Identifier& ident = codeBlock->identifier(property);
PutPropertySlot slot;
@@ -2824,7 +2823,7 @@ skip_id_custom_self:
JSValue proto = baseObject->structure()->prototypeForLookup(callFrame);
while (!proto.isNull()) {
if (UNLIKELY(asObject(proto)->structure() != (*it).get())) {
- uncachePutByID(callFrame->codeBlock(), vPC);
+ uncachePutByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
++it;
@@ -2835,7 +2834,7 @@ skip_id_custom_self:
int value = vPC[3].u.operand;
unsigned offset = vPC[7].u.operand;
- ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
+ ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset);
baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
vPC += OPCODE_LENGTH(op_put_by_id_transition);
@@ -2843,7 +2842,7 @@ skip_id_custom_self:
}
}
- uncachePutByID(callFrame->codeBlock(), vPC);
+ uncachePutByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_put_by_id_replace) {
@@ -2870,7 +2869,7 @@ skip_id_custom_self:
int value = vPC[3].u.operand;
unsigned offset = vPC[5].u.operand;
- ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
+ ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset);
baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
vPC += OPCODE_LENGTH(op_put_by_id_replace);
@@ -2878,7 +2877,7 @@ skip_id_custom_self:
}
}
- uncachePutByID(callFrame->codeBlock(), vPC);
+ uncachePutByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_put_by_id_generic) {
@@ -2895,7 +2894,7 @@ skip_id_custom_self:
int value = vPC[3].u.operand;
JSValue baseValue = callFrame->r(base).jsValue();
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
PutPropertySlot slot;
baseValue.put(callFrame, ident, callFrame->r(value).jsValue(), slot);
CHECK_FOR_EXCEPTION();
@@ -2916,7 +2915,7 @@ skip_id_custom_self:
int property = vPC[3].u.operand;
JSObject* baseObj = callFrame->r(base).jsValue().toObject(callFrame);
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
JSValue result = jsBoolean(baseObj->deleteProperty(callFrame, ident));
CHECK_FOR_EXCEPTION();
callFrame->r(dst) = result;
@@ -3409,12 +3408,12 @@ skip_id_custom_self:
int defaultOffset = vPC[2].u.operand;
JSValue scrutinee = callFrame->r(vPC[3].u.operand).jsValue();
if (scrutinee.isInt32())
- vPC += callFrame->codeBlock()->immediateSwitchJumpTable(tableIndex).offsetForValue(scrutinee.asInt32(), defaultOffset);
+ vPC += codeBlock->immediateSwitchJumpTable(tableIndex).offsetForValue(scrutinee.asInt32(), defaultOffset);
else {
double value;
int32_t intValue;
if (scrutinee.getNumber(value) && ((intValue = static_cast<int32_t>(value)) == value))
- vPC += callFrame->codeBlock()->immediateSwitchJumpTable(tableIndex).offsetForValue(intValue, defaultOffset);
+ vPC += codeBlock->immediateSwitchJumpTable(tableIndex).offsetForValue(intValue, defaultOffset);
else
vPC += defaultOffset;
}
@@ -3439,7 +3438,7 @@ skip_id_custom_self:
if (value->length() != 1)
vPC += defaultOffset;
else
- vPC += callFrame->codeBlock()->characterSwitchJumpTable(tableIndex).offsetForValue(value->characters()[0], defaultOffset);
+ vPC += codeBlock->characterSwitchJumpTable(tableIndex).offsetForValue(value->characters()[0], defaultOffset);
}
NEXT_INSTRUCTION();
}
@@ -3458,7 +3457,7 @@ skip_id_custom_self:
if (!scrutinee.isString())
vPC += defaultOffset;
else
- vPC += callFrame->codeBlock()->stringSwitchJumpTable(tableIndex).offsetForValue(asString(scrutinee)->value(callFrame).rep(), defaultOffset);
+ vPC += codeBlock->stringSwitchJumpTable(tableIndex).offsetForValue(asString(scrutinee)->value(callFrame).rep(), defaultOffset);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_new_func) {
@@ -3472,7 +3471,7 @@ skip_id_custom_self:
int dst = vPC[1].u.operand;
int func = vPC[2].u.operand;
- callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionDecl(func)->make(callFrame, callFrame->scopeChain()));
+ callFrame->r(dst) = JSValue(codeBlock->functionDecl(func)->make(callFrame, callFrame->scopeChain()));
vPC += OPCODE_LENGTH(op_new_func);
NEXT_INSTRUCTION();
@@ -3488,7 +3487,7 @@ skip_id_custom_self:
int dst = vPC[1].u.operand;
int funcIndex = vPC[2].u.operand;
- FunctionExecutable* function = callFrame->codeBlock()->functionExpr(funcIndex);
+ FunctionExecutable* function = codeBlock->functionExpr(funcIndex);
JSFunction* func = function->make(callFrame, callFrame->scopeChain());
/*
@@ -3509,7 +3508,7 @@ skip_id_custom_self:
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_call_eval) {
- /* call_eval dst(r) func(r) argCount(n) registerOffset(n)
+ /* call_eval func(r) argCount(n) registerOffset(n)
Call a function named "eval" with no explicit "this" value
(which may therefore be the eval operator). If register
@@ -3520,10 +3519,9 @@ skip_id_custom_self:
opcode). Otherwise, act exactly as the "call" opcode would.
*/
- int dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCount = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
+ int func = vPC[1].u.operand;
+ int argCount = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
JSValue funcVal = callFrame->r(func).jsValue();
@@ -3536,7 +3534,7 @@ skip_id_custom_self:
JSValue result = callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
if (exceptionValue)
goto vm_throw;
- callFrame->r(dst) = result;
+ functionReturnValue = result;
vPC += OPCODE_LENGTH(op_call_eval);
NEXT_INSTRUCTION();
@@ -3547,7 +3545,7 @@ skip_id_custom_self:
// fall through to op_call
}
DEFINE_OPCODE(op_call) {
- /* call dst(r) func(r) argCount(n) registerOffset(n)
+ /* call func(r) argCount(n) registerOffset(n)
Perform a function call.
@@ -3557,10 +3555,9 @@ skip_id_custom_self:
dst is where op_ret should store its result.
*/
- int dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCount = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
+ int func = vPC[1].u.operand;
+ int argCount = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
JSValue v = callFrame->r(func).jsValue();
@@ -3580,7 +3577,9 @@ skip_id_custom_self:
goto vm_throw;
}
- callFrame->init(newCodeBlock, vPC + 5, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
+ callFrame->init(newCodeBlock, vPC + OPCODE_LENGTH(op_call), callDataScopeChain, previousCallFrame, 0, argCount, asFunction(v));
+ codeBlock = newCodeBlock;
+ ASSERT(codeBlock == callFrame->codeBlock());
vPC = newCodeBlock->instructions().begin();
#if ENABLE(OPCODE_STATS)
@@ -3593,7 +3592,7 @@ skip_id_custom_self:
if (callType == CallTypeHost) {
ScopeChainNode* scopeChain = callFrame->scopeChain();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, 0);
+ newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call), scopeChain, callFrame, 0, argCount, 0);
Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
ArgList args(thisRegister + 1, argCount - 1);
@@ -3610,7 +3609,7 @@ skip_id_custom_self:
}
CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = returnValue;
+ functionReturnValue = returnValue;
vPC += OPCODE_LENGTH(op_call);
NEXT_INSTRUCTION();
@@ -3618,7 +3617,7 @@ skip_id_custom_self:
ASSERT(callType == CallTypeNone);
- exceptionValue = createNotAFunctionError(callFrame, v, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
+ exceptionValue = createNotAFunctionError(callFrame, v, vPC - codeBlock->instructions().begin(), codeBlock);
goto vm_throw;
}
DEFINE_OPCODE(op_load_varargs) {
@@ -3649,7 +3648,7 @@ skip_id_custom_self:
argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - argCount - 1];
} else if (!arguments.isUndefinedOrNull()) {
if (!arguments.isObject()) {
- exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
+ exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPC - codeBlock->instructions().begin(), codeBlock);
goto vm_throw;
}
if (asObject(arguments)->classInfo() == &Arguments::info) {
@@ -3688,7 +3687,7 @@ skip_id_custom_self:
}
} else {
if (!arguments.isObject()) {
- exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
+ exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPC - codeBlock->instructions().begin(), codeBlock);
goto vm_throw;
}
}
@@ -3699,7 +3698,7 @@ skip_id_custom_self:
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_call_varargs) {
- /* call_varargs dst(r) func(r) argCountReg(r) baseRegisterOffset(n)
+ /* call_varargs func(r) argCountReg(r) baseRegisterOffset(n)
Perform a function call with a dynamic set of arguments.
@@ -3710,10 +3709,9 @@ skip_id_custom_self:
dst is where op_ret should store its result.
*/
- int dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCountReg = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
+ int func = vPC[1].u.operand;
+ int argCountReg = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
JSValue v = callFrame->r(func).jsValue();
int argCount = callFrame->r(argCountReg).i();
@@ -3734,7 +3732,9 @@ skip_id_custom_self:
goto vm_throw;
}
- callFrame->init(newCodeBlock, vPC + 5, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
+ callFrame->init(newCodeBlock, vPC + OPCODE_LENGTH(op_call_varargs), callDataScopeChain, previousCallFrame, 0, argCount, asFunction(v));
+ codeBlock = newCodeBlock;
+ ASSERT(codeBlock == callFrame->codeBlock());
vPC = newCodeBlock->instructions().begin();
#if ENABLE(OPCODE_STATS)
@@ -3747,7 +3747,7 @@ skip_id_custom_self:
if (callType == CallTypeHost) {
ScopeChainNode* scopeChain = callFrame->scopeChain();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, 0);
+ newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call_varargs), scopeChain, callFrame, 0, argCount, 0);
Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
ArgList args(thisRegister + 1, argCount - 1);
@@ -3764,7 +3764,7 @@ skip_id_custom_self:
}
CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = returnValue;
+ functionReturnValue = returnValue;
vPC += OPCODE_LENGTH(op_call_varargs);
NEXT_INSTRUCTION();
@@ -3772,47 +3772,50 @@ skip_id_custom_self:
ASSERT(callType == CallTypeNone);
- exceptionValue = createNotAFunctionError(callFrame, v, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
+ exceptionValue = createNotAFunctionError(callFrame, v, vPC - codeBlock->instructions().begin(), codeBlock);
goto vm_throw;
}
DEFINE_OPCODE(op_tear_off_activation) {
- /* tear_off_activation activation(r)
+ /* tear_off_activation activation(r) arguments(r)
- Copy all locals and parameters to new memory allocated on
- the heap, and make the passed activation use this memory
- in the future when looking up entries in the symbol table.
- If there is an 'arguments' object, then it will also use
- this memory for storing the named parameters, but not any
- extra arguments.
+ Copy locals and named parameters from the register file to the heap.
+ Point the bindings in 'activation' and 'arguments' to this new backing
+ store. (Note that 'arguments' may not have been created. If created,
+ 'arguments' already holds a copy of any extra / unnamed parameters.)
- This opcode should only be used immediately before op_ret.
+ This opcode appears before op_ret in functions that require full scope chains.
*/
- int src = vPC[1].u.operand;
- ASSERT(callFrame->codeBlock()->needsFullScopeChain());
+ int src1 = vPC[1].u.operand;
+ int src2 = vPC[2].u.operand;
+ ASSERT(codeBlock->needsFullScopeChain());
+
+ JSActivation* activation = asActivation(callFrame->r(src1).jsValue());
+ activation->copyRegisters();
- asActivation(callFrame->r(src).jsValue())->copyRegisters(callFrame->optionalCalleeArguments());
+ if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(src2)).jsValue())
+ asArguments(arguments)->setActivation(activation);
vPC += OPCODE_LENGTH(op_tear_off_activation);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_tear_off_arguments) {
- /* tear_off_arguments
+ /* tear_off_arguments arguments(r)
- Copy all arguments to new memory allocated on the heap,
- and make the 'arguments' object use this memory in the
- future when looking up named parameters, but not any
- extra arguments. If an activation object exists for the
- current function context, then the tear_off_activation
- opcode should be used instead.
+ Copy named parameters from the register file to the heap. Point the
+ bindings in 'arguments' to this new backing store. (Note that
+ 'arguments' may not have been created. If created, 'arguments' already
+ holds a copy of any extra / unnamed parameters.)
- This opcode should only be used immediately before op_ret.
+ This opcode appears before op_ret in functions that don't require full
+ scope chains, but do use 'arguments'.
*/
- ASSERT(callFrame->codeBlock()->usesArguments() && !callFrame->codeBlock()->needsFullScopeChain());
+ int src1 = vPC[1].u.operand;
+ ASSERT(!codeBlock->needsFullScopeChain() && codeBlock->ownerExecutable()->usesArguments());
- if (callFrame->optionalCalleeArguments())
- callFrame->optionalCalleeArguments()->copyRegisters();
+ if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(src1)).jsValue())
+ asArguments(arguments)->copyRegisters();
vPC += OPCODE_LENGTH(op_tear_off_arguments);
NEXT_INSTRUCTION();
@@ -3821,6 +3824,47 @@ skip_id_custom_self:
/* ret result(r)
Return register result as the return value of the current
+ function call, writing it into functionReturnValue.
+ In addition, unwind one call frame and restore the scope
+ chain, code block instruction pointer and register base
+ to those of the calling function.
+ */
+
+ int result = vPC[1].u.operand;
+
+ if (callFrame->codeBlock()->needsFullScopeChain())
+ callFrame->scopeChain()->deref();
+
+ JSValue returnValue = callFrame->r(result).jsValue();
+
+ vPC = callFrame->returnPC();
+ callFrame = callFrame->callerFrame();
+
+ if (callFrame->hasHostCallFrameFlag())
+ return returnValue;
+
+ functionReturnValue = returnValue;
+ codeBlock = callFrame->codeBlock();
+ ASSERT(codeBlock == callFrame->codeBlock());
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_call_put_result) {
+ /* op_call_put_result result(r)
+
+ Move call result from functionReturnValue to caller's
+ expected return value register.
+ */
+
+ callFrame->r(vPC[1].u.operand) = functionReturnValue;
+
+ vPC += OPCODE_LENGTH(op_call_put_result);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_ret_object_or_this) {
+ /* ret result(r)
+
+ Return register result as the return value of the current
function call, writing it into the caller's expected return
value register. In addition, unwind one call frame and
restore the scope chain, code block instruction pointer and
@@ -3829,36 +3873,36 @@ skip_id_custom_self:
int result = vPC[1].u.operand;
- if (callFrame->codeBlock()->needsFullScopeChain())
+ if (codeBlock->needsFullScopeChain())
callFrame->scopeChain()->deref();
JSValue returnValue = callFrame->r(result).jsValue();
+ if (UNLIKELY(!returnValue.isObject()))
+ returnValue = callFrame->r(vPC[2].u.operand).jsValue();
+
vPC = callFrame->returnPC();
- int dst = callFrame->returnValueRegister();
callFrame = callFrame->callerFrame();
if (callFrame->hasHostCallFrameFlag())
return returnValue;
- callFrame->r(dst) = returnValue;
+ functionReturnValue = returnValue;
+ codeBlock = callFrame->codeBlock();
+ ASSERT(codeBlock == callFrame->codeBlock());
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_enter) {
/* enter
- Initializes local variables to undefined and fills constant
- registers with their values. If the code block requires an
- activation, enter_with_activation should be used instead.
+ Initializes local variables to undefined. If the code block requires
+ an activation, enter_with_activation is used instead.
- This opcode should only be used at the beginning of a code
- block.
+ This opcode appears only at the beginning of a code block.
*/
size_t i = 0;
- CodeBlock* codeBlock = callFrame->codeBlock();
-
for (size_t count = codeBlock->m_numVars; i < count; ++i)
callFrame->r(i) = jsUndefined();
@@ -3868,19 +3912,13 @@ skip_id_custom_self:
DEFINE_OPCODE(op_enter_with_activation) {
/* enter_with_activation dst(r)
- Initializes local variables to undefined, fills constant
- registers with their values, creates an activation object,
- and places the new activation both in dst and at the top
- of the scope chain. If the code block does not require an
- activation, enter should be used instead.
+ Initializes local variables to undefined, creates an activation object,
+ places it in dst, and pushes it onto the scope chain.
- This opcode should only be used at the beginning of a code
- block.
+ This opcode appears only at the beginning of a code block.
*/
size_t i = 0;
- CodeBlock* codeBlock = callFrame->codeBlock();
-
for (size_t count = codeBlock->m_numVars; i < count; ++i)
callFrame->r(i) = jsUndefined();
@@ -3913,37 +3951,39 @@ skip_id_custom_self:
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_init_arguments) {
- /* create_arguments
+ /* create_arguments dst(r)
- Initialises the arguments object reference to null to ensure
- we can correctly detect that we need to create it later (or
- avoid creating it altogether).
+ Initialises 'arguments' to JSValue().
- This opcode should only be used at the beginning of a code
- block.
+ This opcode appears only at the beginning of a code block.
*/
- callFrame->r(RegisterFile::ArgumentsRegister) = JSValue();
+ int dst = vPC[1].u.operand;
+
+ callFrame->r(dst) = JSValue();
+ callFrame->r(unmodifiedArgumentsRegister(dst)) = JSValue();
vPC += OPCODE_LENGTH(op_init_arguments);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_create_arguments) {
- /* create_arguments
+ /* create_arguments dst(r)
Creates the 'arguments' object and places it in both the
'arguments' call frame slot and the local 'arguments'
register, if it has not already been initialised.
*/
- if (!callFrame->r(RegisterFile::ArgumentsRegister).jsValue()) {
- Arguments* arguments = new (globalData) Arguments(callFrame);
- callFrame->setCalleeArguments(arguments);
- callFrame->r(RegisterFile::ArgumentsRegister) = JSValue(arguments);
- }
+ int dst = vPC[1].u.operand;
+
+ if (!callFrame->r(dst).jsValue()) {
+ Arguments* arguments = new (globalData) Arguments(callFrame);
+ callFrame->r(dst) = JSValue(arguments);
+ callFrame->r(unmodifiedArgumentsRegister(dst)) = JSValue(arguments);
+ }
vPC += OPCODE_LENGTH(op_create_arguments);
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_construct) {
- /* construct dst(r) func(r) argCount(n) registerOffset(n) proto(r) thisRegister(r)
+ /* construct func(r) argCount(n) registerOffset(n) proto(r) thisRegister(r)
Invoke register "func" as a constructor. For JS
functions, the calling convention is exactly as for the
@@ -3957,12 +3997,11 @@ skip_id_custom_self:
caching of this lookup.
*/
- int dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCount = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
- int proto = vPC[5].u.operand;
- int thisRegister = vPC[6].u.operand;
+ int func = vPC[1].u.operand;
+ int argCount = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
+ int proto = vPC[4].u.operand;
+ int thisRegister = vPC[5].u.operand;
JSValue v = callFrame->r(func).jsValue();
@@ -3992,7 +4031,8 @@ skip_id_custom_self:
goto vm_throw;
}
- callFrame->init(newCodeBlock, vPC + 7, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
+ callFrame->init(newCodeBlock, vPC + OPCODE_LENGTH(op_construct), callDataScopeChain, previousCallFrame, 0, argCount, asFunction(v));
+ codeBlock = newCodeBlock;
vPC = newCodeBlock->instructions().begin();
#if ENABLE(OPCODE_STATS)
@@ -4007,7 +4047,7 @@ skip_id_custom_self:
ScopeChainNode* scopeChain = callFrame->scopeChain();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, 0);
+ newCallFrame->init(0, vPC + OPCODE_LENGTH(op_construct), scopeChain, callFrame, 0, argCount, 0);
JSValue returnValue;
{
@@ -4015,7 +4055,7 @@ skip_id_custom_self:
returnValue = constructData.native.function(newCallFrame, asObject(v), args);
}
CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = JSValue(returnValue);
+ functionReturnValue = JSValue(returnValue);
vPC += OPCODE_LENGTH(op_construct);
NEXT_INSTRUCTION();
@@ -4023,28 +4063,9 @@ skip_id_custom_self:
ASSERT(constructType == ConstructTypeNone);
- exceptionValue = createNotAConstructorError(callFrame, v, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
+ exceptionValue = createNotAConstructorError(callFrame, v, vPC - codeBlock->instructions().begin(), codeBlock);
goto vm_throw;
}
- DEFINE_OPCODE(op_construct_verify) {
- /* construct_verify dst(r) override(r)
-
- Verifies that register dst holds an object. If not, moves
- the object in register override to register dst.
- */
-
- int dst = vPC[1].u.operand;
- if (LIKELY(callFrame->r(dst).jsValue().isObject())) {
- vPC += OPCODE_LENGTH(op_construct_verify);
- NEXT_INSTRUCTION();
- }
-
- int override = vPC[2].u.operand;
- callFrame->r(dst) = callFrame->r(override);
-
- vPC += OPCODE_LENGTH(op_construct_verify);
- NEXT_INSTRUCTION();
- }
DEFINE_OPCODE(op_strcat) {
int dst = vPC[1].u.operand;
int src = vPC[2].u.operand;
@@ -4143,6 +4164,7 @@ skip_id_custom_self:
JSPropertyNameIterator* it = callFrame->r(iter).propertyNameIterator();
while (callFrame->r(i).i() != callFrame->r(size).i()) {
JSValue key = it->get(callFrame, asObject(callFrame->r(base).jsValue()), callFrame->r(i).i());
+ CHECK_FOR_EXCEPTION();
callFrame->r(i) = Register::withInt(callFrame->r(i).i() + 1);
if (key) {
CHECK_FOR_TIMEOUT();
@@ -4222,13 +4244,14 @@ skip_id_custom_self:
int ex = vPC[1].u.operand;
exceptionValue = callFrame->r(ex).jsValue();
- handler = throwException(callFrame, exceptionValue, vPC - callFrame->codeBlock()->instructions().begin(), true);
+ handler = throwException(callFrame, exceptionValue, vPC - codeBlock->instructions().begin(), true);
if (!handler) {
*exception = exceptionValue;
return jsNull();
}
- vPC = callFrame->codeBlock()->instructions().begin() + handler->target;
+ codeBlock = callFrame->codeBlock();
+ vPC = codeBlock->instructions().begin() + handler->target;
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_new_error) {
@@ -4243,7 +4266,6 @@ skip_id_custom_self:
int type = vPC[2].u.operand;
int message = vPC[3].u.operand;
- CodeBlock* codeBlock = callFrame->codeBlock();
callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()));
vPC += OPCODE_LENGTH(op_new_error);
@@ -4256,7 +4278,7 @@ skip_id_custom_self:
program. Return control to the calling native code.
*/
- if (callFrame->codeBlock()->needsFullScopeChain()) {
+ if (codeBlock->needsFullScopeChain()) {
ScopeChainNode* scopeChain = callFrame->scopeChain();
ASSERT(scopeChain->refCount > 1);
scopeChain->deref();
@@ -4281,7 +4303,7 @@ skip_id_custom_self:
ASSERT(callFrame->r(base).jsValue().isObject());
JSObject* baseObj = asObject(callFrame->r(base).jsValue());
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
ASSERT(callFrame->r(function).jsValue().isObject());
baseObj->defineGetter(callFrame, ident, asObject(callFrame->r(function).jsValue()));
@@ -4305,7 +4327,7 @@ skip_id_custom_self:
ASSERT(callFrame->r(base).jsValue().isObject());
JSObject* baseObj = asObject(callFrame->r(base).jsValue());
- Identifier& ident = callFrame->codeBlock()->identifier(property);
+ Identifier& ident = codeBlock->identifier(property);
ASSERT(callFrame->r(function).jsValue().isObject());
baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue()), 0);
@@ -4390,24 +4412,25 @@ skip_id_custom_self:
// cannot fathom if we don't assign to the exceptionValue before branching)
exceptionValue = createInterruptedExecutionException(globalData);
}
- handler = throwException(callFrame, exceptionValue, vPC - callFrame->codeBlock()->instructions().begin(), false);
+ handler = throwException(callFrame, exceptionValue, vPC - codeBlock->instructions().begin(), false);
if (!handler) {
*exception = exceptionValue;
return jsNull();
}
- vPC = callFrame->codeBlock()->instructions().begin() + handler->target;
+ codeBlock = callFrame->codeBlock();
+ vPC = codeBlock->instructions().begin() + handler->target;
NEXT_INSTRUCTION();
}
}
#if !HAVE(COMPUTED_GOTO)
} // iterator loop ends
#endif
-#endif // USE(INTERPRETER)
#undef NEXT_INSTRUCTION
#undef DEFINE_OPCODE
#undef CHECK_FOR_EXCEPTION
#undef CHECK_FOR_TIMEOUT
+#endif // !ENABLE(JIT)
}
JSValue Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* function) const
@@ -4419,27 +4442,21 @@ JSValue Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* functio
CodeBlock* codeBlock = functionCallFrame->codeBlock();
if (codeBlock->usesArguments()) {
ASSERT(codeBlock->codeType() == FunctionCode);
- SymbolTable& symbolTable = *codeBlock->symbolTable();
- int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex();
- if (!functionCallFrame->r(argumentsIndex).jsValue()) {
- Arguments* arguments = new (callFrame) Arguments(functionCallFrame);
- functionCallFrame->setCalleeArguments(arguments);
- functionCallFrame->r(RegisterFile::ArgumentsRegister) = JSValue(arguments);
+ int argumentsRegister = codeBlock->argumentsRegister();
+ if (!functionCallFrame->r(argumentsRegister).jsValue()) {
+ JSValue arguments = JSValue(new (callFrame) Arguments(functionCallFrame));
+ functionCallFrame->r(argumentsRegister) = arguments;
+ functionCallFrame->r(unmodifiedArgumentsRegister(argumentsRegister)) = arguments;
}
- return functionCallFrame->r(argumentsIndex).jsValue();
- }
-
- Arguments* arguments = functionCallFrame->optionalCalleeArguments();
- if (!arguments) {
- arguments = new (functionCallFrame) Arguments(functionCallFrame);
- arguments->copyRegisters();
- callFrame->setCalleeArguments(arguments);
+ return functionCallFrame->r(argumentsRegister).jsValue();
}
+ Arguments* arguments = new (functionCallFrame) Arguments(functionCallFrame);
+ arguments->copyRegisters();
return arguments;
}
-JSValue Interpreter::retrieveCaller(CallFrame* callFrame, InternalFunction* function) const
+JSValue Interpreter::retrieveCaller(CallFrame* callFrame, JSFunction* function) const
{
CallFrame* functionCallFrame = findFunctionCallFrame(callFrame, function);
if (!functionCallFrame)
@@ -4470,14 +4487,14 @@ void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intp
if (!callerCodeBlock)
return;
- unsigned bytecodeOffset = bytecodeOffsetForPC(callerFrame, callerCodeBlock, callFrame->returnPC());
+ unsigned bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1);
sourceID = callerCodeBlock->ownerExecutable()->sourceID();
sourceURL = callerCodeBlock->ownerExecutable()->sourceURL();
function = callerFrame->callee();
}
-CallFrame* Interpreter::findFunctionCallFrame(CallFrame* callFrame, InternalFunction* function)
+CallFrame* Interpreter::findFunctionCallFrame(CallFrame* callFrame, JSFunction* function)
{
for (CallFrame* candidate = callFrame; candidate; candidate = candidate->callerFrame()->removeHostCallFrameFlag()) {
if (candidate->callee() == function)
diff --git a/JavaScriptCore/interpreter/Interpreter.h b/JavaScriptCore/interpreter/Interpreter.h
index 0a5d592..3572617 100644
--- a/JavaScriptCore/interpreter/Interpreter.h
+++ b/JavaScriptCore/interpreter/Interpreter.h
@@ -44,7 +44,6 @@ namespace JSC {
class CodeBlock;
class EvalExecutable;
class FunctionExecutable;
- class InternalFunction;
class JSFunction;
class JSGlobalObject;
class ProgramExecutable;
@@ -101,7 +100,7 @@ namespace JSC {
JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception);
JSValue retrieveArguments(CallFrame*, JSFunction*) const;
- JSValue retrieveCaller(CallFrame*, InternalFunction*) const;
+ JSValue retrieveCaller(CallFrame*, JSFunction*) const;
void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const;
void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
@@ -124,7 +123,7 @@ namespace JSC {
JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
-#if USE(INTERPRETER)
+#if !ENABLE(JIT)
NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue);
NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValue& exceptionValue);
NEVER_INLINE bool resolveGlobal(CallFrame*, Instruction*, JSValue& exceptionValue);
@@ -137,13 +136,13 @@ namespace JSC {
void uncacheGetByID(CodeBlock*, Instruction* vPC);
void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValue baseValue, const PutPropertySlot&);
void uncachePutByID(CodeBlock*, Instruction* vPC);
-#endif
+#endif // !ENABLE(JIT)
NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValue, unsigned& bytecodeOffset, CodeBlock*&);
static ALWAYS_INLINE CallFrame* slideRegisterWindowForCall(CodeBlock*, RegisterFile*, CallFrame*, size_t registerOffset, int argc);
- static CallFrame* findFunctionCallFrame(CallFrame*, InternalFunction*);
+ static CallFrame* findFunctionCallFrame(CallFrame*, JSFunction*);
JSValue privateExecute(ExecutionFlag, RegisterFile*, CallFrame*, JSValue* exception);
diff --git a/JavaScriptCore/interpreter/Register.h b/JavaScriptCore/interpreter/Register.h
index ecd7403..723112e 100644
--- a/JavaScriptCore/interpreter/Register.h
+++ b/JavaScriptCore/interpreter/Register.h
@@ -36,7 +36,6 @@
namespace JSC {
- class Arguments;
class CodeBlock;
class ExecState;
class JSActivation;
@@ -66,7 +65,6 @@ namespace JSC {
int32_t i() const;
JSActivation* activation() const;
- Arguments* arguments() const;
CallFrame* callFrame() const;
CodeBlock* codeBlock() const;
JSFunction* function() const;
diff --git a/JavaScriptCore/interpreter/RegisterFile.h b/JavaScriptCore/interpreter/RegisterFile.h
index def9e25..e9b8204 100644
--- a/JavaScriptCore/interpreter/RegisterFile.h
+++ b/JavaScriptCore/interpreter/RegisterFile.h
@@ -97,20 +97,17 @@ namespace JSC {
friend class JIT;
public:
enum CallFrameHeaderEntry {
- CallFrameHeaderSize = 8,
-
- CodeBlock = -8,
- ScopeChain = -7,
- CallerFrame = -6,
- ReturnPC = -5, // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
- ReturnValueRegister = -4,
- ArgumentCount = -3,
- Callee = -2,
- OptionalCalleeArguments = -1,
+ CallFrameHeaderSize = 6,
+
+ ArgumentCount = -6,
+ CallerFrame = -5,
+ Callee = -4,
+ ScopeChain = -3,
+ ReturnPC = -2, // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
+ CodeBlock = -1,
};
enum { ProgramCodeThisRegister = -CallFrameHeaderSize - 1 };
- enum { ArgumentsRegister = 0 };
static const size_t defaultCapacity = 524288;
static const size_t defaultMaxGlobals = 8192;
diff --git a/JavaScriptCore/jit/JIT.cpp b/JavaScriptCore/jit/JIT.cpp
index c7a4056..eeffd5c 100644
--- a/JavaScriptCore/jit/JIT.cpp
+++ b/JavaScriptCore/jit/JIT.cpp
@@ -24,6 +24,8 @@
*/
#include "config.h"
+
+#if ENABLE(JIT)
#include "JIT.h"
// This probably does not belong here; adding here for now as a quick Windows build fix.
@@ -32,8 +34,6 @@
JSC::MacroAssemblerX86Common::SSE2CheckState JSC::MacroAssemblerX86Common::s_sse2CheckState = NotCheckedSSE2;
#endif
-#if ENABLE(JIT)
-
#include "CodeBlock.h"
#include "Interpreter.h"
#include "JITInlineMethods.h"
@@ -78,10 +78,10 @@ JIT::JIT(JSGlobalData* globalData, CodeBlock* codeBlock)
, m_labels(codeBlock ? codeBlock->instructions().size() : 0)
, m_propertyAccessCompilationInfo(codeBlock ? codeBlock->numberOfStructureStubInfos() : 0)
, m_callStructureStubCompilationInfo(codeBlock ? codeBlock->numberOfCallLinkInfos() : 0)
- , m_bytecodeIndex((unsigned)-1)
+ , m_bytecodeOffset((unsigned)-1)
#if USE(JSVALUE32_64)
, m_jumpTargetIndex(0)
- , m_mappedBytecodeIndex((unsigned)-1)
+ , m_mappedBytecodeOffset((unsigned)-1)
, m_mappedVirtualRegisterIndex((unsigned)-1)
, m_mappedTag((RegisterID)-1)
, m_mappedPayload((RegisterID)-1)
@@ -114,7 +114,7 @@ void JIT::emitTimeoutCheck()
#endif
#define NEXT_OPCODE(name) \
- m_bytecodeIndex += OPCODE_LENGTH(name); \
+ m_bytecodeOffset += OPCODE_LENGTH(name); \
break;
#if USE(JSVALUE32_64)
@@ -176,21 +176,21 @@ void JIT::privateCompileMainPass()
m_globalResolveInfoIndex = 0;
m_callLinkInfoIndex = 0;
- for (m_bytecodeIndex = 0; m_bytecodeIndex < instructionCount; ) {
- Instruction* currentInstruction = instructionsBegin + m_bytecodeIndex;
- ASSERT_WITH_MESSAGE(m_interpreter->isOpcode(currentInstruction->u.opcode), "privateCompileMainPass gone bad @ %d", m_bytecodeIndex);
+ for (m_bytecodeOffset = 0; m_bytecodeOffset < instructionCount; ) {
+ Instruction* currentInstruction = instructionsBegin + m_bytecodeOffset;
+ ASSERT_WITH_MESSAGE(m_interpreter->isOpcode(currentInstruction->u.opcode), "privateCompileMainPass gone bad @ %d", m_bytecodeOffset);
#if ENABLE(OPCODE_SAMPLING)
- if (m_bytecodeIndex > 0) // Avoid the overhead of sampling op_enter twice.
+ if (m_bytecodeOffset > 0) // Avoid the overhead of sampling op_enter twice.
sampleInstruction(currentInstruction);
#endif
#if !USE(JSVALUE32_64)
- if (m_labels[m_bytecodeIndex].isUsed())
+ if (m_labels[m_bytecodeOffset].isUsed())
killLastResultRegister();
#endif
- m_labels[m_bytecodeIndex] = label();
+ m_labels[m_bytecodeOffset] = label();
switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) {
DEFINE_BINARY_OP(op_del_by_val)
@@ -221,7 +221,6 @@ void JIT::privateCompileMainPass()
DEFINE_OP(op_call_varargs)
DEFINE_OP(op_catch)
DEFINE_OP(op_construct)
- DEFINE_OP(op_construct_verify)
DEFINE_OP(op_convert_this)
DEFINE_OP(op_init_arguments)
DEFINE_OP(op_create_arguments)
@@ -302,6 +301,8 @@ void JIT::privateCompileMainPass()
DEFINE_OP(op_resolve_skip)
DEFINE_OP(op_resolve_with_base)
DEFINE_OP(op_ret)
+ DEFINE_OP(op_call_put_result)
+ DEFINE_OP(op_ret_object_or_this)
DEFINE_OP(op_rshift)
DEFINE_OP(op_urshift)
DEFINE_OP(op_sret)
@@ -347,7 +348,7 @@ void JIT::privateCompileMainPass()
#ifndef NDEBUG
// Reset this, in order to guard its use with ASSERTs.
- m_bytecodeIndex = (unsigned)-1;
+ m_bytecodeOffset = (unsigned)-1;
#endif
}
@@ -356,7 +357,7 @@ void JIT::privateCompileLinkPass()
{
unsigned jmpTableCount = m_jmpTable.size();
for (unsigned i = 0; i < jmpTableCount; ++i)
- m_jmpTable[i].from.linkTo(m_labels[m_jmpTable[i].toBytecodeIndex], this);
+ m_jmpTable[i].from.linkTo(m_labels[m_jmpTable[i].toBytecodeOffset], this);
m_jmpTable.clear();
}
@@ -373,11 +374,11 @@ void JIT::privateCompileSlowCases()
killLastResultRegister();
#endif
- m_bytecodeIndex = iter->to;
+ m_bytecodeOffset = iter->to;
#ifndef NDEBUG
- unsigned firstTo = m_bytecodeIndex;
+ unsigned firstTo = m_bytecodeOffset;
#endif
- Instruction* currentInstruction = instructionsBegin + m_bytecodeIndex;
+ Instruction* currentInstruction = instructionsBegin + m_bytecodeOffset;
switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) {
DEFINE_SLOWCASE_OP(op_add)
@@ -389,7 +390,6 @@ void JIT::privateCompileSlowCases()
DEFINE_SLOWCASE_OP(op_call_eval)
DEFINE_SLOWCASE_OP(op_call_varargs)
DEFINE_SLOWCASE_OP(op_construct)
- DEFINE_SLOWCASE_OP(op_construct_verify)
DEFINE_SLOWCASE_OP(op_convert_this)
#if !USE(JSVALUE32)
DEFINE_SLOWCASE_OP(op_div)
@@ -450,7 +450,7 @@ void JIT::privateCompileSlowCases()
#ifndef NDEBUG
// Reset this, in order to guard its use with ASSERTs.
- m_bytecodeIndex = (unsigned)-1;
+ m_bytecodeOffset = (unsigned)-1;
#endif
}
@@ -483,10 +483,10 @@ JITCode JIT::privateCompile()
if (m_codeBlock->codeType() == FunctionCode) {
registerFileCheck.link(this);
- m_bytecodeIndex = 0;
+ m_bytecodeOffset = 0;
JITStubCall(this, cti_register_file_check).call();
#ifndef NDEBUG
- m_bytecodeIndex = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs.
+ m_bytecodeOffset = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs.
#endif
jump(functionBody);
}
@@ -498,27 +498,27 @@ JITCode JIT::privateCompile()
// Translate vPC offsets into addresses in JIT generated code, for switch tables.
for (unsigned i = 0; i < m_switches.size(); ++i) {
SwitchRecord record = m_switches[i];
- unsigned bytecodeIndex = record.bytecodeIndex;
+ unsigned bytecodeOffset = record.bytecodeOffset;
if (record.type != SwitchRecord::String) {
ASSERT(record.type == SwitchRecord::Immediate || record.type == SwitchRecord::Character);
ASSERT(record.jumpTable.simpleJumpTable->branchOffsets.size() == record.jumpTable.simpleJumpTable->ctiOffsets.size());
- record.jumpTable.simpleJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeIndex + record.defaultOffset]);
+ record.jumpTable.simpleJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset]);
for (unsigned j = 0; j < record.jumpTable.simpleJumpTable->branchOffsets.size(); ++j) {
unsigned offset = record.jumpTable.simpleJumpTable->branchOffsets[j];
- record.jumpTable.simpleJumpTable->ctiOffsets[j] = offset ? patchBuffer.locationOf(m_labels[bytecodeIndex + offset]) : record.jumpTable.simpleJumpTable->ctiDefault;
+ record.jumpTable.simpleJumpTable->ctiOffsets[j] = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.simpleJumpTable->ctiDefault;
}
} else {
ASSERT(record.type == SwitchRecord::String);
- record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeIndex + record.defaultOffset]);
+ record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset]);
StringJumpTable::StringOffsetTable::iterator end = record.jumpTable.stringJumpTable->offsetTable.end();
for (StringJumpTable::StringOffsetTable::iterator it = record.jumpTable.stringJumpTable->offsetTable.begin(); it != end; ++it) {
unsigned offset = it->second.branchOffset;
- it->second.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeIndex + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
+ it->second.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
}
}
}
@@ -536,7 +536,7 @@ JITCode JIT::privateCompile()
if (m_codeBlock->hasExceptionInfo()) {
m_codeBlock->callReturnIndexVector().reserveCapacity(m_calls.size());
for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter)
- m_codeBlock->callReturnIndexVector().append(CallReturnOffsetToBytecodeIndex(patchBuffer.returnAddressOffset(iter->from), iter->bytecodeIndex));
+ m_codeBlock->callReturnIndexVector().append(CallReturnOffsetToBytecodeOffset(patchBuffer.returnAddressOffset(iter->from), iter->bytecodeOffset));
}
// Link absolute addresses for jsr
diff --git a/JavaScriptCore/jit/JIT.h b/JavaScriptCore/jit/JIT.h
index b857351..928c80b 100644
--- a/JavaScriptCore/jit/JIT.h
+++ b/JavaScriptCore/jit/JIT.h
@@ -66,16 +66,16 @@ namespace JSC {
struct CallRecord {
MacroAssembler::Call from;
- unsigned bytecodeIndex;
+ unsigned bytecodeOffset;
void* to;
CallRecord()
{
}
- CallRecord(MacroAssembler::Call from, unsigned bytecodeIndex, void* to = 0)
+ CallRecord(MacroAssembler::Call from, unsigned bytecodeOffset, void* to = 0)
: from(from)
- , bytecodeIndex(bytecodeIndex)
+ , bytecodeOffset(bytecodeOffset)
, to(to)
{
}
@@ -83,11 +83,11 @@ namespace JSC {
struct JumpTable {
MacroAssembler::Jump from;
- unsigned toBytecodeIndex;
+ unsigned toBytecodeOffset;
JumpTable(MacroAssembler::Jump f, unsigned t)
: from(f)
- , toBytecodeIndex(t)
+ , toBytecodeOffset(t)
{
}
};
@@ -119,20 +119,20 @@ namespace JSC {
StringJumpTable* stringJumpTable;
} jumpTable;
- unsigned bytecodeIndex;
+ unsigned bytecodeOffset;
unsigned defaultOffset;
- SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeIndex, unsigned defaultOffset, Type type)
+ SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset, Type type)
: type(type)
- , bytecodeIndex(bytecodeIndex)
+ , bytecodeOffset(bytecodeOffset)
, defaultOffset(defaultOffset)
{
this->jumpTable.simpleJumpTable = jumpTable;
}
- SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeIndex, unsigned defaultOffset)
+ SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset)
: type(String)
- , bytecodeIndex(bytecodeIndex)
+ , bytecodeOffset(bytecodeOffset)
, defaultOffset(defaultOffset)
{
this->jumpTable.stringJumpTable = jumpTable;
@@ -223,6 +223,12 @@ namespace JSC {
jit.privateCompileCTIMachineTrampolines(executablePool, globalData, trampolines);
}
+ static CodePtr compileCTINativeCall(JSGlobalData* globalData, PassRefPtr<ExecutablePool> executablePool, NativeFunction func)
+ {
+ JIT jit(globalData);
+ return jit.privateCompileCTINativeCall(executablePool, globalData, func);
+ }
+
static void patchGetByIdSelf(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
static void patchPutByIdReplace(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
static void patchMethodCallProto(CodeBlock* codeblock, MethodCallLinkInfo&, JSFunction*, Structure*, JSObject*, ReturnAddressPtr);
@@ -263,6 +269,7 @@ namespace JSC {
void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ReturnAddressPtr returnAddress);
void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, TrampolineStructure *trampolines);
+ CodePtr privateCompileCTINativeCall(PassRefPtr<ExecutablePool> executablePool, JSGlobalData* data, NativeFunction func);
void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
void addSlowCase(Jump);
@@ -306,8 +313,8 @@ namespace JSC {
void emitStoreBool(unsigned index, RegisterID tag, bool indexIsBool = false);
void emitStoreDouble(unsigned index, FPRegisterID value);
- bool isLabeled(unsigned bytecodeIndex);
- void map(unsigned bytecodeIndex, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload);
+ bool isLabeled(unsigned bytecodeOffset);
+ void map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload);
void unmap(RegisterID);
void unmap();
bool isMapped(unsigned virtualRegisterIndex);
@@ -644,9 +651,9 @@ namespace JSC {
void emit_op_call(Instruction*);
void emit_op_call_eval(Instruction*);
void emit_op_call_varargs(Instruction*);
+ void emit_op_call_put_result(Instruction*);
void emit_op_catch(Instruction*);
void emit_op_construct(Instruction*);
- void emit_op_construct_verify(Instruction*);
void emit_op_convert_this(Instruction*);
void emit_op_create_arguments(Instruction*);
void emit_op_debug(Instruction*);
@@ -723,6 +730,7 @@ namespace JSC {
void emit_op_resolve_skip(Instruction*);
void emit_op_resolve_with_base(Instruction*);
void emit_op_ret(Instruction*);
+ void emit_op_ret_object_or_this(Instruction*);
void emit_op_rshift(Instruction*);
void emit_op_sret(Instruction*);
void emit_op_strcat(Instruction*);
@@ -751,7 +759,6 @@ namespace JSC {
void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
- void emitSlow_op_construct_verify(Instruction*, Vector<SlowCaseEntry>::iterator&);
void emitSlow_op_convert_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&);
void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
@@ -879,7 +886,7 @@ namespace JSC {
Vector<MethodCallCompilationInfo> m_methodCallCompilationInfo;
Vector<JumpTable> m_jmpTable;
- unsigned m_bytecodeIndex;
+ unsigned m_bytecodeOffset;
Vector<JSRInfo> m_jsrSites;
Vector<SlowCaseEntry> m_slowCases;
Vector<SwitchRecord> m_switches;
@@ -890,7 +897,7 @@ namespace JSC {
#if USE(JSVALUE32_64)
unsigned m_jumpTargetIndex;
- unsigned m_mappedBytecodeIndex;
+ unsigned m_mappedBytecodeOffset;
unsigned m_mappedVirtualRegisterIndex;
RegisterID m_mappedTag;
RegisterID m_mappedPayload;
@@ -905,7 +912,7 @@ namespace JSC {
int m_uninterruptedConstantSequenceBegin;
#endif
#endif
- static PassRefPtr<NativeExecutable> stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool);
+ static CodePtr stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool);
} JIT_CLASS_ALIGNMENT;
inline void JIT::emit_op_loop(Instruction* currentInstruction)
diff --git a/JavaScriptCore/jit/JITArithmetic.cpp b/JavaScriptCore/jit/JITArithmetic.cpp
index cd39b3a..0e5bb45 100644
--- a/JavaScriptCore/jit/JITArithmetic.cpp
+++ b/JavaScriptCore/jit/JITArithmetic.cpp
@@ -24,9 +24,10 @@
*/
#include "config.h"
-#include "JIT.h"
#if ENABLE(JIT)
+#if !USE(JSVALUE32_64)
+#include "JIT.h"
#include "CodeBlock.h"
#include "JITInlineMethods.h"
@@ -46,8 +47,6 @@ using namespace std;
namespace JSC {
-#if !USE(JSVALUE32_64)
-
void JIT::emit_op_lshift(Instruction* currentInstruction)
{
unsigned result = currentInstruction[1].u.operand;
@@ -1834,8 +1833,7 @@ void JIT::emitSlow_op_sub(Instruction* currentInstruction, Vector<SlowCaseEntry>
/* ------------------------------ END: OP_ADD, OP_SUB, OP_MUL ------------------------------ */
-#endif // !USE(JSVALUE32_64)
-
} // namespace JSC
+#endif // !USE(JSVALUE32_64)
#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITArithmetic32_64.cpp b/JavaScriptCore/jit/JITArithmetic32_64.cpp
index 97c8d32..023426e 100644
--- a/JavaScriptCore/jit/JITArithmetic32_64.cpp
+++ b/JavaScriptCore/jit/JITArithmetic32_64.cpp
@@ -24,9 +24,10 @@
*/
#include "config.h"
-#include "JIT.h"
#if ENABLE(JIT)
+#if USE(JSVALUE32_64)
+#include "JIT.h"
#include "CodeBlock.h"
#include "JITInlineMethods.h"
@@ -46,8 +47,6 @@ using namespace std;
namespace JSC {
-#if USE(JSVALUE32_64)
-
void JIT::emit_op_negate(Instruction* currentInstruction)
{
unsigned dst = currentInstruction[1].u.operand;
@@ -1404,8 +1403,7 @@ void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>
/* ------------------------------ END: OP_MOD ------------------------------ */
-#endif // USE(JSVALUE32_64)
-
-}
+} // namespace JSC
+#endif // USE(JSVALUE32_64)
#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITCall.cpp b/JavaScriptCore/jit/JITCall.cpp
index 9979c8e..c0de9d1 100644
--- a/JavaScriptCore/jit/JITCall.cpp
+++ b/JavaScriptCore/jit/JITCall.cpp
@@ -24,9 +24,10 @@
*/
#include "config.h"
-#include "JIT.h"
#if ENABLE(JIT)
+#if !USE(JSVALUE32_64)
+#include "JIT.h"
#include "CodeBlock.h"
#include "JITInlineMethods.h"
@@ -45,406 +46,20 @@ using namespace std;
namespace JSC {
-#if USE(JSVALUE32_64)
-
-void JIT::compileOpCallInitializeCallFrame()
-{
- // regT0 holds callee, regT1 holds argCount
- store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
-
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // scopeChain
-
- emitStore(static_cast<unsigned>(RegisterFile::OptionalCalleeArguments), JSValue());
- storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register)))); // callee
- storePtr(regT1, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register)))); // scopeChain
-}
-
-void JIT::compileOpCallSetupArgs(Instruction* instruction)
-{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- emitPutJITStubArg(regT1, regT0, 0);
- emitPutJITStubArgConstant(registerOffset, 1);
- emitPutJITStubArgConstant(argCount, 2);
-}
-
-void JIT::compileOpConstructSetupArgs(Instruction* instruction)
-{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
-
- emitPutJITStubArg(regT1, regT0, 0);
- emitPutJITStubArgConstant(registerOffset, 1);
- emitPutJITStubArgConstant(argCount, 2);
- emitPutJITStubArgFromVirtualRegister(proto, 3, regT2, regT3);
- emitPutJITStubArgConstant(thisRegister, 4);
-}
-
-void JIT::compileOpCallVarargsSetupArgs(Instruction*)
-{
- emitPutJITStubArg(regT1, regT0, 0);
- emitPutJITStubArg(regT3, 1); // registerOffset
- emitPutJITStubArg(regT2, 2); // argCount
-}
-
-void JIT::compileOpCallVarargs(Instruction* instruction)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCountRegister = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- emitLoad(callee, regT1, regT0);
- emitLoadPayload(argCountRegister, regT2); // argCount
- addPtr(Imm32(registerOffset), regT2, regT3); // registerOffset
-
- compileOpCallVarargsSetupArgs(instruction);
-
- emitJumpSlowCaseIfNotJSCell(callee, regT1);
- addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
-
- // Speculatively roll the callframe, assuming argCount will match the arity.
- mul32(Imm32(sizeof(Register)), regT3, regT3);
- addPtr(callFrameRegister, regT3);
- storePtr(callFrameRegister, Address(regT3, RegisterFile::CallerFrame * static_cast<int>(sizeof(Register))));
- move(regT3, callFrameRegister);
-
- move(regT2, regT1); // argCount
-
- emitNakedCall(m_globalData->jitStubs.ctiVirtualCall());
-
- emitStore(dst, regT1, regT0);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
-
- linkSlowCaseIfNotJSCell(iter, callee);
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
-
- map(m_bytecodeIndex + OPCODE_LENGTH(op_call_varargs), dst, regT1, regT0);
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::emit_op_ret(Instruction* currentInstruction)
-{
- unsigned dst = currentInstruction[1].u.operand;
-
- // We could JIT generate the deref, only calling out to C when the refcount hits zero.
- if (m_codeBlock->needsFullScopeChain())
- JITStubCall(this, cti_op_ret_scopeChain).call();
-
- emitLoad(dst, regT1, regT0);
- emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
-
- restoreReturnAddressBeforeReturn(regT2);
- ret();
-}
-
-void JIT::emit_op_construct_verify(Instruction* currentInstruction)
-{
- unsigned dst = currentInstruction[1].u.operand;
-
- emitLoad(dst, regT1, regT0);
- addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
- addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType)));
-}
-
-void JIT::emitSlow_op_construct_verify(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- unsigned dst = currentInstruction[1].u.operand;
- unsigned src = currentInstruction[2].u.operand;
-
- linkSlowCase(iter);
- linkSlowCase(iter);
- emitLoad(src, regT1, regT0);
- emitStore(dst, regT1, regT0);
-}
-
-void JIT::emitSlow_op_call(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call);
-}
-
-void JIT::emitSlow_op_call_eval(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call_eval);
-}
-
-void JIT::emitSlow_op_call_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- compileOpCallVarargsSlowCase(currentInstruction, iter);
-}
-
-void JIT::emitSlow_op_construct(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_construct);
-}
-
-void JIT::emit_op_call(Instruction* currentInstruction)
-{
- compileOpCall(op_call, currentInstruction, m_callLinkInfoIndex++);
-}
-
-void JIT::emit_op_call_eval(Instruction* currentInstruction)
-{
- compileOpCall(op_call_eval, currentInstruction, m_callLinkInfoIndex++);
-}
-
-void JIT::emit_op_load_varargs(Instruction* currentInstruction)
-{
- int argCountDst = currentInstruction[1].u.operand;
- int argsOffset = currentInstruction[2].u.operand;
-
- JITStubCall stubCall(this, cti_op_load_varargs);
- stubCall.addArgument(Imm32(argsOffset));
- stubCall.call();
- // Stores a naked int32 in the register file.
- store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
-}
-
-void JIT::emit_op_call_varargs(Instruction* currentInstruction)
-{
- compileOpCallVarargs(currentInstruction);
-}
-
-void JIT::emit_op_construct(Instruction* currentInstruction)
-{
- compileOpCall(op_construct, currentInstruction, m_callLinkInfoIndex++);
-}
-
-#if !ENABLE(JIT_OPTIMIZE_CALL)
-
-/* ------------------------------ BEGIN: !ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- Jump wasEval;
- if (opcodeID == op_call_eval) {
- JITStubCall stubCall(this, cti_op_call_eval);
- stubCall.addArgument(callee);
- stubCall.addArgument(JIT::Imm32(registerOffset));
- stubCall.addArgument(JIT::Imm32(argCount));
- stubCall.call();
- wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
- }
-
- emitLoad(callee, regT1, regT0);
-
- if (opcodeID == op_call)
- compileOpCallSetupArgs(instruction);
- else if (opcodeID == op_construct)
- compileOpConstructSetupArgs(instruction);
-
- emitJumpSlowCaseIfNotJSCell(callee, regT1);
- addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
-
- // First, in the case of a construct, allocate the new object.
- if (opcodeID == op_construct) {
- JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitLoad(callee, regT1, regT0);
- }
-
- // Speculatively roll the callframe, assuming argCount will match the arity.
- storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
- addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
- move(Imm32(argCount), regT1);
-
- emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs.ctiVirtualConstruct() : m_globalData->jitStubs.ctiVirtualCall());
-
- if (opcodeID == op_call_eval)
- wasEval.link(this);
-
- emitStore(dst, regT1, regT0);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
-
- linkSlowCaseIfNotJSCell(iter, callee);
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
-
- sampleCodeBlock(m_codeBlock);
-}
-
-#else // !ENABLE(JIT_OPTIMIZE_CALL)
-
-/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- Jump wasEval;
- if (opcodeID == op_call_eval) {
- JITStubCall stubCall(this, cti_op_call_eval);
- stubCall.addArgument(callee);
- stubCall.addArgument(JIT::Imm32(registerOffset));
- stubCall.addArgument(JIT::Imm32(argCount));
- stubCall.call();
- wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
- }
-
- emitLoad(callee, regT1, regT0);
-
- DataLabelPtr addressOfLinkedFunctionCheck;
-
- BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
-
- Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, ImmPtr(0));
-
- END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
-
- addSlowCase(jumpToSlow);
- ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump);
- m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
-
- addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
-
- // The following is the fast case, only used whan a callee can be linked.
-
- // In the case of OpConstruct, call out to a cti_ function to create the new object.
- if (opcodeID == op_construct) {
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
-
- JITStubCall stubCall(this, cti_op_construct_JSConstruct);
- stubCall.addArgument(regT1, regT0);
- stubCall.addArgument(Imm32(0)); // FIXME: Remove this unused JITStub argument.
- stubCall.addArgument(Imm32(0)); // FIXME: Remove this unused JITStub argument.
- stubCall.addArgument(proto);
- stubCall.call(thisRegister);
-
- emitLoad(callee, regT1, regT0);
- }
-
- // Fast version of stack frame initialization, directly relative to edi.
- // Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
- emitStore(registerOffset + RegisterFile::OptionalCalleeArguments, JSValue());
- emitStore(registerOffset + RegisterFile::Callee, regT1, regT0);
-
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
- store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
- storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
- storePtr(regT1, Address(callFrameRegister, (registerOffset + RegisterFile::ScopeChain) * static_cast<int>(sizeof(Register))));
- addPtr(Imm32(registerOffset * sizeof(Register)), callFrameRegister);
-
- // Call to the callee
- m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
-
- if (opcodeID == op_call_eval)
- wasEval.link(this);
-
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + opcodeLengths[opcodeID], dst, regT1, regT0);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- linkSlowCase(iter);
- linkSlowCase(iter);
-
- // The arguments have been set up on the hot path for op_call_eval
- if (opcodeID == op_call)
- compileOpCallSetupArgs(instruction);
- else if (opcodeID == op_construct)
- compileOpConstructSetupArgs(instruction);
-
- // Fast check for JS function.
- Jump callLinkFailNotObject = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
- Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr));
-
- // First, in the case of a construct, allocate the new object.
- if (opcodeID == op_construct) {
- JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitLoad(callee, regT1, regT0);
- }
-
- // Speculatively roll the callframe, assuming argCount will match the arity.
- storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
- addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
- move(Imm32(argCount), regT1);
-
- m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs.ctiVirtualConstructLink() : m_globalData->jitStubs.ctiVirtualCallLink());
-
- // Put the return value in dst.
- emitStore(dst, regT1, regT0);;
- sampleCodeBlock(m_codeBlock);
-
- // If not, we need an extra case in the if below!
- ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_eval));
-
- // Done! - return back to the hot path.
- if (opcodeID == op_construct)
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_construct));
- else
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_call));
-
- // This handles host functions
- callLinkFailNotObject.link(this);
- callLinkFailNotJSFunction.link(this);
- JITStubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction).call();
-
- emitStore(dst, regT1, regT0);;
- sampleCodeBlock(m_codeBlock);
-}
-
-/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-#endif // !ENABLE(JIT_OPTIMIZE_CALL)
-
-#else // USE(JSVALUE32_64)
-
void JIT::compileOpCallInitializeCallFrame()
{
store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
- storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register))));
storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register))));
storePtr(regT1, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register))));
}
void JIT::compileOpCallSetupArgs(Instruction* instruction)
{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
// ecx holds func
emitPutJITStubArg(regT0, 0);
@@ -454,7 +69,7 @@ void JIT::compileOpCallSetupArgs(Instruction* instruction)
void JIT::compileOpCallVarargsSetupArgs(Instruction* instruction)
{
- int registerOffset = instruction[4].u.operand;
+ int registerOffset = instruction[3].u.operand;
// ecx holds func
emitPutJITStubArg(regT0, 0);
@@ -465,10 +80,10 @@ void JIT::compileOpCallVarargsSetupArgs(Instruction* instruction)
void JIT::compileOpConstructSetupArgs(Instruction* instruction)
{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+ int proto = instruction[4].u.operand;
+ int thisRegister = instruction[5].u.operand;
// ecx holds func
emitPutJITStubArg(regT0, 0);
@@ -478,11 +93,16 @@ void JIT::compileOpConstructSetupArgs(Instruction* instruction)
emitPutJITStubArgConstant(thisRegister, 4);
}
-void JIT::compileOpCallVarargs(Instruction* instruction)
+void JIT::emit_op_call_put_result(Instruction* instruction)
{
int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCountRegister = instruction[3].u.operand;
+ emitPutVirtualRegister(dst);
+}
+
+void JIT::compileOpCallVarargs(Instruction* instruction)
+{
+ int callee = instruction[1].u.operand;
+ int argCountRegister = instruction[2].u.operand;
emitGetVirtualRegister(argCountRegister, regT1);
emitGetVirtualRegister(callee, regT0);
@@ -501,20 +121,15 @@ void JIT::compileOpCallVarargs(Instruction* instruction)
addPtr(regT2, callFrameRegister);
emitNakedCall(m_globalData->jitStubs.ctiVirtualCall());
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitPutVirtualRegister(dst);
-
sampleCodeBlock(m_codeBlock);
}
-void JIT::compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
+void JIT::compileOpCallVarargsSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator& iter)
{
- int dst = instruction[1].u.operand;
-
linkSlowCase(iter);
linkSlowCase(iter);
JITStubCall stubCall(this, cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
+ stubCall.call();
sampleCodeBlock(m_codeBlock);
}
@@ -525,10 +140,9 @@ void JIT::compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCase
void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
// Handle eval
Jump wasEval;
@@ -568,20 +182,15 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
if (opcodeID == op_call_eval)
wasEval.link(this);
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitPutVirtualRegister(dst);
-
sampleCodeBlock(m_codeBlock);
}
void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
{
- int dst = instruction[1].u.operand;
-
linkSlowCase(iter);
linkSlowCase(iter);
JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
+ stubCall.call();
sampleCodeBlock(m_codeBlock);
}
@@ -592,10 +201,9 @@ void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>:
void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
// Handle eval
Jump wasEval;
@@ -627,8 +235,8 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
// In the case of OpConstruct, call out to a cti_ function to create the new object.
if (opcodeID == op_construct) {
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
+ int proto = instruction[4].u.operand;
+ int thisRegister = instruction[5].u.operand;
emitPutJITStubArg(regT0, 0);
emitPutJITStubArgFromVirtualRegister(proto, 3, regT2);
@@ -639,11 +247,12 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
// Fast version of stack frame initialization, directly relative to edi.
// Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
- storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, (registerOffset + RegisterFile::OptionalCalleeArguments) * static_cast<int>(sizeof(Register))));
- storePtr(regT0, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
+
store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
+ storePtr(regT0, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
storePtr(regT1, Address(callFrameRegister, (registerOffset + RegisterFile::ScopeChain) * static_cast<int>(sizeof(Register))));
addPtr(Imm32(registerOffset * sizeof(Register)), callFrameRegister);
@@ -653,18 +262,14 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca
if (opcodeID == op_call_eval)
wasEval.link(this);
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitPutVirtualRegister(dst);
-
sampleCodeBlock(m_codeBlock);
}
void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
linkSlowCase(iter);
@@ -693,10 +298,6 @@ void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>:
m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs.ctiVirtualConstructLink() : m_globalData->jitStubs.ctiVirtualCallLink());
- // Put the return value in dst.
- emitPutVirtualRegister(dst);
- sampleCodeBlock(m_codeBlock);
-
// If not, we need an extra case in the if below!
ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_eval));
@@ -711,7 +312,6 @@ void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>:
callLinkFailNotJSFunction.link(this);
JITStubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction).call();
- emitPutVirtualRegister(dst);
sampleCodeBlock(m_codeBlock);
}
@@ -719,8 +319,7 @@ void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>:
#endif // !ENABLE(JIT_OPTIMIZE_CALL)
-#endif // USE(JSVALUE32_64)
-
} // namespace JSC
+#endif // !USE(JSVALUE32_64)
#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITCall32_64.cpp b/JavaScriptCore/jit/JITCall32_64.cpp
new file mode 100644
index 0000000..9b5451a
--- /dev/null
+++ b/JavaScriptCore/jit/JITCall32_64.cpp
@@ -0,0 +1,427 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE32_64)
+#include "JIT.h"
+
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+void JIT::compileOpCallInitializeCallFrame()
+{
+ // regT0 holds callee, regT1 holds argCount
+ store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // scopeChain
+
+ storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register)))); // callee
+ storePtr(regT1, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register)))); // scopeChain
+}
+
+void JIT::compileOpCallSetupArgs(Instruction* instruction)
+{
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ emitPutJITStubArg(regT1, regT0, 0);
+ emitPutJITStubArgConstant(registerOffset, 1);
+ emitPutJITStubArgConstant(argCount, 2);
+}
+
+void JIT::compileOpConstructSetupArgs(Instruction* instruction)
+{
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+ int proto = instruction[4].u.operand;
+ int thisRegister = instruction[5].u.operand;
+
+ emitPutJITStubArg(regT1, regT0, 0);
+ emitPutJITStubArgConstant(registerOffset, 1);
+ emitPutJITStubArgConstant(argCount, 2);
+ emitPutJITStubArgFromVirtualRegister(proto, 3, regT2, regT3);
+ emitPutJITStubArgConstant(thisRegister, 4);
+}
+
+void JIT::compileOpCallVarargsSetupArgs(Instruction*)
+{
+ emitPutJITStubArg(regT1, regT0, 0);
+ emitPutJITStubArg(regT3, 1); // registerOffset
+ emitPutJITStubArg(regT2, 2); // argCount
+}
+
+void JIT::emit_op_call_put_result(Instruction* instruction)
+{
+ int dst = instruction[1].u.operand;
+ emitStore(dst, regT1, regT0);
+}
+
+void JIT::compileOpCallVarargs(Instruction* instruction)
+{
+ int callee = instruction[1].u.operand;
+ int argCountRegister = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ emitLoad(callee, regT1, regT0);
+ emitLoadPayload(argCountRegister, regT2); // argCount
+ addPtr(Imm32(registerOffset), regT2, regT3); // registerOffset
+
+ compileOpCallVarargsSetupArgs(instruction);
+
+ emitJumpSlowCaseIfNotJSCell(callee, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ mul32(Imm32(sizeof(Register)), regT3, regT3);
+ addPtr(callFrameRegister, regT3);
+ storePtr(callFrameRegister, Address(regT3, RegisterFile::CallerFrame * static_cast<int>(sizeof(Register))));
+ move(regT3, callFrameRegister);
+
+ move(regT2, regT1); // argCount
+
+ emitNakedCall(m_globalData->jitStubs.ctiVirtualCall());
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ int callee = instruction[1].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, callee);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_call_NotJSFunction);
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::emit_op_ret(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ // We could JIT generate the deref, only calling out to C when the refcount hits zero.
+ if (m_codeBlock->needsFullScopeChain())
+ JITStubCall(this, cti_op_ret_scopeChain).call();
+
+ emitLoad(dst, regT1, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ restoreReturnAddressBeforeReturn(regT2);
+ ret();
+}
+
+void JIT::emit_op_ret_object_or_this(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned thisReg = currentInstruction[2].u.operand;
+
+ // We could JIT generate the deref, only calling out to C when the refcount hits zero.
+ if (m_codeBlock->needsFullScopeChain())
+ JITStubCall(this, cti_op_ret_scopeChain).call();
+
+ emitLoad(result, regT1, regT0);
+ Jump notJSCell = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ Jump notObject = branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType));
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ restoreReturnAddressBeforeReturn(regT2);
+ ret();
+
+ notJSCell.link(this);
+ notObject.link(this);
+ emitLoad(thisReg, regT1, regT0);
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ restoreReturnAddressBeforeReturn(regT2);
+ ret();
+}
+
+void JIT::emitSlow_op_call(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call);
+}
+
+void JIT::emitSlow_op_call_eval(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call_eval);
+}
+
+void JIT::emitSlow_op_call_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallVarargsSlowCase(currentInstruction, iter);
+}
+
+void JIT::emitSlow_op_construct(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_construct);
+}
+
+void JIT::emit_op_call(Instruction* currentInstruction)
+{
+ compileOpCall(op_call, currentInstruction, m_callLinkInfoIndex++);
+}
+
+void JIT::emit_op_call_eval(Instruction* currentInstruction)
+{
+ compileOpCall(op_call_eval, currentInstruction, m_callLinkInfoIndex++);
+}
+
+void JIT::emit_op_load_varargs(Instruction* currentInstruction)
+{
+ int argCountDst = currentInstruction[1].u.operand;
+ int argsOffset = currentInstruction[2].u.operand;
+
+ JITStubCall stubCall(this, cti_op_load_varargs);
+ stubCall.addArgument(Imm32(argsOffset));
+ stubCall.call();
+ // Stores a naked int32 in the register file.
+ store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
+}
+
+void JIT::emit_op_call_varargs(Instruction* currentInstruction)
+{
+ compileOpCallVarargs(currentInstruction);
+}
+
+void JIT::emit_op_construct(Instruction* currentInstruction)
+{
+ compileOpCall(op_construct, currentInstruction, m_callLinkInfoIndex++);
+}
+
+#if !ENABLE(JIT_OPTIMIZE_CALL)
+
+/* ------------------------------ BEGIN: !ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ Jump wasEval;
+ if (opcodeID == op_call_eval) {
+ JITStubCall stubCall(this, cti_op_call_eval);
+ stubCall.addArgument(callee);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+ wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
+ }
+
+ emitLoad(callee, regT1, regT0);
+
+ if (opcodeID == op_call)
+ compileOpCallSetupArgs(instruction);
+ else if (opcodeID == op_construct)
+ compileOpConstructSetupArgs(instruction);
+
+ emitJumpSlowCaseIfNotJSCell(callee, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // First, in the case of a construct, allocate the new object.
+ if (opcodeID == op_construct) {
+ JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
+ emitLoad(callee, regT1, regT0);
+ }
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
+ move(Imm32(argCount), regT1);
+
+ emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs.ctiVirtualConstruct() : m_globalData->jitStubs.ctiVirtualCall());
+
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
+{
+ int callee = instruction[1].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, callee);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+#else // !ENABLE(JIT_OPTIMIZE_CALL)
+
+/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ Jump wasEval;
+ if (opcodeID == op_call_eval) {
+ JITStubCall stubCall(this, cti_op_call_eval);
+ stubCall.addArgument(callee);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+ wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
+ }
+
+ emitLoad(callee, regT1, regT0);
+
+ DataLabelPtr addressOfLinkedFunctionCheck;
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, ImmPtr(0));
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ addSlowCase(jumpToSlow);
+ ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump);
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
+
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+
+ // The following is the fast case, only used whan a callee can be linked.
+
+ // In the case of OpConstruct, call out to a cti_ function to create the new object.
+ if (opcodeID == op_construct) {
+ int proto = instruction[4].u.operand;
+ int thisRegister = instruction[5].u.operand;
+
+ JITStubCall stubCall(this, cti_op_construct_JSConstruct);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.addArgument(Imm32(0)); // FIXME: Remove this unused JITStub argument.
+ stubCall.addArgument(Imm32(0)); // FIXME: Remove this unused JITStub argument.
+ stubCall.addArgument(proto);
+ stubCall.call(thisRegister);
+
+ emitLoad(callee, regT1, regT0);
+ }
+
+ // Fast version of stack frame initialization, directly relative to edi.
+ // Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT2);
+
+ store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
+ storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
+ emitStore(registerOffset + RegisterFile::Callee, regT1, regT0);
+ storePtr(regT2, Address(callFrameRegister, (registerOffset + RegisterFile::ScopeChain) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * sizeof(Register)), callFrameRegister);
+
+ // Call to the callee
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
+
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ // The arguments have been set up on the hot path for op_call_eval
+ if (opcodeID == op_call)
+ compileOpCallSetupArgs(instruction);
+ else if (opcodeID == op_construct)
+ compileOpConstructSetupArgs(instruction);
+
+ // Fast check for JS function.
+ Jump callLinkFailNotObject = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr));
+
+ // First, in the case of a construct, allocate the new object.
+ if (opcodeID == op_construct) {
+ JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
+ emitLoad(callee, regT1, regT0);
+ }
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
+ move(Imm32(argCount), regT1);
+
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs.ctiVirtualConstructLink() : m_globalData->jitStubs.ctiVirtualCallLink());
+
+ // If not, we need an extra case in the if below!
+ ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_eval));
+
+ // Done! - return back to the hot path.
+ if (opcodeID == op_construct)
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_construct));
+ else
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_call));
+
+ // This handles host functions
+ callLinkFailNotObject.link(this);
+ callLinkFailNotJSFunction.link(this);
+ JITStubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction).call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+#endif // !ENABLE(JIT_OPTIMIZE_CALL)
+
+} // namespace JSC
+
+#endif // USE(JSVALUE32_64)
+#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITInlineMethods.h b/JavaScriptCore/jit/JITInlineMethods.h
index 148f615..89faa00 100644
--- a/JavaScriptCore/jit/JITInlineMethods.h
+++ b/JavaScriptCore/jit/JITInlineMethods.h
@@ -113,10 +113,10 @@ ALWAYS_INLINE void JIT::emitGetFromCallFrameHeader32(RegisterFile::CallFrameHead
ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function)
{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
Call nakedCall = nearCall();
- m_calls.append(CallRecord(nakedCall, m_bytecodeIndex, function.executableAddress()));
+ m_calls.append(CallRecord(nakedCall, m_bytecodeOffset, function.executableAddress()));
return nakedCall;
}
@@ -243,33 +243,33 @@ ALWAYS_INLINE void JIT::linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&
ALWAYS_INLINE void JIT::addSlowCase(Jump jump)
{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
- m_slowCases.append(SlowCaseEntry(jump, m_bytecodeIndex));
+ m_slowCases.append(SlowCaseEntry(jump, m_bytecodeOffset));
}
ALWAYS_INLINE void JIT::addSlowCase(JumpList jumpList)
{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
const JumpList::JumpVector& jumpVector = jumpList.jumps();
size_t size = jumpVector.size();
for (size_t i = 0; i < size; ++i)
- m_slowCases.append(SlowCaseEntry(jumpVector[i], m_bytecodeIndex));
+ m_slowCases.append(SlowCaseEntry(jumpVector[i], m_bytecodeOffset));
}
ALWAYS_INLINE void JIT::addJump(Jump jump, int relativeOffset)
{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
- m_jmpTable.append(JumpTable(jump, m_bytecodeIndex + relativeOffset));
+ m_jmpTable.append(JumpTable(jump, m_bytecodeOffset + relativeOffset));
}
ALWAYS_INLINE void JIT::emitJumpSlowToHot(Jump jump, int relativeOffset)
{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
- jump.linkTo(m_labels[m_bytecodeIndex + relativeOffset], this);
+ jump.linkTo(m_labels[m_bytecodeOffset + relativeOffset], this);
}
#if ENABLE(SAMPLING_FLAGS)
@@ -485,24 +485,24 @@ ALWAYS_INLINE void JIT::emitInitRegister(unsigned dst)
emitStore(dst, jsUndefined());
}
-inline bool JIT::isLabeled(unsigned bytecodeIndex)
+inline bool JIT::isLabeled(unsigned bytecodeOffset)
{
for (size_t numberOfJumpTargets = m_codeBlock->numberOfJumpTargets(); m_jumpTargetIndex != numberOfJumpTargets; ++m_jumpTargetIndex) {
unsigned jumpTarget = m_codeBlock->jumpTarget(m_jumpTargetIndex);
- if (jumpTarget == bytecodeIndex)
+ if (jumpTarget == bytecodeOffset)
return true;
- if (jumpTarget > bytecodeIndex)
+ if (jumpTarget > bytecodeOffset)
return false;
}
return false;
}
-inline void JIT::map(unsigned bytecodeIndex, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload)
+inline void JIT::map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload)
{
- if (isLabeled(bytecodeIndex))
+ if (isLabeled(bytecodeOffset))
return;
- m_mappedBytecodeIndex = bytecodeIndex;
+ m_mappedBytecodeOffset = bytecodeOffset;
m_mappedVirtualRegisterIndex = virtualRegisterIndex;
m_mappedTag = tag;
m_mappedPayload = payload;
@@ -518,7 +518,7 @@ inline void JIT::unmap(RegisterID registerID)
inline void JIT::unmap()
{
- m_mappedBytecodeIndex = (unsigned)-1;
+ m_mappedBytecodeOffset = (unsigned)-1;
m_mappedVirtualRegisterIndex = (unsigned)-1;
m_mappedTag = (RegisterID)-1;
m_mappedPayload = (RegisterID)-1;
@@ -526,7 +526,7 @@ inline void JIT::unmap()
inline bool JIT::isMapped(unsigned virtualRegisterIndex)
{
- if (m_mappedBytecodeIndex != m_bytecodeIndex)
+ if (m_mappedBytecodeOffset != m_bytecodeOffset)
return false;
if (m_mappedVirtualRegisterIndex != virtualRegisterIndex)
return false;
@@ -535,7 +535,7 @@ inline bool JIT::isMapped(unsigned virtualRegisterIndex)
inline bool JIT::getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload)
{
- if (m_mappedBytecodeIndex != m_bytecodeIndex)
+ if (m_mappedBytecodeOffset != m_bytecodeOffset)
return false;
if (m_mappedVirtualRegisterIndex != virtualRegisterIndex)
return false;
@@ -547,7 +547,7 @@ inline bool JIT::getMappedPayload(unsigned virtualRegisterIndex, RegisterID& pay
inline bool JIT::getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag)
{
- if (m_mappedBytecodeIndex != m_bytecodeIndex)
+ if (m_mappedBytecodeOffset != m_bytecodeOffset)
return false;
if (m_mappedVirtualRegisterIndex != virtualRegisterIndex)
return false;
@@ -559,14 +559,22 @@ inline bool JIT::getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag)
inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex)
{
- if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex))
- addSlowCase(emitJumpIfNotJSCell(virtualRegisterIndex));
+ if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
+ if (m_codeBlock->isConstantRegisterIndex(virtualRegisterIndex))
+ addSlowCase(jump());
+ else
+ addSlowCase(emitJumpIfNotJSCell(virtualRegisterIndex));
+ }
}
inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag)
{
- if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex))
- addSlowCase(branch32(NotEqual, tag, Imm32(JSValue::CellTag)));
+ if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
+ if (m_codeBlock->isConstantRegisterIndex(virtualRegisterIndex))
+ addSlowCase(jump());
+ else
+ addSlowCase(branch32(NotEqual, tag, Imm32(JSValue::CellTag)));
+ }
}
inline void JIT::linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator& iter, unsigned virtualRegisterIndex)
@@ -632,7 +640,7 @@ ALWAYS_INLINE void JIT::killLastResultRegister()
// get arg puts an arg from the SF register array into a h/w register
ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, RegisterID dst)
{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
// TODO: we want to reuse values that are already in registers if we can - add a register allocator!
if (m_codeBlock->isConstantRegisterIndex(src)) {
@@ -644,8 +652,8 @@ ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, RegisterID dst)
if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex(src)) {
bool atJumpTarget = false;
- while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= m_bytecodeIndex) {
- if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == m_bytecodeIndex)
+ while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= m_bytecodeOffset) {
+ if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == m_bytecodeOffset)
atJumpTarget = true;
++m_jumpTargetsPosition;
}
diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp
index 9b0f780..f8be135 100644
--- a/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/JavaScriptCore/jit/JITOpcodes.cpp
@@ -25,9 +25,8 @@
*/
#include "config.h"
-#include "JIT.h"
-
#if ENABLE(JIT)
+#include "JIT.h"
#include "JITInlineMethods.h"
#include "JITStubCall.h"
@@ -42,7 +41,7 @@ namespace JSC {
#if !USE(JSVALUE32_64)
#define RECORD_JUMP_TARGET(targetOffset) \
- do { m_labels[m_bytecodeIndex + (targetOffset)].used(); } while (false)
+ do { m_labels[m_bytecodeOffset + (targetOffset)].used(); } while (false)
void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
{
@@ -259,7 +258,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
move(callFrameRegister, X86Registers::edi);
- call(Address(X86Registers::esi, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(X86Registers::esi, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::r9);
+ call(Address(X86Registers::r9, OBJECT_OFFSETOF(NativeExecutable, m_function)));
addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
#elif CPU(X86)
@@ -337,7 +337,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// Plant callframe
move(callFrameRegister, X86Registers::edx);
- call(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::ebx);
+ call(Address(X86Registers::ebx, OBJECT_OFFSETOF(NativeExecutable, m_function)));
// JSValue is a non-POD type
loadPtr(Address(X86Registers::eax), X86Registers::eax);
@@ -347,7 +348,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// Plant callframe
move(callFrameRegister, X86Registers::ecx);
- call(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::ebx);
+ call(Address(X86Registers::ebx, OBJECT_OFFSETOF(NativeExecutable, m_function)));
#endif
// We've put a few temporaries on the stack in addition to the actual arguments
@@ -395,7 +397,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
subPtr(Imm32(sizeof(Register)), stackPointerRegister);
storePtr(regT0, Address(stackPointerRegister));
- call(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
+ call(Address(regT3, OBJECT_OFFSETOF(NativeExecutable, m_function)));
loadPtr(Address(regT0), regT0);
@@ -413,7 +416,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// Setup arg4: This is a plain hack
move(stackPointerRegister, ARMRegisters::r3);
- call(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
+ call(Address(regT3, OBJECT_OFFSETOF(NativeExecutable, m_function)));
addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
#endif // OS(WINCE)
@@ -460,7 +464,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
addPtr(Imm32(20), stackPointerRegister, MIPSRegisters::a0);
// Call
- call(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ call(Address(regT2, OBJECT_OFFSETOF(NativeExecutable, m_function)));
// Get returned value from 0($v0) which is the same as 20($sp)
loadPtr(Address(returnValueRegister, 0), returnValueRegister);
@@ -535,7 +540,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
trampolines->ctiVirtualConstructLink = trampolineAt(finalCode, virtualConstructLinkBegin);
trampolines->ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
trampolines->ctiVirtualConstruct = trampolineAt(finalCode, virtualConstructBegin);
- trampolines->ctiNativeCallThunk = adoptRef(new NativeExecutable(JITCode(JITCode::HostFunction(trampolineAt(finalCode, nativeCallThunk)))));
+ trampolines->ctiNativeCall = trampolineAt(finalCode, nativeCallThunk);
#if ENABLE(JIT_OPTIMIZE_MOD)
trampolines->ctiSoftModulo = trampolineAt(finalCode, softModBegin);
#endif
@@ -544,6 +549,11 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
#endif
}
+JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr<ExecutablePool>, JSGlobalData* globalData, NativeFunction)
+{
+ return globalData->jitStubs.ctiNativeCall();
+}
+
void JIT::emit_op_mov(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
@@ -711,7 +721,7 @@ void JIT::emit_op_put_global_var(Instruction* currentInstruction)
void JIT::emit_op_get_scoped_var(Instruction* currentInstruction)
{
- int skip = currentInstruction[3].u.operand + m_codeBlock->needsFullScopeChain();
+ int skip = currentInstruction[3].u.operand;
emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT0);
while (skip--)
@@ -724,7 +734,7 @@ void JIT::emit_op_get_scoped_var(Instruction* currentInstruction)
void JIT::emit_op_put_scoped_var(Instruction* currentInstruction)
{
- int skip = currentInstruction[2].u.operand + m_codeBlock->needsFullScopeChain();
+ int skip = currentInstruction[2].u.operand;
emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1);
emitGetVirtualRegister(currentInstruction[3].u.operand, regT0);
@@ -739,12 +749,19 @@ void JIT::emit_op_tear_off_activation(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_tear_off_activation);
stubCall.addArgument(currentInstruction[1].u.operand, regT2);
+ stubCall.addArgument(unmodifiedArgumentsRegister(currentInstruction[2].u.operand), regT2);
stubCall.call();
}
-void JIT::emit_op_tear_off_arguments(Instruction*)
+void JIT::emit_op_tear_off_arguments(Instruction* currentInstruction)
{
- JITStubCall(this, cti_op_tear_off_arguments).call();
+ unsigned dst = currentInstruction[1].u.operand;
+
+ Jump argsNotCreated = branchTestPtr(Zero, Address(callFrameRegister, sizeof(Register) * (unmodifiedArgumentsRegister(dst))));
+ JITStubCall stubCall(this, cti_op_tear_off_arguments);
+ stubCall.addArgument(unmodifiedArgumentsRegister(dst), regT2);
+ stubCall.call();
+ argsNotCreated.link(this);
}
void JIT::emit_op_ret(Instruction* currentInstruction)
@@ -771,6 +788,48 @@ void JIT::emit_op_ret(Instruction* currentInstruction)
ret();
}
+void JIT::emit_op_ret_object_or_this(Instruction* currentInstruction)
+{
+ // We could JIT generate the deref, only calling out to C when the refcount hits zero.
+ if (m_codeBlock->needsFullScopeChain())
+ JITStubCall(this, cti_op_ret_scopeChain).call();
+
+ ASSERT(callFrameRegister != regT1);
+ ASSERT(regT1 != returnValueRegister);
+ ASSERT(returnValueRegister != callFrameRegister);
+
+ // Return the result in %eax.
+ emitGetVirtualRegister(currentInstruction[1].u.operand, returnValueRegister);
+ Jump notJSCell = emitJumpIfNotJSCell(returnValueRegister);
+ loadPtr(Address(returnValueRegister, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ Jump notObject = branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType));
+
+ // Grab the return address.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+
+ // Restore our caller's "r".
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ // Return.
+ restoreReturnAddressBeforeReturn(regT1);
+ ret();
+
+ // Return 'this' in %eax.
+ notJSCell.link(this);
+ notObject.link(this);
+ emitGetVirtualRegister(currentInstruction[2].u.operand, returnValueRegister);
+
+ // Grab the return address.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+
+ // Restore our caller's "r".
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ // Return.
+ restoreReturnAddressBeforeReturn(regT1);
+ ret();
+}
+
void JIT::emit_op_new_array(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_new_array);
@@ -786,16 +845,6 @@ void JIT::emit_op_resolve(Instruction* currentInstruction)
stubCall.call(currentInstruction[1].u.operand);
}
-void JIT::emit_op_construct_verify(Instruction* currentInstruction)
-{
- emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
-
- emitJumpSlowCaseIfNotJSCell(regT0);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
- addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
-
-}
-
void JIT::emit_op_to_primitive(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
@@ -831,7 +880,7 @@ void JIT::emit_op_resolve_skip(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_resolve_skip);
stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
- stubCall.addArgument(Imm32(currentInstruction[3].u.operand + m_codeBlock->needsFullScopeChain()));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -1266,7 +1315,7 @@ void JIT::emit_op_switch_imm(Instruction* currentInstruction)
// create jump table for switch destinations, track this switch statement.
SimpleJumpTable* jumpTable = &m_codeBlock->immediateSwitchJumpTable(tableIndex);
- m_switches.append(SwitchRecord(jumpTable, m_bytecodeIndex, defaultOffset, SwitchRecord::Immediate));
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Immediate));
jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
JITStubCall stubCall(this, cti_op_switch_imm);
@@ -1284,7 +1333,7 @@ void JIT::emit_op_switch_char(Instruction* currentInstruction)
// create jump table for switch destinations, track this switch statement.
SimpleJumpTable* jumpTable = &m_codeBlock->characterSwitchJumpTable(tableIndex);
- m_switches.append(SwitchRecord(jumpTable, m_bytecodeIndex, defaultOffset, SwitchRecord::Character));
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Character));
jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
JITStubCall stubCall(this, cti_op_switch_char);
@@ -1302,7 +1351,7 @@ void JIT::emit_op_switch_string(Instruction* currentInstruction)
// create jump table for switch destinations, track this switch statement.
StringJumpTable* jumpTable = &m_codeBlock->stringSwitchJumpTable(tableIndex);
- m_switches.append(SwitchRecord(jumpTable, m_bytecodeIndex, defaultOffset));
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset));
JITStubCall stubCall(this, cti_op_switch_string);
stubCall.addArgument(scrutinee, regT2);
@@ -1316,7 +1365,7 @@ void JIT::emit_op_new_error(Instruction* currentInstruction)
JITStubCall stubCall(this, cti_op_new_error);
stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->getConstant(currentInstruction[3].u.operand))));
- stubCall.addArgument(Imm32(m_bytecodeIndex));
+ stubCall.addArgument(Imm32(m_bytecodeOffset));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -1407,19 +1456,26 @@ void JIT::emit_op_enter_with_activation(Instruction* currentInstruction)
JITStubCall(this, cti_op_push_activation).call(currentInstruction[1].u.operand);
}
-void JIT::emit_op_create_arguments(Instruction*)
+void JIT::emit_op_create_arguments(Instruction* currentInstruction)
{
- Jump argsCreated = branchTestPtr(NonZero, Address(callFrameRegister, sizeof(Register) * RegisterFile::ArgumentsRegister));
+ unsigned dst = currentInstruction[1].u.operand;
+
+ Jump argsCreated = branchTestPtr(NonZero, Address(callFrameRegister, sizeof(Register) * dst));
if (m_codeBlock->m_numParameters == 1)
JITStubCall(this, cti_op_create_arguments_no_params).call();
else
JITStubCall(this, cti_op_create_arguments).call();
+ emitPutVirtualRegister(dst);
+ emitPutVirtualRegister(unmodifiedArgumentsRegister(dst));
argsCreated.link(this);
}
-
-void JIT::emit_op_init_arguments(Instruction*)
+
+void JIT::emit_op_init_arguments(Instruction* currentInstruction)
{
- storePtr(ImmPtr(0), Address(callFrameRegister, sizeof(Register) * RegisterFile::ArgumentsRegister));
+ unsigned dst = currentInstruction[1].u.operand;
+
+ storePtr(ImmPtr(0), Address(callFrameRegister, sizeof(Register) * dst));
+ storePtr(ImmPtr(0), Address(callFrameRegister, sizeof(Register) * (unmodifiedArgumentsRegister(dst))));
}
void JIT::emit_op_convert_this(Instruction* currentInstruction)
@@ -1467,14 +1523,6 @@ void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowC
stubCall.call(currentInstruction[1].u.operand);
}
-void JIT::emitSlow_op_construct_verify(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- linkSlowCase(iter);
- linkSlowCase(iter);
- emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
- emitPutVirtualRegister(currentInstruction[1].u.operand);
-}
-
void JIT::emitSlow_op_to_primitive(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
{
linkSlowCase(iter);
@@ -1672,7 +1720,7 @@ void JIT::emitSlow_op_to_jsnumber(Instruction* currentInstruction, Vector<SlowCa
void JIT::emit_op_resolve_global_dynamic(Instruction* currentInstruction)
{
- int skip = currentInstruction[6].u.operand + m_codeBlock->needsFullScopeChain();
+ int skip = currentInstruction[6].u.operand;
emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT0);
while (skip--) {
@@ -1688,7 +1736,7 @@ void JIT::emitSlow_op_resolve_global_dynamic(Instruction* currentInstruction, Ve
unsigned dst = currentInstruction[1].u.operand;
void* globalObject = currentInstruction[2].u.jsCell;
Identifier* ident = &m_codeBlock->identifier(currentInstruction[3].u.operand);
- int skip = currentInstruction[6].u.operand + m_codeBlock->needsFullScopeChain();
+ int skip = currentInstruction[6].u.operand;
while (skip--)
linkSlowCase(iter);
JITStubCall resolveStubCall(this, cti_op_resolve);
diff --git a/JavaScriptCore/jit/JITOpcodes32_64.cpp b/JavaScriptCore/jit/JITOpcodes32_64.cpp
index d4edb92..b814801 100644
--- a/JavaScriptCore/jit/JITOpcodes32_64.cpp
+++ b/JavaScriptCore/jit/JITOpcodes32_64.cpp
@@ -25,9 +25,10 @@
*/
#include "config.h"
-#include "JIT.h"
-#if ENABLE(JIT) && USE(JSVALUE32_64)
+#if ENABLE(JIT)
+#if USE(JSVALUE32_64)
+#include "JIT.h"
#include "JITInlineMethods.h"
#include "JITStubCall.h"
@@ -309,14 +310,16 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// Plant callframe
move(callFrameRegister, X86Registers::edx);
- call(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::ebx);
+ call(Address(X86Registers::ebx, OBJECT_OFFSETOF(NativeExecutable, m_function)));
// JSValue is a non-POD type, so eax points to it
emitLoad(0, regT1, regT0, X86Registers::eax);
#else
emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::edx); // callee
move(callFrameRegister, X86Registers::ecx); // callFrame
- call(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::ebx);
+ call(Address(X86Registers::ebx, OBJECT_OFFSETOF(NativeExecutable, m_function)));
#endif
// We've put a few temporaries on the stack in addition to the actual arguments
@@ -373,7 +376,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// Setup arg0:
move(stackPointerRegister, regT0);
- call(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
+ call(Address(regT3, OBJECT_OFFSETOF(NativeExecutable, m_function)));
load32(Address(stackPointerRegister, 0), regT0);
load32(Address(stackPointerRegister, 4), regT1);
@@ -401,7 +405,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// Setup arg1:
move(callFrameRegister, regT1);
- call(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data)));
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
+ call(Address(regT3, OBJECT_OFFSETOF(NativeExecutable, m_function)));
// Load return value
load32(Address(stackPointerRegister, 16), regT0);
@@ -476,7 +481,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
trampolines->ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
trampolines->ctiVirtualConstruct = trampolineAt(finalCode, virtualConstructBegin);
- trampolines->ctiNativeCallThunk = adoptRef(new NativeExecutable(JITCode(JITCode::HostFunction(trampolineAt(finalCode, nativeCallThunk)))));
+ trampolines->ctiNativeCall = trampolineAt(finalCode, nativeCallThunk);
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
trampolines->ctiStringLengthTrampoline = trampolineAt(finalCode, stringLengthBegin);
#endif
@@ -489,6 +494,251 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
#endif
}
+JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr<ExecutablePool> executablePool, JSGlobalData* globalData, NativeFunction func)
+{
+#if CPU(X86) || CPU(ARM_TRADITIONAL)
+ Label nativeCallThunk = align();
+ preserveReturnAddressAfterCall(regT0);
+ emitPutToCallFrameHeader(regT0, RegisterFile::ReturnPC); // Push return address
+
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT1);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT1);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+#if CPU(X86)
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
+
+ /* We have two structs that we use to describe the stackframe we set up for our
+ * call to native code. NativeCallFrameStructure describes the how we set up the stack
+ * in advance of the call. NativeFunctionCalleeSignature describes the callframe
+ * as the native code expects it. We do this as we are using the fastcall calling
+ * convention which results in the callee popping its arguments off the stack, but
+ * not the rest of the callframe so we need a nice way to ensure we increment the
+ * stack pointer by the right amount after the call.
+ */
+
+#if COMPILER(MSVC) || OS(LINUX)
+#if COMPILER(MSVC)
+#pragma pack(push)
+#pragma pack(4)
+#endif // COMPILER(MSVC)
+ struct NativeCallFrameStructure {
+ // CallFrame* callFrame; // passed in EDX
+ JSObject* callee;
+ JSValue thisValue;
+ ArgList* argPointer;
+ ArgList args;
+ JSValue result;
+ };
+ struct NativeFunctionCalleeSignature {
+ JSObject* callee;
+ JSValue thisValue;
+ ArgList* argPointer;
+ };
+#if COMPILER(MSVC)
+#pragma pack(pop)
+#endif // COMPILER(MSVC)
+#else
+ struct NativeCallFrameStructure {
+ // CallFrame* callFrame; // passed in ECX
+ // JSObject* callee; // passed in EDX
+ JSValue thisValue;
+ ArgList* argPointer;
+ ArgList args;
+ };
+ struct NativeFunctionCalleeSignature {
+ JSValue thisValue;
+ ArgList* argPointer;
+ };
+#endif
+
+ const int NativeCallFrameSize = (sizeof(NativeCallFrameStructure) + 15) & ~15;
+ // Allocate system stack frame
+ subPtr(Imm32(NativeCallFrameSize), stackPointerRegister);
+
+ // Set up arguments
+ subPtr(Imm32(1), regT0); // Don't include 'this' in argcount
+
+ // push argcount
+ storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, args) + OBJECT_OFFSETOF(ArgList, m_argCount)));
+
+ // Calculate the start of the callframe header, and store in regT1
+ addPtr(Imm32(-RegisterFile::CallFrameHeaderSize * (int)sizeof(Register)), callFrameRegister, regT1);
+
+ // Calculate start of arguments as callframe header - sizeof(Register) * argcount (regT0)
+ mul32(Imm32(sizeof(Register)), regT0, regT0);
+ subPtr(regT0, regT1);
+ storePtr(regT1, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, args) + OBJECT_OFFSETOF(ArgList, m_args)));
+
+ // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
+ addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, args)), stackPointerRegister, regT0);
+ storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, argPointer)));
+
+ // regT1 currently points to the first argument, regT1 - sizeof(Register) points to 'this'
+ loadPtr(Address(regT1, -(int)sizeof(Register) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT2);
+ loadPtr(Address(regT1, -(int)sizeof(Register) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT3);
+ storePtr(regT2, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, thisValue) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)));
+ storePtr(regT3, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, thisValue) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)));
+
+#if COMPILER(MSVC) || OS(LINUX)
+ // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
+ addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, result)), stackPointerRegister, X86Registers::ecx);
+
+ // Plant callee
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::eax);
+ storePtr(X86Registers::eax, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, callee)));
+
+ // Plant callframe
+ move(callFrameRegister, X86Registers::edx);
+
+ Call nativeCall = call();
+
+ // JSValue is a non-POD type, so eax points to it
+ emitLoad(0, regT1, regT0, X86Registers::eax);
+#else
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::edx); // callee
+ move(callFrameRegister, X86Registers::ecx); // callFrame
+ Call nativeCall = call();
+#endif
+
+ // We've put a few temporaries on the stack in addition to the actual arguments
+ // so pull them off now
+ addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister);
+
+#elif CPU(ARM_TRADITIONAL)
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
+
+ // Allocate stack space for our arglist
+ COMPILE_ASSERT((sizeof(ArgList) & 0x7) == 0 && sizeof(JSValue) == 8 && sizeof(Register) == 8, ArgList_should_by_8byte_aligned);
+ subPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
+
+ // Set up arguments
+ subPtr(Imm32(1), regT0); // Don't include 'this' in argcount
+
+ // Push argcount
+ storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_argCount)));
+
+ // Calculate the start of the callframe header, and store in regT1
+ move(callFrameRegister, regT1);
+ sub32(Imm32(RegisterFile::CallFrameHeaderSize * (int32_t)sizeof(Register)), regT1);
+
+ // Calculate start of arguments as callframe header - sizeof(Register) * argcount (regT1)
+ mul32(Imm32(sizeof(Register)), regT0, regT0);
+ subPtr(regT0, regT1);
+
+ // push pointer to arguments
+ storePtr(regT1, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_args)));
+
+ // Argument passing method:
+ // r0 - points to return value
+ // r1 - callFrame
+ // r2 - callee
+ // stack: this(JSValue) and a pointer to ArgList
+
+#if OS(WINCE)
+ // Setup arg4:
+ push(stackPointerRegister);
+
+ // Setup arg3:
+ // regT1 currently points to the first argument, regT1-sizeof(Register) points to 'this'
+ load32(Address(regT1, -(int32_t)sizeof(void*) * 2), ARMRegisters::r3);
+ push(ARMRegisters::r3);
+ load32(Address(regT1, -(int32_t)sizeof(void*)), regT3);
+ storePtr(regT3, Address(stackPointerRegister));
+
+ // Setup arg2:
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT2);
+
+ // Setup arg1:
+ move(callFrameRegister, regT1);
+
+ // Setup arg0:
+ move(stackPointerRegister, regT0);
+
+ Call nativeCall = call();
+
+ load32(Address(stackPointerRegister, 0), regT0);
+ load32(Address(stackPointerRegister, 4), regT1);
+
+ addPtr(Imm32(sizeof(ArgList) + 8), stackPointerRegister);
+#else // OS(WINCE)
+ move(stackPointerRegister, regT3);
+ subPtr(Imm32(8), stackPointerRegister);
+ move(stackPointerRegister, regT0);
+ subPtr(Imm32(8 + 4 + 4 /* padding */), stackPointerRegister);
+
+ // Setup arg4:
+ storePtr(regT3, Address(stackPointerRegister, 8));
+
+ // Setup arg3:
+ // regT1 currently points to the first argument, regT1-sizeof(Register) points to 'this'
+ load32(Address(regT1, -(int32_t)sizeof(void*) * 2), regT3);
+ storePtr(regT3, Address(stackPointerRegister, 0));
+ load32(Address(regT1, -(int32_t)sizeof(void*)), regT3);
+ storePtr(regT3, Address(stackPointerRegister, 4));
+
+ // Setup arg2:
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT2);
+
+ // Setup arg1:
+ move(callFrameRegister, regT1);
+
+ Call nativeCall = call();
+
+ // Load return value
+ load32(Address(stackPointerRegister, 16), regT0);
+ load32(Address(stackPointerRegister, 20), regT1);
+
+ addPtr(Imm32(sizeof(ArgList) + 16 + 8), stackPointerRegister);
+#endif // OS(WINCE)
+
+#endif
+
+ // Check for an exception
+ move(ImmPtr(&globalData->exception), regT2);
+ Jump sawException = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::EmptyValueTag));
+
+ // Grab the return address.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT3);
+
+ // Restore our caller's "r".
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ // Return.
+ restoreReturnAddressBeforeReturn(regT3);
+ ret();
+
+ // Handle an exception
+ sawException.link(this);
+ // Grab the return address.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+ move(ImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ move(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()), regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+ restoreReturnAddressBeforeReturn(regT2);
+ ret();
+
+#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
+#else
+ breakpoint();
+#endif
+
+ // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object.
+ LinkBuffer patchBuffer(this, executablePool);
+
+#if ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+ patchBuffer.link(nativeCall, FunctionPtr(func));
+#endif
+
+ CodeRef finalCode = patchBuffer.finalizeCode();
+ return trampolineAt(finalCode, nativeCallThunk);
+}
+
void JIT::emit_op_mov(Instruction* currentInstruction)
{
unsigned dst = currentInstruction[1].u.operand;
@@ -499,7 +749,7 @@ void JIT::emit_op_mov(Instruction* currentInstruction)
else {
emitLoad(src, regT1, regT0);
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_mov), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_mov), dst, regT1, regT0);
}
}
@@ -649,7 +899,7 @@ void JIT::emit_op_get_global_var(Instruction* currentInstruction)
emitLoad(index, regT1, regT0, regT2);
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_get_global_var), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_global_var), dst, regT1, regT0);
}
void JIT::emit_op_put_global_var(Instruction* currentInstruction)
@@ -663,14 +913,14 @@ void JIT::emit_op_put_global_var(Instruction* currentInstruction)
loadPtr(&globalObject->d()->registers, regT2);
emitStore(index, regT1, regT0, regT2);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_put_global_var), value, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_put_global_var), value, regT1, regT0);
}
void JIT::emit_op_get_scoped_var(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
int index = currentInstruction[2].u.operand;
- int skip = currentInstruction[3].u.operand + m_codeBlock->needsFullScopeChain();
+ int skip = currentInstruction[3].u.operand;
emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT2);
while (skip--)
@@ -682,13 +932,13 @@ void JIT::emit_op_get_scoped_var(Instruction* currentInstruction)
emitLoad(index, regT1, regT0, regT2);
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_get_scoped_var), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_scoped_var), dst, regT1, regT0);
}
void JIT::emit_op_put_scoped_var(Instruction* currentInstruction)
{
int index = currentInstruction[1].u.operand;
- int skip = currentInstruction[2].u.operand + m_codeBlock->needsFullScopeChain();
+ int skip = currentInstruction[2].u.operand;
int value = currentInstruction[3].u.operand;
emitLoad(value, regT1, regT0);
@@ -702,19 +952,26 @@ void JIT::emit_op_put_scoped_var(Instruction* currentInstruction)
loadPtr(Address(regT2, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), regT2);
emitStore(index, regT1, regT0, regT2);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_put_scoped_var), value, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_put_scoped_var), value, regT1, regT0);
}
void JIT::emit_op_tear_off_activation(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_tear_off_activation);
stubCall.addArgument(currentInstruction[1].u.operand);
+ stubCall.addArgument(unmodifiedArgumentsRegister(currentInstruction[2].u.operand));
stubCall.call();
}
-void JIT::emit_op_tear_off_arguments(Instruction*)
+void JIT::emit_op_tear_off_arguments(Instruction* currentInstruction)
{
- JITStubCall(this, cti_op_tear_off_arguments).call();
+ int dst = currentInstruction[1].u.operand;
+
+ Jump argsNotCreated = branch32(Equal, tagFor(unmodifiedArgumentsRegister(dst)), Imm32(JSValue::EmptyValueTag));
+ JITStubCall stubCall(this, cti_op_tear_off_arguments);
+ stubCall.addArgument(unmodifiedArgumentsRegister(dst));
+ stubCall.call();
+ argsNotCreated.link(this);
}
void JIT::emit_op_new_array(Instruction* currentInstruction)
@@ -745,7 +1002,7 @@ void JIT::emit_op_to_primitive(Instruction* currentInstruction)
if (dst != src)
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_to_primitive), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_to_primitive), dst, regT1, regT0);
}
void JIT::emitSlow_op_to_primitive(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -778,7 +1035,7 @@ void JIT::emit_op_resolve_skip(Instruction* currentInstruction)
{
JITStubCall stubCall(this, cti_op_resolve_skip);
stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
- stubCall.addArgument(Imm32(currentInstruction[3].u.operand + m_codeBlock->needsFullScopeChain()));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
stubCall.call(currentInstruction[1].u.operand);
}
@@ -804,7 +1061,7 @@ void JIT::emit_op_resolve_global(Instruction* currentInstruction, bool dynamic)
load32(BaseIndex(regT2, regT3, TimesEight), regT0); // payload
load32(BaseIndex(regT2, regT3, TimesEight, 4), regT1); // tag
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + dynamic ? OPCODE_LENGTH(op_resolve_global_dynamic) : OPCODE_LENGTH(op_resolve_global), dst, regT1, regT0);
+ map(m_bytecodeOffset + dynamic ? OPCODE_LENGTH(op_resolve_global_dynamic) : OPCODE_LENGTH(op_resolve_global), dst, regT1, regT0);
}
void JIT::emitSlow_op_resolve_global(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -1390,7 +1647,7 @@ void JIT::emit_op_to_jsnumber(Instruction* currentInstruction)
if (src != dst)
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_to_jsnumber), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_to_jsnumber), dst, regT1, regT0);
}
void JIT::emitSlow_op_to_jsnumber(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -1424,7 +1681,7 @@ void JIT::emit_op_catch(Instruction* currentInstruction)
// Now store the exception returned by cti_op_throw.
emitStore(exception, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_catch), exception, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_catch), exception, regT1, regT0);
}
void JIT::emit_op_jmp_scopes(Instruction* currentInstruction)
@@ -1443,7 +1700,7 @@ void JIT::emit_op_switch_imm(Instruction* currentInstruction)
// create jump table for switch destinations, track this switch statement.
SimpleJumpTable* jumpTable = &m_codeBlock->immediateSwitchJumpTable(tableIndex);
- m_switches.append(SwitchRecord(jumpTable, m_bytecodeIndex, defaultOffset, SwitchRecord::Immediate));
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Immediate));
jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
JITStubCall stubCall(this, cti_op_switch_imm);
@@ -1461,7 +1718,7 @@ void JIT::emit_op_switch_char(Instruction* currentInstruction)
// create jump table for switch destinations, track this switch statement.
SimpleJumpTable* jumpTable = &m_codeBlock->characterSwitchJumpTable(tableIndex);
- m_switches.append(SwitchRecord(jumpTable, m_bytecodeIndex, defaultOffset, SwitchRecord::Character));
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Character));
jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
JITStubCall stubCall(this, cti_op_switch_char);
@@ -1479,7 +1736,7 @@ void JIT::emit_op_switch_string(Instruction* currentInstruction)
// create jump table for switch destinations, track this switch statement.
StringJumpTable* jumpTable = &m_codeBlock->stringSwitchJumpTable(tableIndex);
- m_switches.append(SwitchRecord(jumpTable, m_bytecodeIndex, defaultOffset));
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset));
JITStubCall stubCall(this, cti_op_switch_string);
stubCall.addArgument(scrutinee);
@@ -1497,7 +1754,7 @@ void JIT::emit_op_new_error(Instruction* currentInstruction)
JITStubCall stubCall(this, cti_op_new_error);
stubCall.addArgument(Imm32(type));
stubCall.addArgument(m_codeBlock->getConstant(message));
- stubCall.addArgument(Imm32(m_bytecodeIndex));
+ stubCall.addArgument(Imm32(m_bytecodeOffset));
stubCall.call(dst);
}
@@ -1532,22 +1789,29 @@ void JIT::emit_op_enter_with_activation(Instruction* currentInstruction)
JITStubCall(this, cti_op_push_activation).call(currentInstruction[1].u.operand);
}
-void JIT::emit_op_create_arguments(Instruction*)
+void JIT::emit_op_create_arguments(Instruction* currentInstruction)
{
- Jump argsCreated = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::EmptyValueTag));
+ unsigned dst = currentInstruction[1].u.operand;
+
+ Jump argsCreated = branch32(NotEqual, tagFor(dst), Imm32(JSValue::EmptyValueTag));
- // If we get here the arguments pointer is a null cell - i.e. arguments need lazy creation.
if (m_codeBlock->m_numParameters == 1)
JITStubCall(this, cti_op_create_arguments_no_params).call();
else
JITStubCall(this, cti_op_create_arguments).call();
+ emitStore(dst, regT1, regT0);
+ emitStore(unmodifiedArgumentsRegister(dst), regT1, regT0);
+
argsCreated.link(this);
}
-void JIT::emit_op_init_arguments(Instruction*)
+void JIT::emit_op_init_arguments(Instruction* currentInstruction)
{
- emitStore(RegisterFile::ArgumentsRegister, JSValue(), callFrameRegister);
+ unsigned dst = currentInstruction[1].u.operand;
+
+ emitStore(dst, JSValue());
+ emitStore(unmodifiedArgumentsRegister(dst), JSValue());
}
void JIT::emit_op_convert_this(Instruction* currentInstruction)
@@ -1561,7 +1825,7 @@ void JIT::emit_op_convert_this(Instruction* currentInstruction)
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
addSlowCase(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
- map(m_bytecodeIndex + OPCODE_LENGTH(op_convert_this), thisRegister, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_convert_this), thisRegister, regT1, regT0);
}
void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -1598,6 +1862,7 @@ void JIT::emit_op_profile_did_call(Instruction* currentInstruction)
noProfiler.link(this);
}
-}
+} // namespace JSC
-#endif // ENABLE(JIT) && USE(JSVALUE32_64)
+#endif // USE(JSVALUE32_64)
+#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITPropertyAccess.cpp b/JavaScriptCore/jit/JITPropertyAccess.cpp
index 399afdd..4d36cfa 100644
--- a/JavaScriptCore/jit/JITPropertyAccess.cpp
+++ b/JavaScriptCore/jit/JITPropertyAccess.cpp
@@ -25,12 +25,10 @@
#include "config.h"
+#if ENABLE(JIT)
#if !USE(JSVALUE32_64)
-
#include "JIT.h"
-#if ENABLE(JIT)
-
#include "CodeBlock.h"
#include "GetterSetter.h"
#include "JITInlineMethods.h"
@@ -52,7 +50,7 @@ using namespace std;
namespace JSC {
-PassRefPtr<NativeExecutable> JIT::stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+JIT::CodePtr JIT::stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool)
{
JSInterfaceJIT jit;
JumpList failures;
@@ -80,7 +78,7 @@ PassRefPtr<NativeExecutable> JIT::stringGetByValStubGenerator(JSGlobalData* glob
jit.ret();
LinkBuffer patchBuffer(&jit, pool);
- return adoptRef(new NativeExecutable(patchBuffer.finalizeCode()));
+ return patchBuffer.finalizeCode().m_code;
}
void JIT::emit_op_get_by_val(Instruction* currentInstruction)
@@ -125,7 +123,7 @@ void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, Vector<SlowCas
Jump nonCell = jump();
linkSlowCase(iter); // base array check
Jump notString = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr));
- emitNakedCall(m_globalData->getThunk(stringGetByValStubGenerator)->generatedJITCodeForCall().addressForCall());
+ emitNakedCall(m_globalData->getCTIStub(stringGetByValStubGenerator));
Jump failed = branchTestPtr(Zero, regT0);
emitPutVirtualRegister(dst, regT0);
emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
@@ -380,7 +378,7 @@ void JIT::emit_op_method_check(Instruction* currentInstruction)
emitPutVirtualRegister(resultVReg);
// We've already generated the following get_by_id, so make sure it's skipped over.
- m_bytecodeIndex += OPCODE_LENGTH(op_get_by_id);
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
}
void JIT::emitSlow_op_method_check(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -393,7 +391,7 @@ void JIT::emitSlow_op_method_check(Instruction* currentInstruction, Vector<SlowC
compileGetByIdSlowCase(resultVReg, baseVReg, ident, iter, true);
// We've already generated the following get_by_id, so make sure it's skipped over.
- m_bytecodeIndex += OPCODE_LENGTH(op_get_by_id);
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
}
#else //!ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
@@ -1112,6 +1110,5 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str
} // namespace JSC
-#endif // ENABLE(JIT)
-
#endif // !USE(JSVALUE32_64)
+#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
index 792583b..6b8af7c 100644
--- a/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
+++ b/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
@@ -25,12 +25,10 @@
#include "config.h"
+#if ENABLE(JIT)
#if USE(JSVALUE32_64)
-
#include "JIT.h"
-#if ENABLE(JIT)
-
#include "CodeBlock.h"
#include "JITInlineMethods.h"
#include "JITStubCall.h"
@@ -241,10 +239,10 @@ void JIT::emit_op_method_check(Instruction* currentInstruction)
match.link(this);
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_method_check), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_method_check), dst, regT1, regT0);
// We've already generated the following get_by_id, so make sure it's skipped over.
- m_bytecodeIndex += OPCODE_LENGTH(op_get_by_id);
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
}
void JIT::emitSlow_op_method_check(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -258,7 +256,7 @@ void JIT::emitSlow_op_method_check(Instruction* currentInstruction, Vector<SlowC
compileGetByIdSlowCase(dst, base, &(m_codeBlock->identifier(ident)), iter, true);
// We've already generated the following get_by_id, so make sure it's skipped over.
- m_bytecodeIndex += OPCODE_LENGTH(op_get_by_id);
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
}
#else //!ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
@@ -269,7 +267,7 @@ void JIT::emitSlow_op_method_check(Instruction*, Vector<SlowCaseEntry>::iterator
#endif
-PassRefPtr<NativeExecutable> JIT::stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+JIT::CodePtr JIT::stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool)
{
JSInterfaceJIT jit;
JumpList failures;
@@ -298,7 +296,7 @@ PassRefPtr<NativeExecutable> JIT::stringGetByValStubGenerator(JSGlobalData* glob
jit.ret();
LinkBuffer patchBuffer(&jit, pool);
- return adoptRef(new NativeExecutable(patchBuffer.finalizeCode()));
+ return patchBuffer.finalizeCode().m_code;
}
void JIT::emit_op_get_by_val(Instruction* currentInstruction)
@@ -321,7 +319,7 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction)
addSlowCase(branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag)));
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_get_by_val), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_val), dst, regT1, regT0);
}
void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -336,7 +334,7 @@ void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, Vector<SlowCas
Jump nonCell = jump();
linkSlowCase(iter); // base array check
Jump notString = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr));
- emitNakedCall(m_globalData->getThunk(stringGetByValStubGenerator)->generatedJITCodeForCall().addressForCall());
+ emitNakedCall(m_globalData->getCTIStub(stringGetByValStubGenerator));
Jump failed = branchTestPtr(Zero, regT0);
emitStore(dst, regT1, regT0);
emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
@@ -414,7 +412,7 @@ void JIT::emit_op_get_by_id(Instruction* currentInstruction)
emitJumpSlowCaseIfNotJSCell(base, regT1);
compileGetByIdHotPath();
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_get_by_id), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_id), dst, regT1, regT0);
}
void JIT::compileGetByIdHotPath()
@@ -1159,7 +1157,7 @@ void JIT::emit_op_get_by_pname(Instruction* currentInstruction)
compileGetDirectOffset(regT2, regT1, regT0, regT0, regT3);
emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_get_by_pname), dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_pname), dst, regT1, regT0);
}
void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
@@ -1182,7 +1180,5 @@ void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector<SlowC
} // namespace JSC
+#endif // USE(JSVALUE32_64)
#endif // ENABLE(JIT)
-
-#endif // ENABLE(JSVALUE32_64)
-
diff --git a/JavaScriptCore/jit/JITStubCall.h b/JavaScriptCore/jit/JITStubCall.h
index 70d2893..4478d06 100644
--- a/JavaScriptCore/jit/JITStubCall.h
+++ b/JavaScriptCore/jit/JITStubCall.h
@@ -167,17 +167,17 @@ namespace JSC {
JIT::Call call()
{
#if ENABLE(OPCODE_SAMPLING)
- if (m_jit->m_bytecodeIndex != (unsigned)-1)
- m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeIndex, true);
+ if (m_jit->m_bytecodeOffset != (unsigned)-1)
+ m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, true);
#endif
m_jit->restoreArgumentReference();
JIT::Call call = m_jit->call();
- m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeIndex, m_stub.value()));
+ m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeOffset, m_stub.value()));
#if ENABLE(OPCODE_SAMPLING)
- if (m_jit->m_bytecodeIndex != (unsigned)-1)
- m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeIndex, false);
+ if (m_jit->m_bytecodeOffset != (unsigned)-1)
+ m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, false);
#endif
#if USE(JSVALUE32_64)
diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp
index 3d1c272..aea80a7 100644
--- a/JavaScriptCore/jit/JITStubs.cpp
+++ b/JavaScriptCore/jit/JITStubs.cpp
@@ -28,9 +28,9 @@
*/
#include "config.h"
-#include "JITStubs.h"
#if ENABLE(JIT)
+#include "JITStubs.h"
#include "Arguments.h"
#include "CallFrame.h"
@@ -113,7 +113,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x3c, JITStackFrame_s
COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline);
-asm volatile (
+asm (
".text\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
HIDE_SYMBOL(ctiTrampoline) "\n"
@@ -135,7 +135,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
@@ -151,7 +151,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
@@ -176,7 +176,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x48, JITStackFrame_s
COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x90, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x80, JITStackFrame_code_offset_matches_ctiTrampoline);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
HIDE_SYMBOL(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
@@ -203,7 +203,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
@@ -219,7 +219,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
@@ -332,7 +332,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x38, JITStackFrame_
COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x30, JITStackFrame_code_offset_matches_ctiTrampoline);
COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
-asm volatile (
+asm (
".text\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
HIDE_SYMBOL(ctiTrampoline) "\n"
@@ -354,7 +354,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
@@ -370,7 +370,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
@@ -394,7 +394,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_
COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x48, JITStackFrame_code_offset_matches_ctiTrampoline);
COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x78, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
-asm volatile (
+asm (
".text\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
HIDE_SYMBOL(ctiTrampoline) "\n"
@@ -429,7 +429,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
@@ -445,7 +445,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"ret" "\n"
);
-asm volatile (
+asm (
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
@@ -1082,7 +1082,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD
extern "C" { \
rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
}; \
- asm volatile ( \
+ asm ( \
".text" "\n" \
".align 2" "\n" \
".globl " SYMBOL_STRING(cti_##op) "\n" \
@@ -1162,7 +1162,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD
extern "C" { \
rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
}; \
- asm volatile ( \
+ asm ( \
".globl " SYMBOL_STRING(cti_##op) "\n" \
SYMBOL_STRING(cti_##op) ":" "\n" \
"str lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
@@ -1717,7 +1717,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_instanceof)
if (!baseVal.isObject() || !(typeInfo = asObject(baseVal)->structure()->typeInfo()).implementsHasInstance()) {
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -2002,27 +2002,25 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction)
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createNotAFunctionError(stackFrame.callFrame, funcVal, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
-DEFINE_STUB_FUNCTION(void, op_create_arguments)
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_arguments)
{
STUB_INIT_STACK_FRAME(stackFrame);
Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame);
- stackFrame.callFrame->setCalleeArguments(arguments);
- stackFrame.callFrame[RegisterFile::ArgumentsRegister] = JSValue(arguments);
+ return JSValue::encode(JSValue(arguments));
}
-DEFINE_STUB_FUNCTION(void, op_create_arguments_no_params)
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_arguments_no_params)
{
STUB_INIT_STACK_FRAME(stackFrame);
Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame, Arguments::NoParameters);
- stackFrame.callFrame->setCalleeArguments(arguments);
- stackFrame.callFrame[RegisterFile::ArgumentsRegister] = JSValue(arguments);
+ return JSValue::encode(JSValue(arguments));
}
DEFINE_STUB_FUNCTION(void, op_tear_off_activation)
@@ -2030,7 +2028,10 @@ DEFINE_STUB_FUNCTION(void, op_tear_off_activation)
STUB_INIT_STACK_FRAME(stackFrame);
ASSERT(stackFrame.callFrame->codeBlock()->needsFullScopeChain());
- asActivation(stackFrame.args[0].jsValue())->copyRegisters(stackFrame.callFrame->optionalCalleeArguments());
+ JSActivation* activation = asActivation(stackFrame.args[0].jsValue());
+ activation->copyRegisters();
+ if (JSValue v = stackFrame.args[1].jsValue())
+ asArguments(v)->setActivation(activation);
}
DEFINE_STUB_FUNCTION(void, op_tear_off_arguments)
@@ -2038,8 +2039,7 @@ DEFINE_STUB_FUNCTION(void, op_tear_off_arguments)
STUB_INIT_STACK_FRAME(stackFrame);
ASSERT(stackFrame.callFrame->codeBlock()->usesArguments() && !stackFrame.callFrame->codeBlock()->needsFullScopeChain());
- if (stackFrame.callFrame->optionalCalleeArguments())
- stackFrame.callFrame->optionalCalleeArguments()->copyRegisters();
+ asArguments(stackFrame.args[0].jsValue())->copyRegisters();
}
DEFINE_STUB_FUNCTION(void, op_profile_will_call)
@@ -2097,7 +2097,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve)
} while (++iter != end);
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -2110,7 +2110,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct)
if (constructor->isHostFunction()) {
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createNotAConstructorError(callFrame, constructor, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -2157,7 +2157,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct)
ASSERT(constructType == ConstructTypeNone);
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createNotAConstructorError(callFrame, constrVal, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -2175,6 +2175,8 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_val)
if (LIKELY(baseValue.isCell() && subscript.isString())) {
Identifier propertyName(callFrame, asString(subscript)->value(callFrame));
PropertySlot slot(asCell(baseValue));
+ // JSString::value may have thrown, but we shouldn't find a property with a null identifier,
+ // so we should miss this case and wind up in the CHECK_FOR_EXCEPTION_AT_END, below.
if (asCell(baseValue)->fastGetOwnPropertySlot(callFrame, propertyName, slot)) {
JSValue result = slot.getValue(callFrame, propertyName);
CHECK_FOR_EXCEPTION();
@@ -2426,7 +2428,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs)
} else if (!arguments.isUndefinedOrNull()) {
if (!arguments.isObject()) {
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -2466,7 +2468,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs)
}
} else {
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -2526,7 +2528,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_skip)
} while (++iter != end);
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -2558,7 +2560,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_global)
return JSValue::encode(result);
}
- unsigned vPCIndex = callFrame->codeBlock()->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = callFrame->codeBlock()->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, callFrame->codeBlock());
VM_THROW_EXCEPTION();
}
@@ -2860,7 +2862,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_with_base)
} while (iter != end);
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, codeBlock);
VM_THROW_EXCEPTION_AT_END();
return JSValue::encode(JSValue());
@@ -2959,7 +2961,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_regexp)
{
STUB_INIT_STACK_FRAME(stackFrame);
- return new (stackFrame.globalData) RegExpObject(stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), stackFrame.args[0].regExp());
+ return new (stackFrame.globalData) RegExpObject(stackFrame.callFrame->lexicalGlobalObject(), stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), stackFrame.args[0].regExp());
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_bitor)
@@ -3014,7 +3016,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_throw)
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
JSValue exceptionValue = stackFrame.args[0].jsValue();
ASSERT(exceptionValue);
@@ -3053,7 +3055,9 @@ DEFINE_STUB_FUNCTION(int, has_property)
JSObject* base = stackFrame.args[0].jsObject();
JSString* property = stackFrame.args[1].jsString();
- return base->hasProperty(stackFrame.callFrame, Identifier(stackFrame.callFrame, property->value(stackFrame.callFrame)));
+ int result = base->hasProperty(stackFrame.callFrame, Identifier(stackFrame.callFrame, property->value(stackFrame.callFrame)));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
}
DEFINE_STUB_FUNCTION(JSObject*, op_push_scope)
@@ -3130,7 +3134,9 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_stricteq)
JSValue src1 = stackFrame.args[0].jsValue();
JSValue src2 = stackFrame.args[1].jsValue();
- return JSValue::encode(jsBoolean(JSValue::strictEqual(stackFrame.callFrame, src1, src2)));
+ bool result = JSValue::strictEqual(stackFrame.callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(jsBoolean(result));
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_to_primitive)
@@ -3156,7 +3162,9 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_nstricteq)
JSValue src1 = stackFrame.args[0].jsValue();
JSValue src2 = stackFrame.args[1].jsValue();
- return JSValue::encode(jsBoolean(!JSValue::strictEqual(stackFrame.callFrame, src1, src2)));
+ bool result = !JSValue::strictEqual(stackFrame.callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(jsBoolean(result));
}
DEFINE_STUB_FUNCTION(EncodedJSValue, op_to_jsnumber)
@@ -3181,7 +3189,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_in)
if (!baseVal.isObject()) {
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createInvalidParamError(callFrame, "in", baseVal, vPCIndex, codeBlock);
VM_THROW_EXCEPTION();
}
@@ -3270,6 +3278,7 @@ DEFINE_STUB_FUNCTION(void*, op_switch_char)
result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue(value->characters()[0]).executableAddress();
}
+ CHECK_FOR_EXCEPTION_AT_END();
return result;
}
@@ -3289,6 +3298,7 @@ DEFINE_STUB_FUNCTION(void*, op_switch_string)
result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value).executableAddress();
}
+ CHECK_FOR_EXCEPTION_AT_END();
return result;
}
@@ -3376,7 +3386,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw)
CodeBlock* codeBlock = callFrame->codeBlock();
JSGlobalData* globalData = stackFrame.globalData;
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, globalData->exceptionLocation);
+ unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, globalData->exceptionLocation);
JSValue exceptionValue = globalData->exception;
ASSERT(exceptionValue);
@@ -3404,13 +3414,28 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, to_object)
return JSValue::encode(stackFrame.args[0].jsValue().toObject(callFrame));
}
-NativeExecutable* JITThunks::specializedThunk(JSGlobalData* globalData, ThunkGenerator generator)
+MacroAssemblerCodePtr JITThunks::ctiStub(JSGlobalData* globalData, ThunkGenerator generator)
+{
+ std::pair<CTIStubMap::iterator, bool> entry = m_ctiStubMap.add(generator, MacroAssemblerCodePtr());
+ if (entry.second)
+ entry.first->second = generator(globalData, m_executablePool.get());
+ return entry.first->second;
+}
+
+PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function)
+{
+ std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
+ if (entry.second)
+ entry.first->second = NativeExecutable::create(JIT::compileCTINativeCall(globalData, m_executablePool, function), function);
+ return entry.first->second;
+}
+
+PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator)
{
- std::pair<ThunkMap::iterator, bool> entry = m_thunkMap.add(generator, 0);
- if (!entry.second)
- return entry.first->second.get();
- entry.first->second = generator(globalData, m_executablePool.get());
- return entry.first->second.get();
+ std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
+ if (entry.second)
+ entry.first->second = NativeExecutable::create(generator(globalData, m_executablePool.get()), function);
+ return entry.first->second;
}
} // namespace JSC
diff --git a/JavaScriptCore/jit/JITStubs.h b/JavaScriptCore/jit/JITStubs.h
index 841950f..e5d1419 100644
--- a/JavaScriptCore/jit/JITStubs.h
+++ b/JavaScriptCore/jit/JITStubs.h
@@ -81,7 +81,7 @@ namespace JSC {
MacroAssemblerCodePtr ctiVirtualConstructLink;
MacroAssemblerCodePtr ctiVirtualCall;
MacroAssemblerCodePtr ctiVirtualConstruct;
- RefPtr<NativeExecutable> ctiNativeCallThunk;
+ MacroAssemblerCodePtr ctiNativeCall;
MacroAssemblerCodePtr ctiSoftModulo;
};
@@ -279,13 +279,18 @@ namespace JSC {
MacroAssemblerCodePtr ctiVirtualConstructLink() { return m_trampolineStructure.ctiVirtualConstructLink; }
MacroAssemblerCodePtr ctiVirtualCall() { return m_trampolineStructure.ctiVirtualCall; }
MacroAssemblerCodePtr ctiVirtualConstruct() { return m_trampolineStructure.ctiVirtualConstruct; }
- NativeExecutable* ctiNativeCallThunk() { return m_trampolineStructure.ctiNativeCallThunk.get(); }
+ MacroAssemblerCodePtr ctiNativeCall() { return m_trampolineStructure.ctiNativeCall; }
MacroAssemblerCodePtr ctiSoftModulo() { return m_trampolineStructure.ctiSoftModulo; }
- NativeExecutable* specializedThunk(JSGlobalData* globalData, ThunkGenerator generator);
+ MacroAssemblerCodePtr ctiStub(JSGlobalData* globalData, ThunkGenerator generator);
+
+ PassRefPtr<NativeExecutable> hostFunctionStub(JSGlobalData* globalData, NativeFunction func);
+ PassRefPtr<NativeExecutable> hostFunctionStub(JSGlobalData* globalData, NativeFunction func, ThunkGenerator generator);
private:
- typedef HashMap<ThunkGenerator, RefPtr<NativeExecutable> > ThunkMap;
- ThunkMap m_thunkMap;
+ typedef HashMap<ThunkGenerator, MacroAssemblerCodePtr> CTIStubMap;
+ CTIStubMap m_ctiStubMap;
+ typedef HashMap<NativeFunction, RefPtr<NativeExecutable> > HostFunctionStubMap;
+ HostFunctionStubMap m_hostFunctionStubMap;
RefPtr<ExecutablePool> m_executablePool;
TrampolineStructure m_trampolineStructure;
@@ -301,15 +306,17 @@ extern "C" {
EncodedJSValue JIT_STUB cti_op_call_eval(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_construct_NotJSConstruct(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_convert_this(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_del_by_id(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_del_by_val(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_div(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_get_by_id(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_get_by_id_array_fail(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_custom_stub(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_get_by_id_generic(STUB_ARGS_DECLARATION);
- EncodedJSValue JIT_STUB cti_op_get_by_id_method_check(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_get_by_id_getter_stub(STUB_ARGS_DECLARATION);
- EncodedJSValue JIT_STUB cti_op_get_by_id_custom_stub(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_method_check(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_get_by_id_proto_fail(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_get_by_id_proto_list(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_get_by_id_proto_list_full(STUB_ARGS_DECLARATION);
@@ -353,8 +360,8 @@ extern "C" {
EncodedJSValue JIT_STUB cti_op_to_primitive(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_typeof(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_urshift(STUB_ARGS_DECLARATION);
- EncodedJSValue JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_to_object(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION);
JSObject* JIT_STUB cti_op_construct_JSConstruct(STUB_ARGS_DECLARATION);
JSObject* JIT_STUB cti_op_new_array(STUB_ARGS_DECLARATION);
JSObject* JIT_STUB cti_op_new_error(STUB_ARGS_DECLARATION);
@@ -378,8 +385,6 @@ extern "C" {
int JIT_STUB cti_op_loop_if_lesseq(STUB_ARGS_DECLARATION);
int JIT_STUB cti_timeout_check(STUB_ARGS_DECLARATION);
int JIT_STUB cti_has_property(STUB_ARGS_DECLARATION);
- void JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION);
- void JIT_STUB cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION);
diff --git a/JavaScriptCore/jit/JSInterfaceJIT.h b/JavaScriptCore/jit/JSInterfaceJIT.h
index 12a6cfa..c85b94d 100644
--- a/JavaScriptCore/jit/JSInterfaceJIT.h
+++ b/JavaScriptCore/jit/JSInterfaceJIT.h
@@ -191,27 +191,32 @@ namespace JSC {
inline JSInterfaceJIT::Jump JSInterfaceJIT::emitJumpIfNotJSCell(unsigned virtualRegisterIndex)
{
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
return branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::CellTag));
}
inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst)
{
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
loadPtr(payloadFor(virtualRegisterIndex), dst);
return branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::Int32Tag));
}
- inline JSInterfaceJIT::Address JSInterfaceJIT::tagFor(unsigned index, RegisterID base)
+ inline JSInterfaceJIT::Address JSInterfaceJIT::tagFor(unsigned virtualRegisterIndex, RegisterID base)
{
- return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
}
- inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned index, RegisterID base)
+ inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned virtualRegisterIndex, RegisterID base)
{
- return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
}
inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch)
{
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
loadPtr(tagFor(virtualRegisterIndex), scratch);
Jump isDouble = branch32(Below, scratch, Imm32(JSValue::LowestTag));
Jump notInt = branch32(NotEqual, scratch, Imm32(JSValue::Int32Tag));
@@ -297,15 +302,17 @@ namespace JSC {
#endif
#if !USE(JSVALUE32_64)
- inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned index, RegisterID base)
+ inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned virtualRegisterIndex, RegisterID base)
{
- return addressFor(index, base);
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return addressFor(virtualRegisterIndex, base);
}
#endif
- inline JSInterfaceJIT::Address JSInterfaceJIT::addressFor(unsigned index, RegisterID base)
+ inline JSInterfaceJIT::Address JSInterfaceJIT::addressFor(unsigned virtualRegisterIndex, RegisterID base)
{
- return Address(base, (index * sizeof(Register)));
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return Address(base, (virtualRegisterIndex * sizeof(Register)));
}
}
diff --git a/JavaScriptCore/jit/SpecializedThunkJIT.h b/JavaScriptCore/jit/SpecializedThunkJIT.h
index 69925a9..00f7aef 100644
--- a/JavaScriptCore/jit/SpecializedThunkJIT.h
+++ b/JavaScriptCore/jit/SpecializedThunkJIT.h
@@ -127,11 +127,11 @@ namespace JSC {
ret();
}
- PassRefPtr<NativeExecutable> finalize()
+ MacroAssemblerCodePtr finalize(MacroAssemblerCodePtr fallback)
{
LinkBuffer patchBuffer(this, m_pool.get());
- patchBuffer.link(m_failures, CodeLocationLabel(m_globalData->jitStubs.ctiNativeCallThunk()->generatedJITCodeForCall().addressForCall()));
- return adoptRef(new NativeExecutable(patchBuffer.finalizeCode()));
+ patchBuffer.link(m_failures, CodeLocationLabel(fallback));
+ return patchBuffer.finalizeCode().m_code;
}
private:
diff --git a/JavaScriptCore/jit/ThunkGenerators.cpp b/JavaScriptCore/jit/ThunkGenerators.cpp
index c625c3d..271c7c1 100644
--- a/JavaScriptCore/jit/ThunkGenerators.cpp
+++ b/JavaScriptCore/jit/ThunkGenerators.cpp
@@ -25,8 +25,9 @@
#include "config.h"
#include "ThunkGenerators.h"
-#include <wtf/text/StringImpl.h>
+#include "CodeBlock.h"
+#include <wtf/text/StringImpl.h>
#include "SpecializedThunkJIT.h"
#if ENABLE(JIT)
@@ -62,59 +63,59 @@ static void charToString(SpecializedThunkJIT& jit, JSGlobalData* globalData, Mac
jit.appendFailure(jit.branchTestPtr(MacroAssembler::Zero, dst));
}
-PassRefPtr<NativeExecutable> charCodeAtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+MacroAssemblerCodePtr charCodeAtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
{
SpecializedThunkJIT jit(1, globalData, pool);
stringCharLoad(jit);
jit.returnInt32(SpecializedThunkJIT::regT0);
- return jit.finalize();
+ return jit.finalize(globalData->jitStubs.ctiNativeCall());
}
-PassRefPtr<NativeExecutable> charAtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+MacroAssemblerCodePtr charAtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
{
SpecializedThunkJIT jit(1, globalData, pool);
stringCharLoad(jit);
charToString(jit, globalData, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT1);
jit.returnJSCell(SpecializedThunkJIT::regT0);
- return jit.finalize();
+ return jit.finalize(globalData->jitStubs.ctiNativeCall());
}
-PassRefPtr<NativeExecutable> fromCharCodeThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+MacroAssemblerCodePtr fromCharCodeThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
{
SpecializedThunkJIT jit(1, globalData, pool);
// load char code
jit.loadInt32Argument(0, SpecializedThunkJIT::regT0);
charToString(jit, globalData, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT1);
jit.returnJSCell(SpecializedThunkJIT::regT0);
- return jit.finalize();
+ return jit.finalize(globalData->jitStubs.ctiNativeCall());
}
-PassRefPtr<NativeExecutable> sqrtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+MacroAssemblerCodePtr sqrtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
{
#if USE(JSVALUE64) || USE(JSVALUE32_64)
SpecializedThunkJIT jit(1, globalData, pool);
if (!jit.supportsFloatingPointSqrt())
- return globalData->jitStubs.ctiNativeCallThunk();
+ return globalData->jitStubs.ctiNativeCall();
jit.loadDoubleArgument(0, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::regT0);
jit.sqrtDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT0);
jit.returnDouble(SpecializedThunkJIT::fpRegT0);
- return jit.finalize();
+ return jit.finalize(globalData->jitStubs.ctiNativeCall());
#else
UNUSED_PARAM(pool);
- return globalData->jitStubs.ctiNativeCallThunk();
+ return globalData->jitStubs.ctiNativeCall();
#endif
}
static const double oneConstant = 1.0;
static const double negativeHalfConstant = -0.5;
-PassRefPtr<NativeExecutable> powThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+MacroAssemblerCodePtr powThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
{
#if USE(JSVALUE64) || USE(JSVALUE32_64)
SpecializedThunkJIT jit(2, globalData, pool);
if (!jit.supportsFloatingPoint())
- return globalData->jitStubs.ctiNativeCallThunk();
+ return globalData->jitStubs.ctiNativeCall();
jit.loadDouble(&oneConstant, SpecializedThunkJIT::fpRegT1);
jit.loadDoubleArgument(0, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::regT0);
@@ -147,10 +148,10 @@ PassRefPtr<NativeExecutable> powThunkGenerator(JSGlobalData* globalData, Executa
} else
jit.appendFailure(nonIntExponent);
- return jit.finalize();
+ return jit.finalize(globalData->jitStubs.ctiNativeCall());
#else
UNUSED_PARAM(pool);
- return globalData->jitStubs.ctiNativeCallThunk();
+ return globalData->jitStubs.ctiNativeCall();
#endif
}
diff --git a/JavaScriptCore/jit/ThunkGenerators.h b/JavaScriptCore/jit/ThunkGenerators.h
index c3374f2..15261f7 100644
--- a/JavaScriptCore/jit/ThunkGenerators.h
+++ b/JavaScriptCore/jit/ThunkGenerators.h
@@ -27,19 +27,18 @@
#define ThunkGenerators_h
#if ENABLE(JIT)
-#include <wtf/PassRefPtr.h>
-
namespace JSC {
class ExecutablePool;
class JSGlobalData;
class NativeExecutable;
+ class MacroAssemblerCodePtr;
- typedef PassRefPtr<NativeExecutable> (*ThunkGenerator)(JSGlobalData*, ExecutablePool*);
- PassRefPtr<NativeExecutable> charCodeAtThunkGenerator(JSGlobalData*, ExecutablePool*);
- PassRefPtr<NativeExecutable> charAtThunkGenerator(JSGlobalData*, ExecutablePool*);
- PassRefPtr<NativeExecutable> fromCharCodeThunkGenerator(JSGlobalData*, ExecutablePool*);
- PassRefPtr<NativeExecutable> sqrtThunkGenerator(JSGlobalData*, ExecutablePool*);
- PassRefPtr<NativeExecutable> powThunkGenerator(JSGlobalData*, ExecutablePool*);
+ typedef MacroAssemblerCodePtr (*ThunkGenerator)(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr charCodeAtThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr charAtThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr fromCharCodeThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr sqrtThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr powThunkGenerator(JSGlobalData*, ExecutablePool*);
}
#endif
diff --git a/JavaScriptCore/jsc.cpp b/JavaScriptCore/jsc.cpp
index ae47d55..46eaccc 100644
--- a/JavaScriptCore/jsc.cpp
+++ b/JavaScriptCore/jsc.cpp
@@ -150,19 +150,19 @@ ASSERT_CLASS_FITS_IN_CELL(GlobalObject);
GlobalObject::GlobalObject(const Vector<UString>& arguments)
: JSGlobalObject()
{
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
#if ENABLE(SAMPLING_FLAGS)
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));
#endif
JSObject* array = constructEmptyArray(globalExec());
diff --git a/JavaScriptCore/profiler/ProfileNode.cpp b/JavaScriptCore/profiler/ProfileNode.cpp
index f60c72e..1391f99 100644
--- a/JavaScriptCore/profiler/ProfileNode.cpp
+++ b/JavaScriptCore/profiler/ProfileNode.cpp
@@ -45,7 +45,7 @@ namespace JSC {
static double getCount()
{
#if OS(WINDOWS)
- static LARGE_INTEGER frequency = {0};
+ static LARGE_INTEGER frequency;
if (!frequency.QuadPart)
QueryPerformanceFrequency(&frequency);
LARGE_INTEGER counter;
diff --git a/JavaScriptCore/profiler/Profiler.cpp b/JavaScriptCore/profiler/Profiler.cpp
index fe8727a..94e46a4 100644
--- a/JavaScriptCore/profiler/Profiler.cpp
+++ b/JavaScriptCore/profiler/Profiler.cpp
@@ -32,6 +32,7 @@
#include "CommonIdentifiers.h"
#include "CallFrame.h"
#include "CodeBlock.h"
+#include "InternalFunction.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "Nodes.h"
@@ -146,6 +147,8 @@ CallIdentifier Profiler::createCallIdentifier(ExecState* exec, JSValue functionV
if (!function->executable()->isHostFunction())
return createCallIdentifierFromFunctionImp(exec, function);
}
+ if (asObject(functionValue)->inherits(&JSFunction::info))
+ return CallIdentifier(static_cast<JSFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
if (asObject(functionValue)->inherits(&InternalFunction::info))
return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
return CallIdentifier(makeString("(", asObject(functionValue)->className(), " object)"), defaultSourceURL, defaultLineNumber);
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro b/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
index 35cc17d..532d430 100644
--- a/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
+++ b/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
@@ -6,7 +6,9 @@ include(../tests.pri)
SOURCES += \
tst_qscriptvalue.cpp \
- tst_qscriptvalue_generated.cpp
+ tst_qscriptvalue_generated_init.cpp \
+ tst_qscriptvalue_generated_istype.cpp \
+ tst_qscriptvalue_generated_totype.cpp \
HEADERS += \
tst_qscriptvalue.h
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
index 27d5f99..3d33f8e 100644
--- a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
@@ -25,6 +25,8 @@
#include <QtCore/qnumeric.h>
#include <QtTest/qtest.h>
+#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr)
+
Q_DECLARE_METATYPE(QScriptValue*);
Q_DECLARE_METATYPE(QScriptValue);
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp
deleted file mode 100644
index 970c960..0000000
--- a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp
+++ /dev/null
@@ -1,1922 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "tst_qscriptvalue.h"
-
-#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr)
-
-void tst_QScriptValue::initScriptValues()
-{
- m_values.clear();
- if (engine)
- delete engine;
- engine = new QScriptEngine;
- DEFINE_TEST_VALUE(QScriptValue());
- DEFINE_TEST_VALUE(QScriptValue(QScriptValue::UndefinedValue));
- DEFINE_TEST_VALUE(QScriptValue(QScriptValue::NullValue));
- DEFINE_TEST_VALUE(QScriptValue(true));
- DEFINE_TEST_VALUE(QScriptValue(false));
- DEFINE_TEST_VALUE(QScriptValue(int(122)));
- DEFINE_TEST_VALUE(QScriptValue(uint(124)));
- DEFINE_TEST_VALUE(QScriptValue(0));
- DEFINE_TEST_VALUE(QScriptValue(0.0));
- DEFINE_TEST_VALUE(QScriptValue(123.0));
- DEFINE_TEST_VALUE(QScriptValue(6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(-6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(0x43211234));
- DEFINE_TEST_VALUE(QScriptValue(0x10000));
- DEFINE_TEST_VALUE(QScriptValue(0x10001));
- DEFINE_TEST_VALUE(QScriptValue(qSNaN()));
- DEFINE_TEST_VALUE(QScriptValue(qQNaN()));
- DEFINE_TEST_VALUE(QScriptValue(qInf()));
- DEFINE_TEST_VALUE(QScriptValue(-qInf()));
- DEFINE_TEST_VALUE(QScriptValue("NaN"));
- DEFINE_TEST_VALUE(QScriptValue("Infinity"));
- DEFINE_TEST_VALUE(QScriptValue("-Infinity"));
- DEFINE_TEST_VALUE(QScriptValue("ciao"));
- DEFINE_TEST_VALUE(QScriptValue(QString::fromLatin1("ciao")));
- DEFINE_TEST_VALUE(QScriptValue(QString("")));
- DEFINE_TEST_VALUE(QScriptValue(QString()));
- DEFINE_TEST_VALUE(QScriptValue(QString("0")));
- DEFINE_TEST_VALUE(QScriptValue(QString("123")));
- DEFINE_TEST_VALUE(QScriptValue(QString("12.4")));
- DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::UndefinedValue));
- DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::NullValue));
- DEFINE_TEST_VALUE(QScriptValue(0, true));
- DEFINE_TEST_VALUE(QScriptValue(0, false));
- DEFINE_TEST_VALUE(QScriptValue(0, int(122)));
- DEFINE_TEST_VALUE(QScriptValue(0, uint(124)));
- DEFINE_TEST_VALUE(QScriptValue(0, 0));
- DEFINE_TEST_VALUE(QScriptValue(0, 0.0));
- DEFINE_TEST_VALUE(QScriptValue(0, 123.0));
- DEFINE_TEST_VALUE(QScriptValue(0, 6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(0, -6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(0, 0x43211234));
- DEFINE_TEST_VALUE(QScriptValue(0, 0x10000));
- DEFINE_TEST_VALUE(QScriptValue(0, 0x10001));
- DEFINE_TEST_VALUE(QScriptValue(0, qSNaN()));
- DEFINE_TEST_VALUE(QScriptValue(0, qQNaN()));
- DEFINE_TEST_VALUE(QScriptValue(0, qInf()));
- DEFINE_TEST_VALUE(QScriptValue(0, -qInf()));
- DEFINE_TEST_VALUE(QScriptValue(0, "NaN"));
- DEFINE_TEST_VALUE(QScriptValue(0, "Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(0, "-Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(0, "ciao"));
- DEFINE_TEST_VALUE(QScriptValue(0, QString::fromLatin1("ciao")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString()));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("0")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("123")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("12.3")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::UndefinedValue));
- DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::NullValue));
- DEFINE_TEST_VALUE(QScriptValue(engine, true));
- DEFINE_TEST_VALUE(QScriptValue(engine, false));
- DEFINE_TEST_VALUE(QScriptValue(engine, int(122)));
- DEFINE_TEST_VALUE(QScriptValue(engine, uint(124)));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0.0));
- DEFINE_TEST_VALUE(QScriptValue(engine, 123.0));
- DEFINE_TEST_VALUE(QScriptValue(engine, 6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(engine, -6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0x43211234));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0x10000));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0x10001));
- DEFINE_TEST_VALUE(QScriptValue(engine, qSNaN()));
- DEFINE_TEST_VALUE(QScriptValue(engine, qQNaN()));
- DEFINE_TEST_VALUE(QScriptValue(engine, qInf()));
- DEFINE_TEST_VALUE(QScriptValue(engine, -qInf()));
- DEFINE_TEST_VALUE(QScriptValue(engine, "NaN"));
- DEFINE_TEST_VALUE(QScriptValue(engine, "Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(engine, "-Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(engine, "ciao"));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString::fromLatin1("ciao")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString()));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("0")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("123")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("1.23")));
- DEFINE_TEST_VALUE(engine->evaluate("[]"));
- DEFINE_TEST_VALUE(engine->evaluate("{}"));
- DEFINE_TEST_VALUE(engine->evaluate("Object.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Date.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Array.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Function.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Error.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Object"));
- DEFINE_TEST_VALUE(engine->evaluate("Array"));
- DEFINE_TEST_VALUE(engine->evaluate("Number"));
- DEFINE_TEST_VALUE(engine->evaluate("Function"));
- DEFINE_TEST_VALUE(engine->evaluate("(function() { return 1; })"));
- DEFINE_TEST_VALUE(engine->evaluate("(function() { return 'ciao'; })"));
- DEFINE_TEST_VALUE(engine->evaluate("(function() { throw new Error('foo'); })"));
- DEFINE_TEST_VALUE(engine->evaluate("/foo/"));
- DEFINE_TEST_VALUE(engine->evaluate("new Object()"));
- DEFINE_TEST_VALUE(engine->evaluate("new Array()"));
- DEFINE_TEST_VALUE(engine->evaluate("new Error()"));
- DEFINE_TEST_VALUE(engine->evaluate("a = new Object(); a.foo = 22; a.foo"));
- DEFINE_TEST_VALUE(engine->evaluate("Undefined"));
- DEFINE_TEST_VALUE(engine->evaluate("Null"));
- DEFINE_TEST_VALUE(engine->evaluate("True"));
- DEFINE_TEST_VALUE(engine->evaluate("False"));
- DEFINE_TEST_VALUE(engine->evaluate("undefined"));
- DEFINE_TEST_VALUE(engine->evaluate("null"));
- DEFINE_TEST_VALUE(engine->evaluate("true"));
- DEFINE_TEST_VALUE(engine->evaluate("false"));
- DEFINE_TEST_VALUE(engine->evaluate("122"));
- DEFINE_TEST_VALUE(engine->evaluate("124"));
- DEFINE_TEST_VALUE(engine->evaluate("0"));
- DEFINE_TEST_VALUE(engine->evaluate("0.0"));
- DEFINE_TEST_VALUE(engine->evaluate("123.0"));
- DEFINE_TEST_VALUE(engine->evaluate("6.37e-8"));
- DEFINE_TEST_VALUE(engine->evaluate("-6.37e-8"));
- DEFINE_TEST_VALUE(engine->evaluate("0x43211234"));
- DEFINE_TEST_VALUE(engine->evaluate("0x10000"));
- DEFINE_TEST_VALUE(engine->evaluate("0x10001"));
- DEFINE_TEST_VALUE(engine->evaluate("NaN"));
- DEFINE_TEST_VALUE(engine->evaluate("Infinity"));
- DEFINE_TEST_VALUE(engine->evaluate("-Infinity"));
- DEFINE_TEST_VALUE(engine->evaluate("'ciao'"));
- DEFINE_TEST_VALUE(engine->evaluate("''"));
- DEFINE_TEST_VALUE(engine->evaluate("'0'"));
- DEFINE_TEST_VALUE(engine->evaluate("'123'"));
- DEFINE_TEST_VALUE(engine->evaluate("'12.4'"));
- DEFINE_TEST_VALUE(engine->nullValue());
- DEFINE_TEST_VALUE(engine->undefinedValue());
-}
-
-
-void tst_QScriptValue::isValid_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isValid_makeData(const char* expr)
-{
- static QSet<QString> isValid;
- if (isValid.isEmpty()) {
- isValid << "QScriptValue(QScriptValue::UndefinedValue)"
- << "QScriptValue(QScriptValue::NullValue)"
- << "QScriptValue(true)"
- << "QScriptValue(false)"
- << "QScriptValue(int(122))"
- << "QScriptValue(uint(124))"
- << "QScriptValue(0)"
- << "QScriptValue(0.0)"
- << "QScriptValue(123.0)"
- << "QScriptValue(6.37e-8)"
- << "QScriptValue(-6.37e-8)"
- << "QScriptValue(0x43211234)"
- << "QScriptValue(0x10000)"
- << "QScriptValue(0x10001)"
- << "QScriptValue(qSNaN())"
- << "QScriptValue(qQNaN())"
- << "QScriptValue(qInf())"
- << "QScriptValue(-qInf())"
- << "QScriptValue(\"NaN\")"
- << "QScriptValue(\"Infinity\")"
- << "QScriptValue(\"-Infinity\")"
- << "QScriptValue(\"ciao\")"
- << "QScriptValue(QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(QString(\"\"))"
- << "QScriptValue(QString())"
- << "QScriptValue(QString(\"0\"))"
- << "QScriptValue(QString(\"123\"))"
- << "QScriptValue(QString(\"12.4\"))"
- << "QScriptValue(0, QScriptValue::UndefinedValue)"
- << "QScriptValue(0, QScriptValue::NullValue)"
- << "QScriptValue(0, true)"
- << "QScriptValue(0, false)"
- << "QScriptValue(0, int(122))"
- << "QScriptValue(0, uint(124))"
- << "QScriptValue(0, 0)"
- << "QScriptValue(0, 0.0)"
- << "QScriptValue(0, 123.0)"
- << "QScriptValue(0, 6.37e-8)"
- << "QScriptValue(0, -6.37e-8)"
- << "QScriptValue(0, 0x43211234)"
- << "QScriptValue(0, 0x10000)"
- << "QScriptValue(0, 0x10001)"
- << "QScriptValue(0, qSNaN())"
- << "QScriptValue(0, qQNaN())"
- << "QScriptValue(0, qInf())"
- << "QScriptValue(0, -qInf())"
- << "QScriptValue(0, \"NaN\")"
- << "QScriptValue(0, \"Infinity\")"
- << "QScriptValue(0, \"-Infinity\")"
- << "QScriptValue(0, \"ciao\")"
- << "QScriptValue(0, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(0, QString(\"\"))"
- << "QScriptValue(0, QString())"
- << "QScriptValue(0, QString(\"0\"))"
- << "QScriptValue(0, QString(\"123\"))"
- << "QScriptValue(0, QString(\"12.3\"))"
- << "QScriptValue(engine, QScriptValue::UndefinedValue)"
- << "QScriptValue(engine, QScriptValue::NullValue)"
- << "QScriptValue(engine, true)"
- << "QScriptValue(engine, false)"
- << "QScriptValue(engine, int(122))"
- << "QScriptValue(engine, uint(124))"
- << "QScriptValue(engine, 0)"
- << "QScriptValue(engine, 0.0)"
- << "QScriptValue(engine, 123.0)"
- << "QScriptValue(engine, 6.37e-8)"
- << "QScriptValue(engine, -6.37e-8)"
- << "QScriptValue(engine, 0x43211234)"
- << "QScriptValue(engine, 0x10000)"
- << "QScriptValue(engine, 0x10001)"
- << "QScriptValue(engine, qSNaN())"
- << "QScriptValue(engine, qQNaN())"
- << "QScriptValue(engine, qInf())"
- << "QScriptValue(engine, -qInf())"
- << "QScriptValue(engine, \"NaN\")"
- << "QScriptValue(engine, \"Infinity\")"
- << "QScriptValue(engine, \"-Infinity\")"
- << "QScriptValue(engine, \"ciao\")"
- << "QScriptValue(engine, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(engine, QString(\"\"))"
- << "QScriptValue(engine, QString())"
- << "QScriptValue(engine, QString(\"0\"))"
- << "QScriptValue(engine, QString(\"123\"))"
- << "QScriptValue(engine, QString(\"1.23\"))"
- << "engine->evaluate(\"[]\")"
- << "engine->evaluate(\"{}\")"
- << "engine->evaluate(\"Object.prototype\")"
- << "engine->evaluate(\"Date.prototype\")"
- << "engine->evaluate(\"Array.prototype\")"
- << "engine->evaluate(\"Function.prototype\")"
- << "engine->evaluate(\"Error.prototype\")"
- << "engine->evaluate(\"Object\")"
- << "engine->evaluate(\"Array\")"
- << "engine->evaluate(\"Number\")"
- << "engine->evaluate(\"Function\")"
- << "engine->evaluate(\"(function() { return 1; })\")"
- << "engine->evaluate(\"(function() { return 'ciao'; })\")"
- << "engine->evaluate(\"(function() { throw new Error('foo'); })\")"
- << "engine->evaluate(\"/foo/\")"
- << "engine->evaluate(\"new Object()\")"
- << "engine->evaluate(\"new Array()\")"
- << "engine->evaluate(\"new Error()\")"
- << "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"
- << "engine->evaluate(\"Undefined\")"
- << "engine->evaluate(\"Null\")"
- << "engine->evaluate(\"True\")"
- << "engine->evaluate(\"False\")"
- << "engine->evaluate(\"undefined\")"
- << "engine->evaluate(\"null\")"
- << "engine->evaluate(\"true\")"
- << "engine->evaluate(\"false\")"
- << "engine->evaluate(\"122\")"
- << "engine->evaluate(\"124\")"
- << "engine->evaluate(\"0\")"
- << "engine->evaluate(\"0.0\")"
- << "engine->evaluate(\"123.0\")"
- << "engine->evaluate(\"6.37e-8\")"
- << "engine->evaluate(\"-6.37e-8\")"
- << "engine->evaluate(\"0x43211234\")"
- << "engine->evaluate(\"0x10000\")"
- << "engine->evaluate(\"0x10001\")"
- << "engine->evaluate(\"NaN\")"
- << "engine->evaluate(\"Infinity\")"
- << "engine->evaluate(\"-Infinity\")"
- << "engine->evaluate(\"'ciao'\")"
- << "engine->evaluate(\"''\")"
- << "engine->evaluate(\"'0'\")"
- << "engine->evaluate(\"'123'\")"
- << "engine->evaluate(\"'12.4'\")"
- << "engine->nullValue()"
- << "engine->undefinedValue()";
- }
- newRow(expr) << isValid.contains(expr);
-}
-
-void tst_QScriptValue::isValid_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isValid(), expected);
- QCOMPARE(value.isValid(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isValid)
-
-
-void tst_QScriptValue::isBool_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isBool_makeData(const char* expr)
-{
- static QSet<QString> isBool;
- if (isBool.isEmpty()) {
- isBool << "QScriptValue(true)"
- << "QScriptValue(false)"
- << "QScriptValue(0, true)"
- << "QScriptValue(0, false)"
- << "QScriptValue(engine, true)"
- << "QScriptValue(engine, false)"
- << "engine->evaluate(\"true\")"
- << "engine->evaluate(\"false\")";
- }
- newRow(expr) << isBool.contains(expr);
-}
-
-void tst_QScriptValue::isBool_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isBool(), expected);
- QCOMPARE(value.isBool(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isBool)
-
-
-void tst_QScriptValue::isBoolean_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isBoolean_makeData(const char* expr)
-{
- static QSet<QString> isBoolean;
- if (isBoolean.isEmpty()) {
- isBoolean << "QScriptValue(true)"
- << "QScriptValue(false)"
- << "QScriptValue(0, true)"
- << "QScriptValue(0, false)"
- << "QScriptValue(engine, true)"
- << "QScriptValue(engine, false)"
- << "engine->evaluate(\"true\")"
- << "engine->evaluate(\"false\")";
- }
- newRow(expr) << isBoolean.contains(expr);
-}
-
-void tst_QScriptValue::isBoolean_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isBoolean(), expected);
- QCOMPARE(value.isBoolean(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isBoolean)
-
-
-void tst_QScriptValue::isNumber_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isNumber_makeData(const char* expr)
-{
- static QSet<QString> isNumber;
- if (isNumber.isEmpty()) {
- isNumber << "QScriptValue(int(122))"
- << "QScriptValue(uint(124))"
- << "QScriptValue(0)"
- << "QScriptValue(0.0)"
- << "QScriptValue(123.0)"
- << "QScriptValue(6.37e-8)"
- << "QScriptValue(-6.37e-8)"
- << "QScriptValue(0x43211234)"
- << "QScriptValue(0x10000)"
- << "QScriptValue(0x10001)"
- << "QScriptValue(qSNaN())"
- << "QScriptValue(qQNaN())"
- << "QScriptValue(qInf())"
- << "QScriptValue(-qInf())"
- << "QScriptValue(0, int(122))"
- << "QScriptValue(0, uint(124))"
- << "QScriptValue(0, 0)"
- << "QScriptValue(0, 0.0)"
- << "QScriptValue(0, 123.0)"
- << "QScriptValue(0, 6.37e-8)"
- << "QScriptValue(0, -6.37e-8)"
- << "QScriptValue(0, 0x43211234)"
- << "QScriptValue(0, 0x10000)"
- << "QScriptValue(0, 0x10001)"
- << "QScriptValue(0, qSNaN())"
- << "QScriptValue(0, qQNaN())"
- << "QScriptValue(0, qInf())"
- << "QScriptValue(0, -qInf())"
- << "QScriptValue(engine, int(122))"
- << "QScriptValue(engine, uint(124))"
- << "QScriptValue(engine, 0)"
- << "QScriptValue(engine, 0.0)"
- << "QScriptValue(engine, 123.0)"
- << "QScriptValue(engine, 6.37e-8)"
- << "QScriptValue(engine, -6.37e-8)"
- << "QScriptValue(engine, 0x43211234)"
- << "QScriptValue(engine, 0x10000)"
- << "QScriptValue(engine, 0x10001)"
- << "QScriptValue(engine, qSNaN())"
- << "QScriptValue(engine, qQNaN())"
- << "QScriptValue(engine, qInf())"
- << "QScriptValue(engine, -qInf())"
- << "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"
- << "engine->evaluate(\"122\")"
- << "engine->evaluate(\"124\")"
- << "engine->evaluate(\"0\")"
- << "engine->evaluate(\"0.0\")"
- << "engine->evaluate(\"123.0\")"
- << "engine->evaluate(\"6.37e-8\")"
- << "engine->evaluate(\"-6.37e-8\")"
- << "engine->evaluate(\"0x43211234\")"
- << "engine->evaluate(\"0x10000\")"
- << "engine->evaluate(\"0x10001\")"
- << "engine->evaluate(\"NaN\")"
- << "engine->evaluate(\"Infinity\")"
- << "engine->evaluate(\"-Infinity\")";
- }
- newRow(expr) << isNumber.contains(expr);
-}
-
-void tst_QScriptValue::isNumber_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isNumber(), expected);
- QCOMPARE(value.isNumber(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isNumber)
-
-
-void tst_QScriptValue::isFunction_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isFunction_makeData(const char* expr)
-{
- static QSet<QString> isFunction;
- if (isFunction.isEmpty()) {
- isFunction << "engine->evaluate(\"Function.prototype\")"
- << "engine->evaluate(\"Object\")"
- << "engine->evaluate(\"Array\")"
- << "engine->evaluate(\"Number\")"
- << "engine->evaluate(\"Function\")"
- << "engine->evaluate(\"(function() { return 1; })\")"
- << "engine->evaluate(\"(function() { return 'ciao'; })\")"
- << "engine->evaluate(\"(function() { throw new Error('foo'); })\")"
- << "engine->evaluate(\"/foo/\")";
- }
- newRow(expr) << isFunction.contains(expr);
-}
-
-void tst_QScriptValue::isFunction_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isFunction(), expected);
- QCOMPARE(value.isFunction(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isFunction)
-
-
-void tst_QScriptValue::isNull_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isNull_makeData(const char* expr)
-{
- static QSet<QString> isNull;
- if (isNull.isEmpty()) {
- isNull << "QScriptValue(QScriptValue::NullValue)"
- << "QScriptValue(0, QScriptValue::NullValue)"
- << "QScriptValue(engine, QScriptValue::NullValue)"
- << "engine->evaluate(\"null\")"
- << "engine->nullValue()";
- }
- newRow(expr) << isNull.contains(expr);
-}
-
-void tst_QScriptValue::isNull_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isNull(), expected);
- QCOMPARE(value.isNull(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isNull)
-
-
-void tst_QScriptValue::isString_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isString_makeData(const char* expr)
-{
- static QSet<QString> isString;
- if (isString.isEmpty()) {
- isString << "QScriptValue(\"NaN\")"
- << "QScriptValue(\"Infinity\")"
- << "QScriptValue(\"-Infinity\")"
- << "QScriptValue(\"ciao\")"
- << "QScriptValue(QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(QString(\"\"))"
- << "QScriptValue(QString())"
- << "QScriptValue(QString(\"0\"))"
- << "QScriptValue(QString(\"123\"))"
- << "QScriptValue(QString(\"12.4\"))"
- << "QScriptValue(0, \"NaN\")"
- << "QScriptValue(0, \"Infinity\")"
- << "QScriptValue(0, \"-Infinity\")"
- << "QScriptValue(0, \"ciao\")"
- << "QScriptValue(0, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(0, QString(\"\"))"
- << "QScriptValue(0, QString())"
- << "QScriptValue(0, QString(\"0\"))"
- << "QScriptValue(0, QString(\"123\"))"
- << "QScriptValue(0, QString(\"12.3\"))"
- << "QScriptValue(engine, \"NaN\")"
- << "QScriptValue(engine, \"Infinity\")"
- << "QScriptValue(engine, \"-Infinity\")"
- << "QScriptValue(engine, \"ciao\")"
- << "QScriptValue(engine, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(engine, QString(\"\"))"
- << "QScriptValue(engine, QString())"
- << "QScriptValue(engine, QString(\"0\"))"
- << "QScriptValue(engine, QString(\"123\"))"
- << "QScriptValue(engine, QString(\"1.23\"))"
- << "engine->evaluate(\"'ciao'\")"
- << "engine->evaluate(\"''\")"
- << "engine->evaluate(\"'0'\")"
- << "engine->evaluate(\"'123'\")"
- << "engine->evaluate(\"'12.4'\")";
- }
- newRow(expr) << isString.contains(expr);
-}
-
-void tst_QScriptValue::isString_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isString(), expected);
- QCOMPARE(value.isString(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isString)
-
-
-void tst_QScriptValue::isUndefined_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isUndefined_makeData(const char* expr)
-{
- static QSet<QString> isUndefined;
- if (isUndefined.isEmpty()) {
- isUndefined << "QScriptValue(QScriptValue::UndefinedValue)"
- << "QScriptValue(0, QScriptValue::UndefinedValue)"
- << "QScriptValue(engine, QScriptValue::UndefinedValue)"
- << "engine->evaluate(\"{}\")"
- << "engine->evaluate(\"undefined\")"
- << "engine->undefinedValue()";
- }
- newRow(expr) << isUndefined.contains(expr);
-}
-
-void tst_QScriptValue::isUndefined_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isUndefined(), expected);
- QCOMPARE(value.isUndefined(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isUndefined)
-
-
-
-
-
-void tst_QScriptValue::isObject_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isObject_makeData(const char* expr)
-{
- static QSet<QString> isObject;
- if (isObject.isEmpty()) {
- isObject << "engine->evaluate(\"[]\")"
- << "engine->evaluate(\"Object.prototype\")"
- << "engine->evaluate(\"Date.prototype\")"
- << "engine->evaluate(\"Array.prototype\")"
- << "engine->evaluate(\"Function.prototype\")"
- << "engine->evaluate(\"Error.prototype\")"
- << "engine->evaluate(\"Object\")"
- << "engine->evaluate(\"Array\")"
- << "engine->evaluate(\"Number\")"
- << "engine->evaluate(\"Function\")"
- << "engine->evaluate(\"(function() { return 1; })\")"
- << "engine->evaluate(\"(function() { return 'ciao'; })\")"
- << "engine->evaluate(\"(function() { throw new Error('foo'); })\")"
- << "engine->evaluate(\"/foo/\")"
- << "engine->evaluate(\"new Object()\")"
- << "engine->evaluate(\"new Array()\")"
- << "engine->evaluate(\"new Error()\")"
- << "engine->evaluate(\"Undefined\")"
- << "engine->evaluate(\"Null\")"
- << "engine->evaluate(\"True\")"
- << "engine->evaluate(\"False\")";
- }
- newRow(expr) << isObject.contains(expr);
-}
-
-void tst_QScriptValue::isObject_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isObject(), expected);
- QCOMPARE(value.isObject(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isObject)
-
-
-void tst_QScriptValue::toString_initData()
-{
- QTest::addColumn<QString>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toString_makeData(const char* expr)
-{
- static QHash<QString, QString> toString;
- if (toString.isEmpty()) {
- toString.insert("QScriptValue()", "");
- toString.insert("QScriptValue(QScriptValue::UndefinedValue)", "undefined");
- toString.insert("QScriptValue(QScriptValue::NullValue)", "null");
- toString.insert("QScriptValue(true)", "true");
- toString.insert("QScriptValue(false)", "false");
- toString.insert("QScriptValue(int(122))", "122");
- toString.insert("QScriptValue(uint(124))", "124");
- toString.insert("QScriptValue(0)", "0");
- toString.insert("QScriptValue(0.0)", "0");
- toString.insert("QScriptValue(123.0)", "123");
- toString.insert("QScriptValue(6.37e-8)", "6.37e-8");
- toString.insert("QScriptValue(-6.37e-8)", "-6.37e-8");
- toString.insert("QScriptValue(0x43211234)", "1126240820");
- toString.insert("QScriptValue(0x10000)", "65536");
- toString.insert("QScriptValue(0x10001)", "65537");
- toString.insert("QScriptValue(qSNaN())", "NaN");
- toString.insert("QScriptValue(qQNaN())", "NaN");
- toString.insert("QScriptValue(qInf())", "Infinity");
- toString.insert("QScriptValue(-qInf())", "-Infinity");
- toString.insert("QScriptValue(\"NaN\")", "NaN");
- toString.insert("QScriptValue(\"Infinity\")", "Infinity");
- toString.insert("QScriptValue(\"-Infinity\")", "-Infinity");
- toString.insert("QScriptValue(\"ciao\")", "ciao");
- toString.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", "ciao");
- toString.insert("QScriptValue(QString(\"\"))", "");
- toString.insert("QScriptValue(QString())", "");
- toString.insert("QScriptValue(QString(\"0\"))", "0");
- toString.insert("QScriptValue(QString(\"123\"))", "123");
- toString.insert("QScriptValue(QString(\"12.4\"))", "12.4");
- toString.insert("QScriptValue(0, QScriptValue::UndefinedValue)", "undefined");
- toString.insert("QScriptValue(0, QScriptValue::NullValue)", "null");
- toString.insert("QScriptValue(0, true)", "true");
- toString.insert("QScriptValue(0, false)", "false");
- toString.insert("QScriptValue(0, int(122))", "122");
- toString.insert("QScriptValue(0, uint(124))", "124");
- toString.insert("QScriptValue(0, 0)", "0");
- toString.insert("QScriptValue(0, 0.0)", "0");
- toString.insert("QScriptValue(0, 123.0)", "123");
- toString.insert("QScriptValue(0, 6.37e-8)", "6.37e-8");
- toString.insert("QScriptValue(0, -6.37e-8)", "-6.37e-8");
- toString.insert("QScriptValue(0, 0x43211234)", "1126240820");
- toString.insert("QScriptValue(0, 0x10000)", "65536");
- toString.insert("QScriptValue(0, 0x10001)", "65537");
- toString.insert("QScriptValue(0, qSNaN())", "NaN");
- toString.insert("QScriptValue(0, qQNaN())", "NaN");
- toString.insert("QScriptValue(0, qInf())", "Infinity");
- toString.insert("QScriptValue(0, -qInf())", "-Infinity");
- toString.insert("QScriptValue(0, \"NaN\")", "NaN");
- toString.insert("QScriptValue(0, \"Infinity\")", "Infinity");
- toString.insert("QScriptValue(0, \"-Infinity\")", "-Infinity");
- toString.insert("QScriptValue(0, \"ciao\")", "ciao");
- toString.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", "ciao");
- toString.insert("QScriptValue(0, QString(\"\"))", "");
- toString.insert("QScriptValue(0, QString())", "");
- toString.insert("QScriptValue(0, QString(\"0\"))", "0");
- toString.insert("QScriptValue(0, QString(\"123\"))", "123");
- toString.insert("QScriptValue(0, QString(\"12.3\"))", "12.3");
- toString.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", "undefined");
- toString.insert("QScriptValue(engine, QScriptValue::NullValue)", "null");
- toString.insert("QScriptValue(engine, true)", "true");
- toString.insert("QScriptValue(engine, false)", "false");
- toString.insert("QScriptValue(engine, int(122))", "122");
- toString.insert("QScriptValue(engine, uint(124))", "124");
- toString.insert("QScriptValue(engine, 0)", "0");
- toString.insert("QScriptValue(engine, 0.0)", "0");
- toString.insert("QScriptValue(engine, 123.0)", "123");
- toString.insert("QScriptValue(engine, 6.37e-8)", "6.37e-8");
- toString.insert("QScriptValue(engine, -6.37e-8)", "-6.37e-8");
- toString.insert("QScriptValue(engine, 0x43211234)", "1126240820");
- toString.insert("QScriptValue(engine, 0x10000)", "65536");
- toString.insert("QScriptValue(engine, 0x10001)", "65537");
- toString.insert("QScriptValue(engine, qSNaN())", "NaN");
- toString.insert("QScriptValue(engine, qQNaN())", "NaN");
- toString.insert("QScriptValue(engine, qInf())", "Infinity");
- toString.insert("QScriptValue(engine, -qInf())", "-Infinity");
- toString.insert("QScriptValue(engine, \"NaN\")", "NaN");
- toString.insert("QScriptValue(engine, \"Infinity\")", "Infinity");
- toString.insert("QScriptValue(engine, \"-Infinity\")", "-Infinity");
- toString.insert("QScriptValue(engine, \"ciao\")", "ciao");
- toString.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", "ciao");
- toString.insert("QScriptValue(engine, QString(\"\"))", "");
- toString.insert("QScriptValue(engine, QString())", "");
- toString.insert("QScriptValue(engine, QString(\"0\"))", "0");
- toString.insert("QScriptValue(engine, QString(\"123\"))", "123");
- toString.insert("QScriptValue(engine, QString(\"1.23\"))", "1.23");
- toString.insert("engine->evaluate(\"[]\")", "");
- toString.insert("engine->evaluate(\"{}\")", "undefined");
- toString.insert("engine->evaluate(\"Object.prototype\")", "[object Object]");
- toString.insert("engine->evaluate(\"Date.prototype\")", "Invalid Date");
- toString.insert("engine->evaluate(\"Array.prototype\")", "");
- toString.insert("engine->evaluate(\"Function.prototype\")", "function () {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Error.prototype\")", "Error: Unknown error");
- toString.insert("engine->evaluate(\"Object\")", "function Object() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Array\")", "function Array() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Number\")", "function Number() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Function\")", "function Function() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"(function() { return 1; })\")", "function () { return 1; }");
- toString.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", "function () { return 'ciao'; }");
- toString.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", "function () { throw new Error('foo'); }");
- toString.insert("engine->evaluate(\"/foo/\")", "/foo/");
- toString.insert("engine->evaluate(\"new Object()\")", "[object Object]");
- toString.insert("engine->evaluate(\"new Array()\")", "");
- toString.insert("engine->evaluate(\"new Error()\")", "Error: Unknown error");
- toString.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", "22");
- toString.insert("engine->evaluate(\"Undefined\")", "ReferenceError: Can't find variable: Undefined");
- toString.insert("engine->evaluate(\"Null\")", "ReferenceError: Can't find variable: Null");
- toString.insert("engine->evaluate(\"True\")", "ReferenceError: Can't find variable: True");
- toString.insert("engine->evaluate(\"False\")", "ReferenceError: Can't find variable: False");
- toString.insert("engine->evaluate(\"undefined\")", "undefined");
- toString.insert("engine->evaluate(\"null\")", "null");
- toString.insert("engine->evaluate(\"true\")", "true");
- toString.insert("engine->evaluate(\"false\")", "false");
- toString.insert("engine->evaluate(\"122\")", "122");
- toString.insert("engine->evaluate(\"124\")", "124");
- toString.insert("engine->evaluate(\"0\")", "0");
- toString.insert("engine->evaluate(\"0.0\")", "0");
- toString.insert("engine->evaluate(\"123.0\")", "123");
- toString.insert("engine->evaluate(\"6.37e-8\")", "6.37e-8");
- toString.insert("engine->evaluate(\"-6.37e-8\")", "-6.37e-8");
- toString.insert("engine->evaluate(\"0x43211234\")", "1126240820");
- toString.insert("engine->evaluate(\"0x10000\")", "65536");
- toString.insert("engine->evaluate(\"0x10001\")", "65537");
- toString.insert("engine->evaluate(\"NaN\")", "NaN");
- toString.insert("engine->evaluate(\"Infinity\")", "Infinity");
- toString.insert("engine->evaluate(\"-Infinity\")", "-Infinity");
- toString.insert("engine->evaluate(\"'ciao'\")", "ciao");
- toString.insert("engine->evaluate(\"''\")", "");
- toString.insert("engine->evaluate(\"'0'\")", "0");
- toString.insert("engine->evaluate(\"'123'\")", "123");
- toString.insert("engine->evaluate(\"'12.4'\")", "12.4");
- toString.insert("engine->nullValue()", "null");
- toString.insert("engine->undefinedValue()", "undefined");
- }
- newRow(expr) << toString.value(expr);
-}
-
-void tst_QScriptValue::toString_test(const char*, const QScriptValue& value)
-{
- QFETCH(QString, expected);
- QCOMPARE(value.toString(), expected);
- QCOMPARE(value.toString(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toString)
-
-
-void tst_QScriptValue::toNumber_initData()
-{
- QTest::addColumn<qsreal>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toNumber_makeData(const char* expr)
-{
- static QHash<QString, qsreal> toNumber;
- if (toNumber.isEmpty()) {
- toNumber.insert("QScriptValue()", 0);
- toNumber.insert("QScriptValue(QScriptValue::UndefinedValue)", qQNaN());
- toNumber.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toNumber.insert("QScriptValue(true)", 1);
- toNumber.insert("QScriptValue(false)", 0);
- toNumber.insert("QScriptValue(int(122))", 122);
- toNumber.insert("QScriptValue(uint(124))", 124);
- toNumber.insert("QScriptValue(0)", 0);
- toNumber.insert("QScriptValue(0.0)", 0);
- toNumber.insert("QScriptValue(123.0)", 123);
- toNumber.insert("QScriptValue(6.37e-8)", 6.369999999999999e-08);
- toNumber.insert("QScriptValue(-6.37e-8)", -6.369999999999999e-08);
- toNumber.insert("QScriptValue(0x43211234)", 1126240820);
- toNumber.insert("QScriptValue(0x10000)", 65536);
- toNumber.insert("QScriptValue(0x10001)", 65537);
- toNumber.insert("QScriptValue(qSNaN())", qQNaN());
- toNumber.insert("QScriptValue(qQNaN())", qQNaN());
- toNumber.insert("QScriptValue(qInf())", qInf());
- toNumber.insert("QScriptValue(-qInf())", qInf());
- toNumber.insert("QScriptValue(\"NaN\")", qQNaN());
- toNumber.insert("QScriptValue(\"Infinity\")", qInf());
- toNumber.insert("QScriptValue(\"-Infinity\")", qInf());
- toNumber.insert("QScriptValue(\"ciao\")", qQNaN());
- toNumber.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", qQNaN());
- toNumber.insert("QScriptValue(QString(\"\"))", 0);
- toNumber.insert("QScriptValue(QString())", 0);
- toNumber.insert("QScriptValue(QString(\"0\"))", 0);
- toNumber.insert("QScriptValue(QString(\"123\"))", 123);
- toNumber.insert("QScriptValue(QString(\"12.4\"))", 12.4);
- toNumber.insert("QScriptValue(0, QScriptValue::UndefinedValue)", qQNaN());
- toNumber.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toNumber.insert("QScriptValue(0, true)", 1);
- toNumber.insert("QScriptValue(0, false)", 0);
- toNumber.insert("QScriptValue(0, int(122))", 122);
- toNumber.insert("QScriptValue(0, uint(124))", 124);
- toNumber.insert("QScriptValue(0, 0)", 0);
- toNumber.insert("QScriptValue(0, 0.0)", 0);
- toNumber.insert("QScriptValue(0, 123.0)", 123);
- toNumber.insert("QScriptValue(0, 6.37e-8)", 6.369999999999999e-08);
- toNumber.insert("QScriptValue(0, -6.37e-8)", -6.369999999999999e-08);
- toNumber.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toNumber.insert("QScriptValue(0, 0x10000)", 65536);
- toNumber.insert("QScriptValue(0, 0x10001)", 65537);
- toNumber.insert("QScriptValue(0, qSNaN())", qQNaN());
- toNumber.insert("QScriptValue(0, qQNaN())", qQNaN());
- toNumber.insert("QScriptValue(0, qInf())", qInf());
- toNumber.insert("QScriptValue(0, -qInf())", qInf());
- toNumber.insert("QScriptValue(0, \"NaN\")", qQNaN());
- toNumber.insert("QScriptValue(0, \"Infinity\")", qInf());
- toNumber.insert("QScriptValue(0, \"-Infinity\")", qInf());
- toNumber.insert("QScriptValue(0, \"ciao\")", qQNaN());
- toNumber.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", qQNaN());
- toNumber.insert("QScriptValue(0, QString(\"\"))", 0);
- toNumber.insert("QScriptValue(0, QString())", 0);
- toNumber.insert("QScriptValue(0, QString(\"0\"))", 0);
- toNumber.insert("QScriptValue(0, QString(\"123\"))", 123);
- toNumber.insert("QScriptValue(0, QString(\"12.3\"))", 12.3);
- toNumber.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", qQNaN());
- toNumber.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toNumber.insert("QScriptValue(engine, true)", 1);
- toNumber.insert("QScriptValue(engine, false)", 0);
- toNumber.insert("QScriptValue(engine, int(122))", 122);
- toNumber.insert("QScriptValue(engine, uint(124))", 124);
- toNumber.insert("QScriptValue(engine, 0)", 0);
- toNumber.insert("QScriptValue(engine, 0.0)", 0);
- toNumber.insert("QScriptValue(engine, 123.0)", 123);
- toNumber.insert("QScriptValue(engine, 6.37e-8)", 6.369999999999999e-08);
- toNumber.insert("QScriptValue(engine, -6.37e-8)", -6.369999999999999e-08);
- toNumber.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toNumber.insert("QScriptValue(engine, 0x10000)", 65536);
- toNumber.insert("QScriptValue(engine, 0x10001)", 65537);
- toNumber.insert("QScriptValue(engine, qSNaN())", qQNaN());
- toNumber.insert("QScriptValue(engine, qQNaN())", qQNaN());
- toNumber.insert("QScriptValue(engine, qInf())", qInf());
- toNumber.insert("QScriptValue(engine, -qInf())", qInf());
- toNumber.insert("QScriptValue(engine, \"NaN\")", qQNaN());
- toNumber.insert("QScriptValue(engine, \"Infinity\")", qInf());
- toNumber.insert("QScriptValue(engine, \"-Infinity\")", qInf());
- toNumber.insert("QScriptValue(engine, \"ciao\")", qQNaN());
- toNumber.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", qQNaN());
- toNumber.insert("QScriptValue(engine, QString(\"\"))", 0);
- toNumber.insert("QScriptValue(engine, QString())", 0);
- toNumber.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toNumber.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toNumber.insert("QScriptValue(engine, QString(\"1.23\"))", 1.23);
- toNumber.insert("engine->evaluate(\"[]\")", 0);
- toNumber.insert("engine->evaluate(\"{}\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Object.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Date.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Array.prototype\")", 0);
- toNumber.insert("engine->evaluate(\"Function.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Error.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Object\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Array\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Number\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Function\")", qQNaN());
- toNumber.insert("engine->evaluate(\"(function() { return 1; })\")", qQNaN());
- toNumber.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", qQNaN());
- toNumber.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", qQNaN());
- toNumber.insert("engine->evaluate(\"/foo/\")", qQNaN());
- toNumber.insert("engine->evaluate(\"new Object()\")", qQNaN());
- toNumber.insert("engine->evaluate(\"new Array()\")", 0);
- toNumber.insert("engine->evaluate(\"new Error()\")", qQNaN());
- toNumber.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toNumber.insert("engine->evaluate(\"Undefined\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Null\")", qQNaN());
- toNumber.insert("engine->evaluate(\"True\")", qQNaN());
- toNumber.insert("engine->evaluate(\"False\")", qQNaN());
- toNumber.insert("engine->evaluate(\"undefined\")", qQNaN());
- toNumber.insert("engine->evaluate(\"null\")", 0);
- toNumber.insert("engine->evaluate(\"true\")", 1);
- toNumber.insert("engine->evaluate(\"false\")", 0);
- toNumber.insert("engine->evaluate(\"122\")", 122);
- toNumber.insert("engine->evaluate(\"124\")", 124);
- toNumber.insert("engine->evaluate(\"0\")", 0);
- toNumber.insert("engine->evaluate(\"0.0\")", 0);
- toNumber.insert("engine->evaluate(\"123.0\")", 123);
- toNumber.insert("engine->evaluate(\"6.37e-8\")", 6.369999999999999e-08);
- toNumber.insert("engine->evaluate(\"-6.37e-8\")", -6.369999999999999e-08);
- toNumber.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toNumber.insert("engine->evaluate(\"0x10000\")", 65536);
- toNumber.insert("engine->evaluate(\"0x10001\")", 65537);
- toNumber.insert("engine->evaluate(\"NaN\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Infinity\")", qInf());
- toNumber.insert("engine->evaluate(\"-Infinity\")", qInf());
- toNumber.insert("engine->evaluate(\"'ciao'\")", qQNaN());
- toNumber.insert("engine->evaluate(\"''\")", 0);
- toNumber.insert("engine->evaluate(\"'0'\")", 0);
- toNumber.insert("engine->evaluate(\"'123'\")", 123);
- toNumber.insert("engine->evaluate(\"'12.4'\")", 12.4);
- toNumber.insert("engine->nullValue()", 0);
- toNumber.insert("engine->undefinedValue()", qQNaN());
- }
- newRow(expr) << toNumber.value(expr);
-}
-
-void tst_QScriptValue::toNumber_test(const char*, const QScriptValue& value)
-{
- QFETCH(qsreal, expected);
- if (qIsNaN(expected)) {
- QVERIFY(qIsNaN(value.toNumber()));
- return;
- }
- if (qIsInf(expected)) {
- QVERIFY(qIsInf(value.toNumber()));
- QVERIFY(qIsInf(value.toNumber()));
- return;
- }
- QCOMPARE(value.toNumber(), expected);
- QCOMPARE(value.toNumber(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toNumber)
-
-
-void tst_QScriptValue::toBool_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toBool_makeData(const char* expr)
-{
- static QHash<QString, bool> toBool;
- if (toBool.isEmpty()) {
- toBool.insert("QScriptValue()", false);
- toBool.insert("QScriptValue(QScriptValue::UndefinedValue)", false);
- toBool.insert("QScriptValue(QScriptValue::NullValue)", false);
- toBool.insert("QScriptValue(true)", true);
- toBool.insert("QScriptValue(false)", false);
- toBool.insert("QScriptValue(int(122))", true);
- toBool.insert("QScriptValue(uint(124))", true);
- toBool.insert("QScriptValue(0)", false);
- toBool.insert("QScriptValue(0.0)", false);
- toBool.insert("QScriptValue(123.0)", true);
- toBool.insert("QScriptValue(6.37e-8)", true);
- toBool.insert("QScriptValue(-6.37e-8)", true);
- toBool.insert("QScriptValue(0x43211234)", true);
- toBool.insert("QScriptValue(0x10000)", true);
- toBool.insert("QScriptValue(0x10001)", true);
- toBool.insert("QScriptValue(qSNaN())", false);
- toBool.insert("QScriptValue(qQNaN())", false);
- toBool.insert("QScriptValue(qInf())", true);
- toBool.insert("QScriptValue(-qInf())", true);
- toBool.insert("QScriptValue(\"NaN\")", true);
- toBool.insert("QScriptValue(\"Infinity\")", true);
- toBool.insert("QScriptValue(\"-Infinity\")", true);
- toBool.insert("QScriptValue(\"ciao\")", true);
- toBool.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true);
- toBool.insert("QScriptValue(QString(\"\"))", false);
- toBool.insert("QScriptValue(QString())", false);
- toBool.insert("QScriptValue(QString(\"0\"))", true);
- toBool.insert("QScriptValue(QString(\"123\"))", true);
- toBool.insert("QScriptValue(QString(\"12.4\"))", true);
- toBool.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false);
- toBool.insert("QScriptValue(0, QScriptValue::NullValue)", false);
- toBool.insert("QScriptValue(0, true)", true);
- toBool.insert("QScriptValue(0, false)", false);
- toBool.insert("QScriptValue(0, int(122))", true);
- toBool.insert("QScriptValue(0, uint(124))", true);
- toBool.insert("QScriptValue(0, 0)", false);
- toBool.insert("QScriptValue(0, 0.0)", false);
- toBool.insert("QScriptValue(0, 123.0)", true);
- toBool.insert("QScriptValue(0, 6.37e-8)", true);
- toBool.insert("QScriptValue(0, -6.37e-8)", true);
- toBool.insert("QScriptValue(0, 0x43211234)", true);
- toBool.insert("QScriptValue(0, 0x10000)", true);
- toBool.insert("QScriptValue(0, 0x10001)", true);
- toBool.insert("QScriptValue(0, qSNaN())", false);
- toBool.insert("QScriptValue(0, qQNaN())", false);
- toBool.insert("QScriptValue(0, qInf())", true);
- toBool.insert("QScriptValue(0, -qInf())", true);
- toBool.insert("QScriptValue(0, \"NaN\")", true);
- toBool.insert("QScriptValue(0, \"Infinity\")", true);
- toBool.insert("QScriptValue(0, \"-Infinity\")", true);
- toBool.insert("QScriptValue(0, \"ciao\")", true);
- toBool.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true);
- toBool.insert("QScriptValue(0, QString(\"\"))", false);
- toBool.insert("QScriptValue(0, QString())", false);
- toBool.insert("QScriptValue(0, QString(\"0\"))", true);
- toBool.insert("QScriptValue(0, QString(\"123\"))", true);
- toBool.insert("QScriptValue(0, QString(\"12.3\"))", true);
- toBool.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false);
- toBool.insert("QScriptValue(engine, QScriptValue::NullValue)", false);
- toBool.insert("QScriptValue(engine, true)", true);
- toBool.insert("QScriptValue(engine, false)", false);
- toBool.insert("QScriptValue(engine, int(122))", true);
- toBool.insert("QScriptValue(engine, uint(124))", true);
- toBool.insert("QScriptValue(engine, 0)", false);
- toBool.insert("QScriptValue(engine, 0.0)", false);
- toBool.insert("QScriptValue(engine, 123.0)", true);
- toBool.insert("QScriptValue(engine, 6.37e-8)", true);
- toBool.insert("QScriptValue(engine, -6.37e-8)", true);
- toBool.insert("QScriptValue(engine, 0x43211234)", true);
- toBool.insert("QScriptValue(engine, 0x10000)", true);
- toBool.insert("QScriptValue(engine, 0x10001)", true);
- toBool.insert("QScriptValue(engine, qSNaN())", false);
- toBool.insert("QScriptValue(engine, qQNaN())", false);
- toBool.insert("QScriptValue(engine, qInf())", true);
- toBool.insert("QScriptValue(engine, -qInf())", true);
- toBool.insert("QScriptValue(engine, \"NaN\")", true);
- toBool.insert("QScriptValue(engine, \"Infinity\")", true);
- toBool.insert("QScriptValue(engine, \"-Infinity\")", true);
- toBool.insert("QScriptValue(engine, \"ciao\")", true);
- toBool.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true);
- toBool.insert("QScriptValue(engine, QString(\"\"))", false);
- toBool.insert("QScriptValue(engine, QString())", false);
- toBool.insert("QScriptValue(engine, QString(\"0\"))", true);
- toBool.insert("QScriptValue(engine, QString(\"123\"))", true);
- toBool.insert("QScriptValue(engine, QString(\"1.23\"))", true);
- toBool.insert("engine->evaluate(\"[]\")", true);
- toBool.insert("engine->evaluate(\"{}\")", false);
- toBool.insert("engine->evaluate(\"Object.prototype\")", true);
- toBool.insert("engine->evaluate(\"Date.prototype\")", true);
- toBool.insert("engine->evaluate(\"Array.prototype\")", true);
- toBool.insert("engine->evaluate(\"Function.prototype\")", true);
- toBool.insert("engine->evaluate(\"Error.prototype\")", true);
- toBool.insert("engine->evaluate(\"Object\")", true);
- toBool.insert("engine->evaluate(\"Array\")", true);
- toBool.insert("engine->evaluate(\"Number\")", true);
- toBool.insert("engine->evaluate(\"Function\")", true);
- toBool.insert("engine->evaluate(\"(function() { return 1; })\")", true);
- toBool.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true);
- toBool.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true);
- toBool.insert("engine->evaluate(\"/foo/\")", true);
- toBool.insert("engine->evaluate(\"new Object()\")", true);
- toBool.insert("engine->evaluate(\"new Array()\")", true);
- toBool.insert("engine->evaluate(\"new Error()\")", true);
- toBool.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", true);
- toBool.insert("engine->evaluate(\"Undefined\")", true);
- toBool.insert("engine->evaluate(\"Null\")", true);
- toBool.insert("engine->evaluate(\"True\")", true);
- toBool.insert("engine->evaluate(\"False\")", true);
- toBool.insert("engine->evaluate(\"undefined\")", false);
- toBool.insert("engine->evaluate(\"null\")", false);
- toBool.insert("engine->evaluate(\"true\")", true);
- toBool.insert("engine->evaluate(\"false\")", false);
- toBool.insert("engine->evaluate(\"122\")", true);
- toBool.insert("engine->evaluate(\"124\")", true);
- toBool.insert("engine->evaluate(\"0\")", false);
- toBool.insert("engine->evaluate(\"0.0\")", false);
- toBool.insert("engine->evaluate(\"123.0\")", true);
- toBool.insert("engine->evaluate(\"6.37e-8\")", true);
- toBool.insert("engine->evaluate(\"-6.37e-8\")", true);
- toBool.insert("engine->evaluate(\"0x43211234\")", true);
- toBool.insert("engine->evaluate(\"0x10000\")", true);
- toBool.insert("engine->evaluate(\"0x10001\")", true);
- toBool.insert("engine->evaluate(\"NaN\")", false);
- toBool.insert("engine->evaluate(\"Infinity\")", true);
- toBool.insert("engine->evaluate(\"-Infinity\")", true);
- toBool.insert("engine->evaluate(\"'ciao'\")", true);
- toBool.insert("engine->evaluate(\"''\")", false);
- toBool.insert("engine->evaluate(\"'0'\")", true);
- toBool.insert("engine->evaluate(\"'123'\")", true);
- toBool.insert("engine->evaluate(\"'12.4'\")", true);
- toBool.insert("engine->nullValue()", false);
- toBool.insert("engine->undefinedValue()", false);
- }
- newRow(expr) << toBool.value(expr);
-}
-
-void tst_QScriptValue::toBool_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.toBool(), expected);
- QCOMPARE(value.toBool(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toBool)
-
-
-void tst_QScriptValue::toBoolean_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toBoolean_makeData(const char* expr)
-{
- static QHash<QString, bool> toBoolean;
- if (toBoolean.isEmpty()) {
- toBoolean.insert("QScriptValue()", false);
- toBoolean.insert("QScriptValue(QScriptValue::UndefinedValue)", false);
- toBoolean.insert("QScriptValue(QScriptValue::NullValue)", false);
- toBoolean.insert("QScriptValue(true)", true);
- toBoolean.insert("QScriptValue(false)", false);
- toBoolean.insert("QScriptValue(int(122))", true);
- toBoolean.insert("QScriptValue(uint(124))", true);
- toBoolean.insert("QScriptValue(0)", false);
- toBoolean.insert("QScriptValue(0.0)", false);
- toBoolean.insert("QScriptValue(123.0)", true);
- toBoolean.insert("QScriptValue(6.37e-8)", true);
- toBoolean.insert("QScriptValue(-6.37e-8)", true);
- toBoolean.insert("QScriptValue(0x43211234)", true);
- toBoolean.insert("QScriptValue(0x10000)", true);
- toBoolean.insert("QScriptValue(0x10001)", true);
- toBoolean.insert("QScriptValue(qSNaN())", false);
- toBoolean.insert("QScriptValue(qQNaN())", false);
- toBoolean.insert("QScriptValue(qInf())", true);
- toBoolean.insert("QScriptValue(-qInf())", true);
- toBoolean.insert("QScriptValue(\"NaN\")", true);
- toBoolean.insert("QScriptValue(\"Infinity\")", true);
- toBoolean.insert("QScriptValue(\"-Infinity\")", true);
- toBoolean.insert("QScriptValue(\"ciao\")", true);
- toBoolean.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true);
- toBoolean.insert("QScriptValue(QString(\"\"))", false);
- toBoolean.insert("QScriptValue(QString())", false);
- toBoolean.insert("QScriptValue(QString(\"0\"))", true);
- toBoolean.insert("QScriptValue(QString(\"123\"))", true);
- toBoolean.insert("QScriptValue(QString(\"12.4\"))", true);
- toBoolean.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false);
- toBoolean.insert("QScriptValue(0, QScriptValue::NullValue)", false);
- toBoolean.insert("QScriptValue(0, true)", true);
- toBoolean.insert("QScriptValue(0, false)", false);
- toBoolean.insert("QScriptValue(0, int(122))", true);
- toBoolean.insert("QScriptValue(0, uint(124))", true);
- toBoolean.insert("QScriptValue(0, 0)", false);
- toBoolean.insert("QScriptValue(0, 0.0)", false);
- toBoolean.insert("QScriptValue(0, 123.0)", true);
- toBoolean.insert("QScriptValue(0, 6.37e-8)", true);
- toBoolean.insert("QScriptValue(0, -6.37e-8)", true);
- toBoolean.insert("QScriptValue(0, 0x43211234)", true);
- toBoolean.insert("QScriptValue(0, 0x10000)", true);
- toBoolean.insert("QScriptValue(0, 0x10001)", true);
- toBoolean.insert("QScriptValue(0, qSNaN())", false);
- toBoolean.insert("QScriptValue(0, qQNaN())", false);
- toBoolean.insert("QScriptValue(0, qInf())", true);
- toBoolean.insert("QScriptValue(0, -qInf())", true);
- toBoolean.insert("QScriptValue(0, \"NaN\")", true);
- toBoolean.insert("QScriptValue(0, \"Infinity\")", true);
- toBoolean.insert("QScriptValue(0, \"-Infinity\")", true);
- toBoolean.insert("QScriptValue(0, \"ciao\")", true);
- toBoolean.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true);
- toBoolean.insert("QScriptValue(0, QString(\"\"))", false);
- toBoolean.insert("QScriptValue(0, QString())", false);
- toBoolean.insert("QScriptValue(0, QString(\"0\"))", true);
- toBoolean.insert("QScriptValue(0, QString(\"123\"))", true);
- toBoolean.insert("QScriptValue(0, QString(\"12.3\"))", true);
- toBoolean.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false);
- toBoolean.insert("QScriptValue(engine, QScriptValue::NullValue)", false);
- toBoolean.insert("QScriptValue(engine, true)", true);
- toBoolean.insert("QScriptValue(engine, false)", false);
- toBoolean.insert("QScriptValue(engine, int(122))", true);
- toBoolean.insert("QScriptValue(engine, uint(124))", true);
- toBoolean.insert("QScriptValue(engine, 0)", false);
- toBoolean.insert("QScriptValue(engine, 0.0)", false);
- toBoolean.insert("QScriptValue(engine, 123.0)", true);
- toBoolean.insert("QScriptValue(engine, 6.37e-8)", true);
- toBoolean.insert("QScriptValue(engine, -6.37e-8)", true);
- toBoolean.insert("QScriptValue(engine, 0x43211234)", true);
- toBoolean.insert("QScriptValue(engine, 0x10000)", true);
- toBoolean.insert("QScriptValue(engine, 0x10001)", true);
- toBoolean.insert("QScriptValue(engine, qSNaN())", false);
- toBoolean.insert("QScriptValue(engine, qQNaN())", false);
- toBoolean.insert("QScriptValue(engine, qInf())", true);
- toBoolean.insert("QScriptValue(engine, -qInf())", true);
- toBoolean.insert("QScriptValue(engine, \"NaN\")", true);
- toBoolean.insert("QScriptValue(engine, \"Infinity\")", true);
- toBoolean.insert("QScriptValue(engine, \"-Infinity\")", true);
- toBoolean.insert("QScriptValue(engine, \"ciao\")", true);
- toBoolean.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true);
- toBoolean.insert("QScriptValue(engine, QString(\"\"))", false);
- toBoolean.insert("QScriptValue(engine, QString())", false);
- toBoolean.insert("QScriptValue(engine, QString(\"0\"))", true);
- toBoolean.insert("QScriptValue(engine, QString(\"123\"))", true);
- toBoolean.insert("QScriptValue(engine, QString(\"1.23\"))", true);
- toBoolean.insert("engine->evaluate(\"[]\")", true);
- toBoolean.insert("engine->evaluate(\"{}\")", false);
- toBoolean.insert("engine->evaluate(\"Object.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Date.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Array.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Function.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Error.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Object\")", true);
- toBoolean.insert("engine->evaluate(\"Array\")", true);
- toBoolean.insert("engine->evaluate(\"Number\")", true);
- toBoolean.insert("engine->evaluate(\"Function\")", true);
- toBoolean.insert("engine->evaluate(\"(function() { return 1; })\")", true);
- toBoolean.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true);
- toBoolean.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true);
- toBoolean.insert("engine->evaluate(\"/foo/\")", true);
- toBoolean.insert("engine->evaluate(\"new Object()\")", true);
- toBoolean.insert("engine->evaluate(\"new Array()\")", true);
- toBoolean.insert("engine->evaluate(\"new Error()\")", true);
- toBoolean.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", true);
- toBoolean.insert("engine->evaluate(\"Undefined\")", true);
- toBoolean.insert("engine->evaluate(\"Null\")", true);
- toBoolean.insert("engine->evaluate(\"True\")", true);
- toBoolean.insert("engine->evaluate(\"False\")", true);
- toBoolean.insert("engine->evaluate(\"undefined\")", false);
- toBoolean.insert("engine->evaluate(\"null\")", false);
- toBoolean.insert("engine->evaluate(\"true\")", true);
- toBoolean.insert("engine->evaluate(\"false\")", false);
- toBoolean.insert("engine->evaluate(\"122\")", true);
- toBoolean.insert("engine->evaluate(\"124\")", true);
- toBoolean.insert("engine->evaluate(\"0\")", false);
- toBoolean.insert("engine->evaluate(\"0.0\")", false);
- toBoolean.insert("engine->evaluate(\"123.0\")", true);
- toBoolean.insert("engine->evaluate(\"6.37e-8\")", true);
- toBoolean.insert("engine->evaluate(\"-6.37e-8\")", true);
- toBoolean.insert("engine->evaluate(\"0x43211234\")", true);
- toBoolean.insert("engine->evaluate(\"0x10000\")", true);
- toBoolean.insert("engine->evaluate(\"0x10001\")", true);
- toBoolean.insert("engine->evaluate(\"NaN\")", false);
- toBoolean.insert("engine->evaluate(\"Infinity\")", true);
- toBoolean.insert("engine->evaluate(\"-Infinity\")", true);
- toBoolean.insert("engine->evaluate(\"'ciao'\")", true);
- toBoolean.insert("engine->evaluate(\"''\")", false);
- toBoolean.insert("engine->evaluate(\"'0'\")", true);
- toBoolean.insert("engine->evaluate(\"'123'\")", true);
- toBoolean.insert("engine->evaluate(\"'12.4'\")", true);
- toBoolean.insert("engine->nullValue()", false);
- toBoolean.insert("engine->undefinedValue()", false);
- }
- newRow(expr) << toBoolean.value(expr);
-}
-
-void tst_QScriptValue::toBoolean_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.toBoolean(), expected);
- QCOMPARE(value.toBoolean(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toBoolean)
-
-
-void tst_QScriptValue::toInteger_initData()
-{
- QTest::addColumn<qsreal>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toInteger_makeData(const char* expr)
-{
- static QHash<QString, qsreal> toInteger;
- if (toInteger.isEmpty()) {
- toInteger.insert("QScriptValue()", 0);
- toInteger.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toInteger.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toInteger.insert("QScriptValue(true)", 1);
- toInteger.insert("QScriptValue(false)", 0);
- toInteger.insert("QScriptValue(int(122))", 122);
- toInteger.insert("QScriptValue(uint(124))", 124);
- toInteger.insert("QScriptValue(0)", 0);
- toInteger.insert("QScriptValue(0.0)", 0);
- toInteger.insert("QScriptValue(123.0)", 123);
- toInteger.insert("QScriptValue(6.37e-8)", 0);
- toInteger.insert("QScriptValue(-6.37e-8)", 0);
- toInteger.insert("QScriptValue(0x43211234)", 1126240820);
- toInteger.insert("QScriptValue(0x10000)", 65536);
- toInteger.insert("QScriptValue(0x10001)", 65537);
- toInteger.insert("QScriptValue(qSNaN())", 0);
- toInteger.insert("QScriptValue(qQNaN())", 0);
- toInteger.insert("QScriptValue(qInf())", qInf());
- toInteger.insert("QScriptValue(-qInf())", qInf());
- toInteger.insert("QScriptValue(\"NaN\")", 0);
- toInteger.insert("QScriptValue(\"Infinity\")", qInf());
- toInteger.insert("QScriptValue(\"-Infinity\")", qInf());
- toInteger.insert("QScriptValue(\"ciao\")", 0);
- toInteger.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toInteger.insert("QScriptValue(QString(\"\"))", 0);
- toInteger.insert("QScriptValue(QString())", 0);
- toInteger.insert("QScriptValue(QString(\"0\"))", 0);
- toInteger.insert("QScriptValue(QString(\"123\"))", 123);
- toInteger.insert("QScriptValue(QString(\"12.4\"))", 12);
- toInteger.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toInteger.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toInteger.insert("QScriptValue(0, true)", 1);
- toInteger.insert("QScriptValue(0, false)", 0);
- toInteger.insert("QScriptValue(0, int(122))", 122);
- toInteger.insert("QScriptValue(0, uint(124))", 124);
- toInteger.insert("QScriptValue(0, 0)", 0);
- toInteger.insert("QScriptValue(0, 0.0)", 0);
- toInteger.insert("QScriptValue(0, 123.0)", 123);
- toInteger.insert("QScriptValue(0, 6.37e-8)", 0);
- toInteger.insert("QScriptValue(0, -6.37e-8)", 0);
- toInteger.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toInteger.insert("QScriptValue(0, 0x10000)", 65536);
- toInteger.insert("QScriptValue(0, 0x10001)", 65537);
- toInteger.insert("QScriptValue(0, qSNaN())", 0);
- toInteger.insert("QScriptValue(0, qQNaN())", 0);
- toInteger.insert("QScriptValue(0, qInf())", qInf());
- toInteger.insert("QScriptValue(0, -qInf())", qInf());
- toInteger.insert("QScriptValue(0, \"NaN\")", 0);
- toInteger.insert("QScriptValue(0, \"Infinity\")", qInf());
- toInteger.insert("QScriptValue(0, \"-Infinity\")", qInf());
- toInteger.insert("QScriptValue(0, \"ciao\")", 0);
- toInteger.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toInteger.insert("QScriptValue(0, QString(\"\"))", 0);
- toInteger.insert("QScriptValue(0, QString())", 0);
- toInteger.insert("QScriptValue(0, QString(\"0\"))", 0);
- toInteger.insert("QScriptValue(0, QString(\"123\"))", 123);
- toInteger.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toInteger.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toInteger.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toInteger.insert("QScriptValue(engine, true)", 1);
- toInteger.insert("QScriptValue(engine, false)", 0);
- toInteger.insert("QScriptValue(engine, int(122))", 122);
- toInteger.insert("QScriptValue(engine, uint(124))", 124);
- toInteger.insert("QScriptValue(engine, 0)", 0);
- toInteger.insert("QScriptValue(engine, 0.0)", 0);
- toInteger.insert("QScriptValue(engine, 123.0)", 123);
- toInteger.insert("QScriptValue(engine, 6.37e-8)", 0);
- toInteger.insert("QScriptValue(engine, -6.37e-8)", 0);
- toInteger.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toInteger.insert("QScriptValue(engine, 0x10000)", 65536);
- toInteger.insert("QScriptValue(engine, 0x10001)", 65537);
- toInteger.insert("QScriptValue(engine, qSNaN())", 0);
- toInteger.insert("QScriptValue(engine, qQNaN())", 0);
- toInteger.insert("QScriptValue(engine, qInf())", qInf());
- toInteger.insert("QScriptValue(engine, -qInf())", qInf());
- toInteger.insert("QScriptValue(engine, \"NaN\")", 0);
- toInteger.insert("QScriptValue(engine, \"Infinity\")", qInf());
- toInteger.insert("QScriptValue(engine, \"-Infinity\")", qInf());
- toInteger.insert("QScriptValue(engine, \"ciao\")", 0);
- toInteger.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toInteger.insert("QScriptValue(engine, QString(\"\"))", 0);
- toInteger.insert("QScriptValue(engine, QString())", 0);
- toInteger.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toInteger.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toInteger.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toInteger.insert("engine->evaluate(\"[]\")", 0);
- toInteger.insert("engine->evaluate(\"{}\")", 0);
- toInteger.insert("engine->evaluate(\"Object.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Date.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Array.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Function.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Error.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Object\")", 0);
- toInteger.insert("engine->evaluate(\"Array\")", 0);
- toInteger.insert("engine->evaluate(\"Number\")", 0);
- toInteger.insert("engine->evaluate(\"Function\")", 0);
- toInteger.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toInteger.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toInteger.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toInteger.insert("engine->evaluate(\"/foo/\")", 0);
- toInteger.insert("engine->evaluate(\"new Object()\")", 0);
- toInteger.insert("engine->evaluate(\"new Array()\")", 0);
- toInteger.insert("engine->evaluate(\"new Error()\")", 0);
- toInteger.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toInteger.insert("engine->evaluate(\"Undefined\")", 0);
- toInteger.insert("engine->evaluate(\"Null\")", 0);
- toInteger.insert("engine->evaluate(\"True\")", 0);
- toInteger.insert("engine->evaluate(\"False\")", 0);
- toInteger.insert("engine->evaluate(\"undefined\")", 0);
- toInteger.insert("engine->evaluate(\"null\")", 0);
- toInteger.insert("engine->evaluate(\"true\")", 1);
- toInteger.insert("engine->evaluate(\"false\")", 0);
- toInteger.insert("engine->evaluate(\"122\")", 122);
- toInteger.insert("engine->evaluate(\"124\")", 124);
- toInteger.insert("engine->evaluate(\"0\")", 0);
- toInteger.insert("engine->evaluate(\"0.0\")", 0);
- toInteger.insert("engine->evaluate(\"123.0\")", 123);
- toInteger.insert("engine->evaluate(\"6.37e-8\")", 0);
- toInteger.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toInteger.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toInteger.insert("engine->evaluate(\"0x10000\")", 65536);
- toInteger.insert("engine->evaluate(\"0x10001\")", 65537);
- toInteger.insert("engine->evaluate(\"NaN\")", 0);
- toInteger.insert("engine->evaluate(\"Infinity\")", qInf());
- toInteger.insert("engine->evaluate(\"-Infinity\")", qInf());
- toInteger.insert("engine->evaluate(\"'ciao'\")", 0);
- toInteger.insert("engine->evaluate(\"''\")", 0);
- toInteger.insert("engine->evaluate(\"'0'\")", 0);
- toInteger.insert("engine->evaluate(\"'123'\")", 123);
- toInteger.insert("engine->evaluate(\"'12.4'\")", 12);
- toInteger.insert("engine->nullValue()", 0);
- toInteger.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toInteger.value(expr);
-}
-
-void tst_QScriptValue::toInteger_test(const char*, const QScriptValue& value)
-{
- QFETCH(qsreal, expected);
- if (qIsInf(expected)) {
- QVERIFY(qIsInf(value.toInteger()));
- QVERIFY(qIsInf(value.toInteger()));
- return;
- }
- QCOMPARE(value.toInteger(), expected);
- QCOMPARE(value.toInteger(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toInteger)
-
-
-void tst_QScriptValue::toInt32_initData()
-{
- QTest::addColumn<qint32>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toInt32_makeData(const char* expr)
-{
- static QHash<QString, qint32> toInt32;
- if (toInt32.isEmpty()) {
- toInt32.insert("QScriptValue()", 0);
- toInt32.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toInt32.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toInt32.insert("QScriptValue(true)", 1);
- toInt32.insert("QScriptValue(false)", 0);
- toInt32.insert("QScriptValue(int(122))", 122);
- toInt32.insert("QScriptValue(uint(124))", 124);
- toInt32.insert("QScriptValue(0)", 0);
- toInt32.insert("QScriptValue(0.0)", 0);
- toInt32.insert("QScriptValue(123.0)", 123);
- toInt32.insert("QScriptValue(6.37e-8)", 0);
- toInt32.insert("QScriptValue(-6.37e-8)", 0);
- toInt32.insert("QScriptValue(0x43211234)", 1126240820);
- toInt32.insert("QScriptValue(0x10000)", 65536);
- toInt32.insert("QScriptValue(0x10001)", 65537);
- toInt32.insert("QScriptValue(qSNaN())", 0);
- toInt32.insert("QScriptValue(qQNaN())", 0);
- toInt32.insert("QScriptValue(qInf())", 0);
- toInt32.insert("QScriptValue(-qInf())", 0);
- toInt32.insert("QScriptValue(\"NaN\")", 0);
- toInt32.insert("QScriptValue(\"Infinity\")", 0);
- toInt32.insert("QScriptValue(\"-Infinity\")", 0);
- toInt32.insert("QScriptValue(\"ciao\")", 0);
- toInt32.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toInt32.insert("QScriptValue(QString(\"\"))", 0);
- toInt32.insert("QScriptValue(QString())", 0);
- toInt32.insert("QScriptValue(QString(\"0\"))", 0);
- toInt32.insert("QScriptValue(QString(\"123\"))", 123);
- toInt32.insert("QScriptValue(QString(\"12.4\"))", 12);
- toInt32.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toInt32.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toInt32.insert("QScriptValue(0, true)", 1);
- toInt32.insert("QScriptValue(0, false)", 0);
- toInt32.insert("QScriptValue(0, int(122))", 122);
- toInt32.insert("QScriptValue(0, uint(124))", 124);
- toInt32.insert("QScriptValue(0, 0)", 0);
- toInt32.insert("QScriptValue(0, 0.0)", 0);
- toInt32.insert("QScriptValue(0, 123.0)", 123);
- toInt32.insert("QScriptValue(0, 6.37e-8)", 0);
- toInt32.insert("QScriptValue(0, -6.37e-8)", 0);
- toInt32.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toInt32.insert("QScriptValue(0, 0x10000)", 65536);
- toInt32.insert("QScriptValue(0, 0x10001)", 65537);
- toInt32.insert("QScriptValue(0, qSNaN())", 0);
- toInt32.insert("QScriptValue(0, qQNaN())", 0);
- toInt32.insert("QScriptValue(0, qInf())", 0);
- toInt32.insert("QScriptValue(0, -qInf())", 0);
- toInt32.insert("QScriptValue(0, \"NaN\")", 0);
- toInt32.insert("QScriptValue(0, \"Infinity\")", 0);
- toInt32.insert("QScriptValue(0, \"-Infinity\")", 0);
- toInt32.insert("QScriptValue(0, \"ciao\")", 0);
- toInt32.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toInt32.insert("QScriptValue(0, QString(\"\"))", 0);
- toInt32.insert("QScriptValue(0, QString())", 0);
- toInt32.insert("QScriptValue(0, QString(\"0\"))", 0);
- toInt32.insert("QScriptValue(0, QString(\"123\"))", 123);
- toInt32.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toInt32.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toInt32.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toInt32.insert("QScriptValue(engine, true)", 1);
- toInt32.insert("QScriptValue(engine, false)", 0);
- toInt32.insert("QScriptValue(engine, int(122))", 122);
- toInt32.insert("QScriptValue(engine, uint(124))", 124);
- toInt32.insert("QScriptValue(engine, 0)", 0);
- toInt32.insert("QScriptValue(engine, 0.0)", 0);
- toInt32.insert("QScriptValue(engine, 123.0)", 123);
- toInt32.insert("QScriptValue(engine, 6.37e-8)", 0);
- toInt32.insert("QScriptValue(engine, -6.37e-8)", 0);
- toInt32.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toInt32.insert("QScriptValue(engine, 0x10000)", 65536);
- toInt32.insert("QScriptValue(engine, 0x10001)", 65537);
- toInt32.insert("QScriptValue(engine, qSNaN())", 0);
- toInt32.insert("QScriptValue(engine, qQNaN())", 0);
- toInt32.insert("QScriptValue(engine, qInf())", 0);
- toInt32.insert("QScriptValue(engine, -qInf())", 0);
- toInt32.insert("QScriptValue(engine, \"NaN\")", 0);
- toInt32.insert("QScriptValue(engine, \"Infinity\")", 0);
- toInt32.insert("QScriptValue(engine, \"-Infinity\")", 0);
- toInt32.insert("QScriptValue(engine, \"ciao\")", 0);
- toInt32.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toInt32.insert("QScriptValue(engine, QString(\"\"))", 0);
- toInt32.insert("QScriptValue(engine, QString())", 0);
- toInt32.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toInt32.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toInt32.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toInt32.insert("engine->evaluate(\"[]\")", 0);
- toInt32.insert("engine->evaluate(\"{}\")", 0);
- toInt32.insert("engine->evaluate(\"Object.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Date.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Array.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Function.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Error.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Object\")", 0);
- toInt32.insert("engine->evaluate(\"Array\")", 0);
- toInt32.insert("engine->evaluate(\"Number\")", 0);
- toInt32.insert("engine->evaluate(\"Function\")", 0);
- toInt32.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toInt32.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toInt32.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toInt32.insert("engine->evaluate(\"/foo/\")", 0);
- toInt32.insert("engine->evaluate(\"new Object()\")", 0);
- toInt32.insert("engine->evaluate(\"new Array()\")", 0);
- toInt32.insert("engine->evaluate(\"new Error()\")", 0);
- toInt32.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toInt32.insert("engine->evaluate(\"Undefined\")", 0);
- toInt32.insert("engine->evaluate(\"Null\")", 0);
- toInt32.insert("engine->evaluate(\"True\")", 0);
- toInt32.insert("engine->evaluate(\"False\")", 0);
- toInt32.insert("engine->evaluate(\"undefined\")", 0);
- toInt32.insert("engine->evaluate(\"null\")", 0);
- toInt32.insert("engine->evaluate(\"true\")", 1);
- toInt32.insert("engine->evaluate(\"false\")", 0);
- toInt32.insert("engine->evaluate(\"122\")", 122);
- toInt32.insert("engine->evaluate(\"124\")", 124);
- toInt32.insert("engine->evaluate(\"0\")", 0);
- toInt32.insert("engine->evaluate(\"0.0\")", 0);
- toInt32.insert("engine->evaluate(\"123.0\")", 123);
- toInt32.insert("engine->evaluate(\"6.37e-8\")", 0);
- toInt32.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toInt32.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toInt32.insert("engine->evaluate(\"0x10000\")", 65536);
- toInt32.insert("engine->evaluate(\"0x10001\")", 65537);
- toInt32.insert("engine->evaluate(\"NaN\")", 0);
- toInt32.insert("engine->evaluate(\"Infinity\")", 0);
- toInt32.insert("engine->evaluate(\"-Infinity\")", 0);
- toInt32.insert("engine->evaluate(\"'ciao'\")", 0);
- toInt32.insert("engine->evaluate(\"''\")", 0);
- toInt32.insert("engine->evaluate(\"'0'\")", 0);
- toInt32.insert("engine->evaluate(\"'123'\")", 123);
- toInt32.insert("engine->evaluate(\"'12.4'\")", 12);
- toInt32.insert("engine->nullValue()", 0);
- toInt32.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toInt32.value(expr);
-}
-
-void tst_QScriptValue::toInt32_test(const char*, const QScriptValue& value)
-{
- QFETCH(qint32, expected);
- QCOMPARE(value.toInt32(), expected);
- QCOMPARE(value.toInt32(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toInt32)
-
-
-void tst_QScriptValue::toUInt32_initData()
-{
- QTest::addColumn<quint32>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toUInt32_makeData(const char* expr)
-{
- static QHash<QString, quint32> toUInt32;
- if (toUInt32.isEmpty()) {
- toUInt32.insert("QScriptValue()", 0);
- toUInt32.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toUInt32.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toUInt32.insert("QScriptValue(true)", 1);
- toUInt32.insert("QScriptValue(false)", 0);
- toUInt32.insert("QScriptValue(int(122))", 122);
- toUInt32.insert("QScriptValue(uint(124))", 124);
- toUInt32.insert("QScriptValue(0)", 0);
- toUInt32.insert("QScriptValue(0.0)", 0);
- toUInt32.insert("QScriptValue(123.0)", 123);
- toUInt32.insert("QScriptValue(6.37e-8)", 0);
- toUInt32.insert("QScriptValue(-6.37e-8)", 0);
- toUInt32.insert("QScriptValue(0x43211234)", 1126240820);
- toUInt32.insert("QScriptValue(0x10000)", 65536);
- toUInt32.insert("QScriptValue(0x10001)", 65537);
- toUInt32.insert("QScriptValue(qSNaN())", 0);
- toUInt32.insert("QScriptValue(qQNaN())", 0);
- toUInt32.insert("QScriptValue(qInf())", 0);
- toUInt32.insert("QScriptValue(-qInf())", 0);
- toUInt32.insert("QScriptValue(\"NaN\")", 0);
- toUInt32.insert("QScriptValue(\"Infinity\")", 0);
- toUInt32.insert("QScriptValue(\"-Infinity\")", 0);
- toUInt32.insert("QScriptValue(\"ciao\")", 0);
- toUInt32.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toUInt32.insert("QScriptValue(QString(\"\"))", 0);
- toUInt32.insert("QScriptValue(QString())", 0);
- toUInt32.insert("QScriptValue(QString(\"0\"))", 0);
- toUInt32.insert("QScriptValue(QString(\"123\"))", 123);
- toUInt32.insert("QScriptValue(QString(\"12.4\"))", 12);
- toUInt32.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toUInt32.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toUInt32.insert("QScriptValue(0, true)", 1);
- toUInt32.insert("QScriptValue(0, false)", 0);
- toUInt32.insert("QScriptValue(0, int(122))", 122);
- toUInt32.insert("QScriptValue(0, uint(124))", 124);
- toUInt32.insert("QScriptValue(0, 0)", 0);
- toUInt32.insert("QScriptValue(0, 0.0)", 0);
- toUInt32.insert("QScriptValue(0, 123.0)", 123);
- toUInt32.insert("QScriptValue(0, 6.37e-8)", 0);
- toUInt32.insert("QScriptValue(0, -6.37e-8)", 0);
- toUInt32.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toUInt32.insert("QScriptValue(0, 0x10000)", 65536);
- toUInt32.insert("QScriptValue(0, 0x10001)", 65537);
- toUInt32.insert("QScriptValue(0, qSNaN())", 0);
- toUInt32.insert("QScriptValue(0, qQNaN())", 0);
- toUInt32.insert("QScriptValue(0, qInf())", 0);
- toUInt32.insert("QScriptValue(0, -qInf())", 0);
- toUInt32.insert("QScriptValue(0, \"NaN\")", 0);
- toUInt32.insert("QScriptValue(0, \"Infinity\")", 0);
- toUInt32.insert("QScriptValue(0, \"-Infinity\")", 0);
- toUInt32.insert("QScriptValue(0, \"ciao\")", 0);
- toUInt32.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toUInt32.insert("QScriptValue(0, QString(\"\"))", 0);
- toUInt32.insert("QScriptValue(0, QString())", 0);
- toUInt32.insert("QScriptValue(0, QString(\"0\"))", 0);
- toUInt32.insert("QScriptValue(0, QString(\"123\"))", 123);
- toUInt32.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toUInt32.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toUInt32.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toUInt32.insert("QScriptValue(engine, true)", 1);
- toUInt32.insert("QScriptValue(engine, false)", 0);
- toUInt32.insert("QScriptValue(engine, int(122))", 122);
- toUInt32.insert("QScriptValue(engine, uint(124))", 124);
- toUInt32.insert("QScriptValue(engine, 0)", 0);
- toUInt32.insert("QScriptValue(engine, 0.0)", 0);
- toUInt32.insert("QScriptValue(engine, 123.0)", 123);
- toUInt32.insert("QScriptValue(engine, 6.37e-8)", 0);
- toUInt32.insert("QScriptValue(engine, -6.37e-8)", 0);
- toUInt32.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toUInt32.insert("QScriptValue(engine, 0x10000)", 65536);
- toUInt32.insert("QScriptValue(engine, 0x10001)", 65537);
- toUInt32.insert("QScriptValue(engine, qSNaN())", 0);
- toUInt32.insert("QScriptValue(engine, qQNaN())", 0);
- toUInt32.insert("QScriptValue(engine, qInf())", 0);
- toUInt32.insert("QScriptValue(engine, -qInf())", 0);
- toUInt32.insert("QScriptValue(engine, \"NaN\")", 0);
- toUInt32.insert("QScriptValue(engine, \"Infinity\")", 0);
- toUInt32.insert("QScriptValue(engine, \"-Infinity\")", 0);
- toUInt32.insert("QScriptValue(engine, \"ciao\")", 0);
- toUInt32.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toUInt32.insert("QScriptValue(engine, QString(\"\"))", 0);
- toUInt32.insert("QScriptValue(engine, QString())", 0);
- toUInt32.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toUInt32.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toUInt32.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toUInt32.insert("engine->evaluate(\"[]\")", 0);
- toUInt32.insert("engine->evaluate(\"{}\")", 0);
- toUInt32.insert("engine->evaluate(\"Object.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Date.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Array.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Function.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Error.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Object\")", 0);
- toUInt32.insert("engine->evaluate(\"Array\")", 0);
- toUInt32.insert("engine->evaluate(\"Number\")", 0);
- toUInt32.insert("engine->evaluate(\"Function\")", 0);
- toUInt32.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toUInt32.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toUInt32.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toUInt32.insert("engine->evaluate(\"/foo/\")", 0);
- toUInt32.insert("engine->evaluate(\"new Object()\")", 0);
- toUInt32.insert("engine->evaluate(\"new Array()\")", 0);
- toUInt32.insert("engine->evaluate(\"new Error()\")", 0);
- toUInt32.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toUInt32.insert("engine->evaluate(\"Undefined\")", 0);
- toUInt32.insert("engine->evaluate(\"Null\")", 0);
- toUInt32.insert("engine->evaluate(\"True\")", 0);
- toUInt32.insert("engine->evaluate(\"False\")", 0);
- toUInt32.insert("engine->evaluate(\"undefined\")", 0);
- toUInt32.insert("engine->evaluate(\"null\")", 0);
- toUInt32.insert("engine->evaluate(\"true\")", 1);
- toUInt32.insert("engine->evaluate(\"false\")", 0);
- toUInt32.insert("engine->evaluate(\"122\")", 122);
- toUInt32.insert("engine->evaluate(\"124\")", 124);
- toUInt32.insert("engine->evaluate(\"0\")", 0);
- toUInt32.insert("engine->evaluate(\"0.0\")", 0);
- toUInt32.insert("engine->evaluate(\"123.0\")", 123);
- toUInt32.insert("engine->evaluate(\"6.37e-8\")", 0);
- toUInt32.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toUInt32.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toUInt32.insert("engine->evaluate(\"0x10000\")", 65536);
- toUInt32.insert("engine->evaluate(\"0x10001\")", 65537);
- toUInt32.insert("engine->evaluate(\"NaN\")", 0);
- toUInt32.insert("engine->evaluate(\"Infinity\")", 0);
- toUInt32.insert("engine->evaluate(\"-Infinity\")", 0);
- toUInt32.insert("engine->evaluate(\"'ciao'\")", 0);
- toUInt32.insert("engine->evaluate(\"''\")", 0);
- toUInt32.insert("engine->evaluate(\"'0'\")", 0);
- toUInt32.insert("engine->evaluate(\"'123'\")", 123);
- toUInt32.insert("engine->evaluate(\"'12.4'\")", 12);
- toUInt32.insert("engine->nullValue()", 0);
- toUInt32.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toUInt32.value(expr);
-}
-
-void tst_QScriptValue::toUInt32_test(const char*, const QScriptValue& value)
-{
- QFETCH(quint32, expected);
- QCOMPARE(value.toUInt32(), expected);
- QCOMPARE(value.toUInt32(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toUInt32)
-
-
-void tst_QScriptValue::toUInt16_initData()
-{
- QTest::addColumn<quint16>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toUInt16_makeData(const char* expr)
-{
- static QHash<QString, quint16> toUInt16;
- if (toUInt16.isEmpty()) {
- toUInt16.insert("QScriptValue()", 0);
- toUInt16.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toUInt16.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toUInt16.insert("QScriptValue(true)", 1);
- toUInt16.insert("QScriptValue(false)", 0);
- toUInt16.insert("QScriptValue(int(122))", 122);
- toUInt16.insert("QScriptValue(uint(124))", 124);
- toUInt16.insert("QScriptValue(0)", 0);
- toUInt16.insert("QScriptValue(0.0)", 0);
- toUInt16.insert("QScriptValue(123.0)", 123);
- toUInt16.insert("QScriptValue(6.37e-8)", 0);
- toUInt16.insert("QScriptValue(-6.37e-8)", 0);
- toUInt16.insert("QScriptValue(0x43211234)", 4660);
- toUInt16.insert("QScriptValue(0x10000)", 0);
- toUInt16.insert("QScriptValue(0x10001)", 1);
- toUInt16.insert("QScriptValue(qSNaN())", 0);
- toUInt16.insert("QScriptValue(qQNaN())", 0);
- toUInt16.insert("QScriptValue(qInf())", 0);
- toUInt16.insert("QScriptValue(-qInf())", 0);
- toUInt16.insert("QScriptValue(\"NaN\")", 0);
- toUInt16.insert("QScriptValue(\"Infinity\")", 0);
- toUInt16.insert("QScriptValue(\"-Infinity\")", 0);
- toUInt16.insert("QScriptValue(\"ciao\")", 0);
- toUInt16.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toUInt16.insert("QScriptValue(QString(\"\"))", 0);
- toUInt16.insert("QScriptValue(QString())", 0);
- toUInt16.insert("QScriptValue(QString(\"0\"))", 0);
- toUInt16.insert("QScriptValue(QString(\"123\"))", 123);
- toUInt16.insert("QScriptValue(QString(\"12.4\"))", 12);
- toUInt16.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toUInt16.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toUInt16.insert("QScriptValue(0, true)", 1);
- toUInt16.insert("QScriptValue(0, false)", 0);
- toUInt16.insert("QScriptValue(0, int(122))", 122);
- toUInt16.insert("QScriptValue(0, uint(124))", 124);
- toUInt16.insert("QScriptValue(0, 0)", 0);
- toUInt16.insert("QScriptValue(0, 0.0)", 0);
- toUInt16.insert("QScriptValue(0, 123.0)", 123);
- toUInt16.insert("QScriptValue(0, 6.37e-8)", 0);
- toUInt16.insert("QScriptValue(0, -6.37e-8)", 0);
- toUInt16.insert("QScriptValue(0, 0x43211234)", 4660);
- toUInt16.insert("QScriptValue(0, 0x10000)", 0);
- toUInt16.insert("QScriptValue(0, 0x10001)", 1);
- toUInt16.insert("QScriptValue(0, qSNaN())", 0);
- toUInt16.insert("QScriptValue(0, qQNaN())", 0);
- toUInt16.insert("QScriptValue(0, qInf())", 0);
- toUInt16.insert("QScriptValue(0, -qInf())", 0);
- toUInt16.insert("QScriptValue(0, \"NaN\")", 0);
- toUInt16.insert("QScriptValue(0, \"Infinity\")", 0);
- toUInt16.insert("QScriptValue(0, \"-Infinity\")", 0);
- toUInt16.insert("QScriptValue(0, \"ciao\")", 0);
- toUInt16.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toUInt16.insert("QScriptValue(0, QString(\"\"))", 0);
- toUInt16.insert("QScriptValue(0, QString())", 0);
- toUInt16.insert("QScriptValue(0, QString(\"0\"))", 0);
- toUInt16.insert("QScriptValue(0, QString(\"123\"))", 123);
- toUInt16.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toUInt16.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toUInt16.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toUInt16.insert("QScriptValue(engine, true)", 1);
- toUInt16.insert("QScriptValue(engine, false)", 0);
- toUInt16.insert("QScriptValue(engine, int(122))", 122);
- toUInt16.insert("QScriptValue(engine, uint(124))", 124);
- toUInt16.insert("QScriptValue(engine, 0)", 0);
- toUInt16.insert("QScriptValue(engine, 0.0)", 0);
- toUInt16.insert("QScriptValue(engine, 123.0)", 123);
- toUInt16.insert("QScriptValue(engine, 6.37e-8)", 0);
- toUInt16.insert("QScriptValue(engine, -6.37e-8)", 0);
- toUInt16.insert("QScriptValue(engine, 0x43211234)", 4660);
- toUInt16.insert("QScriptValue(engine, 0x10000)", 0);
- toUInt16.insert("QScriptValue(engine, 0x10001)", 1);
- toUInt16.insert("QScriptValue(engine, qSNaN())", 0);
- toUInt16.insert("QScriptValue(engine, qQNaN())", 0);
- toUInt16.insert("QScriptValue(engine, qInf())", 0);
- toUInt16.insert("QScriptValue(engine, -qInf())", 0);
- toUInt16.insert("QScriptValue(engine, \"NaN\")", 0);
- toUInt16.insert("QScriptValue(engine, \"Infinity\")", 0);
- toUInt16.insert("QScriptValue(engine, \"-Infinity\")", 0);
- toUInt16.insert("QScriptValue(engine, \"ciao\")", 0);
- toUInt16.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toUInt16.insert("QScriptValue(engine, QString(\"\"))", 0);
- toUInt16.insert("QScriptValue(engine, QString())", 0);
- toUInt16.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toUInt16.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toUInt16.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toUInt16.insert("engine->evaluate(\"[]\")", 0);
- toUInt16.insert("engine->evaluate(\"{}\")", 0);
- toUInt16.insert("engine->evaluate(\"Object.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Date.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Array.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Function.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Error.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Object\")", 0);
- toUInt16.insert("engine->evaluate(\"Array\")", 0);
- toUInt16.insert("engine->evaluate(\"Number\")", 0);
- toUInt16.insert("engine->evaluate(\"Function\")", 0);
- toUInt16.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toUInt16.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toUInt16.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toUInt16.insert("engine->evaluate(\"/foo/\")", 0);
- toUInt16.insert("engine->evaluate(\"new Object()\")", 0);
- toUInt16.insert("engine->evaluate(\"new Array()\")", 0);
- toUInt16.insert("engine->evaluate(\"new Error()\")", 0);
- toUInt16.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toUInt16.insert("engine->evaluate(\"Undefined\")", 0);
- toUInt16.insert("engine->evaluate(\"Null\")", 0);
- toUInt16.insert("engine->evaluate(\"True\")", 0);
- toUInt16.insert("engine->evaluate(\"False\")", 0);
- toUInt16.insert("engine->evaluate(\"undefined\")", 0);
- toUInt16.insert("engine->evaluate(\"null\")", 0);
- toUInt16.insert("engine->evaluate(\"true\")", 1);
- toUInt16.insert("engine->evaluate(\"false\")", 0);
- toUInt16.insert("engine->evaluate(\"122\")", 122);
- toUInt16.insert("engine->evaluate(\"124\")", 124);
- toUInt16.insert("engine->evaluate(\"0\")", 0);
- toUInt16.insert("engine->evaluate(\"0.0\")", 0);
- toUInt16.insert("engine->evaluate(\"123.0\")", 123);
- toUInt16.insert("engine->evaluate(\"6.37e-8\")", 0);
- toUInt16.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toUInt16.insert("engine->evaluate(\"0x43211234\")", 4660);
- toUInt16.insert("engine->evaluate(\"0x10000\")", 0);
- toUInt16.insert("engine->evaluate(\"0x10001\")", 1);
- toUInt16.insert("engine->evaluate(\"NaN\")", 0);
- toUInt16.insert("engine->evaluate(\"Infinity\")", 0);
- toUInt16.insert("engine->evaluate(\"-Infinity\")", 0);
- toUInt16.insert("engine->evaluate(\"'ciao'\")", 0);
- toUInt16.insert("engine->evaluate(\"''\")", 0);
- toUInt16.insert("engine->evaluate(\"'0'\")", 0);
- toUInt16.insert("engine->evaluate(\"'123'\")", 123);
- toUInt16.insert("engine->evaluate(\"'12.4'\")", 12);
- toUInt16.insert("engine->nullValue()", 0);
- toUInt16.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toUInt16.value(expr);
-}
-
-void tst_QScriptValue::toUInt16_test(const char*, const QScriptValue& value)
-{
- QFETCH(quint16, expected);
- QCOMPARE(value.toUInt16(), expected);
- QCOMPARE(value.toUInt16(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toUInt16)
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp
new file mode 100644
index 0000000..b68aaf2
--- /dev/null
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp
@@ -0,0 +1,165 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+
+void tst_QScriptValue::initScriptValues()
+{
+ m_values.clear();
+ if (engine)
+ delete engine;
+ engine = new QScriptEngine;
+ DEFINE_TEST_VALUE(QScriptValue());
+ DEFINE_TEST_VALUE(QScriptValue(QScriptValue::UndefinedValue));
+ DEFINE_TEST_VALUE(QScriptValue(QScriptValue::NullValue));
+ DEFINE_TEST_VALUE(QScriptValue(true));
+ DEFINE_TEST_VALUE(QScriptValue(false));
+ DEFINE_TEST_VALUE(QScriptValue(int(122)));
+ DEFINE_TEST_VALUE(QScriptValue(uint(124)));
+ DEFINE_TEST_VALUE(QScriptValue(0));
+ DEFINE_TEST_VALUE(QScriptValue(0.0));
+ DEFINE_TEST_VALUE(QScriptValue(123.0));
+ DEFINE_TEST_VALUE(QScriptValue(6.37e-8));
+ DEFINE_TEST_VALUE(QScriptValue(-6.37e-8));
+ DEFINE_TEST_VALUE(QScriptValue(0x43211234));
+ DEFINE_TEST_VALUE(QScriptValue(0x10000));
+ DEFINE_TEST_VALUE(QScriptValue(0x10001));
+ DEFINE_TEST_VALUE(QScriptValue(qSNaN()));
+ DEFINE_TEST_VALUE(QScriptValue(qQNaN()));
+ DEFINE_TEST_VALUE(QScriptValue(qInf()));
+ DEFINE_TEST_VALUE(QScriptValue(-qInf()));
+ DEFINE_TEST_VALUE(QScriptValue("NaN"));
+ DEFINE_TEST_VALUE(QScriptValue("Infinity"));
+ DEFINE_TEST_VALUE(QScriptValue("-Infinity"));
+ DEFINE_TEST_VALUE(QScriptValue("ciao"));
+ DEFINE_TEST_VALUE(QScriptValue(QString::fromLatin1("ciao")));
+ DEFINE_TEST_VALUE(QScriptValue(QString("")));
+ DEFINE_TEST_VALUE(QScriptValue(QString()));
+ DEFINE_TEST_VALUE(QScriptValue(QString("0")));
+ DEFINE_TEST_VALUE(QScriptValue(QString("123")));
+ DEFINE_TEST_VALUE(QScriptValue(QString("12.4")));
+ DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::UndefinedValue));
+ DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::NullValue));
+ DEFINE_TEST_VALUE(QScriptValue(0, true));
+ DEFINE_TEST_VALUE(QScriptValue(0, false));
+ DEFINE_TEST_VALUE(QScriptValue(0, int(122)));
+ DEFINE_TEST_VALUE(QScriptValue(0, uint(124)));
+ DEFINE_TEST_VALUE(QScriptValue(0, 0));
+ DEFINE_TEST_VALUE(QScriptValue(0, 0.0));
+ DEFINE_TEST_VALUE(QScriptValue(0, 123.0));
+ DEFINE_TEST_VALUE(QScriptValue(0, 6.37e-8));
+ DEFINE_TEST_VALUE(QScriptValue(0, -6.37e-8));
+ DEFINE_TEST_VALUE(QScriptValue(0, 0x43211234));
+ DEFINE_TEST_VALUE(QScriptValue(0, 0x10000));
+ DEFINE_TEST_VALUE(QScriptValue(0, 0x10001));
+ DEFINE_TEST_VALUE(QScriptValue(0, qSNaN()));
+ DEFINE_TEST_VALUE(QScriptValue(0, qQNaN()));
+ DEFINE_TEST_VALUE(QScriptValue(0, qInf()));
+ DEFINE_TEST_VALUE(QScriptValue(0, -qInf()));
+ DEFINE_TEST_VALUE(QScriptValue(0, "NaN"));
+ DEFINE_TEST_VALUE(QScriptValue(0, "Infinity"));
+ DEFINE_TEST_VALUE(QScriptValue(0, "-Infinity"));
+ DEFINE_TEST_VALUE(QScriptValue(0, "ciao"));
+ DEFINE_TEST_VALUE(QScriptValue(0, QString::fromLatin1("ciao")));
+ DEFINE_TEST_VALUE(QScriptValue(0, QString("")));
+ DEFINE_TEST_VALUE(QScriptValue(0, QString()));
+ DEFINE_TEST_VALUE(QScriptValue(0, QString("0")));
+ DEFINE_TEST_VALUE(QScriptValue(0, QString("123")));
+ DEFINE_TEST_VALUE(QScriptValue(0, QString("12.3")));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::UndefinedValue));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::NullValue));
+ DEFINE_TEST_VALUE(QScriptValue(engine, true));
+ DEFINE_TEST_VALUE(QScriptValue(engine, false));
+ DEFINE_TEST_VALUE(QScriptValue(engine, int(122)));
+ DEFINE_TEST_VALUE(QScriptValue(engine, uint(124)));
+ DEFINE_TEST_VALUE(QScriptValue(engine, 0));
+ DEFINE_TEST_VALUE(QScriptValue(engine, 0.0));
+ DEFINE_TEST_VALUE(QScriptValue(engine, 123.0));
+ DEFINE_TEST_VALUE(QScriptValue(engine, 6.37e-8));
+ DEFINE_TEST_VALUE(QScriptValue(engine, -6.37e-8));
+ DEFINE_TEST_VALUE(QScriptValue(engine, 0x43211234));
+ DEFINE_TEST_VALUE(QScriptValue(engine, 0x10000));
+ DEFINE_TEST_VALUE(QScriptValue(engine, 0x10001));
+ DEFINE_TEST_VALUE(QScriptValue(engine, qSNaN()));
+ DEFINE_TEST_VALUE(QScriptValue(engine, qQNaN()));
+ DEFINE_TEST_VALUE(QScriptValue(engine, qInf()));
+ DEFINE_TEST_VALUE(QScriptValue(engine, -qInf()));
+ DEFINE_TEST_VALUE(QScriptValue(engine, "NaN"));
+ DEFINE_TEST_VALUE(QScriptValue(engine, "Infinity"));
+ DEFINE_TEST_VALUE(QScriptValue(engine, "-Infinity"));
+ DEFINE_TEST_VALUE(QScriptValue(engine, "ciao"));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QString::fromLatin1("ciao")));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QString("")));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QString()));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QString("0")));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QString("123")));
+ DEFINE_TEST_VALUE(QScriptValue(engine, QString("1.23")));
+ DEFINE_TEST_VALUE(engine->evaluate("[]"));
+ DEFINE_TEST_VALUE(engine->evaluate("{}"));
+ DEFINE_TEST_VALUE(engine->evaluate("Object.prototype"));
+ DEFINE_TEST_VALUE(engine->evaluate("Date.prototype"));
+ DEFINE_TEST_VALUE(engine->evaluate("Array.prototype"));
+ DEFINE_TEST_VALUE(engine->evaluate("Function.prototype"));
+ DEFINE_TEST_VALUE(engine->evaluate("Error.prototype"));
+ DEFINE_TEST_VALUE(engine->evaluate("Object"));
+ DEFINE_TEST_VALUE(engine->evaluate("Array"));
+ DEFINE_TEST_VALUE(engine->evaluate("Number"));
+ DEFINE_TEST_VALUE(engine->evaluate("Function"));
+ DEFINE_TEST_VALUE(engine->evaluate("(function() { return 1; })"));
+ DEFINE_TEST_VALUE(engine->evaluate("(function() { return 'ciao'; })"));
+ DEFINE_TEST_VALUE(engine->evaluate("(function() { throw new Error('foo' })"));
+ DEFINE_TEST_VALUE(engine->evaluate("/foo/"));
+ DEFINE_TEST_VALUE(engine->evaluate("new Object()"));
+ DEFINE_TEST_VALUE(engine->evaluate("new Array()"));
+ DEFINE_TEST_VALUE(engine->evaluate("new Error()"));
+ DEFINE_TEST_VALUE(engine->evaluate("a = new Object( a.foo = 22; a.foo"));
+ DEFINE_TEST_VALUE(engine->evaluate("Undefined"));
+ DEFINE_TEST_VALUE(engine->evaluate("Null"));
+ DEFINE_TEST_VALUE(engine->evaluate("True"));
+ DEFINE_TEST_VALUE(engine->evaluate("False"));
+ DEFINE_TEST_VALUE(engine->evaluate("undefined"));
+ DEFINE_TEST_VALUE(engine->evaluate("null"));
+ DEFINE_TEST_VALUE(engine->evaluate("true"));
+ DEFINE_TEST_VALUE(engine->evaluate("false"));
+ DEFINE_TEST_VALUE(engine->evaluate("122"));
+ DEFINE_TEST_VALUE(engine->evaluate("124"));
+ DEFINE_TEST_VALUE(engine->evaluate("0"));
+ DEFINE_TEST_VALUE(engine->evaluate("0.0"));
+ DEFINE_TEST_VALUE(engine->evaluate("123.0"));
+ DEFINE_TEST_VALUE(engine->evaluate("6.37e-8"));
+ DEFINE_TEST_VALUE(engine->evaluate("-6.37e-8"));
+ DEFINE_TEST_VALUE(engine->evaluate("0x43211234"));
+ DEFINE_TEST_VALUE(engine->evaluate("0x10000"));
+ DEFINE_TEST_VALUE(engine->evaluate("0x10001"));
+ DEFINE_TEST_VALUE(engine->evaluate("NaN"));
+ DEFINE_TEST_VALUE(engine->evaluate("Infinity"));
+ DEFINE_TEST_VALUE(engine->evaluate("-Infinity"));
+ DEFINE_TEST_VALUE(engine->evaluate("'ciao'"));
+ DEFINE_TEST_VALUE(engine->evaluate("''"));
+ DEFINE_TEST_VALUE(engine->evaluate("'0'"));
+ DEFINE_TEST_VALUE(engine->evaluate("'123'"));
+ DEFINE_TEST_VALUE(engine->evaluate("'12.4'"));
+ DEFINE_TEST_VALUE(engine->nullValue());
+ DEFINE_TEST_VALUE(engine->undefinedValue());
+}
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp
new file mode 100644
index 0000000..f1de77d
--- /dev/null
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp
@@ -0,0 +1,567 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+
+void tst_QScriptValue::isValid_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isValid_array[] = {
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+
+void tst_QScriptValue::isValid_makeData(const char* expr)
+{
+ static QSet<QString> isValid;
+ if (isValid.isEmpty()) {
+ isValid.reserve(131);
+ for (unsigned i = 0; i < 131; ++i)
+ isValid.insert(isValid_array[i]);
+ }
+ newRow(expr) << isValid.contains(expr);
+}
+
+void tst_QScriptValue::isValid_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isValid(), expected);
+ QCOMPARE(value.isValid(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isValid)
+
+
+void tst_QScriptValue::isBool_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isBool_array[] = {
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")"};
+
+void tst_QScriptValue::isBool_makeData(const char* expr)
+{
+ static QSet<QString> isBool;
+ if (isBool.isEmpty()) {
+ isBool.reserve(8);
+ for (unsigned i = 0; i < 8; ++i)
+ isBool.insert(isBool_array[i]);
+ }
+ newRow(expr) << isBool.contains(expr);
+}
+
+void tst_QScriptValue::isBool_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isBool(), expected);
+ QCOMPARE(value.isBool(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isBool)
+
+
+void tst_QScriptValue::isBoolean_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isBoolean_array[] = {
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")"};
+
+void tst_QScriptValue::isBoolean_makeData(const char* expr)
+{
+ static QSet<QString> isBoolean;
+ if (isBoolean.isEmpty()) {
+ isBoolean.reserve(8);
+ for (unsigned i = 0; i < 8; ++i)
+ isBoolean.insert(isBoolean_array[i]);
+ }
+ newRow(expr) << isBoolean.contains(expr);
+}
+
+void tst_QScriptValue::isBoolean_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isBoolean(), expected);
+ QCOMPARE(value.isBoolean(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isBoolean)
+
+
+void tst_QScriptValue::isNumber_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isNumber_array[] = {
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")"};
+
+void tst_QScriptValue::isNumber_makeData(const char* expr)
+{
+ static QSet<QString> isNumber;
+ if (isNumber.isEmpty()) {
+ isNumber.reserve(55);
+ for (unsigned i = 0; i < 55; ++i)
+ isNumber.insert(isNumber_array[i]);
+ }
+ newRow(expr) << isNumber.contains(expr);
+}
+
+void tst_QScriptValue::isNumber_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isNumber(), expected);
+ QCOMPARE(value.isNumber(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isNumber)
+
+
+void tst_QScriptValue::isFunction_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isFunction_array[] = {
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"/foo/\")"};
+
+void tst_QScriptValue::isFunction_makeData(const char* expr)
+{
+ static QSet<QString> isFunction;
+ if (isFunction.isEmpty()) {
+ isFunction.reserve(8);
+ for (unsigned i = 0; i < 8; ++i)
+ isFunction.insert(isFunction_array[i]);
+ }
+ newRow(expr) << isFunction.contains(expr);
+}
+
+void tst_QScriptValue::isFunction_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isFunction(), expected);
+ QCOMPARE(value.isFunction(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isFunction)
+
+
+void tst_QScriptValue::isNull_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isNull_array[] = {
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\")",
+ "engine->nullValue()"};
+
+void tst_QScriptValue::isNull_makeData(const char* expr)
+{
+ static QSet<QString> isNull;
+ if (isNull.isEmpty()) {
+ isNull.reserve(5);
+ for (unsigned i = 0; i < 5; ++i)
+ isNull.insert(isNull_array[i]);
+ }
+ newRow(expr) << isNull.contains(expr);
+}
+
+void tst_QScriptValue::isNull_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isNull(), expected);
+ QCOMPARE(value.isNull(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isNull)
+
+
+void tst_QScriptValue::isString_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isString_array[] = {
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")"};
+
+void tst_QScriptValue::isString_makeData(const char* expr)
+{
+ static QSet<QString> isString;
+ if (isString.isEmpty()) {
+ isString.reserve(35);
+ for (unsigned i = 0; i < 35; ++i)
+ isString.insert(isString_array[i]);
+ }
+ newRow(expr) << isString.contains(expr);
+}
+
+void tst_QScriptValue::isString_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isString(), expected);
+ QCOMPARE(value.isString(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isString)
+
+
+void tst_QScriptValue::isUndefined_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isUndefined_array[] = {
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->undefinedValue()"};
+
+void tst_QScriptValue::isUndefined_makeData(const char* expr)
+{
+ static QSet<QString> isUndefined;
+ if (isUndefined.isEmpty()) {
+ isUndefined.reserve(6);
+ for (unsigned i = 0; i < 6; ++i)
+ isUndefined.insert(isUndefined_array[i]);
+ }
+ newRow(expr) << isUndefined.contains(expr);
+}
+
+void tst_QScriptValue::isUndefined_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isUndefined(), expected);
+ QCOMPARE(value.isUndefined(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isUndefined)
+
+
+
+
+
+void tst_QScriptValue::isObject_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString isObject_array[] = {
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")"};
+
+void tst_QScriptValue::isObject_makeData(const char* expr)
+{
+ static QSet<QString> isObject;
+ if (isObject.isEmpty()) {
+ isObject.reserve(22);
+ for (unsigned i = 0; i < 22; ++i)
+ isObject.insert(isObject_array[i]);
+ }
+ newRow(expr) << isObject.contains(expr);
+}
+
+void tst_QScriptValue::isObject_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isObject(), expected);
+ QCOMPARE(value.isObject(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isObject)
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp
new file mode 100644
index 0000000..a946aef
--- /dev/null
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp
@@ -0,0 +1,1763 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+
+
+void tst_QScriptValue::toString_initData()
+{
+ QTest::addColumn<QString>("expected");
+ initScriptValues();
+}
+
+static QString toString_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+
+static QString toString_valueArray[] = {
+ "", "undefined",
+ "null", "true",
+ "false", "122",
+ "124", "0",
+ "0", "123",
+ "6.37e-8", "-6.37e-8",
+ "1126240820", "65536",
+ "65537", "NaN",
+ "NaN", "Infinity",
+ "-Infinity", "NaN",
+ "Infinity", "-Infinity",
+ "ciao", "ciao",
+ "", "",
+ "0", "123",
+ "12.4", "undefined",
+ "null", "true",
+ "false", "122",
+ "124", "0",
+ "0", "123",
+ "6.37e-8", "-6.37e-8",
+ "1126240820", "65536",
+ "65537", "NaN",
+ "NaN", "Infinity",
+ "-Infinity", "NaN",
+ "Infinity", "-Infinity",
+ "ciao", "ciao",
+ "", "",
+ "0", "123",
+ "12.3", "undefined",
+ "null", "true",
+ "false", "122",
+ "124", "0",
+ "0", "123",
+ "6.37e-8", "-6.37e-8",
+ "1126240820", "65536",
+ "65537", "NaN",
+ "NaN", "Infinity",
+ "-Infinity", "NaN",
+ "Infinity", "-Infinity",
+ "ciao", "ciao",
+ "", "",
+ "0", "123",
+ "1.23", "",
+ "undefined", "[object Object]",
+ "Invalid Date", "",
+ "function () {\n [native code]\n}", "Error: Unknown error",
+ "function Object() {\n [native code]\n}", "function Array() {\n [native code]\n}",
+ "function Number() {\n [native code]\n}", "function Function() {\n [native code]\n}",
+ "function () { return 1; }", "function () { return 'ciao'; }",
+ "SyntaxError: Parse error", "/foo/",
+ "[object Object]", "",
+ "Error: Unknown error", "SyntaxError: Parse error",
+ "ReferenceError: Can't find variable: Undefined", "ReferenceError: Can't find variable: Null",
+ "ReferenceError: Can't find variable: True", "ReferenceError: Can't find variable: False",
+ "undefined", "null",
+ "true", "false",
+ "122", "124",
+ "0", "0",
+ "123", "6.37e-8",
+ "-6.37e-8", "1126240820",
+ "65536", "65537",
+ "NaN", "Infinity",
+ "-Infinity", "ciao",
+ "", "0",
+ "123", "12.4",
+ "null", "undefined"};
+
+void tst_QScriptValue::toString_makeData(const char* expr)
+{
+ static QHash<QString, QString> toString;
+ if (toString.isEmpty()) {
+ toString.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toString.insert(toString_tagArray[i], toString_valueArray[i]);
+ }
+ newRow(expr) << toString.value(expr);
+}
+
+void tst_QScriptValue::toString_test(const char*, const QScriptValue& value)
+{
+ QFETCH(QString, expected);
+ QCOMPARE(value.toString(), expected);
+ QCOMPARE(value.toString(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toString)
+
+
+void tst_QScriptValue::toNumber_initData()
+{
+ QTest::addColumn<qsreal>("expected");
+ initScriptValues();
+}
+
+static QString toNumber_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+static qsreal toNumber_valueArray[] = {
+ 0, qQNaN(), 0, 1, 0, 122, 124, 0, 0, 123,
+ 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(),
+ qInf(), qInf(), qQNaN(), qQNaN(), 0, 0, 0, 123, 12.4, qQNaN(),
+ 0, 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08,
+ 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(),
+ qQNaN(), qQNaN(), 0, 0, 0, 123, 12.3, qQNaN(), 0, 1,
+ 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536,
+ 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(), qQNaN(), qQNaN(),
+ 0, 0, 0, 123, 1.23, 0, qQNaN(), qQNaN(), qQNaN(), 0,
+ qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(),
+ qQNaN(), 0, qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), 0,
+ 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820,
+ 65536, 65537, qQNaN(), qInf(), qInf(), qQNaN(), 0, 0, 123, 12.4,
+ 0, qQNaN()};
+void tst_QScriptValue::toNumber_makeData(const char* expr)
+{
+ static QHash<QString, qsreal> toNumber;
+ if (toNumber.isEmpty()) {
+ toNumber.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toNumber.insert(toNumber_tagArray[i], toNumber_valueArray[i]);
+ }
+ newRow(expr) << toNumber.value(expr);
+}
+
+void tst_QScriptValue::toNumber_test(const char*, const QScriptValue& value)
+{
+ QFETCH(qsreal, expected);
+ if (qIsNaN(expected)) {
+ QVERIFY(qIsNaN(value.toNumber()));
+ return;
+ }
+ if (qIsInf(expected)) {
+ QVERIFY(qIsInf(value.toNumber()));
+ QVERIFY(qIsInf(value.toNumber()));
+ return;
+ }
+ QCOMPARE(value.toNumber(), expected);
+ QCOMPARE(value.toNumber(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toNumber)
+
+
+void tst_QScriptValue::toBool_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString toBool_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+
+static bool toBool_valueArray[] = {
+ false, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, false,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ false, true,
+ true, true,
+ false, false};
+
+void tst_QScriptValue::toBool_makeData(const char* expr)
+{
+ static QHash<QString, bool> toBool;
+ if (toBool.isEmpty()) {
+ toBool.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toBool.insert(toBool_tagArray[i], toBool_valueArray[i]);
+ }
+ newRow(expr) << toBool.value(expr);
+}
+
+void tst_QScriptValue::toBool_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.toBool(), expected);
+ QCOMPARE(value.toBool(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toBool)
+
+
+void tst_QScriptValue::toBoolean_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString toBoolean_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+
+static bool toBoolean_valueArray[] = {
+ false, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, false,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ false, true,
+ true, true,
+ false, false};
+
+void tst_QScriptValue::toBoolean_makeData(const char* expr)
+{
+ static QHash<QString, bool> toBoolean;
+ if (toBoolean.isEmpty()) {
+ toBoolean.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toBoolean.insert(toBoolean_tagArray[i], toBoolean_valueArray[i]);
+ }
+ newRow(expr) << toBoolean.value(expr);
+}
+
+void tst_QScriptValue::toBoolean_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.toBoolean(), expected);
+ QCOMPARE(value.toBoolean(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toBoolean)
+
+
+void tst_QScriptValue::toInteger_initData()
+{
+ QTest::addColumn<qsreal>("expected");
+ initScriptValues();
+}
+
+static QString toInteger_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+static qsreal toInteger_valueArray[] = {
+ 0, 0, 0, 1, 0, 122, 124, 0, 0, 123,
+ 0, 0, 1126240820, 65536, 65537, 0, 0, qInf(), qInf(), 0,
+ qInf(), qInf(), 0, 0, 0, 0, 0, 123, 12, 0,
+ 0, 1, 0, 122, 124, 0, 0, 123, 0, 0,
+ 1126240820, 65536, 65537, 0, 0, qInf(), qInf(), 0, qInf(), qInf(),
+ 0, 0, 0, 0, 0, 123, 12, 0, 0, 1,
+ 0, 122, 124, 0, 0, 123, 0, 0, 1126240820, 65536,
+ 65537, 0, 0, qInf(), qInf(), 0, qInf(), qInf(), 0, 0,
+ 0, 0, 0, 123, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 122, 124, 0, 0, 123, 0, 0, 1126240820,
+ 65536, 65537, 0, qInf(), qInf(), 0, 0, 0, 123, 12,
+ 0, 0};
+void tst_QScriptValue::toInteger_makeData(const char* expr)
+{
+ static QHash<QString, qsreal> toInteger;
+ if (toInteger.isEmpty()) {
+ toInteger.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toInteger.insert(toInteger_tagArray[i], toInteger_valueArray[i]);
+ }
+ newRow(expr) << toInteger.value(expr);
+}
+
+void tst_QScriptValue::toInteger_test(const char*, const QScriptValue& value)
+{
+ QFETCH(qsreal, expected);
+ if (qIsInf(expected)) {
+ QVERIFY(qIsInf(value.toInteger()));
+ QVERIFY(qIsInf(value.toInteger()));
+ return;
+ }
+ QCOMPARE(value.toInteger(), expected);
+ QCOMPARE(value.toInteger(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toInteger)
+
+
+void tst_QScriptValue::toInt32_initData()
+{
+ QTest::addColumn<qint32>("expected");
+ initScriptValues();
+}
+
+static QString toInt32_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+
+static qint32 toInt32_valueArray[] = {
+ 0, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 122, 124,
+ 0, 0,
+ 123, 0,
+ 0, 1126240820,
+ 65536, 65537,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 123, 12,
+ 0, 0};
+
+void tst_QScriptValue::toInt32_makeData(const char* expr)
+{
+ static QHash<QString, qint32> toInt32;
+ if (toInt32.isEmpty()) {
+ toInt32.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toInt32.insert(toInt32_tagArray[i], toInt32_valueArray[i]);
+ }
+ newRow(expr) << toInt32.value(expr);
+}
+
+void tst_QScriptValue::toInt32_test(const char*, const QScriptValue& value)
+{
+ QFETCH(qint32, expected);
+ QCOMPARE(value.toInt32(), expected);
+ QCOMPARE(value.toInt32(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toInt32)
+
+
+void tst_QScriptValue::toUInt32_initData()
+{
+ QTest::addColumn<quint32>("expected");
+ initScriptValues();
+}
+
+static QString toUInt32_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+
+static quint32 toUInt32_valueArray[] = {
+ 0, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 122, 124,
+ 0, 0,
+ 123, 0,
+ 0, 1126240820,
+ 65536, 65537,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 123, 12,
+ 0, 0};
+
+void tst_QScriptValue::toUInt32_makeData(const char* expr)
+{
+ static QHash<QString, quint32> toUInt32;
+ if (toUInt32.isEmpty()) {
+ toUInt32.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toUInt32.insert(toUInt32_tagArray[i], toUInt32_valueArray[i]);
+ }
+ newRow(expr) << toUInt32.value(expr);
+}
+
+void tst_QScriptValue::toUInt32_test(const char*, const QScriptValue& value)
+{
+ QFETCH(quint32, expected);
+ QCOMPARE(value.toUInt32(), expected);
+ QCOMPARE(value.toUInt32(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toUInt32)
+
+
+void tst_QScriptValue::toUInt16_initData()
+{
+ QTest::addColumn<quint16>("expected");
+ initScriptValues();
+}
+
+static QString toUInt16_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()"};
+
+static quint16 toUInt16_valueArray[] = {
+ 0, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 4660, 0,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 4660, 0,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 4660, 0,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 122, 124,
+ 0, 0,
+ 123, 0,
+ 0, 4660,
+ 0, 1,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 123, 12,
+ 0, 0};
+
+void tst_QScriptValue::toUInt16_makeData(const char* expr)
+{
+ static QHash<QString, quint16> toUInt16;
+ if (toUInt16.isEmpty()) {
+ toUInt16.reserve(132);
+ for (unsigned i = 0; i < 132; ++i)
+ toUInt16.insert(toUInt16_tagArray[i], toUInt16_valueArray[i]);
+ }
+ newRow(expr) << toUInt16.value(expr);
+}
+
+void tst_QScriptValue::toUInt16_test(const char*, const QScriptValue& value)
+{
+ QFETCH(quint16, expected);
+ QCOMPARE(value.toUInt16(), expected);
+ QCOMPARE(value.toUInt16(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toUInt16)
diff --git a/JavaScriptCore/runtime/Arguments.h b/JavaScriptCore/runtime/Arguments.h
index 9dda24c..5b8e51c 100644
--- a/JavaScriptCore/runtime/Arguments.h
+++ b/JavaScriptCore/runtime/Arguments.h
@@ -216,7 +216,7 @@ namespace JSC {
}
// This JSActivation function is defined here so it can get at Arguments::setRegisters.
- inline void JSActivation::copyRegisters(Arguments* arguments)
+ inline void JSActivation::copyRegisters()
{
ASSERT(!d()->registerArray);
@@ -232,18 +232,8 @@ namespace JSC {
Register* registerArray = copyRegisterArray(d()->registers - registerOffset, registerArraySize);
setRegisters(registerArray + registerOffset, registerArray);
- if (arguments && !arguments->isTornOff())
- static_cast<Arguments*>(arguments)->setActivation(this);
}
- ALWAYS_INLINE Arguments* Register::arguments() const
- {
- if (jsValue() == JSValue())
- return 0;
- return asArguments(jsValue());
- }
-
-
} // namespace JSC
#endif // Arguments_h
diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp
index fb44494..c159be4 100644
--- a/JavaScriptCore/runtime/ArrayConstructor.cpp
+++ b/JavaScriptCore/runtime/ArrayConstructor.cpp
@@ -37,8 +37,8 @@ ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
static JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList&);
-ArrayConstructor::ArrayConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, arrayPrototype->classInfo()->className))
+ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className))
{
// ECMA 15.4.3.1 Array.prototype
putDirectWithoutTransition(exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
@@ -47,7 +47,7 @@ ArrayConstructor::ArrayConstructor(ExecState* exec, NonNullPassRefPtr<Structure>
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
// ES5
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum);
}
static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args)
diff --git a/JavaScriptCore/runtime/ArrayConstructor.h b/JavaScriptCore/runtime/ArrayConstructor.h
index 6d25400..5e1408f 100644
--- a/JavaScriptCore/runtime/ArrayConstructor.h
+++ b/JavaScriptCore/runtime/ArrayConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class ArrayConstructor : public InternalFunction {
public:
- ArrayConstructor(ExecState*, NonNullPassRefPtr<Structure>, ArrayPrototype*, Structure*);
+ ArrayConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ArrayPrototype*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp
index 99564a8..70ce69f 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -116,9 +116,10 @@ const ClassInfo ArrayPrototype::info = {"Array", &JSArray::info, 0, ExecState::a
*/
// ECMA 15.4.4
-ArrayPrototype::ArrayPrototype(NonNullPassRefPtr<Structure> structure)
+ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: JSArray(structure)
{
+ putAnonymousValue(0, globalObject);
}
bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
diff --git a/JavaScriptCore/runtime/ArrayPrototype.h b/JavaScriptCore/runtime/ArrayPrototype.h
index e52914c..42665e3 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.h
+++ b/JavaScriptCore/runtime/ArrayPrototype.h
@@ -28,13 +28,21 @@ namespace JSC {
class ArrayPrototype : public JSArray {
public:
- explicit ArrayPrototype(NonNullPassRefPtr<Structure>);
+ explicit ArrayPrototype(JSGlobalObject*, NonNullPassRefPtr<Structure>);
bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned AnonymousSlotCount = JSArray::AnonymousSlotCount + 1;
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/BooleanConstructor.cpp b/JavaScriptCore/runtime/BooleanConstructor.cpp
index b0d8df3..07bcc97 100644
--- a/JavaScriptCore/runtime/BooleanConstructor.cpp
+++ b/JavaScriptCore/runtime/BooleanConstructor.cpp
@@ -28,8 +28,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
-BooleanConstructor::BooleanConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, BooleanPrototype* booleanPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, booleanPrototype->classInfo()->className))
+BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, BooleanPrototype* booleanPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, booleanPrototype->classInfo()->className))
{
putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
diff --git a/JavaScriptCore/runtime/BooleanConstructor.h b/JavaScriptCore/runtime/BooleanConstructor.h
index 1d8a26a..0f3efa7 100644
--- a/JavaScriptCore/runtime/BooleanConstructor.h
+++ b/JavaScriptCore/runtime/BooleanConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class BooleanConstructor : public InternalFunction {
public:
- BooleanConstructor(ExecState*, NonNullPassRefPtr<Structure>, BooleanPrototype*);
+ BooleanConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, BooleanPrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/BooleanPrototype.cpp b/JavaScriptCore/runtime/BooleanPrototype.cpp
index 8d338f9..4378164 100644
--- a/JavaScriptCore/runtime/BooleanPrototype.cpp
+++ b/JavaScriptCore/runtime/BooleanPrototype.cpp
@@ -37,13 +37,13 @@ static JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*, JSObject*, JSVa
// ECMA 15.6.4
-BooleanPrototype::BooleanPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: BooleanObject(structure)
{
setInternalValue(jsBoolean(false));
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
}
diff --git a/JavaScriptCore/runtime/BooleanPrototype.h b/JavaScriptCore/runtime/BooleanPrototype.h
index cc69b3f..ddadc43 100644
--- a/JavaScriptCore/runtime/BooleanPrototype.h
+++ b/JavaScriptCore/runtime/BooleanPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class BooleanPrototype : public BooleanObject {
public:
- BooleanPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ BooleanPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp
index ab95d06..d732a4f 100644
--- a/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/JavaScriptCore/runtime/DateConstructor.cpp
@@ -58,14 +58,14 @@ static JSValue JSC_HOST_CALL dateParse(ExecState*, JSObject*, JSValue, const Arg
static JSValue JSC_HOST_CALL dateNow(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL dateUTC(ExecState*, JSObject*, JSValue, const ArgList&);
-DateConstructor::DateConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, datePrototype->classInfo()->className))
+DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className))
{
putDirectWithoutTransition(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete);
}
diff --git a/JavaScriptCore/runtime/DateConstructor.h b/JavaScriptCore/runtime/DateConstructor.h
index 10e450e..c8ca456 100644
--- a/JavaScriptCore/runtime/DateConstructor.h
+++ b/JavaScriptCore/runtime/DateConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class DateConstructor : public InternalFunction {
public:
- DateConstructor(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, DatePrototype*);
+ DateConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, DatePrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index 108ff55..a5dfabd 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -418,10 +418,11 @@ const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState
// ECMA 15.9.4
-DatePrototype::DatePrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
+DatePrototype::DatePrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: DateInstance(exec, structure)
{
// The constructor will be added later, after DateConstructor has been built.
+ putAnonymousValue(0, globalObject);
}
bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
diff --git a/JavaScriptCore/runtime/DatePrototype.h b/JavaScriptCore/runtime/DatePrototype.h
index 612ca06..e3672aa 100644
--- a/JavaScriptCore/runtime/DatePrototype.h
+++ b/JavaScriptCore/runtime/DatePrototype.h
@@ -29,7 +29,7 @@ namespace JSC {
class DatePrototype : public DateInstance {
public:
- DatePrototype(ExecState*, NonNullPassRefPtr<Structure>);
+ DatePrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
diff --git a/JavaScriptCore/runtime/ErrorConstructor.cpp b/JavaScriptCore/runtime/ErrorConstructor.cpp
index b9c3f58..4a4559e 100644
--- a/JavaScriptCore/runtime/ErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/ErrorConstructor.cpp
@@ -29,8 +29,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor);
-ErrorConstructor::ErrorConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ErrorPrototype* errorPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, errorPrototype->classInfo()->className))
+ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ErrorPrototype* errorPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, errorPrototype->classInfo()->className))
{
// ECMA 15.11.3.1 Error.prototype
putDirectWithoutTransition(exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
diff --git a/JavaScriptCore/runtime/ErrorConstructor.h b/JavaScriptCore/runtime/ErrorConstructor.h
index e3d789b..c0e3323 100644
--- a/JavaScriptCore/runtime/ErrorConstructor.h
+++ b/JavaScriptCore/runtime/ErrorConstructor.h
@@ -30,7 +30,7 @@ namespace JSC {
class ErrorConstructor : public InternalFunction {
public:
- ErrorConstructor(ExecState*, NonNullPassRefPtr<Structure>, ErrorPrototype*);
+ ErrorConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ErrorPrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/ErrorPrototype.cpp b/JavaScriptCore/runtime/ErrorPrototype.cpp
index eb35733..72fa4c4 100644
--- a/JavaScriptCore/runtime/ErrorPrototype.cpp
+++ b/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -35,7 +35,7 @@ ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
static JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
// ECMA 15.9.4
-ErrorPrototype::ErrorPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: ErrorInstance(structure)
{
// The constructor will be added later in ErrorConstructor's constructor
@@ -43,7 +43,7 @@ ErrorPrototype::ErrorPrototype(ExecState* exec, NonNullPassRefPtr<Structure> str
putDirectWithoutTransition(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
putDirectWithoutTransition(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
}
JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
diff --git a/JavaScriptCore/runtime/ErrorPrototype.h b/JavaScriptCore/runtime/ErrorPrototype.h
index a561590..fce2742 100644
--- a/JavaScriptCore/runtime/ErrorPrototype.h
+++ b/JavaScriptCore/runtime/ErrorPrototype.h
@@ -29,7 +29,7 @@ namespace JSC {
class ErrorPrototype : public ErrorInstance {
public:
- ErrorPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ ErrorPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/Executable.h b/JavaScriptCore/runtime/Executable.h
index 3e1609e..ac63c49 100644
--- a/JavaScriptCore/runtime/Executable.h
+++ b/JavaScriptCore/runtime/Executable.h
@@ -26,6 +26,7 @@
#ifndef Executable_h
#define Executable_h
+#include "CallData.h"
#include "JSFunction.h"
#include "Interpreter.h"
#include "Nodes.h"
@@ -90,21 +91,27 @@ namespace JSC {
#if ENABLE(JIT)
class NativeExecutable : public ExecutableBase {
+ friend class JIT;
public:
- NativeExecutable(ExecState* exec)
- : ExecutableBase(NUM_PARAMETERS_IS_HOST)
+ static PassRefPtr<NativeExecutable> create(MacroAssemblerCodePtr thunk, NativeFunction function)
{
- m_jitCodeForCall = exec->globalData().jitStubs.ctiNativeCallThunk()->m_jitCodeForCall;
- m_jitCodeForConstruct = exec->globalData().jitStubs.ctiNativeCallThunk()->m_jitCodeForCall; // FIXME: this thunk should have a construct form
+ return adoptRef(new NativeExecutable(JITCode::HostFunction(thunk), function));
}
- NativeExecutable(JITCode thunk)
+
+ ~NativeExecutable();
+
+ NativeFunction function() { return m_function; }
+
+ private:
+ NativeExecutable(JITCode thunk, NativeFunction function)
: ExecutableBase(NUM_PARAMETERS_IS_HOST)
+ , m_function(function)
{
m_jitCodeForCall = thunk;
m_jitCodeForConstruct = thunk;
}
- ~NativeExecutable();
+ NativeFunction m_function;
};
#endif
@@ -278,6 +285,17 @@ namespace JSC {
{
return new (exec) JSFunction(exec, this, scopeChain);
}
+
+ // Returns either call or construct bytecode. This can be appropriate
+ // for answering questions that that don't vary between call and construct --
+ // for example, argumentsRegister().
+ FunctionCodeBlock& generatedByteCode()
+ {
+ if (m_codeBlockForCall)
+ return *m_codeBlockForCall;
+ ASSERT(m_codeBlockForConstruct);
+ return *m_codeBlockForConstruct;
+ }
FunctionCodeBlock& bytecodeForCall(ExecState* exec, ScopeChainNode* scopeChainNode)
{
@@ -403,6 +421,13 @@ namespace JSC {
return m_executable->isHostFunction();
}
+#if ENABLE(JIT)
+ inline NativeFunction JSFunction::nativeFunction()
+ {
+ ASSERT(isHostFunction());
+ return static_cast<NativeExecutable*>(m_executable.get())->function();
+ }
+#endif
}
#endif
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index 9b0b1bb..c8299a9 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -35,8 +35,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
-FunctionConstructor::FunctionConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, FunctionPrototype* functionPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, functionPrototype->classInfo()->className))
+FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, FunctionPrototype* functionPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, functionPrototype->classInfo()->className))
{
putDirectWithoutTransition(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
diff --git a/JavaScriptCore/runtime/FunctionConstructor.h b/JavaScriptCore/runtime/FunctionConstructor.h
index 197f320..6af4861 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.h
+++ b/JavaScriptCore/runtime/FunctionConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class FunctionConstructor : public InternalFunction {
public:
- FunctionConstructor(ExecState*, NonNullPassRefPtr<Structure>, FunctionPrototype*);
+ FunctionConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, FunctionPrototype*);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp
index a77b5b2..1762816 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.cpp
+++ b/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -38,18 +38,18 @@ static JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*, JSObject*, JS
static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*, JSObject*, JSValue, const ArgList&);
-FunctionPrototype::FunctionPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
- : InternalFunction(&exec->globalData(), structure, exec->propertyNames().nullIdentifier)
+FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier)
{
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
}
-void FunctionPrototype::addFunctionProperties(ExecState* exec, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction)
+void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction)
{
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
- *applyFunction = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
+ *applyFunction = new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);
putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum);
- *callFunction = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall);
+ *callFunction = new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall);
putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum);
}
@@ -87,12 +87,12 @@ JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSVa
{
if (thisValue.inherits(&JSFunction::info)) {
JSFunction* function = asFunction(thisValue);
- if (!function->isHostFunction()) {
- FunctionExecutable* executable = function->jsExecutable();
- UString sourceString = executable->source().toString();
- insertSemicolonIfNeeded(sourceString);
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString);
- }
+ if (function->isHostFunction())
+ return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
+ FunctionExecutable* executable = function->jsExecutable();
+ UString sourceString = executable->source().toString();
+ insertSemicolonIfNeeded(sourceString);
+ return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString);
}
if (thisValue.inherits(&InternalFunction::info)) {
diff --git a/JavaScriptCore/runtime/FunctionPrototype.h b/JavaScriptCore/runtime/FunctionPrototype.h
index af783f7..5661194 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.h
+++ b/JavaScriptCore/runtime/FunctionPrototype.h
@@ -29,8 +29,8 @@ namespace JSC {
class FunctionPrototype : public InternalFunction {
public:
- FunctionPrototype(ExecState*, NonNullPassRefPtr<Structure>);
- void addFunctionProperties(ExecState*, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction);
+ FunctionPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
+ void addFunctionProperties(ExecState*, JSGlobalObject*, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction);
static PassRefPtr<Structure> createStructure(JSValue proto)
{
diff --git a/JavaScriptCore/runtime/GlobalEvalFunction.cpp b/JavaScriptCore/runtime/GlobalEvalFunction.cpp
index c26002b..3ad4644 100644
--- a/JavaScriptCore/runtime/GlobalEvalFunction.cpp
+++ b/JavaScriptCore/runtime/GlobalEvalFunction.cpp
@@ -32,8 +32,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(GlobalEvalFunction);
-GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
- : PrototypeFunction(exec, structure, len, name, function)
+GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
+ : PrototypeFunction(exec, globalObject, structure, len, name, function)
, m_cachedGlobalObject(cachedGlobalObject)
{
ASSERT_ARG(cachedGlobalObject, cachedGlobalObject);
diff --git a/JavaScriptCore/runtime/GlobalEvalFunction.h b/JavaScriptCore/runtime/GlobalEvalFunction.h
index a14ce4d..b889ca9 100644
--- a/JavaScriptCore/runtime/GlobalEvalFunction.h
+++ b/JavaScriptCore/runtime/GlobalEvalFunction.h
@@ -32,7 +32,7 @@ namespace JSC {
class GlobalEvalFunction : public PrototypeFunction {
public:
- GlobalEvalFunction(ExecState*, NonNullPassRefPtr<Structure>, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
+ GlobalEvalFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
JSGlobalObject* cachedGlobalObject() const { return m_cachedGlobalObject; }
static PassRefPtr<Structure> createStructure(JSValue prototype)
diff --git a/JavaScriptCore/runtime/InternalFunction.cpp b/JavaScriptCore/runtime/InternalFunction.cpp
index 717b5ff..f774993 100644
--- a/JavaScriptCore/runtime/InternalFunction.cpp
+++ b/JavaScriptCore/runtime/InternalFunction.cpp
@@ -24,6 +24,7 @@
#include "InternalFunction.h"
#include "FunctionPrototype.h"
+#include "JSGlobalObject.h"
#include "JSString.h"
namespace JSC {
@@ -37,15 +38,20 @@ const ClassInfo* InternalFunction::classInfo() const
return &info;
}
-InternalFunction::InternalFunction(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const Identifier& name)
- : JSObject(structure)
+InternalFunction::InternalFunction(NonNullPassRefPtr<Structure> structure)
+ : JSObjectWithGlobalObject(structure)
+{
+}
+
+InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const Identifier& name)
+ : JSObjectWithGlobalObject(globalObject, structure)
{
putDirect(globalData->propertyNames->name, jsString(globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
}
const UString& InternalFunction::name(ExecState* exec)
{
- return asString(getDirect(exec->globalData().propertyNames->name))->value(exec);
+ return asString(getDirect(exec->globalData().propertyNames->name))->tryGetValue();
}
const UString InternalFunction::displayName(ExecState* exec)
@@ -53,7 +59,7 @@ const UString InternalFunction::displayName(ExecState* exec)
JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
if (displayName && isJSString(&exec->globalData(), displayName))
- return asString(displayName)->value(exec);
+ return asString(displayName)->tryGetValue();
return UString::null();
}
diff --git a/JavaScriptCore/runtime/InternalFunction.h b/JavaScriptCore/runtime/InternalFunction.h
index d19b82b..401f17b 100644
--- a/JavaScriptCore/runtime/InternalFunction.h
+++ b/JavaScriptCore/runtime/InternalFunction.h
@@ -24,14 +24,14 @@
#ifndef InternalFunction_h
#define InternalFunction_h
-#include "JSObject.h"
+#include "JSObjectWithGlobalObject.h"
#include "Identifier.h"
namespace JSC {
class FunctionPrototype;
- class InternalFunction : public JSObject {
+ class InternalFunction : public JSObjectWithGlobalObject {
public:
virtual const ClassInfo* classInfo() const;
static JS_EXPORTDATA const ClassInfo info;
@@ -48,8 +48,10 @@ namespace JSC {
protected:
static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
- InternalFunction(NonNullPassRefPtr<Structure> structure) : JSObject(structure) { }
- InternalFunction(JSGlobalData*, NonNullPassRefPtr<Structure>, const Identifier&);
+ // Only used to allow us to determine the JSFunction vptr
+ InternalFunction(NonNullPassRefPtr<Structure> structure);
+
+ InternalFunction(JSGlobalData*, JSGlobalObject*, NonNullPassRefPtr<Structure>, const Identifier&);
private:
virtual CallType getCallData(CallData&) = 0;
diff --git a/JavaScriptCore/runtime/JSActivation.cpp b/JavaScriptCore/runtime/JSActivation.cpp
index f468ff1..fd415ce 100644
--- a/JavaScriptCore/runtime/JSActivation.cpp
+++ b/JavaScriptCore/runtime/JSActivation.cpp
@@ -70,6 +70,11 @@ void JSActivation::markChildren(MarkStack& markStack)
bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
+ if (propertyName == exec->propertyNames().arguments) {
+ slot.setCustom(this, getArgumentsGetter());
+ return true;
+ }
+
if (symbolTableGet(propertyName, slot))
return true;
@@ -78,12 +83,6 @@ bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propert
return true;
}
- // Only return the built-in arguments object if it wasn't overridden above.
- if (propertyName == exec->propertyNames().arguments) {
- slot.setCustom(this, getArgumentsGetter());
- return true;
- }
-
// We don't call through to JSObject because there's no way to give an
// activation object getter properties or a prototype.
ASSERT(!hasGetterSetterProperties());
@@ -140,26 +139,19 @@ bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const
return false;
}
-JSValue JSActivation::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&)
{
JSActivation* activation = asActivation(slotBase);
-
- if (activation->d()->functionExecutable->usesArguments()) {
- PropertySlot slot;
- activation->symbolTableGet(exec->propertyNames().arguments, slot);
- return slot.getValue(exec, exec->propertyNames().arguments);
- }
-
CallFrame* callFrame = CallFrame::create(activation->d()->registers);
- Arguments* arguments = callFrame->optionalCalleeArguments();
- if (!arguments) {
- arguments = new (callFrame) Arguments(callFrame);
- arguments->copyRegisters();
- callFrame->setCalleeArguments(arguments);
+ int argumentsRegister = activation->d()->functionExecutable->generatedByteCode().argumentsRegister();
+ if (!callFrame->r(argumentsRegister).jsValue()) {
+ JSValue arguments = JSValue(new (callFrame) Arguments(callFrame));
+ callFrame->r(argumentsRegister) = arguments;
+ callFrame->r(unmodifiedArgumentsRegister(argumentsRegister)) = arguments;
}
- ASSERT(arguments->inherits(&Arguments::info));
- return arguments;
+ ASSERT(callFrame->r(argumentsRegister).jsValue().inherits(&Arguments::info));
+ return callFrame->r(argumentsRegister).jsValue();
}
// These two functions serve the purpose of isolating the common case from a
diff --git a/JavaScriptCore/runtime/JSActivation.h b/JavaScriptCore/runtime/JSActivation.h
index a5f8f58..d5e7991 100644
--- a/JavaScriptCore/runtime/JSActivation.h
+++ b/JavaScriptCore/runtime/JSActivation.h
@@ -60,7 +60,7 @@ namespace JSC {
virtual JSObject* toThisObject(ExecState*) const;
- void copyRegisters(Arguments* arguments);
+ void copyRegisters();
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h
index ae5aca3..c083825 100644
--- a/JavaScriptCore/runtime/JSCell.h
+++ b/JavaScriptCore/runtime/JSCell.h
@@ -207,12 +207,16 @@ namespace JSC {
inline CallType JSValue::getCallData(CallData& callData)
{
- return isCell() ? asCell()->getCallData(callData) : CallTypeNone;
+ CallType result = isCell() ? asCell()->getCallData(callData) : CallTypeNone;
+ ASSERT(result == CallTypeNone || isValidCallee());
+ return result;
}
inline ConstructType JSValue::getConstructData(ConstructData& constructData)
{
- return isCell() ? asCell()->getConstructData(constructData) : ConstructTypeNone;
+ ConstructType result = isCell() ? asCell()->getConstructData(constructData) : ConstructTypeNone;
+ ASSERT(result == ConstructTypeNone || isValidCallee());
+ return result;
}
ALWAYS_INLINE bool JSValue::getUInt32(uint32_t& v) const
diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp
index c9f295b..9d36e91 100644
--- a/JavaScriptCore/runtime/JSFunction.cpp
+++ b/JavaScriptCore/runtime/JSFunction.cpp
@@ -43,7 +43,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(JSFunction);
-const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 };
+const ClassInfo JSFunction::info = { "Function", 0, 0, 0 };
bool JSFunction::isHostFunctionNonInline() const
{
@@ -53,34 +53,36 @@ bool JSFunction::isHostFunctionNonInline() const
JSFunction::JSFunction(NonNullPassRefPtr<Structure> structure)
: Base(structure)
, m_executable(adoptRef(new VPtrHackExecutable()))
+ , m_scopeChain(NoScopeChain())
{
}
-JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeExecutable* thunk, NativeFunction func)
- : Base(&exec->globalData(), structure, name)
+JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, PassRefPtr<NativeExecutable> thunk)
+ : Base(globalObject, structure)
#if ENABLE(JIT)
, m_executable(thunk)
#endif
+ , m_scopeChain(globalObject->globalScopeChain())
{
+ putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
#if ENABLE(JIT)
- setNativeFunction(func);
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
#else
UNUSED_PARAM(thunk);
UNUSED_PARAM(length);
- UNUSED_PARAM(func);
ASSERT_NOT_REACHED();
#endif
}
-JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
- : Base(&exec->globalData(), structure, name)
+JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
+ : Base(globalObject, structure)
#if ENABLE(JIT)
- , m_executable(exec->globalData().jitStubs.ctiNativeCallThunk())
+ , m_executable(exec->globalData().getHostFunction(func))
#endif
+ , m_scopeChain(globalObject->globalScopeChain())
{
+ putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
#if ENABLE(JIT)
- setNativeFunction(func);
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
#else
UNUSED_PARAM(length);
@@ -90,10 +92,12 @@ JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure,
}
JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode)
- : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name())
+ : Base(scopeChainNode->globalObject, scopeChainNode->globalObject->functionStructure())
, m_executable(executable)
+ , m_scopeChain(scopeChainNode)
{
- setScopeChain(scopeChainNode);
+ const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name();
+ putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
}
JSFunction::~JSFunction()
@@ -111,34 +115,60 @@ JSFunction::~JSFunction()
if (jsExecutable()->isGeneratedForConstruct())
jsExecutable()->generatedBytecodeForConstruct().unlinkCallers();
#endif
- scopeChain().~ScopeChain(); // FIXME: Don't we need to do this in the interpreter too?
}
}
+const UString& JSFunction::name(ExecState* exec)
+{
+ return asString(getDirect(exec->globalData().propertyNames->name))->tryGetValue();
+}
+
+const UString JSFunction::displayName(ExecState* exec)
+{
+ JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
+
+ if (displayName && isJSString(&exec->globalData(), displayName))
+ return asString(displayName)->tryGetValue();
+
+ return UString::null();
+}
+
+const UString JSFunction::calculatedDisplayName(ExecState* exec)
+{
+ const UString explicitName = displayName(exec);
+
+ if (!explicitName.isEmpty())
+ return explicitName;
+
+ return name(exec);
+}
+
void JSFunction::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
if (!isHostFunction()) {
jsExecutable()->markAggregate(markStack);
- scopeChain().markAggregate(markStack);
+ scope().markAggregate(markStack);
}
}
CallType JSFunction::getCallData(CallData& callData)
{
+#if ENABLE(JIT)
if (isHostFunction()) {
callData.native.function = nativeFunction();
return CallTypeHost;
}
+#endif
callData.js.functionExecutable = jsExecutable();
- callData.js.scopeChain = scopeChain().node();
+ callData.js.scopeChain = scope().node();
return CallTypeJS;
}
JSValue JSFunction::call(ExecState* exec, JSValue thisValue, const ArgList& args)
{
ASSERT(!isHostFunction());
- return exec->interpreter()->executeCall(jsExecutable(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot());
+ return exec->interpreter()->executeCall(jsExecutable(), exec, this, thisValue.toThisObject(exec), args, scope().node(), exec->exceptionSlot());
}
JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&)
@@ -171,7 +201,7 @@ bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
JSValue* location = getDirectLocation(propertyName);
if (!location) {
- JSObject* prototype = new (exec) JSObject(scopeChain().globalObject()->emptyObjectStructure());
+ JSObject* prototype = new (exec) JSObject(scope().globalObject()->emptyObjectStructure());
prototype->putDirect(exec->propertyNames().constructor, this, DontEnum);
putDirect(exec->propertyNames().prototype, prototype, DontDelete);
location = getDirectLocation(propertyName);
@@ -264,7 +294,7 @@ ConstructType JSFunction::getConstructData(ConstructData& constructData)
if (isHostFunction())
return ConstructTypeNone;
constructData.js.functionExecutable = jsExecutable();
- constructData.js.scopeChain = scopeChain().node();
+ constructData.js.scopeChain = scope().node();
return ConstructTypeJS;
}
@@ -279,7 +309,7 @@ JSObject* JSFunction::construct(ExecState* exec, const ArgList& args)
structure = exec->lexicalGlobalObject()->emptyObjectStructure();
JSObject* thisObj = new (exec) JSObject(structure);
- JSValue result = exec->interpreter()->executeConstruct(jsExecutable(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot());
+ JSValue result = exec->interpreter()->executeConstruct(jsExecutable(), exec, this, thisObj, args, scope().node(), exec->exceptionSlot());
if (exec->hadException() || !result.isObject())
return thisObj;
return asObject(result);
diff --git a/JavaScriptCore/runtime/JSFunction.h b/JavaScriptCore/runtime/JSFunction.h
index 301b908..acdfe0d 100644
--- a/JavaScriptCore/runtime/JSFunction.h
+++ b/JavaScriptCore/runtime/JSFunction.h
@@ -24,7 +24,7 @@
#ifndef JSFunction_h
#define JSFunction_h
-#include "InternalFunction.h"
+#include "JSObjectWithGlobalObject.h"
namespace JSC {
@@ -35,23 +35,35 @@ namespace JSC {
class JSGlobalObject;
class NativeExecutable;
- class JSFunction : public InternalFunction {
+ class JSFunction : public JSObjectWithGlobalObject {
friend class JIT;
friend class JSGlobalData;
- typedef InternalFunction Base;
+ typedef JSObjectWithGlobalObject Base;
public:
- JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
- JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeExecutable*, NativeFunction);
+ JSFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
+ JSFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, PassRefPtr<NativeExecutable>);
JSFunction(ExecState*, NonNullPassRefPtr<FunctionExecutable>, ScopeChainNode*);
virtual ~JSFunction();
JSObject* construct(ExecState*, const ArgList&);
JSValue call(ExecState*, JSValue thisValue, const ArgList&);
- void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); }
- ScopeChain& scope() { return scopeChain(); }
+ const UString& name(ExecState*);
+ const UString displayName(ExecState*);
+ const UString calculatedDisplayName(ExecState*);
+
+ ScopeChain& scope()
+ {
+ ASSERT(!isHostFunctionNonInline());
+ return m_scopeChain;
+ }
+ void setScope(const ScopeChain& scopeChain)
+ {
+ ASSERT(!isHostFunctionNonInline());
+ m_scopeChain = scopeChain;
+ }
ExecutableBase* executable() const { return m_executable.get(); }
@@ -66,16 +78,13 @@ namespace JSC {
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
}
- NativeFunction nativeFunction()
- {
- return *WTF::bitwise_cast<NativeFunction*>(m_data);
- }
+ NativeFunction nativeFunction();
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
protected:
- const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | InternalFunction::StructureFlags;
+ const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
private:
JSFunction(NonNullPassRefPtr<Structure>);
@@ -97,31 +106,7 @@ namespace JSC {
static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
RefPtr<ExecutableBase> m_executable;
- ScopeChain& scopeChain()
- {
- ASSERT(!isHostFunctionNonInline());
- return *WTF::bitwise_cast<ScopeChain*>(m_data);
- }
- void clearScopeChain()
- {
- ASSERT(!isHostFunctionNonInline());
- new (m_data) ScopeChain(NoScopeChain());
- }
- void setScopeChain(ScopeChainNode* sc)
- {
- ASSERT(!isHostFunctionNonInline());
- new (m_data) ScopeChain(sc);
- }
- void setScopeChain(const ScopeChain& sc)
- {
- ASSERT(!isHostFunctionNonInline());
- *WTF::bitwise_cast<ScopeChain*>(m_data) = sc;
- }
- void setNativeFunction(NativeFunction func)
- {
- *WTF::bitwise_cast<NativeFunction*>(m_data) = func;
- }
- unsigned char m_data[sizeof(void*)];
+ ScopeChain m_scopeChain;
};
JSFunction* asFunction(JSValue);
diff --git a/JavaScriptCore/runtime/JSGlobalData.cpp b/JavaScriptCore/runtime/JSGlobalData.cpp
index 652fcb0..3f24ea4 100644
--- a/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -253,6 +253,17 @@ const Vector<Instruction>& JSGlobalData::numericCompareFunction(ExecState* exec)
return lazyNumericCompareFunction;
}
+#if ENABLE(JIT)
+PassRefPtr<NativeExecutable> JSGlobalData::getHostFunction(NativeFunction function)
+{
+ return jitStubs.hostFunctionStub(this, function);
+}
+PassRefPtr<NativeExecutable> JSGlobalData::getHostFunction(NativeFunction function, ThunkGenerator generator)
+{
+ return jitStubs.hostFunctionStub(this, function, generator);
+}
+#endif
+
JSGlobalData::ClientData::~ClientData()
{
}
diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h
index 711e148..f48aec8 100644
--- a/JavaScriptCore/runtime/JSGlobalData.h
+++ b/JavaScriptCore/runtime/JSGlobalData.h
@@ -170,10 +170,12 @@ namespace JSC {
Interpreter* interpreter;
#if ENABLE(JIT)
JITThunks jitStubs;
- NativeExecutable* getThunk(ThunkGenerator generator)
+ MacroAssemblerCodePtr getCTIStub(ThunkGenerator generator)
{
- return jitStubs.specializedThunk(this, generator);
+ return jitStubs.ctiStub(this, generator);
}
+ PassRefPtr<NativeExecutable> getHostFunction(NativeFunction function);
+ PassRefPtr<NativeExecutable> getHostFunction(NativeFunction function, ThunkGenerator generator);
#endif
TimeoutChecker timeoutChecker;
Terminator terminator;
diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp
index 7fd491a..fb9b3eb 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -203,14 +203,14 @@ void JSGlobalObject::reset(JSValue prototype)
// Prototypes
- d()->functionPrototype = new (exec) FunctionPrototype(exec, FunctionPrototype::createStructure(jsNull())); // The real prototype will be set once ObjectPrototype is created.
+ d()->functionPrototype = new (exec) FunctionPrototype(exec, this, FunctionPrototype::createStructure(jsNull())); // The real prototype will be set once ObjectPrototype is created.
d()->prototypeFunctionStructure = PrototypeFunction::createStructure(d()->functionPrototype);
NativeFunctionWrapper* callFunction = 0;
NativeFunctionWrapper* applyFunction = 0;
- d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get(), &callFunction, &applyFunction);
+ d()->functionPrototype->addFunctionProperties(exec, this, d()->prototypeFunctionStructure.get(), &callFunction, &applyFunction);
d()->callFunction = callFunction;
d()->applyFunction = applyFunction;
- d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get());
+ d()->objectPrototype = new (exec) ObjectPrototype(exec, this, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get());
d()->functionPrototype->structure()->setPrototypeWithoutTransition(d()->objectPrototype);
d()->emptyObjectStructure = d()->objectPrototype->inheritorID();
@@ -219,63 +219,54 @@ void JSGlobalObject::reset(JSValue prototype)
d()->callbackFunctionStructure = JSCallbackFunction::createStructure(d()->functionPrototype);
d()->argumentsStructure = Arguments::createStructure(d()->objectPrototype);
d()->callbackConstructorStructure = JSCallbackConstructor::createStructure(d()->objectPrototype);
- d()->callbackObjectStructure = JSCallbackObject<JSObject>::createStructure(d()->objectPrototype);
+ d()->callbackObjectStructure = JSCallbackObject<JSObjectWithGlobalObject>::createStructure(d()->objectPrototype);
- d()->arrayPrototype = new (exec) ArrayPrototype(ArrayPrototype::createStructure(d()->objectPrototype));
+ d()->arrayPrototype = new (exec) ArrayPrototype(this, ArrayPrototype::createStructure(d()->objectPrototype));
d()->arrayStructure = JSArray::createStructure(d()->arrayPrototype);
d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructure(d()->arrayPrototype);
- d()->stringPrototype = new (exec) StringPrototype(exec, StringPrototype::createStructure(d()->objectPrototype));
+ d()->stringPrototype = new (exec) StringPrototype(exec, this, StringPrototype::createStructure(d()->objectPrototype));
d()->stringObjectStructure = StringObject::createStructure(d()->stringPrototype);
- d()->booleanPrototype = new (exec) BooleanPrototype(exec, BooleanPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ d()->booleanPrototype = new (exec) BooleanPrototype(exec, this, BooleanPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
d()->booleanObjectStructure = BooleanObject::createStructure(d()->booleanPrototype);
- d()->numberPrototype = new (exec) NumberPrototype(exec, NumberPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ d()->numberPrototype = new (exec) NumberPrototype(exec, this, NumberPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
d()->numberObjectStructure = NumberObject::createStructure(d()->numberPrototype);
- d()->datePrototype = new (exec) DatePrototype(exec, DatePrototype::createStructure(d()->objectPrototype));
+ d()->datePrototype = new (exec) DatePrototype(exec, this, DatePrototype::createStructure(d()->objectPrototype));
d()->dateStructure = DateInstance::createStructure(d()->datePrototype);
- d()->regExpPrototype = new (exec) RegExpPrototype(exec, RegExpPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ d()->regExpPrototype = new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
d()->regExpStructure = RegExpObject::createStructure(d()->regExpPrototype);
d()->methodCallDummy = constructEmptyObject(exec);
- ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, ErrorPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, this, ErrorPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
d()->errorStructure = ErrorInstance::createStructure(errorPrototype);
- RefPtr<Structure> nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(errorPrototype);
-
- NativeErrorPrototype* evalErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "EvalError", "EvalError");
- NativeErrorPrototype* rangeErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "RangeError", "RangeError");
- NativeErrorPrototype* referenceErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "ReferenceError", "ReferenceError");
- NativeErrorPrototype* syntaxErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "SyntaxError", "SyntaxError");
- NativeErrorPrototype* typeErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "TypeError", "TypeError");
- NativeErrorPrototype* URIErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "URIError", "URIError");
-
// Constructors
- JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
- JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype);
- JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get());
- JSCell* stringConstructor = new (exec) StringConstructor(exec, StringConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype);
- JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, BooleanConstructor::createStructure(d()->functionPrototype), d()->booleanPrototype);
- JSCell* numberConstructor = new (exec) NumberConstructor(exec, NumberConstructor::createStructure(d()->functionPrototype), d()->numberPrototype);
- JSCell* dateConstructor = new (exec) DateConstructor(exec, DateConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->datePrototype);
+ JSCell* objectConstructor = new (exec) ObjectConstructor(exec, this, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
+ JSCell* functionConstructor = new (exec) FunctionConstructor(exec, this, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype);
+ JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, this, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get());
+ JSCell* stringConstructor = new (exec) StringConstructor(exec, this, StringConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype);
+ JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, this, BooleanConstructor::createStructure(d()->functionPrototype), d()->booleanPrototype);
+ JSCell* numberConstructor = new (exec) NumberConstructor(exec, this, NumberConstructor::createStructure(d()->functionPrototype), d()->numberPrototype);
+ JSCell* dateConstructor = new (exec) DateConstructor(exec, this, DateConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->datePrototype);
- d()->regExpConstructor = new (exec) RegExpConstructor(exec, RegExpConstructor::createStructure(d()->functionPrototype), d()->regExpPrototype);
+ d()->regExpConstructor = new (exec) RegExpConstructor(exec, this, RegExpConstructor::createStructure(d()->functionPrototype), d()->regExpPrototype);
- d()->errorConstructor = new (exec) ErrorConstructor(exec, ErrorConstructor::createStructure(d()->functionPrototype), errorPrototype);
+ d()->errorConstructor = new (exec) ErrorConstructor(exec, this, ErrorConstructor::createStructure(d()->functionPrototype), errorPrototype);
+ RefPtr<Structure> nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(errorPrototype);
RefPtr<Structure> nativeErrorStructure = NativeErrorConstructor::createStructure(d()->functionPrototype);
-
- d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, evalErrorPrototype);
- d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, rangeErrorPrototype);
- d()->referenceErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, referenceErrorPrototype);
- d()->syntaxErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, syntaxErrorPrototype);
- d()->typeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, typeErrorPrototype);
- d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, URIErrorPrototype);
+ d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError");
+ d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError");
+ d()->referenceErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "ReferenceError");
+ d()->syntaxErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "SyntaxError");
+ d()->typeErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "TypeError");
+ d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError");
d()->objectPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, objectConstructor, DontEnum);
d()->functionPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, functionConstructor, DontEnum);
@@ -287,13 +278,6 @@ void JSGlobalObject::reset(JSValue prototype)
d()->regExpPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);
errorPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
- evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum);
- rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum);
- referenceErrorPrototype->putDirect(exec->propertyNames().constructor, d()->referenceErrorConstructor, DontEnum);
- syntaxErrorPrototype->putDirect(exec->propertyNames().constructor, d()->syntaxErrorConstructor, DontEnum);
- typeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->typeErrorConstructor, DontEnum);
- URIErrorPrototype->putDirect(exec->propertyNames().constructor, d()->URIErrorConstructor, DontEnum);
-
// Set global constructors
// FIXME: These properties could be handled by a static hash table.
@@ -316,31 +300,31 @@ void JSGlobalObject::reset(JSValue prototype)
// Set global values.
GlobalPropertyInfo staticGlobals[] = {
- GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, MathObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete),
+ GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, this, MathObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete),
GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(exec), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(exec, Inf), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly),
- GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(JSONObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete)
+ GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(this, JSONObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete)
};
addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
// Set global functions.
- d()->evalFunction = new (exec) GlobalEvalFunction(exec, GlobalEvalFunction::createStructure(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this);
+ d()->evalFunction = new (exec) GlobalEvalFunction(exec, this, GlobalEvalFunction::createStructure(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this);
putDirectFunctionWithoutTransition(exec, d()->evalFunction, DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
#ifndef NDEBUG
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum);
#endif
resetPrototype(prototype);
diff --git a/JavaScriptCore/runtime/JSGlobalObject.h b/JavaScriptCore/runtime/JSGlobalObject.h
index e38dc79..09a92a1 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.h
+++ b/JavaScriptCore/runtime/JSGlobalObject.h
@@ -160,10 +160,20 @@ namespace JSC {
public:
void* operator new(size_t, JSGlobalData*);
-
+
explicit JSGlobalObject()
: JSVariableObject(JSGlobalObject::createStructure(jsNull()), new JSGlobalObjectData(destroyJSGlobalObjectData))
{
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putAnonymousValue(0, this);
+ init(this);
+ }
+
+ explicit JSGlobalObject(NonNullPassRefPtr<Structure> structure)
+ : JSVariableObject(structure, new JSGlobalObjectData(destroyJSGlobalObjectData))
+ {
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putAnonymousValue(0, this);
init(this);
}
@@ -171,6 +181,8 @@ namespace JSC {
JSGlobalObject(NonNullPassRefPtr<Structure> structure, JSGlobalObjectData* data, JSObject* thisValue)
: JSVariableObject(structure, data)
{
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putAnonymousValue(0, this);
init(thisValue);
}
@@ -285,6 +297,7 @@ namespace JSC {
protected:
+ static const unsigned AnonymousSlotCount = JSVariableObject::AnonymousSlotCount + 1;
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
struct GlobalPropertyInfo {
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index f6c6b5f..bd0e25f 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -30,6 +30,7 @@
#include "Error.h"
#include "ExceptionHelpers.h"
#include "JSArray.h"
+#include "JSGlobalObject.h"
#include "LiteralParser.h"
#include "Lookup.h"
#include "PropertyNameArray.h"
@@ -49,6 +50,11 @@ static JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*, JSObject*, JSVal
namespace JSC {
+JSONObject::JSONObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+}
+
// PropertyNameForFunctionCall objects must be on the stack, since the JSValue that they create is not marked.
class PropertyNameForFunctionCall {
public:
diff --git a/JavaScriptCore/runtime/JSONObject.h b/JavaScriptCore/runtime/JSONObject.h
index 7a9e0a4..f64be12 100644
--- a/JavaScriptCore/runtime/JSONObject.h
+++ b/JavaScriptCore/runtime/JSONObject.h
@@ -26,18 +26,15 @@
#ifndef JSONObject_h
#define JSONObject_h
-#include "JSObject.h"
+#include "JSObjectWithGlobalObject.h"
namespace JSC {
class Stringifier;
- class JSONObject : public JSObject {
+ class JSONObject : public JSObjectWithGlobalObject {
public:
- JSONObject(NonNullPassRefPtr<Structure> structure)
- : JSObject(structure)
- {
- }
+ JSONObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure);
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp
index 61d3bb1..3ac8a34 100644
--- a/JavaScriptCore/runtime/JSObject.cpp
+++ b/JavaScriptCore/runtime/JSObject.cpp
@@ -27,6 +27,7 @@
#include "DatePrototype.h"
#include "ErrorConstructor.h"
#include "GetterSetter.h"
+#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "NativeErrorConstructor.h"
#include "ObjectPrototype.h"
@@ -509,11 +510,21 @@ void JSObject::putDirectFunction(ExecState* exec, InternalFunction* function, un
putDirectFunction(Identifier(exec, function->name(exec)), function, attr);
}
+void JSObject::putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr)
+{
+ putDirectFunction(Identifier(exec, function->name(exec)), function, attr);
+}
+
void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr)
{
putDirectFunctionWithoutTransition(Identifier(exec, function->name(exec)), function, attr);
}
+void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr)
+{
+ putDirectFunctionWithoutTransition(Identifier(exec, function->name(exec)), function, attr);
+}
+
NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue* location)
{
if (JSObject* getterFunction = asGetterSetter(*location)->getter()) {
diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h
index 64a1118..e942ad0 100644
--- a/JavaScriptCore/runtime/JSObject.h
+++ b/JavaScriptCore/runtime/JSObject.h
@@ -74,6 +74,7 @@ namespace JSC {
friend class BatchedTransitionOptimizer;
friend class JIT;
friend class JSCell;
+ friend void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot);
public:
explicit JSObject(NonNullPassRefPtr<Structure>);
@@ -176,10 +177,12 @@ namespace JSC {
void putDirectFunction(const Identifier& propertyName, JSCell* value, unsigned attr = 0);
void putDirectFunction(const Identifier& propertyName, JSCell* value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0);
+ void putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr = 0);
void putDirectWithoutTransition(const Identifier& propertyName, JSValue value, unsigned attr = 0);
void putDirectFunctionWithoutTransition(const Identifier& propertyName, JSCell* value, unsigned attr = 0);
void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0);
+ void putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr = 0);
// Fast access to known property offsets.
JSValue getDirectOffset(size_t offset) const { return JSValue::decode(propertyStorage()[offset]); }
@@ -217,9 +220,6 @@ namespace JSC {
m_structure->flattenDictionaryStructure(this);
}
- protected:
- static const unsigned StructureFlags = 0;
-
void putAnonymousValue(unsigned index, JSValue value)
{
ASSERT(index < m_structure->anonymousSlotCount());
@@ -230,7 +230,10 @@ namespace JSC {
ASSERT(index < m_structure->anonymousSlotCount());
return *locationForOffset(index);
}
-
+
+ protected:
+ static const unsigned StructureFlags = 0;
+
private:
// Nobody should ever ask any of these questions on something already known to be a JSObject.
using JSCell::isAPIValueWrapper;
diff --git a/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp b/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp
new file mode 100644
index 0000000..e9d6c96
--- /dev/null
+++ b/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSObjectWithGlobalObject.h"
+
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : JSObject(structure)
+{
+ COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
+ ASSERT(!globalObject || globalObject->isGlobalObject());
+ putAnonymousValue(GlobalObjectSlot, globalObject);
+}
+
+JSGlobalObject* JSObjectWithGlobalObject::globalObject() const
+{
+ return asGlobalObject((getAnonymousValue(GlobalObjectSlot).asCell()));
+}
+
+} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSObjectWithGlobalObject.h b/JavaScriptCore/runtime/JSObjectWithGlobalObject.h
new file mode 100644
index 0000000..9416a62
--- /dev/null
+++ b/JavaScriptCore/runtime/JSObjectWithGlobalObject.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSObjectWithGlobalObject_h
+#define JSObjectWithGlobalObject_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+class JSGlobalObject;
+
+class JSObjectWithGlobalObject : public JSObject {
+public:
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ JSGlobalObject* globalObject() const;
+
+protected:
+ JSObjectWithGlobalObject(JSGlobalObject*, NonNullPassRefPtr<Structure>);
+
+ JSObjectWithGlobalObject(NonNullPassRefPtr<Structure> structure)
+ : JSObject(structure)
+ {
+ // Should only be used by JSFunction when we aquire the JSFunction vptr.
+ }
+ static const unsigned AnonymousSlotCount = JSObject::AnonymousSlotCount + 1;
+ static const unsigned GlobalObjectSlot = 0;
+};
+
+} // namespace JSC
+
+#endif // JSObjectWithGlobalObject_h
diff --git a/JavaScriptCore/runtime/JSString.cpp b/JavaScriptCore/runtime/JSString.cpp
index df67133..473eb77 100644
--- a/JavaScriptCore/runtime/JSString.cpp
+++ b/JavaScriptCore/runtime/JSString.cpp
@@ -57,7 +57,8 @@ void JSString::resolveRope(ExecState* exec) const
m_fiberCount = 0;
ASSERT(!isRope());
ASSERT(m_value == UString());
- throwOutOfMemoryError(exec);
+ if (exec)
+ throwOutOfMemoryError(exec);
return;
}
UChar* position = buffer + m_length;
diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h
index 5001b01..dec925d 100644
--- a/JavaScriptCore/runtime/JSString.h
+++ b/JavaScriptCore/runtime/JSString.h
@@ -327,11 +327,10 @@ namespace JSC {
resolveRope(exec);
return m_value;
}
- const UString tryGetValue() const
+ const UString& tryGetValue() const
{
- // If this is a rope, m_value should be null -
- // if this is not a rope, m_value should be non-null.
- ASSERT(isRope() == m_value.isNull());
+ if (isRope())
+ resolveRope(0);
return m_value;
}
unsigned length() { return m_length; }
@@ -498,7 +497,7 @@ namespace JSC {
if (isRope())
return getIndexSlowCase(exec, i);
ASSERT(i < m_value.size());
- return jsSingleCharacterSubstring(exec, value(exec), i);
+ return jsSingleCharacterSubstring(exec, m_value, i);
}
inline JSString* jsString(JSGlobalData* globalData, const UString& s)
diff --git a/JavaScriptCore/runtime/JSValue.cpp b/JavaScriptCore/runtime/JSValue.cpp
index 502312c..3a2d713 100644
--- a/JavaScriptCore/runtime/JSValue.cpp
+++ b/JavaScriptCore/runtime/JSValue.cpp
@@ -181,4 +181,9 @@ NEVER_INLINE double nonInlineNaN()
#endif
}
+bool JSValue::isValidCallee()
+{
+ return asObject(asObject(asCell())->getAnonymousValue(0))->isGlobalObject();
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h
index bcf82ee..914e2d5 100644
--- a/JavaScriptCore/runtime/JSValue.h
+++ b/JavaScriptCore/runtime/JSValue.h
@@ -203,6 +203,7 @@ namespace JSC {
bool isCell() const;
JSCell* asCell() const;
+ bool isValidCallee();
#ifndef NDEBUG
char* description();
diff --git a/JavaScriptCore/runtime/Lookup.cpp b/JavaScriptCore/runtime/Lookup.cpp
index 0042e4d..57d4f0c 100644
--- a/JavaScriptCore/runtime/Lookup.cpp
+++ b/JavaScriptCore/runtime/Lookup.cpp
@@ -20,6 +20,7 @@
#include "config.h"
#include "Lookup.h"
+#include "Executable.h"
#include "JSFunction.h"
#include "PrototypeFunction.h"
@@ -70,17 +71,20 @@ void HashTable::deleteTable() const
void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot)
{
+ ASSERT(thisObj->structure()->anonymousSlotCount() > 0);
+ ASSERT(thisObj->getAnonymousValue(0).isCell() && asObject(thisObj->getAnonymousValue(0).asCell())->isGlobalObject());
ASSERT(entry->attributes() & Function);
JSValue* location = thisObj->getDirectLocation(propertyName);
if (!location) {
- InternalFunction* function;
+ NativeFunctionWrapper* function;
+ JSGlobalObject* globalObject = asGlobalObject(thisObj->getAnonymousValue(0).asCell());
#if ENABLE(JIT)
if (entry->generator())
- function = new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), entry->functionLength(), propertyName, exec->globalData().getThunk(entry->generator()), entry->function());
+ function = new (exec) NativeFunctionWrapper(exec, globalObject, globalObject->prototypeFunctionStructure(), entry->functionLength(), propertyName, exec->globalData().getHostFunction(entry->function(), entry->generator()));
else
#endif
- function = new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), entry->functionLength(), propertyName, entry->function());
+ function = new (exec) NativeFunctionWrapper(exec, globalObject, globalObject->prototypeFunctionStructure(), entry->functionLength(), propertyName, entry->function());
thisObj->putDirectFunction(propertyName, function, entry->attributes());
location = thisObj->getDirectLocation(propertyName);
diff --git a/JavaScriptCore/runtime/MathObject.cpp b/JavaScriptCore/runtime/MathObject.cpp
index 1e28dfa..be249e5 100644
--- a/JavaScriptCore/runtime/MathObject.cpp
+++ b/JavaScriptCore/runtime/MathObject.cpp
@@ -86,8 +86,8 @@ const ClassInfo MathObject::info = { "Math", 0, 0, ExecState::mathTable };
@end
*/
-MathObject::MathObject(ExecState* exec, NonNullPassRefPtr<Structure> structure)
- : JSObject(structure)
+MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
{
putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);
putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly);
diff --git a/JavaScriptCore/runtime/MathObject.h b/JavaScriptCore/runtime/MathObject.h
index a9f7031..31fa2fe 100644
--- a/JavaScriptCore/runtime/MathObject.h
+++ b/JavaScriptCore/runtime/MathObject.h
@@ -21,13 +21,13 @@
#ifndef MathObject_h
#define MathObject_h
-#include "JSObject.h"
+#include "JSObjectWithGlobalObject.h"
namespace JSC {
- class MathObject : public JSObject {
+ class MathObject : public JSObjectWithGlobalObject {
public:
- MathObject(ExecState*, NonNullPassRefPtr<Structure>);
+ MathObject(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
index 403fc7e..0fa2218 100644
--- a/JavaScriptCore/runtime/NativeErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
@@ -32,14 +32,17 @@ ASSERT_CLASS_FITS_IN_CELL(NativeErrorConstructor);
const ClassInfo NativeErrorConstructor::info = { "Function", &InternalFunction::info, 0, 0 };
-NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, NativeErrorPrototype* nativeErrorPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, nativeErrorPrototype->getDirect(exec->propertyNames().name).getString(exec)))
- , m_errorStructure(ErrorInstance::createStructure(nativeErrorPrototype))
+NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<Structure> prototypeStructure, const UString& nameAndMessage)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, nameAndMessage))
{
+ NativeErrorPrototype* prototype = new (exec) NativeErrorPrototype(exec, globalObject, prototypeStructure, nameAndMessage, this);
+
putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
- putDirect(exec->propertyNames().prototype, nativeErrorPrototype, DontDelete | ReadOnly | DontEnum);
+ putDirect(exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
+ m_errorStructure = ErrorInstance::createStructure(prototype);
}
+
ErrorInstance* NativeErrorConstructor::construct(ExecState* exec, const ArgList& args)
{
ErrorInstance* object = new (exec) ErrorInstance(m_errorStructure);
diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.h b/JavaScriptCore/runtime/NativeErrorConstructor.h
index 152dbac..0153309 100644
--- a/JavaScriptCore/runtime/NativeErrorConstructor.h
+++ b/JavaScriptCore/runtime/NativeErrorConstructor.h
@@ -31,7 +31,7 @@ namespace JSC {
class NativeErrorConstructor : public InternalFunction {
public:
- NativeErrorConstructor(ExecState*, NonNullPassRefPtr<Structure>, NativeErrorPrototype*);
+ NativeErrorConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<Structure> prototypeStructure, const UString&);
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/NativeErrorPrototype.cpp b/JavaScriptCore/runtime/NativeErrorPrototype.cpp
index aa46a6a..540220a 100644
--- a/JavaScriptCore/runtime/NativeErrorPrototype.cpp
+++ b/JavaScriptCore/runtime/NativeErrorPrototype.cpp
@@ -22,18 +22,21 @@
#include "NativeErrorPrototype.h"
#include "ErrorPrototype.h"
+#include "JSGlobalObject.h"
#include "JSString.h"
+#include "NativeErrorConstructor.h"
#include "UString.h"
namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
-NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& name, const UString& message)
- : JSObject(structure)
+NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+ : JSObjectWithGlobalObject(globalObject, structure)
{
- putDirect(exec->propertyNames().name, jsString(exec, name), 0);
- putDirect(exec->propertyNames().message, jsString(exec, message), 0);
+ putDirect(exec->propertyNames().name, jsString(exec, nameAndMessage), 0);
+ putDirect(exec->propertyNames().message, jsString(exec, nameAndMessage), 0);
+ putDirect(exec->propertyNames().constructor, constructor, DontEnum);
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/NativeErrorPrototype.h b/JavaScriptCore/runtime/NativeErrorPrototype.h
index 0c65a9c..30690d5 100644
--- a/JavaScriptCore/runtime/NativeErrorPrototype.h
+++ b/JavaScriptCore/runtime/NativeErrorPrototype.h
@@ -21,13 +21,14 @@
#ifndef NativeErrorPrototype_h
#define NativeErrorPrototype_h
-#include "JSObject.h"
+#include "JSObjectWithGlobalObject.h"
namespace JSC {
+ class NativeErrorConstructor;
- class NativeErrorPrototype : public JSObject {
+ class NativeErrorPrototype : public JSObjectWithGlobalObject {
public:
- NativeErrorPrototype(ExecState*, NonNullPassRefPtr<Structure>, const UString& name, const UString& message);
+ NativeErrorPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, const UString&, NativeErrorConstructor*);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/NumberConstructor.cpp b/JavaScriptCore/runtime/NumberConstructor.cpp
index 0b7e821..482e87b 100644
--- a/JavaScriptCore/runtime/NumberConstructor.cpp
+++ b/JavaScriptCore/runtime/NumberConstructor.cpp
@@ -54,8 +54,8 @@ const ClassInfo NumberConstructor::info = { "Function", &InternalFunction::info,
@end
*/
-NumberConstructor::NumberConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, numberPrototype->info.className))
+NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, numberPrototype->info.className))
{
// Number.Prototype
putDirectWithoutTransition(exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly);
diff --git a/JavaScriptCore/runtime/NumberConstructor.h b/JavaScriptCore/runtime/NumberConstructor.h
index 723c4b2..d8a2593 100644
--- a/JavaScriptCore/runtime/NumberConstructor.h
+++ b/JavaScriptCore/runtime/NumberConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class NumberConstructor : public InternalFunction {
public:
- NumberConstructor(ExecState*, NonNullPassRefPtr<Structure>, NumberPrototype*);
+ NumberConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, NumberPrototype*);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp
index 7326b9d..efed90b 100644
--- a/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -47,19 +47,19 @@ static JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*, JSObject*, J
// ECMA 15.7.4
-NumberPrototype::NumberPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: NumberObject(structure)
{
setInternalValue(jsNumber(exec, 0));
// The constructor will be added later, after NumberConstructor has been constructed
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
}
// ------------------------------ Functions ---------------------------
diff --git a/JavaScriptCore/runtime/NumberPrototype.h b/JavaScriptCore/runtime/NumberPrototype.h
index 1fb2077..78b690e 100644
--- a/JavaScriptCore/runtime/NumberPrototype.h
+++ b/JavaScriptCore/runtime/NumberPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class NumberPrototype : public NumberObject {
public:
- NumberPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ NumberPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp
index 0838eb4..fe98df3 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ b/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -42,8 +42,8 @@ static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*, JSObjec
static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*, JSObject*, JSValue, const ArgList&);
-ObjectConstructor::ObjectConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
-: InternalFunction(&exec->globalData(), structure, Identifier(exec, "Object"))
+ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
+: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object"))
{
// ECMA 15.2.3.1
putDirectWithoutTransition(exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
@@ -51,13 +51,13 @@ ObjectConstructor::ObjectConstructor(ExecState* exec, NonNullPassRefPtr<Structur
// no. of arguments for constructor
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getOwnPropertyNames, objectConstructorGetOwnPropertyNames), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().create, objectConstructorCreate), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().getOwnPropertyNames, objectConstructorGetOwnPropertyNames), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().create, objectConstructorCreate), DontEnum);
}
// ECMA 15.2.2
diff --git a/JavaScriptCore/runtime/ObjectConstructor.h b/JavaScriptCore/runtime/ObjectConstructor.h
index 1d2cdde..04a3c1a 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.h
+++ b/JavaScriptCore/runtime/ObjectConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class ObjectConstructor : public InternalFunction {
public:
- ObjectConstructor(ExecState*, NonNullPassRefPtr<Structure>, ObjectPrototype*, Structure* prototypeFunctionStructure);
+ ObjectConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ObjectPrototype*, Structure* prototypeFunctionStructure);
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/ObjectPrototype.cpp b/JavaScriptCore/runtime/ObjectPrototype.cpp
index c32a007..97601f3 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ b/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -41,22 +41,22 @@ static JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*, JSObject*,
static JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&);
-ObjectPrototype::ObjectPrototype(ExecState* exec, NonNullPassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
+ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
: JSObject(stucture)
, m_hasNoPropertiesWithUInt32Names(true)
{
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
// Mozilla extensions
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
}
void ObjectPrototype::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
diff --git a/JavaScriptCore/runtime/ObjectPrototype.h b/JavaScriptCore/runtime/ObjectPrototype.h
index 489d962..47065d7 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.h
+++ b/JavaScriptCore/runtime/ObjectPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class ObjectPrototype : public JSObject {
public:
- ObjectPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ ObjectPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
private:
virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
diff --git a/JavaScriptCore/runtime/PrototypeFunction.cpp b/JavaScriptCore/runtime/PrototypeFunction.cpp
index 38f8adb..b0bf2bd 100644
--- a/JavaScriptCore/runtime/PrototypeFunction.cpp
+++ b/JavaScriptCore/runtime/PrototypeFunction.cpp
@@ -32,16 +32,16 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(PrototypeFunction);
-PrototypeFunction::PrototypeFunction(ExecState* exec, int length, const Identifier& name, NativeFunction function)
- : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), name)
+PrototypeFunction::PrototypeFunction(ExecState* exec, JSGlobalObject* globalObject, int length, const Identifier& name, NativeFunction function)
+ : InternalFunction(&exec->globalData(), globalObject, exec->lexicalGlobalObject()->prototypeFunctionStructure(), name)
, m_function(function)
{
ASSERT_ARG(function, function);
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
}
-PrototypeFunction::PrototypeFunction(ExecState* exec, NonNullPassRefPtr<Structure> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function)
- : InternalFunction(&exec->globalData(), prototypeFunctionStructure, name)
+PrototypeFunction::PrototypeFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function)
+ : InternalFunction(&exec->globalData(), globalObject, prototypeFunctionStructure, name)
, m_function(function)
{
ASSERT_ARG(function, function);
diff --git a/JavaScriptCore/runtime/PrototypeFunction.h b/JavaScriptCore/runtime/PrototypeFunction.h
index 70ee034..6ca2342 100644
--- a/JavaScriptCore/runtime/PrototypeFunction.h
+++ b/JavaScriptCore/runtime/PrototypeFunction.h
@@ -31,8 +31,8 @@ namespace JSC {
class PrototypeFunction : public InternalFunction {
public:
- PrototypeFunction(ExecState*, int length, const Identifier&, NativeFunction);
- PrototypeFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
+ PrototypeFunction(ExecState*, JSGlobalObject*, int length, const Identifier&, NativeFunction);
+ PrototypeFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
private:
virtual CallType getCallData(CallData&);
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index 3a67ae6..e7e6109 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -91,8 +91,8 @@ const ClassInfo RegExpConstructor::info = { "Function", &InternalFunction::info,
@end
*/
-RegExpConstructor::RegExpConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, "RegExp"))
+RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "RegExp"))
, d(new RegExpConstructorPrivate)
{
// ECMA 15.10.5.1 RegExp.prototype
@@ -304,7 +304,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
RefPtr<RegExp> regExp = RegExp::create(&exec->globalData(), pattern, flags);
if (!regExp->isValid())
return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage()));
- return new (exec) RegExpObject(exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
+ return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
}
static JSObject* constructWithRegExpConstructor(ExecState* exec, JSObject*, const ArgList& args)
diff --git a/JavaScriptCore/runtime/RegExpConstructor.h b/JavaScriptCore/runtime/RegExpConstructor.h
index bb0671a..58abde5 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.h
+++ b/JavaScriptCore/runtime/RegExpConstructor.h
@@ -55,7 +55,7 @@ namespace JSC {
class RegExpConstructor : public InternalFunction {
public:
- RegExpConstructor(ExecState*, NonNullPassRefPtr<Structure>, RegExpPrototype*);
+ RegExpConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, RegExpPrototype*);
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
diff --git a/JavaScriptCore/runtime/RegExpObject.cpp b/JavaScriptCore/runtime/RegExpObject.cpp
index bc74924..b04b55e 100644
--- a/JavaScriptCore/runtime/RegExpObject.cpp
+++ b/JavaScriptCore/runtime/RegExpObject.cpp
@@ -58,8 +58,8 @@ const ClassInfo RegExpObject::info = { "RegExp", 0, 0, ExecState::regExpTable };
@end
*/
-RegExpObject::RegExpObject(NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<RegExp> regExp)
- : JSObject(structure)
+RegExpObject::RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<RegExp> regExp)
+ : JSObjectWithGlobalObject(globalObject, structure)
, d(new RegExpObjectData(regExp, 0))
{
}
diff --git a/JavaScriptCore/runtime/RegExpObject.h b/JavaScriptCore/runtime/RegExpObject.h
index 4ad11ef..3324e53 100644
--- a/JavaScriptCore/runtime/RegExpObject.h
+++ b/JavaScriptCore/runtime/RegExpObject.h
@@ -21,14 +21,14 @@
#ifndef RegExpObject_h
#define RegExpObject_h
-#include "JSObject.h"
+#include "JSObjectWithGlobalObject.h"
#include "RegExp.h"
namespace JSC {
- class RegExpObject : public JSObject {
+ class RegExpObject : public JSObjectWithGlobalObject {
public:
- RegExpObject(NonNullPassRefPtr<Structure>, NonNullPassRefPtr<RegExp>);
+ RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure>, NonNullPassRefPtr<RegExp>);
virtual ~RegExpObject();
void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; }
@@ -53,8 +53,8 @@ namespace JSC {
}
protected:
- static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
-
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObjectWithGlobalObject::StructureFlags;
+
private:
bool match(ExecState*, const ArgList&);
diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp
index dd5fe02..9ebf105 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -47,13 +47,13 @@ static JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*, JSObject*, JSVa
const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0, 0 };
-RegExpPrototype::RegExpPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: JSObject(structure)
{
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
}
// ------------------------------ Functions ---------------------------
diff --git a/JavaScriptCore/runtime/RegExpPrototype.h b/JavaScriptCore/runtime/RegExpPrototype.h
index d3979bd..77c1ea7 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.h
+++ b/JavaScriptCore/runtime/RegExpPrototype.h
@@ -27,7 +27,7 @@ namespace JSC {
class RegExpPrototype : public JSObject {
public:
- RegExpPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ RegExpPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
diff --git a/JavaScriptCore/runtime/StringConstructor.cpp b/JavaScriptCore/runtime/StringConstructor.cpp
index 42f98c3..b5c46b6 100644
--- a/JavaScriptCore/runtime/StringConstructor.cpp
+++ b/JavaScriptCore/runtime/StringConstructor.cpp
@@ -21,6 +21,8 @@
#include "config.h"
#include "StringConstructor.h"
+#include "Executable.h"
+#include "JITCode.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "PrototypeFunction.h"
@@ -47,17 +49,17 @@ static JSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec, JSObject*, JSVa
ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
-StringConstructor::StringConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, StringPrototype* stringPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, stringPrototype->classInfo()->className))
+StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, StringPrototype* stringPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, stringPrototype->classInfo()->className))
{
// ECMA 15.5.3.1 String.prototype
putDirectWithoutTransition(exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);
// ECMA 15.5.3.2 fromCharCode()
#if ENABLE(JIT)
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, exec->globalData().getThunk(fromCharCodeThunkGenerator), stringFromCharCode), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, exec->globalData().getHostFunction(stringFromCharCode, fromCharCodeThunkGenerator)), DontEnum);
#else
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
#endif
// no. of arguments for constructor
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
diff --git a/JavaScriptCore/runtime/StringConstructor.h b/JavaScriptCore/runtime/StringConstructor.h
index e511f7b..20f3a52 100644
--- a/JavaScriptCore/runtime/StringConstructor.h
+++ b/JavaScriptCore/runtime/StringConstructor.h
@@ -29,7 +29,7 @@ namespace JSC {
class StringConstructor : public InternalFunction {
public:
- StringConstructor(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, StringPrototype*);
+ StringConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, StringPrototype*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp
index b385e70..9df3dbb 100644
--- a/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/JavaScriptCore/runtime/StringPrototype.cpp
@@ -132,9 +132,10 @@ const ClassInfo StringPrototype::info = { "String", &StringObject::info, 0, Exec
*/
// ECMA 15.5.4
-StringPrototype::StringPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
+StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: StringObject(exec, structure)
{
+ putAnonymousValue(0, globalObject);
// The constructor will be added later, after StringConstructor has been built
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
}
@@ -301,6 +302,8 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
if (pattern.inherits(&RegExpObject::info)) {
const UString& source = sourceVal->value(exec);
+ if (exec->hadException())
+ return JSValue();
RegExp* reg = asRegExpObject(pattern)->regExp();
bool global = reg->global();
diff --git a/JavaScriptCore/runtime/StringPrototype.h b/JavaScriptCore/runtime/StringPrototype.h
index 3a6a2a3..4b0f88f 100644
--- a/JavaScriptCore/runtime/StringPrototype.h
+++ b/JavaScriptCore/runtime/StringPrototype.h
@@ -29,7 +29,7 @@ namespace JSC {
class StringPrototype : public StringObject {
public:
- StringPrototype(ExecState*, NonNullPassRefPtr<Structure>);
+ StringPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp
index 6b16274..bdc896d 100644
--- a/JavaScriptCore/runtime/UString.cpp
+++ b/JavaScriptCore/runtime/UString.cpp
@@ -60,6 +60,8 @@ extern const double Inf;
// The null string is immutable, except for refCount.
UString* UString::s_nullUString;
+COMPILE_ASSERT(sizeof(UString) == sizeof(void*), UString_should_stay_small);
+
void initializeUString()
{
// UStringImpl::empty() does not construct its static string in a threadsafe fashion,
diff --git a/JavaScriptCore/wtf/CurrentTime.cpp b/JavaScriptCore/wtf/CurrentTime.cpp
index 08fffa2..56724cb 100644
--- a/JavaScriptCore/wtf/CurrentTime.cpp
+++ b/JavaScriptCore/wtf/CurrentTime.cpp
@@ -163,7 +163,6 @@ double currentTime()
// QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
// To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use QueryPerformanceCounter
// by itself, adding the delta to the saved ftime. We periodically re-sync to correct for drift.
- static bool started;
static double syncLowResUTCTime;
static double syncHighResUpTime;
static double lastUTCTime;
diff --git a/JavaScriptCore/wtf/ListHashSet.h b/JavaScriptCore/wtf/ListHashSet.h
index 54ed36b..09355ad 100644
--- a/JavaScriptCore/wtf/ListHashSet.h
+++ b/JavaScriptCore/wtf/ListHashSet.h
@@ -37,27 +37,27 @@ namespace WTF {
// and an append that moves the element to the end even if already present,
// but unclear yet if these are needed.
- template<typename Value, typename HashFunctions> class ListHashSet;
+ template<typename Value, size_t inlineCapacity, typename HashFunctions> class ListHashSet;
template<typename T> struct IdentityExtractor;
- template<typename Value, typename HashFunctions>
- void deleteAllValues(const ListHashSet<Value, HashFunctions>&);
+ template<typename Value, size_t inlineCapacity, typename HashFunctions>
+ void deleteAllValues(const ListHashSet<Value, inlineCapacity, HashFunctions>&);
- template<typename ValueArg, typename HashArg> class ListHashSetIterator;
- template<typename ValueArg, typename HashArg> class ListHashSetConstIterator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator;
- template<typename ValueArg> struct ListHashSetNode;
- template<typename ValueArg> struct ListHashSetNodeAllocator;
- template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions;
- template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase {
+ template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase {
private:
- typedef ListHashSetNode<ValueArg> Node;
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
typedef HashTraits<Node*> NodeTraits;
- typedef ListHashSetNodeHashFunctions<ValueArg, HashArg> NodeHash;
+ typedef ListHashSetNodeHashFunctions<ValueArg, inlineCapacity, HashArg> NodeHash;
typedef HashTable<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplType;
typedef HashTableIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeIterator;
@@ -67,10 +67,10 @@ namespace WTF {
public:
typedef ValueArg ValueType;
- typedef ListHashSetIterator<ValueType, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueType, HashArg> const_iterator;
+ typedef ListHashSetIterator<ValueType, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueType, inlineCapacity, HashArg> const_iterator;
- friend class ListHashSetConstIterator<ValueType, HashArg>;
+ friend class ListHashSetConstIterator<ValueType, inlineCapacity, HashArg>;
ListHashSet();
ListHashSet(const ListHashSet&);
@@ -119,9 +119,9 @@ namespace WTF {
OwnPtr<NodeAllocator> m_allocator;
};
- template<typename ValueArg> struct ListHashSetNodeAllocator {
- typedef ListHashSetNode<ValueArg> Node;
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
ListHashSetNodeAllocator()
: m_freeList(pool())
@@ -181,15 +181,15 @@ namespace WTF {
Node* m_freeList;
bool m_isDoneWithInitialFreeList;
- static const size_t m_poolSize = 256;
+ static const size_t m_poolSize = inlineCapacity;
union {
char pool[sizeof(Node) * m_poolSize];
double forAlignment;
} m_pool;
};
- template<typename ValueArg> struct ListHashSetNode {
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode {
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
ListHashSetNode(ValueArg value)
: m_value(value)
@@ -220,25 +220,25 @@ namespace WTF {
#endif
};
- template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions {
- typedef ListHashSetNode<ValueArg> Node;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
static unsigned hash(Node* const& key) { return HashArg::hash(key->m_value); }
static bool equal(Node* const& a, Node* const& b) { return HashArg::equal(a->m_value, b->m_value); }
static const bool safeToCompareToEmptyOrDeleted = false;
};
- template<typename ValueArg, typename HashArg> class ListHashSetIterator {
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator {
private:
- typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
- typedef ListHashSetIterator<ValueArg, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
- typedef ListHashSetNode<ValueArg> Node;
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
typedef ValueArg ValueType;
typedef ValueType& ReferenceType;
typedef ValueType* PointerType;
- friend class ListHashSet<ValueArg, HashArg>;
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
ListHashSetIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { }
@@ -271,18 +271,18 @@ namespace WTF {
const_iterator m_iterator;
};
- template<typename ValueArg, typename HashArg> class ListHashSetConstIterator {
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator {
private:
- typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
- typedef ListHashSetIterator<ValueArg, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
- typedef ListHashSetNode<ValueArg> Node;
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
typedef ValueArg ValueType;
typedef const ValueType& ReferenceType;
typedef const ValueType* PointerType;
- friend class ListHashSet<ValueArg, HashArg>;
- friend class ListHashSetIterator<ValueArg, HashArg>;
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+ friend class ListHashSetIterator<ValueArg, inlineCapacity, HashArg>;
ListHashSetConstIterator(const ListHashSetType* set, Node* position)
: m_set(set)
@@ -341,11 +341,11 @@ namespace WTF {
};
- template<typename ValueType, typename HashFunctions>
+ template<typename ValueType, size_t inlineCapacity, typename HashFunctions>
struct ListHashSetTranslator {
private:
- typedef ListHashSetNode<ValueType> Node;
- typedef ListHashSetNodeAllocator<ValueType> NodeAllocator;
+ typedef ListHashSetNode<ValueType, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueType, inlineCapacity> NodeAllocator;
public:
static unsigned hash(const ValueType& key) { return HashFunctions::hash(key); }
static bool equal(Node* const& a, const ValueType& b) { return HashFunctions::equal(a->m_value, b); }
@@ -355,16 +355,16 @@ namespace WTF {
}
};
- template<typename T, typename U>
- inline ListHashSet<T, U>::ListHashSet()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet()
: m_head(0)
, m_tail(0)
, m_allocator(new NodeAllocator)
{
}
- template<typename T, typename U>
- inline ListHashSet<T, U>::ListHashSet(const ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet(const ListHashSet& other)
: m_head(0)
, m_tail(0)
, m_allocator(new NodeAllocator)
@@ -374,16 +374,16 @@ namespace WTF {
add(*it);
}
- template<typename T, typename U>
- inline ListHashSet<T, U>& ListHashSet<T, U>::operator=(const ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>& ListHashSet<T, inlineCapacity, U>::operator=(const ListHashSet& other)
{
ListHashSet tmp(other);
swap(tmp);
return *this;
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::swap(ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::swap(ListHashSet& other)
{
m_impl.swap(other.m_impl);
std::swap(m_head, other.m_head);
@@ -391,95 +391,95 @@ namespace WTF {
m_allocator.swap(other.m_allocator);
}
- template<typename T, typename U>
- inline ListHashSet<T, U>::~ListHashSet()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::~ListHashSet()
{
deleteAllNodes();
}
- template<typename T, typename U>
- inline int ListHashSet<T, U>::size() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::size() const
{
return m_impl.size();
}
- template<typename T, typename U>
- inline int ListHashSet<T, U>::capacity() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::capacity() const
{
return m_impl.capacity();
}
- template<typename T, typename U>
- inline bool ListHashSet<T, U>::isEmpty() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const
{
return m_impl.isEmpty();
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::begin()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::begin()
{
return makeIterator(m_head);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::end()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::end()
{
return makeIterator(0);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::begin() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::begin() const
{
return makeConstIterator(m_head);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::end() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::end() const
{
return makeConstIterator(0);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::find(const ValueType& value)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
ImplTypeIterator it = m_impl.template find<ValueType, Translator>(value);
if (it == m_impl.end())
return end();
return makeIterator(*it);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::find(const ValueType& value) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) const
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
ImplTypeConstIterator it = m_impl.template find<ValueType, Translator>(value);
if (it == m_impl.end())
return end();
return makeConstIterator(*it);
}
- template<typename T, typename U>
- inline bool ListHashSet<T, U>::contains(const ValueType& value) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::contains(const ValueType& value) const
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
return m_impl.template contains<ValueType, Translator>(value);
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::add(const ValueType &value)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::add(const ValueType &value)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(value, m_allocator.get());
if (result.second)
appendNode(*result.first);
return std::make_pair(makeIterator(*result.first), result.second);
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(iterator it, const ValueType& newValue)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, const ValueType& newValue)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(newValue, m_allocator.get());
if (result.second)
insertNodeBefore(it.node(), *result.first);
@@ -487,14 +487,14 @@ namespace WTF {
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
{
return insertBefore(find(beforeValue), newValue);
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::remove(iterator it)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(iterator it)
{
if (it == end())
return;
@@ -502,14 +502,14 @@ namespace WTF {
unlinkAndDelete(it.node());
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::remove(const ValueType& value)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(const ValueType& value)
{
remove(find(value));
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::clear()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::clear()
{
deleteAllNodes();
m_impl.clear();
@@ -517,8 +517,8 @@ namespace WTF {
m_tail = 0;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::unlinkAndDelete(Node* node)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::unlinkAndDelete(Node* node)
{
if (!node->m_prev) {
ASSERT(node == m_head);
@@ -539,8 +539,8 @@ namespace WTF {
node->destroy(m_allocator.get());
}
- template<typename T, typename U>
- void ListHashSet<T, U>::appendNode(Node* node)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::appendNode(Node* node)
{
node->m_prev = m_tail;
node->m_next = 0;
@@ -556,8 +556,8 @@ namespace WTF {
m_tail = node;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
{
if (!beforeNode)
return appendNode(newNode);
@@ -572,8 +572,8 @@ namespace WTF {
m_head = newNode;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::deleteAllNodes()
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::deleteAllNodes()
{
if (!m_head)
return;
@@ -582,16 +582,16 @@ namespace WTF {
node->destroy(m_allocator.get());
}
- template<typename T, typename U>
- inline ListHashSetIterator<T, U> ListHashSet<T, U>::makeIterator(Node* position)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeIterator(Node* position)
{
- return ListHashSetIterator<T, U>(this, position);
+ return ListHashSetIterator<T, inlineCapacity, U>(this, position);
}
- template<typename T, typename U>
- inline ListHashSetConstIterator<T, U> ListHashSet<T, U>::makeConstIterator(Node* position) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetConstIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeConstIterator(Node* position) const
{
- return ListHashSetConstIterator<T, U>(this, position);
+ return ListHashSetConstIterator<T, inlineCapacity, U>(this, position);
}
template<bool, typename ValueType, typename HashTableType>
@@ -603,10 +603,10 @@ namespace WTF {
delete (*it)->m_value;
}
- template<typename T, typename U>
- inline void deleteAllValues(const ListHashSet<T, U>& collection)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collection)
{
- deleteAllValues<true, typename ListHashSet<T, U>::ValueType>(collection.m_impl);
+ deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueType>(collection.m_impl);
}
} // namespace WTF
diff --git a/JavaScriptCore/wtf/MainThread.cpp b/JavaScriptCore/wtf/MainThread.cpp
index 1a0682b..6178420 100644
--- a/JavaScriptCore/wtf/MainThread.cpp
+++ b/JavaScriptCore/wtf/MainThread.cpp
@@ -230,7 +230,7 @@ void setMainThreadCallbacksPaused(bool paused)
scheduleDispatchFunctionsOnMainThread();
}
-#if !PLATFORM(MAC) && !PLATFORM(QT)
+#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(BREWMP)
bool isMainThread()
{
return currentThread() == mainThreadIdentifier;
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 310eb04..bcf3bbe 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -522,6 +522,10 @@
#endif
#endif
+#if PLATFORM(BREWMP)
+#define WTF_PLATFORM_SKIA 1
+#endif
+
#if PLATFORM(GTK)
#define WTF_PLATFORM_CAIRO 1
#endif
@@ -1009,12 +1013,6 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define HAVE_COMPUTED_GOTO 1
#endif
-#if ENABLE(JIT) && defined(COVERAGE)
- #define WTF_USE_INTERPRETER 0
-#else
- #define WTF_USE_INTERPRETER 1
-#endif
-
/* Yet Another Regex Runtime. */
#if !defined(ENABLE_YARR_JIT)
diff --git a/JavaScriptCore/wtf/SizeLimits.cpp b/JavaScriptCore/wtf/SizeLimits.cpp
new file mode 100644
index 0000000..090c1ed
--- /dev/null
+++ b/JavaScriptCore/wtf/SizeLimits.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include <wtf/Assertions.h>
+#include <wtf/CrossThreadRefCounted.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+#ifndef NDEBUG
+static const size_t refCountedExtraDebugSize = sizeof(int);
+#else
+static const size_t refCountedExtraDebugSize = 0;
+#endif
+
+COMPILE_ASSERT(sizeof(OwnPtr<int>) == sizeof(int*), OwnPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), PassRefPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(int) + refCountedExtraDebugSize, RefCounted_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCountedCustomAllocated<int>) == sizeof(int) + refCountedExtraDebugSize, RefCountedCustomAllocated_should_stay_small);
+COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(Vector<int>) == 3 * sizeof(int*), Vector_should_stay_small);
+
+}
diff --git a/JavaScriptCore/wtf/StringExtras.h b/JavaScriptCore/wtf/StringExtras.h
index 28e80b8..323de6a 100644
--- a/JavaScriptCore/wtf/StringExtras.h
+++ b/JavaScriptCore/wtf/StringExtras.h
@@ -86,7 +86,7 @@ inline int strcasecmp(const char* s1, const char* s2)
#endif
-#if OS(WINDOWS) || OS(LINUX) || OS(SOLARIS)
+#if COMPILER(MSVC) || OS(WINDOWS) || OS(LINUX) || OS(SOLARIS)
// FIXME: should check HAVE_STRNSTR
inline char* strnstr(const char* buffer, const char* target, size_t bufferLength)
diff --git a/JavaScriptCore/wtf/text/StringImpl.cpp b/JavaScriptCore/wtf/text/StringImpl.cpp
index 68ff456..3606597 100644
--- a/JavaScriptCore/wtf/text/StringImpl.cpp
+++ b/JavaScriptCore/wtf/text/StringImpl.cpp
@@ -38,6 +38,8 @@ namespace WebCore {
static const unsigned minLengthToShare = 20;
+COMPILE_ASSERT(sizeof(StringImpl) == 2 * sizeof(int) + 3 * sizeof(void*), StringImpl_should_stay_small);
+
StringImpl::~StringImpl()
{
ASSERT(!isStatic());
diff --git a/JavaScriptCore/yarr/RegexInterpreter.cpp b/JavaScriptCore/yarr/RegexInterpreter.cpp
index c2cb1c2..34ccc00 100644
--- a/JavaScriptCore/yarr/RegexInterpreter.cpp
+++ b/JavaScriptCore/yarr/RegexInterpreter.cpp
@@ -674,7 +674,7 @@ public:
backTrack->inParentheses = 1;
if (term.capture()) {
unsigned subpatternId = term.atom.subpatternId;
- output[(subpatternId << 1) + 1] = input.getPos() + term.inputPosition;
+ output[subpatternId << 1] = input.getPos() + term.inputPosition;
}
context->term -= term.atom.parenthesesWidth;
return true;
diff --git a/JavaScriptGlue/Configurations/Version.xcconfig b/JavaScriptGlue/Configurations/Version.xcconfig
index daa79a9..6f999af 100644
--- a/JavaScriptGlue/Configurations/Version.xcconfig
+++ b/JavaScriptGlue/Configurations/Version.xcconfig
@@ -22,7 +22,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MAJOR_VERSION = 534;
-MINOR_VERSION = 0;
+MINOR_VERSION = 1;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/LayoutTests/fast/dom/Geolocation/argument-types.html b/LayoutTests/fast/dom/Geolocation/argument-types.html
index f6b0ad4..feefcd3 100644
--- a/LayoutTests/fast/dom/Geolocation/argument-types.html
+++ b/LayoutTests/fast/dom/Geolocation/argument-types.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/argument-types.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/argument-types.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt b/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt
index ca77390..17ab503 100644
--- a/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt
@@ -4,10 +4,10 @@ Tests that when an exception is thrown in the success callback, the error callba
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/callback-exception.html b/LayoutTests/fast/dom/Geolocation/callback-exception.html
index e5f9a7c..25155c9 100644
--- a/LayoutTests/fast/dom/Geolocation/callback-exception.html
+++ b/LayoutTests/fast/dom/Geolocation/callback-exception.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/callback-exception.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/callback-exception.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/enabled.html b/LayoutTests/fast/dom/Geolocation/enabled.html
index bd6381a..e08bcb7 100644
--- a/LayoutTests/fast/dom/Geolocation/enabled.html
+++ b/LayoutTests/fast/dom/Geolocation/enabled.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/enabled.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/enabled.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/error-expected.txt b/LayoutTests/fast/dom/Geolocation/error-expected.txt
index ea5d7d8..9582059 100644
--- a/LayoutTests/fast/dom/Geolocation/error-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/error-expected.txt
@@ -3,13 +3,13 @@ Tests Geolocation error callback using the mock service.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is mockCode
PASS error.message is mockMessage
PASS error.UNKNOWN_ERROR is undefined
PASS error.PERMISSION_DENIED is 1
PASS error.POSITION_UNAVAILABLE is 2
PASS error.TIMEOUT is 3
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/error.html b/LayoutTests/fast/dom/Geolocation/error.html
index 19718c7..1035d95 100644
--- a/LayoutTests/fast/dom/Geolocation/error.html
+++ b/LayoutTests/fast/dom/Geolocation/error.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/error.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/error.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt b/LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt
index 71b1980..344bd45 100644
--- a/LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/maximum-age-expected.txt
@@ -3,7 +3,6 @@ Tests that the PositionOptions.maximumAge parameter is correctly applied.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
@@ -19,6 +18,7 @@ PASS position.coords.accuracy is mockAccuracy
PASS error.code is mockCode
PASS error.message is mockMessage
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/maximum-age.html b/LayoutTests/fast/dom/Geolocation/maximum-age.html
index 2d871e0..1640193 100644
--- a/LayoutTests/fast/dom/Geolocation/maximum-age.html
+++ b/LayoutTests/fast/dom/Geolocation/maximum-age.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/maximum-age.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/maximum-age.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/notimer-after-unload-expected.txt b/LayoutTests/fast/dom/Geolocation/notimer-after-unload-expected.txt
new file mode 100644
index 0000000..4dbf1b5
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/notimer-after-unload-expected.txt
@@ -0,0 +1,3 @@
+main frame - has 1 onunload handler(s)
+ALERT: unload-called
+You should have seen one unload alert appear.
diff --git a/LayoutTests/fast/dom/Geolocation/notimer-after-unload.html b/LayoutTests/fast/dom/Geolocation/notimer-after-unload.html
new file mode 100644
index 0000000..ffcee5d
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/notimer-after-unload.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/notimer-after-unload.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/ongoing-request-leak-expected.txt b/LayoutTests/fast/dom/Geolocation/ongoing-request-leak-expected.txt
new file mode 100644
index 0000000..3fb979f
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/ongoing-request-leak-expected.txt
@@ -0,0 +1 @@
+Exercises a condition where the DOMWindow may leak if Geolocation requests are ongoing when the page is navigated away or closed. Complete.
diff --git a/LayoutTests/fast/dom/Geolocation/ongoing-request-leak.html b/LayoutTests/fast/dom/Geolocation/ongoing-request-leak.html
new file mode 100644
index 0000000..dab385e
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/ongoing-request-leak.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/ongoing-request-leak.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt
index 63195b2..9ff44ac 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt
@@ -3,12 +3,12 @@ Tests that when Geolocation permission has been denied prior to a call to watchP
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html
index 2db2637..4800a62 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/permission-denied-already-clear-watch.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/permission-denied-already-clear-watch.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt
index e013242..531e6d8 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt
@@ -3,12 +3,12 @@ Tests that when Geolocation permission has been denied prior to a call to a Geol
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html
index dc166c9..d6df9b5 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/permission-denied-already-error.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/permission-denied-already-error.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt
index f617a5f..55e95c5 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt
@@ -3,12 +3,12 @@ Tests that when Geolocation permission has been denied prior to a call to a Geol
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html
index 4b086a7..0db36ec 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/permission-denied-already-success.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/permission-denied-already-success.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt
index 680aa63..65496b7 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt
@@ -3,9 +3,9 @@ Tests Geolocation when permission is denied, using the mock service.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt
index d8f50ca..ef4c687 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt
@@ -3,9 +3,9 @@ Tests that when Geolocation permission is denied, watches are stopped, as well a
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is error.PERMISSION_DENIED
PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html
index 92f3a48..4f0f785 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/permission-denied-stops-watches.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/permission-denied-stops-watches.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied.html b/LayoutTests/fast/dom/Geolocation/permission-denied.html
index 6012079..bd38d20 100644
--- a/LayoutTests/fast/dom/Geolocation/permission-denied.html
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/permission-denied.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/permission-denied.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/position-string-expected.txt b/LayoutTests/fast/dom/Geolocation/position-string-expected.txt
index b042998..045f496 100644
--- a/LayoutTests/fast/dom/Geolocation/position-string-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/position-string-expected.txt
@@ -3,12 +3,12 @@ Tests formatting of position.toString().
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
PASS position.toString() is "[object Geoposition]"
PASS position.coords.toString() is "[object Coordinates]"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/position-string.html b/LayoutTests/fast/dom/Geolocation/position-string.html
index e75a4f5..b15cb38 100644
--- a/LayoutTests/fast/dom/Geolocation/position-string.html
+++ b/LayoutTests/fast/dom/Geolocation/position-string.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/position-string.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/position-string.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt b/LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt
index 7420919..993beac 100644
--- a/LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt
@@ -3,12 +3,12 @@ Tests that reentrant calls to Geolocation methods from the error callback are OK
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is mockCode
PASS error.message is mockMessage
PASS error.code is mockCode
PASS error.message is mockMessage
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-error.html b/LayoutTests/fast/dom/Geolocation/reentrant-error.html
index f3300af..ea00371 100644
--- a/LayoutTests/fast/dom/Geolocation/reentrant-error.html
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-error.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/reentrant-error.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/reentrant-error.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt b/LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt
index ad63fa3..d85f161 100644
--- a/LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt
@@ -3,7 +3,6 @@ Tests that reentrant calls to Geolocation methods from the success callback are
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
@@ -11,6 +10,7 @@ PASS position.coords.accuracy is mockAccuracy
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-success.html b/LayoutTests/fast/dom/Geolocation/reentrant-success.html
index f09cf28..d69cf85 100644
--- a/LayoutTests/fast/dom/Geolocation/reentrant-success.html
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-success.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/reentrant-success.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/reentrant-success.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/js-test-post.js b/LayoutTests/fast/dom/Geolocation/resources/js-test-post.js
deleted file mode 100644
index 558f149..0000000
--- a/LayoutTests/fast/dom/Geolocation/resources/js-test-post.js
+++ /dev/null
@@ -1,4 +0,0 @@
-shouldBeTrue("successfullyParsed");
-if (!isAsynchronous) {
- debug('<br /><span class="pass">TEST COMPLETE</span>');
-}
diff --git a/LayoutTests/fast/dom/Geolocation/resources/TEMPLATE.html b/LayoutTests/fast/dom/Geolocation/script-tests/TEMPLATE.html
index fcb8be1..1951c43 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/TEMPLATE.html
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/TEMPLATE.html
@@ -8,6 +8,6 @@
<p id="description"></p>
<div id="console"></div>
<script src="YOUR_JS_FILE_HERE"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/argument-types.js b/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js
index 956e3d6..2b559d8 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/argument-types.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js
@@ -114,6 +114,6 @@ test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou
test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:-Infinity})', false);
test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:"string"})', false);
-var isAsynchronous = false;
-var successfullyParsed = true;
+window.jsTestIsAsync = false;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/callback-exception.js b/LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js
index d5cd682..7a86648 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/callback-exception.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js
@@ -18,19 +18,14 @@ navigator.geolocation.getCurrentPosition(function(p) {
// Yield to allow for the error callback to be invoked. The timer
// must be started before the exception is thrown.
- window.setTimeout(completeTest, 0);
+ window.setTimeout(finishJSTest, 0);
throw new Error('Exception in success callback');
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
-function completeTest()
-{
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
-}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/enabled.js b/LayoutTests/fast/dom/Geolocation/script-tests/enabled.js
index 4e99984..6cb7bad 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/enabled.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/enabled.js
@@ -14,5 +14,5 @@ shouldBeTrue("hasGeolocationProperty()");
shouldBeTrue("'geolocation' in navigator");
shouldBeTrue("navigator.hasOwnProperty('geolocation')");
-var isAsynchronous = false;
-var successfullyParsed = true;
+window.jsTestIsAsync = false;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/error.js b/LayoutTests/fast/dom/Geolocation/script-tests/error.js
index c76570b..4c818ca 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/error.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/error.js
@@ -8,8 +8,7 @@ window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
var error;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'mockCode');
@@ -18,10 +17,9 @@ navigator.geolocation.getCurrentPosition(function(p) {
shouldBe('error.PERMISSION_DENIED', '1');
shouldBe('error.POSITION_UNAVAILABLE', '2');
shouldBe('error.TIMEOUT', '3');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/maximum-age.js b/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js
index f48aa0d..207fb64 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/maximum-age.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js
@@ -34,7 +34,7 @@ navigator.geolocation.getCurrentPosition(function(p) {
testZeroMaximumAge();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
function testZeroMaximumAge() {
@@ -46,7 +46,7 @@ function testZeroMaximumAge() {
testNonZeroMaximumAge();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
}
@@ -59,7 +59,7 @@ function testNonZeroMaximumAge() {
testZeroMaximumAgeError();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, {maximumAge: 1000});
}
@@ -67,15 +67,14 @@ function testZeroMaximumAgeError() {
// The default maximumAge is zero, so we expect the error from the service.
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
checkError(e);
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js b/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js
new file mode 100644
index 0000000..278e027
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js
@@ -0,0 +1,21 @@
+description("Tests that no timers will trigger for navigator.geolocation object after onunload.");
+
+if (window.layoutTestController) layoutTestController.setGeolocationPermission(true);
+
+document.body.onload = function() {
+ location = "data:text/html,You should have seen one unload alert appear.<script>window.setTimeout('if (window.layoutTestController) layoutTestController.notifyDone();', 100);</" + "script>";
+}
+
+document.body.onunload = function() {
+ navigator.geolocation.getCurrentPosition(
+ function(p) {alert('FAIL: Unexpected Geolocation success callback.');},
+ function(e) {alert('FAIL: Unexpected Geolocation error callback.' + e.code + e.message);},
+ {timeout: 0, maximumAge:0}
+ );
+ alert("unload-called");
+}
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
+
+if (window.layoutTestController) layoutTestController.waitUntilDone();
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/ongoing-request-leak.js b/LayoutTests/fast/dom/Geolocation/script-tests/ongoing-request-leak.js
new file mode 100644
index 0000000..08e6b21
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/ongoing-request-leak.js
@@ -0,0 +1,13 @@
+description("Exercises a condition where the DOMWindow may leak if Geolocation requests are ongoing when the page is navigated away or closed. The page should reoload.");
+
+if (window.layoutTestController) layoutTestController.setGeolocationPermission(true);
+if (window.layoutTestController) layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
+
+navigator.geolocation.watchPosition(function() {}, null);
+
+document.body.onload = function() {
+ location = "data:text/html,Exercises a condition where the DOMWindow may leak if Geolocation requests are ongoing when the page is navigated away or closed. Complete.<script>if (window.layoutTestController) layoutTestController.notifyDone();</" + "script>";
+}
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js
index 1e980a5..410f042 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js
@@ -7,7 +7,7 @@ window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
var error;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.PERMISSION_DENIED');
@@ -21,22 +21,17 @@ function continueTest()
// Make another request, with permission already denied.
var watchId = navigator.geolocation.watchPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.PERMISSION_DENIED');
shouldBe('error.message', '"User denied Geolocation"');
navigator.geolocation.clearWatch(watchId);
- window.setTimeout(completeTest, 0);
+ window.setTimeout(finishJSTest, 0);
});
}
-function completeTest()
-{
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
-}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-error.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js
index 77c8259..9cea5ba 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-error.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js
@@ -7,7 +7,7 @@ window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
var error;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.PERMISSION_DENIED');
@@ -23,16 +23,15 @@ function continueTest()
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.PERMISSION_DENIED');
shouldBe('error.message', '"User denied Geolocation"');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-success.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js
index 966c64d..fdc74e6 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-success.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js
@@ -7,7 +7,7 @@ window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
var error;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.PERMISSION_DENIED');
@@ -21,16 +21,15 @@ function continueTest()
// Make another request, with permission already denied.
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.PERMISSION_DENIED');
shouldBe('error.message', '"User denied Geolocation"');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-stops-watches.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js
index 89e5004..244deda 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-stops-watches.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js
@@ -9,11 +9,11 @@ var error;
var errorCallbackInvoked = false;
navigator.geolocation.watchPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
if (errorCallbackInvoked) {
testFailed('Error callback invoked unexpectedly : ' + error.message);
- window.layoutTestController.notifyDone();
+ finishJSTest();
}
errorCallbackInvoked = true;
@@ -24,15 +24,10 @@ navigator.geolocation.watchPosition(function(p) {
// Update the mock Geolocation service to report a new position, then
// yield to allow a chance for the success callback to be invoked.
window.layoutTestController.setMockGeolocationPosition(55.478, -0.166, 100);
- window.setTimeout(completeTest, 0);
+ window.setTimeout(finishJSTest, 0);
});
-function completeTest()
-{
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
-}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js
index 1915469..aafcaf1 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/permission-denied.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js
@@ -6,15 +6,14 @@ window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
var error;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.PERMISSION_DENIED');
shouldBe('error.message', '"User denied Geolocation"');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/position-string.js b/LayoutTests/fast/dom/Geolocation/script-tests/position-string.js
index 6365fca..d4931ee 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/position-string.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/position-string.js
@@ -18,13 +18,12 @@ navigator.geolocation.getCurrentPosition(function(p) {
shouldBe('position.coords.accuracy', 'mockAccuracy');
shouldBe('position.toString()', '"[object Geoposition]"');
shouldBe('position.coords.toString()', '"[object Coordinates]"');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/reentrant-error.js b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js
index 32858bf..e3361de 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/reentrant-error.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js
@@ -9,11 +9,11 @@ var error;
var errorCallbackInvoked = false;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
if (errorCallbackInvoked) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}
errorCallbackInvoked = true;
@@ -32,16 +32,15 @@ function continueTest() {
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e;
shouldBe('error.code', 'mockCode');
shouldBe('error.message', 'mockMessage');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/reentrant-success.js b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js
index 12dfe39..4b83ea7 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/reentrant-success.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js
@@ -14,7 +14,7 @@ var successCallbackInvoked = false;
navigator.geolocation.getCurrentPosition(function(p) {
if (successCallbackInvoked) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}
successCallbackInvoked = true;
@@ -26,7 +26,7 @@ navigator.geolocation.getCurrentPosition(function(p) {
continueTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
function continueTest() {
@@ -39,14 +39,13 @@ function continueTest() {
shouldBe('position.coords.latitude', 'mockLatitude');
shouldBe('position.coords.longitude', 'mockLongitude');
shouldBe('position.coords.accuracy', 'mockAccuracy');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/success.js b/LayoutTests/fast/dom/Geolocation/script-tests/success.js
index c5f566f..acb6b8d 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/success.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/success.js
@@ -15,13 +15,12 @@ navigator.geolocation.getCurrentPosition(function(p) {
shouldBe('position.coords.latitude', 'mockLatitude');
shouldBe('position.coords.longitude', 'mockLongitude');
shouldBe('position.coords.accuracy', 'mockAccuracy');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
});
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js
index e9d247a..63e0569 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js
@@ -5,23 +5,18 @@ window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
var error;
var watchId = navigator.geolocation.watchPosition(function() {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.TIMEOUT');
shouldBe('error.message', '"Timeout expired"');
navigator.geolocation.clearWatch(watchId);
- window.setTimeout(completeTest, 0);
+ window.setTimeout(finishJSTest, 0);
}, {
timeout: 0
});
-function completeTest()
-{
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
-}
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/timeout-zero.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js
index 8a930d9..9867084 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/timeout-zero.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js
@@ -5,17 +5,16 @@ layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
var error;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
error = e
shouldBe('error.code', 'error.TIMEOUT');
shouldBe('error.message', '"Timeout expired"');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, {
timeout: 0
});
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/timeout.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js
index d4fa1a7..49cab29 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/timeout.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js
@@ -15,15 +15,14 @@ navigator.geolocation.getCurrentPosition(function(p) {
shouldBe('position.coords.latitude', 'mockLatitude');
shouldBe('position.coords.longitude', 'mockLongitude');
shouldBe('position.coords.accuracy', 'mockAccuracy');
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}, {
timeout: 1000
});
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/watch.js b/LayoutTests/fast/dom/Geolocation/script-tests/watch.js
index dbf4272..8249f2e 100644
--- a/LayoutTests/fast/dom/Geolocation/resources/watch.js
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/watch.js
@@ -41,12 +41,11 @@ navigator.geolocation.watchPosition(function(p) {
break;
case 3:
checkPosition(p);
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- window.layoutTestController.notifyDone();
+ finishJSTest();
break;
default:
testFailed('Success callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}
}, function(e) {
switch (state++) {
@@ -56,10 +55,10 @@ navigator.geolocation.watchPosition(function(p) {
break;
default:
testFailed('Error callback invoked unexpectedly');
- window.layoutTestController.notifyDone();
+ finishJSTest();
}
});
window.layoutTestController.waitUntilDone();
-var isAsynchronous = true;
-var successfullyParsed = true;
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/success-expected.txt b/LayoutTests/fast/dom/Geolocation/success-expected.txt
index a063801..7511597 100644
--- a/LayoutTests/fast/dom/Geolocation/success-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/success-expected.txt
@@ -3,10 +3,10 @@ Tests Geolocation success callback using the mock service.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/success.html b/LayoutTests/fast/dom/Geolocation/success.html
index ecd7a25..563f009 100644
--- a/LayoutTests/fast/dom/Geolocation/success.html
+++ b/LayoutTests/fast/dom/Geolocation/success.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/success.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/success.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt
index e97fccd..5005b39 100644
--- a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt
@@ -3,9 +3,9 @@ Tests that when a watch times out and is cleared from the error callback, there
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is error.TIMEOUT
PASS error.message is "Timeout expired"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html
index 45c7735..b5508a0 100644
--- a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html
+++ b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/timeout-clear-watch.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/timeout-clear-watch.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-expected.txt b/LayoutTests/fast/dom/Geolocation/timeout-expected.txt
index c673cd2..cd55796 100644
--- a/LayoutTests/fast/dom/Geolocation/timeout-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/timeout-expected.txt
@@ -3,10 +3,10 @@ Tests that when timeout is non-zero, the success callback is called as expected.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt b/LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt
index f083301..526f274 100644
--- a/LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt
@@ -3,9 +3,9 @@ Tests that when timeout is zero (and maximumAge is too), the error callback is c
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS error.code is error.TIMEOUT
PASS error.message is "Timeout expired"
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-zero.html b/LayoutTests/fast/dom/Geolocation/timeout-zero.html
index 955398e..c0a2c5b 100644
--- a/LayoutTests/fast/dom/Geolocation/timeout-zero.html
+++ b/LayoutTests/fast/dom/Geolocation/timeout-zero.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/timeout-zero.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/timeout-zero.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/timeout.html b/LayoutTests/fast/dom/Geolocation/timeout.html
index f8eaafe..601b299 100644
--- a/LayoutTests/fast/dom/Geolocation/timeout.html
+++ b/LayoutTests/fast/dom/Geolocation/timeout.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/timeout.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/timeout.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/dom/Geolocation/watch-expected.txt b/LayoutTests/fast/dom/Geolocation/watch-expected.txt
index 0f923dc..a043455 100644
--- a/LayoutTests/fast/dom/Geolocation/watch-expected.txt
+++ b/LayoutTests/fast/dom/Geolocation/watch-expected.txt
@@ -3,7 +3,6 @@ Tests that watchPosition correctly reports position updates and errors from the
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS successfullyParsed is true
PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
@@ -19,6 +18,7 @@ PASS position.coords.latitude is mockLatitude
PASS position.coords.longitude is mockLongitude
PASS position.coords.accuracy is mockAccuracy
+PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Geolocation/watch.html b/LayoutTests/fast/dom/Geolocation/watch.html
index 6568883..bf0b120 100644
--- a/LayoutTests/fast/dom/Geolocation/watch.html
+++ b/LayoutTests/fast/dom/Geolocation/watch.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="resources/watch.js"></script>
-<script src="resources/js-test-post.js"></script>
+<script src="script-tests/watch.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk
index 42523a5..fa11703 100644
--- a/WebCore/Android.derived.jscbindings.mk
+++ b/WebCore/Android.derived.jscbindings.mk
@@ -49,7 +49,11 @@ js_binding_scripts := $(addprefix $(LOCAL_PATH)/,\
bindings/scripts/generate-bindings.pl \
)
+<<<<<<< HEAD
FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_GEOLOCATION=1 ENABLE_CONNECTION=1 ENABLE_APPLICATION_INSTALLED=1 ENABLE_XPATH=1 ENABLE_XSLT=1
+=======
+FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 ENABLE_CHANNEL_MESSAGING=1 ENABLE_DEVICE_ORIENTATION=1
+>>>>>>> webkit.org at r60074
# CSS
GEN := \
@@ -104,6 +108,8 @@ GEN := \
$(intermediates)/dom/JSCompositionEvent.h \
$(intermediates)/dom/JSDOMCoreException.h \
$(intermediates)/dom/JSDOMImplementation.h \
+ $(intermediates)/dom/JSDOMStringList.h \
+ $(intermediates)/dom/JSDeviceOrientationEvent.h \
$(intermediates)/dom/JSDocument.h \
$(intermediates)/dom/JSDocumentFragment.h \
$(intermediates)/dom/JSDocumentType.h \
diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk
index e66e55b..81f9f4d 100644
--- a/WebCore/Android.derived.v8bindings.mk
+++ b/WebCore/Android.derived.v8bindings.mk
@@ -30,8 +30,12 @@ js_binding_scripts := \
$(LOCAL_PATH)/bindings/scripts/IDLStructure.pm \
$(LOCAL_PATH)/bindings/scripts/generate-bindings.pl
+<<<<<<< HEAD
# Add ACCELERATED_COMPOSITING=1 and ENABLE_3D_RENDERING=1 for layers support
FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_GEOLOCATION=1 ENABLE_CONNECTION=1 ENABLE_APPLICATION_INSTALLED=1 ENABLE_XPATH=1 ENABLE_XSLT=1
+=======
+FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 ENABLE_DEVICE_ORIENTATION=1
+>>>>>>> webkit.org at r60074
FEATURE_DEFINES += V8_BINDING
# CSS
@@ -87,6 +91,8 @@ GEN := \
$(intermediates)/bindings/V8CustomEvent.h \
$(intermediates)/bindings/V8DOMCoreException.h \
$(intermediates)/bindings/V8DOMImplementation.h \
+ $(intermediates)/bindings/V8DOMStringList.h \
+ $(intermediates)/bindings/V8DeviceOrientationEvent.h \
$(intermediates)/bindings/V8Document.h \
$(intermediates)/bindings/V8DocumentFragment.h \
$(intermediates)/bindings/V8DocumentType.h \
diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index 7a44e51..79b88e6 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -122,6 +122,7 @@ LOCAL_SRC_FILES += \
bindings/js/JSImageDataCustom.cpp \
bindings/js/JSLazyEventListener.cpp \
bindings/js/JSLocationCustom.cpp \
+ bindings/js/JSMainThreadExecState.cpp \
bindings/js/JSMessageChannelConstructor.cpp \
bindings/js/JSMessageChannelCustom.cpp \
bindings/js/JSMessageEventCustom.cpp \
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index b78631d..6f367ea 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -117,6 +117,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
dom/ContainerNode.cpp \
dom/CustomEvent.cpp \
dom/DOMImplementation.cpp \
+ dom/DOMStringList.cpp \
dom/Document.cpp \
dom/DocumentFragment.cpp \
dom/DocumentType.cpp \
@@ -133,7 +134,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
dom/ExceptionCode.cpp \
dom/InputElement.cpp \
dom/KeyboardEvent.cpp \
- dom/MappedAttribute.cpp \
dom/MessageChannel.cpp \
dom/MessageEvent.cpp \
dom/MessagePort.cpp \
@@ -142,8 +142,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
dom/MouseRelatedEvent.cpp \
dom/MutationEvent.cpp \
dom/NameNodeList.cpp \
- dom/NamedAttrMap.cpp \
- dom/NamedMappedAttrMap.cpp \
+ dom/NamedNodeMap.cpp \
dom/Node.cpp \
dom/NodeFilter.cpp \
dom/NodeFilterCondition.cpp \
@@ -151,6 +150,8 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
dom/Notation.cpp \
dom/OptionElement.cpp \
dom/OptionGroupElement.cpp \
+ dom/DeviceOrientation.cpp \
+ dom/DeviceOrientationEvent.cpp \
dom/OverflowEvent.cpp \
dom/PageTransitionEvent.cpp \
dom/PopStateEvent.cpp \
@@ -253,6 +254,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
html/FileList.cpp \
html/FileReader.cpp \
html/FormDataList.cpp \
+ html/HTML5Lexer.cpp \
+ html/HTML5Tokenizer.cpp \
+ html/HTML5TreeBuilder.cpp \
html/HTMLAllCollection.cpp \
html/HTMLCollection.cpp \
html/HTMLDataListElement.cpp \
diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk
index 15d7d6e..6a20987 100644
--- a/WebCore/Android.v8bindings.mk
+++ b/WebCore/Android.v8bindings.mk
@@ -97,7 +97,6 @@ LOCAL_SRC_FILES += \
\
bindings/v8/npruntime.cpp \
\
- bindings/v8/custom/V8AttrCustom.cpp \
bindings/v8/custom/V8CSSRuleCustom.cpp \
bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp \
bindings/v8/custom/V8CSSStyleSheetCustom.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 1a3220f..b17ce27 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -139,6 +139,8 @@ SET(WebCore_IDL_FILES
dom/CustomEvent.idl
dom/DOMCoreException.idl
dom/DOMImplementation.idl
+ dom/DOMStringList.idl
+ dom/DeviceOrientationEvent.idl
dom/Document.idl
dom/DocumentFragment.idl
dom/DocumentType.idl
@@ -232,6 +234,7 @@ SET(WebCore_IDL_FILES
html/HTMLMediaElement.idl
html/HTMLMenuElement.idl
html/HTMLMetaElement.idl
+ html/HTMLMeterElement.idl
html/HTMLModElement.idl
html/HTMLOListElement.idl
html/HTMLObjectElement.idl
@@ -267,16 +270,17 @@ SET(WebCore_IDL_FILES
html/canvas/CanvasPattern.idl
html/canvas/CanvasRenderingContext.idl
html/canvas/CanvasRenderingContext2D.idl
- html/canvas/WebGLArray.idl
- html/canvas/WebGLArrayBuffer.idl
- html/canvas/WebGLByteArray.idl
- html/canvas/WebGLFloatArray.idl
- html/canvas/WebGLIntArray.idl
html/canvas/WebGLRenderingContext.idl
- html/canvas/WebGLShortArray.idl
- html/canvas/WebGLUnsignedByteArray.idl
- html/canvas/WebGLUnsignedIntArray.idl
- html/canvas/WebGLUnsignedShortArray.idl
+
+ html/canvas/ArrayBuffer.idl
+ html/canvas/ArrayBufferView.idl
+ html/canvas/FloatArray.idl
+ html/canvas/Int16Array.idl
+ html/canvas/Int32Array.idl
+ html/canvas/Int8Array.idl
+ html/canvas/Uint16Array.idl
+ html/canvas/Uint32Array.idl
+ html/canvas/Uint8Array.idl
inspector/InjectedScriptHost.idl
inspector/InspectorBackend.idl
@@ -314,11 +318,18 @@ SET(WebCore_IDL_FILES
storage/Database.idl
storage/DatabaseCallback.idl
storage/DatabaseSync.idl
+ storage/IDBAny.idl
+ storage/IDBDatabaseError.idl
+ storage/IDBDatabaseException.idl
+ storage/IDBDatabaseRequest.idl
+ storage/IDBErrorEvent.idl
+ storage/IDBEvent.idl
+ storage/IDBRequest.idl
+ storage/IDBSuccessEvent.idl
+ storage/IndexedDatabaseRequest.idl
storage/SQLError.idl
storage/SQLResultSet.idl
storage/SQLResultSetRowList.idl
- storage/Storage.idl
- storage/StorageEvent.idl
storage/SQLStatementCallback.idl
storage/SQLStatementErrorCallback.idl
storage/SQLTransaction.idl
@@ -326,6 +337,8 @@ SET(WebCore_IDL_FILES
storage/SQLTransactionErrorCallback.idl
storage/SQLTransactionSync.idl
storage/SQLTransactionSyncCallback.idl
+ storage/Storage.idl
+ storage/StorageEvent.idl
workers/AbstractWorker.idl
workers/DedicatedWorkerContext.idl
@@ -526,25 +539,32 @@ SET(WebCore_SOURCES
bindings/js/DOMObjectHashTableMap.cpp
bindings/js/DOMWrapperWorld.cpp
bindings/js/GCController.cpp
+ bindings/js/JavaScriptCallFrame.cpp
bindings/js/JSAttrCustom.cpp
- bindings/js/JSCDATASectionCustom.cpp
- bindings/js/JSCSSRuleCustom.cpp
- bindings/js/JSCSSRuleListCustom.cpp
- bindings/js/JSCSSStyleDeclarationCustom.cpp
- bindings/js/JSCSSValueCustom.cpp
bindings/js/JSCallbackData.cpp
bindings/js/JSCanvasRenderingContext2DCustom.cpp
bindings/js/JSCanvasRenderingContextCustom.cpp
+ bindings/js/JSCDATASectionCustom.cpp
bindings/js/JSClipboardCustom.cpp
bindings/js/JSConsoleCustom.cpp
bindings/js/JSCoordinatesCustom.cpp
+ bindings/js/JSCSSRuleCustom.cpp
+ bindings/js/JSCSSRuleListCustom.cpp
+ bindings/js/JSCSSStyleDeclarationCustom.cpp
+ bindings/js/JSCSSValueCustom.cpp
bindings/js/JSCustomPositionCallback.cpp
bindings/js/JSCustomPositionErrorCallback.cpp
bindings/js/JSCustomSQLStatementErrorCallback.cpp
- bindings/js/JSDatabaseCustom.cpp
- bindings/js/JSDatabaseSyncCustom.cpp
bindings/js/JSCustomVoidCallback.cpp
bindings/js/JSCustomXPathNSResolver.cpp
+ bindings/js/JSDatabaseCustom.cpp
+ bindings/js/JSDatabaseCustom.cpp
+ bindings/js/JSDatabaseSyncCustom.cpp
+ bindings/js/JSDataGridColumnListCustom.cpp
+ bindings/js/JSDataGridDataSource.cpp
+ bindings/js/JSDebugWrapperSet.cpp
+ bindings/js/JSDedicatedWorkerContextCustom.cpp
+ bindings/js/JSDocumentCustom.cpp
bindings/js/JSDOMApplicationCacheCustom.cpp
bindings/js/JSDOMBinding.cpp
bindings/js/JSDOMFormDataCustom.cpp
@@ -553,12 +573,6 @@ SET(WebCore_SOURCES
bindings/js/JSDOMWindowCustom.cpp
bindings/js/JSDOMWindowShell.cpp
bindings/js/JSDOMWrapper.cpp
- bindings/js/JSDataGridColumnListCustom.cpp
- bindings/js/JSDataGridDataSource.cpp
- bindings/js/JSDatabaseCustom.cpp
- bindings/js/JSDebugWrapperSet.cpp
- bindings/js/JSDedicatedWorkerContextCustom.cpp
- bindings/js/JSDocumentCustom.cpp
bindings/js/JSElementCustom.cpp
bindings/js/JSEventCustom.cpp
bindings/js/JSEventListener.cpp
@@ -566,6 +580,7 @@ SET(WebCore_SOURCES
bindings/js/JSEventTarget.cpp
bindings/js/JSExceptionBase.cpp
bindings/js/JSGeolocationCustom.cpp
+ bindings/js/JSHistoryCustom.cpp
bindings/js/JSHTMLAllCollectionCustom.cpp
bindings/js/JSHTMLAppletElementCustom.cpp
bindings/js/JSHTMLCanvasElementCustom.cpp
@@ -582,7 +597,6 @@ SET(WebCore_SOURCES
bindings/js/JSHTMLObjectElementCustom.cpp
bindings/js/JSHTMLOptionsCollectionCustom.cpp
bindings/js/JSHTMLSelectElementCustom.cpp
- bindings/js/JSHistoryCustom.cpp
bindings/js/JSImageConstructor.cpp
bindings/js/JSImageDataCustom.cpp
bindings/js/JSInjectedScriptHostCustom.cpp
@@ -590,6 +604,7 @@ SET(WebCore_SOURCES
bindings/js/JSJavaScriptCallFrameCustom.cpp
bindings/js/JSLazyEventListener.cpp
bindings/js/JSLocationCustom.cpp
+ bindings/js/JSMainThreadExecState.cpp
bindings/js/JSMessageChannelConstructor.cpp
bindings/js/JSMessageChannelCustom.cpp
bindings/js/JSMessageEventCustom.cpp
@@ -607,12 +622,12 @@ SET(WebCore_SOURCES
bindings/js/JSPluginCustom.cpp
bindings/js/JSPluginElementFunctions.cpp
bindings/js/JSPopStateEventCustom.cpp
- bindings/js/JSSQLResultSetRowListCustom.cpp
- bindings/js/JSSQLTransactionCustom.cpp
- bindings/js/JSSQLTransactionSyncCustom.cpp
bindings/js/JSScriptProfileNodeCustom.cpp
bindings/js/JSSharedWorkerConstructor.cpp
bindings/js/JSSharedWorkerCustom.cpp
+ bindings/js/JSSQLResultSetRowListCustom.cpp
+ bindings/js/JSSQLTransactionCustom.cpp
+ bindings/js/JSSQLTransactionSyncCustom.cpp
bindings/js/JSStorageCustom.cpp
bindings/js/JSStyleSheetCustom.cpp
bindings/js/JSStyleSheetListCustom.cpp
@@ -630,7 +645,6 @@ SET(WebCore_SOURCES
bindings/js/JSXMLHttpRequestUploadCustom.cpp
bindings/js/JSXSLTProcessorConstructor.cpp
bindings/js/JSXSLTProcessorCustom.cpp
- bindings/js/JavaScriptCallFrame.cpp
bindings/js/ScheduledAction.cpp
bindings/js/ScriptArray.cpp
bindings/js/ScriptCachedFrameData.cpp
@@ -641,6 +655,7 @@ SET(WebCore_SOURCES
bindings/js/ScriptDebugServer.cpp
bindings/js/ScriptEventListener.cpp
bindings/js/ScriptFunctionCall.cpp
+ bindings/js/ScriptGCEvent.cpp
bindings/js/ScriptObject.cpp
bindings/js/ScriptProfiler.cpp
bindings/js/ScriptState.cpp
@@ -746,6 +761,9 @@ SET(WebCore_SOURCES
dom/ContainerNode.cpp
dom/CustomEvent.cpp
dom/DOMImplementation.cpp
+ dom/DOMStringList.cpp
+ dom/DeviceOrientation.cpp
+ dom/DeviceOrientationEvent.cpp
dom/Document.cpp
dom/DocumentFragment.cpp
dom/DocumentType.cpp
@@ -771,8 +789,7 @@ SET(WebCore_SOURCES
dom/MouseRelatedEvent.cpp
dom/MutationEvent.cpp
dom/NameNodeList.cpp
- dom/NamedAttrMap.cpp
- dom/NamedMappedAttrMap.cpp
+ dom/NamedNodeMap.cpp
dom/Node.cpp
dom/NodeFilter.cpp
dom/NodeFilterCondition.cpp
@@ -880,6 +897,9 @@ SET(WebCore_SOURCES
html/File.cpp
html/FileList.cpp
html/FormDataList.cpp
+ html/HTML5Lexer.cpp
+ html/HTML5Tokenizer.cpp
+ html/HTML5TreeBuilder.cpp
html/HTMLAllCollection.cpp
html/HTMLAnchorElement.cpp
html/HTMLAppletElement.cpp
@@ -930,6 +950,7 @@ SET(WebCore_SOURCES
html/HTMLMarqueeElement.cpp
html/HTMLMenuElement.cpp
html/HTMLMetaElement.cpp
+ html/HTMLMeterElement.cpp
html/HTMLModElement.cpp
html/HTMLNameCollection.cpp
html/HTMLOListElement.cpp
@@ -1024,6 +1045,7 @@ SET(WebCore_SOURCES
loader/Request.cpp
loader/ResourceLoadNotifier.cpp
loader/ResourceLoader.cpp
+ loader/SinkDocument.cpp
loader/SubresourceLoader.cpp
loader/TextDocument.cpp
loader/TextResourceDecoder.cpp
@@ -1267,6 +1289,7 @@ SET(WebCore_SOURCES
rendering/RenderListMarker.cpp
rendering/RenderMarquee.cpp
rendering/RenderMenuList.cpp
+ rendering/RenderMeter.cpp
rendering/RenderObject.cpp
rendering/RenderObjectChildList.cpp
rendering/RenderPart.cpp
@@ -1331,6 +1354,16 @@ SET(WebCore_SOURCES
storage/DatabaseTask.cpp
storage/DatabaseThread.cpp
storage/DatabaseTracker.cpp
+ storage/IDBAny.cpp
+ storage/IDBDatabase.cpp
+ storage/IDBDatabaseRequest.cpp
+ storage/IDBErrorEvent.cpp
+ storage/IDBEvent.cpp
+ storage/IDBRequest.cpp
+ storage/IDBSuccessEvent.cpp
+ storage/IndexedDatabase.cpp
+ storage/IndexedDatabaseImpl.cpp
+ storage/IndexedDatabaseRequest.cpp
storage/LocalStorageTask.cpp
storage/LocalStorageThread.cpp
storage/OriginQuotaManager.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e0a4f29..368c5d5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,4626 @@
+2010-05-24 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r60068.
+ http://trac.webkit.org/changeset/60068
+ https://bugs.webkit.org/show_bug.cgi?id=39600
+
+ "Causes fast/repaint/search-field-cancel to fail." (Requested
+ by jparent on #webkit).
+
+ * rendering/RenderObject.h:
+ (WebCore::objectIsRelayoutBoundary):
+
+2010-05-24 Jeremy Orlow <jorlow@chromium.org>
+
+ Unreviewed. Checked in merge error. :-(
+
+ * CMakeLists.txt:
+
+2010-05-24 Steve Block <steveblock@google.com>
+
+ Reviewed by Darin Adler.
+
+ Geolocation causes DOMWindow to leak if position requests are in progress when the page is navigated away
+ https://bugs.webkit.org/show_bug.cgi?id=39288
+
+ Test: fast/dom/Geolocation/ongoing-request-leak.html
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::stopLoading): Stop all Geolocation instances. This call is made after the unload event has fired, so no new Geolocation activity is possible.
+ * page/Geolocation.cpp:
+ (WebCore::Geolocation::stop): Removes all ongoing requests and stops the service.
+ (WebCore::Geolocation::disconnectFrame): Removed calls to stopUpdating() and stopTimers(), as this will already have been done in stop();
+ * page/Geolocation.h: Added stop() method.
+
+2010-05-24 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Kent Tamura.
+
+ Textarea shouldn't grow when you type.
+ https://bugs.webkit.org/show_bug.cgi?id=32077
+
+ <textarea> with percent-specified, height-related properties did
+ cause partial-layout rooted from the renderer, that resulted
+ different box height between full-layout and partial-layout. This
+ is because calcHeight() assumes that the layout calculation of the
+ RenderBlock's parent is ongoing. But this assumption is violated
+ when the RenderBlock is root of the layout calculation.
+
+ So we prevent such <textarea>'s RenderObjects from being layout
+ root.
+
+ Test: fast/forms/textarea-percentage-dimensions.html
+
+ * rendering/RenderObject.h:
+ (WebCore::objectIsRelayoutBoundary):
+
+2010-05-20 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add DOMStringList idl, needed for IndexedDB and for HTML5 drag & drop
+ https://bugs.webkit.org/show_bug.cgi?id=39429
+
+ IndexedDB depends on DOMStringList.
+ http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDatabase
+ It's currently specced here:
+ http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMStringList
+
+ Existing tests cover the constructor. IndexedDB will also use this
+ soon (and thus add test coverage).
+
+ * Android.mk:
+ * Android.derived.jscbindings.mk:
+ * Android.derived.v8bindings.mk:
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pri:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * dom/DOMStringList.h: Added.
+ (WebCore::DOMStringList::create):
+ (WebCore::DOMStringList::length):
+ (WebCore::DOMStringList::item):
+ (WebCore::DOMStringList::isEmpty):
+ (WebCore::DOMStringList::clear):
+ (WebCore::DOMStringList::append):
+ (WebCore::DOMStringList::DOMStringList):
+ * dom/DOMStringList.idl: Added.
+ * page/DOMWIndow.idl: Re-enabled constructor
+
+2010-05-23 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ 0x5C of EUC-JP is not Yen Sign but U+005C
+ https://bugs.webkit.org/show_bug.cgi?id=24906
+
+ Tests: editing/selection/find-yensign-and-backslash-with-japanese-fonts.html
+ fast/text/backslash-to-yen-sign-dynamic.html
+ fast/text/backslash-to-yen-sign.html
+
+ * GNUmakefile.am:
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.vcproj/WebCoreCommon.vsprops:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/Font.cpp:
+ (WebCore::Font::Font):
+ (WebCore::Font::operator=):
+ * platform/graphics/Font.h:
+ (WebCore::Font::needsTranscoding):
+ * platform/text/CharacterNames.h:
+ * platform/text/transcoder/FontTranscoder.cpp: Added.
+ (WebCore::FontTranscoder::FontTranscoder):
+ (WebCore::FontTranscoder::converterType):
+ (WebCore::FontTranscoder::convert):
+ (WebCore::FontTranscoder::needsTranscoding):
+ (WebCore::fontTranscoder):
+ * platform/text/transcoder/FontTranscoder.h: Added.
+ (WebCore::FontTranscoder::):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::updateNeedsTranscoding):
+ (WebCore::RenderText::styleDidChange):
+ (WebCore::RenderText::setTextInternal):
+
+2010-05-23 MORITA Hajime <morrita@google.com>
+
+ Unreviewed, rolling out r60060.
+ http://trac.webkit.org/changeset/60060
+ https://bugs.webkit.org/show_bug.cgi?id=32077
+
+ breaks chromium test
+
+ * rendering/RenderObject.h:
+ (WebCore::objectIsRelayoutBoundary):
+
+2010-05-23 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Style cleanup for r56288
+ https://bugs.webkit.org/show_bug.cgi?id=39554
+
+ Cleaning up style from a previous patch. No tests needed because no
+ logic is changed.
+
+ * svg/SVGFEMorphologyElement.cpp:
+ (WebCore::SVGFEMorphologyElement::build):
+
+2010-05-23 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Kent Tamura.
+
+ Textarea shouldn't grow when you type.
+ https://bugs.webkit.org/show_bug.cgi?id=32077
+
+ <textarea> with percent-specified, height-related properties did
+ cause partial-layout rooted from the renderer, that resulted
+ different box height between full-layout and partial-layout. This
+ is because calcHeight() assumes that the layout calculation of the
+ RenderBlock's parent is ongoing. But this assumption is violated
+ when the RenderBlock is root of the layout calculation.
+
+ So we prevent such <textarea>'s RenderObjects from being layout
+ root.
+
+ Test: fast/forms/textarea-percentage-dimensions.html
+
+ * rendering/RenderObject.h:
+ (WebCore::objectIsRelayoutBoundary):
+
+2010-05-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=39575
+ Make JS DOMObject inherit from JSObjectWithGlobalObject instead of JSObject
+
+ - Changes JSDOMWindowShell to inherit from JSObject instead of
+ DOMObject since it doesn't ever go into any DOMObject tables.
+ In a separate change, we may want to make this inherit from
+ JSObjectWithGlobalObject since JSDOMWindowShell does store a
+ global object pointer.
+ - Change DOMObject to inherit from JSObjectWithGlobalObject
+ instead of JSObject. In this change I am keeping around
+ DOMObjectWithGlobalPointer, which now just uses the capabilities
+ of JSObjectWithGlobalObject instead of implementing them
+ itself. DOMObjectWithGlobalPointer will go away in a subsequent
+ patch.
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::DOMObjectWithGlobalPointer::globalObject):
+ (WebCore::DOMObjectWithGlobalPointer::DOMObjectWithGlobalPointer):
+ * bindings/js/JSDOMWindowShell.h:
+ * bindings/js/JSDOMWrapper.h:
+ (WebCore::DOMObject::DOMObject):
+
+2010-05-23 Eric Seidel <eric@webkit.org>
+
+ Unreviewed, just being a copy/paste monkey. Oook, eeek.
+
+ Add new HTML5TreeBuilder class to hold the tree builder section of the HTML5 parsing spec
+ https://bugs.webkit.org/show_bug.cgi?id=39572
+
+ Add HTML5TreeBuilder.* to each of WebKit's 85,324 build systems.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+
+2010-05-23 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add new HTML5TreeBuilder class to hold the tree builder section of the HTML5 parsing spec
+ https://bugs.webkit.org/show_bug.cgi?id=39572
+
+ We've been working on the tokenization (lexing) section of the HTML5
+ spec until now and leaning on the old HTMLParser for tree building.
+ We need to start writing more of the tree building sections of the spec,
+ but to do that we need a place to put the new code.
+
+ This patch moves our old-to-new conversion hacks out of HTML5Tokenizer
+ (our Tokenizer.h implementation) and into HTML5TreeBuilder.
+ Follow-up patches will add new HTML5 tree building code to this file
+ and will allow us to switch between old and new parser/treebuilder
+ implementations.
+
+ No change in behavior, thus no new tests.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::HTML5Tokenizer::HTML5Tokenizer):
+ (WebCore::HTML5Tokenizer::write):
+ - Call the new HTML5TreeBuilder code.
+ * html/HTML5Tokenizer.h:
+ * html/HTML5TreeBuilder.cpp: Added.
+ * html/HTML5TreeBuilder.h: Added.
+
+2010-05-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=39574
+ Complete the merge of NamedMappedAttrMap into NamedNodeMap.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::canShareStyleWithElement):
+ (WebCore::CSSStyleSelector::styleForElement):
+ * dom/Element.cpp:
+ (WebCore::Element::createAttributeMap):
+ * dom/NamedMappedAttrMap.cpp: Removed.
+ * dom/NamedMappedAttrMap.h: Removed.
+ * dom/NamedNodeMap.cpp:
+ (WebCore::NamedNodeMap::setClass):
+ (WebCore::NamedNodeMap::declCount):
+ (WebCore::NamedNodeMap::mapsEquivalent):
+ (WebCore::NamedNodeMap::mappedMapsEquivalent):
+ * dom/NamedNodeMap.h:
+ (WebCore::NamedNodeMap::create):
+ (WebCore::NamedNodeMap::clearClass):
+ (WebCore::NamedNodeMap::classNames):
+ (WebCore::NamedNodeMap::hasMappedAttributes):
+ (WebCore::NamedNodeMap::declRemoved):
+ (WebCore::NamedNodeMap::declAdded):
+ (WebCore::NamedNodeMap::NamedNodeMap):
+ * dom/StyledElement.h:
+ (WebCore::StyledElement::mappedAttributes):
+ * html/HTML5Token.h:
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::convertToOldStyle):
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setInputType):
+ * html/HTMLParser.cpp:
+ (WebCore::HTMLParser::handleIsindex):
+ * html/HTMLTokenizer.cpp:
+ (WebCore::Token::addAttribute):
+ (WebCore::HTMLTokenizer::processToken):
+ * html/HTMLTokenizer.h:
+ * html/HTMLViewSourceDocument.cpp:
+ (WebCore::HTMLViewSourceDocument::createContainingTable):
+ (WebCore::HTMLViewSourceDocument::addSpanWithClassName):
+ (WebCore::HTMLViewSourceDocument::addLine):
+ (WebCore::HTMLViewSourceDocument::addLink):
+
+2010-05-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Teach HTML5 parser how to lex comments correctly
+ https://bugs.webkit.org/show_bug.cgi?id=39537
+
+ Implement the non-bogus comment states for the lexer. There's more
+ work to do in some of these states (e.g., to handle doctype tokens and
+ bogus comments), but I'm trying to keep the patches small.
+
+ Tests: comments01.dat
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::nextToken):
+ * html/HTML5Lexer.h:
+ * html/HTML5Token.h:
+ (WebCore::HTML5Token::beginComment):
+ (WebCore::HTML5Token::appendToComment):
+ (WebCore::HTML5Token::data):
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::convertToOldStyle):
+ * platform/text/SegmentedString.h:
+ (WebCore::SegmentedString::):
+ (WebCore::SegmentedString::peek):
+ - Occationally, the HTML5 parsing algorithm looks ahead in the
+ input stream. The implementation here is incomplete, but its
+ enough to run the current HTML5 parsing tests. I'll eventually
+ need to implement the slow case here.
+
+2010-05-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Make the html5lib parser tests run using the HTML5 parser
+ https://bugs.webkit.org/show_bug.cgi?id=39533
+
+ Turns out we're just one small tweak away from running the html5lib
+ tests. After this patch lands, we should be able to introduce tests
+ for every change to the HTML5 parser.
+
+ Test: html5lib/webkit-runner.html
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::nextToken):
+
+2010-05-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Make HTML5 parser parse <script>alert("<hi>");</script>
+ https://bugs.webkit.org/show_bug.cgi?id=39525
+
+ More progress towards getting the html5lib test harness running. We
+ need to parse script data in the ScriptDataState. The spec says the
+ parser should set the lexer's state to ScriptDataState, but we want to
+ keep using the existing parser for a while so I've added some temporary
+ logic to HTML5Tokenizer to set the state in the lexer.
+
+ To get this case running, I needed to flesh out a bunch of the
+ ScriptDataState logic. There's a bunch more to do, but this is a
+ start.
+
+ I'm not 100% happy with this patch, but it lets us execute a simplified
+ version of the test harness up to the point where it starts running the
+ first test.
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::nextToken):
+ (WebCore::HTML5Lexer::isAppropriateEndTag):
+ (WebCore::HTML5Lexer::emitCurrentTagToken):
+ * html/HTML5Lexer.h:
+ (WebCore::HTML5Lexer::setState):
+ * html/HTML5Token.h:
+ (WebCore::HTML5Token::beginEndTag):
+ (WebCore::HTML5Token::appendToCharacter):
+ (WebCore::HTML5Token::name):
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::HTML5Tokenizer::write):
+
+2010-05-23 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Limit the number of tiles created for large tiled layers
+ https://bugs.webkit.org/show_bug.cgi?id=39522
+
+ I added an algorithm to limit the number of tiles created to 512.
+ It tried to limit them in only one dimension and if that's not
+ possible it limits them in both dimensions according to the
+ ratio of width to height. This has the effect of rendering
+ tiles starting from the upper-left, which is often the part
+ that is visible. So it both prevents crashing and tried to do
+ the best job it can of displaying what the author intended.
+
+ The test LayoutTests/compositing/geometry/huge-layers.html was
+ crashing before this fix. Now it works correctly.
+
+ * platform/graphics/win/WebTiledLayer.cpp:
+ (WebCore::WebTiledLayer::WebTiledLayer):
+ (WebCore::WebTiledLayer::setBounds):
+ (WebCore::WebTiledLayer::constrainedSize):
+ (WebCore::WebTiledLayer::updateTiles):
+ * platform/graphics/win/WebTiledLayer.h:
+
+2010-05-23 Noam Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Using Accelerated Composing the rocket back animation on http://www.the-art-of-web.com/css/css-animation/ works differently as when not using AC.
+ https://bugs.webkit.org/show_bug.cgi?id=39513
+
+ The value of GraphicsLayer->transform() needs to be changed during the animation, regardless of m_fillsForward.
+ m_fillsForward should only apply at the end of the animation. Based on previous patch by Kenneth Christiansen.
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::TransformAnimationQt::applyFrame):
+ (WebCore::OpacityAnimationQt::applyFrame):
+
+2010-05-23 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] GraphicsLayerQt: Coding style and comment fixes.
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::MaskEffectQt::MaskEffectQt):
+ (WebCore::MaskEffectQt::draw):
+ (WebCore::GraphicsLayerQtImpl::ContentData::ContentData):
+ (WebCore::GraphicsLayerQtImpl::State::State):
+ (WebCore::GraphicsLayerQtImpl::GraphicsLayerQtImpl):
+ (WebCore::GraphicsLayerQtImpl::~GraphicsLayerQtImpl):
+ (WebCore::GraphicsLayerQtImpl::rootLayer):
+ (WebCore::GraphicsLayerQtImpl::recache):
+ (WebCore::GraphicsLayerQtImpl::updateTransform):
+ (WebCore::GraphicsLayerQtImpl::opaqueArea):
+ (WebCore::GraphicsLayerQtImpl::flushChanges):
+ (WebCore::GraphicsLayerQtImpl::notifyAnimationStarted):
+ (WebCore::GraphicsLayerQt::setNeedsDisplayInRect):
+ (WebCore::GraphicsLayerQt::setContentsToImage):
+ (WebCore::applyTimingFunction):
+ (WebCore::AnimationQtBase::updateState):
+ (WebCore::AnimationQt::AnimationQt):
+ (WebCore::AnimationQt::updateCurrentTime):
+ (WebCore::TransformAnimationQt::applyFrame):
+ (WebCore::TransformAnimationQt::updateState):
+ (WebCore::OpacityAnimationQt::OpacityAnimationQt):
+ (WebCore::OpacityAnimationQt::applyFrame):
+ (WebCore::GraphicsLayerQt::addAnimation):
+ (WebCore::GraphicsLayerQt::removeAnimationsForProperty):
+ (WebCore::GraphicsLayerQt::removeAnimationsForKeyframes):
+ (WebCore::GraphicsLayerQt::pauseAnimation):
+ (WebCore::GraphicsLayerQt::suspendAnimations):
+ (WebCore::GraphicsLayerQt::resumeAnimations):
+ * platform/graphics/qt/GraphicsLayerQt.h:
+
+2010-05-23 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Remove custom binding for Attr.value
+ https://bugs.webkit.org/show_bug.cgi?id=39499
+
+ Custom bindings are no longer needed because origin checks were moved
+ out of the bindings by: http://trac.webkit.org/changeset/59866
+
+ * Android.v8bindings.mk:
+ * WebCore.gypi:
+ * bindings/js/JSAttrCustom.cpp:
+ * bindings/v8/custom/V8AttrCustom.cpp: Removed.
+ * dom/Attr.idl:
+
+2010-05-23 Grace Kloba <klobag@gmail.com>
+
+ Reviewed by Nate Chapin.
+
+ Match the call of scheduleLocationChange() to its correct signature.
+ Fixes <http://webkit.org/b/39452>
+
+ The call of scheduleLocationChange() in generic and v8 bindings assuming the
+ fourth parameter is "usergesture". But it is actually the fifth parameter.
+
+ No new features. No new tests.
+
+ * bindings/generic/BindingDOMWindow.h:
+ (WebCore::::createWindow):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::V8DOMWindow::openCallback):
+
+2010-05-23 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Reduce copy/paste code in HTMLParser using some template functions
+ https://bugs.webkit.org/show_bug.cgi?id=39471
+
+ No functional changes, thus no tests.
+
+ * html/HTMLParser.cpp:
+ (WebCore::addTags):
+ - New function which takes a set an an array of QualifiedNames
+ and adds the localName().impl() to the set for each QualifiedName.
+ (WebCore::isTablePart):
+ (WebCore::isScopingTag):
+ (WebCore::mapTagToFunc):
+ (WebCore::mapTagsToFunc):
+ - New functions which take QualifiedNames and a function and map from the
+ localName().impl() to the function.
+ (WebCore::HTMLParser::getNode):
+ (WebCore::HTMLParser::isHeadingTag):
+ (WebCore::HTMLParser::isResidualStyleTag):
+ (WebCore::HTMLParser::isAffectedByResidualStyle):
+
+2010-05-22 Julie Parent <jparent@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ REGRESSION: xssAuditor tests failing in Chromium.
+ https://bugs.webkit.org/show_bug.cgi?id=39560
+
+ Follow up to r0014. Make if statement in V8 bindings match the one from jsc version.
+
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::evaluate):
+
+2010-05-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ REGRESSION(r59977): platform/mac/fast/AppleScript/001.html failure
+ https://bugs.webkit.org/show_bug.cgi?id=39531
+
+ Revert r59977 and r59943. These changes caused some exceptions to no longer be
+ reported in the inspector; I can't tell what they were originally trying to fix
+ so I am not sure how to fix them other than by reverting.
+
+ Covered by existing test platform/mac/fast/AppleScript/001.html, and
+ also added fast/dom/nested-script-exceptions.html to demonstrate the wider
+ consequences of the original change.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::ScriptController):
+ (WebCore::ScriptController::evaluateInWorld):
+ * bindings/js/ScriptController.h:
+
+2010-05-22 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add DragData
+ https://bugs.webkit.org/show_bug.cgi?id=39469
+
+ As BREW MP does not support dragging, add dummy implementation of DragData.
+
+ * platform/DragData.h:
+ * platform/brew/DragDataBrew.cpp: Added.
+ (WebCore::DragData::canSmartReplace):
+ (WebCore::DragData::containsColor):
+ (WebCore::DragData::containsPlainText):
+ (WebCore::DragData::asPlainText):
+ (WebCore::DragData::asColor):
+ (WebCore::DragData::createClipboard):
+ (WebCore::DragData::containsCompatibleContent):
+ (WebCore::DragData::containsURL):
+ (WebCore::DragData::asURL):
+ (WebCore::DragData::asFragment):
+ (WebCore::DragData::asFilenames):
+ (WebCore::DragData::containsFiles):
+
+2010-05-22 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add dummy Icon
+ https://bugs.webkit.org/show_bug.cgi?id=39468
+
+ Add dummy implementation of Icon.
+
+ * platform/graphics/brew/IconBrew.cpp: Added.
+ (WebCore::Icon::~Icon):
+ (WebCore::Icon::createIconForFiles):
+ (WebCore::Icon::paint):
+
+2010-05-22 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Remove and simplify custom bindings for Node
+ https://bugs.webkit.org/show_bug.cgi?id=39467
+
+ Custom bindings for nodeValue and textContent are no longer needed,
+ and child manipulators are simplified because origin checks were moved
+ out of the bindings by: http://trac.webkit.org/changeset/59866
+
+ * bindings/js/JSNodeCustom.cpp:
+ (WebCore::JSNode::insertBefore):
+ (WebCore::JSNode::replaceChild):
+ (WebCore::JSNode::removeChild):
+ (WebCore::JSNode::appendChild):
+ * bindings/v8/custom/V8NodeCustom.cpp:
+ (WebCore::V8Node::insertBeforeCallback):
+ (WebCore::V8Node::replaceChildCallback):
+ (WebCore::V8Node::removeChildCallback):
+ (WebCore::V8Node::appendChildCallback):
+ * dom/Node.idl:
+
+2010-05-22 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Remove custom bindings for NamedNodeMap.setNamedItem and .setNamedItemNS
+ https://bugs.webkit.org/show_bug.cgi?id=39462
+
+ Custom bindings are no longer needed because origin checks were moved
+ out of the bindings by: http://trac.webkit.org/changeset/59866
+
+ Behavior isn't changed and is covered by existing tests.
+
+ * bindings/js/JSNamedNodeMapCustom.cpp:
+ * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
+ * dom/NamedNodeMap.idl:
+
+2010-05-22 Daniel Bates <dbates@rim.com>
+
+ No review, rolling out 60017.
+ http://trac.webkit.org/changeset/60017
+ https://bugs.webkit.org/show_bug.cgi?id=39339
+
+ Rolling out since this broke the build on the Windows and Qt bots.
+ Need to look into this some more.
+
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/ScriptControllerBase.h: Removed.
+ * bindings/js/ScriptController.h:
+ (WebCore::):
+ * bindings/v8/ScriptController.h:
+ (WebCore::):
+
+2010-05-22 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Move enum ReasonForCallingCanExecuteScripts to header ScriptControllerBase.h
+ https://bugs.webkit.org/show_bug.cgi?id=39339
+
+ Moved the enum ReasonForCallingCanExecuteScripts and ShouldAllowXSS, which
+ was defined in both the JSC and V8 ScriptController.h file, into a shared
+ file called ScriptControllerBase.h.
+
+ No functionality was changed, so no new tests.
+
+ * GNUmakefile.am: Added file bindings/ScriptControllerBase.h.
+ * WebCore.gypi: Ditto.
+ * WebCore.pro: Ditto.
+ * WebCore.vcproj/WebCore.vcproj: Ditto.
+ * WebCore.xcodeproj/project.pbxproj: Ditto.
+ * bindings/ScriptControllerBase.h: Added.
+ (WebCore::):
+ * bindings/js/ScriptController.h: #include ScriptControllerBase.h
+ * bindings/v8/ScriptController.h: Ditto.
+
+2010-05-22 Yong Li <yoli@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Fix a crash when XHTMLMP is enabled. The frame pointer in Document
+ ctor can be null.
+ https://bugs.webkit.org/show_bug.cgi?id=39448
+
+ No new tests because it is obvious and it must be reproduced with
+ XHTMLMP enabled.
+
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+
+2010-05-22 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Adam Barth.
+
+ REGRESSION (r56295): Can't create a new wave on Google Wave
+ https://bugs.webkit.org/show_bug.cgi?id=39249
+
+ Instead of just using the source code portion of a JavaScript URL to
+ detect an XSS attack, we now include the JavaScript URL schema. This
+ reduces the chance of a false positive by providing additional context.
+
+ Test: http/tests/security/xssAuditor/javascript-link-safe.html
+
+ * WebCore.base.exp: Updated exported symbols as necessary.
+ * bindings/ScriptControllerBase.cpp:
+ (WebCore::ScriptController::executeScript): Added parameter shouldAllowXSS.
+ (WebCore::ScriptController::executeIfJavaScriptURL): Ditto.
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld): Ditto.
+ (WebCore::ScriptController::evaluate): Ditto.
+ (WebCore::ScriptController::executeScriptInWorld): Ditto.
+ * bindings/js/ScriptController.h: Added enum ShouldAllowXSS.
+ (WebCore::):
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::evaluate): Added parameter shouldAllowXSS.
+ * bindings/v8/ScriptController.h: Added enum ShouldAllowXSS.
+ (WebCore::):
+
+2010-05-22 Jeremy Moskovich <jeremy@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Document RenderObject::m_hasOverflowClip.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39425
+
+ No new functionality, so no new tests.
+
+ * rendering/RenderObject.h:
+
+2010-05-22 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add DragController
+ https://bugs.webkit.org/show_bug.cgi?id=39400
+
+ Add DragController for BREW MP.
+
+ * page/brew/DragControllerBrew.cpp: Added.
+ (WebCore::DragController::isCopyKeyDown):
+ (WebCore::DragController::dragOperation):
+ (WebCore::DragController::maxDragImageSize):
+ (WebCore::DragController::cleanupAfterSystemDrag):
+
+2010-05-22 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Eric Seidel.
+
+ [EFL] Build fix (update source code lists).
+ http://webkit.org/b/39235
+
+ * CMakeLists.txt:
+
+2010-05-22 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] webkit_web_view_drag_end should call EventHandler::dragSourceEndedAt
+ https://bugs.webkit.org/show_bug.cgi?id=39465
+
+ Added a helper function for converting a GDK action bitmask into a DragOperation bitmask.
+
+ No new tests as behavior has not changed.
+
+ * platform/gtk/ClipboardUtilitiesGtk.cpp:
+ (WebCore::gdkDragActionToDragOperation): Added.
+ * platform/gtk/ClipboardUtilitiesGtk.h:
+
+2010-05-22 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Cleanup SharedBuffer::createWithContentsOfFile
+ https://bugs.webkit.org/show_bug.cgi?id=38917
+
+ * platform/qt/SharedBufferQt.cpp:
+ (WebCore::SharedBuffer::createWithContentsOfFile):
+
+2010-05-22 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] WebKit/gtk/WebCoreSupport/DragClientGtk::startDrag should use the Clipboard::sourceOperation
+ https://bugs.webkit.org/show_bug.cgi?id=39459
+
+ Add ClipboardUtilitiesGtk, a container for GTK+/WebCore clipboard utility functions.
+ Initially add a function which converts a WebCore::DragOperation to a bitmask of
+ GdkDragActions.
+
+ No new tests, because behavior has not changed.
+
+ * GNUmakefile.am:
+ * platform/gtk/ClipboardUtilitiesGtk.cpp: Added.
+ (WebCore::dragOperationToGdkDragActions): Added.
+ * platform/gtk/ClipboardUtilitiesGtk.h: Added.
+
+2010-05-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Parse attributes with HTML5 lexer
+ https://bugs.webkit.org/show_bug.cgi?id=39520
+
+ This patch lets the HTML5 lexer parse attributes, as in
+ <div attr="foo"></div>. This patch is on the critical path to running
+ the html5lib tests.
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::nextToken):
+ * html/HTML5Lexer.h:
+ * html/HTML5Token.h:
+ (WebCore::HTML5Token::beginStartTag):
+ (WebCore::HTML5Token::beginEndTag):
+ (WebCore::HTML5Token::addNewAttribute):
+ (WebCore::HTML5Token::appendToAttributeName):
+ (WebCore::HTML5Token::appendToAttributeValue):
+ (WebCore::HTML5Token::attributes):
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::convertToOldStyle):
+
+2010-05-21 Mark Rowe <mrowe@apple.com>
+
+ 60,000!
+
+ * ChangeLog: Point out revision 60,000.
+
+2010-05-21 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Preparation for support of column-span, which will be implemented using continuations. When a block splits an inline, a
+ continuation chain is created of the form inline -> anonymous block -> inline. The middle block is always anonymous. When a column-span
+ splits the blocks in a multi-column block, it will create a similar chain: block -> anonymous block -> block. Enclosing split elements
+ directly connect to their continuations, so their chains will look like inline -> inline or block -> block.
+
+ This patch changes the member variable in RenderBlock, m_inlineContinuation, to simply be m_continuation and loosens up the type on it
+ to RenderBoxModelObject. This reflects the fact that the continuation of the block can now be another block and isn't always simply an inline.
+
+ Some renames have been done for cleanup:
+ isInlineContinuation -> isInlineElementContinuation to emphasize that this is a split non-anonymous element.
+ inlineContinuation -> inlineElementContinuation, again to emphasize that the inline is not anonymous.
+
+ Some new methods have been added:
+ isBlockElementContinuation - just like isInlineElementContinuation but for split block elements.
+ blockElementContinuation - just like inlineElementContinuation but for split block elements.
+ virtualContinuation - A way to just walk an entire continuation chain of mixed types (blocks and inlines) using their common base class.
+ isAnonymousBlockContinuation - A method for asking if a RenderBlock is an anonymous block in the continuation chain (the guy in the middle).
+
+ Code that was specific to the anonymous blocks in a continuation chain has been patched to ask isAnonymousBlockContinuation, so that it won't
+ incorrectly apply to non-anonymous blocks in the future. Where possible, code that really didn't care about being an inline vs. a block has
+ been broadened so that it will work with block continuations as well.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::lastChildConsideringContinuation):
+ (WebCore::startOfContinuations):
+ (WebCore::endOfContinuations):
+ (WebCore::childBeforeConsideringContinuations):
+ (WebCore::firstChildIsInlineContinuation):
+ (WebCore::AccessibilityRenderObject::nextSibling):
+ (WebCore::AccessibilityRenderObject::anchorElement):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
+ (WebCore::InlineFlowBox::paint):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::RenderBlock):
+ (WebCore::RenderBlock::destroy):
+ (WebCore::RenderBlock::removeLeftoverAnonymousBlock):
+ (WebCore::RenderBlock::removeChild):
+ (WebCore::RenderBlock::paintObject):
+ (WebCore::RenderBlock::inlineElementContinuation):
+ (WebCore::RenderBlock::blockElementContinuation):
+ (WebCore::RenderBlock::addContinuationWithOutline):
+ (WebCore::RenderBlock::absoluteRects):
+ (WebCore::RenderBlock::absoluteQuads):
+ (WebCore::RenderBlock::rectWithOutlineForRepaint):
+ (WebCore::RenderBlock::hoverAncestor):
+ (WebCore::RenderBlock::updateDragState):
+ (WebCore::RenderBlock::outlineStyleForRepaint):
+ (WebCore::RenderBlock::updateHitTestResult):
+ (WebCore::RenderBlock::addFocusRingRects):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::continuation):
+ (WebCore::RenderBlock::setContinuation):
+ (WebCore::RenderBlock::virtualContinuation):
+ (WebCore::RenderBlock::isAnonymousBlockContinuation):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::inlineElementContinuation):
+ (WebCore::RenderInline::styleDidChange):
+ (WebCore::nextContinuation):
+ (WebCore::RenderInline::splitInlines):
+ (WebCore::RenderInline::positionForPoint):
+ (WebCore::RenderInline::updateHitTestResult):
+ * rendering/RenderInline.h:
+ (WebCore::RenderInline::setContinuation):
+ (WebCore::RenderInline::virtualContinuation):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::getTextDecorationColors):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isElementContinuation):
+ (WebCore::RenderObject::isInlineElementContinuation):
+ (WebCore::RenderObject::isBlockElementContinuation):
+ (WebCore::RenderObject::virtualContinuation):
+ * rendering/RenderObjectChildList.cpp:
+ (WebCore::RenderObjectChildList::updateBeforeAfterContent):
+ * rendering/RenderRubyBase.cpp:
+ (WebCore::RenderRubyBase::moveBlockChildren):
+
+2010-05-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Teach WebKit2 to build in the Production configuration.
+
+ * Configurations/WebCore.xcconfig: Pass -allowable_client to the linker in all configurations.
+
+2010-05-21 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Implement tiled compositing layers on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=39461
+
+ This adds a tiling implementation similar (from a GraphicsLayer standpoint)
+ to the one for Mac. But where Mac uses the existing CATiledLayer, I've had
+ to implement one. If a layer is greater then 2k x 2k, I split it into an
+ array of 512 x 512 tiles. These tiles are positioned in the correct place
+ for the TiledLayer's content. When setNeedsDisplay is called on the TiledLayer
+ the tiles' setNeedDisplay methods are called. Each tile clips and positions the
+ CGContext appropriately and then renders the layer.
+
+ I also got rid of all frame()/setFrame() API to reduce the number of calls to
+ override for tiling.
+
+ Much optimization is possible. Most significantly right now all tiles are
+ rendered whether visible or not. We need to only render tiles that are
+ currently visible.
+
+ Tests: compositing/huge-layer-add-remove-child.html
+ compositing/huge-layer-resize.html
+ compositing/huge-layer-with-layer-children-resize.html
+ compositing/huge-layer-with-layer-children.html
+ compositing/huge-layer.html
+
+ * WebCore.vcproj/WebCore.vcproj:
+ * platform/graphics/win/GraphicsLayerCACF.cpp: Added tiling code similar to GraphicsLayerCA
+ (WebCore::GraphicsLayerCACF::requiresTiledLayer):
+ (WebCore::GraphicsLayerCACF::swapFromOrToTiledLayer):
+ (WebCore::GraphicsLayerCACF::updateLayerSize):
+ (WebCore::GraphicsLayerCACF::updateLayerDrawsContent):
+ * platform/graphics/win/GraphicsLayerCACF.h:
+ * platform/graphics/win/WKCACFLayer.cpp: Made some methods virtual so WebTiledLayer can override.
+ Also added sublayer setting and manipulation methods needed for tiling
+ (WebCore::WKCACFLayer::addSublayer):
+ (WebCore::WKCACFLayer::internalInsertSublayer):
+ (WebCore::WKCACFLayer::insertSublayerAboveLayer):
+ (WebCore::WKCACFLayer::insertSublayerBelowLayer):
+ (WebCore::WKCACFLayer::replaceSublayer):
+ (WebCore::WKCACFLayer::internalSublayerCount):
+ (WebCore::WKCACFLayer::adoptSublayers):
+ (WebCore::WKCACFLayer::internalSublayerAtIndex):
+ (WebCore::WKCACFLayer::internalIndexOfSublayer):
+ (WebCore::WKCACFLayer::internalRemoveAllSublayers):
+ (WebCore::WKCACFLayer::internalSetSublayers):
+ (WebCore::WKCACFLayer::internalSetNeedsDisplay):
+ (WebCore::WKCACFLayer::printLayer):
+ * platform/graphics/win/WKCACFLayer.h:
+ (WebCore::WKCACFLayer::setNeedsDisplay):
+ (WebCore::WKCACFLayer::removeAllSublayers):
+ (WebCore::WKCACFLayer::setSublayers):
+ (WebCore::WKCACFLayer::insertSublayer):
+ (WebCore::WKCACFLayer::sublayerCount):
+ * platform/graphics/win/WKCACFLayerRenderer.cpp: Fix a crash exposed when tiling code is active
+ (WebCore::WKCACFLayerRenderer::createRenderer):
+ (WebCore::WKCACFLayerRenderer::destroyRenderer):
+ (WebCore::WKCACFLayerRenderer::resize):
+ * platform/graphics/win/WebLayer.cpp: Added. Split this out from GraphicsLayerCACF so it could be subclassed by WebTiledLayer
+ (WebCore::WebLayer::internalSetNeedsDisplay):
+ (WebCore::WebLayer::drawInContext):
+ * platform/graphics/win/WebLayer.h: Added.
+ (WebCore::WebLayer::create):
+ (WebCore::WebLayer::WebLayer):
+ * platform/graphics/win/WebTiledLayer.cpp: Added. Where all the tile construction and rendering is done
+ (WebCore::WebTiledLayer::tileDisplayCallback):
+ (WebCore::WebTiledLayer::create):
+ (WebCore::WebTiledLayer::WebTiledLayer):
+ (WebCore::WebTiledLayer::~WebTiledLayer):
+ (WebCore::WebTiledLayer::setBounds):
+ (WebCore::WebTiledLayer::internalSetNeedsDisplay):
+ (WebCore::WebTiledLayer::internalSublayerCount):
+ (WebCore::WebTiledLayer::internalRemoveAllSublayers):
+ (WebCore::WebTiledLayer::internalSetSublayers):
+ (WebCore::WebTiledLayer::internalInsertSublayer):
+ (WebCore::WebTiledLayer::internalSublayerAtIndex):
+ (WebCore::WebTiledLayer::internalIndexOfSublayer):
+ (WebCore::WebTiledLayer::addTile):
+ (WebCore::WebTiledLayer::removeTile):
+ (WebCore::WebTiledLayer::tileAtIndex):
+ (WebCore::WebTiledLayer::tileCount):
+ (WebCore::WebTiledLayer::updateTiles):
+ (WebCore::WebTiledLayer::drawTile):
+ * platform/graphics/win/WebTiledLayer.h: Added.
+
+2010-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed a typo in my last commit: Reset m_inEvaluateInWorld to
+ wasInEvaluateInWorld, rather than false, to avoid stomping the old value
+ when it's true.
+ https://bugs.webkit.org/show_bug.cgi?id=39518
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld):
+
+2010-05-21 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39516, back end support for column-span property.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::):
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ * css/CSSPropertyNames.in:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+ * rendering/style/RenderStyle.h:
+ (WebCore::InheritedFlags::columnSpan):
+ (WebCore::InheritedFlags::setColumnSpan):
+ (WebCore::InheritedFlags::initialColumnSpan):
+ * rendering/style/StyleMultiColData.cpp:
+ (WebCore::StyleMultiColData::StyleMultiColData):
+ (WebCore::StyleMultiColData::operator==):
+ * rendering/style/StyleMultiColData.h:
+
+2010-05-21 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Disable full-screen video on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=39506
+ rdar://problem/8012516
+
+ Disable full-screen video through MediaPlayerPrivateVisualContext since
+ we no longer use GWorlds and QuickTime's built in full-screen support.
+
+ Media layout tests updated with new expected results.
+
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::supportsFullscreen):
+
+2010-05-21 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Avoid creating huge tiled layers with accelerated compositing
+ https://bugs.webkit.org/show_bug.cgi?id=39515
+
+ Constrain the size of huge composited layers, to avoid bad behavior. We only
+ need to do this if we detect that we need a tiled layer, since we'll make tiled
+ layers for elements over a certain size that need to draw already.
+
+ Constrain the size by attempting to shrink the longer dimension first.
+
+ Test: compositing/geometry/huge-layer.html
+
+ * platform/graphics/mac/GraphicsLayerCA.h:
+ * platform/graphics/mac/GraphicsLayerCA.mm:
+ (WebCore::GraphicsLayerCA::updateLayerPosition):
+ (WebCore::GraphicsLayerCA::updateLayerSize):
+ (WebCore::GraphicsLayerCA::constrainedSize):
+
+2010-05-21 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39420, :visited not working with background-color.
+
+ Make the RenderStyle color accessors private. This forces callers to use visitedDependentColor
+ instead (or to make the decision to become friends of the RenderStyle class in order to get access
+ to the real style information).
+
+ Modified history/self-is-visited.html to also test background colors.
+
+ * WebCore.base.exp:
+ * accessibility/AccessibilityTable.cpp:
+ (WebCore::AccessibilityTable::isTableExposableThroughAccessibility):
+ * accessibility/mac/AccessibilityObjectWrapper.mm:
+ (AXAttributeStringSetStyle):
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::currentColorOrValidColor):
+ * css/CSSComputedStyleDeclaration.h:
+ * css/SVGCSSStyleSelector.cpp:
+ (WebCore::colorFromSVGColorCSSValue):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::editingStyleAtPosition):
+ (WebCore::prepareEditingStyleToApplyAt):
+ (WebCore::removeStylesAddedByNode):
+ (WebCore::fontColorChangesComputedStyle):
+ (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
+ * editing/ApplyStyleCommand.h:
+ (WebCore::):
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::CompositeEditCommand::moveParagraphs):
+ (WebCore::CompositeEditCommand::breakOutOfEmptyListItem):
+ * editing/DeleteButtonController.cpp:
+ (WebCore::isDeletableElement):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::saveTypingStyleState):
+ * editing/InsertParagraphSeparatorCommand.cpp:
+ (WebCore::InsertParagraphSeparatorCommand::calculateStyleBeforeInsertion):
+ * editing/RemoveFormatCommand.cpp:
+ (WebCore::RemoveFormatCommand::doApply):
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::handleStyleSpansBeforeInsertion):
+ (WebCore::ReplaceSelectionCommand::handleStyleSpans):
+ (WebCore::ReplaceSelectionCommand::doApply):
+ * editing/SelectionController.cpp:
+ (WebCore::SelectionController::paintCaret):
+ * editing/markup.cpp:
+ (WebCore::createMarkup):
+ * page/animation/AnimationBase.cpp:
+ (WebCore::AnimationBase::ensurePropertyMap):
+ * page/animation/AnimationBase.h:
+ * page/mac/FrameMac.mm:
+ (WebCore::Frame::fontAttributesForSelectionStart):
+ * rendering/EllipsisBox.cpp:
+ (WebCore::EllipsisBox::paint):
+ (WebCore::EllipsisBox::paintSelection):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paint):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::styleDidChange):
+ (WebCore::RenderBox::paintRootBoxDecorations):
+ (WebCore::RenderBox::paintBoxDecorationsWithSize):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintBoxShadow):
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::paintBoxDecorations):
+ * rendering/RenderFileUploadControl.cpp:
+ (WebCore::RenderFileUploadControl::paintObject):
+ * rendering/RenderFrameSet.cpp:
+ (WebCore::RenderFrameSet::paintColumnBorder):
+ (WebCore::RenderFrameSet::paintRowBorder):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paintReplaced):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::rendererBackgroundColor):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::paintItemForeground):
+ (WebCore::RenderListBox::paintItemBackground):
+ * rendering/RenderListMarker.cpp:
+ (WebCore::RenderListMarker::paint):
+ * rendering/RenderMenuList.cpp:
+ (WebCore::RenderMenuList::itemStyle):
+ (WebCore::RenderMenuList::itemBackgroundColor):
+ (WebCore::RenderMenuList::menuStyle):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::selectionBackgroundColor):
+ (WebCore::RenderObject::selectionForegroundColor):
+ * rendering/RenderSVGResource.cpp:
+ (WebCore::RenderSVGResource::adjustColorForPseudoRules):
+ (WebCore::RenderSVGResource::fillPaintingResource):
+ (WebCore::RenderSVGResource::strokePaintingResource):
+ * rendering/RenderSVGResource.h:
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::paintBoxDecorations):
+ * rendering/RenderTable.h:
+ (WebCore::RenderTable::bgColor):
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::paintBackgroundsBehindCell):
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::adjustInnerTextStyle):
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlSingleLine::menuStyle):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::isControlStyled):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintMenuListButton):
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::RenderTreeAsText::writeRenderObject):
+ (WebCore::write):
+ * rendering/RenderTreeAsText.h:
+ * rendering/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::paintSelection):
+ * rendering/SVGRenderTreeAsText.cpp:
+ (WebCore::writeRenderSVGTextBox):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::colorIncludingFallback):
+ (WebCore::RenderStyle::visitedDependentColor):
+ * rendering/style/RenderStyle.h:
+ (WebCore::):
+ (WebCore::InheritedFlags::hasBackground):
+ (WebCore::InheritedFlags::borderLeftStyle):
+ (WebCore::InheritedFlags::borderRightStyle):
+ (WebCore::InheritedFlags::borderTopStyle):
+ (WebCore::InheritedFlags::borderBottomStyle):
+ (WebCore::InheritedFlags::textShadow):
+ (WebCore::InheritedFlags::textStrokeWidth):
+ (WebCore::InheritedFlags::hasNormalColumnGap):
+ (WebCore::InheritedFlags::borderLeftColor):
+ (WebCore::InheritedFlags::borderRightColor):
+ (WebCore::InheritedFlags::borderTopColor):
+ (WebCore::InheritedFlags::borderBottomColor):
+ (WebCore::InheritedFlags::backgroundColor):
+ (WebCore::InheritedFlags::color):
+ (WebCore::InheritedFlags::columnRuleColor):
+ (WebCore::InheritedFlags::outlineColor):
+ (WebCore::InheritedFlags::textFillColor):
+ (WebCore::InheritedFlags::textStrokeColor):
+ * svg/SVGAnimationElement.cpp:
+ (WebCore::adjustForCurrentColor):
+
+2010-05-21 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix for <rdar://problem/8009118> Crash in WebCore::toAlphabetic()
+ while running MangleMe
+ -and corresponding-
+ https://bugs.webkit.org/show_bug.cgi?id=39508
+
+ The math was slightly off here, and we wound up trying to access an
+ array at index -1 in some cases. We need to decrement numberShadow
+ rather than subtracting one from the result of the modulo
+ operation.
+
+ * rendering/RenderListMarker.cpp:
+ (WebCore::toAlphabeticOrNumeric):
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Qt buildfix #2
+
+ * bridge/qt/qt_runtime.cpp:
+ (JSC::Bindings::convertQVariantToValue):
+ (JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Qt buildfix #1
+
+ * bridge/qt/qt_instance.cpp:
+ (JSC::Bindings::QtRuntimeObject::QtRuntimeObject):
+ (JSC::Bindings::QtInstance::newRuntimeObject):
+ (JSC::Bindings::QtInstance::getMethod):
+ * bridge/qt/qt_pixmapruntime.cpp:
+ (JSC::Bindings::QtPixmapRuntimeObject::QtPixmapRuntimeObject):
+ (JSC::Bindings::QtPixmapInstance::getMethod):
+ (JSC::Bindings::QtPixmapInstance::createRuntimeObject):
+
+2010-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed failure seen on buildbot (due to flaky test).
+
+ Don't report an exception in a nested script evaluation -- just pass the
+ exception on to our caller. Our caller can decide to report the exception,
+ if it fully propagates -- but we don't want to report an exception that's
+ going to get caught.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::ScriptController):
+ (WebCore::ScriptController::evaluateInWorld):
+ * bindings/js/ScriptController.h:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ All callable objects should have a global object reference
+ https://bugs.webkit.org/show_bug.cgi?id=39495
+
+ Update the bindings generator to give prototype objects a
+ global object. Update all the manually written JSObject
+ subclasses to pass a global object.
+
+ * ForwardingHeaders/runtime/JSObjectWithGlobalObject.h: Added.
+ * WebCore.PluginHostProcess.exp:
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::objectToStringFunctionGetter):
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::nonCachingStaticFunctionGetter):
+ * bindings/js/JSDOMWindowShell.cpp:
+ (WebCore::JSDOMWindowShell::setWindow):
+ * bindings/js/JSHistoryCustom.cpp:
+ (WebCore::nonCachingStaticBackFunctionGetter):
+ (WebCore::nonCachingStaticForwardFunctionGetter):
+ (WebCore::nonCachingStaticGoFunctionGetter):
+ * bindings/js/JSLocationCustom.cpp:
+ (WebCore::nonCachingStaticReplaceFunctionGetter):
+ (WebCore::nonCachingStaticReloadFunctionGetter):
+ (WebCore::nonCachingStaticAssignFunctionGetter):
+ * bindings/js/WorkerScriptController.cpp:
+ (WebCore::WorkerScriptController::initScript):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * bridge/c/CRuntimeObject.cpp:
+ (JSC::Bindings::CRuntimeObject::CRuntimeObject):
+ * bridge/c/CRuntimeObject.h:
+ * bridge/c/c_instance.cpp:
+ (JSC::Bindings::CInstance::newRuntimeObject):
+ (JSC::Bindings::CRuntimeMethod::CRuntimeMethod):
+ (JSC::Bindings::CInstance::getMethod):
+ * bridge/jni/jsc/JavaInstanceJSC.cpp:
+ (JavaInstance::newRuntimeObject):
+ (JavaRuntimeMethod::JavaRuntimeMethod):
+ (JavaInstance::getMethod):
+ * bridge/jni/jsc/JavaRuntimeObject.cpp:
+ (JSC::Bindings::JavaRuntimeObject::JavaRuntimeObject):
+ * bridge/jni/jsc/JavaRuntimeObject.h:
+ * bridge/jsc/BridgeJSC.cpp:
+ (JSC::Bindings::Instance::newRuntimeObject):
+ * bridge/objc/ObjCRuntimeObject.h:
+ * bridge/objc/ObjCRuntimeObject.mm:
+ (JSC::Bindings::ObjCRuntimeObject::ObjCRuntimeObject):
+ * bridge/objc/objc_class.mm:
+ (JSC::Bindings::ObjcClass::fallbackObject):
+ * bridge/objc/objc_instance.mm:
+ (ObjcInstance::newRuntimeObject):
+ (ObjCRuntimeMethod::ObjCRuntimeMethod):
+ (ObjcInstance::getMethod):
+ * bridge/objc/objc_runtime.h:
+ * bridge/objc/objc_runtime.mm:
+ (JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+ * bridge/runtime_method.cpp:
+ (JSC::RuntimeMethod::RuntimeMethod):
+ * bridge/runtime_method.h:
+ * bridge/runtime_object.cpp:
+ (JSC::Bindings::RuntimeObject::RuntimeObject):
+ * bridge/runtime_object.h:
+
+2010-05-21 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Add DeviceOrientation and DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=39479
+
+ The page owns a DeviceOrientation object, which has a pointer to a
+ DeviceOrientationClient object provided by the embedder. The
+ DeviceOrientation object forwards requests to start listening to
+ orientation to the client, and when updates are available, fires a
+ DeviceOrientationEvent on the window object.
+
+ No new tests are possible at this time as the implementation is
+ incomplete. Future patches will add LayoutTestController methods
+ to provide mock orientation events to test this.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.base.exp:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/DeviceOrientation.cpp: Added.
+ (WebCore::DeviceOrientation::DeviceOrientation):
+ (WebCore::DeviceOrientation::onDeviceOrientationChange):
+ * dom/DeviceOrientation.h: Added.
+ * dom/DeviceOrientationClient.h: Added.
+ (WebCore::DeviceOrientationClient::~DeviceOrientationClient):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * page/Page.h:
+ (WebCore::Page::deviceOrientation):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::dataChanged):
+
+2010-05-21 Tasuku Suzuki <tasuku.suzuki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix compilation with QT_NO_GRAPHICSEFFECT
+ https://bugs.webkit.org/show_bug.cgi?id=38324
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::GraphicsLayerQtImpl::flushChanges):
+
+2010-05-21 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Darin Fisher.
+
+ Fix the HistoryController::pushState.
+
+ It should be possible to call the pushState method from
+ the first page in a window.
+
+ history.pushState doesn't work for the first page in a window.
+ https://bugs.webkit.org/show_bug.cgi?id=39418
+
+ * loader/HistoryController.cpp:
+ (WebCore::HistoryController::pushState):
+
+2010-05-21 Victoria Kirst <vrk@google.com>
+
+ Reviewed by David Levin.
+
+ [chromium] Fix slider status when buffering
+ https://bugs.webkit.org/show_bug.cgi?id=39370
+ Adjusts the buffering bar to be aligned with the slider thumb.
+
+ No new tests. (Covered by existing layout tests.)
+
+ * rendering/RenderMediaControlsChromium.cpp:
+ (WebCore::paintMediaSlider):
+ Added logic to align the buffering bar with the thumb. Half of the
+ thumb image is transparent, so the buffer bar is adjusted to fill in
+ this gap.
+
+2010-05-21 Jesus Sanchez-Palencia <jesus@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Extra processesArguments() calls in Document::processViewport
+ https://bugs.webkit.org/show_bug.cgi?id=39358
+
+ The viewport arguments are only needed when there is a frame->page(),
+ therefore we don't need to always call processArguments().
+
+ * dom/Document.cpp:
+ (WebCore::Document::processViewport):
+
+2010-05-17 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Eric Carlson.
+
+ [GStreamer] video painting support on mac port
+ https://bugs.webkit.org/show_bug.cgi?id=39206
+
+ ImageGStreamer support for mac port. A CG Image is created using
+ the GstBuffer data. It can then be painted by the gstreamer player.
+
+ * platform/graphics/gstreamer/ImageGStreamer.h:
+ * platform/graphics/gstreamer/ImageGStreamerCG.mm: Added.
+ (ImageGStreamer::createImage):
+ (ImageGStreamer::ImageGStreamer):
+ (ImageGStreamer::~ImageGStreamer):
+
+2010-05-21 Robin Cao <robin.cao@torchmobile.com.cn>
+
+ Reviewed by Eric Seidel.
+
+ animateTransform does not work on gradientTransform
+ https://bugs.webkit.org/show_bug.cgi?id=38115
+
+ Tests: svg/animations/animate-gradient-transform.html
+
+ * svg/SVGAnimateTransformElement.cpp:
+ (WebCore::SVGAnimateTransformElement::hasValidTarget): Check if the target element is gradient.
+ (WebCore::transformListFor): Ditto.
+ (WebCore::SVGAnimateTransformElement::resetToBaseValue): Ditto.
+ (WebCore::SVGAnimateTransformElement::applyResultsToTarget): Ditto.
+
+2010-05-21 Young Han Lee <joybro@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Fix guard around DatabaseSync
+ https://bugs.webkit.org/show_bug.cgi?id=38897
+
+ * storage/DatabaseSync.cpp:
+
+2010-05-21 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Prospective Qt/Mac build fix
+
+ My cpp is paranoid and doesn't like #if Q_WS_MAC:
+ error: #if with no expression
+
+ * page/qt/EventHandlerQt.cpp:
+
+2010-05-21 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Eric Seidel.
+
+ [EFL] Update Localized Strings. Remove markers from strings
+ since we are not using them and they are only polluting output.
+ https://bugs.webkit.org/show_bug.cgi?id=39371
+
+ No new tests required.
+
+ * platform/efl/LocalizedStringsEfl.cpp:
+ (WebCore::contextMenuItemTagOpenLinkInNewWindow):
+ (WebCore::contextMenuItemTagDownloadLinkToDisk):
+ (WebCore::contextMenuItemTagCopyLinkToClipboard):
+ (WebCore::contextMenuItemTagOpenImageInNewWindow):
+ (WebCore::contextMenuItemTagDownloadImageToDisk):
+ (WebCore::contextMenuItemTagCopyImageToClipboard):
+ (WebCore::contextMenuItemTagOpenFrameInNewWindow):
+ (WebCore::contextMenuItemTagSelectAll):
+ (WebCore::contextMenuItemTagUnicode):
+ (WebCore::contextMenuItemTagInputMethods):
+ (WebCore::contextMenuItemTagGoBack):
+ (WebCore::contextMenuItemTagGoForward):
+ (WebCore::contextMenuItemTagReload):
+ (WebCore::contextMenuItemTagIgnoreSpelling):
+ (WebCore::contextMenuItemTagLearnSpelling):
+ (WebCore::contextMenuItemTagSearchWeb):
+ (WebCore::contextMenuItemTagLookUpInDictionary):
+ (WebCore::contextMenuItemTagOpenLink):
+ (WebCore::contextMenuItemTagIgnoreGrammar):
+ (WebCore::contextMenuItemTagSpellingMenu):
+ (WebCore::contextMenuItemTagCheckSpelling):
+ (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
+ (WebCore::contextMenuItemTagFontMenu):
+ (WebCore::contextMenuItemTagOutline):
+ (WebCore::contextMenuItemTagInspectElement):
+ (WebCore::searchMenuClearRecentSearchesText):
+ (WebCore::missingPluginText): Add missing message.
+ (WebCore::multipleFileUploadText):
+ (WebCore::crashedPluginText):
+
+2010-05-21 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Eric Seidel.
+
+ [EF] Fix support for focus ring.
+ https://bugs.webkit.org/show_bug.cgi?id=39387
+
+ No new tests required.
+
+ * html/HTMLAnchorElement.cpp: Add EFL to #ifdef
+ (WebCore::HTMLAnchorElement::isMouseFocusable):
+
+2010-05-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add missing localized string symbols.
+ https://bugs.webkit.org/show_bug.cgi?id=39394
+
+ Add missingPluginText and crashedPluginText.
+
+ * platform/brew/LocalizedStringsBrew.cpp:
+ (WebCore::missingPluginText):
+ (WebCore::crashedPluginText):
+
+2010-05-21 Steve Block <steveblock@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Calls to CallJNIMethodIDA() in JavaInstance::invokeMethod() are required on Android
+ https://bugs.webkit.org/show_bug.cgi?id=39426
+
+ This code path has always been used by Android, but was guarded with
+ BUILDING_ON_TIGER in http://trac.webkit.org/changeset/55054, thus
+ breaking the Android build.
+
+ No new tests, build fix only.
+
+ * bridge/jni/jsc/JavaInstanceJSC.cpp:
+ (JavaInstance::invokeMethod):
+
+2010-05-20 Tony Chang <tony@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ escape link text when copying or dragging links on win or chromium
+ https://bugs.webkit.org/show_bug.cgi?id=39413
+
+ * editing/markup.cpp:
+ (WebCore::urlToMarkup):
+ * editing/markup.h:
+ * platform/chromium/ClipboardUtilitiesChromium.cpp:
+ * platform/chromium/ClipboardUtilitiesChromium.h:
+ * platform/win/ClipboardUtilitiesWin.cpp:
+ * platform/win/ClipboardUtilitiesWin.h:
+
+2010-05-18 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Eric Carlson.
+
+ [GStreamer] PlatformMedia support
+ https://bugs.webkit.org/show_bug.cgi?id=39300
+
+ Basic support for PlatformMedia in the gst player. The
+ PlatformMedia object contains a GStreamerGWorld object. That
+ object is empty for now. XOverlay features will be added later
+ on for easy review sake.
+
+ * GNUmakefile.am:
+ * platform/graphics/MediaPlayer.h:
+ (WebCore::PlatformMedia::):
+ * platform/graphics/gstreamer/GStreamerGWorld.cpp: Added.
+ (WebCore::GStreamerGWorld::createGWorld):
+ (WebCore::GStreamerGWorld::GStreamerGWorld):
+ (WebCore::GStreamerGWorld::~GStreamerGWorld):
+ * platform/graphics/gstreamer/GStreamerGWorld.h: Added.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::platformMedia):
+ (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+
+2010-05-20 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add dummy SSLKeyGenerator
+ https://bugs.webkit.org/show_bug.cgi?id=39403
+
+ Add dummy implementation of SSLKeyGenerator.
+
+ * platform/brew/SSLKeyGeneratorBrew.cpp: Added.
+ (WebCore::WebCore::getSupportedKeySizes):
+ (WebCore::WebCore::signedPublicKeyAndChallengeString):
+
+2010-05-20 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Dan Bernstein.
+
+ <rdar://problem/7848154> Remove the dependency on Foundation's private __COCOA_FORMAL_PROTOCOLS_2__ define.
+
+ * platform/mac/EmptyProtocolDefinitions.h:
+
+2010-05-20 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add Editor
+ https://bugs.webkit.org/show_bug.cgi?id=39404
+
+ Implement Editor::newGeneralClipboard.
+
+ * editing/brew/EditorBrew.cpp: Added.
+ (WebCore::Editor::newGeneralClipboard):
+
+2010-05-20 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Avoid flushing CA layers when a layout is pending
+ https://bugs.webkit.org/show_bug.cgi?id=39463
+ <rdar://problem/7999463>
+
+ Avoid rendering the compositing layers to the screen if there's a layout pending,
+ since the layer tree not in a state that should be presented to the user.
+
+ This fixes flashes in some types of content that dynamically add and remove layers.
+
+ Do this by adding a WKCACFLayerRendererClient for WKCACFLayerRenderer, which it can
+ call through to ask whether now is a good time to render. If not, it schedules
+ another render soon.
+
+ * platform/graphics/win/WKCACFLayerRenderer.h:
+ (WebCore::WKCACFLayerRendererClient::~WKCACFLayerRendererClient):
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ (WebCore::WKCACFLayerRenderer::acceleratedCompositingAvailable):
+ (WebCore::WKCACFLayerRenderer::create):
+ (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer):
+ (WebCore::WKCACFLayerRenderer::render):
+
+2010-05-20 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Don't include CoreFoundation.h when building for BREW MP
+ https://bugs.webkit.org/show_bug.cgi?id=39405
+
+ Add !defined(BUILDING_BREWMP__) guard for CoreFoundation.h.
+
+ * WebCorePrefix.h:
+
+2010-05-20 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add ScrollTheme
+ https://bugs.webkit.org/show_bug.cgi?id=39406
+
+ As BREW MP always uses frame flattening, there is no need to render scorllbars.
+ Use the default scrollbar theme with thickness 0.
+
+ * platform/brew/ScrollbarThemeBrew.cpp: Added.
+ (WebCore::ScrollbarTheme::nativeTheme):
+ (WebCore::ScrollbarThemeBrew::~ScrollbarThemeBrew):
+ * platform/brew/ScrollbarThemeBrew.h: Added.
+
+2010-05-20 Jon Honeycutt <jhoneycutt@apple.com>
+
+ REGRESSION(r53637): DivX plug-in fails to start until window is resized
+ https://bugs.webkit.org/show_bug.cgi?id=39457
+ <rdar://problem/8006102>
+
+ Before r53637, we called Widget::move() (which caused us to call
+ NPP_SetWindow) before painting a plug-in. r53637 removed the call to
+ Widget::move(), and we end up never calling NPP_SetWindow for plug-ins
+ with the "DeferFirstSetWindowCall" quirk, including the DivX plug-in.
+
+ Reviewed by Simon Fraser.
+
+ * manual-tests/divx-plugin-fails-to-draw.html: Added.
+
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::PluginView):
+ Initialize new member to false.
+
+ * plugins/PluginView.h:
+ Added new member.
+
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::PluginView::paint):
+ Call setNPWindowRect() before painting to ensure that NPP_SetWindow gets
+ called.
+ (WebCore::PluginView::setNPWindowRect):
+ Set m_haveCalledSetWindow.
+
+2010-05-20 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ WebSocket handshake incompatible change in draft-hixie-thewebsocketprotocol-76
+ https://bugs.webkit.org/show_bug.cgi?id=35572
+
+ WebSocket opening handshake is changed. New protocol draft could be found at http://www.whatwg.org/specs/web-socket-protocol/
+ It requires https://bugs.webkit.org/show_bug.cgi?id=38034 to pass websocket tests.
+
+ * websockets/WebSocketHandshake.cpp:
+ (WebCore::extractResponseCode):
+ add lineLength parameter to return length of status line.
+ (WebCore::hostName): Added.
+ (WebCore::generateSecWebSocketKey): Added.
+ (WebCore::generateKey3): Added.
+ (WebCore::setChallengeNumber): Added.
+ (WebCore::generateChallengeResponseExpected): Added.
+ (WebCore::WebSocketHandshake::WebSocketHandshake):
+ generate challenge response key and expected data.
+ (WebCore::WebSocketHandshake::clientLocation):
+ use hostName.
+ (WebCore::WebSocketHandshake::clientHandshakeMessage):
+ changed for draft 76 spec.
+ (WebCore::WebSocketHandshake::clientHandshakeRequest):
+ (WebCore::WebSocketHandshake::readServerHandshake):
+ changed for draft 76 spec.
+ m_mode is managed in this method.
+ (WebCore::WebSocketHandshake::readHTTPHeaders):
+ change error log messages.
+ (WebCore::WebSocketHandshake::processHeaders):
+ chagned for draft 76 spec.
+ (WebCore::WebSocketHandshake::checkResponseHeaders):
+ return boolean whether response header is ok or not and not change m_mode in it.
+ * websockets/WebSocketHandshake.h:
+
+2010-05-20 Adam Roben <aroben@apple.com>
+
+ Stop leaking all CACFContexts
+
+ Fixes <http://webkit.org/b/39466> <rdar://problem/8007141>.
+
+ Reviewed by Simon Fraser.
+
+ * platform/graphics/win/WKCACFContextFlusher.cpp:
+ (WebCore::WKCACFContextFlusher::addContext): Only retain the context
+ when we first add it to the m_contexts set. Otherwise we'll retain the
+ same context multiple times, causing it to leak.
+
+2010-05-20 Young Han Lee <joybro@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Create filenameFromString for all ports except GTK and EFL.
+ https://bugs.webkit.org/show_bug.cgi?id=39348
+
+ * platform/FileSystem.cpp: Added.
+ (WebCore::filenameFromString):
+ * platform/FileSystem.h:
+
+2010-05-20 Young Han Lee <joybro@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Port SharedBuffer to POSIX.
+ https://bugs.webkit.org/show_bug.cgi?id=39283
+
+ * platform/posix/SharedBufferPOSIX.cpp: Added.
+ (WebCore::SharedBuffer::createWithContentsOfFile):
+
+2010-05-20 Zhenyao Mo <zmo@google.com>
+
+ Reviewed by Dimitri Glazkov.
+
+ Map RGBA4/RGB5_A1 to RGBA and RGB565 to RGB in RenderbufferStorage
+ https://bugs.webkit.org/show_bug.cgi?id=39077
+
+ * platform/graphics/mac/GraphicsContext3DMac.cpp:
+ (WebCore::GraphicsContext3D::renderbufferStorage): Mapping the enums.
+
+2010-05-20 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ <rdar://problem/8007953> Textarea using custom font appears blank
+
+ Test: fast/css/font-face-in-shadow-DOM.html
+
+ When a remote font is loaded, CSSFontSelector forces a style recalc, which replaces all
+ RenderSyles that have FontFallbackLists referencing the placeholder font with fresh
+ RenderStyles. However, it does not descend into shadow DOM trees, so those may end up with
+ styles that still reference the placeholder font.
+
+ The fix is to add RenderObject::requiresForcedStyleRecalcPropagation() and have it return
+ true from renderers that maintain shadow DOM trees or otherwise keep their own RenderStyles.
+
+ * dom/Element.cpp:
+ (WebCore::Element::recalcStyle): Check if forced style recalc needs to propagated.
+ * rendering/RenderButton.h:
+ (WebCore::RenderButton::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderDataGrid.h:
+ (WebCore::RenderDataGrid::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderFileUploadControl.h:
+ (WebCore::RenderFileUploadControl::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderListItem.h:
+ (WebCore::RenderListItem::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderMedia.h:
+ (WebCore::RenderMedia::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderMenuList.h:
+ (WebCore::RenderMenuList::RenderMenuList::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderProgress.h:
+ (WebCore::RenderProgress::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderSlider.h:
+ (WebCore::RenderSlider::requiresForcedStyleRecalcPropagation):
+ * rendering/RenderTextControl.h:
+ (WebCore::RenderTextControl::requiresForcedStyleRecalcPropagation):
+
+2010-05-20 Jer Noble <jer.noble@apple.com>
+
+ No review; build fix only.
+
+ When WTF_USE_ACCELERATED_COMPOSITING is turned off, MediaPlayerPrivateQuickTimeVisualContext.cpp
+ must include CoreGraphics/CGContext.h.
+
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+
+2010-05-20 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Video elements show no video on Windows machines that do not support accelerated compositing
+ https://bugs.webkit.org/show_bug.cgi?id=39446
+ rdar://problem/7999794
+
+ Implement the paint() method in MediaPlayerPrivateQuickTimeVisualContext. The visual context should
+ be set up in load() and torn down in the destructor (as opposed to setUpVideoRendering and
+ tearDownVideoRendering, which won't get called in a non-accelerated compositing case).
+
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::~MediaPlayerPrivateQuickTimeVisualContext):
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::load):
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::paint):
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::visualContextTimerFired):
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage):
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::setUpVideoRendering):
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::tearDownVideoRendering):
+
+2010-05-20 Abhishek Arya <inferno@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Added a method to check if the security origin can access
+ password manager.
+ https://bugs.webkit.org/show_bug.cgi?id=38916
+
+ * page/SecurityOrigin.h:
+ (WebCore::SecurityOrigin::canAccessPasswordManager):
+
+2010-05-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix warnings seen on the buildbots today
+ https://bugs.webkit.org/show_bug.cgi?id=39368
+
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::pruneUnretainedIcons): Use the type "long long" for
+ things being printed with "%lli". There is no guaranteed that int64_t is the
+ same thing as long long.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMousePressEvent): Added parentheses as suggested
+ by warnings in newer versions of GCC.
+
+ * platform/ContextMenu.cpp: Fix #if around the functions to match the #if
+ around the call sites to avoid unused function warning.
+
+ * platform/graphics/gtk/ImageGtk.cpp:
+ (WebCore::Image::loadPlatformResource): Use NULL to end a variable argument list
+ rather than 0. This is a case where the WebKit "use 0 instead of NULL" guideline
+ is incorrect and won't work properly.
+
+ * platform/win/SystemTimeWin.cpp:
+ (WebCore::userIdleTime): Removed unnecessary initialization of LASTINPUTINFO.
+
+ * platform/win/WebCoreInstanceHandle.h: Added property svn:eol-style.
+ Made functions inline instead of static. It's not correct to have functions with
+ internal linkage in a header file. Marking them inline makes more sense.
+
+ * plugins/win/PluginMessageThrottlerWin.cpp:
+ (WebCore::PluginMessageThrottlerWin::PluginMessageThrottlerWin): Reordered the
+ initializers to match the order of the data members from the class definition.
+
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::PluginView::paintIntoTransformedContext): Initialized all the fields
+ of WINDOWPOS. I know this goes against the traditions of Windows programming,
+ but it's correct and silences the warning. Also removed the unneeded separate
+ code path for non-WinCE platforms that translates only the corner of the window
+ rectangle; the WinCE version is correct for normal Windows as well. Not sure
+ why this wasn't caught when the code was originally checked in.
+
+2010-05-20 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Moving frame.src checks out of the bindings
+ https://bugs.webkit.org/show_bug.cgi?id=37815
+
+ Moved JavaScript frame.src checks out of bindings and into
+ HTMLFrameElementBase. Added main thread state stack to JavaScriptCore
+ so ExecState is available inside core DOM. Updated affected bindings
+ (except for GObject, which will need to be updated to avoid origin
+ failures inside native code).
+
+ * Android.jscbindings.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSCallbackData.cpp:
+ (WebCore::JSCallbackData::invokeCallback):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::InjectedScriptHost::createInjectedScript):
+ * bindings/js/JSMainThreadExecState.cpp: Added.
+ * bindings/js/JSMainThreadExecState.h: Added.
+ (WebCore::JSMainThreadExecState::currentState):
+ (WebCore::JSMainThreadExecState::call):
+ (WebCore::JSMainThreadExecState::evaluate):
+ (WebCore::JSMainThreadExecState::JSMainThreadExecState):
+ (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
+ (WebCore::JSMainThreadNullState::JSMainThreadNullState):
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::executeFunctionInContext):
+ (WebCore::ScheduledAction::execute):
+ * bindings/js/ScheduledAction.h:
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld):
+ (WebCore::ScriptController::canAccessFromCurrentOrigin):
+ * bindings/js/ScriptController.h:
+ * bindings/js/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::call):
+ * bindings/objc/ObjCEventListener.mm:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ * bindings/scripts/test/ObjC/DOMTestCallback.mm:
+ (-[DOMTestCallback callbackWithClass1Param:]):
+ (-[DOMTestCallback callbackWithClass2Param:strArg:]):
+ (-[DOMTestCallback callbackWithNonBoolReturnType:]):
+ (-[DOMTestCallback customCallback:class6Param:]):
+ * bindings/scripts/test/ObjC/DOMTestInterface.mm:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj readOnlyIntAttr]):
+ (-[DOMTestObj readOnlyStringAttr]):
+ (-[DOMTestObj readOnlyTestObjAttr]):
+ (-[DOMTestObj intAttr]):
+ (-[DOMTestObj setIntAttr:]):
+ (-[DOMTestObj longLongAttr]):
+ (-[DOMTestObj setLongLongAttr:]):
+ (-[DOMTestObj unsignedLongLongAttr]):
+ (-[DOMTestObj setUnsignedLongLongAttr:]):
+ (-[DOMTestObj stringAttr]):
+ (-[DOMTestObj setStringAttr:]):
+ (-[DOMTestObj testObjAttr]):
+ (-[DOMTestObj setTestObjAttr:]):
+ (-[DOMTestObj attrWithException]):
+ (-[DOMTestObj setAttrWithException:]):
+ (-[DOMTestObj attrWithSetterException]):
+ (-[DOMTestObj setAttrWithSetterException:]):
+ (-[DOMTestObj attrWithGetterException]):
+ (-[DOMTestObj setAttrWithGetterException:]):
+ (-[DOMTestObj customAttr]):
+ (-[DOMTestObj setCustomAttr:]):
+ (-[DOMTestObj scriptStringAttr]):
+ (-[DOMTestObj voidMethod]):
+ (-[DOMTestObj voidMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj intMethod]):
+ (-[DOMTestObj intMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj objMethod]):
+ (-[DOMTestObj objMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgs:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgsAndThrows:objArg:]):
+ (-[DOMTestObj serializedValue:]):
+ (-[DOMTestObj methodWithException]):
+ (-[DOMTestObj customMethod]):
+ (-[DOMTestObj customMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj customArgsAndException:]):
+ (-[DOMTestObj addEventListener:listener:useCapture:]):
+ (-[DOMTestObj removeEventListener:listener:useCapture:]):
+ (-[DOMTestObj withDynamicFrame]):
+ (-[DOMTestObj withDynamicFrameAndArg:]):
+ (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
+ (-[DOMTestObj withDynamicFrameAndUserGesture:]):
+ (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
+ (-[DOMTestObj withScriptStateVoid]):
+ (-[DOMTestObj withScriptStateObj]):
+ (-[DOMTestObj withScriptStateVoidException]):
+ (-[DOMTestObj withScriptStateObjException]):
+ (-[DOMTestObj methodWithOptionalArg:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndOptionalArg:opt:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndTwoOptionalArgs:opt1:opt2:]):
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::canAccessFromCurrentOrigin):
+ * bindings/v8/ScriptController.h:
+ * html/HTMLFrameElementBase.cpp:
+ (WebCore::HTMLFrameElementBase::isURLAllowed):
+
+2010-05-20 Adam Roben <aroben@apple.com>
+
+ Fix an HRGN leak in WKCACFLayerRenderer
+
+ Fixes <http://webkit.org/b/39312> <rdar://problem/7998728> REGRESSION
+ (r53686-r55990): Graphics corruption when watching video (affects
+ youtube.com)
+
+ Reviewed by Darin Adler.
+
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ (WebCore::getDirtyRects): Use an OwnPtr to hold the HRGN we allocate.
+ That way we don't have to remember to destroy it (as we were
+ forgetting to do) when we bail out of this function early.
+
+2010-05-20 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ [chromium] Provide a way to catch exceptions thrown while interacting
+ with a NPObject via WebBindings methods.
+ https://bugs.webkit.org/show_bug.cgi?id=39378
+
+ This change also includes a small bit of cleanup in V8NPObject and
+ friends. I moved code into the WebCore namespace where appropriate.
+
+ In _NPN_Invoke, I also moved the call to _NPN_Evaluate outside of the
+ context scope. I did this to avoid having nested ExceptionCatcher
+ objects, which is not strictly necessary, but it seemed cleaner.
+ _NPN_Evaluate already takes care of creating a context scope.
+
+ * bindings/v8/NPV8Object.cpp:
+ (WebCore::v8ObjectToNPObject):
+ (WebCore::npCreateV8ScriptObject):
+ (_NPN_Invoke):
+ (_NPN_InvokeDefault):
+ (_NPN_Evaluate):
+ (_NPN_EvaluateHelper):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ (_NPN_Enumerate):
+ (_NPN_Construct):
+ * bindings/v8/NPV8Object.h:
+ * bindings/v8/V8NPObject.cpp:
+ * bindings/v8/V8NPObject.h:
+ * bindings/v8/V8NPUtils.cpp:
+ (WebCore::convertV8ObjectToNPVariant):
+ (WebCore::pushExceptionHandler):
+ (WebCore::popExceptionHandler):
+ (WebCore::ExceptionCatcher::ExceptionCatcher):
+ (WebCore::ExceptionCatcher::~ExceptionCatcher):
+ * bindings/v8/V8NPUtils.h:
+ * bindings/v8/npruntime.cpp:
+
+2010-05-20 Marcus Bulach <bulach@chromium.org>
+
+ Reviewed by Steve Block.
+
+ Ensure timers are stopped on Geolocation::disconnectFrame()
+ https://bugs.webkit.org/show_bug.cgi?id=39388
+
+ fast/dom/Geolocation/notimer-after-unload.html, plus it should be possible to re-enable Gtk LayoutTests.
+
+ * page/Geolocation.cpp:
+ (WebCore::Geolocation::disconnectFrame):
+
+2010-05-20 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Ensures styles are up-to-date before determining selection
+ https://bugs.webkit.org/show_bug.cgi?id=39389
+
+ This adds a call to document::updateStyleIfNeeded() to
+ Frame::notifyRendererOfSelectionChange(). Without this call, if there
+ is a pending style update that will detach part of the DOM and the
+ the selection is within that part of the DOM when
+ notifyRendererOfSeletionChange is called, the rootEditableElement
+ algorithm ends up walking through detached parts of the render tree.
+
+ Test: editing/selection/focus-and-display-none.html
+
+ * page/Frame.cpp:
+ (WebCore::Frame::notifyRendererOfSelectionChange):
+
+2010-05-20 Adam Roben <aroben@apple.com>
+
+ Remove code that fetched, but did nothing useful with, a CFDictionary
+ in MediaPlayerPrivateQuickTimeVisualContext
+
+ I also removed the code in QTPixelBuffer that vended the dictionary.
+
+ Fixes <http://webkit.org/b/39435> <rdar://problem/8009278>
+ QTPixelBuffer passes CFDictionaries across the DLL boundary, which can
+ lead to crashes
+
+ Reviewed by Darin Adler.
+
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage):
+ Deleted code that fetched the attachments dictionary, which was never
+ used other than to pass it to CFRetain/CFRelease, which could be
+ enough to cause a crash due to incompatible copies of
+ CoreFoundation.dll.
+
+ * platform/graphics/win/QTMovieVisualContext.h: Added a now-needed
+ forward declaration.
+
+ * platform/graphics/win/QTPixelBuffer.cpp:
+ * platform/graphics/win/QTPixelBuffer.h:
+ Removed the now-unused attachments function.
+
+2010-05-20 Adam Roben <aroben@apple.com>
+
+ Fix a CFData leak in MediaPlayerPrivateQuickTimeVisualContext
+
+ Fixes <http://webkit.org/b/39432> <rdar://problem/8008992>
+
+ Reviewed by Ada Chan
+
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+ (WebCore::QTCFDictionaryCreateWithDataCallback): Use a RetainPtr to
+ hold the CFData we allocate so it will get released when this function
+ is exited. Also pass kCFAllocatorNull as the bytes deallocator to
+ CFDataCreateWithBytesNoCopy so that CF doesn't try to deallocate the
+ bytes we pass to it.
+
+2010-05-20 Jian Li <jianli@chromium.org>
+
+ Reviewed by David Levin.
+
+ Rename GenericTask* to CrossThreadTask* in CrossThreadTask.h.
+ https://bugs.webkit.org/show_bug.cgi?id=39437
+
+ * dom/CrossThreadTask.h:
+ (WebCore::):
+ (WebCore::CrossThreadTask1::create):
+ (WebCore::CrossThreadTask1::CrossThreadTask1):
+ (WebCore::CrossThreadTask2::create):
+ (WebCore::CrossThreadTask2::CrossThreadTask2):
+ (WebCore::CrossThreadTask3::create):
+ (WebCore::CrossThreadTask3::CrossThreadTask3):
+ (WebCore::CrossThreadTask4::create):
+ (WebCore::CrossThreadTask4::CrossThreadTask4):
+ (WebCore::CrossThreadTask5::create):
+ (WebCore::CrossThreadTask5::CrossThreadTask5):
+ (WebCore::CrossThreadTask6::create):
+ (WebCore::CrossThreadTask6::CrossThreadTask6):
+ (WebCore::CrossThreadTask7::create):
+ (WebCore::CrossThreadTask7::CrossThreadTask7):
+ (WebCore::CrossThreadTask8::create):
+ (WebCore::CrossThreadTask8::CrossThreadTask8):
+ (WebCore::createCallbackTask):
+
+2010-05-20 Jian Li <jianli@chromium.org>
+
+ Reviewed by David Levin.
+
+ Rename GenericWorkerTask.h to CrossThreadTask.h and move it to dom directory.
+ https://bugs.webkit.org/show_bug.cgi?id=39135
+
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/CrossThreadTask.h: Renamed from WebCore/workers/GenericWorkerTask.h.
+ * html/FileStreamProxy.cpp:
+ * loader/WorkerThreadableLoader.cpp:
+ * websockets/WorkerThreadableWebSocketChannel.cpp:
+ * workers/DefaultSharedWorkerRepository.cpp:
+ * workers/WorkerMessagingProxy.cpp:
+ * workers/WorkerScriptLoader.cpp:
+
+2010-05-20 Adele Peterson <adele@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Remove the Safari welcome page site-specific quirk, since its no longer needed.
+
+ * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::cssRules):
+
+2010-05-20 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Provide bindings for DeviceOrientation
+ https://bugs.webkit.org/show_bug.cgi?id=39210
+
+ Tests: fast/dom/DeviceOrientation/window-property.html
+ fast/dom/Window/window-properties-on-device-orientation.html
+
+ Adds bindings for DeviceOrientation as defined in
+ http://dev.w3.org/geo/api/spec-source-orientation.html
+ This is guarded by ENABLE(DEVICE_ORIENTATION) which is currently disabled on
+ all platforms but Android.
+
+ * Android.derived.jscbindings.mk:
+ * Android.derived.v8bindings.mk:
+ * Android.mk:
+ * Configurations/FeatureDefines.xcconfig:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pri:
+ * WebCore.pro:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSEventCustom.cpp:
+ (WebCore::toJS):
+ * bindings/v8/custom/V8EventCustom.cpp:
+ (WebCore::toV8):
+ * dom/DeviceOrientationEvent.cpp: Added.
+ (WebCore::DeviceOrientationEvent::DeviceOrientationEvent):
+ (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
+ * dom/DeviceOrientationEvent.h: Added.
+ (WebCore::DeviceOrientationEvent::create):
+ (WebCore::DeviceOrientationEvent::alpha):
+ (WebCore::DeviceOrientationEvent::beta):
+ (WebCore::DeviceOrientationEvent::gamma):
+ (WebCore::DeviceOrientationEvent::isDeviceOrientationEvent):
+ * dom/DeviceOrientationEvent.idl: Added.
+ * dom/Event.cpp:
+ (WebCore::Event::isDeviceOrientationEvent):
+ * dom/Event.h:
+ * dom/EventNames.h:
+ * page/DOMWindow.h:
+ * page/DOMWindow.idl:
+
+2010-05-20 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Rubberstamped by Antti Koivisto.
+
+ Use 0.15 as text drag delay when Q_WS_MAC is defined, which is
+ consistent with the Mac OS X platform.
+
+ * page/qt/EventHandlerQt.cpp:
+
+2010-05-19 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Fix painting when using clipToImageBuffer()
+
+ When we apply the transform of the parent painter to the painter of
+ the transparency layer, we adopt its coordinate system, thus offset
+ should not be in page coordinates, but in the coordinate system of
+ the parent painter.
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::TransparencyLayer::TransparencyLayer):
+
+2010-05-20 Adam Langley <agl@chromium.org>
+
+ Reviewed by David Levin.
+
+ [chromium] Avoid crash when msttcorefonts aren't provided
+
+ https://bugs.webkit.org/show_bug.cgi?id=39015
+ http://code.google.com/p/chromium/issues/detail?id=43831
+
+ * platform/graphics/chromium/FontCacheLinux.cpp:
+ (WebCore::FontCache::createFontPlatformData):
+
+2010-05-20 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Dirk Schulze.
+
+ Fix a crash caused by feLigthing::apply()
+ https://bugs.webkit.org/show_bug.cgi?id=39004
+
+ Make FELighting::apply() similar to other filters' applies
+ to avoid an assertion fail in putUnmultipliedImageData(),
+ when effectDrawingRect has negative location (x or y is less than 0).
+
+ Test: svg/filters/feLighting-crash.svg
+
+ * svg/graphics/filters/SVGFELighting.cpp:
+ (WebCore::FELighting::apply):
+
+2010-05-20 Chris Jerdonek <cjerdonek@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Modified FrameLoader::urlSelected() to accept a KURL instead of a
+ ResourceRequest.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39320
+
+ Since ResourceRequest has non-explicit single-parameter constructors for
+ String and KURL, urlSelected() previously accepted any of String, KURL,
+ and ResourceRequest. This revision changes urlSelected() to accept only
+ a KURL to make the API tighter and easier to refactor.
+
+ No new functionality, so no new tests.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::urlSelected):
+ - Changed the public overload to accept a KURL instead of a ResourceRequest.
+ * loader/FrameLoader.h:
+ - Changed the public overload to accept a KURL instead of a ResourceRequest.
+ * wml/WMLAElement.cpp:
+ (WebCore::WMLAElement::defaultEventHandler):
+ - Updated the call to urlSelected().
+
+2010-05-20 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Kent Tamura.
+
+ 2x execCommand ReadAV@NULL
+ https://bugs.webkit.org/show_bug.cgi?id=35791
+
+ In applyBlockStyle(), a node which is referred from
+ nextParagraphStart sometimes removed from the document and goes
+ orphan, and that causes an assertion failed. This is because
+ moveParagraphs() replaces the node with a new one with some new
+ styles applied. So we re-compute nextParagraphStart in that case.
+
+ Test: editing/execCommand/35791.html
+
+ * dom/Position.h:
+ (WebCore::Position::isOrphan):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyBlockStyle):
+ * editing/VisiblePosition.h:
+ (WebCore::VisiblePosition::isOrphan):
+
+2010-05-20 Steve Block <steveblock@google.com>
+
+ Reviewed by Eric Seidel.
+
+ PluginView contains JSC-specific code
+ https://bugs.webkit.org/show_bug.cgi?id=38907
+
+ Build fix only, no new tests.
+
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::start):
+ (WebCore::PluginView::stop):
+ (WebCore::PluginView::performRequest):
+ * plugins/PluginView.h:
+
+2010-05-17 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Eric Seidel.
+
+ [GStreamer] enable gst support if USE_GSTREAMER macro is defined
+ https://bugs.webkit.org/show_bug.cgi?id=39205
+
+ Include gstreamer private player in the build when the
+ USE_GSTREAMER macro is enabled.
+
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::installedMediaEngines):
+
+2010-05-19 Vangelis Kokkevis <vangelis@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Implementing hardware accelerated compositing of layers for Chromium.
+ Completely removed the existing software compositing path to replace
+ it with code implemented using OpenGL.
+ https://bugs.webkit.org/show_bug.cgi?id=38783
+
+ Tests: Covered by existing compositing tests.
+
+ * WebCore.gyp/WebCore.gyp:
+ * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+ (WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::updateLayerDrawsContent):
+ (WebCore::GraphicsLayerChromium::updateContentsRect):
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::LayerChromium):
+ (WebCore::LayerChromium::~LayerChromium):
+ (WebCore::LayerChromium::updateGraphicsContext):
+ (WebCore::LayerChromium::drawsContentUpdated):
+ (WebCore::LayerChromium::updateContents):
+ (WebCore::LayerChromium::setContents):
+ (WebCore::LayerChromium::setBackingStoreSize):
+ (WebCore::LayerChromium::setBounds):
+ (WebCore::LayerChromium::setNeedsDisplay):
+ * platform/graphics/chromium/LayerChromium.h:
+ (WebCore::LayerChromium::contentsDirty):
+ (WebCore::LayerChromium::drawsContent):
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::):
+ (WebCore::checkGLError):
+ (WebCore::loadShader):
+ (WebCore::loadShaderProgram):
+ (WebCore::toGLMatrix):
+ (WebCore::orthoMatrix):
+ (WebCore::createLayerTexture):
+ (WebCore::LayerRendererChromium::create):
+ (WebCore::LayerRendererChromium::LayerRendererChromium):
+ (WebCore::LayerRendererChromium::~LayerRendererChromium):
+ (WebCore::LayerRendererChromium::drawTexturedQuad):
+ (WebCore::LayerRendererChromium::drawLayers):
+ (WebCore::LayerRendererChromium::getTextureId):
+ (WebCore::LayerRendererChromium::assignTextureForLayer):
+ (WebCore::LayerRendererChromium::freeLayerTexture):
+ (WebCore::LayerRendererChromium::drawDebugBorder):
+ (WebCore::LayerRendererChromium::isLayerVisible):
+ (WebCore::LayerRendererChromium::compositeLayersRecursive):
+ (WebCore::LayerRendererChromium::makeContextCurrent):
+ (WebCore::LayerRendererChromium::initGL):
+ (WebCore::LayerRendererChromium::bindCommonAttribLocation):
+ (WebCore::LayerRendererChromium::initializeSharedGLObjects):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ (WebCore::LayerRendererChromium::):
+
+2010-05-19 Andrey Kosyakov <caseq@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Maintain focus on help screen while it's active.
+ https://bugs.webkit.org/show_bug.cgi?id=39237
+
+ * inspector/front-end/HelpScreen.js:
+ (WebInspector.HelpScreen):
+ (WebInspector.HelpScreen.prototype.show):
+ (WebInspector.HelpScreen.prototype._hide):
+ (WebInspector.HelpScreen.prototype._onBlur):
+
+2010-05-19 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Crash fix in the HistoryController.
+
+ The problem was casued by a documented feature of the QWebFrame::setHtml().
+ The method doesn't affect a browsing history (doesn't create a HistoryItem instance), so
+ m_currentItem and m_previousItem are not set.
+
+ A null check was added.
+
+ [Qt] The QWebPage crashes on history.pushState().
+ https://bugs.webkit.org/show_bug.cgi?id=38840
+
+ * loader/HistoryController.cpp:
+ (WebCore::HistoryController::pushState):
+ (WebCore::HistoryController::replaceState):
+
+2010-05-19 Darin Fisher <darin@chromium.org>
+
+ Revert r59790 due to failing Chromium npruntime tests.
+
+ * bindings/v8/NPV8Object.cpp:
+ (v8ObjectToNPObject):
+ (npCreateV8ScriptObject):
+ (_NPN_Invoke):
+ (_NPN_InvokeDefault):
+ (_NPN_Evaluate):
+ (_NPN_EvaluateHelper):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ (_NPN_Enumerate):
+ (_NPN_Construct):
+ * bindings/v8/NPV8Object.h:
+ * bindings/v8/V8NPObject.cpp:
+ (forgetV8ObjectForNPObject):
+ * bindings/v8/V8NPObject.h:
+ * bindings/v8/V8NPUtils.cpp:
+ (convertV8ObjectToNPVariant):
+ (getStringIdentifier):
+ * bindings/v8/V8NPUtils.h:
+ * bindings/v8/npruntime.cpp:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Sam Weinig.
+
+ JSFunctions are no longer a subclass of InternalFunction.
+
+ * bindings/js/ScriptCallStack.cpp:
+ (WebCore::ScriptCallStack::ScriptCallStack):
+ (WebCore::ScriptCallStack::initialize):
+ * bindings/js/ScriptCallStack.h:
+
+2010-05-19 Jian Li <jianli@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Refactor text encoding detection logic in FileReader.
+ https://bugs.webkit.org/show_bug.cgi?id=39131
+
+ Changed FileReader::convertToText to call TextResourceDecoder::decode to
+ detect the encoding from BOM and decode the text. Though the File API
+ spec says that the supplied encoding should be used if it is valid, we
+ choose to ignore this requirement in order to be consistent with how
+ WebKit decodes the web content: always has the BOM override the provided
+ encoding.
+
+ * html/FileReader.cpp:
+ (WebCore::FileReader::convertToText):
+ * html/FileReader.h:
+
+2010-05-19 Abhishek Arya <inferno@chromium.org>
+
+ Reviewed by David Hyatt.
+
+ Check that the node is a text node before doing a static cast
+ to a Text class pointer.
+ https://bugs.webkit.org/show_bug.cgi?id=38626
+
+ Test: fast/text/text-transform-nontext-node-crash.xhtml
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::originalText):
+ * rendering/RenderTextFragment.cpp:
+ (WebCore::RenderTextFragment::originalText):
+ (WebCore::RenderTextFragment::previousCharacter):
+
+2010-05-19 Yaar Schnitman <yaar@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Fixed warnings by JSC overloads changes. Also updated the binding reference files for JSC.
+ https://bugs.webkit.org/show_bug.cgi?id=39390
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * bindings/scripts/test/JS/JSTestInterface.cpp:
+ (WebCore::):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::):
+
+2010-05-19 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ [chromium] Provide a way to catch exceptions thrown while interacting
+ with a NPObject via WebBindings methods.
+ https://bugs.webkit.org/show_bug.cgi?id=39378
+
+ This change also includes a small bit of cleanup in V8NPObject and
+ friends. I moved code into the WebCore namespace where appropriate.
+
+ In _NPN_Invoke, I also moved the call to _NPN_Evaluate outside of the
+ context scope. I did this to avoid having nested ExceptionCatcher
+ objects, which is not strictly necessary, but it seemed cleaner.
+ _NPN_Evaluate already takes care of creating a context scope.
+
+ * bindings/v8/NPV8Object.cpp:
+ (WebCore::v8ObjectToNPObject):
+ (WebCore::npCreateV8ScriptObject):
+ (_NPN_Invoke):
+ (_NPN_InvokeDefault):
+ (_NPN_Evaluate):
+ (_NPN_EvaluateHelper):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ (_NPN_Enumerate):
+ (_NPN_Construct):
+ * bindings/v8/NPV8Object.h:
+ * bindings/v8/V8NPObject.cpp:
+ * bindings/v8/V8NPObject.h:
+ * bindings/v8/V8NPUtils.cpp:
+ (WebCore::convertV8ObjectToNPVariant):
+ (WebCore::pushExceptionHandler):
+ (WebCore::popExceptionHandler):
+ (WebCore::ExceptionCatcher::~ExceptionCatcher):
+ * bindings/v8/V8NPUtils.h:
+ * bindings/v8/npruntime.cpp:
+
+2010-05-19 Yaar Schnitman <yaar@chromium.org>
+
+ Unreviewed, rolling out r59769.
+ http://trac.webkit.org/changeset/59769
+ https://bugs.webkit.org/show_bug.cgi?id=37815
+
+ Broke GTK again
+
+ * Android.jscbindings.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSCallbackData.cpp:
+ (WebCore::JSCallbackData::invokeCallback):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::InjectedScriptHost::createInjectedScript):
+ * bindings/js/JSMainThreadExecState.cpp: Removed.
+ * bindings/js/JSMainThreadExecState.h: Removed.
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::executeFunctionInContext):
+ (WebCore::ScheduledAction::execute):
+ * bindings/js/ScheduledAction.h:
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld):
+ * bindings/js/ScriptController.h:
+ * bindings/js/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::call):
+ * bindings/objc/ObjCEventListener.mm:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ * bindings/scripts/test/ObjC/DOMTestCallback.mm:
+ (-[DOMTestCallback callbackWithClass1Param:]):
+ (-[DOMTestCallback callbackWithClass2Param:strArg:]):
+ (-[DOMTestCallback callbackWithNonBoolReturnType:]):
+ (-[DOMTestCallback customCallback:class6Param:]):
+ * bindings/scripts/test/ObjC/DOMTestInterface.mm:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj readOnlyIntAttr]):
+ (-[DOMTestObj readOnlyStringAttr]):
+ (-[DOMTestObj readOnlyTestObjAttr]):
+ (-[DOMTestObj intAttr]):
+ (-[DOMTestObj setIntAttr:]):
+ (-[DOMTestObj longLongAttr]):
+ (-[DOMTestObj setLongLongAttr:]):
+ (-[DOMTestObj unsignedLongLongAttr]):
+ (-[DOMTestObj setUnsignedLongLongAttr:]):
+ (-[DOMTestObj stringAttr]):
+ (-[DOMTestObj setStringAttr:]):
+ (-[DOMTestObj testObjAttr]):
+ (-[DOMTestObj setTestObjAttr:]):
+ (-[DOMTestObj attrWithException]):
+ (-[DOMTestObj setAttrWithException:]):
+ (-[DOMTestObj attrWithSetterException]):
+ (-[DOMTestObj setAttrWithSetterException:]):
+ (-[DOMTestObj attrWithGetterException]):
+ (-[DOMTestObj setAttrWithGetterException:]):
+ (-[DOMTestObj customAttr]):
+ (-[DOMTestObj setCustomAttr:]):
+ (-[DOMTestObj scriptStringAttr]):
+ (-[DOMTestObj voidMethod]):
+ (-[DOMTestObj voidMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj intMethod]):
+ (-[DOMTestObj intMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj objMethod]):
+ (-[DOMTestObj objMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgs:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgsAndThrows:objArg:]):
+ (-[DOMTestObj serializedValue:]):
+ (-[DOMTestObj methodWithException]):
+ (-[DOMTestObj customMethod]):
+ (-[DOMTestObj customMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj customArgsAndException:]):
+ (-[DOMTestObj addEventListener:listener:useCapture:]):
+ (-[DOMTestObj removeEventListener:listener:useCapture:]):
+ (-[DOMTestObj withDynamicFrame]):
+ (-[DOMTestObj withDynamicFrameAndArg:]):
+ (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
+ (-[DOMTestObj withDynamicFrameAndUserGesture:]):
+ (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
+ (-[DOMTestObj withScriptStateVoid]):
+ (-[DOMTestObj withScriptStateObj]):
+ (-[DOMTestObj withScriptStateVoidException]):
+ (-[DOMTestObj withScriptStateObjException]):
+ (-[DOMTestObj methodWithOptionalArg:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndOptionalArg:opt:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndTwoOptionalArgs:opt1:opt2:]):
+ * bindings/v8/ScriptController.cpp:
+ * bindings/v8/ScriptController.h:
+ * html/HTMLFrameElementBase.cpp:
+ (WebCore::HTMLFrameElementBase::isURLAllowed):
+
+2010-05-19 Dirk Pranke <dpranke@chromium.org>
+
+ Try again to roll out r58675.
+
+ * notifications/Notification.h:
+ * notifications/Notification.idl:
+
+2010-05-19 Enrica Casucci <enrica@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ REGRESSION (r59385) crash destroying inline renderers
+ https://bugs.webkit.org/show_bug.cgi?id=39143
+ <rdar://problem/8003662>
+
+ The goal of r59385 was to make sure that the layout of block after all its children had been removed produced the identical result
+ as the one of a newly created empty block. In order to do so, we had to make sure that the m_inlineChildren flag was reset to true when
+ the block had no children (as it is upon creation).
+ I discovered that, by doing that for anonymous blocks it leads removeChild to conclude that the anonymous children can be removed,
+ without considering that the anonymous block could be part of a continuation chain. For this reason, when RenderInline::destroy()
+ tries to remove the continuations we are effectively deleting a renderer that had been deleted already.
+
+ Test: fast/inline-block/anonymous-block-crash.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutBlock): resetting the flag m_inlineChildren only for non anonymous blocks otherwise we incurr in
+ a double deletion of the renderer that causes the crash.
+
+2010-05-19 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r59782.
+ http://trac.webkit.org/changeset/59782
+ https://bugs.webkit.org/show_bug.cgi?id=39379
+
+ broke DRT build (Requested by dpranke on #webkit).
+
+ * notifications/Notification.h:
+ (WebCore::Notification::dir):
+ (WebCore::Notification::setDir):
+ (WebCore::Notification::replaceId):
+ (WebCore::Notification::setReplaceId):
+ * notifications/Notification.idl:
+
+2010-05-18 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21049, opacity and position:relative fail in multi-column layouts.
+
+ Make layers split painting across columns just as normal flow content does. This is actually very
+ challenging, since intermediate multicol layers can exist between a child that has to be split and
+ its enclosing stacking context.
+
+ In order to properly paginate layers, a bit is set on all pagination roots, i.e., layers that will get
+ split and thus split any descendant layers that they are also responsible for painting. For a paginated
+ root, we walk up the layer hierarchy and collect all intermediate multicol blocks between the child
+ and the enclosing stacking context.
+
+ We then recur from the outside in, applying clipping and translation as we break up the layer into strips.
+
+ Composited layers remain unsplittable and have a hacked offset still in order to be placed in the right
+ column.
+
+ Painting and hit testing of columns has been simplified in all of the functions to use the x position of
+ the column rect instead of trying to increment an x offset by adding in widths and column gaps. This
+ makes those functions directionality-independent (and the LTR/RTL code paths are now the same).
+
+ Fix repainting of columns as well to make sure rects are split across columns only after relative position
+ and transforms have been applied.
+
+ Added fast/multicol/layers-split-across-columns.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::paintColumnContents):
+ (WebCore::RenderBlock::adjustRectForColumns):
+ (WebCore::RenderBlock::adjustForColumns):
+ * rendering/RenderBlock.h:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::computeRectForRepaint):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::RenderLayer):
+ (WebCore::RenderLayer::updateLayerPositions):
+ (WebCore::RenderLayer::updatePagination):
+ (WebCore::RenderLayer::updateLayerPosition):
+ (WebCore::RenderLayer::paintLayer):
+ (WebCore::RenderLayer::paintList):
+ (WebCore::RenderLayer::paintPaginatedChildLayer):
+ (WebCore::RenderLayer::paintChildLayerIntoColumns):
+ (WebCore::RenderLayer::hitTestLayer):
+ (WebCore::RenderLayer::hitTestList):
+ (WebCore::RenderLayer::hitTestPaginatedChildLayer):
+ (WebCore::RenderLayer::hitTestChildLayerColumns):
+ * rendering/RenderLayer.h:
+ (WebCore::RenderLayer::):
+ (WebCore::RenderLayer::isPaginated):
+
+2010-05-18 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Attempt to revert r58765 to see if it was causing a performance
+ regression.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39328
+
+ * notifications/Notification.h:
+ * notifications/Notification.idl:
+
+2010-05-19 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Ensure m_nsFont is initialized properly, and tweak fallback font handling
+ to handle more cases.
+ https://bugs.webkit.org/show_bug.cgi?id=39365
+
+ * platform/graphics/wx/FontCacheWx.cpp:
+ (WebCore::FontCache::getFontDataForCharacters):
+ (WebCore::FontCache::getSimilarFontPlatformData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ * platform/graphics/wx/FontPlatformDataWx.cpp:
+ (WebCore::FontPlatformData::FontPlatformData):
+
+2010-05-19 Marcus Bulach <bulach@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Fixes Windows Qt Release post r59772.
+ https://bugs.webkit.org/show_bug.cgi?id=39369
+
+ * platform/GeolocationService.cpp:
+
+2010-05-19 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add support for handling basic <script> tags in the HTML5 Parser
+ https://bugs.webkit.org/show_bug.cgi?id=39350
+
+ WebKit currently executes scripts from HTMLTokenizer in one giagantic
+ hack. HTML 5 requires that we execute scripts from the tree-builders/parser.
+
+ It will take me a while to re-factor enough of HTMLTokenizer to be able to
+ move the script execution logic without breaking things. In the interest
+ of allowing Adam to continue improving the HTML 5 lexer I've added this
+ very basic (and very incomplete) <script> support to the HTML 5 parser code
+ path so the he can run the HTML5 parser test suite.
+
+ <script> support is tested by most of the layout tests.
+
+ * dom/ScriptElement.cpp:
+ (WebCore::useHTML5Parser):
+ (WebCore::ScriptElement::finishParsingChildren):
+
+2010-05-19 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Move member variables from NamedMappedAttrMap to its base class NamedNodeMap
+ https://bugs.webkit.org/show_bug.cgi?id=39367
+ <rdar://problem/8003304>
+
+ This lets us get rid of the vtable pointer in NamedNodeMap which saves 8 bytes, and also allows us to
+ fit the m_mappedAttributeCount unsigned int in the RefCounted padding (in 64-bit).
+
+ The net result is that we shrink the NamedMappedAttrMap size by 16 bytes, while keeping the size of NamedNodeMap the same.
+
+ * dom/Element.cpp:
+ (WebCore::Element::createAttributeMap):
+ * dom/Element.h:
+ * dom/NamedMappedAttrMap.cpp:
+ * dom/NamedMappedAttrMap.h:
+ (WebCore::NamedMappedAttrMap::NamedMappedAttrMap):
+ * dom/NamedNodeMap.cpp:
+ (WebCore::NamedNodeMap::clearAttributes):
+ * dom/NamedNodeMap.h:
+ (WebCore::NamedNodeMap::NamedNodeMap):
+ * dom/Node.cpp:
+ (WebCore::Node::dumpStatistics):
+ * dom/StyledElement.cpp:
+ * dom/StyledElement.h:
+
+2010-05-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Use ASSERT_UNUSED instead of UNUSED_PARAM.
+
+ * dom/Attribute.cpp:
+ (WebCore::Attribute::unbindAttr):
+
+2010-05-19 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Anders Carlsson.
+
+ Complete the merge of MappedAttribute and Attribute.
+
+ Files elided for brevity.
+
+2010-05-19 Marcus Bulach <bulach@chromium.org>
+
+ Reviewed by Steve Block.
+
+ [chromium] Adds supports for layout tests using GeolocationServiceMock.
+ https://bugs.webkit.org/show_bug.cgi?id=39081
+
+ Allows injection of GeolocationServiceMock factory.
+
+ Tests: existing fast/dom/Geolocation/*
+
+ * platform/GeolocationService.cpp:
+ (WebCore::GeolocationService::useMock):
+ (WebCore::GeolocationService::useMockFactory):
+ * platform/GeolocationService.h:
+ * platform/chromium/GeolocationServiceChromium.cpp:
+ (WebCore::GeolocationServiceChromium::GeolocationServiceChromium):
+
+2010-05-19 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Moving frame.src checks out of the bindings
+ https://bugs.webkit.org/show_bug.cgi?id=37815
+
+ Moved JavaScript frame.src checks out of bindings and into
+ HTMLFrameElementBase. Added main thread state stack to JavaScriptCore
+ so ExecState is available inside core DOM. Updated affected bindings
+ (except for GObject, which will need to be updated to avoid origin
+ failures inside native code).
+
+ * Android.jscbindings.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSCallbackData.cpp:
+ (WebCore::JSCallbackData::invokeCallback):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::InjectedScriptHost::createInjectedScript):
+ * bindings/js/JSMainThreadExecState.cpp: Added.
+ * bindings/js/JSMainThreadExecState.h: Added.
+ (WebCore::JSMainThreadExecState::currentState):
+ (WebCore::JSMainThreadExecState::call):
+ (WebCore::JSMainThreadExecState::evaluate):
+ (WebCore::JSMainThreadExecState::JSMainThreadExecState):
+ (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
+ (WebCore::JSMainThreadNullState::JSMainThreadNullState):
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::executeFunctionInContext):
+ (WebCore::ScheduledAction::execute):
+ * bindings/js/ScheduledAction.h:
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld):
+ (WebCore::ScriptController::canAccessFromCurrentOrigin):
+ * bindings/js/ScriptController.h:
+ * bindings/js/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::call):
+ * bindings/objc/ObjCEventListener.mm:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ * bindings/scripts/test/ObjC/DOMTestCallback.mm:
+ (-[DOMTestCallback callbackWithClass1Param:]):
+ (-[DOMTestCallback callbackWithClass2Param:strArg:]):
+ (-[DOMTestCallback callbackWithNonBoolReturnType:]):
+ (-[DOMTestCallback customCallback:class6Param:]):
+ * bindings/scripts/test/ObjC/DOMTestInterface.mm:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj readOnlyIntAttr]):
+ (-[DOMTestObj readOnlyStringAttr]):
+ (-[DOMTestObj readOnlyTestObjAttr]):
+ (-[DOMTestObj intAttr]):
+ (-[DOMTestObj setIntAttr:]):
+ (-[DOMTestObj longLongAttr]):
+ (-[DOMTestObj setLongLongAttr:]):
+ (-[DOMTestObj unsignedLongLongAttr]):
+ (-[DOMTestObj setUnsignedLongLongAttr:]):
+ (-[DOMTestObj stringAttr]):
+ (-[DOMTestObj setStringAttr:]):
+ (-[DOMTestObj testObjAttr]):
+ (-[DOMTestObj setTestObjAttr:]):
+ (-[DOMTestObj attrWithException]):
+ (-[DOMTestObj setAttrWithException:]):
+ (-[DOMTestObj attrWithSetterException]):
+ (-[DOMTestObj setAttrWithSetterException:]):
+ (-[DOMTestObj attrWithGetterException]):
+ (-[DOMTestObj setAttrWithGetterException:]):
+ (-[DOMTestObj customAttr]):
+ (-[DOMTestObj setCustomAttr:]):
+ (-[DOMTestObj scriptStringAttr]):
+ (-[DOMTestObj voidMethod]):
+ (-[DOMTestObj voidMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj intMethod]):
+ (-[DOMTestObj intMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj objMethod]):
+ (-[DOMTestObj objMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgs:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgsAndThrows:objArg:]):
+ (-[DOMTestObj serializedValue:]):
+ (-[DOMTestObj methodWithException]):
+ (-[DOMTestObj customMethod]):
+ (-[DOMTestObj customMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj customArgsAndException:]):
+ (-[DOMTestObj addEventListener:listener:useCapture:]):
+ (-[DOMTestObj removeEventListener:listener:useCapture:]):
+ (-[DOMTestObj withDynamicFrame]):
+ (-[DOMTestObj withDynamicFrameAndArg:]):
+ (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
+ (-[DOMTestObj withDynamicFrameAndUserGesture:]):
+ (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
+ (-[DOMTestObj withScriptStateVoid]):
+ (-[DOMTestObj withScriptStateObj]):
+ (-[DOMTestObj withScriptStateVoidException]):
+ (-[DOMTestObj withScriptStateObjException]):
+ (-[DOMTestObj methodWithOptionalArg:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndOptionalArg:opt:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndTwoOptionalArgs:opt1:opt2:]):
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::canAccessFromCurrentOrigin):
+ * bindings/v8/ScriptController.h:
+ * html/HTMLFrameElementBase.cpp:
+ (WebCore::HTMLFrameElementBase::isURLAllowed):
+
+2010-05-19 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ CanvasRenderingContext2D's property getters that return colors should
+ serialize them in accordance with the HTML5 spec (4.8.11.1.4)
+ Setters should ignore invalid colors.
+
+ Also, shadowColor should initially be transparent black (4.8.11.1.6)
+
+ https://bugs.webkit.org/show_bug.cgi?id=38845
+
+ Refactored CanvasStyle to store an RGBA32 instead of RGBA components and/or the color string.
+
+ Spec links:
+ http://www.whatwg.org/specs/web-apps/current-work/#serialization-of-a-color
+ http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-shadowcolor
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::State::State):
+ (WebCore::CanvasRenderingContext2D::shadowColor):
+ (WebCore::CanvasRenderingContext2D::setShadowColor):
+ (WebCore::CanvasRenderingContext2D::setShadow):
+ (WebCore::CanvasRenderingContext2D::clearShadow):
+ (WebCore::CanvasRenderingContext2D::applyShadow):
+ * html/canvas/CanvasRenderingContext2D.h:
+ * html/canvas/CanvasStyle.cpp:
+ (WebCore::CanvasStyle::CanvasStyle):
+ (WebCore::CanvasStyle::create):
+ (WebCore::CanvasStyle::applyStrokeColor):
+ (WebCore::CanvasStyle::applyFillColor):
+ * html/canvas/CanvasStyle.h:
+ (WebCore::CanvasStyle::create):
+ (WebCore::CanvasStyle::color):
+ (WebCore::CanvasStyle::):
+ (WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
+ * platform/graphics/Color.cpp:
+ (WebCore::Color::serialized):
+ * platform/graphics/Color.h:
+
+2010-05-19 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] REGRESSION: CoolClock isn't rendered properly
+
+ https://bugs.webkit.org/show_bug.cgi?id=38526
+
+ CanvasRenderingContext2D's arc() should connect to the previous point
+ with a straight line (HTML5 spec 4.8.11.1.8), but if the path is empty
+ to begin with, we don't want a line back to (0,0)
+ This also fixes the rendering artifact discussed in bug 36226.
+
+ Spec link:
+ http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-arc
+
+ Test: fast/canvas/canvas-arc-connecting-line.html
+
+ * platform/graphics/qt/PathQt.cpp:
+ (WebCore::Path::addArc):
+
+2010-05-19 Alexander Pavlov <apavlov@chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Fix whitespace for the bug 38906
+ https://bugs.webkit.org/show_bug.cgi?id=39351
+
+ No new tests required (no code change).
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::~CSSParser):
+ (WebCore::CSSParser::setupParser):
+ (WebCore::CSSParser::parseSheet):
+ (WebCore::CSSParser::parseValue):
+ (WebCore::CSSParser::parseSelector):
+ (WebCore::unitFromString):
+ (WebCore::CSSParser::checkForOrphanedUnits):
+ (WebCore::CSSParser::parseWCSSInputProperty):
+ (WebCore::CSSParser::parseFillShorthand):
+ (WebCore::CSSParser::parseAnimationShorthand):
+ (WebCore::CSSParser::parseTransitionShorthand):
+ (WebCore::CSSParser::parseShorthand):
+ (WebCore::CSSParser::parse4Values):
+ (WebCore::CSSParser::parseAttr):
+ (WebCore::CSSParser::parseFillPositionXY):
+ (WebCore::CSSParser::parseFillPosition):
+ (WebCore::CSSParser::parseFillRepeat):
+ (WebCore::CSSParser::parseFillProperty):
+ (WebCore::CSSParser::parseAnimationTimingFunction):
+ (WebCore::CSSParser::parseAnimationProperty):
+ (WebCore::CSSParser::parseDashboardRegions):
+ (WebCore::CSSParser::parseCounterContent):
+ (WebCore::CSSParser::parseShape):
+ (WebCore::CSSParser::parseFont):
+ (WebCore::CSSParser::parseFontFamily):
+ (WebCore::CSSParser::parseFontFaceSrc):
+ (WebCore::parseInt):
+ (WebCore::CSSParser::parseColor):
+ (WebCore::CSSParser::parseShadow):
+ (WebCore::CSSParser::parseReflect):
+ (WebCore::BorderImageParseContext::commitNumber):
+ (WebCore::BorderImageParseContext::commitBorderImage):
+ (WebCore::CSSParser::parseBorderImage):
+ (WebCore::CSSParser::parseCounter):
+ (WebCore::parseGradientPoint):
+ (WebCore::parseGradientColorStop):
+ (WebCore::CSSParser::parseGradient):
+ (WebCore::CSSParser::parseCanvas):
+ (WebCore::CSSParser::parseTransform):
+ (WebCore::CSSParser::parseTransformOrigin):
+ (WebCore::CSSParser::parsePerspectiveOrigin):
+ (WebCore::CSSParser::text):
+ (WebCore::CSSParser::createRuleList):
+ (WebCore::CSSParser::createVariablesRule):
+ (WebCore::CSSParser::parseVariable):
+ (WebCore::CSSParser::parsePropertyWithResolvedVariables):
+ (WebCore::CSSParser::checkForVariables):
+ (WebCore::CSSParser::createKeyframeRule):
+ * css/CSSParser.h:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::setFrontend):
+ (WebCore::InspectorController::show):
+ (WebCore::InspectorController::unbindAllResources):
+ (WebCore::InspectorController::didCommitLoad):
+ (WebCore::InspectorController::scriptImported):
+ (WebCore::InspectorController::getCurrentUserInitiatedProfileName):
+ (WebCore::InspectorController::removeBreakpoint):
+ (WebCore::drawOutlinedQuad):
+ (WebCore::InspectorController::stopTiming):
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::didRemoveDOMNode):
+ (WebCore::InspectorDOMAgent::getStyles):
+ (WebCore::InspectorDOMAgent::applyStyleText):
+
+2010-05-19 Steve Block <steveblock@google.com>
+
+ Reviewed by Nate Chapin.
+
+ V8 code generator does not add ENABLE guards around attribute getters and setters
+ https://bugs.webkit.org/show_bug.cgi?id=39222
+
+ No new tests, build fix only.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+
+2010-05-19 Jeremy Orlow <jorlow@chromium.org>
+
+ Unreviewed build fix for Chromium.
+
+ * storage/IndexedDatabaseImpl.cpp:
+
+2010-05-17 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Hook Chromium's WebIndexedDatabaseImpl up to IndexedDatabaseImpl
+ https://bugs.webkit.org/show_bug.cgi?id=39216
+
+ All of these functions are supposed to be passing around the origin since
+ the caller of IndexedDatabaseImpl might not be able to pass in a Frame*
+ object. I tried to fix this in an ealier patch, but obviously messed up.
+
+ Also change passing security origin strings to passing SecurityOrigin
+ objects.
+
+ No behavior change because Chromium was emulating the old behavior before
+ even though the code wasn't properly hooked up.
+
+ * storage/IndexedDatabase.h:
+ * storage/IndexedDatabaseImpl.cpp:
+ (WebCore::IndexedDatabaseImpl::open):
+ * storage/IndexedDatabaseImpl.h:
+ * storage/IndexedDatabaseRequest.cpp:
+ (WebCore::IndexedDatabaseRequest::open):
+
+2010-05-19 Ben Murdoch <benm@google.com>
+
+ Reviewed by Darin Adler.
+
+ Touch events are marked DontEnum in DOMWindow.idl
+ https://bugs.webkit.org/show_bug.cgi?id=39118
+
+ Touch events are the only attribute event listeners on the
+ window object that are marked DontEnum. For consistency allow
+ them to be enumerated.
+
+ * page/DOMWindow.idl: Remove DontEnum from touchcancel, touchend,
+ touchstart and touchmove attributes.
+
+2010-05-19 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Fix build warning
+
+ NamedAttrMap.h has been renamed to NamedNodeMap.h
+
+ * WebCore.pro:
+
+2010-05-19 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add an HTML parsing benchmark
+ https://bugs.webkit.org/show_bug.cgi?id=39338
+
+ This benchmark parses the HTML5 specification 10 times and
+ reports how long it takes. It does this 21 times, discarding
+ the first warm-up run, and then prints the average time and
+ standard deviation.
+
+ Sharking the benchmark correctly shows over 60% of the time spent under HTMLTokenizer::write().
+ The numbers from the benchmark are rather consistent. On my
+ Mac Book Pro, I consistently see standard deviations < 2% of total time.
+
+ * benchmarks/parser/html-parser.html: Added.
+ * benchmarks/parser/resources/html5.html: Added.
+
+2010-05-18 Yuzo Fujishima <yuzo@google.com>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Make CSS Parser properly handle only-for-pages pseudo-classes.
+
+ A new Match category, PagePseudoClass, is introduced to distinguish
+ only-for-pages pseudo-classes from others. A new symbol, pseudo_page,
+ is introduced to handle them separately.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38731
+
+ * css/CSSGrammar.y:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::createMarginAtRule):
+ * css/CSSParser.h:
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::extractPseudoType):
+ (WebCore::CSSSelector::selectorText):
+ * css/CSSSelector.h:
+ (WebCore::CSSSelector::):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
+
+2010-05-19 Adam Barth <abarth@webkit.org>
+
+ Reviewed by David Hyatt.
+
+ Change the API of nextToken to distinguish between emitting a token and just running out of input
+ https://bugs.webkit.org/show_bug.cgi?id=39349
+
+ I'm not sure there's a functional difference with this patch yet, but
+ as discussed with Eric, we need this to handle attributes.
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::reset):
+ (WebCore::HTML5Lexer::nextToken):
+ * html/HTML5Lexer.h:
+ * html/HTML5Token.h:
+ (WebCore::HTML5Token::HTML5Token):
+ (WebCore::HTML5Token::clear):
+ (WebCore::HTML5Token::beginStartTag):
+ (WebCore::HTML5Token::beginEndTag):
+ (WebCore::HTML5Token::beginCharacter):
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::HTML5Tokenizer::write):
+
+2010-05-18 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Refactor HTMLTokenizer::write to make it more readable and split out the lexer bits from flow control bits
+ https://bugs.webkit.org/show_bug.cgi?id=39318
+
+ No functional changes, only moving code into smaller functions.
+
+ This code is already covered by numerous layout tests.
+
+ HTML parsing benchmark shows this to be a wash.
+
+ * dom/Tokenizer.h:
+ * html/HTMLTokenizer.cpp:
+ (WebCore::HTMLTokenizer::advance):
+ - New funtion to encapulate code which will move into HTMLLexer eventually.
+ - Use ALWAYS_INLINE to make sure compilers inline this large
+ function (otherwise this patch is a regression).
+ (WebCore::HTMLTokenizer::willWriteHTML):
+ - New function to handle calling any pre-write delegates.
+ (WebCore::HTMLTokenizer::didWriteHTML):
+ - New function to handle calling any post-write delegates.
+ (WebCore::HTMLTokenizer::write):
+ - Call the new functions.
+ * html/HTMLTokenizer.h:
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Make the HTML5 parser correctly parse <div>Hello</div>
+ https://bugs.webkit.org/show_bug.cgi?id=39345
+
+ Again, this patch is covered by a large number of LayoutTests.
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::HTML5Lexer):
+ (WebCore::HTML5Lexer::reset):
+ (WebCore::HTML5Lexer::nextToken):
+ (WebCore::HTML5Lexer::emitCommentToken):
+ (WebCore::HTML5Lexer::emitCharacter):
+ (WebCore::HTML5Lexer::emitCurrentTagToken):
+ * html/HTML5Lexer.h:
+ * html/HTML5Token.h:
+ (WebCore::HTML5Token::beginCharacter):
+ (WebCore::HTML5Token::appendToCharacter):
+ (WebCore::HTML5Token::characters):
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::convertToOldStyle):
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Make the HTML5 parser actually parse <div></div>
+ https://bugs.webkit.org/show_bug.cgi?id=39342
+
+ This patch is covered by every LayoutTest. Yes. All of them. :)
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::toLowerCase):
+ (WebCore::HTML5Lexer::HTML5Lexer):
+ (WebCore::HTML5Lexer::nextToken):
+ (WebCore::HTML5Lexer::emitCharacter):
+ * html/HTML5Lexer.h:
+ * html/HTML5Token.h:
+ (WebCore::HTML5Token::HTML5Token):
+ (WebCore::HTML5Token::beginStartTag):
+ (WebCore::HTML5Token::beginEndTag):
+ (WebCore::HTML5Token::appendToName):
+ (WebCore::HTML5Token::type):
+ (WebCore::HTML5Token::name):
+ (WebCore::HTML5Token::selfClosing):
+ (WebCore::HTML5Token::attrs):
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::convertToOldStyle):
+ (WebCore::HTML5Tokenizer::write):
+
+2010-05-18 Tony Chang <tony@chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ REGRESSION: crash in WebCore::CompositeEditCommand::splitTreeToNode when indenting in an empty li
+ https://bugs.webkit.org/show_bug.cgi?id=38232
+
+ Test: editing/execCommand/crash-indenting-list-item.html
+
+ * editing/IndentOutdentCommand.cpp:
+ (WebCore::IndentOutdentCommand::tryIndentingAsListItem):
+ (WebCore::IndentOutdentCommand::indentIntoBlockquote):
+
+2010-05-18 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ ':optional' pseudo selector should not be applied to <keygen> and <progress>
+ https://bugs.webkit.org/show_bug.cgi?id=39292
+
+ Test: fast/css/pseudo-required-optional-unapplied.html
+
+ * html/HTMLKeygenElement.h:
+ (WebCore::HTMLKeygenElement::isOptionalFormControl):
+ Add isOptionalFormControl() returning false.
+ HTMLKeygenElement inherits HTMLSelectElement, which should return true
+ for isOptionalFormControl(). However, <keygen> is not :optional
+ according to the standard.
+ * html/HTMLProgressElement.h:
+ Remove isOptionalFormControl().
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Implement the DOCTYPE states for the HTML5 lexer
+ https://bugs.webkit.org/show_bug.cgi?id=39335
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::nextToken):
+ (WebCore::emitCurrentDoctypeToken):
+ * html/HTML5Lexer.h:
+
+2010-05-18 Tony Chang <tony@chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ [chromium] ignore IME events if the keydown event was prevented
+ https://bugs.webkit.org/show_bug.cgi?id=37692
+
+ A manual test to verify the IME behavior since the existing methods of
+ textInputController test at a lower level than the fix.
+
+ * manual-tests/ime-keydown-preventdefault.html: Added.
+
+2010-05-18 Sam Weinig <sam@webkit.org>
+
+ Fix the build for platforms that don't always include UnusedParam.h
+
+ * dom/Attribute.cpp:
+
+2010-05-18 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Kent Tamura.
+
+ [Chromium] Windows: Determinate progress bar should have glossy overlay
+ https://bugs.webkit.org/show_bug.cgi?id=39269
+
+ - Moved animation code from RenderThemeChromiumWin to chromium tree
+ because it should be behind the theme implementation, which lives
+ in chromium tree.
+ - Passed current time to the bridge, which will be used to compute
+ the state of the theme animation.
+
+ No new tests, animation effect can be confirmed only manually.
+
+ * platform/chromium/ChromiumBridge.h:
+ * rendering/RenderProgress.h:
+ (WebCore::RenderProgress::animationStartTime): Added.
+ * rendering/RenderThemeChromiumWin.cpp:
+ (WebCore::RenderThemeChromiumWin::animationDurationForProgressBar):
+ (WebCore::RenderThemeChromiumWin::paintProgressBar):
+
+2010-05-18 Sam Weinig <sam@webkit.org>
+
+ Fix release build.
+
+ * dom/Attribute.cpp:
+ (WebCore::Attribute::unbindAttr):
+
+2010-05-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Move Attr pointer from Attribute to a global HashMap.
+ https://bugs.webkit.org/show_bug.cgi?id=39337
+ <rdar://problem/8001168>
+
+ Shaves another word off of Attribute.
+
+ * dom/Attr.cpp:
+ (WebCore::Attr::Attr):
+ (WebCore::Attr::~Attr):
+ * dom/Attribute.cpp:
+ (WebCore::attributeAttrMap):
+ (WebCore::Attribute::attr):
+ (WebCore::Attribute::createAttrIfNeeded):
+ (WebCore::Attribute::bindAttr):
+ (WebCore::Attribute::unbindAttr):
+ * dom/Attribute.h:
+ (WebCore::Attribute::Attribute):
+
+2010-05-18 Jakob Petsovits <jpetsovits@rim.com>
+
+ Unreviewed, forgot to svn add source file in r59619.
+ http://trac.webkit.org/changeset/59619
+
+ * platform/image-decoders/openvg: Added.
+ * platform/image-decoders/openvg/ImageDecoderOpenVG.cpp: Added.
+ (WebCore::RGBA32Buffer::asNewNativeImage):
+
+2010-05-18 Yaar Schnitman <yaar@chromium.org>
+
+ Unreviewed, rolling out r59693.
+ http://trac.webkit.org/changeset/59693
+ https://bugs.webkit.org/show_bug.cgi?id=37815
+
+ Broke GTK Release
+
+ * Android.jscbindings.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSCallbackData.cpp:
+ (WebCore::JSCallbackData::invokeCallback):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::InjectedScriptHost::createInjectedScript):
+ * bindings/js/JSMainThreadExecState.cpp: Removed.
+ * bindings/js/JSMainThreadExecState.h: Removed.
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::executeFunctionInContext):
+ (WebCore::ScheduledAction::execute):
+ * bindings/js/ScheduledAction.h:
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld):
+ * bindings/js/ScriptController.h:
+ * bindings/js/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::call):
+ * bindings/objc/ObjCEventListener.mm:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ * bindings/scripts/test/ObjC/DOMTestCallback.mm:
+ (-[DOMTestCallback callbackWithClass1Param:]):
+ (-[DOMTestCallback callbackWithClass2Param:strArg:]):
+ (-[DOMTestCallback callbackWithNonBoolReturnType:]):
+ (-[DOMTestCallback customCallback:class6Param:]):
+ * bindings/scripts/test/ObjC/DOMTestInterface.mm:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj readOnlyIntAttr]):
+ (-[DOMTestObj readOnlyStringAttr]):
+ (-[DOMTestObj readOnlyTestObjAttr]):
+ (-[DOMTestObj intAttr]):
+ (-[DOMTestObj setIntAttr:]):
+ (-[DOMTestObj longLongAttr]):
+ (-[DOMTestObj setLongLongAttr:]):
+ (-[DOMTestObj unsignedLongLongAttr]):
+ (-[DOMTestObj setUnsignedLongLongAttr:]):
+ (-[DOMTestObj stringAttr]):
+ (-[DOMTestObj setStringAttr:]):
+ (-[DOMTestObj testObjAttr]):
+ (-[DOMTestObj setTestObjAttr:]):
+ (-[DOMTestObj attrWithException]):
+ (-[DOMTestObj setAttrWithException:]):
+ (-[DOMTestObj attrWithSetterException]):
+ (-[DOMTestObj setAttrWithSetterException:]):
+ (-[DOMTestObj attrWithGetterException]):
+ (-[DOMTestObj setAttrWithGetterException:]):
+ (-[DOMTestObj customAttr]):
+ (-[DOMTestObj setCustomAttr:]):
+ (-[DOMTestObj scriptStringAttr]):
+ (-[DOMTestObj voidMethod]):
+ (-[DOMTestObj voidMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj intMethod]):
+ (-[DOMTestObj intMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj objMethod]):
+ (-[DOMTestObj objMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgs:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgsAndThrows:objArg:]):
+ (-[DOMTestObj serializedValue:]):
+ (-[DOMTestObj methodWithException]):
+ (-[DOMTestObj customMethod]):
+ (-[DOMTestObj customMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj customArgsAndException:]):
+ (-[DOMTestObj addEventListener:listener:useCapture:]):
+ (-[DOMTestObj removeEventListener:listener:useCapture:]):
+ (-[DOMTestObj withDynamicFrame]):
+ (-[DOMTestObj withDynamicFrameAndArg:]):
+ (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
+ (-[DOMTestObj withDynamicFrameAndUserGesture:]):
+ (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
+ (-[DOMTestObj withScriptStateVoid]):
+ (-[DOMTestObj withScriptStateObj]):
+ (-[DOMTestObj withScriptStateVoidException]):
+ (-[DOMTestObj withScriptStateObjException]):
+ (-[DOMTestObj methodWithOptionalArg:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndOptionalArg:opt:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndTwoOptionalArgs:opt1:opt2:]):
+ * bindings/v8/ScriptController.cpp:
+ * bindings/v8/ScriptController.h:
+ * html/HTMLFrameElementBase.cpp:
+ (WebCore::HTMLFrameElementBase::isURLAllowed):
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Implement comment states for HTML5 lexer
+ https://bugs.webkit.org/show_bug.cgi?id=39334
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::nextToken):
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Move all member variables from MappedAttribute to Attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=39336
+ <rdar://problem/8000853>
+
+ This saves one word because we no longer have any virtual member functions in Attribute, and
+ thus no vtable pointer.
+
+ I plan to remove MappedAttribute altogether in a subsequent commit.
+
+ * Android.mk:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::styleForElement):
+ * dom/Attribute.cpp:
+ (WebCore::Attribute::clone):
+ * dom/Attribute.h:
+ (WebCore::Attribute::create):
+ (WebCore::Attribute::style):
+ (WebCore::Attribute::decl):
+ (WebCore::Attribute::setDecl):
+ (WebCore::Attribute::isMappedAttribute):
+ (WebCore::Attribute::Attribute):
+ * dom/MappedAttribute.cpp: Removed.
+ * dom/MappedAttribute.h:
+ (WebCore::MappedAttribute::create):
+ (WebCore::MappedAttribute::MappedAttribute):
+ (WebCore::toMappedAttribute):
+ * dom/NamedMappedAttrMap.cpp:
+ (WebCore::NamedMappedAttrMap::declCount):
+ (WebCore::NamedMappedAttrMap::mapsEquivalent):
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::attributeChanged):
+ * svg/SVGSVGElement.cpp:
+ (WebCore::updateCSSForAttribute):
+ * svg/SVGStyledElement.cpp:
+ (WebCore::SVGStyledElement::getPresentationAttribute):
+
+2010-05-18 Tony Chang <tony@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24943
+ Command-B and Command-I do not generate keydown events in contentEditable regions.
+
+ * manual-tests/style-keypress-events.html: Added.
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add more state to the HTML5 lexer
+ https://bugs.webkit.org/show_bug.cgi?id=39333
+
+ This code is just transliteration from the spec.
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::HTML5Lexer):
+ (WebCore::HTML5Lexer::nextToken):
+ * html/HTML5Lexer.h:
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Implement two more lexer states
+ https://bugs.webkit.org/show_bug.cgi?id=39298
+
+ No tests because Eric is still working on wiring up the lexer to the
+ test harness.
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::nextToken):
+ (WebCore::HTML5Lexer::emitParseError):
+ (WebCore::HTML5Lexer::emitCurrentTagToken):
+ * html/HTML5Lexer.h:
+
+2010-05-18 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Repro crash with many Google image search results
+ <rdar://problem/7685669> and https://bugs.webkit.org/show_bug.cgi?id=39323
+
+ When an iframe has a plugin resource as its src, that case bypassed the plugin sandboxing checks and continued to load
+ the data for the plugin resource. It handed that data off to a nonexistent Widget, causing a null deref and the crash.
+
+ By replacing PluginDocuments in sandboxes iframes with a new "SinkDocument" that just acts as a data sink, we prevent the
+ crash and also prevent actually loading the plugin binaries.
+
+ I filed https://bugs.webkit.org/show_bug.cgi?id=39330 to follow up and let us cancel the load as soon as we know we should.
+
+ Test: fast/loader/sandboxed-plugin-crash.html
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+
+ * loader/DocumentWriter.cpp:
+ (WebCore::DocumentWriter::begin): If the created document is a PluginDocument and the plugin sandbox flag is set,
+ replace it with a SinkDocument.
+
+ * loader/PluginDocument.h:
+ (WebCore::PluginDocument::isPluginDocument): Make public (it was already public at the Document.h level).
+
+ Add a simple document/tokenizer pair that simply presents a blank HTML document and acts as a data sink for whatever
+ data is handed to it:
+ * loader/SinkDocument.cpp: Added.
+ (WebCore::SinkTokenizer::SinkTokenizer):
+ (WebCore::SinkTokenizer::write):
+ (WebCore::SinkTokenizer::isWaitingForScripts):
+ (WebCore::SinkTokenizer::wantsRawData):
+ (WebCore::SinkTokenizer::writeRawData):
+ (WebCore::SinkTokenizer::stopParsing):
+ (WebCore::SinkTokenizer::finish):
+ (WebCore::SinkDocument::SinkDocument):
+ (WebCore::SinkDocument::createTokenizer):
+ * loader/SinkDocument.h: Added.
+ (WebCore::SinkDocument::create):
+
+2010-05-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39321
+ Reduce the size of ListHashSets used by Document
+ <rdar://problem/7999388>
+
+ Reduce Membuster peak memory usage by ~450K by reducing the pool sizes
+ of the ListHashSets used by Document.
+
+ * dom/Document.cpp:
+ (WebCore::Document::addStyleSheetCandidateNode):
+ (WebCore::Document::recalcStyleSelector):
+ * dom/Document.h:
+
+2010-05-18 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Rubberstamped by Simon Hausmann.
+
+ Return null when creating an ImageBuffer failed, due to for
+ instance a nulled pixmap.
+
+ * platform/graphics/qt/ImageBufferQt.cpp:
+ (WebCore::ImageBufferData::ImageBufferData):
+ (WebCore::ImageBuffer::ImageBuffer):
+
+2010-05-18 Jian Li <jianli@chromium.org>
+
+ Reviewed by Dmitry Titov.
+
+ Fix bug 39285: fast/files/file-reader.html is timing out on all mac bots.
+ https://bugs.webkit.org/show_bug.cgi?id=39285
+
+ The timeout is caused by 59659 that changed the GC timer to 0 and thus
+ triggered a bug in FileReader code. The fix is to add more states so
+ that hasPendingActivity() can do the check correctly.
+
+ * html/FileReader.cpp:
+ (WebCore::FileReader::FileReader):
+ (WebCore::FileReader::hasPendingActivity):
+ (WebCore::FileReader::readInternal):
+ (WebCore::FileReader::terminate):
+ (WebCore::FileReader::didStart):
+ (WebCore::FileReader::didGetSize):
+ (WebCore::FileReader::didRead):
+ (WebCore::FileReader::didFinish):
+ (WebCore::FileReader::didFail):
+ (WebCore::FileReader::readyState):
+ (WebCore::FileReader::result):
+ * html/FileReader.h:
+ (WebCore::FileReader::):
+
+2010-05-18 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Clean up GraphicsLayer naming code
+ https://bugs.webkit.org/show_bug.cgi?id=39316
+
+ Move code that generates a name for the GraphicsLayer (used in debug builds only) into
+ a new nameForLayer() method. Use it when naming the foreground layer.
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::createGraphicsLayer):
+ (WebCore::RenderLayerBacking::updateForegroundLayer):
+ (WebCore::RenderLayerBacking::nameForLayer):
+ * rendering/RenderLayerBacking.h:
+
+2010-05-18 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Moving frame.src checks out of the bindings
+ https://bugs.webkit.org/show_bug.cgi?id=37815
+
+ Moved JavaScript frame.src checks out of bindings and into
+ HTMLFrameElementBase. Added main thread state stack to JavaScriptCore
+ so ExecState is available inside core DOM. Updated affected bindings
+ (except for GObject, which will need to be updated to avoid origin
+ failures inside native code).
+
+ * Android.jscbindings.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSCallbackData.cpp:
+ (WebCore::JSCallbackData::invokeCallback):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::InjectedScriptHost::createInjectedScript):
+ * bindings/js/JSMainThreadExecState.cpp: Added.
+ * bindings/js/JSMainThreadExecState.h: Added.
+ (WebCore::JSMainThreadExecState::currentState):
+ (WebCore::JSMainThreadExecState::call):
+ (WebCore::JSMainThreadExecState::evaluate):
+ (WebCore::JSMainThreadExecState::JSMainThreadExecState):
+ (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
+ (WebCore::JSMainThreadNullState::JSMainThreadNullState):
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::executeFunctionInContext):
+ (WebCore::ScheduledAction::execute):
+ * bindings/js/ScheduledAction.h:
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld):
+ (WebCore::ScriptController::canAccessFromCurrentOrigin):
+ * bindings/js/ScriptController.h:
+ * bindings/js/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::call):
+ * bindings/objc/ObjCEventListener.mm:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ * bindings/scripts/test/ObjC/DOMTestCallback.mm:
+ (-[DOMTestCallback callbackWithClass1Param:]):
+ (-[DOMTestCallback callbackWithClass2Param:strArg:]):
+ (-[DOMTestCallback callbackWithNonBoolReturnType:]):
+ (-[DOMTestCallback customCallback:class6Param:]):
+ * bindings/scripts/test/ObjC/DOMTestInterface.mm:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj readOnlyIntAttr]):
+ (-[DOMTestObj readOnlyStringAttr]):
+ (-[DOMTestObj readOnlyTestObjAttr]):
+ (-[DOMTestObj intAttr]):
+ (-[DOMTestObj setIntAttr:]):
+ (-[DOMTestObj longLongAttr]):
+ (-[DOMTestObj setLongLongAttr:]):
+ (-[DOMTestObj unsignedLongLongAttr]):
+ (-[DOMTestObj setUnsignedLongLongAttr:]):
+ (-[DOMTestObj stringAttr]):
+ (-[DOMTestObj setStringAttr:]):
+ (-[DOMTestObj testObjAttr]):
+ (-[DOMTestObj setTestObjAttr:]):
+ (-[DOMTestObj attrWithException]):
+ (-[DOMTestObj setAttrWithException:]):
+ (-[DOMTestObj attrWithSetterException]):
+ (-[DOMTestObj setAttrWithSetterException:]):
+ (-[DOMTestObj attrWithGetterException]):
+ (-[DOMTestObj setAttrWithGetterException:]):
+ (-[DOMTestObj customAttr]):
+ (-[DOMTestObj setCustomAttr:]):
+ (-[DOMTestObj scriptStringAttr]):
+ (-[DOMTestObj voidMethod]):
+ (-[DOMTestObj voidMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj intMethod]):
+ (-[DOMTestObj intMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj objMethod]):
+ (-[DOMTestObj objMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgs:objArg:]):
+ (-[DOMTestObj methodThatRequiresAllArgsAndThrows:objArg:]):
+ (-[DOMTestObj serializedValue:]):
+ (-[DOMTestObj methodWithException]):
+ (-[DOMTestObj customMethod]):
+ (-[DOMTestObj customMethodWithArgs:strArg:objArg:]):
+ (-[DOMTestObj customArgsAndException:]):
+ (-[DOMTestObj addEventListener:listener:useCapture:]):
+ (-[DOMTestObj removeEventListener:listener:useCapture:]):
+ (-[DOMTestObj withDynamicFrame]):
+ (-[DOMTestObj withDynamicFrameAndArg:]):
+ (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
+ (-[DOMTestObj withDynamicFrameAndUserGesture:]):
+ (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
+ (-[DOMTestObj withScriptStateVoid]):
+ (-[DOMTestObj withScriptStateObj]):
+ (-[DOMTestObj withScriptStateVoidException]):
+ (-[DOMTestObj withScriptStateObjException]):
+ (-[DOMTestObj methodWithOptionalArg:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndOptionalArg:opt:]):
+ (-[DOMTestObj methodWithNonOptionalArgAndTwoOptionalArgs:opt1:opt2:]):
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::canAccessFromCurrentOrigin):
+ * bindings/v8/ScriptController.h:
+ * html/HTMLFrameElementBase.cpp:
+ (WebCore::HTMLFrameElementBase::isURLAllowed):
+
+2010-05-18 Drew Wilson <atwilson@chromium.org>
+
+ Unreviewed: Speculative build fix for Chromium win.
+
+ * platform/graphics/skia/SkiaFontWin.cpp: Properly set inlineCapacity.
+
+2010-05-18 Drew Wilson <atwilson@chromium.org>
+
+ Unreviewed fix for Chromium build break.
+
+ * platform/graphics/skia/SkiaFontWin.cpp: Now set inlineCapacity param.
+
+2010-05-18 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by Darin Adler, Jian Li.
+
+ DragData::asURL() shouldn't do file validity checks
+ https://bugs.webkit.org/show_bug.cgi?id=38711
+
+ There's no point to trying to make sure the file is valid in
+ DragData::asURL(). It's better to ask for forgiveness than to ask for
+ permission, since asking for permission is prone to race conditions
+ and results in unnecessary I/O. Consumers of this function either:
+ - need to verify the file exists themselves (e.g. the loader)
+ - don't care about file validity (rich text drag-and-drop)
+
+ * platform/chromium/DragDataChromium.cpp:
+ (WebCore::DragData::asURL):
+
+2010-05-18 Timothy Hatcher <timothy@apple.com>
+
+ Fix a handful of various localization issues in the Web Inspector.
+
+ * Localize strings that where not localized.
+ * Make WebInspector.UIString work without bind.
+ * Always pass WebInspector.UIString to Number.secondsToString and Number.bytesToString.
+ * Never pass a variable to WebInspector.UIString, since that prevents auto-generation.
+ * Use an ellipsis instead of three periods.
+
+ https://webkit.org/b/39303
+ rdar://problem/7997101
+
+ Reviewed by Adam Roben.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/AuditRules.js:
+ (WebInspector.AuditRules.GzipRule.prototype.doRun):
+ (WebInspector.AuditRules.CookieSizeRule.prototype.processCookies):
+ (WebInspector.AuditRules.StaticCookielessRule.prototype.processCookies):
+ * inspector/front-end/ConsoleView.js:
+ (WebInspector.ConsoleView):
+ * inspector/front-end/ImageView.js:
+ (WebInspector.ImageView.prototype.contentTabSelected):
+ * inspector/front-end/ProfileDataGridTree.js:
+ (WebInspector.ProfileDataGridNode.prototype.get data.formatMilliseconds):
+ (WebInspector.ProfileDataGridNode.prototype.get data):
+ * inspector/front-end/ResourcesPanel.js:
+ (WebInspector.ResourceTimeCalculator.prototype.formatValue):
+ (WebInspector.ResourceTransferTimeCalculator.prototype.formatValue):
+ (WebInspector.ResourceTransferDurationCalculator.prototype.formatValue):
+ (WebInspector.ResourceTransferSizeCalculator.prototype.formatValue):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._registerShortcuts):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame.prototype._contextMenu):
+ * inspector/front-end/TimelineOverviewPane.js:
+ (WebInspector.TimelineOverviewCalculator):
+ (WebInspector.TimelineOverviewCalculator.prototype.formatValue):
+ * inspector/front-end/TimelinePanel.js:
+ (WebInspector.TimelinePanel):
+ (WebInspector.TimelineCalculator):
+ (WebInspector.TimelineCalculator.prototype.formatValue):
+ (WebInspector.TimelinePanel.FormattedRecord.prototype._generateAggregatedInfo):
+ (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent):
+ (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails):
+ (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendTextRow):
+ (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendElementRow):
+ * inspector/front-end/inspector.js:
+ (WebInspector.loaded):
+ (WebInspector.setRecordingProfile):
+ (WebInspector.UIString):
+
+2010-05-18 Sam Weinig <sam@webkit.org>
+
+ Another attempt to fix the build.
+
+ * css/CSSCursorImageValue.cpp:
+
+2010-05-18 Adam Roben <aroben@apple.com>
+
+ Make accelerated compositing work on machines that don't support
+ hardware vertex processing
+
+ Fixes <http://webkit.org/b/39299> <rdar://problem/7997692> Accelerated
+ compositing on Windows doesn't work on machines that don't support
+ hardware vertex processing, but should
+
+ Reviewed by Eric Carlson.
+
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ (WebCore::WKCACFLayerRenderer::createRenderer): Query the device
+ capabilities to decide whether to request hardware or software vertex
+ processing.
+
+2010-05-18 Adam Roben <aroben@apple.com>
+
+ Make WKCACFLayerRenderer robust against temporary failure of
+ Direct3DCreate9 and IDirect3D9::CreateDevice
+
+ For a short time after waking from sleep, Direct3DCreate9() will
+ return an IDirect3D9 for which IDirect3D9::CreateDevice will always
+ fail. Also during this time period, IDirect3D9::CreateDevice
+ will fail even for non-bad IDirect3D9s. (It will later start
+ succeeding.) WKCACFLayerRenderer now works around this behavior by
+ detecting when it might be in this situation and calling these
+ functions again later.
+
+ Fixes <http://webkit.org/b/39297> <rdar://problem/7997431> WebView
+ doesn't repaint until page reloads when page using hardware
+ acceleration loads just after waking from sleep
+
+ Reviewed by John Sullivan.
+
+ * manual-tests/crash-and-no-repaint-after-wake-from-sleep.html:
+ Renamed from WebCore/manual-tests/crash-after-wake-from-sleep.html.
+ Modified to also include instructions for reproducing this bug.
+
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Replaced
+ m_triedToCreateD3DRenderer with m_mightBeAbleToCreateDeviceLater. The
+ new member is initialized to true, since we haven't even tried to
+ create a device once yet.
+ (WebCore::WKCACFLayerRenderer::createRenderer): If we already have a
+ D3D device, or we don't have one and are sure that we won't be able to
+ create one later, just return the previously-created device, if any.
+ We assume that we won't be able to create a device later if this
+ function fails, unless the function fails due to CreateDevice failing.
+ As noted above, CreateDevice will sometimes temporarily fail and then
+ later start working again. When CreateDevice fails, we also assume
+ that we might have a bad IDirect3D9, so we get rid of the one we have
+ so a new (and hopefully non-bad) one will be allocated later.
+ (WebCore::WKCACFLayerRenderer::destroyRenderer): Reset
+ m_mightBeAbleToCreateDeviceLater to true, since we no longer have a
+ device.
+ (WebCore::WKCACFLayerRenderer::paint): Before trying to paint, try to
+ create our D3D device and renderer. If this fails, we bail out, but if
+ we think we might be able to create a device later we schedule another
+ paint (via renderSoon()) so that we'll try again soon.
+
+ * platform/graphics/win/WKCACFLayerRenderer.h: Replaced
+ m_triedToCreateD3DRenderer with m_mightBeAbleToCreateDeviceLater.
+
+2010-05-18 Adam Roben <aroben@apple.com>
+
+ Fix a crash when a page that uses accelerated compositing loads soon
+ after the computer wakes from sleep
+
+ The set-up:
+
+ For a short time after waking from sleep, IDirect3D9::CreateDevice
+ will fail. This caused WKCACFLayerRenderer::createRenderer to fail,
+ and meant that WKCACFLayerRenderer never allocated a root layer.
+ WebView wouldn't notice that createRenderer failed, and would go ahead
+ and try to use the root layer anyway, resulting in a crash.
+
+ The fix:
+
+ We now allocate the root layer (and all the other members of
+ WKCACFLayerRenderer that aren't dependent on having an
+ IDirect3DDevice9) in WKCACFLayerRenderer's constructor. This way the
+ layers will always be present, even when creating the D3D device
+ fails.
+
+ There are two remaining problems:
+ 1) This results in slightly more memory usage in the case where
+ CreateDevice fails.
+ 2) Once we get into this bad state, the WebView doesn't repaint
+ until we navigate somewhere else.
+
+ (2) is covered by
+ <http://webkit.org/b/39297>/<rdar://problem/7997431>. We'll fix it by
+ retrying CreateDevice later in hopes that it will succeed after more
+ time has passed. This will in turn fix (1). (We should never end up in
+ a case where CreateDevice fails forever because we already did some
+ preliminary checks in acceleratedCompositingAvailable().)
+
+ Fixes <http://webkit.org/b/39295> <rdar://problem/7971319> Crash
+ (preceded by assertion) in WKCACFLayerRenderer::setNeedsDisplay when
+ computer wakes from sleep on particular page
+
+ Reviewed by John Sullivan.
+
+ * manual-tests/crash-after-wake-from-sleep.html: Added. This
+ is the Poster Circle demo from webkit.org/blog, but modified to
+ automatically reload every 5 seconds and with instructions to put the
+ computer to sleep and wake it up again.
+
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Moved code to
+ initialize m_context, m_renderContext, and m_*Layer here...
+ (WebCore::WKCACFLayerRenderer::createRenderer): ...from here.
+
+2010-05-18 Adam Roben <aroben@apple.com>
+
+ Remove an unused member variable from WKCACFLayerRenderer
+
+ Rubber-stamped by Ada Chan.
+
+ * platform/graphics/win/WKCACFLayerRenderer.h: Removed m_viewLayer,
+ which is unused.
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Allocate the m_preloads list hash set dynamically and free it when done.
+ https://bugs.webkit.org/show_bug.cgi?id=39309
+ <rdar://problem/7998495>
+
+ This saves about 6000 bytes on a fully loaded document.
+
+ * loader/DocLoader.cpp:
+ (WebCore::DocLoader::requestPreload):
+ (WebCore::DocLoader::clearPreloads):
+ * loader/DocLoader.h:
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Revert unintended indentation and unnecessary nested name specifier.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::clipOutPositionedObjects):
+ (WebCore::RenderBlock::insertPositionedObject):
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set.
+ https://bugs.webkit.org/show_bug.cgi?id=39304
+ <rdar://problem/7998366>
+
+ Set the inlineCapacity for the positionedObjects ListHashSet to 4 instead of 256. Since a RenderBlock usually has
+ few positioned objects, this saves memory.
+
+ * WebCore.base.exp:
+ * rendering/RenderBlock.cpp:
+ (WebCore::clipOutPositionedObjects):
+ (WebCore::RenderBlock::insertPositionedObject):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::positionedObjects):
+
+2010-05-17 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39258
+ Remove NamedAttrMap residual gunk
+
+ Replace NamedAttrMap.h/cpp with NamedNodeMap.h/cpp which was the class
+ it contained.
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/v8/custom/V8NamedNodesCollection.cpp:
+ * dom/NamedAttrMap.cpp: Removed.
+ * dom/NamedAttrMap.h: Removed.
+ * dom/NamedNodeMap.cpp: Copied from dom/NamedAttrMap.cpp.
+ * dom/NamedNodeMap.h: Replaced with dom/NamedAttrMap.h.
+ * editing/ReplaceNodeWithSpanCommand.cpp:
+ * platform/chromium/ClipboardChromium.cpp:
+
+2010-05-18 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Eric Carlson.
+
+ <rdar://problem/7993468> REGRESSION (r58586): Audio doesn't play on first click of play button at NPR.org
+
+ NPR swallows the first mouse click on the play button, calls load() on the element, then waits for the
+ canplay event to come in before calling play itself.
+
+ After the site specific hack added in r58586, we disallowed play() from within the canplay event handler.
+ By tracking whether a load() was triggered by a user gesture, we can differentiate between the original
+ canplay event that we meant to ignore and the one resulting from the first mouse click which we want to honor.
+
+ No new tests. (Currently no way to test such site specific hack behavior)
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::HTMLMediaElement):
+ (WebCore::HTMLMediaElement::load): Set the m_loadInitiatedByUserGesture flag
+ (WebCore::HTMLMediaElement::play): Only apply the site specific hack if the load wasn't initiated by a user gesture.
+ * html/HTMLMediaElement.h:
+
+2010-05-18 Jakob Petsovits <jpetsovits@rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ [OpenVG] Fix stupid build errors from the OpenVG Path commit
+ https://bugs.webkit.org/show_bug.cgi?id=39228
+
+ * platform/graphics/openvg/PainterOpenVG.cpp:
+ (WebCore::PainterOpenVG::clipPath):
+ * platform/graphics/openvg/PathOpenVG.cpp:
+ (WebCore::Path::transform):
+
+2010-05-18 Chris Jerdonek <cjerdonek@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Refactored FrameLoader::isDocumentSandboxed() from a private member function
+ to a static, non-member, non-friend function.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39157
+
+ Making this function non-private lets us make FrameLoader::createWindow()
+ a non-member function in a subsequent patch. We also made it non-member
+ rather than member to increase encapsulation and limit the number of
+ public functions with access to private FrameLoader data.
+
+ No new functionality, so no new tests.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::isDocumentSandboxed):
+ - Moved this function from a private member function of FrameLoader
+ to a static, non-member, non-friend function.
+ (WebCore::FrameLoader::createWindow):
+ - Updated the call to isDocumentSandboxed().
+ (WebCore::FrameLoader::submitForm):
+ - Updated the call to isDocumentSandboxed().
+ (WebCore::FrameLoader::requestObject):
+ - Updated the call to isDocumentSandboxed().
+ (WebCore::FrameLoader::shouldAllowNavigation):
+ - Updated the call to isDocumentSandboxed().
+ * loader/FrameLoader.h:
+ - Removed isDocumentSandboxed() and added a FIXME to move
+ createWindow() out of the FrameLoader class.
+
+2010-05-08 Robert Hogan <robert@roberthogan.net>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix http/tests/xmlhttprequest/cross-origin-no-authorization.html
+ and http/tests/xmlhttprequest/cross-origin-authorization.html
+
+ QHttpNetworkRequest adds Authorization and Cookie headers to XHRs
+ without knowing if this is valid behaviour or not. In order to allow
+ Qt to decide whether Cookie/Authorization headers should be added
+ to an XHR QtWebKit needs to use an attribute added to QNetworkRequest.
+ These new attributes are: QNetworkRequest::CookieLoadControlAttribute,
+ QNetworkRequest::CookieSaveControlAttribute,and
+ QNetworkRequest::AuthenticationReuseControlAttribute.
+
+ QtWebKit will set QNetworkRequest::AuthenticationReuseControlAttribute to false
+ unless withCredentials is set to true in the XHR.
+
+ QtWebkit will set CookieLoad/SaveControlAttribute to false unless withCredentials
+ is set to true in the XHR.
+
+ Qt will pass the values onto QHttpNetworkRequest and this will permit
+ the Qt network access processing to decide whether or not to add either
+ or both of the Cookie/Authorisation headers, and whether to save cookies
+ returned from such requests. By default the attribute
+ will always be true so unless QtWebKit sets it to false normal
+ header processing is unaffected.
+
+ The Qt part of these changes was merged at: http://gitorious.org/qt/qt/merge_requests/592
+
+ https://bugs.webkit.org/show_bug.cgi?id=32967
+
+ * platform/network/qt/ResourceRequestQt.cpp:
+ (WebCore::ResourceRequest::toNetworkRequest):
+
+2010-05-18 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Implementing clipToImageBuffer for Qt port.
+ https://bugs.webkit.org/show_bug.cgi?id=24289
+
+ The implementation combines pixmap layers and destinationIn
+ composition mode.
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::TransparencyLayer::TransparencyLayer):
+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+ (WebCore::GraphicsContext::savePlatformState):
+ (WebCore::GraphicsContext::restorePlatformState):
+ (WebCore::GraphicsContext::inTransparencyLayer):
+ (WebCore::GraphicsContext::beginTransparencyLayer):
+ (WebCore::GraphicsContext::endTransparencyLayer):
+ (WebCore::GraphicsContext::clipToImageBuffer):
+
+2010-05-18 Eric Seidel <eric@webkit.org>
+
+ Unreviewed build fix.
+
+ Make it possible to enable the new HTML5Tokenizer for testing
+ https://bugs.webkit.org/show_bug.cgi?id=39275
+
+ * WebCore.gypi:
+ - Fix HTMLLexer.* -> HTML5Lexer.*
+ * WebCore.vcproj/WebCore.vcproj:
+ - Add HTML5Lexer and HTML5Tokenizer to project.
+
+2010-05-18 Eric Seidel <eric@webkit.org>
+
+ Unreviewed build fix.
+
+ Make it possible to enable the new HTML5Tokenizer for testing
+ https://bugs.webkit.org/show_bug.cgi?id=39275
+
+ * dom/NamedAttrMap.cpp:
+ (WebCore::NamedNodeMap::setNamedItemNS):
+ - Move this to the .cpp file so as to avoid needing to include "Node.h" in the header.
+ * dom/NamedAttrMap.h:
+ * html/HTML5Token.h:
+ - Remove #include "String.h" which was wrong. Adam meant "PlatformString.h"
+ - Remove unneeded #include "Node.h", it was only needed because
+ NamedAttrMap.h was incorrectly depending on Node.h but not
+ including it. It didn't actually need Node.h except for one
+ inlined method setNamedItemNS, so I moved setNamedItemNS into
+ the .cpp to get rid of the Node.h requirement.
+
+2010-05-18 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Make it possible to enable the new HTML5Tokenizer for testing
+ https://bugs.webkit.org/show_bug.cgi?id=39275
+
+ I added html5ParserEnabled to Settings so that we can enable/disable
+ the HTML5 parser for testing.
+
+ I also ripped out a bunch of dead code from HTML5Lexer.
+
+ I had to add HTML5Lexer/HTML5Tokenizer to all build systems so that
+ the build wouldn't fail now that we reference these classes from HTMLDocument.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::reset):
+ (WebCore::isWhitespace):
+ (WebCore::HTML5Lexer::nextToken):
+ * html/HTML5Lexer.h:
+ * html/HTML5Tokenizer.cpp: Added.
+ (WebCore::HTML5Tokenizer::HTML5Tokenizer):
+ (WebCore::HTML5Tokenizer::~HTML5Tokenizer):
+ (WebCore::HTML5Tokenizer::begin):
+ (WebCore::HTML5Tokenizer::write):
+ (WebCore::HTML5Tokenizer::end):
+ (WebCore::HTML5Tokenizer::finish):
+ (WebCore::HTML5Tokenizer::isWaitingForScripts):
+ * html/HTML5Tokenizer.h: Added.
+ * html/HTMLDocument.cpp:
+ (WebCore::HTMLDocument::createTokenizer):
+ * html/HTMLTokenizer.h:
+ * html/HTMLViewSourceDocument.cpp:
+ (WebCore::HTMLViewSourceDocument::createTokenizer):
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+ * page/Settings.h:
+ (WebCore::Settings::setHTML5ParserEnabled):
+ (WebCore::Settings::html5ParserEnabled):
+
+2010-05-18 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ Attempt to fix build for v8 bindings (untested).
+
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::clearWindowShell):
+ * bindings/v8/ScriptController.h:
+
+2010-05-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ GC more promptly when navigating to a new inner window, but not at all when it went in the page cache
+ https://bugs.webkit.org/show_bug.cgi?id=39254
+ <rdar://problem/7996370>
+
+ ~1% PLT speedup
+ ~4% iBench HTML speedup
+
+ * bindings/js/GCController.cpp:
+ (WebCore::GCController::garbageCollectSoon): Change back to a 0 delay timer instead of
+ 0.5 second.
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::clearWindowShell): Add a new boolean parameter. Don't
+ garbageColectSoon if the page is going into the page cache.
+ * bindings/js/ScriptController.h: Prototype change for above.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::clear): Indicate when the page is going into the page cache.
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add an HTML5Token
+ https://bugs.webkit.org/show_bug.cgi?id=39274
+
+ The token object is an ugly fake union, but I'm sure sure there's a
+ better way... Eric needs this to provide output for the test harness.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::HTML5Lexer):
+ (WebCore::HTML5Lexer::write):
+ (WebCore::HTML5Lexer::emitCharacter):
+ * html/HTML5Lexer.h:
+ * html/HTML5Token.h: Added.
+ (WebCore::HTML5Token::):
+ (WebCore::HTML5Token::HTML5Token):
+ (WebCore::HTML5Token::setToCharacter):
+
+2010-05-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Implement ScriptData states for HTML5Lexer
+ https://bugs.webkit.org/show_bug.cgi?id=39273
+
+ This patch implements more of the lexer states according to the HTML5
+ specification. Currently, this code is compiled by not tested. We're
+ working on bringing up a test harness in parallel with transliterating
+ the spec into code.
+
+ * html/HTML5Lexer.cpp:
+ (WebCore::HTML5Lexer::tokenize):
+ (WebCore::HTML5Lexer::temporaryBufferIs):
+ * html/HTML5Lexer.h:
+ (WebCore::HTML5Lexer::):
+
+2010-05-17 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Rename HTML5Tokenzier to HTML5Lexer so that we can add a new HTML5Tokenizer which implements Tokenizer
+ https://bugs.webkit.org/show_bug.cgi?id=39272
+
+ Strictly a rename, no functionality change.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTML5Lexer.cpp: Added.
+ * html/HTML5Lexer.h: Added.
+ * html/HTML5Tokenizer.cpp: Removed.
+ * html/HTML5Tokenizer.h: Removed.
+
+2010-05-17 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r59652.
+ http://trac.webkit.org/changeset/59652
+ https://bugs.webkit.org/show_bug.cgi?id=39268
+
+ file-input-files-access test is broken on Mac (Requested by
+ dcheng on #webkit).
+
+ * platform/chromium/DragDataChromium.cpp:
+ (WebCore::DragData::asURL):
+
+2010-05-17 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Implement RAWTEXT tokenizer states
+ https://bugs.webkit.org/show_bug.cgi?id=39267
+
+ More tokenizer states. There's a bunch of functionality notImplemented
+ that we'll come back to.
+
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::HTML5Tokenizer::tokenize):
+ * html/HTML5Tokenizer.h:
+
+2010-05-17 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Implement more parser states in HTML5Tokenizer
+ https://bugs.webkit.org/show_bug.cgi?id=39265
+
+ This patch implements some easy states. I'll come back and do the
+ harder states later.
+
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::HTML5Tokenizer::tokenize):
+ (WebCore::HTML5Tokenizer::emitParseError):
+ * html/HTML5Tokenizer.h:
+
+2010-05-17 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ DragData::asURL() shouldn't do file validity checks
+ https://bugs.webkit.org/show_bug.cgi?id=38711
+
+ There's no point to trying to make sure the file is valid in
+ DragData::asURL(). It's better to ask for forgiveness than to ask for
+ permission, since asking for permission is prone to race conditions
+ and results in unnecessary I/O. Consumers of this function either:
+ - need to verify the file exists themselves (e.g. the loader)
+ - don't care about file validity (rich text drag-and-drop)
+
+ * platform/chromium/DragDataChromium.cpp:
+ (WebCore::DragData::asURL):
+
+2010-05-17 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Update states in HTML5Tokenizer to match HTML5 spec
+ https://bugs.webkit.org/show_bug.cgi?id=39264
+
+ I've also implemented the DataState. More states to follow.
+
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::HTML5Tokenizer::reset):
+ (WebCore::HTML5Tokenizer::tokenize):
+ * html/HTML5Tokenizer.h:
+ (WebCore::HTML5Tokenizer::):
+
+2010-05-17 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ ':valid' CSS selector should not be applied to some form controls
+ https://bugs.webkit.org/show_bug.cgi?id=39162
+
+ * html/HTMLElement.cpp:
+ (WebCore::inlineTagList): Always includes progressTag. This change is
+ needed in a case of no ENABLE_PROGRESS_TAG. Without this change and
+ ENABLE_PROGRESS_TAG, <progress> tags disappear.
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::recalcWillValidate):
+ Return false for SUBMIT and IMAGE.
+ * html/HTMLProgressElement.h:
+ (WebCore::HTMLProgressElement::recalcWillValidate):
+ Return false. This change is needed in a case of ENABLE_PROGRESS_TAG.
+
+2010-05-17 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove load-related code from HTML5Tokenizer
+ https://bugs.webkit.org/show_bug.cgi?id=39263
+
+ This code is related to reloading resources and not to tokenizing. In
+ the PreloadScanner, these concerns are coupled, but we want to decouple
+ them.
+
+ * html/HTML5Tokenizer.cpp:
+ (WebCore::HTML5Tokenizer::HTML5Tokenizer):
+ (WebCore::HTML5Tokenizer::~HTML5Tokenizer):
+ (WebCore::HTML5Tokenizer::begin):
+ (WebCore::HTML5Tokenizer::end):
+ (WebCore::HTML5Tokenizer::reset):
+ (WebCore::HTML5Tokenizer::write):
+ (WebCore::HTML5Tokenizer::consumeEntity):
+ (WebCore::HTML5Tokenizer::tokenize):
+ (WebCore::HTML5Tokenizer::processAttribute):
+ (WebCore::HTML5Tokenizer::emitCharacter):
+ (WebCore::HTML5Tokenizer::emitTag):
+ * html/HTML5Tokenizer.h:
+
+2010-05-17 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add HTML5Tokenizer to the build system on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=39262
+
+ This file will be easier to work with if we're actually compiling it.
+ Hopefully we'll get this wired into the PreloadScanner soon. Once we
+ start actually calling the code, we'll add it to the build system on
+ other platforms.
+
+ * WebCore.xcodeproj/project.pbxproj:
+
+2010-05-17 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Copy PreloadScanner.* to HTML5Tokenizer.* to start work on the new HTML5 Tokenizer
+ https://bugs.webkit.org/show_bug.cgi?id=39261
+
+ * html/HTML5Tokenizer.cpp: Rename PreloadScanner to HTML5Tokenizer.
+ * html/HTML5Tokenizer.h: ditto.
+
+2010-05-17 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Copy PreloadScanner.* to HTML5Tokenizer.* to start work on the new HTML5 Tokenizer
+ https://bugs.webkit.org/show_bug.cgi?id=39261
+
+ This time copy the cpp from the right file.
+
+ * html/HTML5Tokenizer.cpp: Copied from WebCore/html/PreloadScanner.cpp.
+
+2010-05-17 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Copy PreloadScanner.* to HTML5Tokenizer.* to start work on the new HTML5 Tokenizer
+ https://bugs.webkit.org/show_bug.cgi?id=39261
+
+ * html/HTML5Tokenizer.cpp: Copied from WebCore/html/PreloadScanner.h.
+ * html/HTML5Tokenizer.h: Copied from WebCore/html/PreloadScanner.h.
+
2010-05-17 MORITA Hajime <morrita@google.com>
Reviewed by Kent Tamura.
diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig
index 947f371..c64d94c 100644
--- a/WebCore/Configurations/FeatureDefines.xcconfig
+++ b/WebCore/Configurations/FeatureDefines.xcconfig
@@ -47,6 +47,7 @@ ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
ENABLE_DATABASE = ENABLE_DATABASE;
ENABLE_DATAGRID = ;
ENABLE_DATALIST = ENABLE_DATALIST;
+ENABLE_DEVICE_ORIENTATION = ;
ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
ENABLE_FILTERS = ENABLE_FILTERS;
@@ -78,4 +79,4 @@ ENABLE_XHTMLMP = ;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/WebCore/Configurations/Version.xcconfig b/WebCore/Configurations/Version.xcconfig
index daa79a9..6f999af 100644
--- a/WebCore/Configurations/Version.xcconfig
+++ b/WebCore/Configurations/Version.xcconfig
@@ -22,7 +22,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MAJOR_VERSION = 534;
-MINOR_VERSION = 0;
+MINOR_VERSION = 1;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/WebCore/Configurations/WebCore.xcconfig b/WebCore/Configurations/WebCore.xcconfig
index b9b37fd..a918146 100644
--- a/WebCore/Configurations/WebCore.xcconfig
+++ b/WebCore/Configurations/WebCore.xcconfig
@@ -43,10 +43,8 @@ PRODUCT_NAME = WebCore;
OTHER_LDFLAGS = -l$(SQLITE3_LIBRARY) -lobjc -sub_library libobjc -umbrella WebKit $(WEBKIT2_LDFLAGS);
WEBKIT2_LDFLAGS = $(WEBKIT2_LDFLAGS_$(TARGET_MAC_OS_X_VERSION_MAJOR));
-WEBKIT2_LDFLAGS_1060 = $(WEBKIT2_LDFLAGS_$(CONFIGURATION));
-WEBKIT2_LDFLAGS_1070 = $(WEBKIT2_LDFLAGS_$(CONFIGURATION));
-WEBKIT2_LDFLAGS_Release = -allowable_client WebKit2;
-WEBKIT2_LDFLAGS_Debug = -allowable_client WebKit2;
+WEBKIT2_LDFLAGS_1060 = -allowable_client WebKit2;
+WEBKIT2_LDFLAGS_1070 = $(WEBKIT2_LDFLAGS_1060);
JAVASCRIPTCORE_PRIVATE_HEADERS_DIR = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION));
JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Release = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering);
diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp
index 38f9e10..3372972 100644
--- a/WebCore/DerivedSources.cpp
+++ b/WebCore/DerivedSources.cpp
@@ -69,6 +69,7 @@
#include "JSDataGridColumn.cpp"
#include "JSDataGridColumnList.cpp"
#include "JSDedicatedWorkerContext.cpp"
+#include "JSDeviceOrientationEvent.cpp"
#include "JSDocument.cpp"
#include "JSDocumentFragment.cpp"
#include "JSDocumentType.cpp"
@@ -78,6 +79,7 @@
#include "JSDOMImplementation.cpp"
#include "JSDOMParser.cpp"
#include "JSDOMSelection.cpp"
+#include "JSDOMStringList.cpp"
#include "JSDOMWindow.cpp"
#include "JSElement.cpp"
#include "JSEntity.cpp"
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index 814db0b..e2a1ad7 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -113,10 +113,12 @@ DOM_CLASSES = \
DOMImplementation \
DOMParser \
DOMSelection \
+ DOMStringList \
DOMWindow \
Database \
DatabaseCallback \
DatabaseSync \
+ DeviceOrientationEvent \
Document \
DocumentFragment \
DocumentType \
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index f15a8f7..f6ed609 100644
--- a/WebCore/English.lproj/localizedStrings.js
+++ b/WebCore/English.lproj/localizedStrings.js
Binary files differ
diff --git a/WebCore/ForwardingHeaders/runtime/JSObjectWithGlobalObject.h b/WebCore/ForwardingHeaders/runtime/JSObjectWithGlobalObject.h
new file mode 100644
index 0000000..2f49b16
--- /dev/null
+++ b/WebCore/ForwardingHeaders/runtime/JSObjectWithGlobalObject.h
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_JSObjectWithGlobalObject_h
+#define WebCore_FWD_JSObjectWithGlobalObject_h
+#include <JavaScriptCore/JSObjectWithGlobalObject.h>
+#endif
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 5e0a126..e7cb038 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -51,6 +51,7 @@ webcore_cppflags += \
-I$(srcdir)/WebCore/platform/network \
-I$(srcdir)/WebCore/platform/sql \
-I$(srcdir)/WebCore/platform/text \
+ -I$(srcdir)/WebCore/platform/text/transcoder \
-I$(srcdir)/WebCore/plugins \
-I$(srcdir)/WebCore/rendering \
-I$(srcdir)/WebCore/rendering/style \
@@ -138,6 +139,8 @@ IDL_BINDINGS += \
Webcore/dom/CustomEvent.idl \
WebCore/dom/DOMCoreException.idl \
WebCore/dom/DOMImplementation.idl \
+ WebCore/dom/DOMStringList.idl \
+ WebCore/dom/DeviceOrientationEvent.idl \
WebCore/dom/Document.idl \
WebCore/dom/DocumentFragment.idl \
WebCore/dom/DocumentType.idl \
@@ -467,6 +470,8 @@ webcore_sources += \
WebCore/bindings/js/JSLazyEventListener.h \
WebCore/bindings/js/JSLocationCustom.cpp \
WebCore/bindings/js/JSLocationCustom.h \
+ WebCore/bindings/js/JSMainThreadExecState.cpp \
+ WebCore/bindings/js/JSMainThreadExecState.h \
WebCore/bindings/js/JSMessageChannelConstructor.cpp \
WebCore/bindings/js/JSMessageChannelConstructor.h \
WebCore/bindings/js/JSMessageChannelCustom.cpp \
@@ -760,11 +765,19 @@ webcore_sources += \
WebCore/dom/ContainerNode.cpp \
WebCore/dom/ContainerNode.h \
WebCore/dom/ContainerNodeAlgorithms.h \
+ WebCore/dom/CrossThreadTask.h \
WebCore/dom/CustomEvent.cpp \
WebCore/dom/CustomEvent.h \
WebCore/dom/DOMCoreException.h \
WebCore/dom/DOMImplementation.cpp \
WebCore/dom/DOMImplementation.h \
+ WebCore/dom/DOMStringList.cpp \
+ WebCore/dom/DOMStringList.h \
+ WebCore/dom/DeviceOrientation.cpp \
+ WebCore/dom/DeviceOrientation.h \
+ WebCore/dom/DeviceOrientationClient.h \
+ WebCore/dom/DeviceOrientationEvent.cpp \
+ WebCore/dom/DeviceOrientationEvent.h \
WebCore/dom/Document.cpp \
WebCore/dom/Document.h \
WebCore/dom/DocumentFragment.cpp \
@@ -801,8 +814,6 @@ webcore_sources += \
WebCore/dom/InputElement.h \
WebCore/dom/KeyboardEvent.cpp \
WebCore/dom/KeyboardEvent.h \
- WebCore/dom/MappedAttribute.cpp \
- WebCore/dom/MappedAttribute.h \
WebCore/dom/MappedAttributeEntry.h \
WebCore/dom/MessageChannel.cpp \
WebCore/dom/MessageChannel.h \
@@ -820,10 +831,7 @@ webcore_sources += \
WebCore/dom/MutationEvent.h \
WebCore/dom/NameNodeList.cpp \
WebCore/dom/NameNodeList.h \
- WebCore/dom/NamedAttrMap.cpp \
- WebCore/dom/NamedAttrMap.h \
- WebCore/dom/NamedMappedAttrMap.cpp \
- WebCore/dom/NamedMappedAttrMap.h \
+ WebCore/dom/NamedNodeMap.cpp \
WebCore/dom/NamedNodeMap.h \
WebCore/dom/Node.cpp \
WebCore/dom/Node.h \
@@ -1069,6 +1077,12 @@ webcore_sources += \
WebCore/html/FileThreadTask.h \
WebCore/html/FormDataList.cpp \
WebCore/html/FormDataList.h \
+ WebCore/html/HTML5Lexer.cpp \
+ WebCore/html/HTML5Lexer.h \
+ WebCore/html/HTML5Tokenizer.cpp \
+ WebCore/html/HTML5Tokenizer.h \
+ WebCore/html/HTML5TreeBuilder.cpp \
+ WebCore/html/HTML5TreeBuilder.h \
WebCore/html/HTMLAllCollection.cpp \
WebCore/html/HTMLAllCollection.h \
WebCore/html/HTMLAnchorElement.cpp \
@@ -1386,6 +1400,8 @@ webcore_sources += \
WebCore/loader/ResourceLoader.h \
WebCore/loader/ResourceLoadNotifier.cpp \
WebCore/loader/ResourceLoadNotifier.h \
+ WebCore/loader/SinkDocument.cpp \
+ WebCore/loader/SinkDocument.h \
WebCore/loader/SubresourceLoader.cpp \
WebCore/loader/SubresourceLoader.h \
WebCore/loader/SubresourceLoaderClient.h \
@@ -1792,6 +1808,8 @@ webcore_sources += \
WebCore/platform/text/TextStream.h \
WebCore/platform/text/UnicodeRange.cpp \
WebCore/platform/text/UnicodeRange.h \
+ WebCore/platform/text/transcoder/FontTranscoder.cpp \
+ WebCore/platform/text/transcoder/FontTranscoder.h \
WebCore/plugins/MimeType.cpp \
WebCore/plugins/MimeType.h \
WebCore/plugins/MimeTypeArray.cpp \
@@ -2097,6 +2115,8 @@ webcoregtk_sources += \
WebCore/platform/graphics/gtk/IntRectGtk.cpp \
WebCore/platform/gtk/ClipboardGtk.cpp \
WebCore/platform/gtk/ClipboardGtk.h \
+ WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp \
+ WebCore/platform/gtk/ClipboardUtilitiesGtk.h \
WebCore/platform/gtk/ContextMenuGtk.cpp \
WebCore/platform/gtk/ContextMenuItemGtk.cpp \
WebCore/platform/gtk/CursorGtk.cpp \
@@ -2598,6 +2618,8 @@ webcoregtk_sources += \
WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h \
WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp \
WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h \
+ WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp \
+ WebCore/platform/graphics/gstreamer/GStreamerGWorld.h \
WebCore/platform/graphics/gstreamer/ImageGStreamer.h \
WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp \
WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp \
@@ -2765,7 +2787,6 @@ webcore_sources += \
WebCore/workers/DedicatedWorkerContext.h \
WebCore/workers/DedicatedWorkerThread.cpp \
WebCore/workers/DedicatedWorkerThread.h \
- WebCore/workers/GenericWorkerTask.h \
WebCore/workers/Worker.cpp \
WebCore/workers/Worker.h \
WebCore/workers/WorkerContext.cpp \
@@ -3891,6 +3912,7 @@ IDL_BINDINGS_GDOM += \
WebCore/dom/DocumentFragment.idl \
WebCore/dom/DocumentType.idl \
WebCore/dom/DOMImplementation.idl \
+ WebCore/dom/DOMStringList.idl \
WebCore/dom/Element.idl \
WebCore/dom/EntityReference.idl \
WebCore/dom/MessagePort.idl \
diff --git a/WebCore/WebCore.PluginHostProcess.exp b/WebCore/WebCore.PluginHostProcess.exp
index d3c4178..308d0f2 100644
--- a/WebCore/WebCore.PluginHostProcess.exp
+++ b/WebCore/WebCore.PluginHostProcess.exp
@@ -4,8 +4,7 @@ __ZN3JSC13RuntimeMethod11getCallDataERNS_8CallDataE
__ZN3JSC13RuntimeMethod18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
__ZN3JSC13RuntimeMethod24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC13RuntimeMethod6s_infoE
-__ZN3JSC13RuntimeMethodC1EPNS_9ExecStateERKNS_10IdentifierERN3WTF6VectorIPNS_8Bindings6MethodELm0EEE
-__ZN3JSC13RuntimeMethodC2EPNS_9ExecStateERKNS_10IdentifierERN3WTF6VectorIPNS_8Bindings6MethodELm0EEE
+__ZN3JSC13RuntimeMethodC2EPNS_9ExecStateEPNS_14JSGlobalObjectERKNS_10IdentifierERN3WTF6VectorIPNS_8Bindings6MethodELm0EEE
__ZN3JSC8Bindings10RootObjectD1Ev
__ZN3JSC8Bindings13RuntimeObject11getCallDataERNS_8CallDataE
__ZN3JSC8Bindings13RuntimeObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
@@ -15,7 +14,7 @@ __ZN3JSC8Bindings13RuntimeObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17Prope
__ZN3JSC8Bindings13RuntimeObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC8Bindings13RuntimeObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
__ZN3JSC8Bindings13RuntimeObject6s_infoE
-__ZN3JSC8Bindings13RuntimeObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS0_8InstanceEEE
+__ZN3JSC8Bindings13RuntimeObjectC2EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF10PassRefPtrINS0_8InstanceEEE
__ZN3JSC8Bindings13RuntimeObjectD2Ev
__ZN3JSC8Bindings8Instance19createRuntimeObjectEPNS_9ExecStateE
__ZN3JSC8Bindings8InstanceC2EN3WTF10PassRefPtrINS0_10RootObjectEEE
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 637ca90..558531a 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -392,9 +392,9 @@ __ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_14NavigationTypeE
__ZN7WebCore16NavigationActionC1Ev
__ZN7WebCore16ScriptController10initScriptEPNS_15DOMWrapperWorldE
__ZN7WebCore16ScriptController11createWorldEv
-__ZN7WebCore16ScriptController13executeScriptERKNS_6StringEb
+__ZN7WebCore16ScriptController13executeScriptERKNS_6StringEbNS_14ShouldAllowXSSE
__ZN7WebCore16ScriptController18windowScriptObjectEv
-__ZN7WebCore16ScriptController20executeScriptInWorldEPNS_15DOMWrapperWorldERKNS_6StringEb
+__ZN7WebCore16ScriptController20executeScriptInWorldEPNS_15DOMWrapperWorldERKNS_6StringEbNS_14ShouldAllowXSSE
__ZN7WebCore16ThreadGlobalData10staticDataE
__ZN7WebCore16ThreadGlobalDataC1Ev
__ZN7WebCore16ThreadGlobalDataD1Ev
@@ -524,7 +524,7 @@ __ZN7WebCore4Page6goBackEv
__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
__ZN7WebCore4Page9goForwardEv
__ZN7WebCore4Page9initGroupEv
-__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientEPNS_15InspectorClientEPNS_18PluginHalterClientEPNS_27GeolocationControllerClientE
+__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientEPNS_15InspectorClientEPNS_18PluginHalterClientEPNS_27GeolocationControllerClientEPNS_23DeviceOrientationClientE
__ZN7WebCore4PageD1Ev
__ZN7WebCore4coreEP20NSURLProtectionSpace
__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarationE
@@ -902,7 +902,7 @@ __ZNK7WebCore4KURL4hostEv
__ZNK7WebCore4KURL4pathEv
__ZNK7WebCore4KURLcvP5NSURLEv
__ZNK7WebCore4Node14isDescendantOfEPKS0_
-__ZNK7WebCore4Node18getSubresourceURLsERN3WTF11ListHashSetINS_4KURLENS_8KURLHashEEE
+__ZNK7WebCore4Node18getSubresourceURLsERN3WTF11ListHashSetINS_4KURLELm256ENS_8KURLHashEEE
__ZNK7WebCore4Node9nodeIndexEv
__ZNK7WebCore4Page10pluginDataEv
__ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
@@ -987,6 +987,7 @@ __ZNK7WebCore9FrameView20isSoftwareRenderableEv
__ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv
__ZNK7WebCore9PageCache10frameCountEv
__ZNK7WebCore9PageCache21autoreleasedPageCountEv
+__ZNK7WebCore11RenderStyle21visitedDependentColorEi
__ZTVN7WebCore12ChromeClientE
__ZTVN7WebCore12PluginWidgetE
__ZTVN7WebCore17FileChooserClientE
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index 7634765..4f57ed2 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -154,6 +154,7 @@
'../platform/network/chromium',
'../platform/sql',
'../platform/text',
+ '../platform/text/transcoder',
'../plugins',
'../plugins/chromium',
'../rendering',
@@ -723,6 +724,7 @@
'include_dirs': [
'<(INTERMEDIATE_DIR)',
'<@(webcore_include_dirs)',
+ '<(chromium_src_dir)/gpu'
],
'sources': [
'<@(webcore_files)',
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 91d7eda..3f660f2 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -40,6 +40,8 @@
'dom/CustomEvent.idl',
'dom/DOMCoreException.idl',
'dom/DOMImplementation.idl',
+ 'dom/DOMStringList.idl',
+ 'dom/DeviceOrientationEvent.idl',
'dom/Document.idl',
'dom/DocumentFragment.idl',
'dom/DocumentType.idl',
@@ -581,6 +583,8 @@
'bindings/js/JSLazyEventListener.h',
'bindings/js/JSLocationCustom.cpp',
'bindings/js/JSLocationCustom.h',
+ 'bindings/js/JSMainThreadExecState.cpp',
+ 'bindings/js/JSMainThreadExecState.h',
'bindings/js/JSMessageChannelConstructor.cpp',
'bindings/js/JSMessageChannelConstructor.h',
'bindings/js/JSMessageChannelCustom.cpp',
@@ -691,7 +695,6 @@
'bindings/ScriptControllerBase.cpp',
'bindings/v8/ChildThreadDOMData.cpp',
'bindings/v8/ChildThreadDOMData.h',
- 'bindings/v8/custom/V8AttrCustom.cpp',
'bindings/v8/custom/V8CanvasPixelArrayCustom.cpp',
'bindings/v8/custom/V8ArrayBufferViewCustom.h',
'bindings/v8/custom/V8ArrayBufferViewCustom.cpp',
@@ -1094,11 +1097,19 @@
'dom/ContainerNode.cpp',
'dom/ContainerNode.h',
'dom/ContainerNodeAlgorithms.h',
+ 'dom/CrossThreadTask.h',
'dom/CustomEvent.cpp',
'dom/CustomEvent.h',
'dom/DOMCoreException.h',
'dom/DOMImplementation.cpp',
'dom/DOMImplementation.h',
+ 'dom/DOMStringList.cpp',
+ 'dom/DOMStringList.h',
+ 'dom/DeviceOrientation.cpp',
+ 'dom/DeviceOrientation.h',
+ 'dom/DeviceOrientationClient.h',
+ 'dom/DeviceOrientationEvent.cpp',
+ 'dom/DeviceOrientationEvent.h',
'dom/Document.cpp',
'dom/Document.h',
'dom/DocumentFragment.cpp',
@@ -1135,8 +1146,6 @@
'dom/InputElement.h',
'dom/KeyboardEvent.cpp',
'dom/KeyboardEvent.h',
- 'dom/MappedAttribute.cpp',
- 'dom/MappedAttribute.h',
'dom/MappedAttributeEntry.h',
'dom/MessageChannel.cpp',
'dom/MessageChannel.h',
@@ -1154,10 +1163,7 @@
'dom/MutationEvent.h',
'dom/NameNodeList.cpp',
'dom/NameNodeList.h',
- 'dom/NamedAttrMap.cpp',
- 'dom/NamedAttrMap.h',
- 'dom/NamedMappedAttrMap.cpp',
- 'dom/NamedMappedAttrMap.h',
+ 'dom/NamedNodeMap.cpp',
'dom/NamedNodeMap.h',
'dom/Node.cpp',
'dom/Node.h',
@@ -1461,6 +1467,12 @@
'html/FileThreadTask.h',
'html/FormDataList.cpp',
'html/FormDataList.h',
+ 'html/HTML5Lexer.cpp',
+ 'html/HTML5Lexer.h',
+ 'html/HTML5Tokenizer.cpp',
+ 'html/HTML5Tokenizer.h',
+ 'html/HTML5TreeBuilder.cpp',
+ 'html/HTML5TreeBuilder.h',
'html/HTMLAllCollection.cpp',
'html/HTMLAllCollection.h',
'html/HTMLAnchorElement.cpp',
@@ -1804,6 +1816,8 @@
'loader/ResourceLoader.h',
'loader/ResourceLoadNotifier.cpp',
'loader/ResourceLoadNotifier.h',
+ 'loader/SinkDocument.cpp',
+ 'loader/SinkDocument.h',
'loader/SubresourceLoader.cpp',
'loader/SubresourceLoader.h',
'loader/SubresourceLoaderClient.h',
@@ -2715,6 +2729,8 @@
'platform/text/qt/TextCodecQt.h',
'platform/text/symbian/StringImplSymbian.cpp',
'platform/text/symbian/StringSymbian.cpp',
+ 'platform/text/transcoder/FontTranscoder.cpp',
+ 'platform/text/transcoder/FontTranscoder.h',
'platform/text/win/TextBreakIteratorInternalICUWin.cpp',
'platform/text/wx/StringWx.cpp',
'platform/text/AtomicString.h',
@@ -3743,7 +3759,6 @@
'workers/DedicatedWorkerContext.h',
'workers/DedicatedWorkerThread.cpp',
'workers/DedicatedWorkerThread.h',
- 'workers/GenericWorkerTask.h',
'workers/SharedWorker.cpp',
'workers/SharedWorker.h',
'workers/SharedWorkerContext.cpp',
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index 4da1aa8..b824f61 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -260,11 +260,13 @@ IDL_BINDINGS += \
dom/Comment.idl \
dom/CompositionEvent.idl \
dom/CustomEvent.idl \
+ dom/DeviceOrientationEvent.idl \
dom/DocumentFragment.idl \
dom/Document.idl \
dom/DocumentType.idl \
dom/DOMCoreException.idl \
dom/DOMImplementation.idl \
+ dom/DOMStringList.idl \
dom/Element.idl \
dom/Entity.idl \
dom/EntityReference.idl \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 933081a..13a4205 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -200,6 +200,7 @@ INCLUDEPATH = \
$$PWD/platform/network \
$$PWD/platform/sql \
$$PWD/platform/text \
+ $$PWD/platform/text/transcoder \
$$PWD/plugins \
$$PWD/rendering \
$$PWD/rendering/style \
@@ -351,6 +352,7 @@ SOURCES += \
bindings/js/JSDOMBinding.cpp \
bindings/js/JSEventListener.cpp \
bindings/js/JSLazyEventListener.cpp \
+ bindings/js/JSMainThreadExecState.cpp \
bindings/js/JSPluginElementFunctions.cpp \
bindings/js/JSPopStateEventCustom.cpp \
bindings/js/JSWorkerContextErrorHandler.cpp \
@@ -462,10 +464,13 @@ SOURCES += \
dom/ContainerNode.cpp \
dom/CSSMappedAttributeDeclaration.cpp \
dom/CustomEvent.cpp \
+ dom/DeviceOrientation.cpp \
+ dom/DeviceOrientationEvent.cpp \
dom/Document.cpp \
dom/DocumentFragment.cpp \
dom/DocumentType.cpp \
dom/DOMImplementation.cpp \
+ dom/DOMStringList.cpp \
dom/DynamicNodeList.cpp \
dom/EditingText.cpp \
dom/Element.cpp \
@@ -479,7 +484,6 @@ SOURCES += \
dom/ExceptionCode.cpp \
dom/InputElement.cpp \
dom/KeyboardEvent.cpp \
- dom/MappedAttribute.cpp \
dom/MessageChannel.cpp \
dom/MessageEvent.cpp \
dom/MessagePort.cpp \
@@ -487,8 +491,7 @@ SOURCES += \
dom/MouseEvent.cpp \
dom/MouseRelatedEvent.cpp \
dom/MutationEvent.cpp \
- dom/NamedAttrMap.cpp \
- dom/NamedMappedAttrMap.cpp \
+ dom/NamedNodeMap.cpp \
dom/NameNodeList.cpp \
dom/Node.cpp \
dom/NodeFilterCondition.cpp \
@@ -605,6 +608,9 @@ SOURCES += \
html/FileStreamProxy.cpp \
html/FileThread.cpp \
html/FormDataList.cpp \
+ html/HTML5Lexer.cpp \
+ html/HTML5Tokenizer.cpp \
+ html/HTML5TreeBuilder.cpp \
html/HTMLAllCollection.cpp \
html/HTMLAnchorElement.cpp \
html/HTMLAppletElement.cpp \
@@ -747,6 +753,7 @@ SOURCES += \
loader/Request.cpp \
loader/ResourceLoader.cpp \
loader/ResourceLoadNotifier.cpp \
+ loader/SinkDocument.cpp \
loader/SubresourceLoader.cpp \
loader/TextDocument.cpp \
loader/TextResourceDecoder.cpp \
@@ -889,6 +896,7 @@ SOURCES += \
platform/ThreadTimers.cpp \
platform/Timer.cpp \
platform/text/UnicodeRange.cpp \
+ platform/text/transcoder/FontTranscoder.cpp \
platform/UUID.cpp \
platform/Widget.cpp \
plugins/PluginDatabase.cpp \
@@ -1185,10 +1193,14 @@ HEADERS += \
dom/CSSMappedAttributeDeclaration.h \
dom/CustomEvent.h \
dom/default/PlatformMessagePortChannel.h \
+ dom/DeviceOrientation.h \
+ dom/DeviceOrientationClient.h \
+ dom/DeviceOrientationEvent.h \
dom/DocumentFragment.h \
dom/Document.h \
dom/DocumentType.h \
dom/DOMImplementation.h \
+ dom/DOMStringList.h \
dom/DynamicNodeList.h \
dom/EditingText.h \
dom/Element.h \
@@ -1201,7 +1213,6 @@ HEADERS += \
dom/ExceptionCode.h \
dom/InputElement.h \
dom/KeyboardEvent.h \
- dom/MappedAttribute.h \
dom/MessageChannel.h \
dom/MessageEvent.h \
dom/MessagePortChannel.h \
@@ -1209,8 +1220,7 @@ HEADERS += \
dom/MouseEvent.h \
dom/MouseRelatedEvent.h \
dom/MutationEvent.h \
- dom/NamedAttrMap.h \
- dom/NamedMappedAttrMap.h \
+ dom/NamedNodeMap.h \
dom/NameNodeList.h \
dom/NodeFilterCondition.h \
dom/NodeFilter.h \
@@ -1659,6 +1669,7 @@ HEADERS += \
platform/text/TextEncodingRegistry.h \
platform/text/TextStream.h \
platform/text/UnicodeRange.h \
+ platform/text/transcoder/FontTranscoder.h \
platform/ThreadGlobalData.h \
platform/ThreadTimers.h \
platform/Timer.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 9535c38..f581af0 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -67,7 +67,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\transcoder\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -123,7 +123,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\transcoder\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -178,7 +178,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\transcoder\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -233,7 +233,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cairo\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\curl\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cairo\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\transcoder\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\curl\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -289,7 +289,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cairo\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\curl\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cairo\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\transcoder\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\curl\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -344,7 +344,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\accessibility\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\inspector\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\appcache\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\archive\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\notifications\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\cg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\transforms\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\opentype\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\text\transcoder\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\jsc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\style\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\animation\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\websockets\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\workers\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\parser\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\runtime\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\masm\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\profiler\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wrec\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\inspector\front-end\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\English.lproj\localizedStrings.js&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
@@ -2737,6 +2737,62 @@
>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\WebCore\DerivedSources\JSDeviceOrientationEvent.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebCore\DerivedSources\JSDeviceOrientationEvent.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDocument.cpp"
>
<FileConfiguration
@@ -3241,6 +3297,62 @@
>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMStringList.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMStringList.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMWindow.cpp"
>
<FileConfiguration
@@ -21985,6 +22097,14 @@
>
</File>
<File
+ RelativePath="..\loader\SinkDocument.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\loader\SinkDocument.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\SubresourceLoader.cpp"
>
</File>
@@ -23887,6 +24007,22 @@
>
</File>
<File
+ RelativePath="..\platform\graphics\win\WebLayer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\win\WebLayer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\win\WebTiledLayer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\win\WebTiledLayer.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\win\WKCACFContextFlusher.cpp"
>
</File>
@@ -26255,6 +26391,18 @@
>
</File>
</Filter>
+ <Filter
+ Name="transcoder"
+ >
+ <File
+ RelativePath="..\platform\text\transcoder\FontTranscoder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\text\transcoder\FontTranscoder.h"
+ >
+ </File>
+ </Filter>
</Filter>
<Filter
Name="image-decoders"
@@ -29409,6 +29557,10 @@
>
</File>
<File
+ RelativePath="..\dom\CrossThreadTask.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\CSSMappedAttributeDeclaration.cpp"
>
</File>
@@ -29425,6 +29577,26 @@
>
</File>
<File
+ RelativePath="..\dom\DeviceOrientation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\dom\DeviceOrientation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\dom\DeviceOrientationClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\dom\DeviceOrientationEvent.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\dom\DeviceOrientationEvent.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\Document.cpp"
>
</File>
@@ -29465,6 +29637,14 @@
>
</File>
<File
+ RelativePath="..\dom\DOMStringList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\dom\DOMStringList.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\DynamicNodeList.cpp"
>
</File>
@@ -29577,14 +29757,6 @@
>
</File>
<File
- RelativePath="..\dom\MappedAttribute.cpp"
- >
- </File>
- <File
- RelativePath="..\dom\MappedAttribute.h"
- >
- </File>
- <File
RelativePath="..\dom\MappedAttributeEntry.h"
>
</File>
@@ -29645,19 +29817,7 @@
>
</File>
<File
- RelativePath="..\dom\NamedAttrMap.cpp"
- >
- </File>
- <File
- RelativePath="..\dom\NamedAttrMap.h"
- >
- </File>
- <File
- RelativePath="..\dom\NamedMappedAttrMap.cpp"
- >
- </File>
- <File
- RelativePath="..\dom\NamedMappedAttrMap.h"
+ RelativePath="..\dom\NamedNodeMap.cpp"
>
</File>
<File
@@ -30057,10 +30217,6 @@
>
</File>
<File
- RelativePath="..\workers\GenericWorkerTask.h"
- >
- </File>
- <File
RelativePath="..\workers\SharedWorker.cpp"
>
</File>
@@ -30773,6 +30929,30 @@
>
</File>
<File
+ RelativePath="..\html\HTML5Lexer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTML5Lexer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTML5Tokenizer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTML5Tokenizer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTML5TreeBuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTML5TreeBuilder.h"
+ >
+ </File>
+ <File
RelativePath="..\html\HTMLAllCollection.cpp"
>
</File>
@@ -38964,6 +39144,62 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\bindings\js\JSMainThreadExecState.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSMainThreadExecState.h"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSMessageChannelConstructor.cpp"
>
<FileConfiguration
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
index 99fe1b9..4283526 100644
--- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
+++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
@@ -7,7 +7,7 @@
>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;"
PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebCorePrefix.h"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index edbe995..ee9e556 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -642,7 +642,7 @@
2E3BC108117D479800B9409A /* DOMFileError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BC106117D479800B9409A /* DOMFileError.h */; };
2E3BC109117D479800B9409A /* DOMFileError.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E3BC107117D479800B9409A /* DOMFileError.mm */; };
2E3BC10B117D47C800B9409A /* DOMFileErrorInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BC10A117D47C800B9409A /* DOMFileErrorInternal.h */; };
- 2E4346440F546A8200B0F1BA /* GenericWorkerTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E4346320F546A8200B0F1BA /* GenericWorkerTask.h */; };
+ 2E3FAA0911A36BF100576624 /* CrossThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3FAA0811A36BF100576624 /* CrossThreadTask.h */; };
2E4346450F546A8200B0F1BA /* Worker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E4346330F546A8200B0F1BA /* Worker.cpp */; };
2E4346460F546A8200B0F1BA /* Worker.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E4346340F546A8200B0F1BA /* Worker.h */; };
2E4346480F546A8200B0F1BA /* WorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E4346360F546A8200B0F1BA /* WorkerContext.cpp */; };
@@ -1048,6 +1048,8 @@
512DD8FB0D91E6AF000F89EE /* ArchiveResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512DD8F10D91E6AF000F89EE /* ArchiveResource.cpp */; };
512DD8FC0D91E6AF000F89EE /* ArchiveResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8F20D91E6AF000F89EE /* ArchiveResource.h */; settings = {ATTRIBUTES = (Private, ); }; };
512DD8FD0D91E6AF000F89EE /* ArchiveFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8F30D91E6AF000F89EE /* ArchiveFactory.h */; };
+ 51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 51327D5E11A33A2B004F9D65 /* SinkDocument.h */; };
+ 51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */; };
513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
514185EE0CD65F0400763C99 /* ChangeVersionWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 514185EC0CD65F0400763C99 /* ChangeVersionWrapper.h */; };
@@ -1165,6 +1167,13 @@
596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */; };
5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
599E759011055A1F00D904FA /* Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 599E758F11055A1F00D904FA /* Bridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 59A85EA2119D68D900DEF1EF /* DeviceOrientationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A85EA1119D68D900DEF1EF /* DeviceOrientationEvent.cpp */; };
+ 59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A85EA3119D68EC00DEF1EF /* DeviceOrientationEvent.h */; };
+ 59A86006119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A86005119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp */; };
+ 59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */; };
+ 59A8F1D411A69508001AC34A /* DeviceOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A8F1D311A69508001AC34A /* DeviceOrientation.cpp */; };
+ 59A8F1D611A69513001AC34A /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D511A69513001AC34A /* DeviceOrientation.h */; };
+ 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */; };
59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; };
59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */; };
59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; };
@@ -2266,6 +2275,7 @@
895253DC116C4EF500CABF00 /* FileStreamProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */; };
895253DD116C4EF500CABF00 /* FileStreamProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253DB116C4EF500CABF00 /* FileStreamProxy.h */; };
895253DF116C4F0600CABF00 /* FileThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253DE116C4F0600CABF00 /* FileThreadTask.h */; };
+ 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; };
9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; };
9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; };
9305B24D098F1B6B00C28855 /* Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9305B24C098F1B6B00C28855 /* Timer.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2544,6 +2554,9 @@
97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; };
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */; };
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */; };
+ 97E8B35611A23CE200169409 /* HTML5Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E8B35411A23CE200169409 /* HTML5Lexer.cpp */; };
+ 97E8B35711A23CE200169409 /* HTML5Lexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E8B35511A23CE200169409 /* HTML5Lexer.h */; };
+ 97E8B3C311A2890800169409 /* HTML5Token.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E8B3C211A2890800169409 /* HTML5Token.h */; };
97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; };
9F6FC1961122E82A00E80196 /* ScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */; };
9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2935,6 +2948,8 @@
A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */; };
A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */; };
A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */; };
+ A871038A11A2947000DBD50E /* HTML5Tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871038811A2947000DBD50E /* HTML5Tokenizer.cpp */; };
+ A871038B11A2947000DBD50E /* HTML5Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = A871038911A2947000DBD50E /* HTML5Tokenizer.h */; };
A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */; };
A871D4580A127CBC00B12A68 /* HTMLParamElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */; };
@@ -2993,6 +3008,8 @@
A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFDF0A15376B00B12A68 /* RenderReplaced.h */; settings = {ATTRIBUTES = (Private, ); }; };
A871DFE40A15376B00B12A68 /* RenderWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFE00A15376B00B12A68 /* RenderWidget.h */; settings = {ATTRIBUTES = (Private, ); }; };
A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFE10A15376B00B12A68 /* RenderWidget.cpp */; };
+ A879C62511A9D1F70059237A /* HTML5TreeBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A879C62311A9D1F70059237A /* HTML5TreeBuilder.cpp */; };
+ A879C62611A9D1F70059237A /* HTML5TreeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A879C62411A9D1F70059237A /* HTML5TreeBuilder.h */; };
A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */; };
A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = A883DF260F3D045D00F19BF6 /* VisibleSelection.h */; settings = {ATTRIBUTES = (Private, ); }; };
A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */; };
@@ -3008,12 +3025,6 @@
A8C4A7FD09D563270003AC8D /* StyledElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7EB09D563270003AC8D /* StyledElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
A8C4A7FE09D563270003AC8D /* StyledElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7EC09D563270003AC8D /* StyledElement.cpp */; };
A8C4A80009D563270003AC8D /* Node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7EE09D563270003AC8D /* Node.cpp */; };
- A8C4A80109D563270003AC8D /* NamedMappedAttrMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7EF09D563270003AC8D /* NamedMappedAttrMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A8C4A80209D563270003AC8D /* NamedMappedAttrMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7F009D563270003AC8D /* NamedMappedAttrMap.cpp */; };
- A8C4A80309D563270003AC8D /* NamedAttrMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7F109D563270003AC8D /* NamedAttrMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A8C4A80409D563270003AC8D /* NamedAttrMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7F209D563270003AC8D /* NamedAttrMap.cpp */; };
- A8C4A80509D563270003AC8D /* MappedAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7F309D563270003AC8D /* MappedAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A8C4A80609D563270003AC8D /* MappedAttribute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7F409D563270003AC8D /* MappedAttribute.cpp */; };
A8C4A80709D563270003AC8D /* Element.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7F509D563270003AC8D /* Element.h */; settings = {ATTRIBUTES = (Private, ); }; };
A8C4A80809D563270003AC8D /* Element.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7F609D563270003AC8D /* Element.cpp */; };
A8C4A80909D563270003AC8D /* CSSMappedAttributeDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4218,6 +4229,8 @@
B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; };
B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B5D36019112F8B560048DEA8 /* DatabaseCallback.h */; };
B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B734B180119B9911006587BD /* FontTranscoder.cpp */; };
+ B734B183119B991D006587BD /* FontTranscoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B734B182119B991D006587BD /* FontTranscoder.h */; };
B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B776D43C1104527500BEB0EC /* PrintContext.cpp */; };
BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; };
BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; };
@@ -4737,6 +4750,7 @@
BCEFE1E50DCA5F3300739219 /* JSXSLTProcessorCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEFE1E40DCA5F3300739219 /* JSXSLTProcessorCustom.cpp */; };
BCEFE1EA0DCA5F6400739219 /* JSXSLTProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEFE1E80DCA5F6400739219 /* JSXSLTProcessor.cpp */; };
BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEFE1E90DCA5F6400739219 /* JSXSLTProcessor.h */; };
+ BCF34A3711A231CD00C71804 /* NamedNodeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF34A3611A231CD00C71804 /* NamedNodeMap.cpp */; };
BCF524600FEBEE5D0095BF26 /* HTMLDataGridElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF5245F0FEBEE5D0095BF26 /* HTMLDataGridElement.cpp */; };
BCFA930810333193007B25D1 /* RenderOverflow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFA930710333193007B25D1 /* RenderOverflow.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCFB2E5E0979E46400BA703D /* CachedResourceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2E5D0979E46400BA703D /* CachedResourceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4759,6 +4773,8 @@
C5102D950FD9AA2D00FAFF04 /* StorageSyncManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5102D930FD9AA2D00FAFF04 /* StorageSyncManager.cpp */; };
C5102ECF0FD9EF8C00FAFF04 /* StorageAreaSync.h in Headers */ = {isa = PBXBuildFile; fileRef = C5102ECD0FD9EF8C00FAFF04 /* StorageAreaSync.h */; };
C5102ED00FD9EF8C00FAFF04 /* StorageAreaSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5102ECE0FD9EF8C00FAFF04 /* StorageAreaSync.cpp */; };
+ C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */; };
+ C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C5137CF111A58378004ADB99 /* JSDOMStringList.h */; };
C5160EEA1004543A00A7CEE2 /* StorageAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5160EE81004543A00A7CEE2 /* StorageAreaImpl.cpp */; };
C5160EEB1004543A00A7CEE2 /* StorageAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */; };
C5198F4C1192ECFD002B74A6 /* IDBCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = C5198F381192ECFD002B74A6 /* IDBCallbacks.h */; };
@@ -4776,6 +4792,8 @@
C5198F5C1192ECFD002B74A6 /* IndexedDatabaseImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C5198F481192ECFD002B74A6 /* IndexedDatabaseImpl.h */; };
C5198F5D1192ECFD002B74A6 /* IndexedDatabaseRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5198F491192ECFD002B74A6 /* IndexedDatabaseRequest.cpp */; };
C5198F5E1192ECFD002B74A6 /* IndexedDatabaseRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C5198F4A1192ECFD002B74A6 /* IndexedDatabaseRequest.h */; };
+ C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C544274911A57E7A0063A749 /* DOMStringList.h */; };
+ C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55610F011A704EB00B82D27 /* DOMStringList.cpp */; };
C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */; };
C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; };
C56C914E119D849800DE4CD9 /* JSIDBAnyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C914D119D849800DE4CD9 /* JSIDBAnyCustom.cpp */; };
@@ -6156,7 +6174,7 @@
2E3BC106117D479800B9409A /* DOMFileError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileError.h; sourceTree = "<group>"; };
2E3BC107117D479800B9409A /* DOMFileError.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFileError.mm; sourceTree = "<group>"; };
2E3BC10A117D47C800B9409A /* DOMFileErrorInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileErrorInternal.h; sourceTree = "<group>"; };
- 2E4346320F546A8200B0F1BA /* GenericWorkerTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GenericWorkerTask.h; path = workers/GenericWorkerTask.h; sourceTree = "<group>"; };
+ 2E3FAA0811A36BF100576624 /* CrossThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadTask.h; sourceTree = "<group>"; };
2E4346330F546A8200B0F1BA /* Worker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Worker.cpp; path = workers/Worker.cpp; sourceTree = "<group>"; };
2E4346340F546A8200B0F1BA /* Worker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Worker.h; path = workers/Worker.h; sourceTree = "<group>"; };
2E4346350F546A8200B0F1BA /* Worker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Worker.idl; path = workers/Worker.idl; sourceTree = "<group>"; };
@@ -6631,6 +6649,8 @@
512DD8F10D91E6AF000F89EE /* ArchiveResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArchiveResource.cpp; sourceTree = "<group>"; };
512DD8F20D91E6AF000F89EE /* ArchiveResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveResource.h; sourceTree = "<group>"; };
512DD8F30D91E6AF000F89EE /* ArchiveFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveFactory.h; sourceTree = "<group>"; };
+ 51327D5E11A33A2B004F9D65 /* SinkDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinkDocument.h; sourceTree = "<group>"; };
+ 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SinkDocument.cpp; sourceTree = "<group>"; };
513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; };
513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; };
514185EC0CD65F0400763C99 /* ChangeVersionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChangeVersionWrapper.h; sourceTree = "<group>"; };
@@ -6763,6 +6783,14 @@
596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPositionCache.cpp; sourceTree = "<group>"; };
596229791133EFE200DC4CBB /* GeolocationPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPositionCache.h; sourceTree = "<group>"; };
599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; };
+ 59A85EA1119D68D900DEF1EF /* DeviceOrientationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientationEvent.cpp; sourceTree = "<group>"; };
+ 59A85EA3119D68EC00DEF1EF /* DeviceOrientationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationEvent.h; sourceTree = "<group>"; };
+ 59A85EAA119D7B6E00DEF1EF /* DeviceOrientationEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DeviceOrientationEvent.idl; sourceTree = "<group>"; };
+ 59A86005119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEvent.cpp; sourceTree = "<group>"; };
+ 59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeviceOrientationEvent.h; sourceTree = "<group>"; };
+ 59A8F1D311A69508001AC34A /* DeviceOrientation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientation.cpp; sourceTree = "<group>"; };
+ 59A8F1D511A69513001AC34A /* DeviceOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientation.h; sourceTree = "<group>"; };
+ 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClient.h; sourceTree = "<group>"; };
59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaInstanceJSC.cpp; path = jsc/JavaInstanceJSC.cpp; sourceTree = "<group>"; };
59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaInstanceJSC.h; path = jsc/JavaInstanceJSC.h; sourceTree = "<group>"; };
59B597721108656B007159E8 /* BridgeJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BridgeJSC.cpp; path = bridge/jsc/BridgeJSC.cpp; sourceTree = "<group>"; };
@@ -7831,6 +7859,8 @@
895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStreamProxy.cpp; sourceTree = "<group>"; };
895253DB116C4EF500CABF00 /* FileStreamProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamProxy.h; sourceTree = "<group>"; };
895253DE116C4F0600CABF00 /* FileThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileThreadTask.h; sourceTree = "<group>"; };
+ 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; };
+ 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; };
9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; };
9302B0BE0D79F82C00C7EE83 /* PageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroup.h; sourceTree = "<group>"; };
9305B24C098F1B6B00C28855 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; };
@@ -8087,6 +8117,9 @@
97DCE20010807C750057D394 /* HistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryController.h; sourceTree = "<group>"; };
97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSSAuditor.cpp; sourceTree = "<group>"; };
97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSSAuditor.h; sourceTree = "<group>"; };
+ 97E8B35411A23CE200169409 /* HTML5Lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5Lexer.cpp; sourceTree = "<group>"; };
+ 97E8B35511A23CE200169409 /* HTML5Lexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5Lexer.h; sourceTree = "<group>"; };
+ 97E8B3C211A2890800169409 /* HTML5Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5Token.h; sourceTree = "<group>"; };
97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptControllerBase.cpp; sourceTree = "<group>"; };
9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptDebugServer.cpp; sourceTree = "<group>"; };
9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugServer.h; sourceTree = "<group>"; };
@@ -8348,6 +8381,8 @@
A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEvent.cpp; sourceTree = "<group>"; };
A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSKeyboardEvent.h; sourceTree = "<group>"; };
A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyboardEvent.cpp; sourceTree = "<group>"; };
+ A871038811A2947000DBD50E /* HTML5Tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5Tokenizer.cpp; sourceTree = "<group>"; };
+ A871038911A2947000DBD50E /* HTML5Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5Tokenizer.h; sourceTree = "<group>"; };
A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInElement.h; sourceTree = "<group>"; };
A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInElement.cpp; sourceTree = "<group>"; };
A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParamElement.h; sourceTree = "<group>"; };
@@ -8406,6 +8441,8 @@
A871DFDF0A15376B00B12A68 /* RenderReplaced.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderReplaced.h; sourceTree = "<group>"; };
A871DFE00A15376B00B12A68 /* RenderWidget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderWidget.h; sourceTree = "<group>"; };
A871DFE10A15376B00B12A68 /* RenderWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderWidget.cpp; sourceTree = "<group>"; };
+ A879C62311A9D1F70059237A /* HTML5TreeBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5TreeBuilder.cpp; sourceTree = "<group>"; };
+ A879C62411A9D1F70059237A /* HTML5TreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5TreeBuilder.h; sourceTree = "<group>"; };
A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisibleSelection.cpp; sourceTree = "<group>"; };
A883DF260F3D045D00F19BF6 /* VisibleSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleSelection.h; sourceTree = "<group>"; };
A88DD4860B4629A300C02990 /* PathTraversalState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathTraversalState.h; sourceTree = "<group>"; };
@@ -8420,12 +8457,6 @@
A8C4A7EB09D563270003AC8D /* StyledElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyledElement.h; sourceTree = "<group>"; };
A8C4A7EC09D563270003AC8D /* StyledElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyledElement.cpp; sourceTree = "<group>"; };
A8C4A7EE09D563270003AC8D /* Node.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Node.cpp; sourceTree = "<group>"; };
- A8C4A7EF09D563270003AC8D /* NamedMappedAttrMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NamedMappedAttrMap.h; sourceTree = "<group>"; };
- A8C4A7F009D563270003AC8D /* NamedMappedAttrMap.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NamedMappedAttrMap.cpp; sourceTree = "<group>"; };
- A8C4A7F109D563270003AC8D /* NamedAttrMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NamedAttrMap.h; sourceTree = "<group>"; };
- A8C4A7F209D563270003AC8D /* NamedAttrMap.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NamedAttrMap.cpp; sourceTree = "<group>"; };
- A8C4A7F309D563270003AC8D /* MappedAttribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MappedAttribute.h; sourceTree = "<group>"; };
- A8C4A7F409D563270003AC8D /* MappedAttribute.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MappedAttribute.cpp; sourceTree = "<group>"; };
A8C4A7F509D563270003AC8D /* Element.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Element.h; sourceTree = "<group>"; };
A8C4A7F609D563270003AC8D /* Element.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Element.cpp; sourceTree = "<group>"; };
A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSMappedAttributeDeclaration.h; sourceTree = "<group>"; };
@@ -9665,6 +9696,8 @@
B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionCoordinator.cpp; sourceTree = "<group>"; };
B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionCoordinator.h; sourceTree = "<group>"; };
B5D36019112F8B560048DEA8 /* DatabaseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseCallback.h; sourceTree = "<group>"; };
+ B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; };
+ B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; };
B776D43A1104525D00BEB0EC /* PrintContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintContext.h; sourceTree = "<group>"; };
B776D43C1104527500BEB0EC /* PrintContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintContext.cpp; sourceTree = "<group>"; };
BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; };
@@ -10220,6 +10253,7 @@
BCEFE1E40DCA5F3300739219 /* JSXSLTProcessorCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXSLTProcessorCustom.cpp; sourceTree = "<group>"; };
BCEFE1E80DCA5F6400739219 /* JSXSLTProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXSLTProcessor.cpp; sourceTree = "<group>"; };
BCEFE1E90DCA5F6400739219 /* JSXSLTProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXSLTProcessor.h; sourceTree = "<group>"; };
+ BCF34A3611A231CD00C71804 /* NamedNodeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NamedNodeMap.cpp; sourceTree = "<group>"; };
BCF5245F0FEBEE5D0095BF26 /* HTMLDataGridElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataGridElement.cpp; sourceTree = "<group>"; };
BCFA930710333193007B25D1 /* RenderOverflow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderOverflow.h; sourceTree = "<group>"; };
BCFB2E5D0979E46400BA703D /* CachedResourceClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedResourceClient.h; sourceTree = "<group>"; };
@@ -10243,6 +10277,8 @@
C5102D930FD9AA2D00FAFF04 /* StorageSyncManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageSyncManager.cpp; sourceTree = "<group>"; };
C5102ECD0FD9EF8C00FAFF04 /* StorageAreaSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaSync.h; sourceTree = "<group>"; };
C5102ECE0FD9EF8C00FAFF04 /* StorageAreaSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaSync.cpp; sourceTree = "<group>"; };
+ C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringList.cpp; sourceTree = "<group>"; };
+ C5137CF111A58378004ADB99 /* JSDOMStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMStringList.h; sourceTree = "<group>"; };
C5160EE81004543A00A7CEE2 /* StorageAreaImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaImpl.cpp; sourceTree = "<group>"; };
C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaImpl.h; sourceTree = "<group>"; };
C5198F381192ECFD002B74A6 /* IDBCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCallbacks.h; sourceTree = "<group>"; };
@@ -10265,6 +10301,9 @@
C5198F491192ECFD002B74A6 /* IndexedDatabaseRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedDatabaseRequest.cpp; sourceTree = "<group>"; };
C5198F4A1192ECFD002B74A6 /* IndexedDatabaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedDatabaseRequest.h; sourceTree = "<group>"; };
C5198F4B1192ECFD002B74A6 /* IndexedDatabaseRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IndexedDatabaseRequest.idl; sourceTree = "<group>"; };
+ C544274911A57E7A0063A749 /* DOMStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStringList.h; sourceTree = "<group>"; };
+ C544274A11A57E7A0063A749 /* DOMStringList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMStringList.idl; sourceTree = "<group>"; };
+ C55610F011A704EB00B82D27 /* DOMStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMStringList.cpp; sourceTree = "<group>"; };
C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespaceImpl.h; sourceTree = "<group>"; };
C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceImpl.cpp; sourceTree = "<group>"; };
C56C914D119D849800DE4CD9 /* JSIDBAnyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAnyCustom.cpp; sourceTree = "<group>"; };
@@ -11213,7 +11252,6 @@
41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */,
4167EBF3102962BA003D252A /* DefaultSharedWorkerRepository.cpp */,
4167EBF4102962BA003D252A /* DefaultSharedWorkerRepository.h */,
- 2E4346320F546A8200B0F1BA /* GenericWorkerTask.h */,
41E1B1CD0FF5986900576B3B /* SharedWorker.cpp */,
41E1B1CE0FF5986900576B3B /* SharedWorker.h */,
41E1B1CF0FF5986900576B3B /* SharedWorker.idl */,
@@ -13261,10 +13299,10 @@
93EEC1EC09C2877700C515D1 /* html */ = {
isa = PBXGroup;
children = (
- 49484FAE102CF01E00187DD3 /* canvas */,
2EAFAF0B10E2AF2D007ED3D6 /* Blob.cpp */,
2EAFAF0C10E2AF2D007ED3D6 /* Blob.h */,
2EAFAF0D10E2AF2D007ED3D6 /* Blob.idl */,
+ 49484FAE102CF01E00187DD3 /* canvas */,
93C441ED0F813A1A00C1A634 /* CollectionCache.cpp */,
93C441EE0F813A1A00C1A634 /* CollectionCache.h */,
93C441FF0F813AE100C1A634 /* CollectionType.h */,
@@ -13303,6 +13341,13 @@
895253DE116C4F0600CABF00 /* FileThreadTask.h */,
A8136D370973A8E700D74463 /* FormDataList.cpp */,
A8136D360973A8E700D74463 /* FormDataList.h */,
+ 97E8B35411A23CE200169409 /* HTML5Lexer.cpp */,
+ 97E8B35511A23CE200169409 /* HTML5Lexer.h */,
+ A879C62311A9D1F70059237A /* HTML5TreeBuilder.cpp */,
+ A879C62411A9D1F70059237A /* HTML5TreeBuilder.h */,
+ 97E8B3C211A2890800169409 /* HTML5Token.h */,
+ A871038811A2947000DBD50E /* HTML5Tokenizer.cpp */,
+ A871038911A2947000DBD50E /* HTML5Tokenizer.h */,
BC97E239109144950010D361 /* HTMLAllCollection.cpp */,
BC97E238109144950010D361 /* HTMLAllCollection.h */,
BC97E23C109146F10010D361 /* HTMLAllCollection.idl */,
@@ -14199,6 +14244,8 @@
A83B79100CCB001B000B0825 /* Core */ = {
isa = PBXGroup;
children = (
+ 59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */,
+ 59A86005119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp */,
65DF31D809D1C122000BE325 /* JSAttr.cpp */,
65DF31D909D1C123000BE325 /* JSAttr.h */,
93F9B79E0BA6032600854064 /* JSCDATASection.cpp */,
@@ -14221,6 +14268,8 @@
BC60D7BF0D29A46300B9918F /* JSDOMCoreException.h */,
65DF31E309D1CC60000BE325 /* JSDOMImplementation.cpp */,
65DF31E409D1CC60000BE325 /* JSDOMImplementation.h */,
+ C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */,
+ C5137CF111A58378004ADB99 /* JSDOMStringList.h */,
65DF31E509D1CC60000BE325 /* JSElement.cpp */,
65DF31E609D1CC60000BE325 /* JSElement.h */,
65DF322D09D1DDBC000BE325 /* JSEntity.cpp */,
@@ -15063,6 +15112,7 @@
B2C3D9EC0D006C1D00EF6F26 /* text */ = {
isa = PBXGroup;
children = (
+ B734B17F119B98DB006587BD /* transcoder */,
B2B264590D00A77E000ACC1D /* cf */,
B2C3D9F90D006C1D00EF6F26 /* mac */,
B2C3D9EE0D006C1D00EF6F26 /* AtomicString.h */,
@@ -15146,6 +15196,15 @@
name = cf;
sourceTree = "<group>";
};
+ B734B17F119B98DB006587BD /* transcoder */ = {
+ isa = PBXGroup;
+ children = (
+ B734B182119B991D006587BD /* FontTranscoder.h */,
+ B734B180119B9911006587BD /* FontTranscoder.cpp */,
+ );
+ name = transcoder;
+ sourceTree = "<group>";
+ };
BC1A3790097C6F970019F3D8 /* bindings */ = {
isa = PBXGroup;
children = (
@@ -15195,6 +15254,8 @@
BC60901D0E91B8EC000C68B5 /* JSEventTarget.h */,
3314ACE910892086000F0E56 /* JSExceptionBase.cpp */,
3314ACEA10892086000F0E56 /* JSExceptionBase.h */,
+ 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */,
+ 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */,
93B70D4F09EB0C7C009D8468 /* JSPluginElementFunctions.cpp */,
93B70D5009EB0C7C009D8468 /* JSPluginElementFunctions.h */,
415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */,
@@ -15602,6 +15663,8 @@
656D37270ADBA5DE00A4554D /* ResourceLoader.h */,
973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */,
973E325510883B7C005BC493 /* ResourceLoadNotifier.h */,
+ 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */,
+ 51327D5E11A33A2B004F9D65 /* SinkDocument.h */,
93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */,
656D37300ADBA5DE00A4554D /* SubresourceLoader.h */,
1A3178920B20A81600316987 /* SubresourceLoaderClient.h */,
@@ -16391,6 +16454,12 @@
F523D32402DE4478018635CA /* dom */ = {
isa = PBXGroup;
children = (
+ 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */,
+ 59A8F1D511A69513001AC34A /* DeviceOrientation.h */,
+ 59A8F1D311A69508001AC34A /* DeviceOrientation.cpp */,
+ 59A85EAA119D7B6E00DEF1EF /* DeviceOrientationEvent.idl */,
+ 59A85EA3119D68EC00DEF1EF /* DeviceOrientationEvent.h */,
+ 59A85EA1119D68D900DEF1EF /* DeviceOrientationEvent.cpp */,
E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
A8C4A7FC09D563270003AC8D /* Attr.cpp */,
@@ -16439,6 +16508,7 @@
A81872140977D3C0005826D9 /* ContainerNode.cpp */,
A81872110977D3C0005826D9 /* ContainerNode.h */,
E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */,
+ 2E3FAA0811A36BF100576624 /* CrossThreadTask.h */,
A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */,
A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */,
62CD32561157E57C0063B0A7 /* CustomEvent.cpp */,
@@ -16459,6 +16529,9 @@
A8185F3609765765005826D9 /* DOMImplementation.cpp */,
A8185F3309765765005826D9 /* DOMImplementation.h */,
93EEC1E909C2877700C515D1 /* DOMImplementation.idl */,
+ C55610F011A704EB00B82D27 /* DOMStringList.cpp */,
+ C544274911A57E7A0063A749 /* DOMStringList.h */,
+ C544274A11A57E7A0063A749 /* DOMStringList.idl */,
BC7FA61E0D1F0CBD00DB22A9 /* DynamicNodeList.cpp */,
BC7FA61F0D1F0CBD00DB22A9 /* DynamicNodeList.h */,
6550B699099DF0270090D781 /* EditingText.cpp */,
@@ -16497,8 +16570,6 @@
85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */,
85031B2E0A44EFC700F992E0 /* KeyboardEvent.h */,
14CF7C2009F7110600EB3665 /* KeyboardEvent.idl */,
- A8C4A7F409D563270003AC8D /* MappedAttribute.cpp */,
- A8C4A7F309D563270003AC8D /* MappedAttribute.h */,
A8C4A84B09D5649D0003AC8D /* MappedAttributeEntry.h */,
E1ADECCD0E76AD8B004A1A5E /* MessageChannel.cpp */,
E1ADECCC0E76AD8B004A1A5E /* MessageChannel.h */,
@@ -16519,10 +16590,7 @@
85031B330A44EFC700F992E0 /* MutationEvent.cpp */,
85031B340A44EFC700F992E0 /* MutationEvent.h */,
93EEC1F309C2877700C515D1 /* MutationEvent.idl */,
- A8C4A7F209D563270003AC8D /* NamedAttrMap.cpp */,
- A8C4A7F109D563270003AC8D /* NamedAttrMap.h */,
- A8C4A7F009D563270003AC8D /* NamedMappedAttrMap.cpp */,
- A8C4A7EF09D563270003AC8D /* NamedMappedAttrMap.h */,
+ BCF34A3611A231CD00C71804 /* NamedNodeMap.cpp */,
A81872180977D3C0005826D9 /* NamedNodeMap.h */,
85ACA9F90A9B631000671E90 /* NamedNodeMap.idl */,
A81872190977D3C0005826D9 /* NameNodeList.cpp */,
@@ -17771,7 +17839,6 @@
C0C054CC1118C8E400CE2636 /* generate-bindings.pl in Headers */,
BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */,
BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */,
- 2E4346440F546A8200B0F1BA /* GenericWorkerTask.h in Headers */,
FE80D7C60E9C1F25000D6F75 /* Geolocation.h in Headers */,
BC56CB2210D5AC8000A77C64 /* GeolocationController.h in Headers */,
BC56CB2310D5AC8000A77C64 /* GeolocationControllerClient.h in Headers */,
@@ -18398,7 +18465,6 @@
A8239E0109B3CF8A00B60641 /* Logging.h in Headers */,
656D37410ADBA5DE00A4554D /* MainResourceLoader.h in Headers */,
1A8F6BC60DB55CDC001DB794 /* ManifestParser.h in Headers */,
- A8C4A80509D563270003AC8D /* MappedAttribute.h in Headers */,
A8C4A84C09D5649D0003AC8D /* MappedAttributeEntry.h in Headers */,
93309DF8099E64920056E581 /* markup.h in Headers */,
FABE72F51059C1EB00D999DD /* MathMLElement.h in Headers */,
@@ -18433,8 +18499,6 @@
85031B480A44EFC700F992E0 /* MouseRelatedEvent.h in Headers */,
93309DFC099E64920056E581 /* MoveSelectionCommand.h in Headers */,
85031B4A0A44EFC700F992E0 /* MutationEvent.h in Headers */,
- A8C4A80309D563270003AC8D /* NamedAttrMap.h in Headers */,
- A8C4A80109D563270003AC8D /* NamedMappedAttrMap.h in Headers */,
A81872230977D3C0005826D9 /* NamedNodeMap.h in Headers */,
A818721E0977D3C0005826D9 /* NameNodeList.h in Headers */,
E10B9B6C0B747599003ED890 /* NativeXPathNSResolver.h in Headers */,
@@ -19251,6 +19315,19 @@
C56C91A1119D918100DE4CD9 /* JSIDBErrorEvent.h in Headers */,
C56C91A3119D918100DE4CD9 /* JSIDBEvent.h in Headers */,
C56C91A7119D918700DE4CD9 /* JSIDBSuccessEvent.h in Headers */,
+ 97E8B35711A23CE200169409 /* HTML5Lexer.h in Headers */,
+ 97E8B3C311A2890800169409 /* HTML5Token.h in Headers */,
+ A871038B11A2947000DBD50E /* HTML5Tokenizer.h in Headers */,
+ 51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */,
+ 59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */,
+ 59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */,
+ 2E3FAA0911A36BF100576624 /* CrossThreadTask.h in Headers */,
+ 59A8F1D611A69513001AC34A /* DeviceOrientation.h in Headers */,
+ 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */,
+ A879C62611A9D1F70059237A /* HTML5TreeBuilder.h in Headers */,
+ B734B183119B991D006587BD /* FontTranscoder.h in Headers */,
+ C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */,
+ C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -20780,7 +20857,6 @@
1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */,
93E227E10AF589AD00D48324 /* MainResourceLoader.cpp in Sources */,
1A8F6BC50DB55CDC001DB794 /* ManifestParser.cpp in Sources */,
- A8C4A80609D563270003AC8D /* MappedAttribute.cpp in Sources */,
93309DF7099E64920056E581 /* markup.cpp in Sources */,
FABE72F41059C1EB00D999DD /* MathMLElement.cpp in Sources */,
FABE72FD1059C21100D999DD /* MathMLElementFactory.cpp in Sources */,
@@ -20814,8 +20890,6 @@
85031B470A44EFC700F992E0 /* MouseRelatedEvent.cpp in Sources */,
93309DFB099E64920056E581 /* MoveSelectionCommand.cpp in Sources */,
85031B490A44EFC700F992E0 /* MutationEvent.cpp in Sources */,
- A8C4A80409D563270003AC8D /* NamedAttrMap.cpp in Sources */,
- A8C4A80209D563270003AC8D /* NamedMappedAttrMap.cpp in Sources */,
A81872240977D3C0005826D9 /* NameNodeList.cpp in Sources */,
E10B9B6D0B747599003ED890 /* NativeXPathNSResolver.cpp in Sources */,
93CCF0600AF6CA7600018E89 /* NavigationAction.cpp in Sources */,
@@ -21498,6 +21572,7 @@
B59DD6A211902A52007E9684 /* JSSQLTransactionErrorCallback.cpp in Sources */,
B59DD6A611902A62007E9684 /* JSSQLStatementCallback.cpp in Sources */,
B59DD6AA11902A71007E9684 /* JSSQLStatementErrorCallback.cpp in Sources */,
+ 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */,
B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */,
B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */,
B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */,
@@ -21531,6 +21606,17 @@
C56C91A0119D918100DE4CD9 /* JSIDBErrorEvent.cpp in Sources */,
C56C91A2119D918100DE4CD9 /* JSIDBEvent.cpp in Sources */,
C56C91A6119D918700DE4CD9 /* JSIDBSuccessEvent.cpp in Sources */,
+ BCF34A3711A231CD00C71804 /* NamedNodeMap.cpp in Sources */,
+ 97E8B35611A23CE200169409 /* HTML5Lexer.cpp in Sources */,
+ A871038A11A2947000DBD50E /* HTML5Tokenizer.cpp in Sources */,
+ 51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */,
+ 59A85EA2119D68D900DEF1EF /* DeviceOrientationEvent.cpp in Sources */,
+ 59A86006119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp in Sources */,
+ 59A8F1D411A69508001AC34A /* DeviceOrientation.cpp in Sources */,
+ A879C62511A9D1F70059237A /* HTML5TreeBuilder.cpp in Sources */,
+ B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */,
+ C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
+ C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/WebCorePrefix.h b/WebCore/WebCorePrefix.h
index ac2014e..09ffd4c 100644
--- a/WebCore/WebCorePrefix.h
+++ b/WebCore/WebCorePrefix.h
@@ -118,7 +118,7 @@
#include <time.h>
-#if !defined(BUILDING_WX__) && !defined(ANDROID)
+#if !defined(BUILDING_WX__) && !defined(ANDROID) && !defined(BUILDING_BREWMP__)
#include <CoreFoundation/CoreFoundation.h>
#ifdef WIN_CAIRO
#include <ConditionalMacros.h>
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index 785ee31..6077aae 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -168,10 +168,10 @@ static inline RenderObject* lastChildConsideringContinuation(RenderObject* rende
lastChild = lc;
if (cur->isRenderInline()) {
- cur = toRenderInline(cur)->inlineContinuation();
+ cur = toRenderInline(cur)->inlineElementContinuation();
ASSERT(cur || !toRenderInline(prev)->continuation());
} else
- cur = toRenderBlock(cur)->inlineContinuation();
+ cur = toRenderBlock(cur)->inlineElementContinuation();
}
return lastChild;
@@ -205,12 +205,12 @@ AccessibilityObject* AccessibilityRenderObject::lastChild() const
static inline RenderInline* startOfContinuations(RenderObject* r)
{
- if (r->isInlineContinuation())
+ if (r->isInlineElementContinuation())
return toRenderInline(r->node()->renderer());
// Blocks with a previous continuation always have a next continuation
- if (r->isRenderBlock() && toRenderBlock(r)->inlineContinuation())
- return toRenderInline(toRenderBlock(r)->inlineContinuation()->node()->renderer());
+ if (r->isRenderBlock() && toRenderBlock(r)->inlineElementContinuation())
+ return toRenderInline(toRenderBlock(r)->inlineElementContinuation()->node()->renderer());
return 0;
}
@@ -226,10 +226,10 @@ static inline RenderObject* endOfContinuations(RenderObject* renderer)
while (cur) {
prev = cur;
if (cur->isRenderInline()) {
- cur = toRenderInline(cur)->inlineContinuation();
+ cur = toRenderInline(cur)->inlineElementContinuation();
ASSERT(cur || !toRenderInline(prev)->continuation());
} else
- cur = toRenderBlock(cur)->inlineContinuation();
+ cur = toRenderBlock(cur)->inlineElementContinuation();
}
return prev;
@@ -258,7 +258,7 @@ static inline RenderObject* childBeforeConsideringContinuations(RenderInline* r,
return prev;
prev = curContainer;
- curContainer = toRenderBlock(curContainer)->inlineContinuation();
+ curContainer = toRenderBlock(curContainer)->inlineElementContinuation();
}
}
@@ -269,7 +269,7 @@ static inline RenderObject* childBeforeConsideringContinuations(RenderInline* r,
static inline bool firstChildIsInlineContinuation(RenderObject* renderer)
{
- return renderer->firstChild() && renderer->firstChild()->isInlineContinuation();
+ return renderer->firstChild() && renderer->firstChild()->isInlineElementContinuation();
}
AccessibilityObject* AccessibilityRenderObject::previousSibling() const
@@ -320,7 +320,7 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const
// Case 1: node is a block and has an inline continuation. Next sibling is the inline continuation's
// first child.
RenderInline* inlineContinuation;
- if (m_renderer->isRenderBlock() && (inlineContinuation = toRenderBlock(m_renderer)->inlineContinuation()))
+ if (m_renderer->isRenderBlock() && (inlineContinuation = toRenderBlock(m_renderer)->inlineElementContinuation()))
nextSibling = firstChildConsideringContinuation(inlineContinuation);
// Case 2: Anonymous block parent of the start of a continuation - skip all the way to
@@ -774,8 +774,8 @@ Element* AccessibilityRenderObject::anchorElement() const
// Search up the render tree for a RenderObject with a DOM node. Defer to an earlier continuation, though.
for (currRenderer = m_renderer; currRenderer && !currRenderer->node(); currRenderer = currRenderer->parent()) {
- if (currRenderer->isRenderBlock()) {
- RenderInline* continuation = toRenderBlock(currRenderer)->inlineContinuation();
+ if (currRenderer->isAnonymousBlock()) {
+ RenderObject* continuation = toRenderBlock(currRenderer)->continuation();
if (continuation)
return cache->getOrCreate(continuation)->anchorElement();
}
diff --git a/WebCore/accessibility/AccessibilityTable.cpp b/WebCore/accessibility/AccessibilityTable.cpp
index aed8867..8e0562c 100644
--- a/WebCore/accessibility/AccessibilityTable.cpp
+++ b/WebCore/accessibility/AccessibilityTable.cpp
@@ -126,7 +126,7 @@ bool AccessibilityTable::isTableExposableThroughAccessibility()
RenderStyle* tableStyle = table->style();
if (!tableStyle)
return false;
- Color tableBGColor = tableStyle->backgroundColor();
+ Color tableBGColor = tableStyle->visitedDependentColor(CSSPropertyBackgroundColor);
// check enough of the cells to find if the table matches our criteria
// Criteria:
@@ -169,7 +169,7 @@ bool AccessibilityTable::isTableExposableThroughAccessibility()
// if the cell has a different color from the table and there is cell spacing,
// then it is probably a data table cell (spacing and colors take the place of borders)
- Color cellColor = renderStyle->backgroundColor();
+ Color cellColor = renderStyle->visitedDependentColor(CSSPropertyBackgroundColor);
if (table->hBorderSpacing() > 0 && table->vBorderSpacing() > 0
&& tableBGColor != cellColor && cellColor.alpha() != 1)
backgroundDifferenceCellCount++;
diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
index 97aaaf2..4734d4e 100644
--- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
+++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
@@ -315,8 +315,8 @@ static void AXAttributeStringSetStyle(NSMutableAttributedString* attrString, Ren
AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style->font().primaryFont()->getNSFont(), range);
// set basic colors
- AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style->color()), range);
- AXAttributeStringSetColor(attrString, NSAccessibilityBackgroundColorTextAttribute, nsColor(style->backgroundColor()), range);
+ AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style->visitedDependentColor(CSSPropertyColor)), range);
+ AXAttributeStringSetColor(attrString, NSAccessibilityBackgroundColorTextAttribute, nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)), range);
// set super/sub scripting
EVerticalAlign alignment = style->verticalAlign();
diff --git a/WebCore/benchmarks/parser/html-parser.html b/WebCore/benchmarks/parser/html-parser.html
new file mode 100644
index 0000000..24810da
--- /dev/null
+++ b/WebCore/benchmarks/parser/html-parser.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<body>
+<pre id="log"></pre>
+<script>
+function log(text) {
+ document.getElementById("log").innerText += text + "\n";
+ window.scrollTo(document.body.height);
+}
+
+function loadFile(path) {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", path, false);
+ xhr.send(null);
+ return xhr.responseText;
+}
+
+var spec = loadFile("resources/html5.html");
+
+function parse(html) {
+ var iframe = document.createElement("iframe");
+ iframe.src = "about:blank";
+ iframe.style.display = "none";
+ document.body.appendChild(iframe)
+ var detachedElement = iframe.contentDocument.createElement("div");
+ detachedElement.innerHTML = html;
+ document.body.removeChild(iframe)
+}
+
+var runCount = 20;
+var completedRuns = -1; // Discard the any runs < 0.
+var times = [];
+
+function computeAverage(values) {
+ var sum = 0;
+ for (var i = 0; i < values.length; i++)
+ sum += values[i];
+ return sum / values.length;
+}
+
+function computeStdev(values) {
+ var average = computeAverage(values);
+ var sumOfSquaredDeviations = 0;
+ for (var i = 0; i < values.length; ++i) {
+ var deviation = values[i] - average;
+ sumOfSquaredDeviations += deviation * deviation;
+ }
+ return Math.sqrt(sumOfSquaredDeviations / values.length);
+}
+
+function logStatistics(times) {
+ log("");
+ log("avg " + computeAverage(times));
+ log("stdev " + computeStdev(times));
+}
+
+function run() {
+ var start = new Date();
+ for (var i = 0; i < 10; ++i)
+ parse(spec);
+ var time = new Date() - start;
+ completedRuns++;
+ if (completedRuns <= 0) {
+ log("Ignoring warm-up run (" + time + ")");
+ } else {
+ times.push(time);
+ log(time);
+ }
+ if (completedRuns < runCount) {
+ window.setTimeout(run, 0);
+ } else {
+ logStatistics(times);
+ }
+}
+
+log("Running " + runCount + " times");
+run();
+</script>
+</body>
diff --git a/WebCore/benchmarks/parser/resources/html5.html b/WebCore/benchmarks/parser/resources/html5.html
new file mode 100644
index 0000000..ccb95bc
--- /dev/null
+++ b/WebCore/benchmarks/parser/resources/html5.html
@@ -0,0 +1,85096 @@
+<!DOCTYPE html><html lang=en-US-x-hixie><title>HTML5 (including next generation additions still in development)</title><script>
+ var loadTimer = new Date();
+ var current_revision = "r" + "$Revision: 5097 $".substr(11);
+ current_revision = current_revision.substr(0, current_revision.length - 2);
+ var last_known_revision = current_revision;
+ function getCookie(name) {
+ var params = location.search.substr(1).split("&");
+ for (var index = 0; index < params.length; index++) {
+ if (params[index] == name)
+ return "1";
+ var data = params[index].split("=");
+ if (data[0] == name)
+ return unescape(data[1]);
+ }
+ var cookies = document.cookie.split("; ");
+ for (var index = 0; index < cookies.length; index++) {
+ var data = cookies[index].split("=");
+ if (data[0] == name)
+ return unescape(data[1]);
+ }
+ return null;
+ }
+ var currentAlert;
+ var currentAlertTimeout;
+ function showAlert(s, href) {
+ if (!currentAlert) {
+ currentAlert = document.createElement('div');
+ currentAlert.id = 'alert';
+ var x = document.createElement('button');
+ x.textContent = '\u2573';
+ x.onclick = closeAlert2;
+ currentAlert.appendChild(x);
+ currentAlert.appendChild(document.createElement('span'));
+ currentAlert.onmousemove = function () {
+ clearTimeout(currentAlertTimeout);
+ currentAlert.className = '';
+ currentAlertTimeout = setTimeout(closeAlert, 10000);
+ }
+ document.body.appendChild(currentAlert);
+ } else {
+ clearTimeout(currentAlertTimeout);
+ currentAlert.className = '';
+ }
+ currentAlert.lastChild.textContent = s + ' ';
+ if (href) {
+ var link = document.createElement('a');
+ link.href = href;
+ link.textContent = href;
+ currentAlert.lastChild.appendChild(link);
+ }
+ currentAlertTimeout = setTimeout(closeAlert, 10000);
+ }
+ function closeAlert() {
+ clearTimeout(currentAlertTimeout);
+ if (currentAlert) {
+ currentAlert.className = 'closed';
+ currentAlertTimeout = setTimeout(closeAlert2, 3000);
+ }
+ }
+ function closeAlert2() {
+ clearTimeout(currentAlertTimeout);
+ if (currentAlert) {
+ currentAlert.parentNode.removeChild(currentAlert);
+ currentAlert = null;
+ }
+ }
+ window.addEventListener('keydown', function (event) {
+ if (event.keyCode == 27) {
+ if (currentAlert)
+ closeAlert2();
+ } else {
+ closeAlert();
+ }
+ }, false);
+ window.addEventListener('scroll', function (event) {
+ closeAlert();
+ }, false);
+ function load(script) {
+ var e = document.createElement('script');
+ e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
+ document.body.appendChild(e);
+ }
+ </script><link href=/style/specification rel=stylesheet><link href=/images/icon rel=icon><style>
+ .proposal { border: blue solid; padding: 1em; }
+ .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
+ #updatesStatus { display: none; }
+ #updatesStatus.relevant { display: block; position: fixed; right: 1em; top: 1em; padding: 0.5em; font: bold small sans-serif; min-width: 25em; width: 30%; max-width: 40em; height: auto; border: ridge 4px gray; background: #EEEEEE; color: black; }
+ div.head .logo { width: 11em; margin-bottom: 20em; }
+ #configUI { position: absolute; z-index: 20; top: 10em; right: 0; width: 11em; padding: 0 0.5em 0 0.5em; font-size: small; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 1em; -moz-border-radius: 1em 0 0 1em; }
+ #configUI p { margin: 0.75em 0; padding: 0.3em; }
+ #configUI p label { display: block; }
+ #configUI #updateUI, #configUI .loginUI { text-align: center; }
+ #configUI input[type=button] { display: block; margin: auto; }
+ #configUI :link, #configUI :visited { color: white; }
+ #configUI :link:hover, #configUI :visited:hover { background: transparent; }
+ #reviewer { position: fixed; bottom: 0; right: 0; padding: 0.15em 0.25em 0em 0.5em; white-space: nowrap; overflow: hidden; z-index: 30; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 0; -moz-border-radius: 1em 0 0 0; max-width: 90%; }
+ #reviewer input { max-width: 50%; }
+ #reviewer * { font-size: small; }
+ #reviewer.off > :not(:first-child) { display: none; }
+ #alert { position: fixed; top: 20%; left: 20%; right: 20%; font-size: 2em; padding: 0.5em; z-index: 40; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em; -moz-border-radius: 1em; -webkit-transition: opacity 1s linear; }
+ #alert.closed { opacity: 0; }
+ #alert button { position: absolute; top: -1em; right: 2em; border-radius: 1em 1em 0 0; border: none; line-height: 0.9; color: white; background: rgb(64,64,64); font-size: 0.6em; font-weight: 900; cursor: pointer; }
+ #alert :link, #alert :visited { color: white; }
+ #alert :link:hover, #alert :visited:hover { background: transparent; }
+ @media print { #configUI { display: none; } }
+ .rfc2119 { font-variant: small-caps; text-shadow: 0 0 0.5em yellow; position: static; }
+ .rfc2119::after { position: absolute; left: 0; width: 25px; text-align: center; color: yellow; text-shadow: 0.075em 0.075em 0.2em black; }
+ .rfc2119.m\ust::after { content: '\2605'; }
+ .rfc2119.s\hould::after { content: '\2606'; }
+ [hidden] { display: none; }
+ </style><style type=text/css>
+
+ .applies thead th > * { display: block; }
+ .applies thead code { display: block; }
+ .applies tbody th { whitespace: nowrap; }
+ .applies td { text-align: center; }
+ .applies .yes { background: yellow; }
+
+ .matrix, .matrix td { border: none; text-align: right; }
+ .matrix { margin-left: 2em; }
+
+ .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
+ .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
+ .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
+
+ #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
+ #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
+ #table-example-1 caption { padding-bottom: 0.5em; }
+ #table-example-1 thead, #table-example-1 tbody { border: none; }
+ #table-example-1 th, #table-example-1 td { border: solid thin; }
+ #table-example-1 th { font-weight: normal; }
+ #table-example-1 td { border-style: none solid; vertical-align: top; }
+ #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
+ #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
+ #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
+ #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
+ #table-example-1 tbody td:first-child::after { content: leader(". "); }
+ #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
+ #table-example-1 tbody td:first-child + td { width: 10em; }
+ #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
+ #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
+
+ .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
+ .apple-table-examples * { font-family: "Times", serif; }
+ .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
+ .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
+ .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
+ .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
+ .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
+ .apple-table-examples td { text-align: right; vertical-align: top; }
+ .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
+ .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
+ .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
+ .apple-table-examples sup { line-height: 0; }
+
+ .details-example img { vertical-align: top; }
+
+ #named-character-references-table {
+ font-size: 0.6em;
+ column-width: 28em;
+ column-gap: 1em;
+ -moz-column-width: 28em;
+ -moz-column-gap: 1em;
+ -webkit-column-width: 28em;
+ -webkit-column-gap: 1em;
+ }
+ #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
+ #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
+
+ </style><style>
+ .domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
+ </style><link href=data:text/css, id=complete rel=stylesheet title="Complete specification"><link href=data:text/css,.impl%20{%20display:%20none;%20}%0Ahtml%20{%20border:%20solid%20yellow;%20}%20.domintro:before%20{%20display:%20none;%20} id=author rel="alternate stylesheet" title="Author documentation only"><link href=data:text/css,.impl%20{%20background:%20%23FFEEEE;%20}%20.domintro:before%20{%20background:%20%23FFEEEE;%20} id=highlight rel="alternate stylesheet" title="Highlight implementation requirements"><link href=status.css rel=stylesheet><script>
+ function init() {
+ if (location.search == '?slow-browser')
+ return;
+ var configUI = document.createElement('div');
+ configUI.id = 'configUI';
+ document.body.appendChild(configUI);
+ load('reviewer.js');
+ if (document.documentElement.className == "" || document.documentElement.className == "split index")
+ load('toc.js');
+ load('styler.js');
+ load('updater.js');
+ load('dfn.js');
+ load('status.js');
+ if (getCookie('profile') == '1')
+ document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
+ }
+ </script><body class=draft onload=init()>
+
+ <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
+ <hgroup><h1>HTML5 (including next generation additions still in development)</h1>
+ <h2 class="no-num no-toc">Draft Standard &mdash; 18 May 2010</h2>
+ </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
+ <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
+ <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
+ <dl><dt>Multiple-page version:</dt>
+ <dd><strong><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/>http://whatwg.org/html5</a></strong></dd>
+ <dt>One-page version:</dt>
+ <dd><a href=http://www.whatwg.org/specs/web-apps/current-work/>http://www.whatwg.org/specs/web-apps/current-work/</a></dd>
+ <dt>PDF print versions:</dt>
+ <dd>A4: <a href=http://www.whatwg.org/specs/web-apps/current-work/html5-a4.pdf>http://www.whatwg.org/specs/web-apps/current-work/html5-a4.pdf</a></dd>
+ <dd>Letter: <a href=http://www.whatwg.org/specs/web-apps/current-work/html5-letter.pdf>http://www.whatwg.org/specs/web-apps/current-work/html5-letter.pdf</a></dd>
+ <dt>Version history:</dt>
+ <dd>Twitter messages (non-editorial changes only): <a href=http://twitter.com/WHATWG>http://twitter.com/WHATWG</a></dd>
+ <dd>Commit-Watchers mailing list: <a href=http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org>http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org</a></dd>
+ <dd>Interactive Web interface: <a href=http://html5.org/tools/web-apps-tracker>http://html5.org/tools/web-apps-tracker</a></dd>
+ <dd>Subversion interface: <a href=http://svn.whatwg.org/>http://svn.whatwg.org/</a></dd>
+ <dt>Issues:</dt>
+ <dd>To view the open bugs: <a href="http://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;short_desc_type=allwordssubstr&amp;short_desc=&amp;product=HTML+WG&amp;long_desc_type=allwordssubstr&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;status_whiteboard_type=allwordssubstr&amp;status_whiteboard=&amp;keywords_type=allwords&amp;keywords=&amp;bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;emailassigned_to1=1&amp;emailtype1=exact&amp;email1=ian%40hixie.ch&amp;emailtype2=substring&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;cmdtype=doit&amp;order=Reuse+same+sort+as+last+time&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">HTML5 bug list</a></dd>
+ <dd>To file bugs, use the "submit review comments" feature at the bottom of the window</dd>
+ <dd>To send feedback by e-mail: <a href=http://www.whatwg.org/mailing-list>whatwg@whatwg.org</a></dd>
+ <dd>To view and vote on e-mail feedback: <a href=http://www.whatwg.org/issues/>http://www.whatwg.org/issues/</a></dd>
+ <dt>Editor:</dt>
+ <dd>Ian Hickson, Google, ian@hixie.ch</dd>
+ </dl><p class=copyright>&copy; Copyright 2004-2010 Apple Computer, Inc.,
+ Mozilla Foundation, and Opera Software ASA.</p>
+ <p class=copyright>You are granted a license to use, reproduce
+ and create derivative works of this document.</p>
+ </header><hr><h2 class="no-num no-toc" id=abstract>Abstract</h2>
+
+ <p>This specification evolves HTML and its related APIs to ease the
+ authoring of Web-based applications. The most recent additions
+ include a <code><a href=#devices>device</a></code> element to enable video conferencing,
+ as well as all the features added as part of the earlier HTML5
+ effort.</p>
+
+
+ <h2 class="no-num no-toc" id=status>Status of this document</h2>
+
+ <p><strong>This is a work in progress!</strong> This document is
+ changing on a daily if not hourly basis in response to comments and
+ as a general part of its development process. Comments are very
+ welcome, please send them to <a href=mailto:whatwg@whatwg.org>whatwg@whatwg.org</a>. Thank
+ you.</p>
+
+ <p><a href=http://www.whatwg.org/issues/>Outstanding feedback</a>
+ is tracked; all e-mails sent to the list above receive a reply. The
+ level of outstanding feedback is <a href=http://www.whatwg.org/issues/data.html>charted</a> to allow
+ progress to be evaluated.</p>
+
+ <p>Implementors should be aware that this specification is not
+ stable. <strong>Implementors who are not taking part in the
+ discussions are likely to find the specification changing out from
+ under them in incompatible ways.</strong> Vendors interested in
+ implementing this specification before it eventually reaches the
+ call for implementations should join the <a href=/mailing-list>WHATWG mailing list</a> and take part in the
+ discussions.</p>
+
+ <p>This specification is intended to replace (be the new version of)
+ what was previously the HTML5, HTML4, XHTML1, and DOM2 HTML
+ specifications.</p>
+
+
+
+ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
+
+<!--begin-toc-->
+<ol class=toc>
+ <li><a href=#introduction><span class=secno>1 </span>Introduction</a>
+ <ol>
+ <li><a href=#is-this-html5?><span class=secno>1.1 </span>Is this HTML5?</a></li>
+ <li><a href=#background><span class=secno>1.2 </span>Background</a></li>
+ <li><a href=#audience><span class=secno>1.3 </span>Audience</a></li>
+ <li><a href=#scope><span class=secno>1.4 </span>Scope</a></li>
+ <li><a href=#history-1><span class=secno>1.5 </span>History</a></li>
+ <li><a href=#design-notes><span class=secno>1.6 </span>Design notes</a>
+ <ol>
+ <li><a href=#serializability-of-script-execution><span class=secno>1.6.1 </span>Serializability of script execution</a></li>
+ <li><a href=#compliance-with-other-specifications><span class=secno>1.6.2 </span>Compliance with other specifications</a></ol></li>
+ <li><a href=#html-vs-xhtml><span class=secno>1.7 </span>HTML vs XHTML</a></li>
+ <li><a href=#structure-of-this-specification><span class=secno>1.8 </span>Structure of this specification</a>
+ <ol>
+ <li><a href=#how-to-read-this-specification><span class=secno>1.8.1 </span>How to read this specification</a></li>
+ <li><a href=#typographic-conventions><span class=secno>1.8.2 </span>Typographic conventions</a></ol></li>
+ <li><a href=#a-quick-introduction-to-html><span class=secno>1.9 </span>A quick introduction to HTML</a></li>
+ <li><a href=#conformance-requirements-for-authors><span class=secno>1.10 </span>Conformance requirements for authors</a>
+ <ol>
+ <li><a href=#presentational-markup><span class=secno>1.10.1 </span>Presentational markup</a></li>
+ <li><a href=#syntax-errors><span class=secno>1.10.2 </span>Syntax errors</a></li>
+ <li><a href=#restrictions-on-content-models-and-on-attribute-values><span class=secno>1.10.3 </span>Restrictions on content models and on attribute values</a></ol></li>
+ <li><a href=#recommended-reading><span class=secno>1.11 </span>Recommended reading</a></ol></li>
+ <li><a href=#infrastructure><span class=secno>2 </span>Common infrastructure</a>
+ <ol>
+ <li><a href=#terminology><span class=secno>2.1 </span>Terminology</a>
+ <ol>
+ <li><a href=#resources><span class=secno>2.1.1 </span>Resources</a></li>
+ <li><a href=#xml><span class=secno>2.1.2 </span>XML</a></li>
+ <li><a href=#dom-trees><span class=secno>2.1.3 </span>DOM trees</a></li>
+ <li><a href=#scripting-0><span class=secno>2.1.4 </span>Scripting</a></li>
+ <li><a href=#plugins><span class=secno>2.1.5 </span>Plugins</a></li>
+ <li><a href=#character-encodings><span class=secno>2.1.6 </span>Character encodings</a></ol></li>
+ <li><a href=#conformance-requirements><span class=secno>2.2 </span>Conformance requirements</a>
+ <ol>
+ <li><a href=#dependencies><span class=secno>2.2.1 </span>Dependencies</a></li>
+ <li><a href=#extensibility><span class=secno>2.2.2 </span>Extensibility</a></ol></li>
+ <li><a href=#case-sensitivity-and-string-comparison><span class=secno>2.3 </span>Case-sensitivity and string comparison</a></li>
+ <li><a href=#common-microsyntaxes><span class=secno>2.4 </span>Common microsyntaxes</a>
+ <ol>
+ <li><a href=#common-parser-idioms><span class=secno>2.4.1 </span>Common parser idioms</a></li>
+ <li><a href=#boolean-attributes><span class=secno>2.4.2 </span>Boolean attributes</a></li>
+ <li><a href=#keywords-and-enumerated-attributes><span class=secno>2.4.3 </span>Keywords and enumerated attributes</a></li>
+ <li><a href=#numbers><span class=secno>2.4.4 </span>Numbers</a>
+ <ol>
+ <li><a href=#non-negative-integers><span class=secno>2.4.4.1 </span>Non-negative integers</a></li>
+ <li><a href=#signed-integers><span class=secno>2.4.4.2 </span>Signed integers</a></li>
+ <li><a href=#real-numbers><span class=secno>2.4.4.3 </span>Real numbers</a></li>
+ <li><a href=#percentages-and-dimensions><span class=secno>2.4.4.4 </span>Percentages and lengths</a></li>
+ <li><a href=#lists-of-integers><span class=secno>2.4.4.5 </span>Lists of integers</a></li>
+ <li><a href=#lists-of-dimensions><span class=secno>2.4.4.6 </span>Lists of dimensions</a></ol></li>
+ <li><a href=#dates-and-times><span class=secno>2.4.5 </span>Dates and times</a>
+ <ol>
+ <li><a href=#months><span class=secno>2.4.5.1 </span>Months</a></li>
+ <li><a href=#dates><span class=secno>2.4.5.2 </span>Dates</a></li>
+ <li><a href=#times><span class=secno>2.4.5.3 </span>Times</a></li>
+ <li><a href=#local-dates-and-times><span class=secno>2.4.5.4 </span>Local dates and times</a></li>
+ <li><a href=#global-dates-and-times><span class=secno>2.4.5.5 </span>Global dates and times</a></li>
+ <li><a href=#weeks><span class=secno>2.4.5.6 </span>Weeks</a></li>
+ <li><a href=#vaguer-moments-in-time><span class=secno>2.4.5.7 </span>Vaguer moments in time</a></ol></li>
+ <li><a href=#colors><span class=secno>2.4.6 </span>Colors</a></li>
+ <li><a href=#space-separated-tokens><span class=secno>2.4.7 </span>Space-separated tokens</a></li>
+ <li><a href=#comma-separated-tokens><span class=secno>2.4.8 </span>Comma-separated tokens</a></li>
+ <li><a href=#syntax-references><span class=secno>2.4.9 </span>References</a></li>
+ <li><a href=#mq><span class=secno>2.4.10 </span>Media queries</a></ol></li>
+ <li><a href=#urls><span class=secno>2.5 </span>URLs</a>
+ <ol>
+ <li><a href=#terminology-0><span class=secno>2.5.1 </span>Terminology</a></li>
+ <li><a href=#dynamic-changes-to-base-urls><span class=secno>2.5.2 </span>Dynamic changes to base URLs</a></li>
+ <li><a href=#interfaces-for-url-manipulation><span class=secno>2.5.3 </span>Interfaces for URL manipulation</a></ol></li>
+ <li><a href=#fetching-resources><span class=secno>2.6 </span>Fetching resources</a>
+ <ol>
+ <li><a href=#concept-http-equivalent><span class=secno>2.6.1 </span>Protocol concepts</a></li>
+ <li><a href=#encrypted-http-and-related-security-concerns><span class=secno>2.6.2 </span>Encrypted HTTP and related security concerns</a></li>
+ <li><a href=#content-type-sniffing><span class=secno>2.6.3 </span>Determining the type of a resource</a></ol></li>
+ <li><a href=#common-dom-interfaces><span class=secno>2.7 </span>Common DOM interfaces</a>
+ <ol>
+ <li><a href=#reflecting-content-attributes-in-idl-attributes><span class=secno>2.7.1 </span>Reflecting content attributes in IDL attributes</a></li>
+ <li><a href=#collections-0><span class=secno>2.7.2 </span>Collections</a>
+ <ol>
+ <li><a href=#htmlcollection-0><span class=secno>2.7.2.1 </span>HTMLCollection</a></li>
+ <li><a href=#htmlallcollection-0><span class=secno>2.7.2.2 </span>HTMLAllCollection</a></li>
+ <li><a href=#htmlformcontrolscollection-0><span class=secno>2.7.2.3 </span>HTMLFormControlsCollection</a></li>
+ <li><a href=#htmloptionscollection-0><span class=secno>2.7.2.4 </span>HTMLOptionsCollection</a></li>
+ <li><a href=#htmlpropertiescollection-0><span class=secno>2.7.2.5 </span>HTMLPropertiesCollection</a></ol></li>
+ <li><a href=#domtokenlist-0><span class=secno>2.7.3 </span>DOMTokenList</a></li>
+ <li><a href=#domsettabletokenlist-0><span class=secno>2.7.4 </span>DOMSettableTokenList</a></li>
+ <li><a href=#safe-passing-of-structured-data><span class=secno>2.7.5 </span>Safe passing of structured data</a></li>
+ <li><a href=#domstringmap-0><span class=secno>2.7.6 </span>DOMStringMap</a></li>
+ <li><a href=#dom-feature-strings><span class=secno>2.7.7 </span>DOM feature strings</a></li>
+ <li><a href=#exceptions><span class=secno>2.7.8 </span>Exceptions</a></li>
+ <li><a href=#garbage-collection><span class=secno>2.7.9 </span>Garbage collection</a></ol></li>
+ <li><a href=#namespaces><span class=secno>2.8 </span>Namespaces</a></ol></li>
+ <li><a href=#dom><span class=secno>3 </span>Semantics, structure, and APIs of HTML documents</a>
+ <ol>
+ <li><a href=#documents><span class=secno>3.1 </span>Documents</a>
+ <ol>
+ <li><a href=#documents-in-the-dom><span class=secno>3.1.1 </span>Documents in the DOM</a></li>
+ <li><a href=#security-document><span class=secno>3.1.2 </span>Security</a></li>
+ <li><a href=#resource-metadata-management><span class=secno>3.1.3 </span>Resource metadata management</a></li>
+ <li><a href=#dom-tree-accessors><span class=secno>3.1.4 </span>DOM tree accessors</a></li>
+ <li><a href=#creating-documents><span class=secno>3.1.5 </span>Creating documents</a></ol></li>
+ <li><a href=#elements><span class=secno>3.2 </span>Elements</a>
+ <ol>
+ <li><a href=#semantics-0><span class=secno>3.2.1 </span>Semantics</a></li>
+ <li><a href=#elements-in-the-dom><span class=secno>3.2.2 </span>Elements in the DOM</a></li>
+ <li><a href=#global-attributes><span class=secno>3.2.3 </span>Global attributes</a>
+ <ol>
+ <li><a href=#the-id-attribute><span class=secno>3.2.3.1 </span>The <code>id</code> attribute</a></li>
+ <li><a href=#the-title-attribute><span class=secno>3.2.3.2 </span>The <code>title</code> attribute</a></li>
+ <li><a href=#the-lang-and-xml:lang-attributes><span class=secno>3.2.3.3 </span>The <code title=attr-lang>lang</code> and <code title=attr-xml-lang>xml:lang</code> attributes</a></li>
+ <li><a href=#the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.4 </span>The <code>xml:base</code>
+ attribute (XML only)</a></li>
+ <li><a href=#the-dir-attribute><span class=secno>3.2.3.5 </span>The <code>dir</code> attribute</a></li>
+ <li><a href=#classes><span class=secno>3.2.3.6 </span>The <code>class</code> attribute</a></li>
+ <li><a href=#the-style-attribute><span class=secno>3.2.3.7 </span>The <code>style</code> attribute</a></li>
+ <li><a href=#embedding-custom-non-visible-data><span class=secno>3.2.3.8 </span>Embedding custom non-visible data</a></ol></li>
+ <li><a href=#element-definitions><span class=secno>3.2.4 </span>Element definitions</a>
+ <ol>
+ <li><a href=#attributes><span class=secno>3.2.4.1 </span>Attributes</a></ol></li>
+ <li><a href=#content-models><span class=secno>3.2.5 </span>Content models</a>
+ <ol>
+ <li><a href=#kinds-of-content><span class=secno>3.2.5.1 </span>Kinds of content</a>
+ <ol>
+ <li><a href=#metadata-content-0><span class=secno>3.2.5.1.1 </span>Metadata content</a></li>
+ <li><a href=#flow-content-0><span class=secno>3.2.5.1.2 </span>Flow content</a></li>
+ <li><a href=#sectioning-content-0><span class=secno>3.2.5.1.3 </span>Sectioning content</a></li>
+ <li><a href=#heading-content-0><span class=secno>3.2.5.1.4 </span>Heading content</a></li>
+ <li><a href=#phrasing-content-0><span class=secno>3.2.5.1.5 </span>Phrasing content</a></li>
+ <li><a href=#embedded-content-0><span class=secno>3.2.5.1.6 </span>Embedded content</a></li>
+ <li><a href=#interactive-content-0><span class=secno>3.2.5.1.7 </span>Interactive content</a></ol></li>
+ <li><a href=#transparent-content-models><span class=secno>3.2.5.2 </span>Transparent content models</a></li>
+ <li><a href=#paragraphs><span class=secno>3.2.5.3 </span>Paragraphs</a></ol></li>
+ <li><a href=#annotations-for-assistive-technology-products-(aria)><span class=secno>3.2.6 </span>Annotations for assistive technology products (ARIA)</a></ol></li>
+ <li><a href=#apis-in-html-documents><span class=secno>3.3 </span>APIs in HTML documents</a></li>
+ <li><a href=#interactions-with-xpath-and-xslt><span class=secno>3.4 </span>Interactions with XPath and XSLT</a></li>
+ <li><a href=#dynamic-markup-insertion><span class=secno>3.5 </span>Dynamic markup insertion</a>
+ <ol>
+ <li><a href=#opening-the-input-stream><span class=secno>3.5.1 </span>Opening the input stream</a></li>
+ <li><a href=#closing-the-input-stream><span class=secno>3.5.2 </span>Closing the input stream</a></li>
+ <li><a href=#document.write()><span class=secno>3.5.3 </span><code title=dom-document-write>document.write()</code></a></li>
+ <li><a href=#document.writeln()><span class=secno>3.5.4 </span><code title=dom-document-writeln>document.writeln()</code></a></li>
+ <li><a href=#innerhtml><span class=secno>3.5.5 </span><code title=dom-innerHTML>innerHTML</code></a></li>
+ <li><a href=#outerhtml><span class=secno>3.5.6 </span><code title=dom-outerHTML>outerHTML</code></a></li>
+ <li><a href=#insertadjacenthtml()><span class=secno>3.5.7 </span><code title=dom-insertAdjacentHTML>insertAdjacentHTML()</code></a></ol></ol></li>
+ <li><a href=#semantics><span class=secno>4 </span>The elements of HTML</a>
+ <ol>
+ <li><a href=#the-root-element><span class=secno>4.1 </span>The root element</a>
+ <ol>
+ <li><a href=#the-html-element-0><span class=secno>4.1.1 </span>The <code>html</code> element</a></ol></li>
+ <li><a href=#document-metadata><span class=secno>4.2 </span>Document metadata</a>
+ <ol>
+ <li><a href=#the-head-element-0><span class=secno>4.2.1 </span>The <code>head</code> element</a></li>
+ <li><a href=#the-title-element-0><span class=secno>4.2.2 </span>The <code>title</code> element</a></li>
+ <li><a href=#the-base-element><span class=secno>4.2.3 </span>The <code>base</code> element</a></li>
+ <li><a href=#the-link-element><span class=secno>4.2.4 </span>The <code>link</code> element</a></li>
+ <li><a href=#meta><span class=secno>4.2.5 </span>The <code>meta</code> element</a>
+ <ol>
+ <li><a href=#standard-metadata-names><span class=secno>4.2.5.1 </span>Standard metadata names</a></li>
+ <li><a href=#other-metadata-names><span class=secno>4.2.5.2 </span>Other metadata names</a></li>
+ <li><a href=#pragma-directives><span class=secno>4.2.5.3 </span>Pragma directives</a></li>
+ <li><a href=#other-pragma-directives><span class=secno>4.2.5.4 </span>Other pragma directives</a></li>
+ <li><a href=#charset><span class=secno>4.2.5.5 </span>Specifying the document's character encoding</a></ol></li>
+ <li><a href=#the-style-element><span class=secno>4.2.6 </span>The <code>style</code> element</a></li>
+ <li><a href=#styling><span class=secno>4.2.7 </span>Styling</a></ol></li>
+ <li><a href=#scripting-1><span class=secno>4.3 </span>Scripting</a>
+ <ol>
+ <li><a href=#script><span class=secno>4.3.1 </span>The <code>script</code> element</a>
+ <ol>
+ <li><a href=#scriptingLanguages><span class=secno>4.3.1.1 </span>Scripting languages</a></li>
+ <li><a href=#restrictions-for-contents-of-script-elements><span class=secno>4.3.1.2 </span>Restrictions for contents of <code>script</code> elements</a></li>
+ <li><a href=#inline-documentation-for-external-scripts><span class=secno>4.3.1.3 </span>Inline documentation for external scripts</a></ol></li>
+ <li><a href=#the-noscript-element><span class=secno>4.3.2 </span>The <code>noscript</code> element</a></ol></li>
+ <li><a href=#sections><span class=secno>4.4 </span>Sections</a>
+ <ol>
+ <li><a href=#the-body-element-0><span class=secno>4.4.1 </span>The <code>body</code> element</a></li>
+ <li><a href=#the-section-element><span class=secno>4.4.2 </span>The <code>section</code> element</a></li>
+ <li><a href=#the-nav-element><span class=secno>4.4.3 </span>The <code>nav</code> element</a></li>
+ <li><a href=#the-article-element><span class=secno>4.4.4 </span>The <code>article</code> element</a></li>
+ <li><a href=#the-aside-element><span class=secno>4.4.5 </span>The <code>aside</code> element</a></li>
+ <li><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><span class=secno>4.4.6 </span>The <code>h1</code>, <code>h2</code>,
+ <code>h3</code>, <code>h4</code>,
+ <code>h5</code>, and <code>h6</code>
+ elements</a></li>
+ <li><a href=#the-hgroup-element><span class=secno>4.4.7 </span>The <code>hgroup</code> element</a></li>
+ <li><a href=#the-header-element><span class=secno>4.4.8 </span>The <code>header</code> element</a></li>
+ <li><a href=#the-footer-element><span class=secno>4.4.9 </span>The <code>footer</code> element</a></li>
+ <li><a href=#the-address-element><span class=secno>4.4.10 </span>The <code>address</code> element</a></li>
+ <li><a href=#headings-and-sections><span class=secno>4.4.11 </span>Headings and sections</a>
+ <ol>
+ <li><a href=#outlines><span class=secno>4.4.11.1 </span>Creating an outline</a></ol></ol></li>
+ <li><a href=#grouping-content><span class=secno>4.5 </span>Grouping content</a>
+ <ol>
+ <li><a href=#the-p-element><span class=secno>4.5.1 </span>The <code>p</code> element</a></li>
+ <li><a href=#the-hr-element><span class=secno>4.5.2 </span>The <code>hr</code> element</a></li>
+ <li><a href=#the-pre-element><span class=secno>4.5.3 </span>The <code>pre</code> element</a></li>
+ <li><a href=#the-blockquote-element><span class=secno>4.5.4 </span>The <code>blockquote</code> element</a></li>
+ <li><a href=#the-ol-element><span class=secno>4.5.5 </span>The <code>ol</code> element</a></li>
+ <li><a href=#the-ul-element><span class=secno>4.5.6 </span>The <code>ul</code> element</a></li>
+ <li><a href=#the-li-element><span class=secno>4.5.7 </span>The <code>li</code> element</a></li>
+ <li><a href=#the-dl-element><span class=secno>4.5.8 </span>The <code>dl</code> element</a></li>
+ <li><a href=#the-dt-element><span class=secno>4.5.9 </span>The <code>dt</code> element</a></li>
+ <li><a href=#the-dd-element><span class=secno>4.5.10 </span>The <code>dd</code> element</a></li>
+ <li><a href=#the-figure-element><span class=secno>4.5.11 </span>The <code>figure</code> element</a></li>
+ <li><a href=#the-figcaption-element><span class=secno>4.5.12 </span>The <code>figcaption</code> element</a></li>
+ <li><a href=#the-div-element><span class=secno>4.5.13 </span>The <code>div</code> element</a></ol></li>
+ <li><a href=#text-level-semantics><span class=secno>4.6 </span>Text-level semantics</a>
+ <ol>
+ <li><a href=#the-a-element><span class=secno>4.6.1 </span>The <code>a</code> element</a></li>
+ <li><a href=#the-em-element><span class=secno>4.6.2 </span>The <code>em</code> element</a></li>
+ <li><a href=#the-strong-element><span class=secno>4.6.3 </span>The <code>strong</code> element</a></li>
+ <li><a href=#the-small-element><span class=secno>4.6.4 </span>The <code>small</code> element</a></li>
+ <li><a href=#the-cite-element><span class=secno>4.6.5 </span>The <code>cite</code> element</a></li>
+ <li><a href=#the-q-element><span class=secno>4.6.6 </span>The <code>q</code> element</a></li>
+ <li><a href=#the-dfn-element><span class=secno>4.6.7 </span>The <code>dfn</code> element</a></li>
+ <li><a href=#the-abbr-element><span class=secno>4.6.8 </span>The <code>abbr</code> element</a></li>
+ <li><a href=#the-time-element><span class=secno>4.6.9 </span>The <code>time</code> element</a></li>
+ <li><a href=#the-code-element><span class=secno>4.6.10 </span>The <code>code</code> element</a></li>
+ <li><a href=#the-var-element><span class=secno>4.6.11 </span>The <code>var</code> element</a></li>
+ <li><a href=#the-samp-element><span class=secno>4.6.12 </span>The <code>samp</code> element</a></li>
+ <li><a href=#the-kbd-element><span class=secno>4.6.13 </span>The <code>kbd</code> element</a></li>
+ <li><a href=#the-sub-and-sup-elements><span class=secno>4.6.14 </span>The <code>sub</code> and <code>sup</code> elements</a></li>
+ <li><a href=#the-i-element><span class=secno>4.6.15 </span>The <code>i</code> element</a></li>
+ <li><a href=#the-b-element><span class=secno>4.6.16 </span>The <code>b</code> element</a></li>
+ <li><a href=#the-mark-element><span class=secno>4.6.17 </span>The <code>mark</code> element</a></li>
+ <li><a href=#the-ruby-element><span class=secno>4.6.18 </span>The <code>ruby</code> element</a></li>
+ <li><a href=#the-rt-element><span class=secno>4.6.19 </span>The <code>rt</code> element</a></li>
+ <li><a href=#the-rp-element><span class=secno>4.6.20 </span>The <code>rp</code> element</a></li>
+ <li><a href=#the-bdo-element><span class=secno>4.6.21 </span>The <code>bdo</code> element</a></li>
+ <li><a href=#the-span-element><span class=secno>4.6.22 </span>The <code>span</code> element</a></li>
+ <li><a href=#the-br-element><span class=secno>4.6.23 </span>The <code>br</code> element</a></li>
+ <li><a href=#the-wbr-element><span class=secno>4.6.24 </span>The <code>wbr</code> element</a></li>
+ <li><a href=#usage-summary><span class=secno>4.6.25 </span>Usage summary</a></ol></li>
+ <li><a href=#edits><span class=secno>4.7 </span>Edits</a>
+ <ol>
+ <li><a href=#the-ins-element><span class=secno>4.7.1 </span>The <code>ins</code> element</a></li>
+ <li><a href=#the-del-element><span class=secno>4.7.2 </span>The <code>del</code> element</a></li>
+ <li><a href=#attributes-common-to-ins-and-del-elements><span class=secno>4.7.3 </span>Attributes common to <code>ins</code> and <code>del</code> elements</a></li>
+ <li><a href=#edits-and-paragraphs><span class=secno>4.7.4 </span>Edits and paragraphs</a></li>
+ <li><a href=#edits-and-lists><span class=secno>4.7.5 </span>Edits and lists</a></ol></li>
+ <li><a href=#embedded-content-1><span class=secno>4.8 </span>Embedded content</a>
+ <ol>
+ <li><a href=#the-img-element><span class=secno>4.8.1 </span>The <code>img</code> element</a>
+ <ol>
+ <li><a href=#alt><span class=secno>4.8.1.1 </span>Requirements for providing text to act as an alternative for images</a>
+ <ol>
+ <li><a href=#a-link-or-button-containing-nothing-but-the-image><span class=secno>4.8.1.1.1 </span>A link or button containing nothing but the image</a></li>
+ <li><a href=#a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations><span class=secno>4.8.1.1.2 </span>A phrase or paragraph with an alternative graphical representation: charts, diagrams, graphs, maps, illustrations</a></li>
+ <li><a href=#a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos><span class=secno>4.8.1.1.3 </span>A short phrase or label with an alternative graphical representation: icons, logos</a></li>
+ <li><a href=#text-that-has-been-rendered-to-a-graphic-for-typographical-effect><span class=secno>4.8.1.1.4 </span>Text that has been rendered to a graphic for typographical effect</a></li>
+ <li><a href=#a-graphical-representation-of-some-of-the-surrounding-text><span class=secno>4.8.1.1.5 </span>A graphical representation of some of the surrounding text</a></li>
+ <li><a href="#a-purely-decorative-image-that-doesn't-add-any-information"><span class=secno>4.8.1.1.6 </span>A purely decorative image that doesn't add any information</a></li>
+ <li><a href=#a-group-of-images-that-form-a-single-larger-picture-with-no-links><span class=secno>4.8.1.1.7 </span>A group of images that form a single larger picture with no links</a></li>
+ <li><a href=#a-group-of-images-that-form-a-single-larger-picture-with-links><span class=secno>4.8.1.1.8 </span>A group of images that form a single larger picture with links</a></li>
+ <li><a href=#a-key-part-of-the-content><span class=secno>4.8.1.1.9 </span>A key part of the content</a></li>
+ <li><a href=#an-image-not-intended-for-the-user><span class=secno>4.8.1.1.10 </span>An image not intended for the user</a></li>
+ <li><a href=#an-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images><span class=secno>4.8.1.1.11 </span>An image in an e-mail or private document intended for a specific person who is known to be able to view images</a></li>
+ <li><a href=#general-guidelines><span class=secno>4.8.1.1.12 </span>General guidelines</a></li>
+ <li><a href=#guidance-for-markup-generators><span class=secno>4.8.1.1.13 </span>Guidance for markup generators</a></li>
+ <li><a href=#guidance-for-conformance-checkers><span class=secno>4.8.1.1.14 </span>Guidance for conformance checkers</a></ol></ol></li>
+ <li><a href=#the-iframe-element><span class=secno>4.8.2 </span>The <code>iframe</code> element</a></li>
+ <li><a href=#the-embed-element><span class=secno>4.8.3 </span>The <code>embed</code> element</a></li>
+ <li><a href=#the-object-element><span class=secno>4.8.4 </span>The <code>object</code> element</a></li>
+ <li><a href=#the-param-element><span class=secno>4.8.5 </span>The <code>param</code> element</a></li>
+ <li><a href=#video><span class=secno>4.8.6 </span>The <code>video</code> element</a></li>
+ <li><a href=#audio><span class=secno>4.8.7 </span>The <code>audio</code> element</a></li>
+ <li><a href=#the-source-element><span class=secno>4.8.8 </span>The <code>source</code> element</a></li>
+ <li><a href=#the-track-element><span class=secno>4.8.9 </span>The <code>track</code> element</a></li>
+ <li><a href=#media-elements><span class=secno>4.8.10 </span>Media elements</a>
+ <ol>
+ <li><a href=#error-codes><span class=secno>4.8.10.1 </span>Error codes</a></li>
+ <li><a href=#location-of-the-media-resource><span class=secno>4.8.10.2 </span>Location of the media resource</a></li>
+ <li><a href=#mime-types><span class=secno>4.8.10.3 </span>MIME types</a></li>
+ <li><a href=#network-states><span class=secno>4.8.10.4 </span>Network states</a></li>
+ <li><a href=#loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the media resource</a></li>
+ <li><a href=#offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets into the media resource</a></li>
+ <li><a href=#the-ready-states><span class=secno>4.8.10.7 </span>The ready states</a></li>
+ <li><a href=#playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the media resource</a></li>
+ <li><a href=#seeking><span class=secno>4.8.10.9 </span>Seeking</a></li>
+ <li><a href=#timed-tracks><span class=secno>4.8.10.10 </span>Timed tracks</a>
+ <ol>
+ <li><a href=#timed-track-model><span class=secno>4.8.10.10.1 </span>Timed track model</a></li>
+ <li><a href=#sourcing-in-band-timed-tracks><span class=secno>4.8.10.10.2 </span>Sourcing in-band timed tracks</a></li>
+ <li><a href=#sourcing-out-of-band-timed-tracks><span class=secno>4.8.10.10.3 </span>Sourcing out-of-band timed tracks</a></li>
+ <li><a href=#guidelines-for-exposing-cues-in-various-formats-as-timed-track-cues><span class=secno>4.8.10.10.4 </span>Guidelines for exposing cues in various formats as
+ timed track cues</a></li>
+ <li><a href=#timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</a></li>
+ <li><a href=#cue-events><span class=secno>4.8.10.10.6 </span>Event definitions</a></ol></li>
+ <li><a href=#websrt><span class=secno>4.8.10.11 </span>WebSRT</a>
+ <ol>
+ <li><a href=#syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</a></li>
+ <li><a href=#parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</a></ol></li>
+ <li><a href=#user-interface><span class=secno>4.8.10.12 </span>User interface</a></li>
+ <li><a href=#time-ranges><span class=secno>4.8.10.13 </span>Time ranges</a></li>
+ <li><a href=#mediaevents><span class=secno>4.8.10.14 </span>Event summary</a></li>
+ <li><a href=#security-and-privacy-considerations><span class=secno>4.8.10.15 </span>Security and privacy considerations</a></ol></li>
+ <li><a href=#the-canvas-element><span class=secno>4.8.11 </span>The <code>canvas</code> element</a>
+ <ol>
+ <li><a href=#2dcontext><span class=secno>4.8.11.1 </span>The 2D context</a>
+ <ol>
+ <li><a href=#the-canvas-state><span class=secno>4.8.11.1.1 </span>The canvas state</a></li>
+ <li><a href=#transformations><span class=secno>4.8.11.1.2 </span>Transformations</a></li>
+ <li><a href=#compositing><span class=secno>4.8.11.1.3 </span>Compositing</a></li>
+ <li><a href=#colors-and-styles><span class=secno>4.8.11.1.4 </span>Colors and styles</a></li>
+ <li><a href=#line-styles><span class=secno>4.8.11.1.5 </span>Line styles</a></li>
+ <li><a href=#shadows><span class=secno>4.8.11.1.6 </span>Shadows</a></li>
+ <li><a href=#simple-shapes-(rectangles)><span class=secno>4.8.11.1.7 </span>Simple shapes (rectangles)</a></li>
+ <li><a href=#complex-shapes-(paths)><span class=secno>4.8.11.1.8 </span>Complex shapes (paths)</a></li>
+ <li><a href=#focus-management-0><span class=secno>4.8.11.1.9 </span>Focus management</a></li>
+ <li><a href=#text-0><span class=secno>4.8.11.1.10 </span>Text</a></li>
+ <li><a href=#images><span class=secno>4.8.11.1.11 </span>Images</a></li>
+ <li><a href=#pixel-manipulation><span class=secno>4.8.11.1.12 </span>Pixel manipulation</a></li>
+ <li><a href=#drawing-model><span class=secno>4.8.11.1.13 </span>Drawing model</a></li>
+ <li><a href=#examples><span class=secno>4.8.11.1.14 </span>Examples</a></ol></li>
+ <li><a href=#color-spaces-and-color-correction><span class=secno>4.8.11.2 </span>Color spaces and color correction</a></li>
+ <li><a href=#security-with-canvas-elements><span class=secno>4.8.11.3 </span>Security with <code>canvas</code> elements</a></ol></li>
+ <li><a href=#the-map-element><span class=secno>4.8.12 </span>The <code>map</code> element</a></li>
+ <li><a href=#the-area-element><span class=secno>4.8.13 </span>The <code>area</code> element</a></li>
+ <li><a href=#image-maps><span class=secno>4.8.14 </span>Image maps</a>
+ <ol>
+ <li><a href=#authoring><span class=secno>4.8.14.1 </span>Authoring</a></li>
+ <li><a href=#processing-model><span class=secno>4.8.14.2 </span>Processing model</a></ol></li>
+ <li><a href=#mathml><span class=secno>4.8.15 </span>MathML</a></li>
+ <li><a href=#svg-0><span class=secno>4.8.16 </span>SVG</a></li>
+ <li><a href=#dimension-attributes><span class=secno>4.8.17 </span>Dimension attributes</a></ol></li>
+ <li><a href=#tabular-data><span class=secno>4.9 </span>Tabular data</a>
+ <ol>
+ <li><a href=#the-table-element><span class=secno>4.9.1 </span>The <code>table</code> element</a></li>
+ <li><a href=#the-caption-element><span class=secno>4.9.2 </span>The <code>caption</code> element</a></li>
+ <li><a href=#the-colgroup-element><span class=secno>4.9.3 </span>The <code>colgroup</code> element</a></li>
+ <li><a href=#the-col-element><span class=secno>4.9.4 </span>The <code>col</code> element</a></li>
+ <li><a href=#the-tbody-element><span class=secno>4.9.5 </span>The <code>tbody</code> element</a></li>
+ <li><a href=#the-thead-element><span class=secno>4.9.6 </span>The <code>thead</code> element</a></li>
+ <li><a href=#the-tfoot-element><span class=secno>4.9.7 </span>The <code>tfoot</code> element</a></li>
+ <li><a href=#the-tr-element><span class=secno>4.9.8 </span>The <code>tr</code> element</a></li>
+ <li><a href=#the-td-element><span class=secno>4.9.9 </span>The <code>td</code> element</a></li>
+ <li><a href=#the-th-element><span class=secno>4.9.10 </span>The <code>th</code> element</a></li>
+ <li><a href=#attributes-common-to-td-and-th-elements><span class=secno>4.9.11 </span>Attributes common to <code>td</code> and <code>th</code> elements</a></li>
+ <li><a href=#processing-model-0><span class=secno>4.9.12 </span>Processing model</a>
+ <ol>
+ <li><a href=#forming-a-table><span class=secno>4.9.12.1 </span>Forming a table</a></li>
+ <li><a href=#header-and-data-cell-semantics><span class=secno>4.9.12.2 </span>Forming relationships between data cells and header cells</a></ol></li>
+ <li><a href=#examples-0><span class=secno>4.9.13 </span>Examples</a></ol></li>
+ <li><a href=#forms><span class=secno>4.10 </span>Forms</a>
+ <ol>
+ <li><a href=#introduction-0><span class=secno>4.10.1 </span>Introduction</a>
+ <ol>
+ <li><a href="#writing-a-form's-user-interface"><span class=secno>4.10.1.1 </span>Writing a form's user interface</a></li>
+ <li><a href=#implementing-the-server-side-processing-for-a-form><span class=secno>4.10.1.2 </span>Implementing the server-side processing for a form</a></li>
+ <li><a href=#configuring-a-form-to-communicate-with-a-server><span class=secno>4.10.1.3 </span>Configuring a form to communicate with a server</a></li>
+ <li><a href=#client-side-form-validation><span class=secno>4.10.1.4 </span>Client-side form validation</a></ol></li>
+ <li><a href=#categories><span class=secno>4.10.2 </span>Categories</a></li>
+ <li><a href=#the-form-element><span class=secno>4.10.3 </span>The <code>form</code> element</a></li>
+ <li><a href=#the-fieldset-element><span class=secno>4.10.4 </span>The <code>fieldset</code> element</a></li>
+ <li><a href=#the-legend-element><span class=secno>4.10.5 </span>The <code>legend</code> element</a></li>
+ <li><a href=#the-label-element><span class=secno>4.10.6 </span>The <code>label</code> element</a></li>
+ <li><a href=#the-input-element><span class=secno>4.10.7 </span>The <code>input</code> element</a>
+ <ol>
+ <li><a href=#states-of-the-type-attribute><span class=secno>4.10.7.1 </span>States of the <code title=attr-input-type>type</code> attribute</a>
+ <ol>
+ <li><a href=#hidden-state><span class=secno>4.10.7.1.1 </span>Hidden state</a></li>
+ <li><a href=#text-state-and-search-state><span class=secno>4.10.7.1.2 </span>Text state and Search state</a></li>
+ <li><a href=#telephone-state><span class=secno>4.10.7.1.3 </span>Telephone state</a></li>
+ <li><a href=#url-state><span class=secno>4.10.7.1.4 </span>URL state</a></li>
+ <li><a href=#e-mail-state><span class=secno>4.10.7.1.5 </span>E-mail state</a></li>
+ <li><a href=#password-state><span class=secno>4.10.7.1.6 </span>Password state</a></li>
+ <li><a href=#date-and-time-state><span class=secno>4.10.7.1.7 </span>Date and Time state</a></li>
+ <li><a href=#date-state><span class=secno>4.10.7.1.8 </span>Date state</a></li>
+ <li><a href=#month-state><span class=secno>4.10.7.1.9 </span>Month state</a></li>
+ <li><a href=#week-state><span class=secno>4.10.7.1.10 </span>Week state</a></li>
+ <li><a href=#time-state><span class=secno>4.10.7.1.11 </span>Time state</a></li>
+ <li><a href=#local-date-and-time-state><span class=secno>4.10.7.1.12 </span>Local Date and Time state</a></li>
+ <li><a href=#number-state><span class=secno>4.10.7.1.13 </span>Number state</a></li>
+ <li><a href=#range-state><span class=secno>4.10.7.1.14 </span>Range state</a></li>
+ <li><a href=#color-state><span class=secno>4.10.7.1.15 </span>Color state</a></li>
+ <li><a href=#checkbox-state><span class=secno>4.10.7.1.16 </span>Checkbox state</a></li>
+ <li><a href=#radio-button-state><span class=secno>4.10.7.1.17 </span>Radio Button state</a></li>
+ <li><a href=#file-upload-state><span class=secno>4.10.7.1.18 </span>File Upload state</a></li>
+ <li><a href=#submit-button-state><span class=secno>4.10.7.1.19 </span>Submit Button state</a></li>
+ <li><a href=#image-button-state><span class=secno>4.10.7.1.20 </span>Image Button state</a></li>
+ <li><a href=#reset-button-state><span class=secno>4.10.7.1.21 </span>Reset Button state</a></li>
+ <li><a href=#button-state><span class=secno>4.10.7.1.22 </span>Button state</a></ol></li>
+ <li><a href=#common-input-element-attributes><span class=secno>4.10.7.2 </span>Common <code>input</code> element attributes</a>
+ <ol>
+ <li><a href=#the-autocomplete-attribute><span class=secno>4.10.7.2.1 </span>The <code title=attr-input-autocomplete>autocomplete</code> attribute</a></li>
+ <li><a href=#the-list-attribute><span class=secno>4.10.7.2.2 </span>The <code title=attr-input-list>list</code> attribute</a></li>
+ <li><a href=#the-readonly-attribute><span class=secno>4.10.7.2.3 </span>The <code title=attr-input-readonly>readonly</code> attribute</a></li>
+ <li><a href=#the-size-attribute><span class=secno>4.10.7.2.4 </span>The <code title=attr-input-size>size</code> attribute</a></li>
+ <li><a href=#the-required-attribute><span class=secno>4.10.7.2.5 </span>The <code title=attr-input-required>required</code> attribute</a></li>
+ <li><a href=#the-multiple-attribute><span class=secno>4.10.7.2.6 </span>The <code title=attr-input-multiple>multiple</code> attribute</a></li>
+ <li><a href=#the-maxlength-attribute><span class=secno>4.10.7.2.7 </span>The <code title=attr-input-maxlength>maxlength</code> attribute</a></li>
+ <li><a href=#the-pattern-attribute><span class=secno>4.10.7.2.8 </span>The <code title=attr-input-pattern>pattern</code> attribute</a></li>
+ <li><a href=#the-min-and-max-attributes><span class=secno>4.10.7.2.9 </span>The <code title=attr-input-min>min</code> and <code title=attr-input-max>max</code> attributes</a></li>
+ <li><a href=#the-step-attribute><span class=secno>4.10.7.2.10 </span>The <code title=attr-input-step>step</code> attribute</a></li>
+ <li><a href=#the-placeholder-attribute><span class=secno>4.10.7.2.11 </span>The <code title=attr-input-placeholder>placeholder</code> attribute</a></ol></li>
+ <li><a href=#common-input-element-apis><span class=secno>4.10.7.3 </span>Common <code>input</code> element APIs</a></li>
+ <li><a href=#common-event-behaviors><span class=secno>4.10.7.4 </span>Common event behaviors</a></ol></li>
+ <li><a href=#the-button-element><span class=secno>4.10.8 </span>The <code>button</code> element</a></li>
+ <li><a href=#the-select-element><span class=secno>4.10.9 </span>The <code>select</code> element</a></li>
+ <li><a href=#the-datalist-element><span class=secno>4.10.10 </span>The <code>datalist</code> element</a></li>
+ <li><a href=#the-optgroup-element><span class=secno>4.10.11 </span>The <code>optgroup</code> element</a></li>
+ <li><a href=#the-option-element><span class=secno>4.10.12 </span>The <code>option</code> element</a></li>
+ <li><a href=#the-textarea-element><span class=secno>4.10.13 </span>The <code>textarea</code> element</a></li>
+ <li><a href=#the-keygen-element><span class=secno>4.10.14 </span>The <code>keygen</code> element</a></li>
+ <li><a href=#the-output-element><span class=secno>4.10.15 </span>The <code>output</code> element</a></li>
+ <li><a href=#the-progress-element><span class=secno>4.10.16 </span>The <code>progress</code> element</a></li>
+ <li><a href=#the-meter-element><span class=secno>4.10.17 </span>The <code>meter</code> element</a></li>
+ <li><a href=#association-of-controls-and-forms><span class=secno>4.10.18 </span>Association of controls and forms</a></li>
+ <li><a href=#attributes-common-to-form-controls><span class=secno>4.10.19 </span>Attributes common to form controls</a>
+ <ol>
+ <li><a href=#naming-form-controls><span class=secno>4.10.19.1 </span>Naming form controls</a></li>
+ <li><a href=#enabling-and-disabling-form-controls><span class=secno>4.10.19.2 </span>Enabling and disabling form controls</a></li>
+ <li><a href="#a-form-control's-value"><span class=secno>4.10.19.3 </span>A form control's value</a></li>
+ <li><a href=#autofocusing-a-form-control><span class=secno>4.10.19.4 </span>Autofocusing a form control</a></li>
+ <li><a href=#limiting-user-input-length><span class=secno>4.10.19.5 </span>Limiting user input length</a></li>
+ <li><a href=#form-submission-0><span class=secno>4.10.19.6 </span>Form submission</a></ol></li>
+ <li><a href=#constraints><span class=secno>4.10.20 </span>Constraints</a>
+ <ol>
+ <li><a href=#definitions><span class=secno>4.10.20.1 </span>Definitions</a></li>
+ <li><a href=#constraint-validation><span class=secno>4.10.20.2 </span>Constraint validation</a></li>
+ <li><a href=#the-constraint-validation-api><span class=secno>4.10.20.3 </span>The constraint validation API</a></li>
+ <li><a href=#security-forms><span class=secno>4.10.20.4 </span>Security</a></ol></li>
+ <li><a href=#form-submission><span class=secno>4.10.21 </span>Form submission</a>
+ <ol>
+ <li><a href=#introduction-1><span class=secno>4.10.21.1 </span>Introduction</a></li>
+ <li><a href=#implicit-submission><span class=secno>4.10.21.2 </span>Implicit submission</a></li>
+ <li><a href=#form-submission-algorithm><span class=secno>4.10.21.3 </span>Form submission algorithm</a></li>
+ <li><a href=#url-encoded-form-data><span class=secno>4.10.21.4 </span>URL-encoded form data</a></li>
+ <li><a href=#multipart-form-data><span class=secno>4.10.21.5 </span>Multipart form data</a></li>
+ <li><a href=#plain-text-form-data><span class=secno>4.10.21.6 </span>Plain text form data</a></ol></li>
+ <li><a href=#resetting-a-form><span class=secno>4.10.22 </span>Resetting a form</a></li>
+ <li><a href=#event-dispatch><span class=secno>4.10.23 </span>Event dispatch</a></ol></li>
+ <li><a href=#interactive-elements><span class=secno>4.11 </span>Interactive elements</a>
+ <ol>
+ <li><a href=#the-details-element><span class=secno>4.11.1 </span>The <code>details</code> element</a></li>
+ <li><a href=#the-summary-element><span class=secno>4.11.2 </span>The <code>summary</code> element</a></li>
+ <li><a href=#the-command><span class=secno>4.11.3 </span>The <code>command</code> element</a></li>
+ <li><a href=#menus><span class=secno>4.11.4 </span>The <code>menu</code> element</a>
+ <ol>
+ <li><a href=#menus-intro><span class=secno>4.11.4.1 </span>Introduction</a></li>
+ <li><a href=#building-menus-and-toolbars><span class=secno>4.11.4.2 </span>Building menus and toolbars</a></li>
+ <li><a href=#context-menus><span class=secno>4.11.4.3 </span>Context menus</a></li>
+ <li><a href=#toolbars><span class=secno>4.11.4.4 </span>Toolbars</a></ol></li>
+ <li><a href=#commands><span class=secno>4.11.5 </span>Commands</a>
+ <ol>
+ <li><a href=#using-the-a-element-to-define-a-command><span class=secno>4.11.5.1 </span>Using the <code>a</code> element to define a command</a></li>
+ <li><a href=#using-the-button-element-to-define-a-command><span class=secno>4.11.5.2 </span>Using the <code>button</code> element to define a command</a></li>
+ <li><a href=#using-the-input-element-to-define-a-command><span class=secno>4.11.5.3 </span>Using the <code>input</code> element to define a command</a></li>
+ <li><a href=#using-the-option-element-to-define-a-command><span class=secno>4.11.5.4 </span>Using the <code>option</code> element to define a command</a></li>
+ <li><a href=#using-the-command-element-to-define-a-command><span class=secno>4.11.5.5 </span>Using the <code>command</code> element to define
+ a command</a></li>
+ <li><a href=#using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.5.6 </span>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>label</code> element to define a command</a></li>
+ <li><a href=#using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.5.7 </span>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>legend</code> element to define a command</a></li>
+ <li><a href=#using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.5.8 </span>Using the <code title=attr-accesskey>accesskey</code> attribute to define a command on other elements</a></ol></li>
+ <li><a href=#devices><span class=secno>4.11.6 </span>The <code>device</code> element</a>
+ <ol>
+ <li><a href=#stream-api><span class=secno>4.11.6.1 </span>Stream API</a></li>
+ <li><a href=#peer-to-peer-connections><span class=secno>4.11.6.2 </span>Peer-to-peer connections</a></ol></ol></li>
+ <li><a href=#links><span class=secno>4.12 </span>Links</a>
+ <ol>
+ <li><a href=#hyperlink-elements><span class=secno>4.12.1 </span>Hyperlink elements</a></li>
+ <li><a href=#following-hyperlinks><span class=secno>4.12.2 </span>Following hyperlinks</a>
+ <ol>
+ <li><a href=#hyperlink-auditing><span class=secno>4.12.2.1 </span>Hyperlink auditing</a></ol></li>
+ <li><a href=#linkTypes><span class=secno>4.12.3 </span>Link types</a>
+ <ol>
+ <li><a href=#link-type-alternate><span class=secno>4.12.3.1 </span>Link type "<code>alternate</code>"</a></li>
+ <li><a href=#link-type-archives><span class=secno>4.12.3.2 </span>Link type "<code>archives</code>"</a></li>
+ <li><a href=#link-type-author><span class=secno>4.12.3.3 </span>Link type "<code>author</code>"</a></li>
+ <li><a href=#link-type-bookmark><span class=secno>4.12.3.4 </span>Link type "<code>bookmark</code>"</a></li>
+ <li><a href=#link-type-external><span class=secno>4.12.3.5 </span>Link type "<code>external</code>"</a></li>
+ <li><a href=#link-type-help><span class=secno>4.12.3.6 </span>Link type "<code>help</code>"</a></li>
+ <li><a href=#rel-icon><span class=secno>4.12.3.7 </span>Link type "<code>icon</code>"</a></li>
+ <li><a href=#link-type-license><span class=secno>4.12.3.8 </span>Link type "<code>license</code>"</a></li>
+ <li><a href=#link-type-nofollow><span class=secno>4.12.3.9 </span>Link type "<code>nofollow</code>"</a></li>
+ <li><a href=#link-type-noreferrer><span class=secno>4.12.3.10 </span>Link type "<code>noreferrer</code>"</a></li>
+ <li><a href=#link-type-pingback><span class=secno>4.12.3.11 </span>Link type "<code>pingback</code>"</a></li>
+ <li><a href=#link-type-prefetch><span class=secno>4.12.3.12 </span>Link type "<code>prefetch</code>"</a></li>
+ <li><a href=#link-type-search><span class=secno>4.12.3.13 </span>Link type "<code>search</code>"</a></li>
+ <li><a href=#link-type-stylesheet><span class=secno>4.12.3.14 </span>Link type "<code>stylesheet</code>"</a></li>
+ <li><a href=#link-type-sidebar><span class=secno>4.12.3.15 </span>Link type "<code>sidebar</code>"</a></li>
+ <li><a href=#link-type-tag><span class=secno>4.12.3.16 </span>Link type "<code>tag</code>"</a></li>
+ <li><a href=#hierarchical-link-types><span class=secno>4.12.3.17 </span>Hierarchical link types</a>
+ <ol>
+ <li><a href=#link-type-index><span class=secno>4.12.3.17.1 </span>Link type "<code>index</code>"</a></li>
+ <li><a href=#link-type-up><span class=secno>4.12.3.17.2 </span>Link type "<code>up</code>"</a></ol></li>
+ <li><a href=#sequential-link-types><span class=secno>4.12.3.18 </span>Sequential link types</a>
+ <ol>
+ <li><a href=#link-type-first><span class=secno>4.12.3.18.1 </span>Link type "<code>first</code>"</a></li>
+ <li><a href=#link-type-last><span class=secno>4.12.3.18.2 </span>Link type "<code>last</code>"</a></li>
+ <li><a href=#link-type-next><span class=secno>4.12.3.18.3 </span>Link type "<code>next</code>"</a></li>
+ <li><a href=#link-type-prev><span class=secno>4.12.3.18.4 </span>Link type "<code>prev</code>"</a></ol></li>
+ <li><a href=#other-link-types><span class=secno>4.12.3.19 </span>Other link types</a></ol></ol></li>
+ <li><a href=#common-idioms-without-dedicated-elements><span class=secno>4.13 </span>Common idioms without dedicated elements</a>
+ <ol>
+ <li><a href=#tag-clouds><span class=secno>4.13.1 </span>Tag clouds</a></li>
+ <li><a href=#conversations><span class=secno>4.13.2 </span>Conversations</a></li>
+ <li><a href=#footnotes><span class=secno>4.13.3 </span>Footnotes</a></ol></li>
+ <li><a href=#matching-html-elements-using-selectors><span class=secno>4.14 </span>Matching HTML elements using selectors</a>
+ <ol>
+ <li><a href=#selectors><span class=secno>4.14.1 </span>Case-sensitivity</a></li>
+ <li><a href=#pseudo-classes><span class=secno>4.14.2 </span>Pseudo-classes</a></ol></ol></li>
+ <li><a href=#microdata><span class=secno>5 </span>Microdata</a>
+ <ol>
+ <li><a href=#introduction-2><span class=secno>5.1 </span>Introduction</a>
+ <ol>
+ <li><a href=#overview><span class=secno>5.1.1 </span>Overview</a></li>
+ <li><a href=#the-basic-syntax><span class=secno>5.1.2 </span>The basic syntax</a></li>
+ <li><a href=#typed-items><span class=secno>5.1.3 </span>Typed items</a></li>
+ <li><a href=#global-identifiers-for-items><span class=secno>5.1.4 </span>Global identifiers for items</a></li>
+ <li><a href=#selecting-names-when-defining-vocabularies><span class=secno>5.1.5 </span>Selecting names when defining vocabularies</a></li>
+ <li><a href=#using-the-microdata-dom-api><span class=secno>5.1.6 </span>Using the microdata DOM API</a></ol></li>
+ <li><a href=#encoding-microdata><span class=secno>5.2 </span>Encoding microdata</a>
+ <ol>
+ <li><a href=#the-microdata-model><span class=secno>5.2.1 </span>The microdata model</a></li>
+ <li><a href=#items><span class=secno>5.2.2 </span>Items</a></li>
+ <li><a href=#names:-the-itemprop-attribute><span class=secno>5.2.3 </span>Names: the <code>itemprop</code> attribute</a></li>
+ <li><a href=#values><span class=secno>5.2.4 </span>Values</a></li>
+ <li><a href=#associating-names-with-items><span class=secno>5.2.5 </span>Associating names with items</a></ol></li>
+ <li><a href=#microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</a></li>
+ <li><a href=#mdvocabs><span class=secno>5.4 </span>Microdata vocabularies</a>
+ <ol>
+ <li><a href=#vcard><span class=secno>5.4.1 </span>vCard</a>
+ <ol>
+ <li><a href=#conversion-to-vcard><span class=secno>5.4.1.1 </span>Conversion to vCard</a></li>
+ <li><a href=#examples-1><span class=secno>5.4.1.2 </span>Examples</a></ol></li>
+ <li><a href=#vevent><span class=secno>5.4.2 </span>vEvent</a>
+ <ol>
+ <li><a href=#conversion-to-icalendar><span class=secno>5.4.2.1 </span>Conversion to iCalendar</a></li>
+ <li><a href=#examples-2><span class=secno>5.4.2.2 </span>Examples</a></ol></li>
+ <li><a href=#licensing-works><span class=secno>5.4.3 </span>Licensing works</a>
+ <ol>
+ <li><a href=#conversion-to-rdf><span class=secno>5.4.3.1 </span>Conversion to RDF</a></li>
+ <li><a href=#examples-3><span class=secno>5.4.3.2 </span>Examples</a></ol></ol></li>
+ <li><a href=#converting-html-to-other-formats><span class=secno>5.5 </span>Converting HTML to other formats</a>
+ <ol>
+ <li><a href=#json><span class=secno>5.5.1 </span>JSON</a></li>
+ <li><a href=#rdf><span class=secno>5.5.2 </span>RDF</a>
+ <ol>
+ <li><a href=#examples-4><span class=secno>5.5.2.1 </span>Examples</a></ol></li>
+ <li><a href=#atom><span class=secno>5.5.3 </span>Atom</a></ol></ol></li>
+ <li><a href=#browsers><span class=secno>6 </span>Loading Web pages</a>
+ <ol>
+ <li><a href=#windows><span class=secno>6.1 </span>Browsing contexts</a>
+ <ol>
+ <li><a href=#nested-browsing-contexts><span class=secno>6.1.1 </span>Nested browsing contexts</a>
+ <ol>
+ <li><a href=#navigating-nested-browsing-contexts-in-the-dom><span class=secno>6.1.1.1 </span>Navigating nested browsing contexts in the DOM</a></ol></li>
+ <li><a href=#auxiliary-browsing-contexts><span class=secno>6.1.2 </span>Auxiliary browsing contexts</a>
+ <ol>
+ <li><a href=#navigating-auxiliary-browsing-contexts-in-the-dom><span class=secno>6.1.2.1 </span>Navigating auxiliary browsing contexts in the DOM</a></ol></li>
+ <li><a href=#secondary-browsing-contexts><span class=secno>6.1.3 </span>Secondary browsing contexts</a></li>
+ <li><a href=#security-nav><span class=secno>6.1.4 </span>Security</a></li>
+ <li><a href=#groupings-of-browsing-contexts><span class=secno>6.1.5 </span>Groupings of browsing contexts</a></li>
+ <li><a href=#browsing-context-names><span class=secno>6.1.6 </span>Browsing context names</a></ol></li>
+ <li><a href=#the-window-object><span class=secno>6.2 </span>The <code>Window</code> object</a>
+ <ol>
+ <li><a href=#security-window><span class=secno>6.2.1 </span>Security</a></li>
+ <li><a href=#apis-for-creating-and-navigating-browsing-contexts-by-name><span class=secno>6.2.2 </span>APIs for creating and navigating browsing contexts by name</a></li>
+ <li><a href=#accessing-other-browsing-contexts><span class=secno>6.2.3 </span>Accessing other browsing contexts</a></li>
+ <li><a href=#named-access-on-the-window-object><span class=secno>6.2.4 </span>Named access on the <code>Window</code> object</a></li>
+ <li><a href=#garbage-collection-and-browsing-contexts><span class=secno>6.2.5 </span>Garbage collection and browsing contexts</a></li>
+ <li><a href=#browser-interface-elements><span class=secno>6.2.6 </span>Browser interface elements</a></li>
+ <li><a href=#the-windowproxy-object><span class=secno>6.2.7 </span>The <code>WindowProxy</code> object</a></ol></li>
+ <li><a href=#origin-0><span class=secno>6.3 </span>Origin</a>
+ <ol>
+ <li><a href=#relaxing-the-same-origin-restriction><span class=secno>6.3.1 </span>Relaxing the same-origin restriction</a></ol></li>
+ <li><a href=#history><span class=secno>6.4 </span>Session history and navigation</a>
+ <ol>
+ <li><a href=#the-session-history-of-browsing-contexts><span class=secno>6.4.1 </span>The session history of browsing contexts</a></li>
+ <li><a href=#the-history-interface><span class=secno>6.4.2 </span>The <code>History</code> interface</a></li>
+ <li><a href=#the-location-interface><span class=secno>6.4.3 </span>The <code>Location</code> interface</a>
+ <ol>
+ <li><a href=#security-location><span class=secno>6.4.3.1 </span>Security</a></ol></li>
+ <li><a href=#history-notes><span class=secno>6.4.4 </span>Implementation notes for session history</a></ol></li>
+ <li><a href=#browsing-the-web><span class=secno>6.5 </span>Browsing the Web</a>
+ <ol>
+ <li><a href=#navigating-across-documents><span class=secno>6.5.1 </span>Navigating across documents</a></li>
+ <li><a href=#read-html><span class=secno>6.5.2 </span>Page load processing model for HTML files</a></li>
+ <li><a href=#read-xml><span class=secno>6.5.3 </span>Page load processing model for XML files</a></li>
+ <li><a href=#read-text><span class=secno>6.5.4 </span>Page load processing model for text files</a></li>
+ <li><a href=#read-image><span class=secno>6.5.5 </span>Page load processing model for images</a></li>
+ <li><a href=#read-plugin><span class=secno>6.5.6 </span>Page load processing model for content that uses plugins</a></li>
+ <li><a href=#read-ua-inline><span class=secno>6.5.7 </span>Page load processing model for inline content that doesn't have a DOM</a></li>
+ <li><a href=#scroll-to-fragid><span class=secno>6.5.8 </span>Navigating to a fragment identifier</a></li>
+ <li><a href=#history-traversal><span class=secno>6.5.9 </span>History traversal</a>
+ <ol>
+ <li><a href=#event-definitions><span class=secno>6.5.9.1 </span>Event definitions</a></ol></li>
+ <li><a href=#unloading-documents><span class=secno>6.5.10 </span>Unloading documents</a>
+ <ol>
+ <li><a href=#event-definition><span class=secno>6.5.10.1 </span>Event definition</a></ol></li>
+ <li><a href=#aborting-a-document-load><span class=secno>6.5.11 </span>Aborting a document load</a></ol></li>
+ <li><a href=#offline><span class=secno>6.6 </span>Offline Web applications</a>
+ <ol>
+ <li><a href=#introduction-3><span class=secno>6.6.1 </span>Introduction</a>
+ <ol>
+ <li><a href=#appcacheevents><span class=secno>6.6.1.1 </span>Event summary</a></ol></li>
+ <li><a href=#appcache><span class=secno>6.6.2 </span>Application caches</a></li>
+ <li><a href=#manifests><span class=secno>6.6.3 </span>The cache manifest syntax</a>
+ <ol>
+ <li><a href=#a-sample-manifest><span class=secno>6.6.3.1 </span>A sample manifest</a></li>
+ <li><a href=#writing-cache-manifests><span class=secno>6.6.3.2 </span>Writing cache manifests</a></li>
+ <li><a href=#parsing-cache-manifests><span class=secno>6.6.3.3 </span>Parsing cache manifests</a></ol></li>
+ <li><a href=#downloading-or-updating-an-application-cache><span class=secno>6.6.4 </span>Downloading or updating an application cache</a></li>
+ <li><a href=#the-application-cache-selection-algorithm><span class=secno>6.6.5 </span>The application cache selection algorithm</a></li>
+ <li><a href=#changesToNetworkingModel><span class=secno>6.6.6 </span>Changes to the networking model</a></li>
+ <li><a href=#expiring-application-caches><span class=secno>6.6.7 </span>Expiring application caches</a></li>
+ <li><a href=#application-cache-api><span class=secno>6.6.8 </span>Application cache API</a></li>
+ <li><a href=#browser-state><span class=secno>6.6.9 </span>Browser state</a></ol></ol></li>
+ <li><a href=#webappapis><span class=secno>7 </span>Web application APIs</a>
+ <ol>
+ <li><a href=#scripting><span class=secno>7.1 </span>Scripting</a>
+ <ol>
+ <li><a href=#introduction-4><span class=secno>7.1.1 </span>Introduction</a></li>
+ <li><a href=#enabling-and-disabling-scripting><span class=secno>7.1.2 </span>Enabling and disabling scripting</a></li>
+ <li><a href=#processing-model-1><span class=secno>7.1.3 </span>Processing model</a>
+ <ol>
+ <li><a href=#definitions-0><span class=secno>7.1.3.1 </span>Definitions</a></li>
+ <li><a href=#calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</a></li>
+ <li><a href=#creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</a></li>
+ <li><a href=#killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</a></ol></li>
+ <li><a href=#event-loops><span class=secno>7.1.4 </span>Event loops</a>
+ <ol>
+ <li><a href=#definitions-1><span class=secno>7.1.4.1 </span>Definitions</a></li>
+ <li><a href=#processing-model-2><span class=secno>7.1.4.2 </span>Processing model</a></li>
+ <li><a href=#generic-task-sources><span class=secno>7.1.4.3 </span>Generic task sources</a></ol></li>
+ <li><a href=#javascript-protocol><span class=secno>7.1.5 </span>The <code title="">javascript:</code> protocol</a></li>
+ <li><a href=#events><span class=secno>7.1.6 </span>Events</a>
+ <ol>
+ <li><a href=#event-handler-attributes><span class=secno>7.1.6.1 </span>Event handlers</a></li>
+ <li><a href=#event-handlers-on-elements,-document-objects,-and-window-objects><span class=secno>7.1.6.2 </span>Event handlers on elements, <code>Document</code> objects, and <code>Window</code> objects</a></li>
+ <li><a href=#event-firing><span class=secno>7.1.6.3 </span>Event firing</a></li>
+ <li><a href=#events-and-the-window-object><span class=secno>7.1.6.4 </span>Events and the <code>Window</code> object</a></li>
+ <li><a href=#runtime-script-errors><span class=secno>7.1.6.5 </span>Runtime script errors</a></ol></ol></li>
+ <li><a href=#timers><span class=secno>7.2 </span>Timers</a></li>
+ <li><a href=#user-prompts><span class=secno>7.3 </span>User prompts</a>
+ <ol>
+ <li><a href=#simple-dialogs><span class=secno>7.3.1 </span>Simple dialogs</a></li>
+ <li><a href=#printing><span class=secno>7.3.2 </span>Printing</a></li>
+ <li><a href=#dialogs-implemented-using-separate-documents><span class=secno>7.3.3 </span>Dialogs implemented using separate documents</a></ol></li>
+ <li><a href=#system-state-and-capabilities><span class=secno>7.4 </span>System state and capabilities</a>
+ <ol>
+ <li><a href=#client-identification><span class=secno>7.4.1 </span>Client identification</a></li>
+ <li><a href=#custom-handlers><span class=secno>7.4.2 </span>Custom scheme and content handlers</a>
+ <ol>
+ <li><a href=#security-and-privacy><span class=secno>7.4.2.1 </span>Security and privacy</a></li>
+ <li><a href=#sample-handler-impl><span class=secno>7.4.2.2 </span>Sample user interface</a></ol></li>
+ <li><a href=#manually-releasing-the-storage-mutex><span class=secno>7.4.3 </span>Manually releasing the storage mutex</a></ol></ol></li>
+ <li><a href=#editing><span class=secno>8 </span>User interaction</a>
+ <ol>
+ <li><a href=#the-hidden-attribute><span class=secno>8.1 </span>The <code>hidden</code> attribute</a></li>
+ <li><a href=#activation><span class=secno>8.2 </span>Activation</a></li>
+ <li><a href=#scrolling-elements-into-view><span class=secno>8.3 </span>Scrolling elements into view</a></li>
+ <li><a href=#focus><span class=secno>8.4 </span>Focus</a>
+ <ol>
+ <li><a href=#sequential-focus-navigation><span class=secno>8.4.1 </span>Sequential focus navigation</a></li>
+ <li><a href=#focus-management><span class=secno>8.4.2 </span>Focus management</a></li>
+ <li><a href=#document-level-focus-apis><span class=secno>8.4.3 </span>Document-level focus APIs</a></li>
+ <li><a href=#element-level-focus-apis><span class=secno>8.4.4 </span>Element-level focus APIs</a></ol></li>
+ <li><a href=#the-accesskey-attribute><span class=secno>8.5 </span>The <code>accesskey</code> attribute</a></li>
+ <li><a href=#selection><span class=secno>8.6 </span>The text selection APIs</a>
+ <ol>
+ <li><a href=#documentSelection><span class=secno>8.6.1 </span>APIs for the browsing context selection</a></li>
+ <li><a href=#textFieldSelection><span class=secno>8.6.2 </span>APIs for the text field selections</a></ol></li>
+ <li><a href=#contenteditable><span class=secno>8.7 </span>The <code title=attr-contenteditable>contenteditable</code> attribute</a>
+ <ol>
+ <li><a href=#user-editing-actions><span class=secno>8.7.1 </span>User editing actions</a></li>
+ <li><a href=#making-entire-documents-editable><span class=secno>8.7.2 </span>Making entire documents editable</a></ol></li>
+ <li><a href=#spelling-and-grammar-checking><span class=secno>8.8 </span>Spelling and grammar checking</a></li>
+ <li><a href=#dnd><span class=secno>8.9 </span>Drag and drop</a>
+ <ol>
+ <li><a href=#introduction-5><span class=secno>8.9.1 </span>Introduction</a></li>
+ <li><a href=#the-dragevent-and-datatransfer-interfaces><span class=secno>8.9.2 </span>The <code>DragEvent</code> and <code>DataTransfer</code> interfaces</a></li>
+ <li><a href=#dndevents><span class=secno>8.9.3 </span>Events fired during a drag-and-drop action</a></li>
+ <li><a href=#drag-and-drop-processing-model><span class=secno>8.9.4 </span>Drag-and-drop processing model</a>
+ <ol>
+ <li><a href=#when-the-drag-and-drop-operation-starts-or-ends-in-another-document><span class=secno>8.9.4.1 </span>When the drag-and-drop operation starts or ends in another
+ document</a></li>
+ <li><a href=#when-the-drag-and-drop-operation-starts-or-ends-in-another-application><span class=secno>8.9.4.2 </span>When the drag-and-drop operation starts or ends in another
+ application</a></ol></li>
+ <li><a href=#the-draggable-attribute><span class=secno>8.9.5 </span>The <code>draggable</code> attribute</a></li>
+ <li><a href=#security-risks-in-the-drag-and-drop-model><span class=secno>8.9.6 </span>Security risks in the drag-and-drop model</a></ol></li>
+ <li><a href=#undo><span class=secno>8.10 </span>Undo history</a>
+ <ol>
+ <li><a href=#definitions-2><span class=secno>8.10.1 </span>Definitions</a></li>
+ <li><a href=#the-undomanager-interface><span class=secno>8.10.2 </span>The <code>UndoManager</code> interface</a></li>
+ <li><a href=#undo:-moving-back-in-the-undo-transaction-history><span class=secno>8.10.3 </span>Undo: moving back in the undo transaction history</a></li>
+ <li><a href=#redo:-moving-forward-in-the-undo-transaction-history><span class=secno>8.10.4 </span>Redo: moving forward in the undo transaction history</a></li>
+ <li><a href=#the-undomanagerevent-interface-and-the-undo-and-redo-events><span class=secno>8.10.5 </span>The <code>UndoManagerEvent</code> interface and the <code title=event-undo>undo</code> and <code title=event-redo>redo</code> events</a></li>
+ <li><a href=#implementation-notes><span class=secno>8.10.6 </span>Implementation notes</a></ol></li>
+ <li><a href=#editing-apis><span class=secno>8.11 </span>Editing APIs</a></ol></li>
+ <li><a href=#comms><span class=secno>9 </span>Communication</a>
+ <ol>
+ <li><a href=#event-definitions-0><span class=secno>9.1 </span>Event definitions</a></li>
+ <li><a href=#web-messaging><span class=secno>9.2 </span>Cross-document messaging</a>
+ <ol>
+ <li><a href=#introduction-6><span class=secno>9.2.1 </span>Introduction</a></li>
+ <li><a href=#security-postmsg><span class=secno>9.2.2 </span>Security</a>
+ <ol>
+ <li><a href=#authors><span class=secno>9.2.2.1 </span>Authors</a></li>
+ <li><a href=#user-agents><span class=secno>9.2.2.2 </span>User agents</a></ol></li>
+ <li><a href=#posting-messages><span class=secno>9.2.3 </span>Posting messages</a></ol></li>
+ <li><a href=#channel-messaging><span class=secno>9.3 </span>Channel messaging</a>
+ <ol>
+ <li><a href=#introduction-7><span class=secno>9.3.1 </span>Introduction</a></li>
+ <li><a href=#message-channels><span class=secno>9.3.2 </span>Message channels</a></li>
+ <li><a href=#message-ports><span class=secno>9.3.3 </span>Message ports</a>
+ <ol>
+ <li><a href=#ports-and-garbage-collection><span class=secno>9.3.3.1 </span>Ports and garbage collection</a></ol></ol></ol></li>
+ <li><a href=#syntax><span class=secno>10 </span>The HTML syntax</a>
+ <ol>
+ <li><a href=#writing><span class=secno>10.1 </span>Writing HTML documents</a>
+ <ol>
+ <li><a href=#the-doctype><span class=secno>10.1.1 </span>The DOCTYPE</a></li>
+ <li><a href=#elements-0><span class=secno>10.1.2 </span>Elements</a>
+ <ol>
+ <li><a href=#start-tags><span class=secno>10.1.2.1 </span>Start tags</a></li>
+ <li><a href=#end-tags><span class=secno>10.1.2.2 </span>End tags</a></li>
+ <li><a href=#attributes-0><span class=secno>10.1.2.3 </span>Attributes</a></li>
+ <li><a href=#optional-tags><span class=secno>10.1.2.4 </span>Optional tags</a></li>
+ <li><a href=#element-restrictions><span class=secno>10.1.2.5 </span>Restrictions on content models</a></li>
+ <li><a href=#cdata-rcdata-restrictions><span class=secno>10.1.2.6 </span>Restrictions on the contents of raw text and RCDATA elements</a></ol></li>
+ <li><a href=#text-1><span class=secno>10.1.3 </span>Text</a>
+ <ol>
+ <li><a href=#newlines><span class=secno>10.1.3.1 </span>Newlines</a></ol></li>
+ <li><a href=#character-references><span class=secno>10.1.4 </span>Character references</a></li>
+ <li><a href=#cdata-sections><span class=secno>10.1.5 </span>CDATA sections</a></li>
+ <li><a href=#comments><span class=secno>10.1.6 </span>Comments</a></ol></li>
+ <li><a href=#parsing><span class=secno>10.2 </span>Parsing HTML documents</a>
+ <ol>
+ <li><a href=#overview-of-the-parsing-model><span class=secno>10.2.1 </span>Overview of the parsing model</a></li>
+ <li><a href=#the-input-stream><span class=secno>10.2.2 </span>The input stream</a>
+ <ol>
+ <li><a href=#determining-the-character-encoding><span class=secno>10.2.2.1 </span>Determining the character encoding</a></li>
+ <li><a href=#character-encodings-0><span class=secno>10.2.2.2 </span>Character encodings</a></li>
+ <li><a href=#preprocessing-the-input-stream><span class=secno>10.2.2.3 </span>Preprocessing the input stream</a></li>
+ <li><a href=#changing-the-encoding-while-parsing><span class=secno>10.2.2.4 </span>Changing the encoding while parsing</a></ol></li>
+ <li><a href=#parse-state><span class=secno>10.2.3 </span>Parse state</a>
+ <ol>
+ <li><a href=#the-insertion-mode><span class=secno>10.2.3.1 </span>The insertion mode</a></li>
+ <li><a href=#the-stack-of-open-elements><span class=secno>10.2.3.2 </span>The stack of open elements</a></li>
+ <li><a href=#the-list-of-active-formatting-elements><span class=secno>10.2.3.3 </span>The list of active formatting elements</a></li>
+ <li><a href=#the-element-pointers><span class=secno>10.2.3.4 </span>The element pointers</a></li>
+ <li><a href=#other-parsing-state-flags><span class=secno>10.2.3.5 </span>Other parsing state flags</a></ol></li>
+ <li><a href=#tokenization><span class=secno>10.2.4 </span>Tokenization</a>
+ <ol>
+ <li><a href=#data-state><span class=secno>10.2.4.1 </span>Data state</a></li>
+ <li><a href=#character-reference-in-data-state><span class=secno>10.2.4.2 </span>Character reference in data state</a></li>
+ <li><a href=#rcdata-state><span class=secno>10.2.4.3 </span>RCDATA state</a></li>
+ <li><a href=#character-reference-in-rcdata-state><span class=secno>10.2.4.4 </span>Character reference in RCDATA state</a></li>
+ <li><a href=#rawtext-state><span class=secno>10.2.4.5 </span>RAWTEXT state</a></li>
+ <li><a href=#script-data-state><span class=secno>10.2.4.6 </span>Script data state</a></li>
+ <li><a href=#plaintext-state><span class=secno>10.2.4.7 </span>PLAINTEXT state</a></li>
+ <li><a href=#tag-open-state><span class=secno>10.2.4.8 </span>Tag open state</a></li>
+ <li><a href=#end-tag-open-state><span class=secno>10.2.4.9 </span>End tag open state</a></li>
+ <li><a href=#tag-name-state><span class=secno>10.2.4.10 </span>Tag name state</a></li>
+ <li><a href=#rcdata-less-than-sign-state><span class=secno>10.2.4.11 </span>RCDATA less-than sign state</a></li>
+ <li><a href=#rcdata-end-tag-open-state><span class=secno>10.2.4.12 </span>RCDATA end tag open state</a></li>
+ <li><a href=#rcdata-end-tag-name-state><span class=secno>10.2.4.13 </span>RCDATA end tag name state</a></li>
+ <li><a href=#rawtext-less-than-sign-state><span class=secno>10.2.4.14 </span>RAWTEXT less-than sign state</a></li>
+ <li><a href=#rawtext-end-tag-open-state><span class=secno>10.2.4.15 </span>RAWTEXT end tag open state</a></li>
+ <li><a href=#rawtext-end-tag-name-state><span class=secno>10.2.4.16 </span>RAWTEXT end tag name state</a></li>
+ <li><a href=#script-data-less-than-sign-state><span class=secno>10.2.4.17 </span>Script data less-than sign state</a></li>
+ <li><a href=#script-data-end-tag-open-state><span class=secno>10.2.4.18 </span>Script data end tag open state</a></li>
+ <li><a href=#script-data-end-tag-name-state><span class=secno>10.2.4.19 </span>Script data end tag name state</a></li>
+ <li><a href=#script-data-escape-start-state><span class=secno>10.2.4.20 </span>Script data escape start state</a></li>
+ <li><a href=#script-data-escape-start-dash-state><span class=secno>10.2.4.21 </span>Script data escape start dash state</a></li>
+ <li><a href=#script-data-escaped-state><span class=secno>10.2.4.22 </span>Script data escaped state</a></li>
+ <li><a href=#script-data-escaped-dash-state><span class=secno>10.2.4.23 </span>Script data escaped dash state</a></li>
+ <li><a href=#script-data-escaped-dash-dash-state><span class=secno>10.2.4.24 </span>Script data escaped dash dash state</a></li>
+ <li><a href=#script-data-escaped-less-than-sign-state><span class=secno>10.2.4.25 </span>Script data escaped less-than sign state</a></li>
+ <li><a href=#script-data-escaped-end-tag-open-state><span class=secno>10.2.4.26 </span>Script data escaped end tag open state</a></li>
+ <li><a href=#script-data-escaped-end-tag-name-state><span class=secno>10.2.4.27 </span>Script data escaped end tag name state</a></li>
+ <li><a href=#script-data-double-escape-start-state><span class=secno>10.2.4.28 </span>Script data double escape start state</a></li>
+ <li><a href=#script-data-double-escaped-state><span class=secno>10.2.4.29 </span>Script data double escaped state</a></li>
+ <li><a href=#script-data-double-escaped-dash-state><span class=secno>10.2.4.30 </span>Script data double escaped dash state</a></li>
+ <li><a href=#script-data-double-escaped-dash-dash-state><span class=secno>10.2.4.31 </span>Script data double escaped dash dash state</a></li>
+ <li><a href=#script-data-double-escaped-less-than-sign-state><span class=secno>10.2.4.32 </span>Script data double escaped less-than sign state</a></li>
+ <li><a href=#script-data-double-escape-end-state><span class=secno>10.2.4.33 </span>Script data double escape end state</a></li>
+ <li><a href=#before-attribute-name-state><span class=secno>10.2.4.34 </span>Before attribute name state</a></li>
+ <li><a href=#attribute-name-state><span class=secno>10.2.4.35 </span>Attribute name state</a></li>
+ <li><a href=#after-attribute-name-state><span class=secno>10.2.4.36 </span>After attribute name state</a></li>
+ <li><a href=#before-attribute-value-state><span class=secno>10.2.4.37 </span>Before attribute value state</a></li>
+ <li><a href=#attribute-value-(double-quoted)-state><span class=secno>10.2.4.38 </span>Attribute value (double-quoted) state</a></li>
+ <li><a href=#attribute-value-(single-quoted)-state><span class=secno>10.2.4.39 </span>Attribute value (single-quoted) state</a></li>
+ <li><a href=#attribute-value-(unquoted)-state><span class=secno>10.2.4.40 </span>Attribute value (unquoted) state</a></li>
+ <li><a href=#character-reference-in-attribute-value-state><span class=secno>10.2.4.41 </span>Character reference in attribute value state</a></li>
+ <li><a href=#after-attribute-value-(quoted)-state><span class=secno>10.2.4.42 </span>After attribute value (quoted) state</a></li>
+ <li><a href=#self-closing-start-tag-state><span class=secno>10.2.4.43 </span>Self-closing start tag state</a></li>
+ <li><a href=#bogus-comment-state><span class=secno>10.2.4.44 </span>Bogus comment state</a></li>
+ <li><a href=#markup-declaration-open-state><span class=secno>10.2.4.45 </span>Markup declaration open state</a></li>
+ <li><a href=#comment-start-state><span class=secno>10.2.4.46 </span>Comment start state</a></li>
+ <li><a href=#comment-start-dash-state><span class=secno>10.2.4.47 </span>Comment start dash state</a></li>
+ <li><a href=#comment-state><span class=secno>10.2.4.48 </span>Comment state</a></li>
+ <li><a href=#comment-end-dash-state><span class=secno>10.2.4.49 </span>Comment end dash state</a></li>
+ <li><a href=#comment-end-state><span class=secno>10.2.4.50 </span>Comment end state</a></li>
+ <li><a href=#comment-end-bang-state><span class=secno>10.2.4.51 </span>Comment end bang state</a></li>
+ <li><a href=#comment-end-space-state><span class=secno>10.2.4.52 </span>Comment end space state</a></li>
+ <li><a href=#doctype-state><span class=secno>10.2.4.53 </span>DOCTYPE state</a></li>
+ <li><a href=#before-doctype-name-state><span class=secno>10.2.4.54 </span>Before DOCTYPE name state</a></li>
+ <li><a href=#doctype-name-state><span class=secno>10.2.4.55 </span>DOCTYPE name state</a></li>
+ <li><a href=#after-doctype-name-state><span class=secno>10.2.4.56 </span>After DOCTYPE name state</a></li>
+ <li><a href=#after-doctype-public-keyword-state><span class=secno>10.2.4.57 </span>After DOCTYPE public keyword state</a></li>
+ <li><a href=#before-doctype-public-identifier-state><span class=secno>10.2.4.58 </span>Before DOCTYPE public identifier state</a></li>
+ <li><a href=#doctype-public-identifier-(double-quoted)-state><span class=secno>10.2.4.59 </span>DOCTYPE public identifier (double-quoted) state</a></li>
+ <li><a href=#doctype-public-identifier-(single-quoted)-state><span class=secno>10.2.4.60 </span>DOCTYPE public identifier (single-quoted) state</a></li>
+ <li><a href=#after-doctype-public-identifier-state><span class=secno>10.2.4.61 </span>After DOCTYPE public identifier state</a></li>
+ <li><a href=#between-doctype-public-and-system-identifiers-state><span class=secno>10.2.4.62 </span>Between DOCTYPE public and system identifiers state</a></li>
+ <li><a href=#after-doctype-system-keyword-state><span class=secno>10.2.4.63 </span>After DOCTYPE system keyword state</a></li>
+ <li><a href=#before-doctype-system-identifier-state><span class=secno>10.2.4.64 </span>Before DOCTYPE system identifier state</a></li>
+ <li><a href=#doctype-system-identifier-(double-quoted)-state><span class=secno>10.2.4.65 </span>DOCTYPE system identifier (double-quoted) state</a></li>
+ <li><a href=#doctype-system-identifier-(single-quoted)-state><span class=secno>10.2.4.66 </span>DOCTYPE system identifier (single-quoted) state</a></li>
+ <li><a href=#after-doctype-system-identifier-state><span class=secno>10.2.4.67 </span>After DOCTYPE system identifier state</a></li>
+ <li><a href=#bogus-doctype-state><span class=secno>10.2.4.68 </span>Bogus DOCTYPE state</a></li>
+ <li><a href=#cdata-section-state><span class=secno>10.2.4.69 </span>CDATA section state</a></li>
+ <li><a href=#tokenizing-character-references><span class=secno>10.2.4.70 </span>Tokenizing character references</a></ol></li>
+ <li><a href=#tree-construction><span class=secno>10.2.5 </span>Tree construction</a>
+ <ol>
+ <li><a href=#creating-and-inserting-elements><span class=secno>10.2.5.1 </span>Creating and inserting elements</a></li>
+ <li><a href=#closing-elements-that-have-implied-end-tags><span class=secno>10.2.5.2 </span>Closing elements that have implied end tags</a></li>
+ <li><a href=#foster-parenting><span class=secno>10.2.5.3 </span>Foster parenting</a></li>
+ <li><a href=#the-initial-insertion-mode><span class=secno>10.2.5.4 </span>The "initial" insertion mode</a></li>
+ <li><a href=#the-before-html-insertion-mode><span class=secno>10.2.5.5 </span>The "before html" insertion mode</a></li>
+ <li><a href=#the-before-head-insertion-mode><span class=secno>10.2.5.6 </span>The "before head" insertion mode</a></li>
+ <li><a href=#parsing-main-inhead><span class=secno>10.2.5.7 </span>The "in head" insertion mode</a></li>
+ <li><a href=#parsing-main-inheadnoscript><span class=secno>10.2.5.8 </span>The "in head noscript" insertion mode</a></li>
+ <li><a href=#the-after-head-insertion-mode><span class=secno>10.2.5.9 </span>The "after head" insertion mode</a></li>
+ <li><a href=#parsing-main-inbody><span class=secno>10.2.5.10 </span>The "in body" insertion mode</a></li>
+ <li><a href=#parsing-main-incdata><span class=secno>10.2.5.11 </span>The "text" insertion mode</a></li>
+ <li><a href=#parsing-main-intable><span class=secno>10.2.5.12 </span>The "in table" insertion mode</a></li>
+ <li><a href=#parsing-main-intabletext><span class=secno>10.2.5.13 </span>The "in table text" insertion mode</a></li>
+ <li><a href=#parsing-main-incaption><span class=secno>10.2.5.14 </span>The "in caption" insertion mode</a></li>
+ <li><a href=#parsing-main-incolgroup><span class=secno>10.2.5.15 </span>The "in column group" insertion mode</a></li>
+ <li><a href=#parsing-main-intbody><span class=secno>10.2.5.16 </span>The "in table body" insertion mode</a></li>
+ <li><a href=#parsing-main-intr><span class=secno>10.2.5.17 </span>The "in row" insertion mode</a></li>
+ <li><a href=#parsing-main-intd><span class=secno>10.2.5.18 </span>The "in cell" insertion mode</a></li>
+ <li><a href=#parsing-main-inselect><span class=secno>10.2.5.19 </span>The "in select" insertion mode</a></li>
+ <li><a href=#parsing-main-inselectintable><span class=secno>10.2.5.20 </span>The "in select in table" insertion mode</a></li>
+ <li><a href=#parsing-main-inforeign><span class=secno>10.2.5.21 </span>The "in foreign content" insertion mode</a></li>
+ <li><a href=#parsing-main-afterbody><span class=secno>10.2.5.22 </span>The "after body" insertion mode</a></li>
+ <li><a href=#parsing-main-inframeset><span class=secno>10.2.5.23 </span>The "in frameset" insertion mode</a></li>
+ <li><a href=#parsing-main-afterframeset><span class=secno>10.2.5.24 </span>The "after frameset" insertion mode</a></li>
+ <li><a href=#the-after-after-body-insertion-mode><span class=secno>10.2.5.25 </span>The "after after body" insertion mode</a></li>
+ <li><a href=#the-after-after-frameset-insertion-mode><span class=secno>10.2.5.26 </span>The "after after frameset" insertion mode</a></ol></li>
+ <li><a href=#the-end><span class=secno>10.2.6 </span>The end</a></li>
+ <li><a href=#coercing-an-html-dom-into-an-infoset><span class=secno>10.2.7 </span>Coercing an HTML DOM into an infoset</a></li>
+ <li><a href=#an-introduction-to-error-handling-and-strange-cases-in-the-parser><span class=secno>10.2.8 </span>An introduction to error handling and strange cases in the parser</a>
+ <ol>
+ <li><a href=#misnested-tags:-b-i-/b-/i><span class=secno>10.2.8.1 </span>Misnested tags: &lt;b&gt;&lt;i&gt;&lt;/b&gt;&lt;/i&gt;</a></li>
+ <li><a href=#misnested-tags:-b-p-/b-/p><span class=secno>10.2.8.2 </span>Misnested tags: &lt;b&gt;&lt;p&gt;&lt;/b&gt;&lt;/p&gt;</a></li>
+ <li><a href=#unexpected-markup-in-tables><span class=secno>10.2.8.3 </span>Unexpected markup in tables</a></li>
+ <li><a href=#scripts-that-modify-the-page-as-it-is-being-parsed><span class=secno>10.2.8.4 </span>Scripts that modify the page as it is being parsed</a></ol></ol></li>
+ <li><a href=#serializing-html-fragments><span class=secno>10.3 </span>Serializing HTML fragments</a></li>
+ <li><a href=#parsing-html-fragments><span class=secno>10.4 </span>Parsing HTML fragments</a></li>
+ <li><a href=#named-character-references><span class=secno>10.5 </span>Named character references</a></ol></li>
+ <li><a href=#the-xhtml-syntax><span class=secno>11 </span>The XHTML syntax</a>
+ <ol>
+ <li><a href=#writing-xhtml-documents><span class=secno>11.1 </span>Writing XHTML documents</a></li>
+ <li><a href=#parsing-xhtml-documents><span class=secno>11.2 </span>Parsing XHTML documents</a></li>
+ <li><a href=#serializing-xhtml-fragments><span class=secno>11.3 </span>Serializing XHTML fragments</a></li>
+ <li><a href=#parsing-xhtml-fragments><span class=secno>11.4 </span>Parsing XHTML fragments</a></ol></li>
+ <li><a href=#rendering><span class=secno>12 </span>Rendering</a>
+ <ol>
+ <li><a href=#introduction-8><span class=secno>12.1 </span>Introduction</a></li>
+ <li><a href=#the-css-user-agent-style-sheet-and-presentational-hints><span class=secno>12.2 </span>The CSS user agent style sheet and presentational hints</a>
+ <ol>
+ <li><a href=#introduction-9><span class=secno>12.2.1 </span>Introduction</a></li>
+ <li><a href=#display-types><span class=secno>12.2.2 </span>Display types</a></li>
+ <li><a href=#margins-and-padding><span class=secno>12.2.3 </span>Margins and padding</a></li>
+ <li><a href=#alignment><span class=secno>12.2.4 </span>Alignment</a></li>
+ <li><a href=#fonts-and-colors><span class=secno>12.2.5 </span>Fonts and colors</a></li>
+ <li><a href=#punctuation-and-decorations><span class=secno>12.2.6 </span>Punctuation and decorations</a></li>
+ <li><a href=#resetting-rules-for-inherited-properties><span class=secno>12.2.7 </span>Resetting rules for inherited properties</a></li>
+ <li><a href=#the-hr-element-0><span class=secno>12.2.8 </span>The <code>hr</code> element</a></li>
+ <li><a href=#the-fieldset-element-0><span class=secno>12.2.9 </span>The <code>fieldset</code> element</a></ol></li>
+ <li><a href=#replaced-elements><span class=secno>12.3 </span>Replaced elements</a>
+ <ol>
+ <li><a href=#embedded-content-2><span class=secno>12.3.1 </span>Embedded content</a></li>
+ <li><a href=#timed-tracks-0><span class=secno>12.3.2 </span>Timed tracks</a></li>
+ <li><a href=#images-0><span class=secno>12.3.3 </span>Images</a></li>
+ <li><a href=#attributes-for-embedded-content-and-images><span class=secno>12.3.4 </span>Attributes for embedded content and images</a></li>
+ <li><a href=#image-maps-0><span class=secno>12.3.5 </span>Image maps</a></li>
+ <li><a href=#toolbars-0><span class=secno>12.3.6 </span>Toolbars</a></ol></li>
+ <li><a href=#bindings><span class=secno>12.4 </span>Bindings</a>
+ <ol>
+ <li><a href=#introduction-10><span class=secno>12.4.1 </span>Introduction</a></li>
+ <li><a href=#the-button-element-0><span class=secno>12.4.2 </span>The <code>button</code> element</a></li>
+ <li><a href=#the-details-element-0><span class=secno>12.4.3 </span>The <code>details</code> element</a></li>
+ <li><a href=#the-input-element-as-a-text-entry-widget><span class=secno>12.4.4 </span>The <code>input</code> element as a text entry widget</a></li>
+ <li><a href=#the-input-element-as-domain-specific-widgets><span class=secno>12.4.5 </span>The <code>input</code> element as domain-specific widgets</a></li>
+ <li><a href=#the-input-element-as-a-range-control><span class=secno>12.4.6 </span>The <code>input</code> element as a range control</a></li>
+ <li><a href=#the-input-element-as-a-color-well><span class=secno>12.4.7 </span>The <code>input</code> element as a color well</a></li>
+ <li><a href=#the-input-element-as-a-check-box-and-radio-button-widgets><span class=secno>12.4.8 </span>The <code>input</code> element as a check box and radio button widgets</a></li>
+ <li><a href=#the-input-element-as-a-file-upload-control><span class=secno>12.4.9 </span>The <code>input</code> element as a file upload control</a></li>
+ <li><a href=#the-input-element-as-a-button><span class=secno>12.4.10 </span>The <code>input</code> element as a button</a></li>
+ <li><a href=#the-marquee-element-0><span class=secno>12.4.11 </span>The <code>marquee</code> element</a></li>
+ <li><a href=#the-meter-element-0><span class=secno>12.4.12 </span>The <code>meter</code> element</a></li>
+ <li><a href=#the-progress-element-0><span class=secno>12.4.13 </span>The <code>progress</code> element</a></li>
+ <li><a href=#the-select-element-0><span class=secno>12.4.14 </span>The <code>select</code> element</a></li>
+ <li><a href=#the-textarea-element-0><span class=secno>12.4.15 </span>The <code>textarea</code> element</a></li>
+ <li><a href=#the-keygen-element-0><span class=secno>12.4.16 </span>The <code>keygen</code> element</a></li>
+ <li><a href=#the-time-element-0><span class=secno>12.4.17 </span>The <code>time</code> element</a></ol></li>
+ <li><a href=#frames-and-framesets><span class=secno>12.5 </span>Frames and framesets</a></li>
+ <li><a href=#interactive-media><span class=secno>12.6 </span>Interactive media</a>
+ <ol>
+ <li><a href=#links,-forms,-and-navigation><span class=secno>12.6.1 </span>Links, forms, and navigation</a></li>
+ <li><a href=#the-title-attribute-0><span class=secno>12.6.2 </span>The <code title=attr-title>title</code> attribute</a></li>
+ <li><a href=#editing-hosts><span class=secno>12.6.3 </span>Editing hosts</a></ol></li>
+ <li><a href=#print-media><span class=secno>12.7 </span>Print media</a></ol></li>
+ <li><a href=#obsolete><span class=secno>13 </span>Obsolete features</a>
+ <ol>
+ <li><a href=#obsolete-but-conforming-features><span class=secno>13.1 </span>Obsolete but conforming features</a>
+ <ol>
+ <li><a href=#warnings-for-obsolete-but-conforming-features><span class=secno>13.1.1 </span>Warnings for obsolete but conforming features</a></ol></li>
+ <li><a href=#non-conforming-features><span class=secno>13.2 </span>Non-conforming features</a></li>
+ <li><a href=#requirements-for-implementations><span class=secno>13.3 </span>Requirements for implementations</a>
+ <ol>
+ <li><a href=#the-applet-element><span class=secno>13.3.1 </span>The <code>applet</code> element</a></li>
+ <li><a href=#the-marquee-element><span class=secno>13.3.2 </span>The <code>marquee</code> element</a></li>
+ <li><a href=#frames><span class=secno>13.3.3 </span>Frames</a></li>
+ <li><a href=#other-elements,-attributes-and-apis><span class=secno>13.3.4 </span>Other elements, attributes and APIs</a></ol></ol></li>
+ <li><a href=#iana><span class=secno>14 </span>IANA considerations</a>
+ <ol>
+ <li><a href=#text/html><span class=secno>14.1 </span><code>text/html</code></a></li>
+ <li><a href=#text/html-sandboxed><span class=secno>14.2 </span><code>text/html-sandboxed</code></a></li>
+ <li><a href=#application/xhtml+xml><span class=secno>14.3 </span><code>application/xhtml+xml</code></a></li>
+ <li><a href=#text/cache-manifest><span class=secno>14.4 </span><code>text/cache-manifest</code></a></li>
+ <li><a href=#text/ping><span class=secno>14.5 </span><code>text/ping</code></a></li>
+ <li><a href=#text/srt><span class=secno>14.6 </span><code>text/srt</code></a></li>
+ <li><a href=#application/microdata+json><span class=secno>14.7 </span><code>application/microdata+json</code></a></li>
+ <li><a href=#ping-from><span class=secno>14.8 </span><code>Ping-From</code></a></li>
+ <li><a href=#ping-to><span class=secno>14.9 </span><code>Ping-To</code></a></ol></li>
+ <li><a class=no-num href=#index>Index</a>
+ <ol>
+ <li><a class=no-num href=#elements-1>Elements</a></li>
+ <li><a class=no-num href=#element-content-categories>Element content categories</a></li>
+ <li><a class=no-num href=#attributes-1>Attributes</a></li>
+ <li><a class=no-num href=#interfaces>Interfaces</a></li>
+ <li><a class=no-num href=#events-0>Events</a></ol></li>
+ <li><a class=no-num href=#references>References</a></li>
+ <li><a class=no-num href=#acknowledgements>Acknowledgements</a></ol>
+<!--end-toc-->
+ <hr><h2 id=introduction><span class=secno>1 </span>Introduction</h2>
+
+
+
+ <h3 id=is-this-html5?><span class=secno>1.1 </span>Is this HTML5?</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+
+
+ <p>In short: Yes.</p>
+
+ <p>In more length: "HTML5" has at various times been used to refer
+ to a wide variety of technologies, some of which originated in this
+ document, and some of which have only ever been tangentially
+ related.</p>
+
+ <p>This specification actually now defines the next generation of
+ HTML after HTML5. HTML5 reached Last Call at the WHATWG in October
+ 2009, and shortly after we started working on some experimental new
+ features that are not as stable as the rest of the
+ specification. The stability of sections is annotated in the
+ margin.</p>
+
+ <p>The W3C has also been working on HTML in conjunction with the
+ WHATWG; at the W3C, this document has been split into several parts,
+ and the occasional informative paragraph or example has been removed
+ for technical reasons. For all intents and purposes, however, the
+ W3C HTML specifications and this specification are equivalent (and
+ they are in fact all generated from the same source document).</p>
+
+ <p>Features that are considered part of the next generation of HTML
+ beyond HTML5 currently consist of only:</p>
+
+ <ul class=brief><li>The <code><a href=#devices>device</a></code> element.</li>
+ <li>The <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute and related <a href=#hyperlink-auditing>hyperlink auditing</a> features.</li>
+ </ul><p>Features that are part of HTML5 (and this specification) but that
+ are either currently, or have been in the past, published as
+ separate specifications:</p>
+
+ <ul class=brief><li><a href=#2dcontext>Canvas 2D Graphics Context</a>
+ <li><a href=#microdata>Microdata</a>
+ <li><a href=#mdvocabs>Microdata vocabularies</a>
+ <li><a href=#crossDocumentMessages>Cross-document messaging</a> (also known as Communications)
+ <li><a href=#channel-messaging>Channel messaging</a> (also known as Communications)
+ <li><a href=#forms>Forms</a> (previously known as Web Forms 2)
+ </ul><p>Features that are not currently in this document that were in the
+ past considered part of HTML5, or that were never part of HTML5 but
+ have been referred to as part of HTML5 in the media, include:</p>
+
+ <ul class=brief><li><a href=http://www.whatwg.org/specs/web-workers/current-work/>Web Workers</a>
+ <li><a href=http://dev.w3.org/html5/webstorage/>Web Storage</a>
+ <li><a href=http://dev.w3.org/html5/websockets/>WebSocket API</a>
+ <li><a href=http://www.whatwg.org/specs/web-socket-protocol/>WebSocket protocol</a>
+<!--
+ <li><a href="http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol">WebSocket protocol</a>
+-->
+ <li><a href=http://dev.w3.org/html5/eventsource/>Server-sent Events</a>
+ <li><a href=http://dev.w3.org/html5/webdatabase/>Web SQL Database</a>
+ <li><a href=http://dev.w3.org/geo/api/spec-source.html>Geolocation API</a>
+ <li><a href=http://www.w3.org/TR/SVG/>SVG</a>
+ <li><a href=http://www.w3.org/TR/MathML/>MathML</a>
+ <li><a href=http://dev.w3.org/2006/webapi/XMLHttpRequest-2/>XMLHttpRequest</a>
+ </ul><h3 id=background><span class=secno>1.2 </span>Background</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The World Wide Web's markup language has always been HTML. HTML
+ was primarily designed as a language for semantically describing
+ scientific documents, although its general design and adaptations
+ over the years have enabled it to be used to describe a number of
+ other types of documents.</p>
+
+ <p>The main area that has not been adequately addressed by HTML is a
+ vague subject referred to as Web Applications. This specification
+ attempts to rectify this, while at the same time updating the HTML
+ specifications to address issues raised in the past few years.</p>
+
+
+ <h3 id=audience><span class=secno>1.3 </span>Audience</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>This specification is intended for authors of documents and
+ scripts that use the features defined in this specification<span class=impl>, implementors of tools that operate on pages that use
+ the features defined in this specification, and individuals wishing
+ to establish the correctness of documents or implementations with
+ respect to the requirements of this specification</span>.</p>
+
+ <p>This document is probably not suited to readers who do not
+ already have at least a passing familiarity with Web technologies,
+ as in places it sacrifices clarity for precision, and brevity for
+ completeness. More approachable tutorials and authoring guides can
+ provide a gentler introduction to the topic.</p>
+
+ <p>In particular, familiarity with the basics of DOM Core and DOM
+ Events is necessary for a complete understanding of some of the more
+ technical parts of this specification. An understanding of Web IDL,
+ HTTP, XML, Unicode, character encodings, JavaScript, and CSS will
+ also be helpful in places but is not essential.</p>
+
+
+ <h3 id=scope><span class=secno>1.4 </span>Scope</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>This specification is limited to providing a semantic-level
+ markup language and associated semantic-level scripting APIs for
+ authoring accessible pages on the Web ranging from static documents
+ to dynamic applications.</p>
+
+ <p>The scope of this specification does not include providing
+ mechanisms for media-specific customization of presentation
+ (although default rendering rules for Web browsers are included at
+ the end of this specification, and several mechanisms for hooking
+ into CSS are provided as part of the language).</p>
+
+ <p>The scope of this specification is not to describe an entire
+ operating system. In particular, hardware configuration software,
+ image manipulation tools, and applications that users would be
+ expected to use with high-end workstations on a daily basis are out
+ of scope. In terms of applications, this specification is targeted
+ specifically at applications that would be expected to be used by
+ users on an occasional basis, or regularly but from disparate
+ locations, with low CPU requirements. For instance online purchasing
+ systems, searching systems, games (especially multiplayer online
+ games), public telephone books or address books, communications
+ software (e-mail clients, instant messaging clients, discussion
+ software), document editing software, etc.</p>
+
+
+ <h3 id=history-1><span class=secno>1.5 </span>History</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>For its first five years (1990-1995), HTML went through a number
+ of revisions and experienced a number of extensions, primarily
+ hosted first at CERN, and then at the IETF.</p>
+
+ <p>With the creation of the W3C, HTML's development changed venue
+ again. A first abortive attempt at extending HTML in 1995 known as
+ HTML 3.0 then made way to a more pragmatic approach known as HTML
+ 3.2, which was completed in 1997. HTML4 followed, reaching
+ completion in 1998.</p>
+
+ <p>At this time, the W3C membership decided to stop evolving HTML
+ and instead begin work on an XML-based equivalent, called
+ XHTML. This effort started with a reformulation of HTML4 in XML,
+ known as XHTML 1.0, which added no new features except the new
+ serialization, and which was completed in 2000. After XHTML 1.0, the
+ W3C's focus turned to making it easier for other working groups to
+ extend XHTML, under the banner of XHTML Modularization. In parallel
+ with this, the W3C also worked on a new language that was not
+ compatible with the earlier HTML and XHTML languages, calling it
+ XHTML2.</p>
+
+ <p>Around the time that HTML's evolution was stopped in 1998, parts
+ of the API for HTML developed by browser vendors were specified and
+ published under the name DOM Level 1 (in 1998) and DOM Level 2 Core
+ and DOM Level 2 HTML (starting in 2000 and culminating in
+ 2003). These efforts then petered out, with some DOM Level 3
+ specifications published in 2004 but the working group being closed
+ before all the Level 3 drafts were completed.</p>
+
+ <p>In 2003, the publication of XForms, a technology which was
+ positioned as the next generation of Web forms, sparked a renewed
+ interest in evolving HTML itself, rather than finding replacements
+ for it. This interest was borne from the realization that XML's
+ deployment as a Web technology was limited to entirely new
+ technologies (like RSS and later Atom), rather than as a replacement
+ for existing deployed technologies (like HTML).</p>
+
+ <p>A proof of concept to show that it was possible to extend HTML4's
+ forms to provide many of the features that XForms 1.0 introduced,
+ without requiring browsers to implement rendering engines that were
+ incompatible with existing HTML Web pages, was the first result of
+ this renewed interest. At this early stage, while the draft was
+ already publicly available, and input was already being solicited
+ from all sources, the specification was only under Opera Software's
+ copyright.</p>
+
+ <p>The idea that HTML's evolution should be reopened was tested at a
+ W3C workshop in 2004, where some of the principles that underlie the
+ HTML5 work (described below), as well as the aforementioned early
+ draft proposal covering just forms-related features, were presented
+ to the W3C jointly by Mozilla and Opera. The proposal was rejected
+ on the grounds that the proposal conflicted with the previously
+ chosen direction for the Web's evolution; the W3C staff and
+ membership voted to continue developing XML-based replacements
+ instead.</p>
+
+ <p>Shortly thereafter, Apple, Mozilla, and Opera jointly announced
+ their intent to continue working on the effort under the umbrella of
+ a new venue called the WHATWG. A public mailing list was created,
+ and the draft was moved to the WHATWG site. The copyright was
+ subsequently amended to be jointly owned by all three vendors, and
+ to allow reuse of the specification.</p>
+
+ <p>The WHATWG was based on several core principles, in particular
+ that technologies need to be backwards compatible, that
+ specifications and implementations need to match even if this means
+ changing the specification rather than the implementations, and that
+ specifications need to be detailed enough that implementations can
+ achieve complete interoperability without reverse-engineering each
+ other.</p>
+
+ <p>The latter requirement in particular required that the scope of
+ the HTML5 specification include what had previously been specified
+ in three separate documents: HTML4, XHTML1, and DOM2 HTML. It also
+ meant including significantly more detail than had previously been
+ considered the norm.</p>
+
+ <p>In 2006, the W3C indicated an interest to participate in the
+ development of HTML5 after all, and in 2007 formed a working group
+ chartered to work with the WHATWG on the development of the HTML5
+ specification. Apple, Mozilla, and Opera allowed the W3C to publish
+ the specification under the W3C copyright, while keeping a version
+ with the less restrictive license on the WHATWG site.</p>
+
+ <p>Since then, both groups have been working together.</p>
+
+ <p>A separate document has been published by the W3C HTML working
+ group to document the differences between this specification and the
+ language described in the HTML4 specification. <a href=#refsHTMLDIFF>[HTMLDIFF]</a></p>
+
+
+
+
+ <h3 id=design-notes><span class=secno>1.6 </span>Design notes</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>It must be admitted that many aspects of HTML appear at first
+ glance to be nonsensical and inconsistent.</p>
+
+ <p>HTML, its supporting DOM APIs, as well as many of its supporting
+ technologies, have been developed over a period of several decades
+ by a wide array of people with different priorities who, in many
+ cases, did not know of each other's existence.</p>
+
+ <p>Features have thus arisen from many sources, and have not always
+ been designed in especially consistent ways. Furthermore, because of
+ the unique characteristics of the Web, implementation bugs have
+ often become de-facto, and now de-jure, standards, as content is
+ often unintentionally written in ways that rely on them before they
+ can be fixed.</p>
+
+ <p>Despite all this, efforts have been made to adhere to certain
+ design goals. These are described in the next few subsections.</p>
+
+
+ <h4 id=serializability-of-script-execution><span class=secno>1.6.1 </span>Serializability of script execution</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>To avoid exposing Web authors to the complexities of
+ multithreading, the HTML and DOM APIs are designed such that no
+ script can ever detect the simultaneous execution of other
+ scripts. Even with <span title=Worker>workers</span>, the intent
+ is that the behavior of implementations can be thought of as
+ completely serializing the execution of all scripts in all <a href=#browsing-context title="browsing context">browsing contexts</a>.</p>
+
+ <p class=note>The <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
+ method, in this model, is equivalent to allowing other scripts to
+ run while the calling script is blocked.</p>
+
+
+ <h4 id=compliance-with-other-specifications><span class=secno>1.6.2 </span>Compliance with other specifications</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>This specification interacts with and relies on a wide variety of
+ other specifications. In certain circumstances, unfortunately,
+ conflicting needs have led to this specification violating the
+ requirements of these other specifications. Whenever this has
+ occurred, the transgressions have each been noted as a "<dfn id=willful-violation>willful
+ violation</dfn>", and the reason for the violation has been
+ noted.</p>
+
+
+
+
+ <h3 id=html-vs-xhtml><span class=secno>1.7 </span>HTML vs XHTML</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>This specification defines an abstract language for describing
+ documents and applications, and some APIs for interacting with
+ in-memory representations of resources that use this language.</p>
+
+ <p>The in-memory representation is known as "DOM HTML", or "the DOM"
+ for short. This specification defines version 5 of DOM HTML, known
+ as "DOM5 HTML".</p>
+
+ <p>There are various concrete syntaxes that can be used to transmit
+ resources that use this abstract language, two of which are defined
+ in this specification.</p>
+
+ <p>The first such concrete syntax is the HTML syntax. This is the
+ format suggested for most authors. It is compatible with most legacy
+ Web browsers. If a document is transmitted with an <a href=#html-mime-type>HTML MIME
+ type</a>, such as <code><a href=#text/html>text/html</a></code>, then it will be
+ processed as an HTML document by Web browsers.
+
+ This specification defines the latest HTML syntax, known simply as
+ "HTML".
+
+
+ </p>
+
+ <p>The second concrete syntax is the XHTML syntax, which is an
+ application of XML. When a document is transmitted with an <a href=#xml-mime-type>XML
+ MIME type</a>, such as <code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>, then
+ it is treated as an XML document by Web browsers, to be parsed by an
+ XML processor. Authors are reminded that the processing for XML and
+ HTML differs; in particular, even minor syntax errors will prevent a
+ document labeled as XML from being rendered fully, whereas they
+ would be ignored in the HTML syntax.
+
+ This specification defines the latest XHTML syntax, known simply as
+ "XHTML".
+
+
+ </p>
+
+ <p>The DOM, the HTML syntax, and XML cannot all represent the same
+ content. For example, namespaces cannot be represented using the
+ HTML syntax, but they are supported in the DOM and in XML.
+ Similarly, documents that use the <code><a href=#the-noscript-element>noscript</a></code> feature can
+ be represented using the HTML syntax, but cannot be represented with
+ the DOM or in XML. Comments that contain the string "<code title="">--&gt;</code>" can be represented in the DOM but not in the
+ HTML syntax or in XML.</p>
+
+
+ <h3 id=structure-of-this-specification><span class=secno>1.8 </span>Structure of this specification</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>This specification is divided into the following major
+ sections:</p>
+
+ <dl><dt><a href=#infrastructure>Common infrastructure</a></dt>
+
+ <dd>The conformance classes, algorithms, definitions, and the
+ common underpinnings of the rest of the specification.</dd>
+
+
+ <dt><a href=#dom>Semantics, structure, and APIs of HTML documents</a></dt>
+
+ <dd>Documents are built from elements. These elements form a tree
+ using the DOM. This section defines the features of this DOM, as
+ well as introducing the features common to all elements, and the
+ concepts used in defining elements.</dd>
+
+
+ <dt><a href=#semantics>The elements of HTML</a></dt>
+
+ <dd>Each element has a predefined meaning, which is explained in
+ this section. Rules for authors on how to use the element<span class=impl>, along with user agent requirements for how to handle
+ each element,</span> are also given.</dd>
+
+
+ <dt><a href=#microdata>Microdata</a></dt>
+
+ <dd>This specification introduces a mechanism for adding
+ machine-readable annotations to documents, so that tools can
+ extract trees of name/value pairs from the document. This section
+ describes this mechanism<span class=impl> and some algorithms
+ that can be used to convert HTML documents into other
+ formats</span>.
+
+ This section also defines some Microdata vocabularies for contact
+ information, calendar events, and licensing works.
+
+ </dd>
+
+
+ <dt><a href=#browsers>Loading Web pages</a></dt>
+
+ <dd>HTML documents do not exist in a vacuum &mdash; this section
+ defines many of the features that affect environments that deal
+ with multiple pages.</dd>
+
+ <dt><a href=#webappapis>Web application APIs</a></dt>
+
+ <dd>This section introduces basic features for scripting of
+ applications in HTML.</dd>
+
+ <dt><a href=#editing>User interaction</a></dt>
+
+ <dd>HTML documents can provide a number of mechanisms for users to
+ interact with and modify content, which are described in this
+ section.</dd>
+
+
+
+
+ <dt><a href=#comms>The communication APIs</a></dt>
+
+ <dd>This section describes some mechanisms that applications
+ written in HTML can use to communicate with other applications from
+ different domains running on the same client.
+ </dd>
+
+
+
+ <dt><a href=#syntax>The HTML syntax</a></dt>
+ <dt><a href=#xhtml>The XHTML syntax</a></dt>
+
+ <dd>All of these features would be for naught if they couldn't be
+ represented in a serialized form and sent to other people, and so
+ these sections define the syntaxes of HTML, along with rules for
+ how to parse content using those syntaxes.</dd>
+
+
+ </dl><p>There are also some appendices, defining <a href=#rendering>rendering rules</a> for Web browsers and listing
+ <a href=#obsolete>obsolete features</a> and <a href=#iana>IANA
+ considerations</a>.</p>
+
+
+
+ <h4 id=how-to-read-this-specification><span class=secno>1.8.1 </span>How to read this specification</h4>
+
+ <p>This specification should be read like all other specifications.
+ First, it should be read cover-to-cover, multiple times. Then, it
+ should be read backwards at least once. Then it should be read by
+ picking random sections from the contents list and following all the
+ cross-references.</p>
+
+
+
+ <h4 id=typographic-conventions><span class=secno>1.8.2 </span>Typographic conventions</h4>
+
+ <p>This is a definition, requirement, or explanation.</p>
+
+ <p class=note>This is a note.</p>
+
+ <p class=example>This is an example.</p>
+
+ <p class=XXX>This is an open issue.</p>
+
+ <p class=warning>This is a warning.</p>
+
+ <pre class="idl extract">interface <dfn title="">Example</dfn> {
+ // this is an IDL definition
+};</pre>
+
+ <dl class=domintro><dt><var title="">variable</var> = <var title="">object</var> . <code title="">method</code>( [ <var title="">optionalArgument</var> ] )</dt>
+
+ <dd>
+
+ <p>This is a note to authors describing the usage of an interface.</p>
+
+ </dd>
+
+ </dl><pre class=css>/* this is a CSS fragment */</pre>
+
+ <p>The defining instance of a term is marked up like <dfn id=x-this title=x-this>this</dfn>. Uses of that term are marked up like
+ <a href=#x-this title=x-this>this</a> or like <i title=x-this><a href=#x-this>this</a></i>.</p>
+
+ <p>The defining instance of an element, attribute, or API is marked
+ up like <dfn id=x-that title=x-that><code>this</code></dfn>. References to
+ that element, attribute, or API are marked up like <code title=x-that><a href=#x-that>this</a></code>.</p>
+
+ <p>Other code fragments are marked up <code title="">like
+ this</code>.</p>
+
+ <p>Variables are marked up like <var title="">this</var>.</p>
+
+ <p class=impl>This is an implementation requirement.</p>
+
+
+
+ <h3 id=a-quick-introduction-to-html><span class=secno>1.9 </span>A quick introduction to HTML</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>A basic HTML document looks like this:</p>
+
+ <pre id=intro-early-example>&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Sample page&lt;/title&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;h1&gt;Sample page&lt;/h1&gt;
+ &lt;p&gt;This is a &lt;a href="demo.html"&gt;simple&lt;/a&gt; sample.&lt;/p&gt;
+ &lt;!-- this is a comment --&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>HTML documents consist of a tree of elements and text. Each
+ element is denoted in the source by a <a href=#syntax-start-tag title=syntax-start-tag>start tag</a>, such as "<code title="">&lt;body&gt;</code>", and an <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a>, such as "<code title="">&lt;/body&gt;</code>". (Certain
+ start tags and end tags can in certain cases be <a href=#syntax-tag-omission title=syntax-tag-omission>omitted</a> and are implied by other
+ tags.)</p>
+
+ <p>Tags have to be nested such that elements are all completely
+ within each other, without overlapping:</p>
+
+ <pre class=bad>&lt;p&gt;This is &lt;em&gt;very &lt;strong&gt;wrong&lt;/em&gt;!&lt;/strong&gt;&lt;/p&gt;</pre>
+ <pre>&lt;p&gt;This &lt;em&gt;is &lt;strong&gt;correct&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;</pre>
+
+ <p>This specification defines a set of elements that can be used in
+ HTML, along with rules about the ways in which the elements can be
+ nested.</p>
+
+ <p>Elements can have attributes, which control how the elements
+ work. In the example below, there is a <a href=#hyperlink>hyperlink</a>,
+ formed using the <code><a href=#the-a-element>a</a></code> element and its <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute:</p>
+
+ <pre>&lt;a href="demo.html"&gt;simple&lt;/a&gt;</pre>
+
+ <p><a href=#syntax-attributes title=syntax-attributes>Attributes</a> are placed
+ inside the start tag, and consist of a <a href=#syntax-attribute-name title=syntax-attribute-name>name</a> and a <a href=#syntax-attribute-value title=syntax-attribute-value>value</a>, separated by an "<code title="">=</code>" character. The attribute value can remain <a href=#unquoted>unquoted</a> if it doesn't contain spaces or any of
+ <code title="">"</code> <code title="">'</code> <code title="">`</code> <code title="">=</code> <code title="">&lt;</code>
+ or <code title="">&gt;</code>. Otherwise, it has to be quoted using
+ either single or double quotes. The value, along with the "<code title="">=</code>" character, can be omitted altogether if the value
+ is the empty string.</p>
+
+ <pre>&lt;!-- empty attributes --&gt;
+&lt;input name=address disabled&gt;
+&lt;input name=address disabled=""&gt;
+
+&lt;!-- attributes with a value --&gt;
+&lt;input name=address maxlength=200&gt;
+&lt;input name=address maxlength='200'&gt;
+&lt;input name=address maxlength="200"&gt;</pre>
+
+ <p>HTML user agents (e.g. Web browsers) then <i>parse</i> this
+ markup, turning it into a DOM (Document Object Model) tree. A DOM
+ tree is an in-memory representation of a document.</p>
+
+ <p>DOM trees contain several kinds of nodes, in particular a DOCTYPE
+ node, elements, text nodes, and comment nodes.</p>
+
+ <p>The <a href=#intro-early-example>markup snippet at the top of
+ this section</a> would be turned into the following DOM tree:</p>
+
+ <ul class=domTree><li class=t10>DOCTYPE: <code><a href=#the-html-element-0>html</a></code><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><ul><li class=t3><code>#text</code>: <span title="">&#9166;&#9251;&#9251;</span><li class=t1><code><a href=#the-title-element-0>title</a></code><ul><li class=t3><code>#text</code>: <span title="">Sample page</span></ul><li class=t3><code>#text</code>: <span title="">&#9166;&#9251;</span></ul><li class=t3><code>#text</code>: <span title="">&#9166;&#9251;</span><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t3><code>#text</code>: <span title="">&#9166;&#9251;&#9251;</span><li class=t1><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code><ul><li class=t3><code>#text</code>: <span title="">Sample page</span></ul><li class=t3><code>#text</code>: <span title="">&#9166;&#9251;&#9251;</span><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">This is a </span><li class=t1><code><a href=#the-a-element>a</a></code> <span class=t2 title=""><code class="attribute name">href</code>="<code class="attribute value">demo.html</code>"</span><ul><li class=t3><code>#text</code>: <span title="">simple</span></ul><li class=t3><code>#text</code>: <span title=""> sample.</span></ul><li class=t3><code>#text</code>: <span title="">&#9166;&#9251;&#9251;</span><li class=t8><code>#comment</code>: <span title=""> this is a comment </span><li class=t3><code>#text</code>: <span title="">&#9166;&#9251;&#9166;</span></ul></ul></ul><p>The <a href=#root-element>root element</a> of this tree is the
+ <code><a href=#the-html-element-0>html</a></code> element, which is the element always found at the
+ root of HTML documents. It contains two elements, <code><a href=#the-head-element-0>head</a></code>
+ and <code><a href=#the-body-element-0>body</a></code>, as well as a text node between them.</p>
+
+ <p>There are many more text nodes in the DOM tree than one would
+ initially expect, because the source contains a number of spaces
+ (represented here by "&#9251;") and line breaks ("&#9166;") that
+ all end up as text nodes in the DOM.</p>
+
+ <p>The <code><a href=#the-head-element-0>head</a></code> element contains a <code><a href=#the-title-element-0>title</a></code>
+ element, which itself contains a text node with the text "Sample
+ page". Similarly, the <code><a href=#the-body-element-0>body</a></code> element contains an
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element, a <code><a href=#the-p-element>p</a></code> element, and a
+ comment.</p>
+
+ <hr><p>This DOM tree can be manipulated from scripts in the
+ page. Scripts (typically in JavaScript) are small programs that can
+ be embedded using the <code><a href=#script>script</a></code> element or using
+ <a href=#event-handler-content-attributes>event handler content attributes</a>. For example, here is
+ a form with a script that sets the value of the form's
+ <code><a href=#the-output-element>output</a></code> element to say "Hello World":</p>
+
+ <pre>&lt;<a href=#the-form-element>form</a> <a href=#attr-form-name title=attr-form-name>name</a>="main"&gt;
+ Result: &lt;<a href=#the-output-element>output</a> <a href=#attr-fe-name title=attr-fe-name>name</a>="result"&gt;&lt;/output&gt;
+ &lt;<a href=#script>script</a>&gt;
+ <a href=#htmldocument title=HTMLDocument>document</a>.<a href=#dom-document-forms title=dom-document-forms>forms</a>.main.<a href=#dom-form-elements title=dom-form-elements>elements</a>.result.<a href=#dom-output-value title=dom-output-value>value</a> = 'Hello World';
+ &lt;/script&gt;
+&lt;/form&gt;</pre>
+
+ <p>Each element in the DOM tree is represented by an object, and
+ these objects have APIs so that they can be manipulated. For
+ instance, a link (e.g. the <code><a href=#the-a-element>a</a></code> element in the tree above)
+ can have its "<code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>"
+ attribute changed in several ways:</p>
+
+ <pre>var a = <a href=#htmldocument title=HTMLDocument>document</a>.<a href=#dom-document-links title=dom-document-links>links</a>[0]; // obtain the first link in the document
+a.<a href=#dom-a-href title=dom-a-href>href</a> = 'sample.html'; // change the destination URL of the link
+a.<a href=#dom-uda-protocol title=dom-uda-protocol>protocol</a> = 'https'; // change just the scheme part of the URL
+a.setAttribute('href', 'http://example.com/'); // change the content attribute directly</pre>
+
+ <p>Since DOM trees are used as the way to represent HTML documents
+ when they are processed and presented by implementations (especially
+ interactive implementations like Web browsers), this specification
+ is mostly phrased in terms of DOM trees, instead of the markup
+ described above.</p>
+
+ <hr><p>HTML documents represent a media-independent description of
+ interactive content. HTML documents might be rendered to a screen,
+ or through a speech synthesizer, or on a braille display. To
+ influence exactly how such rendering takes place, authors can use a
+ styling language such as CSS.</p>
+
+ <p>In the following example, the page has been made yellow-on-blue
+ using CSS.</p>
+
+ <pre>&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Sample styled page&lt;/title&gt;
+ &lt;style&gt;
+ body { background: navy; color: yellow; }
+ &lt;/style&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;h1&gt;Sample styled page&lt;/h1&gt;
+ &lt;p&gt;This page is just a demo.&lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>For more details on how to use HTML, authors are encouraged to
+ consult tutorials and guides. Some of the examples included in this
+ specification might also be of use, but the novice author is
+ cautioned that this specification, by necessity, defines the
+ language with a level of detail that might be difficult to
+ understand at first.</p>
+
+
+ <h3 id=conformance-requirements-for-authors><span class=secno>1.10 </span>Conformance requirements for authors</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Unlike previous versions of the HTML specification, this
+ specification defines in some detail the required processing for
+ invalid documents as well as valid documents.</p> <!-- This has led
+ to some questioning the purpose of conformance criteria: if there is
+ no ambiguity in how something will be processed, why disallow it? -->
+
+ <p>However, even though the processing of invalid content is in most
+ cases well-defined, conformance requirements for documents are still
+ important: in practice, interoperability (the situation in which all
+ implementations process particular content in a reliable and
+ identical or equivalent way) is not the only goal of document
+ conformance requirements. This section details some of the more
+ common reasons for still distinguishing between a conforming
+ document and one with errors.</p>
+
+
+ <h4 id=presentational-markup><span class=secno>1.10.1 </span>Presentational markup</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The majority of presentational features from previous versions of
+ HTML are no longer allowed. Presentational markup in general has
+ been found to have a number of problems:</p>
+
+ <dl><dt>The use of presentational elements leads to poorer accessibility</dt>
+
+ <dd>
+
+ <p>While it is possible to use presentational markup in a way that
+ provides users of assistive technologies (ATs) with an acceptable
+ experience (e.g. using ARIA), doing so is significantly more
+ difficult than doing so when using semantically-appropriate
+ markup. Furthermore, even using such techniques doesn't help make
+ pages accessible for non-AT non-graphical users, such as users of
+ text-mode browsers.</p>
+
+ <p>Using media-independent markup, on the other hand, provides an
+ easy way for documents to be authored in such a way that they work
+ for more users (e.g. text browsers).</p>
+
+ </dd>
+
+
+ <dt>Higher cost of maintenance</dt>
+
+ <dd>
+
+ <p>It is significantly easier to maintain a site written in such a
+ way that the markup is style-independent. For example, changing
+ the color of a site that uses <code>&lt;font&nbsp;color=""&gt;</code>
+ throughout requires changes across the entire site, whereas a
+ similar change to a site based on CSS can be done by changing a
+ single file.</p>
+
+ </dd>
+
+
+ <dt>Higher document sizes</dt>
+
+ <dd>
+
+ <p>Presentational markup tends to be much more redundant, and thus
+ results in larger document sizes.</p>
+
+ </dd>
+
+ </dl><p>For those reasons, presentational markup has been removed from
+ HTML in this version. This change should not come as a surprise;
+ HTML4 deprecated presentational markup many years ago and provided a
+ mode (HTML4 Transitional) to help authors move away from
+ presentational markup; later, XHTML 1.1 went further and obsoleted
+ those features altogether.</p>
+
+ <p>The only remaining presentational markup features in HTML are the
+ <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute and the
+ <code><a href=#the-style-element>style</a></code> element. Use of the <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute is somewhat discouraged in
+ production environments, but it can be useful for rapid prototyping
+ (where its rules can be directly moved into a separate style sheet
+ later) and for providing specific styles in unusual cases where a
+ separate style sheet would be inconvenient. Similarly, the
+ <code><a href=#the-style-element>style</a></code> element can be useful in syndication or for
+ page-specific styles, but in general an external style sheet is
+ likely to be more convenient when the styles apply to multiple
+ pages.</p>
+
+ <p>It is also worth noting that four elements that were previously
+ presentational have been redefined in this specification to be
+ media-independent: <code><a href=#the-b-element>b</a></code>, <code><a href=#the-i-element>i</a></code>, <code><a href=#the-hr-element>hr</a></code>,
+ and <code><a href=#the-small-element>small</a></code>.</p>
+
+
+ <h4 id=syntax-errors><span class=secno>1.10.2 </span>Syntax errors</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The syntax of HTML is constrained to avoid a wide variety of
+ problems.</p>
+
+ <dl><dt>Unintuitive error-handling behavior</dt>
+
+ <dd>
+
+ <p>Certain invalid syntax constructs, when parsed, result in DOM
+ trees that are highly unintuitive.</p>
+
+ <div class=example>
+
+ <p>For example, the following markup fragment results in a DOM
+ with an <code><a href=#the-hr-element>hr</a></code> element that is an <em>earlier</em>
+ sibling of the corresponding <code><a href=#the-table-element>table</a></code> element:</p>
+
+ <pre class=bad>&lt;table&gt;&lt;hr&gt;...</pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors with optional error recovery</dt>
+
+ <dd>
+
+ <p>To allow user agents to be used in controlled environments
+ without having to implement the more bizarre and convoluted error
+ handling rules, user agents are permitted to fail whenever
+ encountering a <a href=#parse-error>parse error</a>.</p>
+
+ </dd>
+
+
+ <dt>Errors where the error-handling behavior is not compatible with streaming user agents</dt>
+
+ <dd>
+
+ <p>Some error-handling behavior, such as the behavior for the
+ <code title="">&lt;table&gt;&lt;hr&gt;...</code> example mentioned
+ above, are incompatible with streaming user agents. To avoid
+ interoperability problems with such user agents, any syntax
+ resulting in such behavior is considered invalid.</p>
+
+ </dd>
+
+
+ <dt>Errors that can result in infoset coercion</dt>
+
+ <dd>
+
+ <p>When a user agent based on XML is connected to an HTML parser,
+ it is possible that certain invariants that XML enforces, such as
+ comments never containing two consecutive hyphens, will be
+ violated by an HTML file. Handling this can require that the
+ parser coerce the HTML DOM into an XML-compatible infoset. Most
+ syntax constructs that require such handling are considered
+ invalid.</p>
+
+ </dd>
+
+
+ <dt>Errors that result in disproportionally poor performance</dt>
+
+ <dd>
+
+ <p>Certain syntax constructs can result in disproportionally poor
+ performance. To discourage the use of such constructs, they are
+ typically made non-conforming.</p>
+
+ <div class=example>
+
+ <p>For example, the following markup results in poor performance
+ when hitting the highlighted end tag, since all the open elements
+ are examined first to see if they match the close tag:</p>
+
+ <pre class=bad>&lt;p&gt;&lt;em&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;...&lt;span&gt;&lt;span&gt;&lt;span&gt;<strong>&lt;/em&gt;</strong></pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors involving fragile syntax constructs</dt>
+
+ <dd>
+
+ <p>There are syntax constructs that, for historical reasons, are
+ relatively fragile. To help reduce the number of users who
+ accidentally run into such problems, they are made
+ non-conforming.</p>
+
+ <div class=example>
+
+ <p>For example, the parsing of certain named character references
+ in attributes happens even with the closing semicolon being
+ omitted. It is safe to include an ampersand followed by letters
+ that do not form a named character reference, but if the letters
+ are changed to a string that <em>does</em> form a named character
+ reference, they will be interpreted as that character instead.</p>
+
+ <p>In this fragment, the attribute's value is "<code title="">?hello=1&amp;world=2</code>":</p>
+
+ <pre class=bad>&lt;a href="?hello=1&amp;world=2"&gt;Demo&lt;/a&gt;</pre>
+
+ <p>In the following fragment, however, the attribute's value is
+ actually "<code title="">?original=1&copy;=2</code>",
+ <em>not</em> the intended "<code title="">?original=1&amp;copy=2</code>":</p>
+
+ <pre class=bad>&lt;a href="?original=1&amp;copy=2"&gt;Compare&lt;/a&gt;</pre>
+
+ <p>To avoid this problem, all named character references are
+ required to end with a semicolon, and uses of named character
+ references without a semicolon are flagged as errors.</p>
+
+ <p>Thus, the correct way to express the above cases is as
+ follows:</p>
+
+ <pre>&lt;a href="?hello=1&amp;world=2"&gt;Demo&lt;/a&gt; &lt;!-- &amp;world is ok, since it's not a named character reference --&gt;</pre>
+ <pre>&lt;a href="?original=1&amp;amp;copy=2"&gt;Compare&lt;/a&gt; &lt;!-- the &amp; has to be escaped, since &amp;copy <em>is</em> a named character reference --&gt;</pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors involving known interoperability problems in legacy user agents</dt>
+
+ <dd>
+
+ <p>Certain syntax constructs are known to cause especially subtle
+ or serious problems in legacy user agents, and are therefore
+ marked as non-conforming to help authors avoid them.</p>
+
+ <div class=example>
+
+ <p>For example, this is why the U+0060 GRAVE ACCENT character (`)
+ is not allowed in unquoted attributes. In certain legacy user
+ agents, <!-- namely IE --> it is sometimes treated as a quote
+ character.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Another example of this is the DOCTYPE, which is required to
+ trigger <a href=#no-quirks-mode>no-quirks mode</a>, because the behavior of
+ legacy user agents in <a href=#quirks-mode>quirks mode</a> is often largely
+ undocumented.</p>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors that risk exposing authors to security attacks</dt>
+
+ <dd>
+
+ <p>Certain restrictions exist purely to avoid known security
+ problems.</p>
+
+ <div class=example>
+
+ <p>For example, the restriction on using UTF-7 exists purely to
+ avoid authors falling prey to a known cross-site-scripting attack
+ using UTF-7.</p>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Cases where the author's intent is unclear</dt>
+
+ <dd>
+
+ <p>Markup where the author's intent is very unclear is often made
+ non-conforming. Correcting these errors early makes later
+ maintenance easier.</p>
+
+ <div class=example>
+
+ <p>For example, it is unclear whether the author intended the
+ following to be an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> heading or an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>
+ heading:</p>
+
+ <pre class=bad>&lt;h1&gt;Contact details&lt;/h2&gt;</pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Cases that are likely to be typos</dt>
+
+ <dd>
+
+ <p>When a user makes a simple typo, it is helpful if the error can
+ be caught early, as this can save the author a lot of debugging
+ time. This specification therefore usually considers it an error
+ to use element names, attribute names, and so forth, that do not
+ match the names defined in this specification.</p>
+
+ <div class=example>
+
+ <p>For example, if the author typed <code>&lt;capton&gt;</code>
+ instead of <code>&lt;caption&gt;</code>, this would be flagged as an
+ error and the author could correct the typo immediately.</p>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors that could interfere with new syntax in the future</dt>
+
+ <dd>
+
+ <p>In order to allow the language syntax to be extended in the
+ future, certain otherwise harmless features are disallowed.</p>
+
+ <div class=example>
+
+ <p>For example, "attributes" in end tags are ignored currently,
+ but they are invalid, in case a future change to the language
+ makes use of that syntax feature without conflicting with
+ already-deployed (and valid!) content.</p>
+
+ </div>
+
+ </dd>
+
+
+ </dl><p>Some authors find it helpful to be in the practice of always
+ quoting all attributes and always including all optional tags,
+ preferring the consistency derived from such custom over the minor
+ benefits of terseness afforded by making use of the flexibility of
+ the HTML syntax. To aid such authors, conformance checkers can
+ provide modes of operation wherein such conventions are
+ enforced.</p>
+
+
+
+ <h4 id=restrictions-on-content-models-and-on-attribute-values><span class=secno>1.10.3 </span>Restrictions on content models and on attribute values</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Beyond the syntax of the language, this specification also places
+ restrictions on how elements and attributes can be specified. These
+ restrictions are present for similar reasons:</p>
+
+ <dl><dt>Errors involving content with dubious semantics</dt>
+
+ <dd>
+
+ <p>To avoid misuse of elements with defined meanings, content
+ models are defined that restrict how elements can be nested when
+ such nestings would be of dubious value.</p>
+
+ <p class=example>For example, this specification disallows
+ nesting a <code><a href=#the-section-element>section</a></code> element inside a <code><a href=#the-kbd-element>kbd</a></code>
+ element, since it is highly unlikely for an author to indicate
+ that an entire section should be keyed in.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve a conflict in expressed semantics</dt>
+
+ <dd>
+
+ <p>Similarly, to draw the author's attention to mistakes in the
+ use of elements, clear contradictions in the semantics expressed
+ are also considered conformance errors.</p>
+
+ <div class=example>
+
+ <p>In the fragments below, for example, the semantics are
+ nonsensical: a row cannot simultaneously be a cell, nor can a
+ radio button be a progress bar.</p>
+
+ <pre class=bad>&lt;tr role="cell"&gt;</pre>
+ <pre class=bad>&lt;input type=radio role=progressbar&gt;</pre>
+
+ </div>
+
+ <p class=example>Another example is the restrictions on the
+ content models of the <code><a href=#the-ul-element>ul</a></code> element, which only allows
+ <code><a href=#the-li-element>li</a></code> element children. Lists by definition consist just
+ of zero or more list items, so if a <code><a href=#the-ul-element>ul</a></code> element
+ contains something other than an <code><a href=#the-li-element>li</a></code> element, it's not
+ clear what was meant.</p>
+
+ </dd>
+
+
+ <dt>Cases where the default styles are likely to lead to confusion</dt>
+
+ <dd>
+
+ <p>Certain elements have default styles or behaviors that make
+ certain combinations likely to lead to confusion. Where these have
+ equivalent alternatives without this problem, the confusing
+ combinations are disallowed.</p>
+
+ <p class=example>For example, <code><a href=#the-div-element>div</a></code> elements are
+ rendered as block boxes, and <code><a href=#the-span-element>span</a></code> elements as inline
+ boxes. Putting a block box in an inline box is unnecessarily
+ confusing; since either nesting just <code><a href=#the-div-element>div</a></code> elements, or
+ nesting just <code><a href=#the-span-element>span</a></code> elements, or nesting
+ <code><a href=#the-span-element>span</a></code> elements inside <code><a href=#the-div-element>div</a></code> elements all
+ serve the same purpose as nesting a <code><a href=#the-div-element>div</a></code> element in a
+ <code><a href=#the-span-element>span</a></code> element, but only the latter involves a block
+ box in an inline box, the latter combination is disallowed.</p>
+
+ <p class=example>Another example would be the way
+ <a href=#interactive-content>interactive content</a> cannot be nested. For example, a
+ <code><a href=#the-button-element>button</a></code> element cannot contain a <code><a href=#the-textarea-element>textarea</a></code>
+ element. This is because the default behavior of such nesting
+ interactive elements would be highly confusing to users. Instead
+ of nesting these elements, they can be placed side by side.</p>
+
+ </dd>
+
+
+ <dt>Errors that indicate a likely misunderstanding of the specification</dt>
+
+ <dd>
+
+ <p>Sometimes, something is disallowed because allowing it would
+ likely cause author confusion.</p>
+
+ <p class=example>For example, setting the <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute to the value
+ "<code title="">false</code>" is disallowed, because despite the
+ appearance of meaning that the element is enabled, it in fact
+ means that the element is <em>disabled</em> (what matters for
+ implementations is the presence of the attribute, not its
+ value).</p>
+
+ </dd>
+
+
+ <dt>Errors involving limits that have been imposed merely to simplify the language</dt>
+
+ <dd>
+
+ <p>Some conformance errors simplify the language that authors need
+ to learn.</p>
+
+ <p class=example>For example, the <code><a href=#the-area-element>area</a></code> element's
+ <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute, despite
+ accepting both <code title=attr-area-shape-keyword-circ><a href=#attr-area-shape-keyword-circ>circ</a></code> and <code title=attr-area-shape-keyword-circle><a href=#attr-area-shape-keyword-circle>circle</a></code> values in
+ practice as synonyms, disallows the use of the <code title=attr-area-shape-keyword-circ><a href=#attr-area-shape-keyword-circ>circ</a></code> value, so as to
+ simplify tutorials and other learning aids. There would be no
+ benefit to allowing both, but it would cause extra confusion when
+ teaching the language.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve peculiarities of the parser</dt>
+
+ <dd>
+
+ <p>Certain elements are parsed in somewhat eccentric ways
+ (typically for historical reasons), and their content model
+ restrictions are intended to avoid exposing the author to these
+ issues.</p>
+
+ <div class=example>
+
+ <p>For example, a <code><a href=#the-form-element>form</a></code> element isn't allowed inside
+ <a href=#phrasing-content>phrasing content</a>, because when parsed as HTML, a
+ <code><a href=#the-form-element>form</a></code> element's start tag will imply a <code><a href=#the-p-element>p</a></code>
+ element's end tag. Thus, the following markup results in two
+ <a href=#paragraph title=paragraph>paragraphs</a>, not one:</p>
+
+ <pre>&lt;p&gt;Welcome. &lt;form&gt;&lt;label&gt;Name:&lt;/label&gt; &lt;input&gt;&lt;/form&gt;</pre>
+
+ <p>It is parsed exactly like the following:</p>
+
+ <pre>&lt;p&gt;Welcome. &lt;/p&gt;&lt;form&gt;&lt;label&gt;Name:&lt;/label&gt; &lt;input&gt;&lt;/form&gt;</pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors that would likely result in scripts failing in hard-to-debug ways</dt>
+
+ <dd>
+
+ <p>Some errors are intended to help prevent script problems that
+ would be hard to debug.</p>
+
+ <p class=example>This is why, for instance, it is non-conforming
+ to have two <code title=attr-id><a href=#the-id-attribute>id</a></code> attributes with the
+ same value. Duplicate IDs lead to the wrong element being
+ selected, with sometimes disastrous effects whose cause is hard to
+ determine.</p>
+
+ </dd>
+
+
+ <dt>Errors that waste authoring time</dt>
+
+ <dd>
+
+ <p>Some constructs are disallowed because historically they have
+ been the cause of a lot of wasted authoring time, and by
+ encouraging authors to avoid making them, authors can save time in
+ future efforts.</p>
+
+ <p class=example>For example, a <code><a href=#script>script</a></code> element's
+ <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute causes the
+ element's contents to be ignored. However, this isn't obvious,
+ especially if the element's contents appear to be executable
+ script &mdash; which can lead to authors spending a lot of time
+ trying to debug the inline script without realising that it is not
+ executing. To reduce this problem, this specification makes it
+ non-conforming to have executable script in a <code><a href=#script>script</a></code>
+ element when the <code title=attr-script-src><a href=#attr-script-src>src</a></code>
+ attribute is present. This means that authors who are validating
+ their documents are less likely to waste time with this kind of
+ mistake.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve areas that affect authors migrating to and from XHTML</dt>
+
+ <dd>
+
+ <p>Some authors like to write files that can be interpreted as
+ both XML and HTML with similar results. Though this practice is
+ discouraged in general due to the myriad of subtle complications
+ involved (especially when involving scripting, styling, or any
+ kind of automated serialization), this specification has a few
+ restrictions intended to at least somewhat mitigate the
+ difficulties. This makes it easier for authors to use this as a
+ transitionary step when migrating between HTML and XHTML.</p>
+
+ <p class=example>For example, there are somewhat complicated
+ rules surrounding the <code title=attr-lang><a href=#attr-lang>lang</a></code> and
+ <code title=attr-xml-lang><a href=#attr-xml-lang>xml:lang</a></code> attributes intended
+ to keep the two synchronized.</p>
+
+ <p class=example>Another example would be the restrictions on
+ the values of <code title="">xmlns</code> attributes in the HTML
+ serialization, which are intended to ensure that elements in
+ conforming documents end up in the same namespaces whether
+ processed as HTML or XML.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve areas reserved for future expansion</dt>
+
+ <dd>
+
+ <p>As with the restrictions on the syntax intended to allow for
+ new syntax in future revisions of the language, some restrictions
+ on the content models of elements and values of attributes are
+ intended to allow for future expansion of the HTML vocabulary.</p>
+
+ <p class=example>For example, limiting the values of the <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute that start
+ with an U+005F LOW LINE character (_) to only specific predefined
+ values allows new predefined values to be introduced at a future
+ time without conflicting with author-defined values.</p>
+
+ </dd>
+
+
+ <dt>Errors that indicate a mis-use of other specifications</dt>
+
+ <dd>
+
+ <p>Certain restrictions are intended to support the restrictions
+ made by other specifications.</p>
+
+ <p class=example>For example, requiring that attributes that
+ take media queries use only <em>valid</em> media queries
+ reinforces the importance of following the conformance rules of
+ that specification.</p>
+
+ </dd>
+
+ </dl><h3 id=recommended-reading><span class=secno>1.11 </span>Recommended reading</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The following documents might be of interest to readers of this
+ specification.</p>
+
+ <dl><dt><cite>Character Model for the World Wide Web 1.0: Fundamentals</cite> <a href=#refsCHARMOD>[CHARMOD]</a></dt>
+
+ <dd><blockquote><p>This Architectural Specification provides
+ authors of specifications, software developers, and content
+ developers with a common reference for interoperable text
+ manipulation on the World Wide Web, building on the Universal
+ Character Set, defined jointly by the Unicode Standard and ISO/IEC
+ 10646. Topics addressed include use of the terms 'character',
+ 'encoding' and 'string', a reference processing model, choice and
+ identification of character encodings, character escaping, and
+ string indexing.</blockquote></dd>
+
+ <dt><cite>Unicode Security Considerations</cite> <a href=#refsUTR36>[UTR36]</a></dt>
+
+ <dd><blockquote><p>Because Unicode contains such a large number of
+ characters and incorporates the varied writing systems of the
+ world, incorrect usage can expose programs or systems to possible
+ security attacks. This is especially important as more and more
+ products are internationalized. This document describes some of the
+ security considerations that programmers, system analysts,
+ standards developers, and users should take into account, and
+ provides specific recommendations to reduce the risk of
+ problems.</blockquote></dd>
+
+ <dt><cite>Web Content Accessibility Guidelines (WCAG) 2.0</cite> <a href=#refsWCAG>[WCAG]</a></dt>
+
+ <dd><blockquote><p>Web Content Accessibility Guidelines (WCAG) 2.0
+ covers a wide range of recommendations for making Web content more
+ accessible. Following these guidelines will make content accessible
+ to a wider range of people with disabilities, including blindness
+ and low vision, deafness and hearing loss, learning disabilities,
+ cognitive limitations, limited movement, speech disabilities,
+ photosensitivity and combinations of these. Following these
+ guidelines will also often make your Web content more usable to
+ users in general.</blockquote></dd>
+
+ <dt class=impl><cite>Authoring Tool Accessibility Guidelines (ATAG) 2.0</cite> <a href=#refsATAG>[ATAG]</a></dt>
+
+ <dd class=impl><blockquote><p>This specification provides
+ guidelines for designing Web content authoring tools that are more
+ accessible for people with disabilities. An authoring tool that
+ conforms to these guidelines will promote accessibility by
+ providing an accessible user interface to authors with disabilities
+ as well as by enabling, supporting, and promoting the production of
+ accessible Web content by all authors.</blockquote></dd>
+
+ <dt class=impl><cite>User Agent Accessibility Guidelines (UAAG) 2.0</cite> <a href=#refsUAAG>[UAAG]</a></dt>
+
+ <dd class=impl><blockquote><p>This document provides guidelines
+ for designing user agents that lower barriers to Web accessibility
+ for people with disabilities. User agents include browsers and
+ other types of software that retrieve and render Web content. A
+ user agent that conforms to these guidelines will promote
+ accessibility through its own user interface and through other
+ internal facilities, including its ability to communicate with
+ other technologies (especially assistive
+ technologies). Furthermore, all users, not just users with
+ disabilities, should find conforming user agents to be more
+ usable.</blockquote></dd>
+
+ </dl><h2 id=infrastructure><span class=secno>2 </span>Common infrastructure</h2>
+
+ <h3 id=terminology><span class=secno>2.1 </span>Terminology</h3>
+
+ <p>This specification refers to both HTML and XML attributes and IDL
+ attributes, often in the same context. When it is not clear which is
+ being referred to, they are referred to as <dfn title="">content
+ attributes</dfn> for HTML and XML attributes, and <dfn title="">IDL
+ attributes</dfn> for those defined on IDL interfaces. Similarly, the
+ term "properties" is used for both JavaScript object properties and
+ CSS properties. When these are ambiguous they are qualified as <dfn title="">object properties</dfn> and <dfn title="">CSS
+ properties</dfn> respectively.</p>
+
+ <p>Generally, when the specification states that a feature applies
+ to <a href=#syntax>the HTML syntax</a> or <a href=#the-xhtml-syntax>the XHTML syntax</a>, it
+ also includes the other. When a feature specifically only applies to
+ one of the two languages, it is called out by explicitly stating
+ that it does not apply to the other format, as in "for HTML,
+ ... (this does not apply to XHTML)".</p>
+
+ <p>This specification uses the term <dfn title="">document</dfn> to
+ refer to any use of HTML, ranging from short static documents to
+ long essays or reports with rich multimedia, as well as to
+ fully-fledged interactive applications.</p>
+
+ <p>For simplicity, terms such as <dfn title="">shown</dfn>, <dfn title="">displayed</dfn>, and <dfn title="">visible</dfn> might
+ sometimes be used when referring to the way a document is rendered
+ to the user. These terms are not meant to imply a visual medium;
+ they must be considered to apply to other media in equivalent
+ ways.</p>
+
+ <div class=impl>
+
+ <p>When an algorithm B says to return to another algorithm A, it
+ implies that A called B. Upon returning to A, the implementation
+ must continue from where it left off in calling B.</p>
+
+ </div>
+
+
+ <h4 id=resources><span class=secno>2.1.1 </span>Resources</h4>
+
+ <p>The specification uses the term <dfn title="">supported</dfn>
+ when referring to whether a user agent has an implementation capable
+ of decoding the semantics of an external resource. A format or type
+ is said to be <i>supported</i> if the implementation can process an
+ external resource of that format or type without critical aspects of
+ the resource being ignored. Whether a specific resource is
+ <i>supported</i> can depend on what features of the resource's
+ format are in use.</p>
+
+ <p class=example>For example, a PNG image would be considered to
+ be in a supported format if its pixel data could be decoded and
+ rendered, even if, unbeknownst to the implementation, the image also
+ contained animation data.</p>
+
+ <p class=example>A MPEG4 video file would not be considered to be
+ in a supported format if the compression format used was not
+ supported, even if the implementation could determine the dimensions
+ of the movie from the file's metadata.</p>
+
+ <p>What some specifications, in particular the HTTP and URI
+ specifications, refer to as a <i>representation</i> is referred to
+ in this specification as a <dfn title="">resource</dfn>. <a href=#refsHTTP>[HTTP]</a> <a href=#refsRFC3986>[RFC3986]</a></p>
+
+ <p>The term <dfn id=mime-type>MIME type</dfn> is used to refer to what is
+ sometimes called an <i>Internet media type</i> in protocol
+ literature. The term <i>media type</i> in this specification is used
+ to refer to the type of media intended for presentation, as used by
+ the CSS specifications. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsMQ>[MQ]</a></p>
+
+ <p>A string is a <dfn id=valid-mime-type>valid MIME type</dfn> if it matches the <code title="">media-type</code> rule defined in section 3.7 "Media Types"
+ of RFC 2616. In particular, a <a href=#valid-mime-type>valid MIME type</a> may
+ include MIME type parameters. <a href=#refsHTTP>[HTTP]</a></p>
+
+ <p>A string is a <dfn id=valid-mime-type-with-no-parameters>valid MIME type with no parameters</dfn> if it
+ matches the <code title="">media-type</code> rule defined in section
+ 3.7 "Media Types" of RFC 2616, but does not contain any U+003B
+ SEMICOLON characters (;). In other words, if it consists only of a
+ type and subtype, with no MIME Type parameters. <a href=#refsHTTP>[HTTP]</a></p>
+
+ <p>The term <dfn id=html-mime-type>HTML MIME type</dfn> is used to refer to the <a href=#mime-type title="MIME type">MIME types</a> <code><a href=#text/html>text/html</a></code> and
+ <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code>.</p>
+
+ <p>A resource's <dfn id=critical-subresources>critical subresources</dfn> are those that the
+ resource needs to have available to be correctly processed. Which
+ resources are considered critical or not is defined by the
+ specification that defines the resource's format. For CSS resources,
+ only <code title="">@import</code> rules introduce <a href=#critical-subresources>critical
+ subresources</a>; other resources, e.g. fonts or backgrounds, are
+ not.</p>
+
+
+ <h4 id=xml><span class=secno>2.1.2 </span>XML</h4>
+
+ <p id=html-namespace>To ease migration from HTML to XHTML, UAs
+ conforming to this specification will place elements in HTML in the
+ <code>http://www.w3.org/1999/xhtml</code> namespace, at least for
+ the purposes of the DOM and CSS. The term "<dfn id=html-elements>HTML
+ elements</dfn>", when used in this specification, refers to any
+ element in that namespace, and thus refers to both HTML and XHTML
+ elements.</p>
+
+ <p>Except where otherwise stated, all elements defined or mentioned
+ in this specification are in the
+ <code>http://www.w3.org/1999/xhtml</code> namespace, and all
+ attributes defined or mentioned in this specification have no
+ namespace.</p>
+
+ <p>Attribute names are said to be <dfn id=xml-compatible>XML-compatible</dfn> if they
+ match the <a href=http://www.w3.org/TR/REC-xml/#NT-Name><code title="">Name</code></a> production defined in XML, they contain no
+ U+003A COLON characters (:), and their first three characters are
+ not an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
+ "<code title="">xml</code>". <a href=#refsXML>[XML]</a></p>
+
+ <p>The term <dfn id=xml-mime-type>XML MIME type</dfn> is used to refer to the <a href=#mime-type title="MIME type">MIME types</a> <code title="">text/xml</code>,
+ <code title="">application/xml</code>, and any <a href=#mime-type>MIME
+ type</a> whose subtype ends with the four characters "<code title="">+xml</code>". <a href=#refsRFC3023>[RFC3023]</a></p>
+
+
+ <h4 id=dom-trees><span class=secno>2.1.3 </span>DOM trees</h4>
+
+ <p>The term <dfn id=root-element>root element</dfn>, when not explicitly qualified
+ as referring to the document's root element, means the furthest
+ ancestor element node of whatever node is being discussed, or the
+ node itself if it has no ancestors. When the node is a part of the
+ document, then the node's <a href=#root-element>root element</a> is indeed the
+ document's root element; however, if the node is not currently part
+ of the document tree, the root element will be an orphaned node.</p>
+
+ <p>When an element's <a href=#root-element>root element</a> is the root element
+ of a <code><a href=#document>Document</a></code>, it is said to be <dfn id=in-a-document>in a
+ <code>Document</code></dfn>. An element is said to have been <dfn id=insert-an-element-into-a-document title="insert an element into a document">inserted into a
+ document</dfn> when its <a href=#root-element>root element</a> changes and is now
+ the document's <a href=#root-element>root element</a>. Analogously, an element is
+ said to have been <dfn id=remove-an-element-from-a-document title="remove an element from a
+ document">removed from a document</dfn> when its <a href=#root-element>root
+ element</a> changes from being the document's <a href=#root-element>root
+ element</a> to being another element.</p>
+
+ <p>A node's <dfn id=home-subtree>home subtree</dfn> is the subtree rooted at that
+ node's <a href=#root-element>root element</a>. When a node is <a href=#in-a-document>in a
+ <code>Document</code></a>, its <a href=#home-subtree>home subtree</a> is that
+ <code><a href=#document>Document</a></code>'s tree.</p>
+
+ <p>The <code><a href=#document>Document</a></code> of a <code><a href=#node>Node</a></code> (such as an
+ element) is the <code><a href=#document>Document</a></code> that the <code><a href=#node>Node</a></code>'s
+ <code title="">ownerDocument</code> IDL attribute returns. When a
+ <code><a href=#node>Node</a></code> is <a href=#in-a-document>in a <code>Document</code></a> then
+ that <code><a href=#document>Document</a></code> is always the <code><a href=#node>Node</a></code>'s
+ <code><a href=#document>Document</a></code>, and the <code><a href=#node>Node</a></code>'s <code title="">ownerDocument</code> IDL attribute thus always returns that
+ <code><a href=#document>Document</a></code>.</p>
+
+ <p>The term <dfn id=tree-order>tree order</dfn> means a pre-order, depth-first
+ traversal of DOM nodes involved (through the <code title=dom-Node-parentNode><a href=#dom-node-parentnode>parentNode</a></code>/<code title=dom-Node-childNodes><a href=#dom-node-childnodes>childNodes</a></code> relationship).</p>
+
+ <p>When it is stated that some element or attribute is <dfn id=ignore title=ignore>ignored</dfn>, or treated as some other value, or
+ handled as if it was something else, this refers only to the
+ processing of the node after it is in the DOM. <span class=impl>A
+ user agent must not mutate the DOM in such situations.</span></p>
+
+ <p>The term <dfn id=text-node>text node</dfn> refers to any <code><a href=#text>Text</a></code>
+ node, including <code><a href=#cdatasection>CDATASection</a></code> nodes; specifically, any
+ <code><a href=#node>Node</a></code> with node type <code title="">TEXT_NODE</code> (3)
+ or <code title="">CDATA_SECTION_NODE</code> (4). <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <p>A content attribute is said to <dfn title="">change</dfn> value
+ only if its new value is different than its previous value; setting
+ an attribute to a value it already has does not change it.</p>
+
+
+ <h4 id=scripting-0><span class=secno>2.1.4 </span>Scripting</h4>
+
+ <p>The construction "a <code>Foo</code> object", where
+ <code>Foo</code> is actually an interface, is sometimes used instead
+ of the more accurate "an object implementing the interface
+ <code>Foo</code>".</p>
+
+ <p>An IDL attribute is said to be <dfn title="">getting</dfn> when
+ its value is being retrieved (e.g. by author script), and is said to
+ be <dfn title="">setting</dfn> when a new value is assigned to
+ it.</p>
+
+ <p>If a DOM object is said to be <dfn id=live>live</dfn>, then the
+ attributes and methods on that object <span class=impl>must</span>
+ operate on the actual underlying data, not a snapshot of the
+ data.</p>
+
+ <p>The terms <dfn title="">fire</dfn> and <dfn title="">dispatch</dfn> are used interchangeably in the context of
+ events, as in the DOM Events specifications. The term <dfn id=concept-events-trusted title=concept-events-trusted>trusted event</dfn> is used as
+ defined by the DOM Events specification. <!--
+ http://krijnhoetmer.nl/irc-logs/webapps/20091218 --> <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+
+ <h4 id=plugins><span class=secno>2.1.5 </span>Plugins</h4>
+
+ <p>The term <dfn id=plugin>plugin</dfn> refers to a user-agent defined set of
+ content handlers used by the user agent that can take part in the
+ user agent's rendering of a <code><a href=#document>Document</a></code> object, but that
+ neither act as <a href=#child-browsing-context title="child browsing context">child browsing
+ contexts</a> of the <code><a href=#document>Document</a></code> nor introduce any
+ <code><a href=#node>Node</a></code> objects to the <code><a href=#document>Document</a></code>'s DOM.</p>
+
+ <p>Typically such content handlers are provided by third parties,
+ though a user agent can also designate built-in content handlers as
+ plugins.</p>
+
+ <p>A user agent must not consider the types <code>text/plain</code>
+ and <code>application/octet-stream</code> as having a registered
+ <a href=#plugin>plugin</a>.</p> <!-- because of the way <object> handles
+ those types, if nothing else (it also doesn't make any sense to have
+ a plugin registered for those types, of course) -->
+
+ <p class=example>One example of a plugin would be a PDF viewer
+ that is instantiated in a <a href=#browsing-context>browsing context</a> when the
+ user navigates to a PDF file. This would count as a plugin
+ regardless of whether the party that implemented the PDF viewer
+ component was the same as that which implemented the user agent
+ itself. However, a PDF viewer application that launches separate
+ from the user agent (as opposed to using the same interface) is not
+ a plugin by this definition.</p>
+
+ <p class=note>This specification does not define a mechanism for
+ interacting with plugins, as it is expected to be user-agent- and
+ platform-specific. Some UAs might opt to support a plugin mechanism
+ such as the Netscape Plugin API; others might use remote content
+ converters or have built-in support for certain types. <a href=#refsNPAPI>[NPAPI]</a></p>
+
+ <p class=warning>Browsers should take extreme care when
+ interacting with external content intended for <a href=#plugin title=plugin>plugins</a>. When third-party software is run with
+ the same privileges as the user agent itself, vulnerabilities in the
+ third-party software become as dangerous as those in the user
+ agent.</p>
+
+
+ <h4 id=character-encodings><span class=secno>2.1.6 </span>Character encodings</h4>
+
+ <p>The <dfn id=preferred-mime-name>preferred MIME name</dfn> of a character encoding is the
+ name or alias labeled as "preferred MIME name" in the IANA
+ <cite>Character Sets</cite> registry, if there is one, or the
+ encoding's name, if none of the aliases are so labeled. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>
+
+ <p>An <dfn id=ascii-compatible-character-encoding>ASCII-compatible character encoding</dfn> is a
+ single-byte or variable-length encoding in which the bytes 0x09,
+ 0x0A, 0x0C, 0x0D, 0x20 - 0x22, 0x26, 0x27, 0x2C - 0x3F, 0x41 - 0x5A,
+ and 0x61 - 0x7A<!-- is that list ok? do any character sets we want
+ to support do things outside that range? -->, ignoring bytes that
+ are the second and later bytes of multibyte sequences, all
+ correspond to single-byte sequences that map to the same Unicode
+ characters as those bytes in ANSI_X3.4-1968 (US-ASCII). <a href=#refsRFC1345>[RFC1345]</a></p>
+
+ <p class=note>This includes such encodings as Shift_JIS,
+ HZ-GB-2312, and variants of ISO-2022, even though it is possible in
+ these encodings for bytes like 0x70 to be part of longer sequences
+ that are unrelated to their interpretation as ASCII. It excludes
+ such encodings as UTF-7, UTF-16, GSM03.38, and EBCDIC variants.</p>
+
+ <!--
+ We'll have to change that if anyone comes up with a way to have a
+ document that is valid as two different encodings at once, with
+ different <meta charset> elements applying in each case.
+ -->
+
+ <p>The term <dfn title="">Unicode character</dfn> is used to mean a
+ <i title="">Unicode scalar value</i> (i.e. any Unicode code point
+ that is not a surrogate code point). <a href=#refsUNICODE>[UNICODE]</a></p>
+
+
+
+
+
+<!--FIXUP microdata +1-->
+<!--FIXUP 2dcontext +1-->
+ <h3 id=conformance-requirements><span class=secno>2.2 </span>Conformance requirements</h3>
+<!--FIXUP microdata -1-->
+<!--FIXUP 2dcontext -1-->
+
+ <p>All diagrams, examples, and notes in this specification are
+ non-normative, as are all sections explicitly marked non-normative.
+ Everything else in this specification is normative.</p>
+
+ <p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
+ NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
+ "OPTIONAL" in the normative parts of this document are to be
+ interpreted as described in RFC2119. For readability, these words do
+ not appear in all uppercase letters in this specification. <a href=#refsRFC2119>[RFC2119]</a></p>
+
+ <p class=impl>Requirements phrased in the imperative as part of
+ algorithms (such as "strip any leading space characters" or "return
+ false and abort these steps") are to be interpreted with the meaning
+ of the key word ("must", "should", "may", etc) used in introducing
+ the algorithm.</p>
+
+ <p>This specification describes the conformance criteria for <span class=impl>user agents (relevant to implementors) and</span>
+ documents<span class=impl> (relevant to authors and authoring tool
+ implementors)</span>.</p>
+
+ <p><dfn id=conforming-documents>Conforming documents</dfn> are those that comply with all
+ the conformance criteria for documents. For readability, some of
+ these conformance requirements are phrased as conformance
+ requirements on authors; such requirements are implicitly
+ requirements on documents: by definition, all documents are assumed
+ to have had an author. (In some cases, that author may itself be a
+ user agent &mdash; such user agents are subject to additional rules,
+ as explained below.)</p>
+
+ <p class=example>For example, if a requirement states that
+ "authors must not use the <code title="">foobar</code> element", it
+ would imply that documents are not allowed to contain elements named
+ <code title="">foobar</code>.</p>
+
+ <div class=impl>
+
+
+
+ <p>User agents fall into several (overlapping) categories with
+ different conformance requirements.</p>
+
+ <dl><dt id=interactive>Web browsers and other interactive user agents</dt>
+
+ <dd>
+
+ <p>Web browsers that support <a href=#the-xhtml-syntax>the XHTML syntax</a> must
+ process elements and attributes from the <a href=#html-namespace-0>HTML
+ namespace</a> found in XML documents as described in this
+ specification, so that users can interact with them, unless the
+ semantics of those elements have been overridden by other
+ specifications.</p>
+
+ <p class=example>A conforming XHTML processor would, upon
+ finding an XHTML <code><a href=#script>script</a></code> element in an XML document,
+ execute the script contained in that element. However, if the
+ element is found within a transformation expressed in XSLT
+ (assuming the user agent also supports XSLT), then the processor
+ would instead treat the <code><a href=#script>script</a></code> element as an opaque
+ element that forms part of the transform.</p>
+
+ <p>Web browsers that support <a href=#syntax>the HTML syntax</a> must
+ process documents labeled with an <a href=#html-mime-type>HTML MIME type</a> as
+ described in this specification, so that users can interact with
+ them.</p>
+
+ <p>User agents that support scripting must also be conforming
+ implementations of the IDL fragments in this specification, as
+ described in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
+
+ <p class=note>Unless explicitly stated, specifications that
+ override the semantics of HTML elements do not override the
+ requirements on DOM objects representing those elements. For
+ example, the <code><a href=#script>script</a></code> element in the example above
+ would still implement the <code><a href=#htmlscriptelement>HTMLScriptElement</a></code>
+ interface.</p>
+
+ </dd>
+
+ <dt id=non-interactive>Non-interactive presentation user agents</dt>
+
+ <dd>
+
+ <p>User agents that process HTML and XHTML documents purely to
+ render non-interactive versions of them must comply to the same
+ conformance criteria as Web browsers, except that they are exempt
+ from requirements regarding user interaction.</p>
+
+ <p class=note>Typical examples of non-interactive presentation
+ user agents are printers (static UAs) and overhead displays
+ (dynamic UAs). It is expected that most static non-interactive
+ presentation user agents will also opt to <a href=#non-scripted>lack scripting support</a>.</p>
+
+ <p class=example>A non-interactive but dynamic presentation UA
+ would still execute scripts, allowing forms to be dynamically
+ submitted, and so forth. However, since the concept of "focus" is
+ irrelevant when the user cannot interact with the document, the UA
+ would not need to support any of the focus-related DOM APIs.</p>
+
+ </dd>
+
+ <dt><dfn id=non-scripted>User agents with no scripting support</dfn></dt>
+
+ <dd>
+
+ <p>Implementations that do not support scripting (or which have
+ their scripting features disabled entirely) are exempt from
+ supporting the events and DOM interfaces mentioned in this
+ specification. For the parts of this specification that are
+ defined in terms of an events model or in terms of the DOM, such
+ user agents must still act as if events and the DOM were
+ supported.</p>
+
+ <p class=note>Scripting can form an integral part of an
+ application. Web browsers that do not support scripting, or that
+ have scripting disabled, might be unable to fully convey the
+ author's intent.</p>
+
+ </dd>
+
+ <dt>Conformance checkers</dt>
+
+ <dd id=conformance-checkers>
+
+ <p>Conformance checkers must verify that a document conforms to
+ the applicable conformance criteria described in this
+ specification. Automated conformance checkers are exempt from
+ detecting errors that require interpretation of the author's
+ intent (for example, while a document is non-conforming if the
+ content of a <code><a href=#the-blockquote-element>blockquote</a></code> element is not a quote,
+ conformance checkers running without the input of human judgement
+ do not have to check that <code><a href=#the-blockquote-element>blockquote</a></code> elements only
+ contain quoted material).</p>
+
+ <p>Conformance checkers must check that the input document
+ conforms when parsed without a <a href=#browsing-context>browsing context</a>
+ (meaning that no scripts are run, and that the parser's
+ <a href=#scripting-flag>scripting flag</a> is disabled), and should also check
+ that the input document conforms when parsed with a <a href=#browsing-context>browsing
+ context</a> in which scripts execute, and that the scripts
+ never cause non-conforming states to occur other than transiently
+ during script execution itself. (This is only a "SHOULD" and not a
+ "MUST" requirement because it has been proven to be impossible. <a href=#refsCOMPUTABLE>[COMPUTABLE]</a>)</p>
+
+ <p>The term "HTML validator" can be used to refer to a
+ conformance checker that itself conforms to the applicable
+ requirements of this specification.</p>
+
+
+ <div class=note>
+
+ <p>XML DTDs cannot express all the conformance requirements of
+ this specification. Therefore, a validating XML processor and a
+ DTD cannot constitute a conformance checker. Also, since neither
+ of the two authoring formats defined in this specification are
+ applications of SGML, a validating SGML system cannot constitute
+ a conformance checker either.</p>
+
+ <p>To put it another way, there are three types of conformance
+ criteria:</p>
+
+ <ol><li>Criteria that can be expressed in a DTD.</li>
+
+ <li>Criteria that cannot be expressed by a DTD, but can still be
+ checked by a machine.</li>
+
+ <li>Criteria that can only be checked by a human.</li>
+
+ </ol><p>A conformance checker must check for the first two. A simple
+ DTD-based validator only checks for the first class of errors and
+ is therefore not a conforming conformance checker according to
+ this specification.</p>
+
+ </div>
+ </dd>
+
+ <dt>Data mining tools</dt>
+
+ <dd id=data-mining>
+
+ <p>Applications and tools that process HTML and XHTML documents
+ for reasons other than to either render the documents or check
+ them for conformance should act in accordance with the semantics
+ of the documents that they process.</p>
+
+ <p class=example>A tool that generates <a href=#outline title=outline>document outlines</a> but increases the nesting
+ level for each paragraph and does not increase the nesting level
+ for each section would not be conforming.</p>
+
+ </dd>
+
+ <dt id=editors>Authoring tools and markup generators</dt>
+
+ <dd>
+
+ <p>Authoring tools and markup generators must generate
+ <a href=#conforming-documents>conforming documents</a>. Conformance criteria that apply
+ to authors also apply to authoring tools, where appropriate.</p>
+
+ <p>Authoring tools are exempt from the strict requirements of
+ using elements only for their specified purpose, but only to the
+ extent that authoring tools are not yet able to determine author
+ intent. However, authoring tools must not automatically misuse
+ elements or encourage their users to do so.</p>
+
+ <p class=example>For example, it is not conforming to use an
+ <code><a href=#the-address-element>address</a></code> element for arbitrary contact information;
+ that element can only be used for marking up contact information
+ for the author of the document or section. However, since an
+ authoring tool is likely unable to determine the difference, an
+ authoring tool is exempt from that requirement. This does not
+ mean, though, that authoring tools can use <code><a href=#the-address-element>address</a></code>
+ elements for any block of italics text (for instance); it just
+ means that the authoring tool doesn't have to verify that when the
+ user uses a tool for inserting contact information for a section,
+ that the user really is doing that and not inserting something
+ else instead.</p>
+
+ <p class=note>In terms of conformance checking, an editor has to
+ output documents that conform to the same extent that a
+ conformance checker will verify.</p>
+
+ <p>When an authoring tool is used to edit a non-conforming
+ document, it may preserve the conformance errors in sections of
+ the document that were not edited during the editing session
+ (i.e. an editing tool is allowed to round-trip erroneous
+ content). However, an authoring tool must not claim that the
+ output is conformant if errors have been so preserved.</p>
+
+ <p>Authoring tools are expected to come in two broad varieties:
+ tools that work from structure or semantic data, and tools that
+ work on a What-You-See-Is-What-You-Get media-specific editing
+ basis (WYSIWYG).</p>
+
+ <p>The former is the preferred mechanism for tools that author
+ HTML, since the structure in the source information can be used to
+ make informed choices regarding which HTML elements and attributes
+ are most appropriate.</p>
+
+ <p>However, WYSIWYG tools are legitimate. WYSIWYG tools should use
+ elements they know are appropriate, and should not use elements
+ that they do not know to be appropriate. This might in certain
+ extreme cases mean limiting the use of flow elements to just a few
+ elements, like <code><a href=#the-div-element>div</a></code>, <code><a href=#the-b-element>b</a></code>, <code><a href=#the-i-element>i</a></code>,
+ and <code><a href=#the-span-element>span</a></code> and making liberal use of the <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute.</p>
+
+ <p>All authoring tools, whether WYSIWYG or not, should make a best
+ effort attempt at enabling users to create well-structured,
+ semantically rich, media-independent content.</p>
+
+ </dd>
+
+ </dl><p>Some conformance requirements are phrased as requirements on
+ elements, attributes, methods or objects. Such requirements fall
+ into two categories: those describing content model restrictions,
+ and those describing implementation behavior. Those in the former
+ category are requirements on documents and authoring tools. Those in
+ the second category are requirements on user agents. Similarly, some
+ conformance requirements are phrased as requirements on authors;
+ such requirements are to be interpreted as conformance requirements
+ on the documents that authors produce. (In other words, this
+ specification does not distinguish between conformance criteria on
+ authors and conformance criteria on documents.)</p>
+
+ <p>Conformance requirements phrased as algorithms or specific steps
+ may be implemented in any manner, so long as the end result is
+ equivalent. (In particular, the algorithms defined in this
+ specification are intended to be easy to follow, and not intended to
+ be performant.)</p>
+
+ <p id=hardwareLimitations>User agents may impose
+ implementation-specific limits on otherwise unconstrained inputs,
+ e.g. to prevent denial of service attacks, to guard against running
+ out of memory, or to work around platform-specific limitations.</p>
+
+ </div>
+
+
+
+ <p class="note impl">There is no implied relationship between
+ document conformance requirements and implementation conformance
+ requirements. User agents are not free to handle non-conformant
+ documents as they please; the processing model described in this
+ specification applies to implementations regardless of the
+ conformity of the input documents.</p>
+
+ <p>For compatibility with existing content and prior specifications,
+ this specification describes two authoring formats: one based on XML
+ (referred to as <a href=#the-xhtml-syntax>the XHTML syntax</a>), and one using a <a href=#writing>custom format</a> inspired by SGML (referred to as
+ <a href=#syntax>the HTML syntax</a>). <span class=impl>Implementations
+ may support only one of these two formats, although supporting both
+ is encouraged.</span></p>
+
+ <p class=impl id=entity-references>The language in this
+ specification assumes that the user agent expands all entity
+ references, and therefore does not include entity reference nodes in
+ the DOM. If user agents do include entity reference nodes in the
+ DOM, then user agents must handle them as if they were fully
+ expanded when implementing this specification. For example, if a
+ requirement talks about an element's child text nodes, then any text
+ nodes that are children of an entity reference that is a child of
+ that element would be used as well. Entity references to unknown
+ entities must be treated as if they contained just an empty text
+ node for the purposes of the algorithms defined in this
+ specification.</p>
+
+
+ <div class=impl>
+
+ <h4 id=dependencies><span class=secno>2.2.1 </span>Dependencies</h4>
+
+ <p>This specification relies on several other underlying
+ specifications.</p>
+
+ <dl><dt>XML</dt>
+
+ <dd>
+
+ <p>Implementations that support <a href=#the-xhtml-syntax>the XHTML syntax</a> must
+ support some version of XML, as well as its corresponding
+ namespaces specification, because that syntax uses an XML
+ serialization with namespaces. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>
+
+ </dd>
+
+ <dt>DOM</dt>
+
+ <dd>
+
+ <p>The Document Object Model (DOM) is a representation &mdash; a
+ model &mdash; of a document and its content. The DOM is not just
+ an API; the conformance criteria of HTML implementations are
+ defined, in this specification, in terms of operations on the DOM.
+ <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <p>Implementations must support some version of DOM Core and DOM
+ Events, because this specification is defined in terms of the DOM,
+ and some of the features are defined as extensions to the DOM Core
+ interfaces. <a href=#refsDOMCORE>[DOMCORE]</a> <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>In particular, the following features are defined in the DOM
+ Core specification: <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <ul class=brief><li><dfn id=attr><code>Attr</code></dfn> interface</li>
+ <li><dfn id=cdatasection><code>CDATASection</code></dfn> interface</li>
+ <li><dfn id=comment-0><code>Comment</code></dfn> interface</li>
+ <li><dfn id=domimplementation><code>DOMImplementation</code></dfn> interface</li>
+ <li><dfn id=document><code>Document</code></dfn> interface</li>
+ <li><dfn id=documentfragment><code>DocumentFragment</code></dfn> interface</li>
+ <li><dfn id=documenttype><code>DocumentType</code></dfn> interface</li>
+ <li><dfn id=domexception><code>DOMException</code></dfn> interface</li>
+ <li><dfn id=element><code>Element</code></dfn> interface</li>
+ <li><dfn id=node><code>Node</code></dfn> interface</li>
+ <li><dfn id=nodelist><code>NodeList</code></dfn> interface</li>
+ <li><dfn id=processinginstruction><code>ProcessingInstruction</code></dfn> interface</li>
+ <li><dfn id=text><code>Text</code></dfn> interface</li>
+
+ <li><dfn id=dom-domimplementation-createdocument title=dom-DOMImplementation-createDocument><code>createDocument()</code></dfn> method</li>
+ <li><dfn id=dom-document-getelementbyid title=dom-Document-getElementById><code>getElementById()</code></dfn> method</li>
+ <li><dfn id=dom-node-insertbefore title=dom-Node-insertBefore><code>insertBefore()</code></dfn> method</li>
+
+ <li><dfn id=dom-node-childnodes title=dom-Node-childNodes><code>childNodes</code></dfn> attribute </li>
+ <li><dfn id=dom-node-localname title=dom-Node-localName><code>localName</code></dfn> attribute </li>
+ <li><dfn id=dom-node-parentnode title=dom-Node-parentNode><code>parentNode</code></dfn> attribute </li>
+ <li><dfn id=dom-element-tagname title=dom-Element-tagName><code>tagName</code></dfn> attribute </li>
+ <li><dfn id=textcontent><code>textContent</code></dfn> attribute </li>
+
+ </ul><p>The following features are defined in the DOM Events
+ specification: <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <ul class=brief><li><dfn id=event><code>Event</code></dfn> interface</li>
+ <li><dfn id=eventtarget><code>EventTarget</code></dfn> interface</li>
+ <li><dfn id=uievent><code>UIEvent</code></dfn> interface</li>
+
+ <li><dfn id=event-click title=event-click><code>click</code></dfn> event</li>
+ <li><dfn id=event-domactivate title=event-DOMActivate><code>DOMActivate</code></dfn> event</li>
+
+ <li><dfn id=dom-event-target title=dom-Event-target><code>target</code></dfn> attribute</li>
+
+ </ul><p>The following features are defined in the DOM
+ Range specification: <a href=#refsDOMRANGE>[DOMRANGE]</a></p>
+
+ <ul class=brief><li><dfn id=range><code>Range</code></dfn> interface</li>
+
+ <li><dfn id=dom-range-deletecontents title=dom-Range-deleteContents><code>deleteContents()</code></dfn> method </li>
+ <li><dfn id=dom-range-selectnodecontents title=dom-Range-selectNodeContents><code>selectNodeContents()</code></dfn> method </li>
+ <li><dfn id=dom-range-setend title=dom-Range-setEnd><code>setEnd()</code></dfn> method </li>
+ <li><dfn id=dom-range-setstart title=dom-Range-setStart><code>setStart()</code></dfn> method </li>
+
+ <li><dfn id=dom-range-collapsed title=dom-Range-collapsed><code>collapsed</code></dfn> attribute </li>
+ <li><dfn id=dom-range-endcontainer title=dom-Range-endContainer><code>endContainer</code></dfn> attribute </li>
+ <li><dfn id=dom-range-endoffset title=dom-Range-endOffset><code>endOffset</code></dfn> attribute </li>
+ <li><dfn id=dom-range-startcontainer title=dom-Range-startContainer><code>startContainer</code></dfn> attribute </li>
+ <li><dfn id=dom-range-startoffset title=dom-Range-startOffset><code>startOffset</code></dfn> attribute </li>
+
+ </ul></dd>
+
+ <dt>Web IDL</dt>
+
+ <dd>
+
+ <p>The IDL fragments in this specification must be interpreted as
+ required for conforming IDL fragments, as described in the Web IDL
+ specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
+
+ <p id=float-nan>Except where otherwise specified, if an IDL
+ attribute that is a floating point number type (<code title="">float</code>) is assigned an Infinity or Not-a-Number
+ (NaN) value, a <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception must be
+ raised.</p>
+
+ <p>Except where otherwise specified, if a method with an argument
+ that is a floating point number type (<code title="">float</code>)
+ is passed an Infinity or Not-a-Number (NaN) value, a
+ <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception must be raised.</p>
+
+ </dd>
+
+ <dt>JavaScript</dt>
+
+ <dd>
+
+ <p>Some parts of the language described by this specification only
+ support JavaScript as the underlying scripting language. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ <p class=note>The term "JavaScript" is used to refer to ECMA262,
+ rather than the official term ECMAScript, since the term
+ JavaScript is more widely known. Similarly, the <a href=#mime-type>MIME
+ type</a> used to refer to JavaScript in this specification is
+ <code title="">text/javascript</code>, since that is the most
+ commonly used type, <a href=#willful-violation title="willful violation">despite it
+ being an officially obsoleted type</a> according to RFC
+ 4329. <a href=#refsRFC4329>[RFC4329]</a></p>
+
+ </dd>
+
+ <dt>Media Queries</dt>
+
+ <dd>
+
+ <p>Implementations must support some version of the Media Queries
+ language. <a href=#refsMQ>[MQ]</a></p>
+
+ </dd>
+
+ <dt>URIs, IRIs, IDNA</dt>
+
+ <dd>
+
+ <p>Implementations must support the semantics of <a href=#url title=URL>URLs</a> defined in the URI and IRI specifications,
+ as well as the semantics of IDNA domain names defined in the
+ <cite>Internationalizing Domain Names in Applications
+ (IDNA)</cite> specification. <a href=#refsRFC3986>[RFC3986]</a>
+ <a href=#refsRFC3987>[RFC3987]</a> <a href=#refsRFC3490>[RFC3490]</a>
+
+ </dd>
+
+ </dl><p>This specification does not <em>require</em> support of any
+ particular network protocol, style sheet language, scripting
+ language, or any of the DOM specifications beyond those described
+ above. However, the language described by this specification is
+ biased towards CSS as the styling language, JavaScript as the
+ scripting language, and HTTP as the network protocol, and several
+ features assume that those languages and protocols are in use.</p>
+
+ <p class=note>This specification might have certain additional
+ requirements on character encodings, image formats, audio formats,
+ and video formats in the respective sections.</p>
+
+ </div>
+
+
+
+ <h4 id=extensibility><span class=secno>2.2.2 </span>Extensibility</h4>
+
+ <p>HTML has a wide number of extensibility mechanisms that can be
+ used for adding semantics in a safe manner:</p>
+
+ <ul><li>Authors can use the <code title=attr-class><a href=#classes>class</a></code>
+ attribute to extend elements, effectively creating their own
+ elements, while using the most applicable existing "real" HTML
+ element, so that browsers and other tools that don't know of the
+ extension can still support it somewhat well. This is the tack used
+ by Microformats, for example.</li>
+
+ <li>Authors can include data for inline client-side scripts or
+ server-side site-wide scripts to process using the <code title=attr-data-*><a href=#attr-data-*>data-*=""</a></code> attributes. These are
+ guaranteed to never be touched by browsers, and allow scripts to
+ include data on HTML elements that scripts can then look for and
+ process.</li>
+
+ <li>Authors can use the <code title=meta><a href=#meta>&lt;meta name=""
+ content=""&gt;</a></code> mechanism to include page-wide metadata by
+ registering <a href=#concept-meta-extensions title=concept-meta-extensions>extensions to the
+ predefined set of metadata names</a>.</li>
+
+ <li>Authors can use the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel=""</a></code> mechanism to annotate
+ links with specific meanings by registering <a href=#concept-rel-extensions title=concept-rel-extensions> extensions to the predefined set of
+ link types</a>. This is also used by Microformats.</li>
+
+ <li>Authors can embed raw data using the <code title=script><a href=#script>&lt;script type=""&gt;</a></code> mechanism with a custom
+ type, for further handling by a inline or server-side scripts.</li>
+
+ <li>Authors can create <a href=#plugin title=plugin>plugins</a> and
+ invoke them using the <code><a href=#the-embed-element>embed</a></code> element. This is how Flash
+ works.</li>
+
+ <li>Authors can extend APIs using the JavaScript prototyping
+ mechanism. This is widely used by script libraries, for
+ instance.</li>
+
+ <li>Authors can use the microdata feature (the <code title=attr-item>item=""</code> and <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop=""</a></code> attributes) to embed
+ nested name-value pairs of data to be shared with other
+ applications and sites.</li>
+
+ </ul><div class=impl>
+
+ <hr><p>Vendor-specific proprietary user agent extensions to this
+ specification are strongly discouraged. Documents must not use such
+ extensions, as doing so reduces interoperability and fragments the
+ user base, allowing only users of specific user agents to access the
+ content in question.</p>
+
+ <p>If such extensions are nonetheless needed, e.g. for experimental
+ purposes, then vendors are strongly urged to use one of the
+ following extension mechanisms:</p>
+
+ <p>For markup-level features that can be limited to the XML
+ serialization and need not be supported in the HTML serialization,
+ vendors should use the namespace mechanism to define custom
+ namespaces in which the non-standard elements and attributes are
+ supported.</p>
+
+ <p>For markup-level features that are intended for use with
+ <a href=#syntax>the HTML syntax</a>, extensions should be limited to new
+ attributes of the form "<code title="">_<var title="">vendor</var>-<var title="">feature</var></code>", where
+ <var title="">vendor</var> is a short string that identifies the
+ vendor responsible for the extension, and <var title="">feature</var> is the name of the feature. New element names
+ should not be created. Using attributes for such extensions
+ exclusively allows extensions from multiple vendors to co-exist on
+ the same element, which would not be possible with elements. Using
+ the "<code title="">_<var title="">vendor</var>-<var title="">feature</var></code>" form allows extensions to be made
+ without risk of conflicting with future additions to the
+ specification.</p>
+
+ <div class=example>
+
+ <p>For instance, a browser named "FerretBrowser" could use "ferret"
+ as a vendor prefix, while a browser named "Mellblom Browser" could
+ use "mb". If both of these browsers invented extensions that turned
+ elements into scratch-and-sniff areas, an author experimenting with
+ these features could write:</p>
+
+ <pre>&lt;p&gt;This smells of lemons!
+&lt;span _ferret-smellovision _ferret-smellcode="LEM01"
+ _mb-outputsmell _mb-smell="lemon juice"&gt;&lt;/span&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+ <p>Attribute names starting with a U+005F LOW LINE character (_) are
+ reserved for user agent use and are guaranteed to never be formally
+ added to the HTML language.</p>
+
+ <p class=note>Pages that use such attributes are by definition
+ non-conforming.</p>
+
+ <p>For DOM extensions, e.g. new methods and IDL attributes, the new
+ members should be prefixed by vendor-specific strings to prevent
+ clashes with future versions of this specification.</p>
+
+ <p>All extensions must be defined so that the use of extensions
+ neither contradicts nor causes the non-conformance of functionality
+ defined in the specification.</p> <!-- thanks to QA Framework -->
+
+ <div class=example>
+
+ <p>For example, while strongly discouraged from doing so, an
+ implementation "Foo Browser" could add a new IDL attribute "<code title="">fooTypeTime</code>" to a control's DOM interface that
+ returned the time it took the user to select the current value of a
+ control (say). On the other hand, defining a new control that
+ appears in a form's <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code>
+ array would be in violation of the above requirement, as it would
+ violate the definition of <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> given in this
+ specification.</p>
+
+ </div>
+
+ <hr><p>When vendor-neutral extensions to this specification are needed,
+ either this specification can be updated accordingly, or an
+ extension specification can be written that overrides the
+ requirements in this specification. When someone applying this
+ specification to their activities decides that they will recognize
+ the requirements of such an extension specification, it becomes an
+ <dfn id=other-applicable-specifications title="other applicable specifications">applicable
+ specification</dfn> for the purposes of conformance requirements in
+ this specification.</p>
+ <!-- http://www.w3.org/mid/17E341CD-E790-422C-9F9A-69347EE01CEB@iki.fi -->
+
+ <hr><p>User agents must treat elements and attributes that they do not
+ understand as semantically neutral; leaving them in the DOM (for DOM
+ processors), and styling them according to CSS (for CSS processors),
+ but not inferring any meaning from them.</p>
+
+ <p>When support for a feature is disabled (e.g. as an emergency
+ measure to mitigate a security problem, or to aid in development, or
+ for performance reasons), user agents must act as if they had no
+ support for the feature whatsoever, and as if the feature was not
+ mentioned in this specification. For example, if a particular
+ feature is accessed via an attribute in a Web IDL interface, the
+ attribute itself would be omitted from the objects that implement
+ that interface &mdash; leaving the attribute on the object but
+ making it return null or throw an exception is insufficient.</p>
+
+ </div>
+
+
+
+ <h3 id=case-sensitivity-and-string-comparison><span class=secno>2.3 </span>Case-sensitivity and string comparison</h3>
+
+ <p>Comparing two strings in a <dfn id=case-sensitive>case-sensitive</dfn> manner means
+ comparing them exactly, code point for code point.</p>
+
+ <p>Comparing two strings in an <dfn id=ascii-case-insensitive>ASCII case-insensitive</dfn>
+ manner means comparing them exactly, code point for code point, except
+ that the characters in the range U+0041 to U+005A (i.e. LATIN
+ CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and the corresponding
+ characters in the range U+0061 to U+007A (i.e. LATIN SMALL LETTER A
+ to LATIN SMALL LETTER Z) are considered to also match.</p>
+
+ <p>Comparing two strings in a <dfn id=compatibility-caseless>compatibility caseless</dfn>
+ manner means using the Unicode <i>compatibility caseless match</i>
+ operation to compare the two strings. <a href=#refsUNICODE>[UNICODE]</a></p>
+
+
+ <div class=impl>
+
+ <p><dfn id=converted-to-ascii-uppercase title="converted to ASCII uppercase">Converting a string to
+ ASCII uppercase</dfn> means replacing all characters in the range
+ U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL LETTER Z)
+ with the corresponding characters in the range U+0041 to U+005A
+ (i.e. LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z).</p>
+
+ <p><dfn id=converted-to-ascii-lowercase title="converted to ASCII lowercase">Converting a string to
+ ASCII lowercase</dfn> means replacing all characters in the range
+ U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN CAPITAL
+ LETTER Z) with the corresponding characters in the range U+0061
+ to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL LETTER Z).</p>
+
+ </div>
+
+
+ <p>A string <var title="">pattern</var> is a <dfn id=prefix-match>prefix match</dfn>
+ for a string <var title="">s</var> when <var title="">pattern</var>
+ is not longer than <var title="">s</var> and truncating <var title="">s</var> to <var title="">pattern</var>'s length leaves the
+ two strings as matches of each other.</p>
+
+
+ <h3 id=common-microsyntaxes><span class=secno>2.4 </span>Common microsyntaxes</h3>
+
+ <p>There are various places in HTML that accept particular data
+ types, such as dates or numbers. This section describes what the
+ conformance criteria for content in those formats is, and how to
+ parse them.</p>
+
+ <div class=impl>
+
+ <p class=note>Implementors are strongly urged to carefully examine
+ any third-party libraries they might consider using to implement the
+ parsing of syntaxes described below. For example, date libraries are
+ likely to implement error handling behavior that differs from what
+ is required in this specification, since error-handling behavior is
+ often not defined in specifications that describe date syntaxes
+ similar to those used in this specification, and thus
+ implementations tend to vary greatly in how they handle errors.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=common-parser-idioms><span class=secno>2.4.1 </span>Common parser idioms</h4>
+
+ <p>The <dfn id=space-character title="space character">space characters</dfn>, for the
+ purposes of this specification, are U+0020 SPACE, U+0009 CHARACTER
+ TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and
+ U+000D CARRIAGE RETURN (CR).</p>
+
+ <p>The <dfn id=white_space title=White_Space>White_Space characters</dfn> are
+ those that have the Unicode property "White_Space" in the Unicode
+ <code title="">PropList.txt</code> data file. <a href=#refsUNICODE>[UNICODE]</a></p>
+
+ <p class=note>This should not be confused with the "White_Space"
+ value (abbreviated "WS") of the "Bidi_Class" property in the <code title="">Unicode.txt</code> data file.</p>
+
+ <p>The <dfn id=alphanumeric-ascii-characters>alphanumeric ASCII characters</dfn> are those in the
+ ranges U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0041 LATIN
+ CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z, U+0061 LATIN
+ SMALL LETTER A to U+007A LATIN SMALL LETTER Z.</p>
+
+ <p>Some of the micro-parsers described below follow the pattern of
+ having an <var title="">input</var> variable that holds the string
+ being parsed, and having a <var title="">position</var> variable
+ pointing at the next character to parse in <var title="">input</var>.</p>
+
+ <p>For parsers based on this pattern, a step that requires the user
+ agent to <dfn id=collect-a-sequence-of-characters>collect a sequence of characters</dfn> means that the
+ following algorithm must be run, with <var title="">characters</var>
+ being the set of characters that can be collected:</p>
+
+ <ol><li><p>Let <var title="">input</var> and <var title="">position</var> be the same variables as those of the same
+ name in the algorithm that invoked these steps.</li>
+
+ <li><p>Let <var title="">result</var> be the empty string.</li>
+
+ <li><p>While <var title="">position</var> doesn't point past the
+ end of <var title="">input</var> and the character at <var title="">position</var> is one of the <var title="">characters</var>, append that character to the end of <var title="">result</var> and advance <var title="">position</var> to
+ the next character in <var title="">input</var>.</li>
+
+ <li><p>Return <var title="">result</var>.</li>
+
+ </ol><p>The step <dfn id=skip-whitespace>skip whitespace</dfn> means that the user agent
+ must <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> that are <a href=#space-character title="space character">space characters</a>. The step <dfn id=skip-white_space-characters>skip
+ White_Space characters</dfn> means that the user agent must
+ <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> that are
+ <a href=#white_space>White_Space</a> characters. In both cases, the collected
+ characters are not used. <a href=#refsUNICODE>[UNICODE]</a></p>
+
+ <p>When a user agent is to <dfn id=strip-line-breaks>strip line breaks</dfn> from a
+ string, the user agent must remove any U+000A LINE FEED (LF) and
+ U+000D CARRIAGE RETURN (CR) characters from that string.</p>
+
+ <p>When a user agent is to <dfn id=strip-leading-and-trailing-whitespace>strip leading and trailing
+ whitespace</dfn> from a string, the user agent must remove all <a href=#space-character title="space character">space characters</a> that are at the
+ start or end of the string.</p>
+
+ <p>The <dfn id=code-point-length>code-point length</dfn> of a string is the number of
+ Unicode code points in that string.</p>
+
+ </div>
+
+
+
+ <h4 id=boolean-attributes><span class=secno>2.4.2 </span>Boolean attributes</h4>
+
+ <p>A number of attributes are <dfn id=boolean-attribute title="boolean attribute">boolean
+ attributes</dfn>. The presence of a boolean attribute on an element
+ represents the true value, and the absence of the attribute
+ represents the false value.</p>
+
+ <p>If the attribute is present, its value must either be the empty
+ string or a value that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
+ match for the attribute's canonical name, with no leading or
+ trailing whitespace.</p>
+
+ <p class=note>The values "true" and "false" are not allowed on
+ boolean attributes. To represent a false value, the attribute has to
+ be omitted altogether.</p>
+
+
+
+ <h4 id=keywords-and-enumerated-attributes><span class=secno>2.4.3 </span>Keywords and enumerated attributes</h4>
+
+ <p>Some attributes are defined as taking one of a finite set of
+ keywords. Such attributes are called <dfn id=enumerated-attribute title="enumerated
+ attribute">enumerated attributes</dfn>. The keywords are each
+ defined to map to a particular <em>state</em> (several keywords
+ might map to the same state, in which case some of the keywords are
+ synonyms of each other; additionally, some of the keywords can be
+ said to be non-conforming, and are only in the specification for
+ historical reasons). In addition, two default states can be
+ given. The first is the <i>invalid value default</i>, the second
+ is the <i>missing value default</i>.</p>
+
+ <p>If an enumerated attribute is specified, the attribute's value
+ must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the
+ given keywords that are not said to be non-conforming, with no
+ leading or trailing whitespace.</p>
+
+ <p>When the attribute is specified, if its value is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for one of the given keywords then
+ that keyword's state is the state that the attribute represents. If
+ the attribute value matches none of the given keywords, but the
+ attribute has an <i>invalid value default</i>, then the attribute
+ represents that state. Otherwise, if the attribute value matches
+ none of the keywords but there is a <i>missing value default</i>
+ state defined, then <em>that</em> is the state represented by the
+ attribute. Otherwise, there is no default, and invalid values must
+ be ignored.</p>
+
+ <p>When the attribute is <em>not</em> specified, if there is a
+ <i>missing value default</i> state defined, then that is the state
+ represented by the (missing) attribute. Otherwise, the absence of
+ the attribute means that there is no state represented.</p>
+
+ <p class=note>The empty string can be a valid keyword.</p>
+
+
+ <h4 id=numbers><span class=secno>2.4.4 </span>Numbers</h4>
+
+ <h5 id=non-negative-integers><span class=secno>2.4.4.1 </span>Non-negative integers</h5>
+
+ <p>A string is a <dfn id=valid-non-negative-integer>valid non-negative integer</dfn> if it
+ consists of one or more characters in the range U+0030 DIGIT ZERO
+ (0) to U+0039 DIGIT NINE (9).</p>
+
+ <p>A <a href=#valid-non-negative-integer>valid non-negative integer</a> represents the number
+ that is represented in base ten by that string of digits.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</dfn> are as
+ given in the following algorithm. When invoked, the steps must be
+ followed in the order given, aborting at the first step that returns
+ a value. This algorithm will return either zero, a positive integer,
+ or an error. Leading spaces are ignored. Trailing spaces and any
+ trailing garbage characters are ignored.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is a U+002B PLUS SIGN character (+), advance <var title="">position</var> to the next character. (The "<code title="">+</code>" is ignored, but it is not conforming.)</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
+ return an error.</li>
+
+ <!-- Ok. At this point we know we have a number. It might have
+ trailing garbage which we'll ignore, but it's a number, and we
+ won't return an error. -->
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+ resulting sequence as a base-ten integer. Let <var title="">value</var> be that integer.</li>
+
+ <li><p>Return <var title="">value</var>.</li>
+
+ </ol></div>
+
+
+ <h5 id=signed-integers><span class=secno>2.4.4.2 </span>Signed integers</h5>
+
+ <p>A string is a <dfn id=valid-integer>valid integer</dfn> if it consists of one or
+ more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9), optionally prefixed with a U+002D HYPHEN-MINUS character
+ (-).</p>
+
+ <p>A <a href=#valid-integer>valid integer</a> without a U+002D HYPHEN-MINUS (-)
+ prefix represents the number that is represented in base ten by that
+ string of digits. A <a href=#valid-integer>valid integer</a> <em>with</em> a
+ U+002D HYPHEN-MINUS (-) prefix represents the number represented in
+ base ten by the string of digits that follows the U+002D
+ HYPHEN-MINUS, subtracted from zero.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=rules-for-parsing-integers>rules for parsing integers</dfn> are similar to the
+ <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">rules for
+ non-negative integers</a>, and are as given in the following
+ algorithm. When invoked, the steps must be followed in the order
+ given, aborting at the first step that returns a value. This
+ algorithm will return either an integer or an error. Leading spaces
+ are ignored. Trailing spaces and trailing garbage characters are
+ ignored.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>Let <var title="">sign</var> have the value
+ "positive".</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ <li>
+
+ <p>If the character indicated by <var title="">position</var> (the
+ first character) is a U+002D HYPHEN-MINUS character (-):</p>
+
+ <ol><li>Let <var title="">sign</var> be "negative".</li>
+
+ <li>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ </ol><p>Otherwise, if the character indicated by <var title="">position</var> (the first character) is a U+002B PLUS
+ SIGN character (+):</p>
+
+ <ol><li>Advance <var title="">position</var> to the next
+ character. (The "<code title="">+</code>" is ignored, but it is
+ not conforming.)</li>
+
+ <li>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ </ol></li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
+ return an error.</li>
+
+ <!-- Ok. At this point we know we have a number. It might have
+ trailing garbage which we'll ignore, but it's a number, and we
+ won't return an error. -->
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+ resulting sequence as a base-ten integer. Let <var title="">value</var> be that integer.</li>
+
+ <li><p>If <var title="">sign</var> is "positive", return <var title="">value</var>, otherwise return the result of subtracting
+ <var title="">value</var> from zero.</li>
+
+ </ol></div>
+
+
+ <h5 id=real-numbers><span class=secno>2.4.4.3 </span>Real numbers</h5>
+
+ <p>A string is a <dfn id=valid-floating-point-number>valid floating point number</dfn> if it
+ consists of:</p>
+
+ <ol class=brief><li>Optionally, a U+002D HYPHEN-MINUS character (-).</li>
+
+ <li>A series of one or more characters in the range U+0030 DIGIT
+ ZERO (0) to U+0039 DIGIT NINE (9).</li>
+
+ <li>Optionally:
+
+ <ol><li>A single U+002E FULL STOP character (.).</li>
+
+ <li>A series of one or more characters in the range U+0030 DIGIT
+ ZERO (0) to U+0039 DIGIT NINE (9).</li>
+
+ </ol></li>
+
+ <li>Optionally:
+
+ <ol><li>Either a U+0065 LATIN SMALL LETTER E character (e) or a
+ U+0045 LATIN CAPITAL LETTER E character (E).</li>
+
+ <li>Optionally, a U+002D HYPHEN-MINUS character (-) or U+002B
+ PLUS SIGN character (+).</li>
+
+ <li>A series of one or more characters in the range U+0030 DIGIT
+ ZERO (0) to U+0039 DIGIT NINE (9).</li>
+
+ </ol></li>
+
+ </ol><p>A <a href=#valid-floating-point-number>valid floating point number</a> represents the number
+ obtained by multiplying the significand by ten raised to the power
+ of the exponent, where the significand is the first number,
+ interpreted as base ten (including the decimal point and the number
+ after the decimal point, if any, and interpreting the significand as
+ a negative number if the whole string starts with a U+002D
+ HYPHEN-MINUS character (-) and the number is not zero), and where
+ the exponent is the number after the E, if any (interpreted as a
+ negative number if there is a U+002D HYPHEN-MINUS character (-)
+ between the E and the number and the number is not zero, or else
+ ignoring a U+002B PLUS SIGN character (+) between the E and the
+ number if there is one). If there is no E, then the exponent is
+ treated as zero.</p>
+
+ <p class=note>The Infinity and Not-a-Number (NaN) values are not
+ <a href=#valid-floating-point-number title="valid floating point number">valid floating point
+ numbers</a>.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=best-representation-of-the-number-as-a-floating-point-number title="best representation of the number as a floating
+ point number">best representation of the number <var title="">n</var> as a floating point number</dfn> is the string
+ obtained from applying the JavaScript operator ToString to <var title="">n</var>. The JavaScript operator ToString is not uniquely
+ determined. When there are multiple possible strings that could be
+ obtained from the JavaScript operator ToString for a particular
+ value, the user agent must always return the same string for that
+ value (though it may differ from the value used by other user
+ agents).</p>
+
+ <p>The <dfn id=rules-for-parsing-floating-point-number-values>rules for parsing floating point number values</dfn> are
+ as given in the following algorithm. This algorithm must be aborted
+ at the first step that returns something. This algorithm will return
+ either a number or an error. Leading spaces are ignored. Trailing
+ spaces and garbage characters are ignored.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>Let <var title="">value</var> have the value 1.</li>
+
+ <li><p>Let <var title="">divisor</var> have the value 1.</li>
+
+ <li><p>Let <var title="">exponent</var> have the value 1.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ <li>
+
+ <p>If the character indicated by <var title="">position</var> is a
+ U+002D HYPHEN-MINUS character (-):</p>
+
+ <ol><li>Change <var title="">value</var> and <var title="">divisor</var> to &minus;1.</li>
+
+ <li>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ </ol></li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
+ return an error.</li>
+
+ <!-- Ok. At this point we know we have a number. It might have
+ trailing garbage which we'll ignore, but it's a number, and we
+ won't return an error unless it's out of range. -->
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+ resulting sequence as a base-ten integer. Multiply <var title="">value</var> by that integer.</li>
+
+ <li>If <var title="">position</var> is past the end of <var title="">input</var>, jump to the step labeled
+ <i>conversion</i>.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is a U+002E FULL STOP (.), run these substeps:</p>
+
+ <ol><li><p>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, or if the character indicated by <var title="">position</var> is not one of U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9), then jump to the step labeled
+ <i>conversion</i>.</li>
+
+ <li><p><i>Fraction loop</i>: Multiply <var title="">divisor</var>
+ by ten.</li>
+
+ <li>Add the value of the character indicated by <var title="">position</var>, interpreted as a base-ten digit (0..9)
+ and divided by <var title="">divisor</var>, to <var title="">value</var>.</li>
+
+ <li><p>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump to the step labeled
+ <i>conversion</i>.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), jump
+ back to the step labeled <i>fraction loop</i> in these
+ substeps.</li>
+
+ </ol></li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN
+ CAPITAL LETTER E character (E), run these substeps:</p>
+
+ <ol><li><p>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump to the step labeled
+ <i>conversion</i>.</li>
+
+ <li>
+
+ <p>If the character indicated by <var title="">position</var> is
+ a U+002D HYPHEN-MINUS character (-):</p>
+
+ <ol><li>Change <var title="">exponent</var> to &minus;1.</li>
+
+ <li>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump to the step labeled
+ <i>conversion</i>.</li>
+
+ </ol><p>Otherwise, if the character indicated by <var title="">position</var> is a U+002B PLUS SIGN character (+):</p>
+
+ <ol><li>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump to the step labeled
+ <i>conversion</i>.</li>
+
+ </ol></li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9),
+ then jump to the step labeled <i>conversion</i>.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+ resulting sequence as a base-ten integer. Multiply <var title="">exponent</var> by that integer.</li>
+
+ <li><p>Multiply <var title="">value</var> by ten raised to the
+ <var title="">exponent</var>th power.</li>
+
+ </ol></li>
+
+ <li><p><i>Conversion</i>: Let <var title="">S</var> be the set of
+ finite IEEE 754 single-precision floating point values except
+ &minus;0, but with two special values added: 2<sup title="">128</sup> and &minus;2<sup title="">128</sup>.</li>
+
+ <li><p>Let <var title="">rounded-value</var> be the number in <var title="">S</var> that is closest to <var title="">value</var>,
+ selecting the number with an even significand if there are two
+ equally close values. (The two special values 2<sup title="">128</sup> and &minus;2<sup title="">128</sup> are
+ considered to have even significands for this purpose.)</li>
+
+ <li><p>If <var title="">rounded-value</var> is 2<sup title="">128</sup> or &minus;2<sup title="">128</sup>, return an
+ error.</li>
+
+ <li><p>Return <var title="">rounded-value</var>.</li>
+
+ </ol></div>
+
+
+<div class=impl>
+ <h5 id=percentages-and-dimensions><span class=secno>2.4.4.4 </span>Percentages and lengths</h5>
+<!--(percentages are not used in valid html anymore)
+ <p>A string is a <dfn>valid dimension value</dfn> if it consists of
+ a character in the range U+0031 DIGIT ONE (1) to U+0039 DIGIT NINE
+ (9), optionally followed by zero of more characters in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), optionally followed
+ by a U+002E FULL STOP character (.) and one or more characters in
+ the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and
+ optionally suffixed by a U+0025 PERCENT SIGN character (%).</p>
+
+ <p>A <span>valid dimension value</span> represents the number that
+ is represented in base ten by that string of digits, optionally with
+ a fractional component. If the U+0025 PERCENT SIGN is present, then
+ the dimension is a percentage; otherwise, it is a length.</p>
+
+ <p class="note">For historical reasons, percentanges and lengths
+ less than 1.0 cannot be represented as <span title="valid dimension
+ value">valid dimension values</span>.</p>
+-->
+ <p>The <dfn id=rules-for-parsing-dimension-values>rules for parsing dimension values</dfn> are as given in
+ the following algorithm. When invoked, the steps must be followed in
+ the order given, aborting at the first step that returns a
+ value. This algorithm will return either a number greater than or
+ equal to 1.0, or an error; if a number is returned, then it is
+ further categorized as either a percentage or a length.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is a U+002B PLUS SIGN character (+), advance <var title="">position</var> to the next character.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
+ U+0030 DIGIT ZERO (0) characters, and discard them.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is not one of U+0031 DIGIT ONE (1) to U+0039 DIGIT NINE (9), then
+ return an error.</li>
+
+ <!-- Ok. At this point we know we have a number. It might have
+ trailing garbage which we'll ignore, but it's a number, and we
+ won't return an error. -->
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+ resulting sequence as a base-ten integer. Let <var title="">value</var> be that number.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return <var title="">value</var> as a
+ length.</li>
+
+ <li>
+
+ <p>If the character indicated by <var title="">position</var> is a
+ U+002E FULL STOP character (.):</p>
+
+ <ol><li><p>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, or if the character indicated by <var title="">position</var> is not one of U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9), then return <var title="">value</var> as a
+ length.</li>
+
+ <li><p>Let <var title="">divisor</var> have the value 1.</li>
+
+ <li><p><i>Fraction loop</i>: Multiply <var title="">divisor</var>
+ by ten.</li>
+
+ <li>Add the value of the character indicated by <var title="">position</var>, interpreted as a base-ten digit (0..9)
+ and divided by <var title="">divisor</var>, to <var title="">value</var>.</li>
+
+ <li><p>Advance <var title="">position</var> to the next
+ character.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then return <var title="">value</var> as a
+ length.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), return
+ to the step labeled <i>fraction loop</i> in these
+ substeps.</li>
+
+ </ol></li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return <var title="">value</var> as a
+ length.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is a U+0025 PERCENT SIGN character (%), return <var title="">value</var> as a percentage.</li>
+
+ <li><p>Return <var title="">value</var> as a length.</li>
+
+ </ol></div>
+
+
+ <h5 id=lists-of-integers><span class=secno>2.4.4.5 </span>Lists of integers</h5>
+
+ <p>A <dfn id=valid-list-of-integers>valid list of integers</dfn> is a number of <a href=#valid-integer title="valid integer">valid integers</a> separated by U+002C
+ COMMA characters, with no other characters (e.g. no <a href=#space-character title="space character">space characters</a>). In addition, there
+ might be restrictions on the number of integers that can be given,
+ or on the range of values allowed.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=rules-for-parsing-a-list-of-integers>rules for parsing a list of integers</dfn> are as
+ follows:</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>Let <var title="">numbers</var> be an initially empty list
+ of integers. This list will be the result of this
+ algorithm.</li>
+
+ <li><p>If there is a character in the string <var title="">input</var> at position <var title="">position</var>, and
+ it is either a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON
+ character, then advance <var title="">position</var> to the next
+ character in <var title="">input</var>, or to beyond the end of the
+ string if there are no more characters.</li>
+
+ <li><p>If <var title="">position</var> points to beyond the end of
+ <var title="">input</var>, return <var title="">numbers</var> and
+ abort.</li>
+
+ <li><p>If the character in the string <var title="">input</var> at
+ position <var title="">position</var> is a U+0020 SPACE, U+002C
+ COMMA, or U+003B SEMICOLON character, then return to step 4.</li>
+
+ <li><p>Let <var title="">negated</var> be false.</li>
+ <li><p>Let <var title="">value</var> be 0.</li>
+
+ <li><p>Let <var title="">started</var> be false. This variable is
+ set to true when the parser sees a number or a U+002D HYPHEN-MINUS
+ character (-).</li>
+
+ <li><p>Let <var title="">got number</var> be false. This variable
+ is set to true when the parser sees a number.</li>
+
+ <li><p>Let <var title="">finished</var> be false. This variable is
+ set to true to switch parser into a mode where it ignores
+ characters until the next separator.</li>
+
+ <li><p>Let <var title="">bogus</var> be false.</li>
+
+ <li><p><i>Parser</i>: If the character in the string <var title="">input</var> at position <var title="">position</var>
+ is:</p>
+
+ <dl class=switch><dt>A U+002D HYPHEN-MINUS character</dt>
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol><li>If <var title="">got number</var> is true, let <var title="">finished</var> be true.</li>
+
+ <li>If <var title="">finished</var> is true, skip to the next
+ step in the overall set of steps.</li>
+
+ <li>If <var title="">started</var> is true, let <var title="">negated</var> be false.</li>
+
+ <li>Otherwise, if <var title="">started</var> is false and if <var title="">bogus</var> is false, let <var title="">negated</var>
+ be true.</li>
+
+ <li>Let <var title="">started</var> be true.</li>
+
+ </ol></dd>
+
+
+ <dt>A character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9)</dt>
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol><li>If <var title="">finished</var> is true, skip to the next
+ step in the overall set of steps.</li>
+
+ <li>Multiply <var title="">value</var> by ten.</li>
+
+ <li>Add the value of the digit, interpreted in base ten, to
+ <var title="">value</var>.</li>
+
+ <li>Let <var title="">started</var> be true.</li>
+
+ <li>Let <var title="">got number</var> be true.</li>
+
+ </ol></dd>
+
+
+ <dt>A U+0020 SPACE character</dt>
+ <dt>A U+002C COMMA character</dt>
+ <dt>A U+003B SEMICOLON character</dt>
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol><li>If <var title="">got number</var> is false, return the <var title="">numbers</var> list and abort. This happens if an entry
+ in the list has no digits, as in "<code title="">1,2,x,4</code>".</li>
+
+ <li>If <var title="">negated</var> is true, then negate <var title="">value</var>.</li>
+
+ <li>Append <var title="">value</var> to the <var title="">numbers</var> list.</li>
+
+ <li>Jump to step 4 in the overall set of steps.</li>
+
+ </ol></dd>
+
+
+ <!-- <dt>A U+002E FULL STOP character</dt> -->
+ <dt>A character in the range U+0001 to U+001F, <!-- space --> U+0021 to U+002B, <!-- comma --> U+002D to U+002F, <!-- digits --> U+003A, <!-- semicolon --> U+003C to U+0040, <!-- a-z --> U+005B to U+0060, <!-- A-Z --> U+007b to U+007F
+ (i.e. any other non-alphabetic ASCII character)</dt>
+
+ <!--
+ Test: http://www.hixie.ch/tests/adhoc/html/flow/image-maps/004-demo.html
+ IE6 on Wine treats the following characters like this also: U+1-U+1f,
+ U+21-U+2b, U+2d-U+2f, U+3a, U+3c-U+40, U+5b-U+60, U+7b-U+82,
+ U+84-U+89, U+8b, U+8d, U+8f-U+99, U+9b, U+9d, U+a0-U+bf, U+d7, U+f7,
+ U+1f6-U+1f9, U+218-U+24f, U+2a9-U+385, U+387, U+38b, U+38d, U+3a2,
+ U+3cf, U+3d7-U+3d9, U+3db, U+3dd, U+3df, U+3e1, U+3f4-U+400, U+40d,
+ U+450, U+45d, U+482-U+48f, U+4c5-U+4c6, U+4c9-U+4ca, U+4cd-U+4cf,
+ U+4ec-U+4ed, U+4f6-U+4f7, U+4fa-U+530, U+557-U+560, U+588-U+5cf,
+ U+5eb-U+5ef, U+5f3-U+620, U+63b-U+640, U+64b-U+670, U+6b8-U+6b9,
+ U+6bf, U+6cf, U+6d4, U+6d6-U+904, U+93a-U+957, U+962-U+984,
+ U+98d-U+98e, U+991-U+992, U+9a9, U+9b1, U+9b3-U+9b5, U+9ba-U+9db,
+ U+9de, U+9e2-U+9ef, U+9f2-U+a04, U+a0b-U+a0e, U+a11-U+a12, U+a29,
+ U+a31, U+a34, U+a37, U+a3a-U+a58, U+a5d, U+a5f-U+a84, U+a8c, U+a8e,
+ U+a92, U+aa9, U+ab1, U+ab4, U+aba-U+adf, U+ae1-U+b04, U+b0d-U+b0e,
+ U+b11-U+b12, U+b29, U+b31, U+b34-U+b35, U+b3a-U+b5b, U+b5e,
+ U+b62-U+b84, U+b8b-U+b8d, U+b91, U+b96-U+b98, U+b9b, U+b9d,
+ U+ba0-U+ba2, U+ba5-U+ba7, U+bab-U+bad, U+bb6, U+bba-U+c04, U+c0d,
+ U+c11, U+c29, U+c34, U+c3a-U+c5f, U+c62-U+c84, U+c8d, U+c91, U+ca9,
+ U+cb4, U+cba-U+cdd, U+cdf, U+ce2-U+d04, U+d0d, U+d11, U+d29,
+ U+d3a-U+d5f, U+d62-U+e00, U+e2f, U+e31, U+e34-U+e3f, U+e46-U+e80,
+ U+e83, U+e85-U+e86, U+e89, U+e8b-U+e8c, U+e8e-U+e93, U+e98, U+ea0,
+ U+ea4, U+ea6, U+ea8-U+ea9, U+eac, U+eaf-U+edb, U+ede-U+109f,
+ U+10c6-U+10cf, U+10f7-U+10ff, U+115a-U+115e, U+11a3-U+11a7,
+ U+11fa-U+1dff, U+1e9b-U+1e9f, U+1efa-U+1eff, U+1f16-U+1f17,
+ U+1f1e-U+1f1f, U+1f46-U+1f47, U+1f4e-U+1f4f, U+1f58, U+1f5a, U+1f5c,
+ U+1f5e, U+1f7e-U+1f7f, U+1fb5, U+1fbd-U+1fc1, U+1fc5, U+1fcd-U+1fcf,
+ U+1fd4-U+1fd5, U+1fdc-U+1fdf, U+1fed-U+1ff1, U+1ff5, U+1ffd-U+249b,
+ U+24ea-U+3004, U+3006-U+3040, U+3095-U+309a, U+309f-U+30a0, U+30fb,
+ U+30ff-U+3104, U+312d-U+3130, U+318f-U+4dff, U+9fa6-U+abff,
+ U+d7a4-U+d7ff, U+e000-U+f8ff, U+fa2e-U+faff, U+fb07-U+fb12,
+ U+fb18-U+fb1e, U+fb37, U+fb3d, U+fb3f, U+fb42, U+fb45, U+fbb2-U+fbd2,
+ U+fbe9, U+fce1, U+fd3e-U+fd4f, U+fd90-U+fd91, U+fdc8-U+fdef,
+ U+fdfc-U+fe7f, U+fefd-U+ff20, U+ff3b-U+ff40, U+ff5b-U+ff65, U+ffa0,
+ U+ffbf-U+ffc1, U+ffc8-U+ffc9, U+ffd0-U+ffd1, U+ffd8-U+ffd9,
+ U+ffdd-U+ffff
+ IE7 on Win2003 treats the following characters like this also
+ instead: U+1-U+1f, U+21-U+2b, U+2d-U+2f, U+3a, U+3c-U+40, U+5b-U+60,
+ U+7b-U+82, U+84-U+89, U+8b, U+8d, U+8f-U+99, U+9b, U+9d, U+a0-U+a9,
+ U+ab-U+b4, U+b6-U+b9, U+bb-U+bf, U+d7, U+f7, U+220-U+221,
+ U+234-U+24f, U+2ae-U+2af, U+2b9-U+2ba, U+2c2-U+2df, U+2e5-U+2ed,
+ U+2ef-U+344, U+346-U+379, U+37b-U+385, U+387, U+38b, U+38d, U+3a2,
+ U+3cf, U+3d8-U+3d9, U+3f4-U+3ff, U+482-U+48b, U+4c5-U+4c6,
+ U+4c9-U+4ca, U+4cd-U+4cf, U+4f6-U+4f7, U+4fa-U+530, U+557-U+558,
+ U+55a-U+560, U+588-U+5cf, U+5eb-U+5ef, U+5f3-U+620, U+63b-U+640,
+ U+656-U+66f, U+6d4, U+6dd-U+6e0, U+6e9-U+6ec, U+6ee-U+6f9,
+ U+6fd-U+70f, U+72d-U+72f, U+740-U+77f, U+7b1-U+900, U+904,
+ U+93a-U+93c, U+94d - U+94f, U+951-U+957, U+964-U+980, U+984,
+ U+98d-U+98e, U+991-U+992, U+9a9, U+9b1, U+9b3-U+9b5, U+9ba-U+9bd,
+ U+9c5-U+9c6, U+9c9-U+9ca, U+9cd-U+9d6, U+9d8-U+9db, U+9de,
+ U+9e4-U+9ef, U+9f2-U+a01, U+a03-U+a04, U+a0b-U+a0e, U+a11-U+a12,
+ U+a29, U+a31, U+a34, U+a37, U+a3a-U+a3d, U+a43-U+a46, U+a49-U+a4a,
+ U+a4d-U+a58, U+a5d, U+a5f-U+a6f, U+a75-U+a80, U+a84, U+a8c, U+a8e,
+ U+a92, U+aa9, U+ab1, U+ab4, U+aba-U+abc, U+ac6, U+aca, U+acd-U+acf,
+ U+ad1-U+adf, U+ae1-U+b00, U+b04, U+b0d-U+b0e, U+b11-U+b12, U+b29,
+ U+b31, U+b34-U+b35, U+b3a-U+b3c, U+b44-U+b46, U+b49 - U+b4a,
+ U+b4d-U+b55, U+b58-U+b5b, U+b5e, U+b62-U+b81, U+b84, U+b8b-U+b8d,
+ U+b91, U+b96-U+b98, U+b9b, U+b9d, U+ba0 - U+ba2, U+ba5-U+ba7,
+ U+bab-U+bad, U+bb6, U+bba-U+bbd, U+bc3-U+bc5, U+bc9, U+bcd-U+bd6,
+ U+bd8-U+c00, U+c04, U+c0d, U+c11, U+c29, U+c34, U+c3a-U+c3d, U+c45,
+ U+c49, U+c4d-U+c54, U+c57-U+c5f, U+c62-U+c81, U+c84, U+c8d, U+c91,
+ U+ca9, U+cb4, U+cba-U+cbd, U+cc5, U+cc9, U+ccd-U+cd4, U+cd7-U+cdd,
+ U+cdf, U+ce2-U+d01, U+d04, U+d0d, U+d11, U+d29, U+d3a-U+d3d,
+ U+d44-U+d45, U+d49, U+d4d-U+d56, U+d58-U+d5f, U+d62-U+d81, U+d84,
+ U+d97-U+d99, U+db2, U+dbc, U+dbe - U+dbf, U+dc7-U+dce, U+dd5, U+dd7,
+ U+de0-U+df1, U+df4-U+e00, U+e3b-U+e3f, U+e4f-U+e80, U+e83,
+ U+e85-U+e86, U+e89, U+e8b-U+e8c, U+e8e-U+e93, U+e98, U+ea0, U+ea4,
+ U+ea6, U+ea8-U+ea9, U+eac, U+eba, U+ebe-U+ebf, U+ec5-U+ecc,
+ U+ece-U+edb, U+ede-U+eff, U+f01-U+f3f, U+f48, U+f6b-U+f70,
+ U+f82-U+f87, U+f8c-U+f8f, U+f98, U+fbd-U+fff, U+1022, U+1028, U+102b,
+ U+1033-U+1035, U+1037, U+1039-U+104f, U+105a-U+109f, U+10c6-U+10cf,
+ U+10f7-U+10ff, U+115a - U+115e, U+11a3-U+11a7, U+11fa-U+11ff, U+1207,
+ U+1247, U+1249, U+124e-U+124f, U+1257, U+1259, U+125e-U+125f, U+1287,
+ U+1289, U+128e-U+128f, U+12af, U+12b1, U+12b6-U+12b7, U+12bf, U+12c1,
+ U+12c6-U+12c7, U+12cf, U+12d7, U+12ef, U+130f, U+1311, U+1316-U+1317,
+ U+131f, U+1347, U+135b-U+139f, U+13f5-U+1400, U+166d-U+166e,
+ U+1677-U+1680, U+169b - U+169f, U+16eb-U+177f, U+17c9-U+181f, U+1843,
+ U+1878-U+187f, U+18aa-U+1dff, U+1e9c-U+1e9f, U+1efa-U+1eff,
+ U+1f16-U+1f17, U+1f1e-U+1f1f, U+1f46-U+1f47, U+1f4e-U+1f4f, U+1f58,
+ U+1f5a, U+1f5c, U+1f5e, U+1f7e-U+1f7f, U+1fb5, U+1fbd, U+1fbf-U+1fc1,
+ U+1fc5, U+1fcd-U+1fcf, U+1fd4-U+1fd5, U+1fdc-U+1fdf, U+1fed-U+1ff1,
+ U+1ff5, U+1ffd-U+207e, U+2080-U+2101, U+2103-U+2106, U+2108-U+2109,
+ U+2114, U+2116-U+2118, U+211e-U+2123, U+2125, U+2127, U+2129, U+212e,
+ U+2132, U+213a-U+215f, U+2184-U+3005, U+3008-U+3020, U+302a-U+3037,
+ U+303b-U+3104, U+312d-U+3130, U+318f - U+319f, U+31b8-U+33ff,
+ U+4db6-U+4dff, U+9fa6-U+9fff, U+a48d-U+abff, U+d7a4-U+d7ff,
+ U+e000-U+f8ff, U+fa2e-U+faff, U+fb07-U+fb12, U+fb18-U+fb1c, U+fb1e,
+ U+fb29, U+fb37, U+fb3d, U+fb3f, U+fb42, U+fb45, U+fbb2-U+fbd2,
+ U+fd3e-U+fd4f, U+fd90-U+fd91, U+fdc8-U+fdef, U+fdfc-U+fe6f, U+fe73,
+ U+fe75, U+fefd-U+ff20, U+ff3b-U+ff40, U+ff5b-U+ff9f, U+ffbf-U+ffc1,
+ U+ffc8-U+ffc9, U+ffd0-U+ffd1, U+ffd8-U+ffd9, U+ffdd-U+ffff
+ -->
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol><li>If <var title="">got number</var> is true, let <var title="">finished</var> be true.</li>
+
+ <li>If <var title="">finished</var> is true, skip to the next
+ step in the overall set of steps.</li>
+
+ <li>Let <var title="">negated</var> be false.</li>
+
+ </ol></dd>
+
+
+ <dt>Any other character</dt>
+ <!-- alphabetic a-z A-Z, and non-ASCII -->
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol><li>If <var title="">finished</var> is true, skip to the next
+ step in the overall set of steps.</li>
+
+ <li>Let <var title="">negated</var> be false.</li>
+
+ <li>Let <var title="">bogus</var> be true.</li>
+
+ <li>If <var title="">started</var> is true, then return the
+ <var title="">numbers</var> list, and abort. (The value in <var title="">value</var> is not appended to the list first; it is
+ dropped.)</li>
+
+ </ol></dd>
+
+ </dl></li>
+
+ <li><p>Advance <var title="">position</var> to the next character
+ in <var title="">input</var>, or to beyond the end of the string if
+ there are no more characters.</li>
+
+ <li><p>If <var title="">position</var> points to a character (and
+ not to beyond the end of <var title="">input</var>), jump to the
+ big <i>Parser</i> step above.</li>
+
+ <li><p>If <var title="">negated</var> is true, then negate <var title="">value</var>.</li>
+
+ <li><p>If <var title="">got number</var> is true, then append <var title="">value</var> to the <var title="">numbers</var> list.</li>
+
+ <li><p>Return the <var title="">numbers</var> list and
+ abort.</li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h5 id=lists-of-dimensions><span class=secno>2.4.4.6 </span>Lists of dimensions</h5>
+
+ <!-- no definition of a type since no conforming feature uses this
+ syntax (it's only used in cols="" and rows="" on <frameset> -->
+
+ <p>The <dfn id=rules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions</dfn> are as
+ follows. These rules return a list of zero or more pairs consisting
+ of a number and a unit, the unit being one of <i>percentage</i>,
+ <i>relative</i>, and <i>absolute</i>.</p>
+
+ <ol><li><p>Let <var title="">raw input</var> be the string being
+ parsed.</li>
+
+ <li><p>If the last character in <var title="">raw input</var> is a
+ U+002C COMMA character (,), then remove that character from <var title="">raw input</var>.</li>
+
+ <li><p><a href=#split-a-string-on-commas title="split a string on commas">Split the string <var title="">raw input</var> on commas</a>. Let <var title="">raw
+ tokens</var> be the resulting list of tokens.</li>
+
+ <li><p>Let <var title="">result</var> be an empty list of
+ number/unit pairs.</li>
+
+ <li>
+
+ <p>For each token in <var title="">raw tokens</var>, run the
+ following substeps:</p>
+
+ <ol><li><p>Let <var title="">input</var> be the token.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>Let <var title="">value</var> be the number 0.</li>
+
+ <li><p>Let <var title="">unit</var> be <i>absolute</i>.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, set <var title="">unit</var> to
+ <i>relative</i> and jump to the last substep.</li>
+
+ <li><p>If the character at <var title="">position</var> is a
+ character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE
+ (9), <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), interpret the
+ resulting sequence as an integer in base ten, and increment <var title="">value</var> by that integer.</li>
+
+ <li>
+
+ <p>If the character at <var title="">position</var> is a U+002E
+ FULL STOP character (.), run these substeps:</p>
+
+ <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> consisting
+ of <a href=#space-character title="space character">space characters</a> and
+ characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9). Let <var title="">s</var> be the resulting
+ sequence.</li>
+
+ <li><p>Remove all <a href=#space-character title="space character">space
+ characters</a> in <var title="">s</var>.</li>
+
+ <li>
+
+ <p>If <var title="">s</var> is not the empty string, run these
+ subsubsteps:</p>
+
+ <ol><li><p>Let <var title="">length</var> be the number of
+ characters in <var title="">s</var> (after the spaces were
+ removed).</li>
+
+ <li><p>Let <var title="">fraction</var> be the result of
+ interpreting <var title="">s</var> as a base-ten integer, and
+ then dividing that number by <span title="">10<sup title=""><var title="">length</var></sup></span>.</li>
+
+ <li><p>Increment <var title="">value</var> by <var title="">fraction</var>.</li>
+
+ </ol></li>
+
+ </ol></li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li>
+
+ <p>If the character at <var title="">position</var> is a U+0025
+ PERCENT SIGN character (%), then set <var title="">unit</var> to
+ <i>percentage</i>.</p>
+
+ <p>Otherwise, if the character at <var title="">position</var>
+ is a U+002A ASTERISK character (*), then set <var title="">unit</var> to <i>relative</i>.</p>
+
+ </li>
+
+ <!-- the remaining characters in /input/ are ignored -->
+
+ <li><p>Add an entry to <var title="">result</var> consisting of
+ the number given by <var title="">value</var> and the unit given
+ by <var title="">unit</var>.</li>
+
+ </ol></li>
+
+ <li><p>Return the list <var title="">result</var>.</li>
+
+ </ol></div>
+
+
+ <h4 id=dates-and-times><span class=secno>2.4.5 </span>Dates and times</h4>
+
+ <p>In the algorithms below, the <dfn id=number-of-days-in-month-month-of-year-year>number of days in month <var title="">month</var> of year <var title="">year</var></dfn> is:
+ <em>31</em> if <var title="">month</var> is 1, 3, 5, 7, 8, 10, or
+ 12; <em>30</em> if <var title="">month</var> is 4, 6, 9, or 11;
+ <em>29</em> if <var title="">month</var> is 2 and <var title="">year</var> is a number divisible by 400, or if <var title="">year</var> is a number divisible by 4 but not by 100; and
+ <em>28</em> otherwise. This takes into account leap years in the
+ Gregorian calendar. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
+
+ <p>The <dfn id=concept-datetime-digit title=concept-datetime-digit>digits</dfn> in the date
+ and time syntaxes defined in this section must be characters in the
+ range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), used to
+ express numbers in base ten.</p>
+
+ <div class=impl>
+
+ <p class=note>While the formats described here are intended to be
+ subsets of the corresponding ISO8601 formats, this specification
+ defines parsing rules in much more detail than ISO8601.
+ Implementors are therefore encouraged to carefully examine any date
+ parsing libraries before using them to implement the parsing rules
+ described below; ISO8601 libraries might not parse dates and times
+ in exactly the same manner. <a href=#refsISO8601>[ISO8601]</a></p>
+
+ </div>
+
+
+ <h5 id=months><span class=secno>2.4.5.1 </span>Months</h5>
+
+ <p>A <dfn id=concept-month title=concept-month>month</dfn> consists of a specific
+ proleptic Gregorian date with no time-zone information and no date
+ information beyond a year and a month. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn id=valid-month-string>valid month string</dfn> representing a year
+ <var title="">year</var> and month <var title="">month</var> if it
+ consists of the following components in the given order:</p>
+
+ <ol><li>Four or more <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>, representing <var title="">year</var>, where <var title="">year</var>&nbsp;&gt;&nbsp;0</li>
+
+ <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+ <li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing the month <var title="">month</var>, in the range
+ 1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12</li>
+
+ </ol><div class=impl>
+
+ <p>The rules to <dfn id=parse-a-month-string>parse a month string</dfn> are as follows. This
+ will return either a year and month, or nothing. If at any point the
+ algorithm says that it "fails", this means that it is aborted at
+ that point and returns nothing.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#parse-a-month-component>Parse a month component</a> to obtain <var title="">year</var> and <var title="">month</var>. If this returns
+ nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</li>
+
+ <li><p>Return <var title="">year</var> and <var title="">month</var>.</li>
+
+ </ol><p>The rules to <dfn id=parse-a-month-component>parse a month component</dfn>, given an <var title="">input</var> string and a <var title="">position</var>, are
+ as follows. This will return either a year and a month, or
+ nothing. If at any point the algorithm says that it "fails", this
+ means that it is aborted at that point and returns nothing.</p>
+
+ <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not at least four characters long, then
+ fail. Otherwise, interpret the resulting sequence as a base-ten
+ integer. Let that number be the <var title="">year</var>.</li>
+
+ <li><p>If <var title="">year</var> is not a number greater than
+ zero, then fail.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character,
+ then fail. Otherwise, move <var title="">position</var> forwards
+ one character.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then fail. Otherwise,
+ interpret the resulting sequence as a base-ten integer. Let that
+ number be the <var title="">month</var>.</li>
+
+ <li><p>If <var title="">month</var> is not a number in the range
+ 1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12, then
+ fail.</li>
+
+ <li><p>Return <var title="">year</var> and <var title="">month</var>.</li>
+
+ </ol></div>
+
+
+ <h5 id=dates><span class=secno>2.4.5.2 </span>Dates</h5>
+
+ <p>A <dfn id=concept-date title=concept-date>date</dfn> consists of a specific
+ proleptic Gregorian date with no time-zone information, consisting
+ of a year, a month, and a day. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn id=valid-date-string>valid date string</dfn> representing a year
+ <var title="">year</var>, month <var title="">month</var>, and day
+ <var title="">day</var> if it consists of the following components
+ in the given order:</p>
+
+ <ol><li>A <a href=#valid-month-string>valid month string</a>, representing <var title="">year</var> and <var title="">month</var></li>
+
+ <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+ <li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing <var title="">day</var>, in the range
+ 1&nbsp;&le;&nbsp;<var title="">day</var>&nbsp;&le;&nbsp;<var title="">maxday</var> where <var title="">maxday</var> is the <a href=#number-of-days-in-month-month-of-year-year title="number of days in month month of year year">number of days
+ in the month <var title="">month</var> and year <var title="">year</var></a></li>
+
+ </ol><div class=impl>
+
+ <p>The rules to <dfn id=parse-a-date-string>parse a date string</dfn> are as follows. This
+ will return either a date, or nothing. If at any point the algorithm
+ says that it "fails", this means that it is aborted at that point
+ and returns nothing.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</li>
+
+ <li><p>Let <var title="">date</var> be the date with year <var title="">year</var>, month <var title="">month</var>, and day <var title="">day</var>.</li>
+
+ <li><p>Return <var title="">date</var>.</li>
+
+ </ol><p>The rules to <dfn id=parse-a-date-component>parse a date component</dfn>, given an <var title="">input</var> string and a <var title="">position</var>, are
+ as follows. This will return either a year, a month, and a day, or
+ nothing. If at any point the algorithm says that it "fails", this
+ means that it is aborted at that point and returns nothing.</p>
+
+ <ol><li><p><a href=#parse-a-month-component>Parse a month component</a> to obtain <var title="">year</var> and <var title="">month</var>. If this returns
+ nothing, then fail.</li>
+
+ <li><p>Let <var title="">maxday</var> be the <a href=#number-of-days-in-month-month-of-year-year>number of days
+ in month <var title="">month</var> of year <var title="">year</var></a>.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character,
+ then fail. Otherwise, move <var title="">position</var> forwards
+ one character.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then fail. Otherwise,
+ interpret the resulting sequence as a base-ten integer. Let that
+ number be the <var title="">day</var>.</li>
+
+ <li><p>If <var title="">day</var> is not a number in the range
+ 1&nbsp;&le;&nbsp;<var title="">day</var>&nbsp;&le;&nbsp;<var title="">maxday</var>, then fail.</li>
+
+ <li><p>Return <var title="">year</var>, <var title="">month</var>,
+ and <var title="">day</var>.</li>
+
+ </ol></div>
+
+
+ <h5 id=times><span class=secno>2.4.5.3 </span>Times</h5>
+
+ <p>A <dfn id=concept-time title=concept-time>time</dfn> consists of a specific
+ time with no time-zone information, consisting of an hour, a minute,
+ a second, and a fraction of a second.</p>
+
+ <p>A string is a <dfn id=valid-time-string>valid time string</dfn> representing an hour
+ <var title="">hour</var>, a minute <var title="">minute</var>, and a
+ second <var title="">second</var> if it consists of the following
+ components in the given order:</p>
+
+ <ol><li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing <var title="">hour</var>, in the range
+ 0&nbsp;&le;&nbsp;<var title="">hour</var>&nbsp;&le;&nbsp;23</li>
+
+ <li>A U+003A COLON character (:)</li>
+
+ <li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing <var title="">minute</var>, in the range
+ 0&nbsp;&le;&nbsp;<var title="">minute</var>&nbsp;&le;&nbsp;59</li>
+
+ <li>Optionally (required if <var title="">second</var> is
+ non-zero):
+
+ <ol><li>A U+003A COLON character (:)</li>
+
+ <li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing the integer part of <var title="">second</var>, in
+ the range 0&nbsp;&le;&nbsp;<var title="">s</var>&nbsp;&le;&nbsp;59</li>
+
+ <li>Optionally (required if <var title="">second</var> is not an
+ integer):
+
+ <ol><li>A 002E FULL STOP character (.)</li>
+
+ <li>One or more <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>, representing the
+ fractional part of <var title="">second</var></li>
+
+ </ol></li>
+
+ </ol></li>
+
+ </ol><p class=note>The <var title="">second</var> component cannot be
+ 60 or 61; leap seconds cannot be represented.</p>
+
+ <div class=impl>
+
+ <p>The rules to <dfn id=parse-a-time-string>parse a time string</dfn> are as follows. This
+ will return either a time, or nothing. If at any point the algorithm
+ says that it "fails", this means that it is aborted at that point
+ and returns nothing.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#parse-a-time-component>Parse a time component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</li>
+
+ <li><p>Let <var title="">time</var> be the time with hour <var title="">hour</var>, minute <var title="">minute</var>, and second
+ <var title="">second</var>.</li>
+
+ <li><p>Return <var title="">time</var>.</li>
+
+ </ol><p>The rules to <dfn id=parse-a-time-component>parse a time component</dfn>, given an <var title="">input</var> string and a <var title="">position</var>, are
+ as follows. This will return either an hour, a minute, and a second,
+ or nothing. If at any point the algorithm says that it "fails", this
+ means that it is aborted at that point and returns nothing.</p>
+
+ <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then fail. Otherwise,
+ interpret the resulting sequence as a base-ten integer. Let that
+ number be the <var title="">hour</var>.</li>
+
+ <li>If <var title="">hour</var> is not a number in the range
+ 0&nbsp;&le;&nbsp;<var title="">hour</var>&nbsp;&le;&nbsp;23, then
+ fail.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+003A COLON character, then
+ fail. Otherwise, move <var title="">position</var> forwards one
+ character.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then fail. Otherwise,
+ interpret the resulting sequence as a base-ten integer. Let that
+ number be the <var title="">minute</var>.</li>
+
+ <li>If <var title="">minute</var> is not a number in the range
+ 0&nbsp;&le;&nbsp;<var title="">minute</var>&nbsp;&le;&nbsp;59, then
+ fail.</li>
+
+ <li><p>Let <var title="">second</var> be a string with the value
+ "0".</li>
+
+ <li>
+
+ <p>If <var title="">position</var> is not beyond the end of
+ <var title="">input</var> and the character at <var title="">position</var> is a U+003A COLON, then run these
+ substeps:</p>
+
+ <ol><li><p>Advance <var title="">position</var> to the next character
+ in <var title="">input</var>.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var>, or at the last character in <var title="">input</var>, or if the next <em>two</em> characters in
+ <var title="">input</var> starting at <var title="">position</var> are not two characters both in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
+ fail.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
+ either characters in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9) or U+002E FULL STOP characters. If the collected
+ sequence has more than one U+002E FULL STOP characters, or if the
+ last character in the sequence is a U+002E FULL STOP character,
+ then fail. Otherwise, let the collected string be <var title="">second</var> instead of its previous value.</li>
+
+ </ol></li>
+
+ <li><p>Interpret <var title="">second</var> as a base-ten number
+ (possibly with a fractional part). Let <var title="">second</var>
+ be that number instead of the string version.</li>
+
+ <li><p>If <var title="">second</var> is not a number in the range
+ 0&nbsp;&le;&nbsp;<var title="">second</var>&nbsp;&lt;&nbsp;60, then
+ fail.</li>
+
+ <li><p>Return <var title="">hour</var>, <var title="">minute</var>,
+ and <var title="">second</var>.</li>
+
+ </ol></div>
+
+
+ <h5 id=local-dates-and-times><span class=secno>2.4.5.4 </span>Local dates and times</h5>
+
+ <p>A <dfn id=concept-datetime-local title=concept-datetime-local>local date and time</dfn>
+ consists of a specific proleptic Gregorian date, consisting of a
+ year, a month, and a day, and a time, consisting of an hour, a
+ minute, a second, and a fraction of a second, but expressed without
+ a time zone. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn id=valid-local-date-and-time-string>valid local date and time string</dfn>
+ representing a date and time if it consists of the following
+ components in the given order:</p>
+
+ <ol><li>A <a href=#valid-date-string>valid date string</a> representing the date.</li>
+
+ <li>A U+0054 LATIN CAPITAL LETTER T character (T).</li>
+
+ <li>A <a href=#valid-time-string>valid time string</a> representing the time.</li>
+
+ </ol><div class=impl>
+
+ <p>The rules to <dfn id=parse-a-local-date-and-time-string>parse a local date and time string</dfn> are as
+ follows. This will return either a date and time, or nothing. If at
+ any point the algorithm says that it "fails", this means that it is
+ aborted at that point and returns nothing.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+0054 LATIN CAPITAL LETTER T
+ character (T) then fail. Otherwise, move <var title="">position</var> forwards one character.</li>
+
+ <li><p><a href=#parse-a-time-component>Parse a time component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</li>
+
+ <li><p>Let <var title="">date</var> be the date with year <var title="">year</var>, month <var title="">month</var>, and day <var title="">day</var>.</li>
+
+ <li><p>Let <var title="">time</var> be the time with hour <var title="">hour</var>, minute <var title="">minute</var>, and second
+ <var title="">second</var>.</li>
+
+ <li><p>Return <var title="">date</var> and <var title="">time</var>.</li>
+
+ </ol></div>
+
+
+
+ <h5 id=global-dates-and-times><span class=secno>2.4.5.5 </span>Global dates and times</h5>
+
+ <p>A <dfn id=concept-datetime title=concept-datetime>global date and time</dfn>
+ consists of a specific proleptic Gregorian date, consisting of a
+ year, a month, and a day, and a time, consisting of an hour, a
+ minute, a second, and a fraction of a second, expressed with a
+ time-zone offset, consisting of a signed number of hours and
+ minutes. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn id=valid-global-date-and-time-string>valid global date and time string</dfn>
+ representing a date, time, and a time-zone offset if it consists of
+ the following components in the given order:</p>
+
+ <ol><li>A <a href=#valid-date-string>valid date string</a> representing the date</li>
+
+ <li>A U+0054 LATIN CAPITAL LETTER T character (T)</li>
+
+ <li>A <a href=#valid-time-string>valid time string</a> representing the time</li>
+
+ <li>Either:
+
+ <ul><li>A U+005A LATIN CAPITAL LETTER Z character (Z), allowed only
+ if the time zone is UTC</li>
+
+ <li>Or:
+
+ <ol><li>Either a U+002B PLUS SIGN character (+) or a U+002D
+ HYPHEN-MINUS character (-), representing the sign of the
+ time-zone offset</li>
+
+ <li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing the hours component <var title="">hour</var> of
+ the time-zone offset, in the range 0&nbsp;&le;&nbsp;<var title="">hour</var>&nbsp;&le;&nbsp;23</li>
+
+ <li>A U+003A COLON character (:)</li>
+
+ <li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing the minutes component <var title="">minute</var>
+ of the time-zone offset, in the range 0&nbsp;&le;&nbsp;<var title="">minute</var>&nbsp;&le;&nbsp;59</li>
+
+ </ol></li>
+
+ </ul></li>
+
+ </ol><p class=note>This format allows for time-zone offsets from -23:59
+ to +23:59. In practice, however, the range of offsets of actual time
+ zones is -12:00 to +14:00, and the minutes component of offsets of
+ actual time zones is always either 00, 30, or 45.</p>
+
+ <div class=example>
+
+ <p>The following are some examples of dates written as <a href=#valid-global-date-and-time-string title="valid global date and time string">valid global date and
+ time strings</a>.</p>
+
+ <dl><dt>"<code>0037-12-13T00:00Z</code>"</dt>
+
+ <dd>Midnight UTC on the birthday of Nero (the Roman Emperor). See
+ below for further discussion on which date this actually
+ corresponds to.</dd>
+
+ <dt>"<code>1979-10-14T12:00:00.001-04:00</code>"</dt>
+
+ <dd>One millisecond after noon on October 14th 1979, in the time
+ zone in use on the east coast of the USA during daylight saving
+ time.</dd>
+
+ <dt>"<code>8592-01-01T02:09+02:09</code>"</dt>
+
+ <dd>Midnight UTC on the 1st of January, 8592. The time zone
+ associated with that time is two hours and nine minutes ahead of
+ UTC, which is not currently a real time zone, but is nonetheless
+ allowed.</dd>
+
+ </dl><p>Several things are notable about these dates:</p>
+
+ <ul><li>Years with fewer than four digits have to be
+ zero-padded. The date "37-12-13" would not be a valid date.</li>
+
+ <li>To unambiguously identify a moment in time prior to the
+ introduction of the Gregorian calendar, the date has to be first
+ converted to the Gregorian calendar from the calendar in use at
+ the time (e.g. from the Julian calendar). The date of Nero's birth
+ is the 15th of December 37, in the Julian Calendar, which is the
+ 13th of December 37 in the proleptic Gregorian Calendar.</li> <!--
+ This might not be true. I can't find a reference that gives his
+ birthday with an explicit statement about the calendar being
+ used. However, it seems unlikely that it would be given in the
+ Gregorian calendar, so I assume sites use the Julian one. -->
+
+ <li>The time and time-zone offset components are not optional.</li>
+
+ <li>Dates before the year one can't be represented as a datetime
+ in this version of HTML.</li>
+
+ <li>Time-zone offsets differ based on daylight savings time.</li>
+
+ </ul></div>
+
+ <div class=impl>
+
+ <p>The <dfn id=best-representation-of-the-global-date-and-time-string>best representation of the global date and time
+ string</dfn> <var title="">datetime</var> is the <a href=#valid-global-date-and-time-string>valid global
+ date and time string</a> representing <var title="">datetime</var> with the last character of the string not
+ being a U+005A LATIN CAPITAL LETTER Z character (Z), even if the
+ time zone is UTC, and with a U+002D HYPHEN-MINUS character (-)
+ representing the sign of the time-zone offset when the time zone is
+ UTC.</p>
+
+ <p>The rules to <dfn id=parse-a-global-date-and-time-string>parse a global date and time string</dfn> are
+ as follows. This will return either a time in UTC, with associated
+ time-zone offset information for round tripping or display purposes,
+ or nothing. If at any point the algorithm says that it "fails", this
+ means that it is aborted at that point and returns nothing.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+0054 LATIN CAPITAL LETTER T
+ character (T) then fail. Otherwise, move <var title="">position</var> forwards one character.</li>
+
+ <li><p><a href=#parse-a-time-component>Parse a time component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var>, then fail.</li>
+
+ <li><p><a href=#parse-a-time-zone-offset-component>Parse a time-zone offset component</a> to obtain
+ <var title="">timezone<sub title="">hours</sub></var> and <var title="">timezone<sub title="">minutes</sub></var>. If this returns
+ nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</li>
+
+ <li><p>Let <var title="">time</var> be the moment in time at year
+ <var title="">year</var>, month <var title="">month</var>, day <var title="">day</var>, hours <var title="">hour</var>, minute <var title="">minute</var>, second <var title="">second</var>,
+ subtracting <var title="">timezone<sub title="">hours</sub></var>
+ hours and <var title="">timezone<sub title="">minutes</sub></var>
+ minutes. That moment in time is a moment in the UTC
+ time zone.</li>
+
+ <li><p>Let <var title="">timezone</var> be <var title="">timezone<sub title="">hours</sub></var> hours and <var title="">timezone<sub title="">minutes</sub></var> minutes from
+ UTC.</li>
+
+ <li><p>Return <var title="">time</var> and <var title="">timezone</var>.</li>
+
+ </ol><p>The rules to <dfn id=parse-a-time-zone-offset-component>parse a time-zone offset component</dfn>, given
+ an <var title="">input</var> string and a <var title="">position</var>, are as follows. This will return either
+ time-zone hours and time-zone minutes, or nothing. If at any point
+ the algorithm says that it "fails", this means that it is aborted at
+ that point and returns nothing.</p>
+
+ <ol><li>
+
+ <p>If the character at <var title="">position</var> is a U+005A
+ LATIN CAPITAL LETTER Z character (Z), then:</p>
+
+ <ol><li><p>Let <var title="">timezone<sub title="">hours</sub></var>
+ be 0.</li>
+
+ <li><p>Let <var title="">timezone<sub title="">minutes</sub></var> be 0.</li>
+
+ <li><p>Advance <var title="">position</var> to the next character
+ in <var title="">input</var>.</li>
+
+ </ol><p>Otherwise, if the character at <var title="">position</var> is
+ either a U+002B PLUS SIGN (+) or a U+002D HYPHEN-MINUS (-),
+ then:</p>
+
+ <ol><li><p>If the character at <var title="">position</var> is a
+ U+002B PLUS SIGN (+), let <var title="">sign</var> be
+ "positive". Otherwise, it's a U+002D HYPHEN-MINUS (-); let <var title="">sign</var> be "negative".</li>
+
+ <li><p>Advance <var title="">position</var> to the next character
+ in <var title="">input</var>.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then
+ fail. Otherwise, interpret the resulting sequence as a base-ten
+ integer. Let that number be the <var title="">timezone<sub title="">hours</sub></var>.</li>
+
+ <li>If <var title="">timezone<sub title="">hours</sub></var> is
+ not a number in the range 0&nbsp;&le;&nbsp;<var title="">timezone<sub title="">hours</sub></var>&nbsp;&le;&nbsp;23, then fail.</li>
+
+ <li>If <var title="">sign</var> is "negative", then negate <var title="">timezone<sub title="">hours</sub></var>.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+003A COLON character, then
+ fail. Otherwise, move <var title="">position</var> forwards one
+ character.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then
+ fail. Otherwise, interpret the resulting sequence as a base-ten
+ integer. Let that number be the <var title="">timezone<sub title="">minutes</sub></var>.</li>
+
+ <li>If <var title="">timezone<sub title="">minutes</sub></var> is
+ not a number in the range 0&nbsp;&le;&nbsp;<var title="">timezone<sub title="">minutes</sub></var>&nbsp;&le;&nbsp;59, then fail.</li>
+
+ <li>If <var title="">sign</var> is "negative", then negate <var title="">timezone<sub title="">minutes</sub></var>.</li>
+
+ </ol><p>Otherwise, fail.</p>
+
+ </li>
+
+ <li><p>Return <var title="">timezone<sub title="">hours</sub></var>
+ and <var title="">timezone<sub title="">minutes</sub></var>.</li>
+
+ </ol></div>
+
+
+ <h5 id=weeks><span class=secno>2.4.5.6 </span>Weeks</h5>
+
+ <p>A <dfn id=concept-week title=concept-week>week</dfn> consists of a week-year
+ number and a week number representing a seven-day period starting on
+ a Monday. Each week-year in this calendaring system has either 52 or
+ 53 such seven-day periods, as defined below. The seven-day period
+ starting on the Gregorian date Monday December 29th 1969
+ (1969-12-29) is defined as week number 1 in week-year
+ 1970. Consecutive weeks are numbered sequentially. The week before
+ the number 1 week in a week-year is the last week in the previous
+ week-year, and vice versa. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
+
+ <p>A week-year with a number <var title="">year</var> has 53 weeks
+ if it corresponds to either a year <var title="">year</var> in the
+ proleptic Gregorian calendar that has a Thursday as its first day
+ (January 1st), or a year <var title="">year</var> in the proleptic
+ Gregorian calendar that has a Wednesday as its first day (January
+ 1st) and where <var title="">year</var> is a number divisible by
+ 400, or a number divisible by 4 but not by 100. All other week-years
+ have 52 weeks.</p>
+
+ <p>The <dfn id=week-number-of-the-last-day>week number of the last day</dfn> of a week-year with 53
+ weeks is 53; the week number of the last day of a week-year with 52
+ weeks is 52.</p>
+
+ <p class=note>The week-year number of a particular day can be
+ different than the number of the year that contains that day in the
+ proleptic Gregorian calendar. The first week in a week-year <var title="">y</var> is the week that contains the first Thursday of
+ the Gregorian year <var title="">y</var>.</p>
+
+ <p>A string is a <dfn id=valid-week-string>valid week string</dfn> representing a
+ week-year <var title="">year</var> and week <var title="">week</var>
+ if it consists of the following components in the given order:</p>
+
+ <ol><li>Four or more <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>, representing <var title="">year</var>, where <var title="">year</var>&nbsp;&gt;&nbsp;0</li>
+
+ <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+ <li>A U+0057 LATIN CAPITAL LETTER W character (W)</li>
+
+ <li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
+ representing the week <var title="">week</var>, in the range
+ 1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var title="">maxweek</var>, where <var title="">maxweek</var> is the
+ <a href=#week-number-of-the-last-day>week number of the last day</a> of week-year <var title="">year</var></li>
+
+ </ol><div class=impl>
+
+ <p>The rules to <dfn id=parse-a-week-string>parse a week string</dfn> are as follows. This
+ will return either a week-year number and week number, or
+ nothing. If at any point the algorithm says that it "fails", this
+ means that it is aborted at that point and returns nothing.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not at least four characters long, then
+ fail. Otherwise, interpret the resulting sequence as a base-ten
+ integer. Let that number be the <var title="">year</var>.</li>
+
+ <li><p>If <var title="">year</var> is not a number greater than
+ zero, then fail.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character,
+ then fail. Otherwise, move <var title="">position</var> forwards
+ one character.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+0057 LATIN CAPITAL LETTER W
+ character (W), then fail. Otherwise, move <var title="">position</var> forwards one character.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then fail. Otherwise,
+ interpret the resulting sequence as a base-ten integer. Let that
+ number be the <var title="">week</var>.</li>
+
+ <li><p>Let <var title="">maxweek</var> be the <a href=#week-number-of-the-last-day>week number of
+ the last day</a> of year <var title="">year</var>.</li>
+
+ <li><p>If <var title="">week</var> is not a number in the range
+ 1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var title="">maxweek</var>, then fail.</li>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</li>
+
+ <li><p>Return the week-year number <var title="">year</var> and the
+ week number <var title="">week</var>.</li>
+
+ </ol></div>
+
+
+ <h5 id=vaguer-moments-in-time><span class=secno>2.4.5.7 </span>Vaguer moments in time</h5>
+
+ <p>A string is a <dfn id=valid-date-or-time-string>valid date or time string</dfn> if it is also
+ one of the following:</p>
+
+ <ul><li>A <a href=#valid-date-string>valid date string</a>.</li>
+
+ <li>A <a href=#valid-time-string>valid time string</a>.</li>
+
+ <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</li>
+
+ </ul><p>A string is a <dfn id=valid-date-or-time-string-in-content>valid date or time string in content</dfn> if
+ it consists of zero or more <a href=#white_space>White_Space</a> characters,
+ followed by a <a href=#valid-date-or-time-string>valid date or time string</a>, followed by
+ zero or more further <a href=#white_space>White_Space</a> characters.</p>
+
+ <hr><p>A string is a <dfn id=valid-date-string-with-optional-time>valid date string with optional time</dfn> if
+ it is also one of the following:</p>
+
+ <ul><li>A <a href=#valid-date-string>valid date string</a>.</li>
+
+ <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</li>
+
+ </ul><p>A string is a <dfn id=valid-date-string-in-content-with-optional-time>valid date string in content with optional
+ time</dfn> if it consists of zero or more <a href=#white_space>White_Space</a>
+ characters, followed by a <a href=#valid-date-string-with-optional-time>valid date string with optional
+ time</a>, followed by zero or more further
+ <a href=#white_space>White_Space</a> characters.</p>
+
+ <div class=impl>
+
+ <hr><p>The rules to <dfn id=parse-a-date-or-time-string>parse a date or time string</dfn> are as
+ follows. The algorithm is invoked with a flag indicating if the
+ <i>in attribute</i> variant or the <i>in content</i> variant is to
+ be used. The algorithm will return either a <a href=#concept-date title=concept-date>date</a>, a <a href=#concept-time title=concept-time>time</a>, a <a href=#concept-datetime title=concept-datetime>global date and time</a>, or nothing. If
+ at any point the algorithm says that it "fails", this means that it
+ is aborted at that point and returns nothing.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>For the <i>in content</i> variant: <a href=#skip-white_space-characters>skip White_Space
+ characters</a>.</li>
+
+ <li><p>Set <var title="">start position</var> to the same position
+ as <var title="">position</var>.</li>
+
+ <li><p>Set the <var title="">date present</var> and <var title="">time present</var> flags to true.</li>
+
+ <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this fails, then set the <var title="">date
+ present</var> flag to false.</p>
+
+ <li>
+
+ <p>If <var title="">date present</var> is true, and <var title="">position</var> is not beyond the end of <var title="">input</var>, and the character at <var title="">position</var> is a U+0054 LATIN CAPITAL LETTER T
+ character (T), then advance <var title="">position</var> to the
+ next character in <var title="">input</var>.</p>
+
+ <p>Otherwise, if <var title="">date present</var> is true, and
+ either <var title="">position</var> is beyond the end of <var title="">input</var> or the character at <var title="">position</var> is not a U+0054 LATIN CAPITAL LETTER T
+ character (T), then set <var title="">time present</var> to
+ false.</p>
+
+ <p>Otherwise, if <var title="">date present</var> is false, set
+ <var title="">position</var> back to the same position as <var title="">start position</var>.</p>
+
+ </li>
+
+ <li><p>If the <var title="">time present</var> flag is true, then
+ <a href=#parse-a-time-component>parse a time component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</li>
+
+ <li><p>If the <var title="">date present</var> and <var title="">time present</var> flags are both true, but <var title="">position</var> is beyond the end of <var title="">input</var>, then fail.</li>
+
+ <li><p>If the <var title="">date present</var> and <var title="">time present</var> flags are both true, <a href=#parse-a-time-zone-offset-component>parse a
+ time-zone offset component</a> to obtain <var title="">timezone<sub title="">hours</sub></var> and <var title="">timezone<sub title="">minutes</sub></var>. If this returns
+ nothing, then fail.</p>
+
+ <li><p>For the <i>in content</i> variant: <a href=#skip-white_space-characters>skip White_Space
+ characters</a>.</li>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</li>
+
+ <li>
+
+ <p>If the <var title="">date present</var> flag is true and the
+ <var title="">time present</var> flag is false, then let <var title="">date</var> be the date with year <var title="">year</var>, month <var title="">month</var>, and day <var title="">day</var>, and return <var title="">date</var>.</p>
+
+ <p>Otherwise, if the <var title="">time present</var> flag is true
+ and the <var title="">date present</var> flag is false, then let
+ <var title="">time</var> be the time with hour <var title="">hour</var>, minute <var title="">minute</var>, and second
+ <var title="">second</var>, and return <var title="">time</var>.</p>
+
+ <p>Otherwise, let <var title="">time</var> be the moment in time
+ at year <var title="">year</var>, month <var title="">month</var>,
+ day <var title="">day</var>, hours <var title="">hour</var>,
+ minute <var title="">minute</var>, second <var title="">second</var>, subtracting <var title="">timezone<sub title="">hours</sub></var> hours and <var title="">timezone<sub title="">minutes</sub></var> minutes, that moment in time being a
+ moment in the UTC time zone; let <var title="">timezone</var> be
+ <var title="">timezone<sub title="">hours</sub></var> hours and
+ <var title="">timezone<sub title="">minutes</sub></var> minutes
+ from UTC; and return <var title="">time</var> and <var title="">timezone</var>.</p>
+
+ </li>
+
+ </ol></div>
+
+
+ <h4 id=colors><span class=secno>2.4.6 </span>Colors</h4>
+
+ <p>A <dfn id=simple-color>simple color</dfn> consists of three 8-bit numbers in the
+ range 0..255, representing the red, green, and blue components of
+ the color respectively, in the sRGB color space. <a href=#refsSRGB>[SRGB]</a></p>
+
+ <p>A string is a <dfn id=valid-simple-color>valid simple color</dfn> if it is exactly
+ seven characters long, and the first character is a U+0023 NUMBER
+ SIGN character (#), and the remaining six characters are all in the
+ range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0041 LATIN
+ CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, U+0061 LATIN
+ SMALL LETTER A to U+0066 LATIN SMALL LETTER F, with the first two
+ digits representing the red component, the middle two digits
+ representing the green component, and the last two digits
+ representing the blue component, in hexadecimal.</p>
+
+ <p>A string is a <dfn id=valid-lowercase-simple-color>valid lowercase simple color</dfn> if it is a
+ <a href=#valid-simple-color>valid simple color</a> and doesn't use any characters in
+ the range U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL
+ LETTER F.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=rules-for-parsing-simple-color-values>rules for parsing simple color values</dfn> are as given
+ in the following algorithm. When invoked, the steps must be followed
+ in the order given, aborting at the first step that returns a
+ value. This algorithm will return either a <a href=#simple-color>simple color</a>
+ or an error.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>If <var title="">input</var> is not exactly seven characters
+ long, then return an error.</li>
+
+ <li><p>If the first character in <var title="">input</var> is not a
+ U+0023 NUMBER SIGN character (#), then return an error.</li>
+
+ <li><p>If the last six characters of <var title="">input</var> are
+ not all in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE
+ (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER
+ F, U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F, then
+ return an error.</li>
+
+ <li><p>Let <var title="">result</var> be a <a href=#simple-color>simple
+ color</a>.</p>
+
+ <li><p>Interpret the second and third characters as a hexadecimal
+ number and let the result be the red component of <var title="">result</var>.</p>
+
+ <li><p>Interpret the fourth and fifth characters as a hexadecimal
+ number and let the result be the green component of <var title="">result</var>.</p>
+
+ <li><p>Interpret the sixth and seventh characters as a hexadecimal
+ number and let the result be the blue component of <var title="">result</var>.</p>
+
+ <li><p>Return <var title="">result</var>.</p>
+
+ </ol><p>The <dfn id=rules-for-serializing-simple-color-values>rules for serializing simple color values</dfn> given a
+ <a href=#simple-color>simple color</a> are as given in the following
+ algorithm:</p>
+
+ <ol><li><p>Let <var title="">result</var> be a string consisting of a
+ single U+0023 NUMBER SIGN character (#).</li>
+
+ <li><p>Convert the red, green, and blue components in turn to
+ two-digit hexadecimal numbers using the digits U+0030 DIGIT ZERO
+ (0) to U+0039 DIGIT NINE (9) and U+0061 LATIN SMALL LETTER A
+ to U+0066 LATIN SMALL LETTER F, zero-padding if necessary, and
+ append these numbers to <var title="">result</var>, in the order
+ red, green, blue.</p>
+
+ <li><p>Return <var title="">result</var>, which will be a
+ <a href=#valid-lowercase-simple-color>valid lowercase simple color</a>.</li>
+
+ </ol><hr><p>Some obsolete legacy attributes parse colors in a more
+ complicated manner, using the <dfn id=rules-for-parsing-a-legacy-color-value>rules for parsing a legacy color
+ value</dfn>, which are given in the following algorithm. When
+ invoked, the steps must be followed in the order given, aborting at
+ the first step that returns a value. This algorithm will return
+ either a <a href=#simple-color>simple color</a> or an error.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>If <var title="">input</var> is the empty string, then
+ return an error.</li>
+
+ <li><p>If <var title="">input</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">transparent</code>", then return an error.</li>
+
+ <li><p>If <var title="">input</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for one of the keywords listed in the
+ <a href=http://www.w3.org/TR/css3-color/#svg-color>SVG color
+ keywords</a> or <a href=http://www.w3.org/TR/css3-color/#css2-system>CSS2 System
+ Colors</a> sections of the CSS3 Color specification, then return
+ the <a href=#simple-color>simple color</a> corresponding to that keyword. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></li>
+
+ <li>
+
+ <p>If <var title="">input</var> is four characters long, and the
+ first character in <var title="">input</var> is a U+0023 NUMBER
+ SIGN character (#), and the last three characters of <var title="">input</var> are all in the range U+0030 DIGIT ZERO (0)
+ to U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046
+ LATIN CAPITAL LETTER F, and U+0061 LATIN SMALL LETTER A to U+0066
+ LATIN SMALL LETTER F, then run these substeps:</p>
+
+ <ol><li><p>Let <var title="">result</var> be a <a href=#simple-color>simple
+ color</a>.</p>
+
+ <li><p>Interpret the second character of <var title="">input</var> as a hexadecimal digit; let the red
+ component of <var title="">result</var> be the resulting number
+ multiplied by 17.</p>
+
+ <li><p>Interpret the third character of <var title="">input</var>
+ as a hexadecimal digit; let the green component of <var title="">result</var> be the resulting number multiplied by
+ 17.</p>
+
+ <li><p>Interpret the fourth character of <var title="">input</var> as a hexadecimal digit; let the blue
+ component of <var title="">result</var> be the resulting number
+ multiplied by 17.</p>
+
+ <li><p>Return <var title="">result</var>.</p>
+
+ </ol></li>
+
+ <li><p>Replace any characters in <var title="">input</var> that
+ have a Unicode code point greater than U+FFFF (i.e. any characters
+ that are not in the basic multilingual plane) with the
+ two-character string "<code title="">00</code>".</li>
+
+ <li><p>If <var title="">input</var> is longer than 128 characters,
+ truncate <var title="">input</var>, leaving only the first 128
+ characters.</li>
+
+ <li><p>If the first character in <var title="">input</var> is a
+ U+0023 NUMBER SIGN character (#), remove it.</li>
+
+ <li><p>Replace any character in <var title="">input</var> that is
+ not in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9),
+ U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, and
+ U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F with the
+ character U+0030 DIGIT ZERO (0).</li>
+
+ <li><p>While <var title="">input</var>'s length is zero or not a
+ multiple of three, append a U+0030 DIGIT ZERO (0) character to <var title="">input</var>.</li>
+
+ <li><p>Split <var title="">input</var> into three strings of equal
+ length, to obtain three components. Let <var title="">length</var>
+ be the length of those components (one third the length of <var title="">input</var>).</li>
+
+ <li><p>If <var title="">length</var> is greater than 8, then remove
+ the leading <span title=""><var title="">length</var>-8</span>
+ characters in each component, and let <var title="">length</var> be
+ 8.</li>
+
+ <li><p>While <var title="">length</var> is greater than two and the
+ first character in each component is a U+0030 DIGIT ZERO (0)
+ character, remove that character and reduce <var title="">length</var> by one.</li>
+
+ <li><p>If <var title="">length</var> is <em>still</em> greater than
+ two, truncate each component, leaving only the first two
+ characters in each.</li>
+
+ <li><p>Let <var title="">result</var> be a <a href=#simple-color>simple
+ color</a>.</p>
+
+ <li><p>Interpret the first component as a hexadecimal number; let
+ the red component of <var title="">result</var> be the resulting
+ number.</li>
+
+ <li><p>Interpret the second component as a hexadecimal number; let
+ the green component of <var title="">result</var> be the resulting
+ number.</li>
+
+ <li><p>Interpret the third component as a hexadecimal number; let
+ the blue component of <var title="">result</var> be the resulting
+ number.</li>
+
+ <li><p>Return <var title="">result</var>.</p>
+
+ </ol></div>
+
+ <hr><p class=note>The <a href=#canvas-context-2d title=canvas-context-2d>2D graphics
+ context</a> has a separate color syntax that also handles
+ opacity.</p>
+
+
+
+
+ <h4 id=space-separated-tokens><span class=secno>2.4.7 </span>Space-separated tokens</h4>
+
+ <p>A <dfn id=set-of-space-separated-tokens>set of space-separated tokens</dfn> is a string containing
+ zero or more words separated by one or more <a href=#space-character title="space
+ character">space characters</a>, where words consist of any
+ string of one or more characters, none of which are <a href=#space-character title="space character">space characters</a>.</p>
+
+ <p>A string containing a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a>
+ may have leading or trailing <a href=#space-character title="space character">space
+ characters</a>.</p>
+
+ <p>An <dfn id=unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</dfn> is a
+ <a href=#set-of-space-separated-tokens>set of space-separated tokens</a> where none of the words
+ are duplicated.</p>
+
+ <p>An <dfn id=ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</dfn> is a
+ <a href=#set-of-space-separated-tokens>set of space-separated tokens</a> where none of the words
+ are duplicated but where the order of the tokens is meaningful.</p>
+
+ <p><a href=#set-of-space-separated-tokens title="set of space-separated tokens">Sets of
+ space-separated tokens</a> sometimes have a defined set of
+ allowed values. When a set of allowed values is defined, the tokens
+ must all be from that list of allowed values; other values are
+ non-conforming. If no such set of allowed values is provided, then
+ all values are conforming.</p>
+
+ <div class=impl>
+
+ <p>When a user agent has to <dfn id=split-a-string-on-spaces>split a string on spaces</dfn>, it
+ must use the following algorithm:</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>Let <var title="">tokens</var> be a list of tokens,
+ initially empty.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a></li>
+
+ <li><p>While <var title="">position</var> is not past the end of
+ <var title="">input</var>:</p>
+
+ <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li><p>Add the string collected in the previous step to <var title="">tokens</var>.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a></li>
+
+ </ol></li>
+
+ <li><p>Return <var title="">tokens</var>.</li>
+
+ </ol><p>When a user agent has to <dfn id=remove-a-token-from-a-string>remove a token from a string</dfn>,
+ it must use the following algorithm:</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ modified.</li>
+
+ <li><p>Let <var title="">token</var> be the token being removed. It
+ will not contain any <a href=#space-character title="space character">space
+ characters</a>.</li>
+
+ <li><p>Let <var title="">output</var> be the output string,
+ initially empty.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><i>Loop</i>: If <var title="">position</var> is beyond the
+ end of <var title="">input</var>, abort these steps.</li>
+
+ <li><p>If the character at <var title="">position</var> is a
+ <a href=#space-character>space character</a>:</p>
+
+ <ol><li><p>Append the character at <var title="">position</var> to
+ the end of <var title="">output</var>.</li>
+
+ <li><p>Advance <var title="">position</var> so it points at the
+ next character in <var title="">input</var>.</li>
+
+ <li><p>Return to the step labeled <i>loop</i>.</li>
+
+ </ol></li>
+
+ <li><p>Otherwise, the character at <var title="">position</var> is
+ the first character of a token. <a href=#collect-a-sequence-of-characters>Collect a sequence of
+ characters</a> that are not <a href=#space-character title="space character">space
+ characters</a>, and let that be <var title="">s</var>.</li>
+
+ <li><p>If <var title="">s</var> is exactly equal to <var title="">token</var>, then:</p>
+
+ <ol><li><p><a href=#skip-whitespace>Skip whitespace</a> (in <var title="">input</var>).</li>
+
+ <li><p>Remove any <a href=#space-character title="space character">space
+ characters</a> currently at the end of <var title="">output</var>.</li>
+
+ <li><p>If <var title="">position</var> is not past the end of
+ <var title="">input</var>, and <var title="">output</var> is not
+ the empty string, append a single U+0020 SPACE character at the
+ end of <var title="">output</var>.</li>
+
+ </ol></li>
+
+ <li><p>Otherwise, append <var title="">s</var> to the end of <var title="">output</var>.</li>
+
+ <li><p>Return to the step labeled <i>loop</i>.</li>
+
+ </ol><p class=note>This causes any occurrences of the token to be
+ removed from the string, and any spaces that were surrounding the
+ token to be collapsed to a single space, except at the start and end
+ of the string, where such spaces are removed.</p>
+
+ </div>
+
+
+
+ <h4 id=comma-separated-tokens><span class=secno>2.4.8 </span>Comma-separated tokens</h4>
+
+ <p>A <dfn id=set-of-comma-separated-tokens>set of comma-separated tokens</dfn> is a string containing
+ zero or more tokens each separated from the next by a single U+002C
+ COMMA character (,), where tokens consist of any string of zero or
+ more characters, neither beginning nor ending with <a href=#space-character title="space character">space characters</a>, nor containing any
+ U+002C COMMA characters (,), and optionally surrounded by <a href=#space-character title="space character">space characters</a>.</p>
+
+ <p class=example>For instance, the string "<code title="">&nbsp;a&nbsp;,b,,d&nbsp;d&nbsp;</code>" consists of four
+ tokens: "a", "b", the empty string, and "d&nbsp;d". Leading and
+ trailing whitespace around each token doesn't count as part of the
+ token, and the empty string can be a token.</p>
+
+ <p><a href=#set-of-comma-separated-tokens title="set of comma-separated tokens">Sets of
+ comma-separated tokens</a> sometimes have further restrictions on
+ what consists a valid token. When such restrictions are defined, the
+ tokens must all fit within those restrictions; other values are
+ non-conforming. If no such restrictions are specified, then all
+ values are conforming.</p>
+
+ <div class=impl>
+
+ <p>When a user agent has to <dfn id=split-a-string-on-commas>split a string on commas</dfn>, it
+ must use the following algorithm:</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>Let <var title="">tokens</var> be a list of tokens,
+ initially empty.</li>
+
+ <li><p><i>Token</i>: If <var title="">position</var> is past the
+ end of <var title="">input</var>, jump to the last step.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not
+ U+002C COMMA characters (,). Let <var title="">s</var> be the resulting sequence (which might be the
+ empty string).</li>
+
+ <li><p>Remove any leading or trailing sequence of <a href=#space-character title="space character">space characters</a> from <var title="">s</var>.</li>
+
+ <li><p>Add <var title="">s</var> to <var title="">tokens</var>.</li>
+
+ <li><p>If <var title="">position</var> is not past the end of <var title="">input</var>, then the character at <var title="">position</var> is a U+002C COMMA character (,); advance
+ <var title="">position</var> past that character.</li>
+
+ <li><p>Jump back to the step labeled <i>token</i>.</li>
+
+ <li><p>Return <var title="">tokens</var>.</li>
+
+ </ol></div>
+
+
+
+
+ <h4 id=syntax-references><span class=secno>2.4.9 </span>References</h4>
+
+ <p>A <dfn id=valid-hash-name-reference>valid hash-name reference</dfn> to an element of type <var title="">type</var> is a string consisting of a U+0023 NUMBER SIGN
+ character (#) followed by a string which exactly matches the value
+ of the <code title="">name</code> attribute of an element with type
+ <var title="">type</var> in the document.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=rules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference</dfn> to an
+ element of type <var title="">type</var> are as follows:</p>
+
+ <ol><li><p>If the string being parsed does not contain a U+0023 NUMBER
+ SIGN character, or if the first such character in the string is the
+ last character in the string, then return null and abort these
+ steps.</li>
+
+ <li><p>Let <var title="">s</var> be the string from the character
+ immediately after the first U+0023 NUMBER SIGN character in the
+ string being parsed up to the end of that string.</li>
+
+ <li><p>Return the first element of type <var title="">type</var>
+ that has an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute whose value
+ is a <a href=#case-sensitive>case-sensitive</a> match for <var title="">s</var> or
+ a <code title="">name</code> attribute whose value is a
+ <a href=#compatibility-caseless>compatibility caseless</a> match for <var title="">s</var>.</li>
+
+ <!--
+ IE is also doing case-insensitive id="" matching.
+ Tests:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cmap%20name%3D%22T%26eacute%3B%26%23x01F1%3B%26%23x2075%3B%22%3E%3Carea%20href%3D%22%2F%22%20shape%3Drect%20coords%3D0%2C0%2C200%2C200%3E%3C%2Fmap%3E%0A%3Cimg%20usemap%3D%22%23t%26Eacute%3BDZ5%22%20src%3Dimage%3E
+ ...except that doesn't explain why this fails:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cmap%20name%3D%22T%26eacute%3B%26%23x01F1%3B%26%23x2075%3B%26%23xFB01%3B%22%3E%3Carea%20href%3D%22%2F%22%20shape%3Drect%20coords%3D0%2C0%2C200%2C200%3E%3C%2Fmap%3E%0A%3Cimg%20usemap%3D%22%23t%26Eacute%3BDZ5F%26%23x0131%3B%26%23x0307%3B%22%20src%3Dimage%3E
+ maybe they just don't know about combining dot above?
+ -->
+
+ </ol></div>
+
+
+ <h4 id=mq><span class=secno>2.4.10 </span>Media queries</h4>
+
+ <p>A string is a <dfn id=valid-media-query>valid media query</dfn> if it matches the
+ <code title="">media_query_list</code> production of the Media
+ Queries specification. <a href=#refsMQ>[MQ]</a></p>
+
+ <p>A string <dfn id=matches-the-environment>matches the environment</dfn> of the user if it is
+ the empty string, a string consisting of only <a href=#space-character title="space
+ character">space characters</a>, or is a media query that matches
+ the user's environment according to the definitions given in the
+ Media Queries specification. <a href=#refsMQ>[MQ]</a></p>
+
+
+
+
+ <h3 id=urls><span class=secno>2.5 </span>URLs</h3>
+
+ <h4 id=terminology-0><span class=secno>2.5.1 </span>Terminology</h4>
+
+ <!-- see also: svn diff -r3244:3245 source -->
+
+ <p>A <dfn id=url>URL</dfn> is a string used to identify a resource.</p>
+
+ <p>A <a href=#url>URL</a> is a <dfn id=valid-url>valid URL</dfn> if at least one of
+ the following conditions holds:</p>
+
+ <ul><li><p>The <a href=#url>URL</a> is a valid URI reference <a href=#refsRFC3986>[RFC3986]</a>.</li>
+
+ <li><p>The <a href=#url>URL</a> is a valid IRI reference and it has no
+ query component. <a href=#refsRFC3987>[RFC3987]</a></li>
+
+ <li><p>The <a href=#url>URL</a> is a valid IRI reference and its query
+ component contains no unescaped non-ASCII characters. <a href=#refsRFC3987>[RFC3987]</a></li>
+
+ <li><p>The <a href=#url>URL</a> is a valid IRI reference and the <a href="#document's-character-encoding" title="document's character encoding">character encoding</a> of
+ the URL's <code><a href=#document>Document</a></code> is UTF-8 or UTF-16. <a href=#refsRFC3987>[RFC3987]</a></li>
+
+ </ul><p>A string is a <dfn id=valid-non-empty-url>valid non-empty URL</dfn> if it is a
+ <a href=#valid-url>valid URL</a> but it is not the empty string.</p>
+
+ <p>A string is a <dfn id=valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by
+ spaces</dfn> if, after <a href=#strip-leading-and-trailing-whitespace title="strip leading and trailing
+ whitespace">stripping leading and trailing whitespace</a> from
+ it, it is a <a href=#valid-url>valid URL</a>.</p>
+
+ <p>A string is a <dfn id=valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</dfn> if, after <a href=#strip-leading-and-trailing-whitespace title="strip leading and trailing
+ whitespace">stripping leading and trailing whitespace</a> from
+ it, it is a <a href=#valid-non-empty-url>valid non-empty URL</a>.</p>
+
+ <div class=impl>
+
+ <p>To <dfn id=parse-a-url>parse a URL</dfn> <var title="">url</var> into its
+ component parts, the user agent must use the <span class=XXX>parse
+ an address</span> algorithm defined by the IRI specification. <a href=#refsRFC3987>[RFC3987]</a></p>
+
+ <p>Parsing a URL can fail. If it does not, then it results in the
+ following components, again as defined by the IRI specification:</p>
+
+ <ul class=brief><li><dfn id=url-scheme title=url-scheme>&lt;scheme&gt;</dfn></li>
+ <li><dfn id=url-host title=url-host>&lt;host&gt;</dfn></li>
+ <li><dfn id=url-port title=url-port>&lt;port&gt;</dfn></li>
+ <li><dfn id=url-hostport title=url-hostport>&lt;hostport&gt;</dfn></li>
+ <li><dfn id=url-path title=url-path>&lt;path&gt;</dfn></li>
+ <li><dfn id=url-query title=url-query>&lt;query&gt;</dfn></li>
+ <li><dfn id=url-fragment title=url-fragment>&lt;fragment&gt;</dfn></li>
+ <li><dfn id=url-host-specific title=url-host-specific>&lt;host-specific&gt;</dfn></li>
+ </ul><hr><p>To <dfn id=resolve-a-url>resolve a URL</dfn> to an <a href=#absolute-url>absolute URL</a>
+ relative to either another <a href=#absolute-url>absolute URL</a> or an element,
+ the user agent must use the following steps. Resolving a URL can
+ result in an error, in which case the URL is not resolvable.</p>
+
+ <ol><li><p>Let <var title="">url</var> be the <a href=#url>URL</a> being
+ resolved.</li>
+
+ <li>
+
+ <p>Let <var title="">encoding</var> be determined as follows:</p>
+
+ <dl class=switch><dt>If the URL had a character encoding defined when the URL was
+ created or defined</dt>
+
+ <dd>The URL character encoding is as defined.</dd>
+
+ <dt>If the URL came from a script (e.g. as an argument to a
+ method)</dt>
+
+ <dd>The URL character encoding is the <a href="#script's-url-character-encoding">script's URL character
+ encoding</a>.</dd>
+
+ <dt>If the URL came from a DOM node (e.g. from an element)</dt>
+
+ <dd>The node has a <code><a href=#document>Document</a></code>, and the URL character
+ encoding is the <a href="#document's-character-encoding">document's character encoding</a>.</dd>
+
+ </dl></li>
+
+ <li><p>If <var title="">encoding</var> is a UTF-16 encoding, then
+ change the value of <var title="">encoding</var> to UTF-8.</li>
+
+ <li>
+
+ <p>If the algorithm was invoked with an <a href=#absolute-url>absolute URL</a>
+ to use as the base URL, let <var title="">base</var> be that
+ <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Otherwise, let <var title="">base</var> be the <i>base URI of
+ the element</i>, as defined by the XML Base specification, with
+ <i>the base URI of the document entity</i> being defined as the
+ <a href=#document-base-url>document base URL</a> of the <code><a href=#document>Document</a></code> that
+ owns the element. <a href=#refsXMLBASE>[XMLBASE]</a></p>
+
+ <p>For the purposes of the XML Base specification, user agents
+ must act as if all <code><a href=#document>Document</a></code> objects represented XML
+ documents.</p>
+
+ <p class=note>It is possible for <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes to be present
+ even in HTML fragments, as such attributes can be added
+ dynamically using script. (Such scripts would not be conforming,
+ however, as <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes
+ are not allowed in <a href=#html-documents>HTML documents</a>.)</p>
+
+ <p>The <dfn id=document-base-url>document base URL</dfn> of a <code><a href=#document>Document</a></code>
+ object is the <a href=#absolute-url>absolute URL</a> obtained by running these
+ substeps:</p>
+
+ <ol><li><p>Let <var title="">fallback base url</var> be <a href="#the-document's-address">the
+ document's address</a>.</li>
+
+ <li>
+
+ <!-- http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/ -->
+
+ <!-- this should be tested in the case of a browsing context that
+ was navigated to about:blank after having been elsewhere, as
+ opposed to the about:blank used at the time of the browsing
+ context's creation. -->
+
+ <p>If <var title="">fallback base url</var> is
+ <code><a href=#about:blank>about:blank</a></code>, and the <code><a href=#document>Document</a></code>'s
+ <a href=#browsing-context>browsing context</a> has a <a href=#creator-browsing-context>creator browsing
+ context</a>, then let <var title="">fallback base url</var>
+ be the <a href=#document-base-url>document base URL</a> of the <a href=#creator-document>creator
+ <code>Document</code></a> instead.</p>
+
+ </li>
+
+ <li><p>If there is no <code><a href=#the-base-element>base</a></code> element that is both a
+ child of <a href=#the-head-element>the <code>head</code> element</a> and has an
+ <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, then the
+ <a href=#document-base-url>document base URL</a> is <var title="">fallback base
+ url</var>.</li>
+
+ <li><p>Otherwise, let <var title="">url</var> be the value of the
+ <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute of the first
+ such element.</li>
+
+ <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> <var title="">url</var> relative to <var title="">fallback base
+ url</var> (thus, the <code><a href=#the-base-element>base</a></code> <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute isn't affected by
+ <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes).</li>
+
+ <li><p>The <a href=#document-base-url>document base URL</a> is the result of the
+ previous step if it was successful; otherwise it is <var title="">fallback base url</var>.</li>
+
+ </ol></li>
+
+ <li><p>Return the result of applying the <span class=XXX>resolve
+ an address</span> algorithm defined by the IRI specification to
+ resolve <var title="">url</var> relative to <var title="">base</var> using encoding <var title="">encoding</var>. <a href=#refsRFC3987>[RFC3987]</a></li>
+
+ </ol></div>
+
+ <p>A <a href=#url>URL</a> is an <dfn id=absolute-url>absolute URL</dfn> if <a href=#resolve-a-url title="resolve a url">resolving</a> it results in the same output
+ regardless of what it is resolved relative to, and that output is
+ not a failure.</p>
+
+ <p>An <a href=#absolute-url>absolute URL</a> is a <dfn id=hierarchical-url>hierarchical URL</dfn> if,
+ when <a href=#resolve-a-url title="resolve a url">resolved</a> and then <a href=#parse-a-url title="parse a url">parsed</a>, there is a character immediately
+ after the <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> component
+ and it is a U+002F SOLIDUS character (/).</p>
+
+ <p>An <a href=#absolute-url>absolute URL</a> is an <dfn id=authority-based-url>authority-based URL</dfn>
+ if, when <a href=#resolve-a-url title="resolve a url">resolved</a> and then <a href=#parse-a-url title="parse a url">parsed</a>, there are two characters
+ immediately after the <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a>
+ component and they are both U+002F SOLIDUS characters (//).</p>
+
+ <hr><p>This specification defines the URL
+ <dfn id=about:legacy-compat><code>about:legacy-compat</code></dfn> as a reserved, though
+ unresolvable, <code title="">about:</code> URI, for use in <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>s in <a href=#html-documents>HTML
+ documents</a> when needed for compatibility with XML tools. <a href=#refsABOUT>[ABOUT]</a></p>
+
+ <p>This specification defines the URL
+ <dfn id=about:srcdoc><code>about:srcdoc</code></dfn> as a reserved, though
+ unresolvable, <code title="">about:</code> URI, that is used as
+ <a href="#the-document's-address">the document's address</a> of <a href=#an-iframe-srcdoc-document title="an iframe srcdoc
+ document"><code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> documents</a>. <a href=#refsABOUT>[ABOUT]</a></p>
+
+ <p class=note>The term "URL" in this specification is used in a
+ manner distinct from the precise technical meaning it is given in
+ RFC 3986. Readers familiar with that RFC will find it easier to read
+ <em>this</em> specification if they pretend the term "URL" as used
+ herein is really called something else altogether. This is a
+ <a href=#willful-violation>willful violation</a> of RFC 3986. <a href=#refsRFC3986>[RFC3986]</a></p>
+
+
+ <div class=impl>
+
+ <h4 id=dynamic-changes-to-base-urls><span class=secno>2.5.2 </span>Dynamic changes to base URLs</h4>
+
+ <p>When an <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute
+ changes, the attribute's element, and all descendant elements, are
+ <a href=#affected-by-a-base-url-change>affected by a base URL change</a>.</p>
+
+ <p>When a document's <a href=#document-base-url>document base URL</a> changes, all
+ elements in that document are <a href=#affected-by-a-base-url-change>affected by a base URL
+ change</a>.</p>
+
+ <p>When an element is moved from one document to another, if the two
+ documents have different <a href=#document-base-url title="document base URL">base
+ URLs</a>, then that element and all its descendants are
+ <a href=#affected-by-a-base-url-change>affected by a base URL change</a>.</p>
+
+ <p>When an element is <dfn id=affected-by-a-base-url-change>affected by a base URL change</dfn>, it
+ must act as described in the following list:</p>
+
+ <dl class=switch><dt>If the element is a <a href=#hyperlink title=hyperlink>hyperlink
+ element</a></dt>
+
+ <dd>
+
+ <p>If the <a href=#absolute-url>absolute URL</a> identified by the hyperlink is
+ being shown to the user, or if any data derived from that URL is
+ affecting the display, then the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute should be <a href=#resolve-a-url title="resolve a url">re-resolved</a> relative to the element
+ and the UI updated appropriately.</p>
+
+ <p class=example>For example, the CSS <code title=selector-link><a href=#selector-link>:link</a></code>/<code title=selector-visited><a href=#selector-visited>:visited</a></code> pseudo-classes might have
+ been affected.</p>
+
+<!--PING-->
+ <p>If the hyperlink has a <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute and its <a href=#absolute-url title="absolute URL">absolute URL(s)</a> are being shown to the
+ user, then the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>
+ attribute's tokens should be <a href=#resolve-a-url title="resolve a
+ url">re-resolved</a> relative to the element and the UI updated
+ appropriately.</p>
+<!--PING-->
+
+ </dd>
+
+ <dt>If the element is a <code><a href=#the-q-element>q</a></code>, <code><a href=#the-blockquote-element>blockquote</a></code>,
+ <code><a href=#the-section-element>section</a></code>, <code><a href=#the-article-element>article</a></code>, <code><a href=#the-ins-element>ins</a></code>, or
+ <code><a href=#the-del-element>del</a></code> element with a <code title="">cite</code>
+ attribute</dt>
+
+ <dd>
+
+ <p>If the <a href=#absolute-url>absolute URL</a> identified by the <code title="">cite</code> attribute is being shown to the user, or if
+ any data derived from that URL is affecting the display, then the
+ <a href=#url>URL</a> should be <a href=#resolve-a-url title="resolve a
+ url">re-resolved</a> relative to the element and the UI updated
+ appropriately.</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>The element is not directly affected.</p>
+
+ <p class=example>Changing the base URL doesn't affect the image
+ displayed by <code><a href=#the-img-element>img</a></code> elements, although subsequent
+ accesses of the <code title=dom-img-src><a href=#dom-img-src>src</a></code> IDL attribute
+ from script will return a new <a href=#absolute-url>absolute URL</a> that might
+ no longer correspond to the image being shown.</p>
+
+ </dd>
+
+ </dl></div>
+
+
+
+ <h4 id=interfaces-for-url-manipulation><span class=secno>2.5.3 </span>Interfaces for URL manipulation</h4>
+
+ <p>An interface that has a complement of <dfn id=url-decomposition-idl-attributes>URL decomposition IDL
+ attributes</dfn> will have seven attributes with the following
+ definitions:</p>
+
+<pre class="idl extract"> attribute DOMString <a href=#dom-uda-protocol title=dom-uda-protocol>protocol</a>;
+ attribute DOMString <a href=#dom-uda-host title=dom-uda-host>host</a>;
+ attribute DOMString <a href=#dom-uda-hostname title=dom-uda-hostname>hostname</a>;
+ attribute DOMString <a href=#dom-uda-port title=dom-uda-port>port</a>;
+ attribute DOMString <a href=#dom-uda-pathname title=dom-uda-pathname>pathname</a>;
+ attribute DOMString <a href=#dom-uda-search title=dom-uda-search>search</a>;
+ attribute DOMString <a href=#dom-uda-hash title=dom-uda-hash>hash</a>;</pre>
+
+ <dl class=domintro><dt><var title="">o</var> . <code title=dom-uda-protocol><a href=#dom-uda-protocol>protocol</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the current scheme of the underlying URL.</p>
+ <p>Can be set, to change the underlying URL's scheme.</p>
+ </dd>
+
+ <dt><var title="">o</var> . <code title=dom-uda-host><a href=#dom-uda-host>host</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the current host and port (if it's not the default port) in the underlying URL.</p>
+ <p>Can be set, to change the underlying URL's host and port.</p>
+ <p>The host and the port are separated by a colon. The port part,
+ if omitted, will be assumed to be the current scheme's default
+ port.</p>
+ </dd>
+
+ <dt><var title="">o</var> . <code title=dom-uda-hostname><a href=#dom-uda-hostname>hostname</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the current host in the underlying URL.</p>
+ <p>Can be set, to change the underlying URL's host.</p>
+ </dd>
+
+ <dt><var title="">o</var> . <code title=dom-uda-port><a href=#dom-uda-port>port</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the current port in the underlying URL.</p>
+ <p>Can be set, to change the underlying URL's port.</p>
+ </dd>
+
+ <dt><var title="">o</var> . <code title=dom-uda-pathname><a href=#dom-uda-pathname>pathname</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the current path in the underlying URL.</p>
+ <p>Can be set, to change the underlying URL's path.</p>
+ </dd>
+
+ <dt><var title="">o</var> . <code title=dom-uda-search><a href=#dom-uda-search>search</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the current query component in the underlying URL.</p>
+ <p>Can be set, to change the underlying URL's query component.</p>
+ </dd>
+
+ <dt><var title="">o</var> . <code title=dom-uda-hash><a href=#dom-uda-hash>hash</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the current fragment identifier in the underlying URL.</p>
+ <p>Can be set, to change the underlying URL's fragment identifier.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <hr><p>The attributes defined to be URL decomposition IDL attributes must
+ act as described for the attributes with the same corresponding
+ names in this section.</p>
+
+ <p>In addition, an interface with a complement of URL decomposition IDL
+ attributes will define an <dfn id=concept-uda-input title=concept-uda-input>input</dfn>, which is a <a href=#url>URL</a>
+ that the attributes act on, and a <dfn id=concept-uda-setter title=concept-uda-setter>common setter action</dfn>, which is a
+ set of steps invoked when any of the attributes' setters are
+ invoked.</p>
+
+ <p>The seven URL decomposition IDL attributes have similar
+ requirements.</p>
+
+ <p>On getting, if the <a href=#concept-uda-input title=concept-uda-input>input</a>
+ is an <a href=#absolute-url>absolute URL</a> that fulfills the condition given in
+ the "getter condition" column corresponding to the attribute in the
+ table below, the user agent must return the part of the <a href=#concept-uda-input title=concept-uda-input>input</a> URL given in the "component"
+ column, with any prefixes specified in the "prefix" column
+ appropriately added to the start of the string and any suffixes
+ specified in the "suffix" column appropriately added to the end of
+ the string. Otherwise, the attribute must return the empty
+ string.</p>
+
+ <p>On setting, the new value must first be mutated as described by
+ the "setter preprocessor" column, then mutated by %-escaping any
+ characters in the new value that are not valid in the relevant
+ component as given by the "component" column. Then, if the <a href=#concept-uda-input title=concept-uda-input>input</a> is an <a href=#absolute-url>absolute
+ URL</a> and the resulting new value fulfills the condition given
+ in the "setter condition" column, the user agent must make a new
+ string <var title="">output</var> by replacing the component of the
+ URL given by the "component" column in the <a href=#concept-uda-input title=concept-uda-input>input</a> URL with the new value;
+ otherwise, the user agent must let <var title="">output</var> be
+ equal to the <a href=#concept-uda-input title=concept-uda-input>input</a>. Finally,
+ the user agent must invoke the <a href=#concept-uda-setter title=concept-uda-setter>common setter action</a> with the
+ value of <var title="">output</var>.</p>
+
+ <p>When replacing a component in the URL, if the component is part
+ of an optional group in the URL syntax consisting of a character
+ followed by the component, the component (including its prefix
+ character) must be included even if the new value is the empty
+ string.</p>
+
+ <p class=note>The previous paragraph applies in particular to the
+ "<code title="">:</code>" before a &lt;port&gt; component, the "<code title="">?</code>" before a &lt;query&gt; component, and the "<code title="">#</code>" before a &lt;fragment&gt; component.</p>
+
+ <p>For the purposes of the above definitions, URLs must be parsed
+ using the <a href=#parse-a-url title="parse a URL">URL parsing rules</a> defined
+ in this specification.</p>
+
+ <table><thead><tr><th>Attribute
+ <th>Component
+ <th>Getter Condition
+ <th>Prefix
+ <th>Suffix
+ <th>Setter Preprocessor
+ <th>Setter Condition
+ <tbody><tr><td><dfn id=dom-uda-protocol title=dom-uda-protocol><code>protocol</code></dfn>
+ <td><a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a>
+ <td>&mdash;
+ <td>&mdash;
+ <td>U+003A COLON (:)
+ <td>Remove all trailing U+003A COLON characters (:)
+ <td>The new value is not the empty string
+ <tr><td><dfn id=dom-uda-host title=dom-uda-host><code>host</code></dfn>
+ <td><a href=#url-hostport title=url-hostport>&lt;hostport&gt;</a>
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is an <a href=#authority-based-url>authority-based URL</a>
+ <td>&mdash;
+ <td>&mdash;
+ <td>&mdash;
+ <td>The new value is not the empty string and <a href=#concept-uda-input title=concept-uda-input>input</a> is an <a href=#authority-based-url>authority-based URL</a>
+ <tr><td><dfn id=dom-uda-hostname title=dom-uda-hostname><code>hostname</code></dfn>
+ <td><a href=#url-host title=url-host>&lt;host&gt;</a>
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is an <a href=#authority-based-url>authority-based URL</a>
+ <td>&mdash;
+ <td>&mdash;
+ <td>Remove all leading U+002F SOLIDUS characters (/)
+ <td>The new value is not the empty string and <a href=#concept-uda-input title=concept-uda-input>input</a> is an <a href=#authority-based-url>authority-based URL</a>
+ <tr><td><dfn id=dom-uda-port title=dom-uda-port><code>port</code></dfn>
+ <td><a href=#url-port title=url-port>&lt;port&gt;</a>
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is an <a href=#authority-based-url>authority-based URL</a>, and contained a <a href=#url-port title=url-port>&lt;port&gt;</a> component (possibly an empty one)
+ <td>&mdash;
+ <td>&mdash;
+ <td>Remove all characters in the new value from the first that is not in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), if any.
+ Remove any leading U+0030 DIGIT ZERO characters (0) in the new value.
+ If the resulting string is empty, set it to a single U+0030 DIGIT ZERO character (0).
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is an <a href=#authority-based-url>authority-based URL</a>,
+ and the new value, when interpretted as a base-ten integer, is less than or equal to 65535
+ <tr><td><dfn id=dom-uda-pathname title=dom-uda-pathname><code>pathname</code></dfn>
+ <td><a href=#url-path title=url-path>&lt;path&gt;</a>
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is a <a href=#hierarchical-url>hierarchical URL</a>
+ <td>&mdash;
+ <td>&mdash;
+ <td>If it has no leading U+002F SOLIDUS character (/), prepend a U+002F SOLIDUS character (/) to the new value
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is hierarchical
+ <tr><td><dfn id=dom-uda-search title=dom-uda-search><code>search</code></dfn>
+ <td><a href=#url-query title=url-query>&lt;query&gt;</a>
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is a <a href=#hierarchical-url>hierarchical URL</a>, and contained a <a href=#url-query title=url-query>&lt;query&gt;</a> component (possibly an empty one)
+ <td>U+003F QUESTION MARK (?)
+ <td>&mdash;
+ <td>Remove one leading U+003F QUESTION MARK character (?), if any
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> is a <a href=#hierarchical-url>hierarchical URL</a>
+ <tr><td><dfn id=dom-uda-hash title=dom-uda-hash><code>hash</code></dfn>
+ <td><a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a>
+ <td><a href=#concept-uda-input title=concept-uda-input>input</a> contained a non-empty <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component
+ <td>U+0023 NUMBER SIGN (#)
+ <td>&mdash;
+ <td>Remove one leading U+0023 NUMBER SIGN character (#), if any
+ <td>&mdash;
+ </table><!--
+ http://www.hixie.ch/tests/adhoc/dom/level0/location/components/
+ http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsLocation.cpp
+ http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_h-l.htm#84722
+--></div>
+
+ <div class=example>
+
+ <p>The table below demonstrates how the getter <span class=impl>condition</span> for <code title=dom-uda-search><a href=#dom-uda-search>search</a></code> results in different results
+ depending on the exact original syntax of the URL:</p>
+
+ <table><thead><tr><th> Input URL
+ <th> <code title=dom-uda-search><a href=#dom-uda-search>search</a></code> value
+ <th> Explanation
+ <tbody><tr><td> <code title="">http://example.com/</code>
+ <td> <i>empty string</i>
+ <td> No <a href=#url-query title=url-query>&lt;query&gt;</a> component in input URL.
+ <tr><td> <code title="">http://example.com/?</code>
+ <td> <code title="">?</code>
+ <td> There is a <a href=#url-query title=url-query>&lt;query&gt;</a> component, but it is empty.
+ <span class=impl>The question mark in the resulting value is the prefix.</span>
+ <tr><td> <code title="">http://example.com/?test</code>
+ <td> <code title="">?test</code>
+ <td> The <a href=#url-query title=url-query>&lt;query&gt;</a> component has the value "<code title="">test</code>".
+ <tr><td> <code title="">http://example.com/?test#</code>
+ <td> <code title="">?test</code>
+ <td> The (empty) <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component is not part of the <a href=#url-query title=url-query>&lt;query&gt;</a> component.
+ </table></div>
+
+
+ <div class=impl>
+
+ <h3 id=fetching-resources><span class=secno>2.6 </span>Fetching resources</h3>
+
+ <p>When a user agent is to <dfn id=fetch>fetch</dfn> a resource or
+ <a href=#url>URL</a>, optionally from an origin <i title="">origin</i>,
+ and optionally with a <i>synchronous flag</i> and/or a <i>manual
+ redirect flag</i>, the following steps must be run. (When a
+ <em>URL</em> is to be fetched, the URL identifies a resource to be
+ obtained.)</p>
+
+ <!-- if invoked with the synchronous flag, make sure to release the
+ storage mutex first -->
+
+ <!-- synchronous flag is only used by sync-XHR, for legacy reasons;
+ don't use it in new features! -->
+
+ <ol><li>
+
+ <p>Generate the <i>address of the resource from which Request-URIs
+ are obtained</i> as required by HTTP for the <code title=http-referer>Referer</code> (sic) header from <a href="#the-document's-current-address">the
+ document's current address</a> of the appropriate
+ <code><a href=#document>Document</a></code> as given by the following list. <a href=#refsHTTP>[HTTP]</a></p>
+
+ <dl class=switch><dt>When <a href=#navigate title=navigate>navigating</a></dt>
+
+ <dd>The <a href=#active-document>active document</a> of the <a href=#source-browsing-context>source browsing
+ context</a>.</dd>
+
+ <dt>When fetching resources for an element</dt>
+
+ <dd>The element's <code><a href=#document>Document</a></code>.</dd>
+
+ <dt>When fetching resources in response to a call to an API</dt>
+
+ <dd>The <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
+ document">document</a>.</dd>
+
+ </dl><p>Remove any <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a>
+ component from the generated <i>address of the resource from which
+ Request-URIs are obtained</i>.</p> <!-- RFC2616 says "The URI MUST
+ NOT include a fragment." (section 14.36) -->
+
+ <p>If the <a href=#origin>origin</a> of the appropriate
+ <code><a href=#document>Document</a></code> is not a scheme/host/port tuple, then the
+ <code title=http-referer>Referer</code> (sic) header must be
+ omitted, regardless of its value.</p>
+
+ </li>
+
+ <li><p>If the algorithm was not invoked with the <i>synchronous
+ flag</i>, perform the remaining steps asynchronously.</li>
+
+ <li>
+
+ <p>This is the <i>main step</i>.</p>
+
+ <p>If the resource is identified by an <a href=#absolute-url>absolute URL</a>,
+ and the resource is to be obtained using an idempotent action
+ (such as an HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
+ equivalent</a>), and it is already being downloaded for other
+ reasons (e.g. another invocation of this algorithm), and this
+ request would be identical to the previous one (e.g. same <code title=http-accept>Accept</code> and <code title=http-origin>Origin</code> headers), and the user agent is
+ configured such that it is to reuse the data from the existing
+ download instead of initiating a new one, then use the results of
+ the existing download instead of starting a new one.</p>
+
+ <p>Otherwise, at a time convenient to the user and the user agent,
+ download (or otherwise obtain) the resource, applying the
+ semantics of the relevant specifications (e.g. performing an HTTP
+ GET or POST operation, or reading the file from disk, <a href=#concept-js-deref title=concept-js-deref>dereferencing <span title="javascript
+ protocol"><code title="">javascript:</code> URLs</span></a>,
+ etc).</p>
+
+ <p>For the purposes of the <code title=http-referer>Referer</code> (sic) header, use the
+ <i>address of the resource from which Request-URIs are
+ obtained</i> generated in the earlier step.</p>
+
+ <p>For the purposes of the <code title=http-origin>Origin</code>
+ header, if the <a href=#fetch title=fetch>fetching algorithm</a> was
+ explicitly initiated from an <i title="">origin</i>, then <i title="">the origin that initiated the HTTP request</i> is <i title="">origin</i>. Otherwise, this is <i title="">a request from
+ a "privacy-sensitive" context</i>. <a href=#refsORIGIN>[ORIGIN]</a></p>
+
+ <p>If the resource is identified by the <a href=#url>URL</a>
+ <dfn id=about:blank><code>about:blank</code></dfn>, then the resource is
+ immediately available and consists of the empty string, with no
+ metadata.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there are cookies to be set, then the user agent must run
+ the following substeps:</p>
+
+ <ol><li><p>Wait until ownership of the <a href=#storage-mutex>storage mutex</a> can
+ be taken by this instance of the <a href=#fetch title=fetch>fetching</a> algorithm.</li>
+
+ <li><p>Take ownership of the <a href=#storage-mutex>storage mutex</a>.</li>
+
+ <li><p>Update the cookies. <a href=#refsCOOKIES>[COOKIES]</a></li>
+
+ <li><p>Release the <a href=#storage-mutex>storage mutex</a> so that it is once
+ again free.</li>
+
+ </ol></li>
+
+ <li>
+
+ <p>If the fetched resource is an HTTP redirect <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>,
+ then:</p>
+
+ <dl class=switch><dt>If the <i>manual redirect flag</i> is set</dt>
+
+ <dd>
+
+ <p>Continue, using the fetched resource (the redirect) as the
+ result of the algorithm.</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>First, apply any relevant requirements for redirects (such as
+ showing any appropriate prompts). Then, redo <i>main step</i>,
+ but using the target of the redirect as the resource to fetch,
+ rather than the original resource.</p>
+
+ <p class=note>The HTTP specification requires that 301, 302,
+ and 307 redirects, when applied to methods other than the safe
+ methods, not be followed without user confirmation. That would
+ be an appropriate prompt for the purposes of the requirement in
+ the paragraph above. <a href=#refsHTTP>[HTTP]</a></p>
+
+ </dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>If the algorithm was not invoked with the <i>synchronous
+ flag</i>: When the resource is available, or if there is an error
+ of some description, <a href=#queue-a-task>queue a task</a> that uses the
+ resource as appropriate. If the resource can be processed
+ incrementally, as, for instance, with a progressively interlaced
+ JPEG or an HTML file, additional tasks may be queued to process
+ the data as it is downloaded. The <a href=#task-source>task source</a> for
+ these <a href=#concept-task title=concept-task>tasks</a> is the
+ <a href=#networking-task-source>networking task source</a>.</p>
+
+ <p>Otherwise, return the resource or error information to the
+ calling algorithm.</p>
+
+ </li>
+
+ </ol><p>If the user agent can determine the actual length of the resource
+ being <a href=#fetch title=fetch>fetched</a> for an instance of this
+ algorithm, and if that length is finite, then that length is the
+ file's <dfn id=concept-fetch-total title=concept-fetch-total>size</dfn>. Otherwise, the
+ subject of the algorithm (that is, the resource being fetched) has
+ no known <a href=#concept-fetch-total title=concept-fetch-total>size</a>. (For
+ example, the HTTP <code title=http-content-length>Content-Length</code> header might
+ provide this information.)</p>
+
+ <p>The user agent must also keep track of the <dfn id=concept-fetch-loaded title=concept-fetch-loaded>number of bytes downloaded</dfn> for
+ each instance of this algorithm. This number must exclude any
+ out-of-band metadata, such as HTTP headers.</p>
+
+ <p class=note>The <a href=#application-cache>application cache</a> processing model
+ introduces some <a href=#changesToNetworkingModel>changes to the
+ networking model</a> to handle the returning of cached
+ resources.</p>
+
+ <p class=note>The <a href=#navigate title=navigate>navigation</a>
+ processing model handles redirects itself, overriding the
+ redirection handling that would be done by the fetching
+ algorithm.</p>
+
+ <p class=note>Whether the <a href=#content-type-sniffing>type
+ sniffing rules</a> apply to the fetched resource depends on the
+ algorithm that invokes the rules &mdash; they are not always
+ applicable.</p>
+
+
+ <h4 id=concept-http-equivalent><span class=secno>2.6.1 </span>Protocol concepts</h4>
+
+ <p>User agents can implement a variety of transfer protocols, but
+ this specification mostly defines behavior in terms of HTTP. <a href=#refsHTTP>[HTTP]</a></p>
+
+ <p>The <dfn id=concept-http-equivalent-get title=concept-http-equivalent-get>HTTP GET
+ method</dfn> is equivalent to the default retrieval action of the
+ protocol. For example, RETR in FTP. Such actions are idempotent and
+ safe, in HTTP terms.</p>
+
+ <p>The <dfn id=concept-http-equivalent-codes title=concept-http-equivalent-codes>HTTP response
+ codes</dfn> are equivalent to statuses in other protocols that have
+ the same basic meanings. For example, a "file not found" error is
+ equivalent to a 404 code, a server error is equivalent to a 5xx
+ code, and so on.</p>
+
+ <p>The <dfn id=concept-http-equivalent-headers title=concept-http-equivalent-headers>HTTP
+ headers</dfn> are equivalent to fields in other protocols that have
+ the same basic meaning. For example, the HTTP authentication
+ headers are equivalent to the authentication aspects of the FTP
+ protocol.</p>
+
+
+ <h4 id=encrypted-http-and-related-security-concerns><span class=secno>2.6.2 </span>Encrypted HTTP and related security concerns</h4>
+
+ <p>Anything in this specification that refers to HTTP also applies
+ to HTTP-over-TLS, as represented by <a href=#url title=url>URLs</a>
+ representing the <code title="">https</code> scheme.</p>
+
+ <p class=warning>User agents should report certificate errors to
+ the user and must either refuse to download resources sent with
+ erroneous certificates or must act as if such resources were in fact
+ served with no encryption.</p>
+
+ <p>User agents should warn the user that there is a potential
+ problem whenever the user visits a page that the user has previously
+ visited, if the page uses less secure encryption on the second
+ visit.</p>
+
+ <p>Not doing so can result in users not noticing man-in-the-middle
+ attacks.</p>
+
+ <div class=example>
+
+ <p>If a user connects to a server with a self-signed certificate,
+ the user agent could allow the connection but just act as if there
+ had been no encryption. If the user agent instead allowed the user
+ to override the problem and then displayed the page as if it was
+ fully and safely encrypted, the user could be easily tricked into
+ accepting man-in-the-middle connections.</p>
+
+ <p>If a user connects to a server with full encryption, but the
+ page then refers to an external resource that has an expired
+ certificate, then the user agent will act as if the resource was
+ unavailable, possibly also reporting the problem to the user. If
+ the user agent instead allowed the resource to be used, then an
+ attacker could just look for "secure" sites that used resources
+ from a different host and only apply man-in-the-middle attacks to
+ that host, for example taking over scripts in the page.</p>
+
+ <p>If a user bookmarks a site that uses a CA-signed certificate,
+ and then later revisits that site directly but the site has started
+ using a self-signed certificate, the user agent could warn the user
+ that a man-in-the-middle attack is likely underway, instead of
+ simply acting as if the page was not encrypted.</p>
+
+ </div>
+
+
+ <h4 id=content-type-sniffing><span class=secno>2.6.3 </span>Determining the type of a resource</h4>
+
+ <p>The <dfn id=content-type title=Content-Type>Content-Type metadata</dfn> of a
+ resource must be obtained and interpreted in a manner consistent
+ with the requirements of the Content-Type Processing Model
+ specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
+
+ <p>The <dfn id=content-type-sniffing-0 title="Content-Type sniffing">sniffed type of a
+ resource</dfn> must be found in a manner consistent with the
+ requirements given in the Content-Type Processing Model
+ specification for finding the <i>sniffed-type</i> of the relevant
+ sequence of octets. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
+
+ <p>The <dfn id=content-type-sniffing:-image title="Content-Type sniffing: image">rules for sniffing
+ images specifically</dfn> and the <dfn id=content-type-sniffing:-text-or-binary title="Content-Type sniffing:
+ text or binary">rules for distingushing if a resource is text or
+ binary</dfn> are also defined in the Content-Type Processing Model
+ specification. Both sets of rules return a <a href=#mime-type>MIME type</a> as
+ their result. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
+
+ <p class=warning>It is imperative that the rules in the
+ Content-Type Processing Model specification be followed
+ exactly. When a user agent uses different heuristics for content
+ type detection than the server expects, security problems can
+ occur. For more details, see the Content-Type Processing Model
+ specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
+
+ <p>The <dfn id=algorithm-for-extracting-an-encoding-from-a-content-type>algorithm for extracting an encoding from a
+ Content-Type</dfn>, given a string <var title="">s</var>, is as
+ follows. It either returns an encoding or nothing.</p>
+
+ <ol><li><p>Find the first seven characters in <var title="">s</var>
+ that are an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the word
+ "<code title="">charset</code>". If no such match is found, return
+ nothing.</li>
+
+ <li><p>Skip any U+0009, U+000A, U+000C, U+000D, or U+0020
+ characters that immediately follow the word "<code title="">charset</code>" (there might not be any).</li>
+
+ <li><p>If the next character is not a U+003D EQUALS SIGN ('='),
+ return nothing and abort these steps.</li>
+
+ <li><p>Skip any U+0009, U+000A, U+000C, U+000D, or U+0020
+ characters that immediately follow the equals sign (there might not
+ be any).</li>
+
+ <li>
+
+ <p>Process the next character as follows:</p>
+
+ <dl class=switch><dt>If it is a U+0022 QUOTATION MARK ('"') and there is a later U+0022 QUOTATION MARK ('"') in <var title="">s</var></dt>
+ <dt>If it is a U+0027 APOSTROPHE ("'") and there is a later U+0027 APOSTROPHE ("'") in <var title="">s</var></dt>
+ <dd>Return the encoding corresponding to the string between this character and the next earliest occurrence of this character.</dd>
+
+ <dt>If it is an unmatched U+0022 QUOTATION MARK ('"')</dt>
+ <dt>If it is an unmatched U+0027 APOSTROPHE ("'")</dt>
+ <dt>If there is no next character</dt>
+ <dd>Return nothing.</dd>
+
+ <dt>Otherwise</dt>
+ <dd>Return the encoding corresponding to the string from this
+ character to the first U+0009, U+000A, U+000C, U+000D, U+0020, or
+ U+003B character or the end of <var title="">s</var>, whichever
+ comes first.</dd>
+
+ </dl></li>
+
+ </ol><p class=note>This requirement is a <a href=#willful-violation>willful violation</a>
+ of the HTTP specification, motivated by the need for backwards
+ compatibility with legacy content. <a href=#refsHTTP>[HTTP]</a></p>
+
+ </div>
+
+
+
+ <h3 id=common-dom-interfaces><span class=secno>2.7 </span>Common DOM interfaces</h3>
+
+ <h4 id=reflecting-content-attributes-in-idl-attributes><span class=secno>2.7.1 </span>Reflecting content attributes in IDL attributes</h4>
+
+ <p>Some IDL attributes are defined to <dfn id=reflect>reflect</dfn> a
+ particular content attribute. This means that on getting, the IDL
+ attribute returns the current value of the content attribute, and on
+ setting, the IDL attribute changes the value of the content
+ attribute to the given value.</p>
+
+<!-- v2 for completeness: (also search for REFLECTIDL)
+ <p class="note">A list of <span>reflecting IDL attributes</span> and
+ their corresponding content attributes is given in the index.</p>
+-->
+
+ <div class=impl>
+
+ <p>In general, on getting, if the content attribute is not present,
+ the IDL attribute must act as if the content attribute's value is
+ the empty string; and on setting, if the content attribute is not
+ present, it must first be added.</p>
+
+ <p>If a reflecting IDL attribute is a <code>DOMString</code>
+ attribute whose content attribute is defined to contain a
+ <a href=#url>URL</a>, then on getting, the IDL attribute must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of the content
+ attribute relative to the element and return the resulting
+ <a href=#absolute-url>absolute URL</a> if that was successful, or the empty
+ string otherwise; and on setting, must set the content attribute to
+ the specified literal value. If the content attribute is absent, the
+ IDL attribute must return the default value, if the content
+ attribute has one, or else the empty string.</p>
+
+ <p>If a reflecting IDL attribute is a <code>DOMString</code>
+ attribute whose content attribute is defined to contain one or more
+ <a href=#url title=URL>URLs</a>, then on getting, the IDL attribute
+ must <a href=#split-a-string-on-spaces title="split a string on spaces">split the content
+ attribute on spaces</a> and return the concatenation of <a href=#resolve-a-url title="resolve a URL">resolving</a> each token URL to an
+ <a href=#absolute-url>absolute URL</a> relative to the element, with a single
+ U+0020 SPACE character between each URL, ignoring any tokens that
+ did not resolve successfully. If the content attribute is absent,
+ the IDL attribute must return the default value, if the content
+ attribute has one, or else the empty string. On setting, the IDL
+ attribute must set the content attribute to the specified literal
+ value.</p>
+
+ <p>If a reflecting IDL attribute is a <code>DOMString</code> whose
+ content attribute is an <a href=#enumerated-attribute>enumerated attribute</a>, and the
+ IDL attribute is <dfn id=limited-to-only-known-values>limited to only known values</dfn>, then, on
+ getting, the IDL attribute must return the conforming value
+ associated with the state the attribute is in (in its canonical
+ case), or the empty string if the attribute is in a state that has
+ no associated keyword value; and on setting, if the new value is an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the keywords
+ given for that attribute, then the content attribute must be set to
+ the conforming value associated with the state that the attribute
+ would be in if set to the given new value, otherwise, if the new
+ value is the empty string, then the content attribute must be
+ removed, otherwise, the content attribute must be set to the given
+ new value.</p>
+
+ <p>If a reflecting IDL attribute is a <code>DOMString</code> but
+ doesn't fall into any of the above categories, then the getting and
+ setting must be done in a transparent, case-preserving manner.</p>
+
+ <p>If a reflecting IDL attribute is a <code title="">boolean</code>
+ attribute, then on getting the IDL attribute must return true if the
+ content attribute is set, and false if it is absent. On setting, the
+ content attribute must be removed if the IDL attribute is set to
+ false, and must be set to the empty string if the IDL attribute is
+ set to true. (This corresponds to the rules for <a href=#boolean-attribute title="boolean
+ attribute">boolean content attributes</a>.)</p>
+
+ <p>If a reflecting IDL attribute is a signed integer type
+ (<code>long</code>) then, on getting, the content attribute must be
+ parsed according to the <a href=#rules-for-parsing-integers title="rules for parsing
+ integers">rules for parsing signed integers</a>, and if that is
+ successful, and the value is in the range of the IDL attribute's
+ type, the resulting value must be returned. If, on the other hand,
+ it fails or returns an out of range value, or if the attribute is
+ absent, then the default value must be returned instead, or 0 if
+ there is no default value. On setting, the given value must be
+ converted to the shortest possible string representing the number as
+ a <a href=#valid-integer>valid integer</a> and then that string must be used as
+ the new content attribute value.</p>
+
+ <p>If a reflecting IDL attribute is a signed integer type
+ (<code>long</code>) that is <dfn id=limited-to-only-non-negative-numbers>limited to only non-negative
+ numbers</dfn> then, on getting, the content attribute must be parsed
+ according to the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a>, and if that is successful, and the value is in the
+ range of the IDL attribute's type, the resulting value must be
+ returned. If, on the other hand, it fails or returns an out of range
+ value, or if the attribute is absent, the default value must be
+ returned instead, or &minus;1 if there is no default value. On
+ setting, if the value is negative, the user agent must fire an
+ <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception. Otherwise, the given value
+ must be converted to the shortest possible string representing the
+ number as a <a href=#valid-non-negative-integer>valid non-negative integer</a> and then that
+ string must be used as the new content attribute value.</p>
+
+ <p>If a reflecting IDL attribute is an <em>unsigned</em> integer
+ type (<code>unsigned long</code>) then, on getting, the content
+ attribute must be parsed according to the <a href=#rules-for-parsing-non-negative-integers>rules for parsing
+ non-negative integers</a>, and if that is successful, and the
+ value is in the range of the IDL attribute's type, the resulting
+ value must be returned. If, on the other hand, it fails or returns
+ an out of range value, or if the attribute is absent, the default
+ value must be returned instead, or 0 if there is no default
+ value. On setting, the given value must be converted to the shortest
+ possible string representing the number as a <a href=#valid-non-negative-integer>valid
+ non-negative integer</a> and then that string must be used as the
+ new content attribute value.</p>
+
+ <p>If a reflecting IDL attribute is an unsigned integer type
+ (<code>unsigned long</code>) that is <dfn id=limited-to-only-non-negative-numbers-greater-than-zero>limited to only
+ non-negative numbers greater than zero</dfn>, then the behavior is
+ similar to the previous case, but zero is not allowed. On getting,
+ the content attribute must first be parsed according to the
+ <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>, and if that is
+ successful, and the value is in the range of the IDL attribute's
+ type, the resulting value must be returned. If, on the other hand,
+ it fails or returns an out of range value, or if the attribute is
+ absent, the default value must be returned instead, or 1 if there is
+ no default value. On setting, if the value is zero, the user agent
+ must fire an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception. Otherwise, the
+ given value must be converted to the shortest possible string
+ representing the number as a <a href=#valid-non-negative-integer>valid non-negative integer</a>
+ and then that string must be used as the new content attribute
+ value.</p>
+
+ <p>If a reflecting IDL attribute is a floating point number type
+ (<code>float</code>), then, on getting, the content attribute must
+ be parsed according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point
+ number values</a>, and if that is successful, the resulting value
+ must be returned. If, on the other hand, it fails, or if the
+ attribute is absent, the default value must be returned instead, or
+ 0.0 if there is no default value. On setting, the given value must
+ be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number>best representation of the number as a
+ floating point number</a> and then that string must be used as
+ the new content attribute value.</p>
+
+ <p class=note>The values Infinity and Not-a-Number (NaN) values
+ throw an exception on setting, as <a href=#float-nan>defined
+ earlier</a>.</p>
+
+ <p>If a reflecting IDL attribute is of the type
+ <code><a href=#domtokenlist>DOMTokenList</a></code> or <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code>, then
+ on getting it must return a <code><a href=#domtokenlist>DOMTokenList</a></code> or
+ <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code> object (as appropriate) whose
+ underlying string is the element's corresponding content
+ attribute. When the object mutates its underlying string, the
+ content attribute must itself be immediately mutated. When the
+ attribute is absent, then the string represented by the object is
+ the empty string; when the object mutates this empty string, the
+ user agent must add the corresponding content attribute, with its
+ value set to the value it would have been set to after mutating the
+ empty string. The same <code><a href=#domtokenlist>DOMTokenList</a></code> or
+ <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code> object must be returned every time
+ for each attribute.</p>
+
+ <div class=example>
+
+ <p>If an element with no attributes has its <code title=dom-tokenlist-remove><a href=#dom-tokenlist-remove>element.classList.remove()</a></code>
+ method invoked, the underlying string won't be changed, since the
+ result of removing any token from the empty string is still the
+ empty string. However, if the <code title=dom-tokenlist-add><a href=#dom-tokenlist-add>element.classList.add()</a></code> method is
+ then invoked, a <code title=attr-class><a href=#classes>class</a></code> attribute
+ will be added to the element with the value of the token to be
+ added.</p>
+
+ </div>
+
+ <p>If a reflecting IDL attribute has the type
+ <code><a href=#htmlelement>HTMLElement</a></code>, or an interface that descends from
+ <code><a href=#htmlelement>HTMLElement</a></code>, then, on getting, it must run the
+ following algorithm (stopping at the first point where a value is
+ returned):</p>
+
+ <ol><li>If the corresponding content attribute is absent, then the
+ IDL attribute must return null.</li>
+
+ <li>Let <var title="">candidate</var> be the element that the <code title=dom-Document-getElementById><a href=#dom-document-getelementbyid>document.getElementById()</a></code> method
+ would find when called on the content attribute's document if it
+ was passed as its argument the current value of the corresponding
+ content attribute.</li>
+
+ <li>If <var title="">candidate</var> is null, or if it is not
+ type-compatible with the IDL attribute, then the IDL attribute must
+ return null.</li>
+
+ <li>Otherwise, it must return <var title="">candidate</var>.</li>
+
+ </ol><p>On setting, if the given element has an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute, then the content attribute must
+ be set to the value of that <code title=attr-id><a href=#the-id-attribute>id</a></code>
+ attribute. Otherwise, the IDL attribute must be set to the empty
+ string.</p>
+
+ </div>
+
+
+ <h4 id=collections-0><span class=secno>2.7.2 </span>Collections</h4>
+
+ <p>The <code><a href=#htmlcollection>HTMLCollection</a></code>, <code><a href=#htmlallcollection>HTMLAllCollection</a></code>,
+ <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code>,
+ <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code>, and
+ <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> interfaces represent various
+ lists of DOM nodes. Collectively, objects implementing these
+ interfaces are called <dfn id=collections>collections</dfn>.</p>
+
+ <p>When a <a href=#collections title=collections>collection</a> is created, a
+ filter and a root are associated with the collection.</p>
+
+ <p class=example>For example, when the <code><a href=#htmlcollection>HTMLCollection</a></code>
+ object for the <code title=dom-document-images><a href=#dom-document-images>document.images</a></code> attribute is
+ created, it is associated with a filter that selects only
+ <code><a href=#the-img-element>img</a></code> elements, and rooted at the root of the
+ document.</p>
+
+ <p>The <a href=#collections title=collections>collection</a> then <dfn id=represented-by-the-collection title="represented by the collection">represents</dfn> a
+ <a href=#live>live</a> view of the subtree rooted at the collection's
+ root, containing only nodes that match the given filter. The view is
+ linear. <span class=impl>In the absence of specific requirements
+ to the contrary, the nodes within the collection must be sorted in
+ <a href=#tree-order>tree order</a>.</span></p>
+
+ <div class=impl>
+
+ <p class=note>The <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> list is
+ not in tree order.</p>
+
+ <p>An attribute that returns a collection must return the same
+ object every time it is retrieved.</p>
+
+ </div>
+
+
+ <h5 id=htmlcollection-0><span class=secno>2.7.2.1 </span>HTMLCollection</h5>
+
+ <p>The <code><a href=#htmlcollection>HTMLCollection</a></code> interface represents a generic
+ <a href=#collections title=collections>collection</a> of elements.</p>
+
+ <pre class=idl>interface <dfn id=htmlcollection>HTMLCollection</dfn> {
+ readonly attribute unsigned long <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a>;
+ caller getter object <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>(in unsigned long index); // only returns Element
+ caller getter object <a href=#dom-htmlcollection-nameditem title=dom-HTMLCollection-namedItem>namedItem</a>(in DOMString name); // only returns Element
+};</pre>
+
+ <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
+ <dd>
+ <p>Returns the number of elements in the collection.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">index</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">name</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">name</var>)</dt>
+ <dd>
+ <p>Returns the first item with <a href=#concept-id title=concept-id>ID</a> or name <var title="">name</var>
+ from the collection.</p>
+ <p>Returns null if no element with that <a href=#concept-id title=concept-id>ID</a> or name could be found.</p>
+ <p>Only <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
+ <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
+ <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
+ <code><a href=#the-object-element>object</a></code> elements can have a name for the purpose of
+ this method; their name is given by the value of their <code title="">name</code> attribute.</p>
+ </dd>
+ </dl><div class=impl>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are the numbers in the range zero to one less than
+ the number of nodes <a href=#represented-by-the-collection>represented by the collection</a>. If
+ there are no such elements, then there are no <span>supported
+ indexed properties</span>.</p>
+
+ <p>The <dfn id=dom-htmlcollection-length title=dom-HTMLCollection-length><code>length</code></dfn>
+ attribute must return the number of nodes <a href=#represented-by-the-collection>represented by the
+ collection</a>.</p>
+
+ <p>The <dfn id=dom-htmlcollection-item title=dom-HTMLCollection-item><code>item(<var title="">index</var>)</code></dfn> method must return the <var title="">index</var>th node in the collection. If there is no <var title="">index</var>th node in the collection, then the method must
+ return null.</p>
+
+ <p>The <span>names of the supported named properties</span> consist
+ of the values of the <code title="">name</code> attributes of each
+ <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
+ <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
+ <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
+ <code><a href=#the-object-element>object</a></code> element <a href=#represented-by-the-collection>represented by the
+ collection</a> with a <code title="">name</code> attribute, plus
+ the list of IDs that the elements <a href=#represented-by-the-collection>represented by the
+ collection</a> have.</p>
+
+ <p>The <dfn id=dom-htmlcollection-nameditem title=dom-HTMLCollection-namedItem><code>namedItem(<var title="">key</var>)</code></dfn> method must return the first node
+ in the collection that matches the following requirements:</p>
+
+ <ul><li>It is an <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>,
+ <code><a href=#the-area-element>area</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>,
+ <code><a href=#frame>frame</a></code>, <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
+ <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> element with a <code title="">name</code> attribute equal to <var title="">key</var>,
+ or,</li>
+
+ <li>It is an element with an <a href=#concept-id title=concept-id>ID</a>
+ equal to <var title="">key</var>.</li>
+
+ </ul><p>If no such elements are found, then the method must return
+ null.</p>
+
+ </div>
+
+
+ <h5 id=htmlallcollection-0><span class=secno>2.7.2.2 </span>HTMLAllCollection</h5>
+
+ <p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code> interface represents a generic
+ <a href=#collections title=collections>collection</a> of elements just like
+ <code><a href=#htmlcollection>HTMLCollection</a></code>, with the exception that its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method
+ returns an <code><a href=#htmlcollection>HTMLCollection</a></code> object when there are
+ multiple matching elements.</p>
+
+ <pre class=idl>interface <dfn id=htmlallcollection>HTMLAllCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
+ // inherits <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
+ caller getter object <a href=#dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
+ <a href=#htmlallcollection>HTMLAllCollection</a> <a href=#dom-htmlallcollection-tags title=dom-HTMLAllCollection-tags>tags</a>(in DOMString tagName);
+};</pre>
+
+ <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
+ <dd>
+ <p>Returns the number of elements in the collection.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">index</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">collection</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">name</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">name</var>)</dt>
+ <dd>
+ <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or name <var title="">name</var> from the collection.</p>
+ <p>If there are multiple matching items, then an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object containing all those elements is returned.</p>
+ <p>Returns null if no element with that <a href=#concept-id title=concept-id>ID</a> or name could be found.</p>
+ <p>Only <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
+ <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
+ <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
+ <code><a href=#the-object-element>object</a></code> elements can have a name for the purpose of
+ this method; their name is given by the value of their <code title="">name</code> attribute.</p>
+ </dd>
+
+ <dt><var title="">collection</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-tags><a href=#dom-htmlallcollection-tags>tags</a></code>(<var title="">tagName</var>)</dt>
+ <dd>
+ <p>Returns a collection that is a filtered view of the current collection, containing only elements with the given tag name.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> and <span>names of the supported named
+ properties</span> are as defined for <code><a href=#htmlcollection>HTMLCollection</a></code>
+ objects.</p>
+
+ <p>The <dfn id=dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem><code>namedItem(<var title="">key</var>)</code></dfn> method must act according to the
+ following algorithm:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">collection</var> be an
+ <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object rooted at the same node as
+ the <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object on which the method was
+ invoked, whose filter matches only only elements that already
+ match the filter of the <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object on
+ which the method was invoked and that are either:</p>
+
+ <ul><li><code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
+ <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
+ <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, or
+ <code><a href=#the-object-element>object</a></code> elements with a <code title="">name</code>
+ attribute equal to <var title="">key</var>, or,</li>
+
+ <li>elements with an <a href=#concept-id title=concept-id>ID</a> equal to
+ <var title="">key</var>.</li>
+
+ </ul></li>
+
+ <li>If, at the time the method is called, there is exactly one node
+ in <var title="">collection</var>, then return that node and stop
+ the algorithm.</li>
+
+ <li>Otherwise, if, at the time the method is called, <var title="">collection</var> is empty, return null and stop the
+ algorithm.</li>
+
+ <li>Otherwise, return <var title="">collection</var>.</li>
+
+ </ol><p>The <dfn id=dom-htmlallcollection-tags title=dom-HTMLAllCollection-tags><code>tags(<var title="">tagName</var>)</code></dfn> method must return an
+ <code><a href=#htmlallcollection>HTMLAllCollection</a></code> rooted at the same node as the
+ <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object on which the method was
+ invoked, whose filter matches only <a href=#html-elements>HTML elements</a> whose
+ local name is the <var title="">tagName</var> argument and that
+ already match the filter of the <code><a href=#htmlallcollection>HTMLAllCollection</a></code>
+ object on which the method was invoked. In <a href=#html-documents>HTML
+ documents</a>, the argument must first be <a href=#converted-to-ascii-lowercase>converted to
+ ASCII lowercase</a>.</p>
+
+ </div>
+
+
+ <h5 id=htmlformcontrolscollection-0><span class=secno>2.7.2.3 </span>HTMLFormControlsCollection</h5>
+
+ <p>The <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> interface represents
+ a <a href=#collections title=collections>collection</a> of <a href=#category-listed title=category-listed>listed elements</a> in <code><a href=#the-form-element>form</a></code>
+ and <code><a href=#the-fieldset-element>fieldset</a></code> elements.</p>
+
+ <pre class=idl>interface <dfn id=htmlformcontrolscollection>HTMLFormControlsCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
+ // inherits <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
+ caller getter object <a href=#dom-htmlformcontrolscollection-nameditem title=dom-HTMLFormControlsCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
+};
+
+interface <dfn id=radionodelist>RadioNodeList</dfn> : <a href=#nodelist>NodeList</a> {
+ attribute DOMString <a href=#dom-radionodelist-value title=dom-RadioNodeList-value>value</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
+ <dd>
+ <p>Returns the number of elements in the collection.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">index</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLFormControlsCollection-namedItem><a href=#dom-htmlformcontrolscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">radioNodeList</var> = <var title="">collection</var> . <code title=dom-HTMLFormControlsCollection-namedItem><a href=#dom-htmlformcontrolscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">name</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">name</var>)</dt>
+ <dd>
+ <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> <var title="">name</var> from the collection.</p>
+ <p>If there are multiple matching items, then a <code><a href=#radionodelist>RadioNodeList</a></code> object containing all those elements is returned.</p>
+ <p>Returns null if no element with that <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> could be found.</p>
+ </dd>
+
+ <dt><var title="">radioNodeList</var> . <var title="">value</var> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the value of the first checked radio button represented by the object.</p>
+ <p>Can be set, to check the first radio button with the given value represented by the object.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are as defined for <code><a href=#htmlcollection>HTMLCollection</a></code>
+ objects.</p>
+
+ <p>The <span>names of the supported named properties</span> consist
+ of the values of all the <code title=attr-id><a href=#the-id-attribute>id</a></code> and <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attributes of all the elements
+ <a href=#represented-by-the-collection>represented by the collection</a>.</p>
+
+ <p>The <dfn id=dom-htmlformcontrolscollection-nameditem title=dom-HTMLFormControlsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must act according to the
+ following algorithm:</p>
+
+ <ol><li>If, at the time the method is called, there is exactly one node
+ in the collection that has either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute equal to <var title="">name</var>, then return that node and stop the
+ algorithm.</li>
+
+ <li>Otherwise, if there are no nodes in the collection that have
+ either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute equal to <var title="">name</var>, then return null and stop the algorithm.</li>
+
+ <li>Otherwise, create a new <code><a href=#radionodelist>RadioNodeList</a></code> object
+ representing a <a href=#live>live</a> view of the
+ <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> object, further filtered so
+ that the only nodes in the <code><a href=#radionodelist>RadioNodeList</a></code> object are
+ those that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute
+ or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute equal to <var title="">name</var>. The nodes in the <code><a href=#radionodelist>RadioNodeList</a></code>
+ object must be sorted in <a href=#tree-order>tree order</a>.</li>
+
+ <li>Return that <code><a href=#radionodelist>RadioNodeList</a></code> object.</li>
+
+ </ol><hr><p>Members of the <code><a href=#radionodelist>RadioNodeList</a></code> interface inherited
+ from the <code><a href=#nodelist>NodeList</a></code> interface must behave as they would
+ on a <code><a href=#nodelist>NodeList</a></code> object.</p>
+
+ <p>The <dfn id=dom-radionodelist-value title=dom-RadioNodeList-value><code>value</code></dfn>
+ IDL attribute on the <code><a href=#radionodelist>RadioNodeList</a></code> object, on getting,
+ must return the value returned by running the following steps:</p>
+
+ <ol><li><p>Let <var title="">element</var> be the first element in
+ <a href=#tree-order>tree order</a> represented by the
+ <code><a href=#radionodelist>RadioNodeList</a></code> object that is an <code><a href=#the-input-element>input</a></code>
+ element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute
+ is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a>
+ state and whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>
+ is true. Otherwise, let it be null.</li>
+
+ <li><p>If <var title="">element</var> is null, or if it is an
+ element with no <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+ attribute, return the empty string.</li>
+
+ <li><p>Otherwise, return the value of <var title="">element</var>'s
+ <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute.</li>
+
+ </ol><p>On setting, the <code title=dom-RadioNodeList-value><a href=#dom-radionodelist-value>value</a></code> IDL attribute must run
+ the following steps:</p>
+
+ <ol><li><p>Let <var title="">element</var> be the first element in
+ <a href=#tree-order>tree order</a> represented by the
+ <code><a href=#radionodelist>RadioNodeList</a></code> object that is an <code><a href=#the-input-element>input</a></code>
+ element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute
+ is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a>
+ state and whose <code title=attr-input-value><a href=#attr-input-value>value</a></code> content
+ attribute is present and equal to the new value, if any. Otherwise,
+ let it be null.</li>
+
+ <li><p>If <var title="">element</var> is not null, then set its
+ <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to true.</p>
+
+ </ol><!--
+http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
+--></div>
+
+
+ <h5 id=htmloptionscollection-0><span class=secno>2.7.2.4 </span>HTMLOptionsCollection</h5>
+
+ <p>The <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> interface represents a
+ list of <code><a href=#the-option-element>option</a></code> elements. It is always rooted on a
+ <code><a href=#the-select-element>select</a></code> element and has attributes and methods that
+ manipulate that element's descendants.</p>
+
+ <pre class=idl>interface <dfn id=htmloptionscollection>HTMLOptionsCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
+ // inherits <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
+ attribute unsigned long <a href=#dom-htmloptionscollection-length title=dom-HTMLOptionsCollection-length>length</a>; // overrides inherited length
+ caller getter object <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
+ void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in optional <a href=#htmlelement>HTMLElement</a> before);
+ void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in long before);
+ void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>(in long index);
+};</pre>
+
+ <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLOptionsCollection-length><a href=#dom-htmloptionscollection-length>length</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the number of elements in the collection.</p>
+ <p>When set to a smaller number, truncates the number of <code><a href=#the-option-element>option</a></code> elements in the corresponding container.</p>
+ <p>When set to a greater number, adds new blank <code><a href=#the-option-element>option</a></code> elements to that container.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">index</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLOptionsCollection-namedItem><a href=#dom-htmloptionscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">nodeList</var> = <var title="">collection</var> . <code title=dom-HTMLOptionsCollection-namedItem><a href=#dom-htmloptionscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">name</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">name</var>)</dt>
+ <dd>
+ <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or <code title=attr-option-name><a href=#attr-option-name>name</a></code> <var title="">name</var> from the collection.</p>
+ <p>If there are multiple matching items, then a <code><a href=#nodelist>NodeList</a></code> object containing all those elements is returned.</p>
+ <p>Returns null if no element with that <a href=#concept-id title=concept-id>ID</a> could be found.</p>
+ </dd>
+
+ <dt><var title="">collection</var> . <code title=dom-HTMLOptionsCollection-add><a href=#dom-htmloptionscollection-add>add</a></code>(<var title="">element</var> [, <var title="">before</var> ] )</dt>
+ <dd>
+ <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>
+ <p>The <var title="">before</var> argument can be a number, in
+ which case <var title="">element</var> is inserted before the item
+ with that number, or an element from the collection, in which case
+ <var title="">element</var> is inserted before that element.</p>
+ <p>If <var title="">before</var> is omitted, null, or a number out
+ of range, then <var title="">element</var> will be added at the
+ end of the list.</p>
+ <p>This method will throw a <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code>
+ exception if <var title="">element</var> is an ancestor of the
+ element into which it is to be inserted. If <var title="">element</var> is not an <code><a href=#the-option-element>option</a></code> or
+ <code><a href=#the-optgroup-element>optgroup</a></code> element, then the method does nothing.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are as defined for <code><a href=#htmlcollection>HTMLCollection</a></code>
+ objects.</p>
+
+ <p>On getting, the <dfn id=dom-htmloptionscollection-length title=dom-HTMLOptionsCollection-length><code>length</code></dfn>
+ attribute must return the number of nodes <a href=#represented-by-the-collection>represented by the
+ collection</a>.</p>
+
+ <p>On setting, the behavior depends on whether the new value is
+ equal to, greater than, or less than the number of nodes
+ <a href=#represented-by-the-collection>represented by the collection</a> at that time. If the
+ number is the same, then setting the attribute must do nothing. If
+ the new value is greater, then <var title="">n</var> new
+ <code><a href=#the-option-element>option</a></code> elements with no attributes and no child nodes
+ must be appended to the <code><a href=#the-select-element>select</a></code> element on which the
+ <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted, where <var title="">n</var> is the difference between the two numbers (new
+ value minus old value). Mutation events must be fired as if a
+ <code><a href=#documentfragment>DocumentFragment</a></code> containing the new <code><a href=#the-option-element>option</a></code>
+ elements had been inserted. If the new value is lower, then the
+ last <var title="">n</var> nodes in the collection must be removed
+ from their parent nodes, where <var title="">n</var> is the
+ difference between the two numbers (old value minus new value).</p>
+
+ <p class=note>Setting <code title=dom-HTMLOptionsCollection-length><a href=#dom-htmloptionscollection-length>length</a></code> never removes
+ or adds any <code><a href=#the-optgroup-element>optgroup</a></code> elements, and never adds new
+ children to existing <code><a href=#the-optgroup-element>optgroup</a></code> elements (though it can
+ remove children from them).</p>
+
+ <p>The <span>names of the supported named properties</span> consist
+ of the values of all the <code title=attr-id><a href=#the-id-attribute>id</a></code> and <code title=attr-option-name><a href=#attr-option-name>name</a></code> attributes of all the elements
+ <a href=#represented-by-the-collection>represented by the collection</a>.</p>
+
+ <p>The <dfn id=dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must act according to the
+ following algorithm:</p>
+
+ <ol><li>If, at the time the method is called, there is exactly one node
+ in the collection that has either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>, then return that node and stop the
+ algorithm.</li>
+
+ <li>Otherwise, if there are no nodes in the collection that have
+ either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>, then return null and stop the algorithm.</li>
+
+ <!-- IE returns an HTMLCollection instead; we may need to change to that for compat -->
+ <li>Otherwise, create a new <code><a href=#nodelist>NodeList</a></code> object
+ representing a <a href=#live>live</a> view of the
+ <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> object, further filtered so that
+ the only nodes in the <code><a href=#nodelist>NodeList</a></code> object are those that
+ have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>. The nodes in the <code><a href=#nodelist>NodeList</a></code> object
+ must be sorted in <a href=#tree-order>tree order</a>.</li>
+
+ <li>Return that <code><a href=#nodelist>NodeList</a></code> object.</li>
+
+ </ol><p>The <dfn id=dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add><code>add(<var title="">element</var>, <var title="">before</var>)</code></dfn>
+ method must act according to the following algorithm:</p>
+
+ <ol><li><p>If <var title="">element</var> is not an <code><a href=#the-option-element>option</a></code>
+ or <code><a href=#the-optgroup-element>optgroup</a></code> element, then return and abort these
+ steps.</li>
+
+ <li><p>If <var title="">element</var> is an ancestor of the
+ <code><a href=#the-select-element>select</a></code> element on which the
+ <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted, then throw a
+ <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> exception.</li>
+
+ <li><p>If <var title="">before</var> is an element, but that
+ element isn't a descendant of the <code><a href=#the-select-element>select</a></code> element on
+ which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted, then throw
+ a <code><a href=#not_found_err>NOT_FOUND_ERR</a></code> exception.</li>
+
+ <li><p>If <var title="">element</var> and <var title="">before</var> are the same element, then return and abort
+ these steps.</li>
+
+ <li><p>If <var title="">before</var> is a node, then let <var title="">reference</var> be that node. Otherwise, if <var title="">before</var> is an integer, and there is a <var title="">before</var>th node in the collection, let <var title="">reference</var> be that node. Otherwise, let <var title="">reference</var> be null.</li>
+
+ <li><p>If <var title="">reference</var> is not null, let <var title="">parent</var> be the parent node of <var title="">reference</var>. Otherwise, let <var title="">parent</var>
+ be the <code><a href=#the-select-element>select</a></code> element on which the
+ <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted.</li>
+
+ <li><p>Act as if the DOM Core <code title=dom-Node-insertBefore><a href=#dom-node-insertbefore>insertBefore()</a></code> method was
+ invoked on the <var title="">parent</var> node, with <var title="">element</var> as the first argument and <var title="">reference</var> as the second argument.</p>
+
+ </ol><p>The <dfn id=dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove><code>remove(<var title="">index</var>)</code></dfn> method must act according to
+ the following algorithm:</p>
+
+ <ol><li><p>If the number of nodes <a href=#represented-by-the-collection>represented by the
+ collection</a> is zero, abort these steps.</li>
+
+ <li><p>If <var title="">index</var> is not a number greater than or
+ equal to 0 and less than the number of nodes <a href=#represented-by-the-collection>represented by
+ the collection</a>, let <var title="">element</var> be the first
+ element in the collection. Otherwise, let <var title="">element</var> be the <var title="">index</var>th element
+ in the collection.</li>
+
+ <li><p>Remove <var title="">element</var> from its parent
+ node.</li>
+
+ </ol><!-- see also http://ln.hixie.ch/?start=1161042744&count=1 --></div>
+
+
+ <div data-component="HTML Microdata (editor: Ian Hickson)">
+
+<!--FIXUP microdata -1-->
+ <h5 id=htmlpropertiescollection-0><span class=secno>2.7.2.5 </span>HTMLPropertiesCollection</h5>
+<!--FIXUP microdata +1-->
+
+ <p>The <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> interface represents a
+ <a href=#collections title=collections>collection</a> of elements that add
+ name-value pairs to a particular <a href=#concept-item title=concept-item>item</a> in the <a href=#microdata>microdata</a>
+ model.</p>
+
+ <pre class=idl>interface <dfn id=htmlpropertiescollection>HTMLPropertiesCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
+ // inherits <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
+ caller getter <a href=#propertynodelist>PropertyNodeList</a> <a href=#dom-htmlpropertiescollection-nameditem title=dom-HTMLPropertiesCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
+ readonly attribute <span>DOMStringList</span> <a href=#dom-htmlpropertiescollection-names title=dom-HTMLPropertiesCollection-names>names</a>;
+};
+
+typedef sequence&lt;any&gt; <dfn id=propertyvaluearray>PropertyValueArray</dfn>;
+
+interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <a href=#nodelist>NodeList</a> {
+ readonly attribute <a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-values title=dom-PropertyNodeList-values>values</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
+ <dd>
+ <p>Returns the number of elements in the collection.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">index</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Returns the element with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+ </dd>
+
+ <dt><var title="">propertyNodeList</var> = <var title="">collection</var> . <code title=dom-HTMLPropertiesCollection-namedItem><a href=#dom-htmlpropertiescollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">collection</var>[<var title="">name</var>]</dt>
+ <dt><var title="">collection</var>(<var title="">name</var>)</dt>
+ <dd>
+ <p>Returns a <code><a href=#propertynodelist>PropertyNodeList</a></code> object containing any elements that add a property named <var title="">name</var>.</p>
+ </dd>
+
+ <dt><var title="">collection</var> . <code title=dom-HTMLPropertiesCollection-names><a href=#dom-htmlpropertiescollection-names>names</a></code></dt>
+ <dd>
+ <p>Returns a <code>DOMStringList</code> with the <a href=#property-names>property names</a> of the elements in the collection.</p>
+ </dd>
+
+ <dt><var title="">propertyNodeList</var> . <code title=dom-PropertyNodeList-values><a href=#dom-propertynodelist-values>values</a></code></dt>
+ <dd>
+ <p>Returns an array of the various values that the relevant elements have.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are as defined for <code><a href=#htmlcollection>HTMLCollection</a></code>
+ objects.</p>
+
+ <p>The <span>names of the supported named properties</span> consist
+ of the <a href=#property-names>property names</a> of all the elements
+ <a href=#represented-by-the-collection>represented by the collection</a>.</p>
+
+ <p>The <dfn id=dom-htmlpropertiescollection-names title=dom-HTMLPropertiesCollection-names><code>names</code></dfn>
+ attribute must return a <a href=#live>live</a> <code>DOMStringList</code>
+ object giving the <a href=#property-names>property names</a> of all the elements
+ <a href=#represented-by-the-collection>represented by the collection</a>, listed in <a href=#tree-order>tree
+ order</a>, but with duplicates removed, leaving only the first
+ occurrence of each name. The same object must be returned each
+ time.</p>
+
+ <p>The <dfn id=dom-htmlpropertiescollection-nameditem title=dom-HTMLPropertiesCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must return a
+ <code><a href=#propertynodelist>PropertyNodeList</a></code> object representing a
+ <a href=#live>live</a> view of the <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code>
+ object, further filtered so that the only nodes in the
+ <code><a href=#propertynodelist>PropertyNodeList</a></code> object are those that have a <a href=#property-names title="property names">property name</a> equal to <var title="">name</var>. The nodes in the <code><a href=#propertynodelist>PropertyNodeList</a></code>
+ object must be sorted in <a href=#tree-order>tree order</a>, and the same
+ object must be returned each time a particular <var title="">name</var> is queried.</p>
+
+ <hr><p>Members of the <code><a href=#propertynodelist>PropertyNodeList</a></code> interface inherited
+ from the <code><a href=#nodelist>NodeList</a></code> interface must behave as they would
+ on a <code><a href=#nodelist>NodeList</a></code> object.</p>
+
+ <p>The <dfn id=dom-propertynodelist-values title=dom-PropertyNodeList-values><code>values</code></dfn>
+ IDL attribute on the <code><a href=#propertynodelist>PropertyNodeList</a></code> object, on
+ getting, must return a newly constructed array whose values are the
+ values obtained from the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> DOM property of each of the
+ elements represented by the object, in <a href=#tree-order>tree order</a>.</p>
+
+ </div>
+
+ </div><!--data-component-->
+
+
+
+ <h4 id=domtokenlist-0><span class=secno>2.7.3 </span>DOMTokenList</h4>
+
+ <p>The <code><a href=#domtokenlist>DOMTokenList</a></code> interface represents an interface
+ to an underlying string that consists of a <a href=#set-of-space-separated-tokens>set of
+ space-separated tokens</a>.</p>
+
+ <p class=note><code><a href=#domtokenlist>DOMTokenList</a></code> objects are always
+ <a href=#case-sensitive>case-sensitive</a>, even when the underlying string might
+ ordinarily be treated in a case-insensitive manner.</p>
+
+ <pre class=idl>interface <dfn id=domtokenlist>DOMTokenList</dfn> {
+ readonly attribute unsigned long <a href=#dom-tokenlist-length title=dom-tokenlist-length>length</a>;
+ getter DOMString <a href=#dom-tokenlist-item title=dom-tokenlist-item>item</a>(in unsigned long index);
+ boolean <a href=#dom-tokenlist-contains title=dom-tokenlist-contains>contains</a>(in DOMString token);
+ void <a href=#dom-tokenlist-add title=dom-tokenlist-add>add</a>(in DOMString token);
+ void <a href=#dom-tokenlist-remove title=dom-tokenlist-remove>remove</a>(in DOMString token);
+ boolean <a href=#dom-tokenlist-toggle title=dom-tokenlist-toggle>toggle</a>(in DOMString token);
+ <a href=#dom-tokenlist-tostring title=dom-tokenlist-toString>stringifier</a> DOMString ();
+};</pre>
+
+ <dl class=domintro><dt><var title="">tokenlist</var> . <code title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></code></dt>
+ <dd>
+ <p>Returns the number of tokens in the string.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-item><a href=#dom-tokenlist-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">tokenlist</var>[<var title="">index</var>]</dt>
+ <dd>
+ <p>Returns the token with index <var title="">index</var>. The tokens are returned in the order they are found in the underlying string.</p>
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+ </dd>
+
+ <dt><var title="">hastoken</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-contains><a href=#dom-tokenlist-contains>contains</a></code>(<var title="">token</var>)</dt>
+ <dd>
+ <p>Returns true if the <var title="">token</var> is present; false otherwise.</p>
+ <p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if <var title="">token</var> is empty.</p>
+ <p>Throws an <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception if <var title="">token</var> contains any spaces.</p>
+ </dd>
+
+ <dt><var title="">tokenlist</var> . <code title=dom-tokenlist-add><a href=#dom-tokenlist-add>add</a></code>(<var title="">token</var>)</dt>
+ <dd>
+ <p>Adds <var title="">token</var>, unless it is already present.</p>
+ <p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if <var title="">token</var> is empty.</p>
+ <p>Throws an <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception if <var title="">token</var> contains any spaces.</p>
+ </dd>
+
+ <dt><var title="">tokenlist</var> . <code title=dom-tokenlist-remove><a href=#dom-tokenlist-remove>remove</a></code>(<var title="">token</var>)</dt>
+ <dd>
+ <p>Removes <var title="">token</var> if it is present.</p>
+ <p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if <var title="">token</var> is empty.</p>
+ <p>Throws an <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception if <var title="">token</var> contains any spaces.</p>
+ </dd>
+
+ <dt><var title="">hastoken</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-toggle><a href=#dom-tokenlist-toggle>toggle</a></code>(<var title="">token</var>)</dt>
+ <dd>
+ <p>Adds <var title="">token</var> if it is not present, or removes
+ it if it is. Returns true if <var title="">token</var> is now
+ present (it was added); returns false if it is not (it was
+ removed).</p>
+ <p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if <var title="">token</var> is empty.</p>
+ <p>Throws an <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception if <var title="">token</var> contains any spaces.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-tokenlist-length title=dom-tokenlist-length><code>length</code></dfn>
+ attribute must return the number of tokens that result from <a href=#split-a-string-on-spaces title="split a string on spaces">splitting the underlying string on
+ spaces</a>. This is the <var title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></var>.</p>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are the numbers in the range zero to <span title=""><var title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></var>-1</span>, unless the <var title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></var> is zero, in which case
+ there are no <span>supported indexed properties</span>.</p>
+
+ <p>The <dfn id=dom-tokenlist-item title=dom-tokenlist-item><code>item(<var title="">index</var>)</code></dfn> method must <a href=#split-a-string-on-spaces title="split a
+ string on spaces">split the underlying string on spaces</a>,
+ preserving the order of the tokens as found in the underlying
+ string, and then return the <var title="">index</var>th item in this
+ list. If <var title="">index</var> is equal to or greater than the
+ number of tokens, then the method must return null.</p>
+
+ <p class=example>For example, if the string is "<code title="">a b
+ a c</code>" then there are four tokens: the token with index 0 is
+ "<code title="">a</code>", the token with index 1 is "<code title="">b</code>", the token with index 2 is "<code title="">a</code>", and the token with index 3 is "<code title="">c</code>".</p>
+
+ <p>The <dfn id=dom-tokenlist-contains title=dom-tokenlist-contains><code>contains(<var title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol><li>If the <var title="">token</var> argument is the empty string,
+ then raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>If the <var title="">token</var> argument contains any <a href=#space-character title="space character">space characters</a>, then raise an
+ <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <a href=#split-a-string-on-spaces title="split a string on spaces">split the
+ underlying string on spaces</a> to get the list of tokens in the
+ object's underlying string.</li>
+
+ <li>If the token indicated by <var title="">token</var> is a
+ <a href=#case-sensitive>case-sensitive</a> match for one of the tokens in the
+ object's underlying string then return true and stop this
+ algorithm.</li>
+
+ <li>Otherwise, return false.</li>
+
+ </ol><p>The <dfn id=dom-tokenlist-add title=dom-tokenlist-add><code>add(<var title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol><li>If the <var title="">token</var> argument is the empty string,
+ then raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>If the <var title="">token</var> argument contains any <a href=#space-character title="space character">space characters</a>, then raise an
+ <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <a href=#split-a-string-on-spaces title="split a string on spaces">split the
+ underlying string on spaces</a> to get the list of tokens in the
+ object's underlying string.</li>
+
+ <li>If the given <var title="">token</var> is a
+ <a href=#case-sensitive>case-sensitive</a> match for one of the tokens in the
+ <code><a href=#domtokenlist>DOMTokenList</a></code> object's underlying string then stop the
+ algorithm.</li>
+
+ <li>Otherwise, if the <code><a href=#domtokenlist>DOMTokenList</a></code> object's underlying
+ string is not the empty string and the last character of that
+ string is not a <a href=#space-character>space character</a>, then append a U+0020
+ SPACE character to the end of that string.</li>
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code><a href=#domtokenlist>DOMTokenList</a></code> object's underlying string.</li>
+
+ </ol><p>The <dfn id=dom-tokenlist-remove title=dom-tokenlist-remove><code>remove(<var title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol><li>If the <var title="">token</var> argument is the empty string,
+ then raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>If the <var title="">token</var> argument contains any <a href=#space-character title="space character">space characters</a>, then raise an
+ <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <a href=#remove-a-token-from-a-string title="remove a token from a string">remove
+ the given <var title="">token</var> from the underlying
+ string</a>.</li>
+
+ </ol><p>The <dfn id=dom-tokenlist-toggle title=dom-tokenlist-toggle><code>toggle(<var title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol><li>If the <var title="">token</var> argument is the empty string,
+ then raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>If the <var title="">token</var> argument contains any <a href=#space-character title="space character">space characters</a>, then raise an
+ <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <a href=#split-a-string-on-spaces title="split a string on spaces">split the
+ underlying string on spaces</a> to get the list of tokens in the
+ object's underlying string.</li>
+
+ <li>If the given <var title="">token</var> is a
+ <a href=#case-sensitive>case-sensitive</a> match for one of the tokens in the
+ <code><a href=#domtokenlist>DOMTokenList</a></code> object's underlying string then <a href=#remove-a-token-from-a-string title="remove a token from a string">remove the given <var title="">token</var> from the underlying string</a> and stop the
+ algorithm, returning false.</li>
+
+ <li>Otherwise, if the <code><a href=#domtokenlist>DOMTokenList</a></code> object's underlying
+ string is not the empty string and the last character of that
+ string is not a <a href=#space-character>space character</a>, then append a U+0020
+ SPACE character to the end of that string.</li>
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code><a href=#domtokenlist>DOMTokenList</a></code> object's underlying string.</li>
+
+ <li>Return true.</li>
+
+ </ol><p>Objects implementing the <code><a href=#domtokenlist>DOMTokenList</a></code> interface must
+ <dfn id=dom-tokenlist-tostring title=dom-tokenlist-toString>stringify</dfn> to the object's
+ underlying string representation.</p>
+
+ </div>
+
+
+ <h4 id=domsettabletokenlist-0><span class=secno>2.7.4 </span>DOMSettableTokenList</h4>
+
+ <p>The <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code> interface is the same as the
+ <code><a href=#domtokenlist>DOMTokenList</a></code> interface, except that it allows the
+ underlying string to be directly changed.</p>
+
+ <pre class=idl>interface <dfn id=domsettabletokenlist>DOMSettableTokenList</dfn> : <a href=#domtokenlist>DOMTokenList</a> {
+ attribute DOMString <a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">tokenlist</var> . <code title=dom-DOMSettableTokenList-value><a href=#dom-domsettabletokenlist-value>value</a></code></dt>
+ <dd>
+ <p>Returns the underlying string.</p>
+ <p>Can be set, to change the underlying string.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>An object implementing the <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code>
+ interface must act as defined for the <code><a href=#domtokenlist>DOMTokenList</a></code>
+ interface, except for the <code title=dom-DOMSettableTokenList-value><a href=#dom-domsettabletokenlist-value>value</a></code> attribute defined
+ here.</p>
+
+ <p>The <dfn id=dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value><code>value</code></dfn>
+ attribute must return the underlying string on getting, and must
+ replace the underlying string with the new value on setting.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=safe-passing-of-structured-data><span class=secno>2.7.5 </span>Safe passing of structured data</h4>
+
+ <p>When a user agent is required to obtain a <dfn id=structured-clone>structured
+ clone</dfn> of an object, it must run the following algorithm, which
+ either returns a separate object, or throws an exception.</p>
+
+ <ol><li><p>Let <var title="">input</var> be the object being
+ cloned.</li>
+
+ <li><p>Let <var title="">memory</var> be a list of objects,
+ initially empty. (This is used to catch cycles.)</li>
+
+ <li><p>Let <var title="">output</var> be the object resulting from
+ calling the <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> with
+ <var title="">input</var> and <var title="">memory</var>.</li>
+
+ <li><p>Return <var title="">output</var>.</li>
+
+ </ol><p>The <dfn id=internal-structured-cloning-algorithm>internal structured cloning algorithm</dfn> is always
+ called with two arguments, <var title="">input</var> and <var title="">memory</var>, and its behavior depends on the type of <var title="">input</var>, as follows:</p>
+
+ <dl class=switch><dt>If <var title="">input</var> is the undefined value</dt>
+
+ <dd><p>Return the undefined value.</dd>
+
+ <dt>If <var title="">input</var> is the null value</dt>
+
+ <dd><p>Return the null value.</dd>
+
+ <dt>If <var title="">input</var> is the false value</dt>
+
+ <dd><p>Return the false value.</dd>
+
+ <dt>If <var title="">input</var> is the true value</dt>
+
+ <dd><p>Return the true value.</dd>
+
+ <dt>If <var title="">input</var> is a Number object</dt>
+
+ <dd><p>Return a newly constructed Number object with the same value as <var title="">input</var>.</dd>
+
+ <dt>If <var title="">input</var> is a String object</dt>
+
+ <dd><p>Return a newly constructed String object with the same value as <var title="">input</var>.</dd>
+
+ <dt>If <var title="">input</var> is a <code>Date</code> object</dt>
+
+ <dd><p>Return a newly constructed <code>Date</code> object with the same value as <var title="">input</var>.</dd>
+
+ <dt>If <var title="">input</var> is a <code>RegExp</code> object</dt>
+
+ <dd>
+
+ <p>Return a newly constructed <code>RegExp</code> object with the same pattern and flags as <var title="">input</var>.</p>
+
+ <p class=note>The value of the <code title="">lastIndex</code> property is not copied.</p>
+
+ </dd>
+
+ <dt>If <var title="">input</var> is a <code><a href=#imagedata>ImageData</a></code> object</dt>
+
+ <dd><p>Return a newly constructed <code><a href=#imagedata>ImageData</a></code> object
+ with the same <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> and
+ <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> as <var title="">input</var>, and with a newly constructed
+ <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> for its <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute, with the same
+ <code title=dom-canvaspixelarray-length><a href=#dom-canvaspixelarray-length>length</a></code> and pixel
+ values as the <var title="">input</var>'s.</dd>
+
+ <dt>If <var title="">input</var> is a <code>File</code> object</dt>
+
+ <dd><p>Return a newly constructed <code>File</code> object corresponding to the same underlying data.</dd>
+
+ <dt>If <var title="">input</var> is a <code>Blob</code> object</dt>
+
+ <dd><p>Return a newly constructed <code>Blob</code> object corresponding to the same underlying data.</dd>
+
+ <dt>If <var title="">input</var> is a <code>FileList</code> object</dt>
+
+ <dd><p>Return a newly constructed <code>FileList</code> object containing a list of newly constructed <code>File</code> objects corresponding to the same underlying data as those in <var title="">input</var>, maintaining their relative order.</dd>
+
+ <dt>If <var title="">input</var> is an Array object</dt>
+ <dt>If <var title="">input</var> is an Object object</dt>
+
+ <dd>
+
+ <ol><li><p>If <var title="">input</var> is in <var title="">memory</var>, then throw a
+ <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception and abort the overall
+ <a href=#structured-clone>structured clone</a> algorithm.</li>
+
+ <li><p>Otherwise, let <var title="">new memory</var> be a list
+ consisting of the items in <var title="">memory</var> with the
+ addition of <var title="">input</var>.</li>
+
+ <li><p>Create a new object, <var title="">output</var>, of the
+ same type as <var title="">input</var>: either an Array or an
+ Object.</li>
+
+ <li>
+
+ <p>For each enumerable property in <var title="">input</var>,
+ add a corresponding property to <var title="">output</var>
+ having the same name, and having a value created from invoking
+ the <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a>
+ recursively with the value of the property as the "<var title="">input</var>" argument and <var title="">new
+ memory</var> as the "<var title="">memory</var>" argument. The
+ order of the properties in the <var title="">input</var> and
+ <var title="">output</var> objects must be the same.</p>
+
+ <p class=note>This does not walk the prototype chain.</p>
+
+ </li>
+
+ <li><p>Return <var title="">output</var>.</li>
+
+ </ol></dd>
+
+ <dt>If <var title="">input</var> is another native object type (e.g. <code>Error</code>)</dt>
+ <dt>If <var title="">input</var> is a host object (e.g. a DOM node)</dt>
+
+ <dd><p>Throw a <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception and abort
+ the overall <a href=#structured-clone>structured clone</a> algorithm.</dd>
+
+ </dl></div>
+
+
+ <h4 id=domstringmap-0><span class=secno>2.7.6 </span>DOMStringMap</h4>
+
+ <p>The <code><a href=#domstringmap>DOMStringMap</a></code> interface represents a set of
+ name-value pairs. It exposes these using the scripting language's
+ native mechanisms for property access.</p>
+
+ <div class=impl>
+
+ <p>When a <code><a href=#domstringmap>DOMStringMap</a></code> object is instantiated, it is
+ associated with three algorithms, one for getting the list of
+ name-value pairs, one for setting names to certain values, and one
+ for deleting names.</p>
+
+ <pre class=idl>interface <dfn id=domstringmap>DOMStringMap</dfn> {
+ getter DOMString (in DOMString name);
+ setter void (in DOMString name, in DOMString value);
+ creator void (in DOMString name, in DOMString value);
+ deleter void (in DOMString name);
+};</pre>
+
+ <p>The <span>names of the supported named properties</span> on a
+ <code><a href=#domstringmap>DOMStringMap</a></code> object at any instant are the names of
+ each pair returned from the algorithm for getting the list of
+ name-value pairs at that instant.</p>
+
+ <p>When a <code><a href=#domstringmap>DOMStringMap</a></code> object is indexed to retrieve a
+ named property <var title="">name</var>, the value returned must be
+ the value component of the name-value pair whose name component is
+ <var title="">name</var> in the list returned by the algorithm for
+ getting the list of name-value pairs.</p>
+
+ <p>When a <code><a href=#domstringmap>DOMStringMap</a></code> object is indexed to create or
+ modify a named property <var title="">name</var> with value <var title="">value</var>, the algorithm for setting names to certain
+ values must be run, passing <var title="">name</var> as the name and
+ the result of converting <var title="">value</var> to a
+ <code>DOMString</code> as the value.</p>
+
+ <p>When a <code><a href=#domstringmap>DOMStringMap</a></code> object is indexed to delete a
+ named property named <var title="">name</var>, the algorithm for
+ deleting names must be run, passing <var title="">name</var> as the
+ name.</p>
+
+ <p class=note>The <code><a href=#domstringmap>DOMStringMap</a></code> interface definition
+ here is only intended for JavaScript environments. Other language
+ bindings will need to define how <code><a href=#domstringmap>DOMStringMap</a></code> is to be
+ implemented for those languages.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The <code title=dom-dataset><a href=#dom-dataset>dataset</a></code> attribute on
+ elements exposes the <code title=attr-data-*><a href=#attr-data-*>data-*</a></code>
+ attributes on the element.</p>
+
+ <p>Given the following fragment and elements with similar
+ constructions:</p>
+
+ <pre>&lt;img class="tower" id="tower5" data-x="12" data-y="5"
+ data-ai="robotarget" data-hp="46" data-ability="flames"
+ src="towers/rocket.png alt="Rocket Tower"&gt;</pre>
+
+ <p>...one could imagine a function <code title="">splashDamage()</code> that takes some arguments, the first
+ of which is the element to process:</p>
+
+ <pre>function splashDamage(node, x, y, damage) {
+ if (node.classList.contains('tower') &amp;&amp; // checking the 'class' attribute
+ node.dataset.x == x &amp;&amp; // reading the 'data-x' attribute
+ node.dataset.y == y) { // reading the 'data-y' attribute
+ var hp = parseInt(node.dataset.hp); // reading the 'data-hp' attribute
+ hp = hp - damage;
+ if (hp &lt; 0) {
+ hp = 0;
+ node.dataset.ai = 'dead'; // setting the 'data-ai' attribute
+ delete node.dataset.ability; // removing the 'data-ability' attribute
+ }
+ node.dataset.hp = hp; // setting the 'data-hp' attribute
+ }
+}</pre>
+
+ </div>
+
+
+ <h4 id=dom-feature-strings><span class=secno>2.7.7 </span>DOM feature strings</h4>
+
+ <p>DOM3 Core defines mechanisms for checking for interface support,
+ and for obtaining implementations of interfaces, using <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures>feature
+ strings</a>. <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <p>Authors are strongly discouraged from using these, as they are
+ notoriously unreliable and imprecise. Authors are encouraged to rely
+ on explicit feature testing or the graceful degradation behavior
+ intrinsic to some of the features in this specification.</p>
+
+ <div class=impl>
+
+ <p>For historical reasons, user agents should return the true value
+ when the <dfn id=hasfeature title=hasFeature><code>hasFeature(<var title="">feature</var>, <var title="">version</var>)</code></dfn>
+ method of the <code><a href=#domimplementation>DOMImplementation</a></code> interface is invoked
+ with <var title="">feature</var> set to either "<code title="">HTML</code>" or "<code title="">XHTML</code>" and <var title="">version</var> set to either "<code>1.0</code>" or
+ "<code>2.0</code>".</p>
+
+ </div>
+
+
+ <h4 id=exceptions><span class=secno>2.7.8 </span>Exceptions</h4>
+
+ <p>The following are <code><a href=#domexception>DOMException</a></code> codes. <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <ol class=brief><li value=1><dfn id=index_size_err><code>INDEX_SIZE_ERR</code></dfn></li>
+ <li value=2><dfn id=domstring_size_err><code>DOMSTRING_SIZE_ERR</code></dfn></li>
+ <li value=3><dfn id=hierarchy_request_err><code>HIERARCHY_REQUEST_ERR</code></dfn></li>
+ <li value=4><dfn id=wrong_document_err><code>WRONG_DOCUMENT_ERR</code></dfn></li>
+ <li value=5><dfn id=invalid_character_err><code>INVALID_CHARACTER_ERR</code></dfn></li>
+ <li value=6><dfn id=no_data_allowed_err><code>NO_DATA_ALLOWED_ERR</code></dfn></li>
+ <li value=7><dfn id=no_modification_allowed_err><code>NO_MODIFICATION_ALLOWED_ERR</code></dfn></li>
+ <li value=8><dfn id=not_found_err><code>NOT_FOUND_ERR</code></dfn></li>
+ <li value=9><dfn id=not_supported_err><code>NOT_SUPPORTED_ERR</code></dfn></li>
+ <li value=10><dfn id=inuse_attribute_err><code>INUSE_ATTRIBUTE_ERR</code></dfn></li>
+ <li value=11><dfn id=invalid_state_err><code>INVALID_STATE_ERR</code></dfn></li>
+ <li value=12><dfn id=syntax_err><code>SYNTAX_ERR</code></dfn></li>
+ <li value=13><dfn id=invalid_modification_err><code>INVALID_MODIFICATION_ERR</code></dfn></li>
+ <li value=14><dfn id=namespace_err><code>NAMESPACE_ERR</code></dfn></li>
+ <li value=15><dfn id=invalid_access_err><code>INVALID_ACCESS_ERR</code></dfn></li>
+ <li value=16><dfn id=validation_err><code>VALIDATION_ERR</code></dfn></li>
+ <li value=17><dfn id=type_mismatch_err><code>TYPE_MISMATCH_ERR</code></dfn></li>
+ <li value=18><dfn id=security_err><code>SECURITY_ERR</code></dfn></li> <!-- actually in XHR for now -->
+ <li value=19><dfn id=network_err><code>NETWORK_ERR</code></dfn></li> <!-- actually in XHR for now -->
+ <li value=20><dfn id=abort_err><code>ABORT_ERR</code></dfn></li> <!-- actually in XHR for now -->
+ <li value=21><dfn id=url_mismatch_err><code>URL_MISMATCH_ERR</code></dfn></li> <!-- actually in workers for now -->
+ <li value=22><dfn id=quota_exceeded_err><code>QUOTA_EXCEEDED_ERR</code></dfn></li> <!-- actually defined right here for now -->
+<!--v2DATAGRID <li value="23"><dfn><code>DATAGRID_MODEL_ERR</code></dfn></li> --> <!-- actually defined right here for now -->
+ <li value=81><dfn id=parse_err><code>PARSE_ERR</code></dfn></li> <!-- actually defined in dom3ls -->
+ <li value=82><dfn id=serialize_err><code>SERIALIZE_ERR</code></dfn></li> <!-- actually defined in dom3ls -->
+ </ol><div class=impl>
+
+ <h4 id=garbage-collection><span class=secno>2.7.9 </span>Garbage collection</h4>
+
+ <p>There is an <dfn id=implied-strong-reference>implied strong reference</dfn> from any IDL
+ attribute that returns a pre-existing object to that object.</p>
+
+ <div class=example>
+
+ <p>For example, the <code>document.location</code> attribute means
+ that there is a strong reference from a <code><a href=#document>Document</a></code>
+ object to its <code><a href=#location>Location</a></code> object. Similarly, there is
+ always a strong reference from a <code><a href=#document>Document</a></code> to any
+ descendant nodes, and from any node to its owner
+ <code><a href=#document>Document</a></code>.</p>
+
+ </div>
+
+ </div>
+
+
+ <h3 id=namespaces><span class=secno>2.8 </span>Namespaces</h3>
+
+ <p>The <dfn id=html-namespace-0>HTML namespace</dfn> is: <code>http://www.w3.org/1999/xhtml</code></p>
+
+ <p>The <dfn id=mathml-namespace>MathML namespace</dfn> is: <code>http://www.w3.org/1998/Math/MathML</code></p>
+
+ <p>The <dfn id=svg-namespace>SVG namespace</dfn> is: <code>http://www.w3.org/2000/svg</code></p>
+
+ <p>The <dfn id=xlink-namespace>XLink namespace</dfn> is: <code>http://www.w3.org/1999/xlink</code></p>
+
+ <p>The <dfn id=xml-namespace>XML namespace</dfn> is: <code>http://www.w3.org/XML/1998/namespace</code></p>
+
+ <p>The <dfn id=xmlns-namespace>XMLNS namespace</dfn> is: <code>http://www.w3.org/2000/xmlns/</code></p>
+
+ <hr><p>Data mining tools and other user agents that perform operations
+ on content without running scripts, evaluating CSS or XPath
+ expressions, or otherwise exposing the resulting DOM to arbitrary
+ content, may "support namespaces" by just asserting that their DOM
+ node analogues are in certain namespaces, without actually exposing
+ the above strings.</p>
+
+
+ <h2 id=dom><span class=secno>3 </span>Semantics, structure, and APIs of HTML documents</h2>
+
+ <h3 id=documents><span class=secno>3.1 </span>Documents</h3>
+
+ <p>Every XML and HTML document in an HTML UA is represented by a
+ <code><a href=#document>Document</a></code> object. <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <p><dfn id="the-document's-address">The document's address</dfn> is an <a href=#absolute-url>absolute URL</a>
+ that is set when the <code><a href=#document>Document</a></code> is created. <dfn id="the-document's-current-address">The
+ document's current address</dfn> is an <a href=#absolute-url>absolute URL</a>
+ that can change during the lifetime of the <code><a href=#document>Document</a></code>,
+ for example when the user <a href=#navigate title=navigate>navigates</a> to
+ a <a href=#scroll-to-fragid title=navigate-fragid>fragment identifier</a> on the
+ page or when the <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> method is called
+ with a new <a href=#url>URL</a>. <span class=impl><a href="#the-document's-current-address">The document's
+ current address</a> must be set to <a href="#the-document's-address">the document's
+ address</a> when the <code><a href=#document>Document</a></code> is created.</span></p>
+
+ <p class=note>Interactive user agents typically expose <a href="#the-document's-current-address">the
+ document's current address</a> in their user interface.</p>
+
+ <p>When a <code><a href=#document>Document</a></code> is created by a <a href=#concept-script title=concept-script>script</a> using the <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>
+ or <code title=dom-DOMHTMLImplementation-createHTMLDocument><a href=#dom-domhtmlimplementation-createhtmldocument>createHTMLDocument()</a></code>
+ APIs, <a href="#the-document's-address">the document's address</a> is the same as <a href="#the-document's-address">the
+ document's address</a> of the <a href="#script's-document">script's document</a>.</p>
+
+ <p><code><a href=#document>Document</a></code> objects are assumed to be <dfn id=xml-documents>XML
+ documents</dfn> unless they are flagged as being <dfn id=html-documents>HTML
+ documents</dfn> when they are created. Whether a document is an
+ <a href=#html-documents title="HTML documents">HTML document</a> or an <a href=#xml-documents title="XML documents">XML document</a> affects the behavior of
+ certain APIs and the case-sensitivity of some selectors.</p>
+
+
+
+ <h4 id=documents-in-the-dom><span class=secno>3.1.1 </span>Documents in the DOM</h4>
+
+ <p>All <code><a href=#document>Document</a></code> objects (in user agents implementing
+ this specification) <span class=impl>must</span> also implement
+ the <code><a href=#htmldocument>HTMLDocument</a></code> interface, available using
+ binding-specific methods. (This is the case whether or not the
+ document in question is an <a href=#html-documents title="HTML documents">HTML
+ document</a> or indeed whether it contains any <a href=#html-elements>HTML
+ elements</a> at all.) <code><a href=#document>Document</a></code> objects <span class=impl>must</span> also implement the document-level interface
+ of any other namespaces that the UA supports.</p>
+
+ <p class=example>For example, if an HTML implementation also
+ supports SVG, then the <code><a href=#document>Document</a></code> object implements both
+ <code><a href=#htmldocument>HTMLDocument</a></code> and <code>SVGDocument</code>.</p>
+
+ <p class=note>Because the <code><a href=#htmldocument>HTMLDocument</a></code> interface is
+ now obtained using binding-specific casting methods instead of
+ simply being the primary interface of the document object, it is no
+ longer defined as inheriting from <code><a href=#document>Document</a></code>.</p>
+
+ <pre class=idl>[OverrideBuiltins]
+interface <dfn id=htmldocument>HTMLDocument</dfn> {
+ // <a href=#resource-metadata-management>resource metadata management</a>
+ [PutForwards=<a href=#dom-location-href title=dom-location-href>href</a>] readonly attribute <a href=#location>Location</a> <a href=#dom-document-location title=dom-document-location>location</a>;
+ readonly attribute DOMString <a href=#dom-document-url title=dom-document-URL>URL</a>;
+ attribute DOMString <a href=#dom-document-domain title=dom-document-domain>domain</a>;
+ readonly attribute DOMString <a href=#dom-document-referrer title=dom-document-referrer>referrer</a>;
+ attribute DOMString <a href=#dom-document-cookie title=dom-document-cookie>cookie</a>;
+ readonly attribute DOMString <a href=#dom-document-lastmodified title=dom-document-lastModified>lastModified</a>;
+ readonly attribute DOMString <a href=#dom-document-compatmode title=dom-document-compatMode>compatMode</a>;
+ attribute DOMString <a href=#dom-document-charset title=dom-document-charset>charset</a>;
+ readonly attribute DOMString <a href=#dom-document-characterset title=dom-document-characterSet>characterSet</a>;
+ readonly attribute DOMString <a href=#dom-document-defaultcharset title=dom-document-defaultCharset>defaultCharset</a>;
+ readonly attribute DOMString <a href=#dom-document-readystate title=dom-document-readyState>readyState</a>;
+
+ // <a href=#dom-tree-accessors>DOM tree accessors</a>
+ <a href=#dom-document-nameditem title=dom-document-namedItem>getter</a> any (in DOMString name);
+ attribute DOMString <a href=#document.title title=dom-document-title>title</a>;
+ attribute DOMString <a href=#dom-document-dir title=dom-document-dir>dir</a>;
+ attribute <a href=#htmlelement>HTMLElement</a> <a href=#dom-document-body title=dom-document-body>body</a>;
+ readonly attribute <a href=#htmlheadelement>HTMLHeadElement</a> <a href=#dom-document-head title=dom-document-head>head</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-images title=dom-document-images>images</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-embeds title=dom-document-embeds>embeds</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-plugins title=dom-document-plugins>plugins</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-links title=dom-document-links>links</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-forms title=dom-document-forms>forms</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-scripts title=dom-document-scripts>scripts</a>;
+ NodeList <a href=#dom-document-getelementsbyname title=dom-document-getElementsByName>getElementsByName</a>(in DOMString elementName);
+ NodeList <a href=#dom-document-getelementsbyclassname title=dom-document-getElementsByClassName>getElementsByClassName</a>(in DOMString classNames);
+ NodeList <a href=#dom-document-getitems title=dom-document-getItems>getItems</a>(in optional DOMString typeNames); // <a href=#microdata>microdata</a> <!--WARNING: ALSO DUPLICATED IN MICRODATA SECTION-->
+
+ // <a href=#dynamic-markup-insertion>dynamic markup insertion</a>
+ attribute DOMString <a href=#dom-innerhtml title=dom-innerHTML>innerHTML</a>;
+ <a href=#htmldocument>HTMLDocument</a> <a href=#dom-document-open title=dom-document-open>open</a>(in optional DOMString type, in optional DOMString replace);
+ <a href=#windowproxy>WindowProxy</a> <a href=#dom-document-open title=dom-document-open>open</a>(in DOMString url, in DOMString name, in DOMString features, in optional boolean replace);
+ void <a href=#dom-document-close title=dom-document-close>close</a>();
+ void <a href=#dom-document-write title=dom-document-write>write</a>(in DOMString... text);
+ void <a href=#dom-document-writeln title=dom-document-writeln>writeln</a>(in DOMString... text);
+
+ // <a href=#editing>user interaction</a>
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-document-defaultview title=dom-document-defaultView>defaultView</a>;
+ <a href=#selection-0>Selection</a> <a href=#dom-document-getselection title=dom-document-getSelection>getSelection</a>();
+ readonly attribute <a href=#element>Element</a> <a href=#dom-document-activeelement title=dom-document-activeElement>activeElement</a>;
+ boolean <a href=#dom-document-hasfocus title=dom-document-hasFocus>hasFocus</a>();
+ attribute DOMString <a href=#designMode title=dom-document-designMode>designMode</a>;
+ boolean <a href=#execCommand title=dom-document-execCommand>execCommand</a>(in DOMString commandId);
+ boolean <a href=#execCommand title=dom-document-execCommand>execCommand</a>(in DOMString commandId, in boolean showUI);
+ boolean <a href=#execCommand title=dom-document-execCommand>execCommand</a>(in DOMString commandId, in boolean showUI, in DOMString value);
+ boolean <a href=#dom-document-querycommandenabled title=dom-document-queryCommandEnabled>queryCommandEnabled</a>(in DOMString commandId);
+ boolean <a href=#dom-document-querycommandindeterm title=dom-document-queryCommandIndeterm>queryCommandIndeterm</a>(in DOMString commandId);
+ boolean <a href=#dom-document-querycommandstate title=dom-document-queryCommandState>queryCommandState</a>(in DOMString commandId);
+ boolean <a href=#dom-document-querycommandsupported title=dom-document-queryCommandSupported>queryCommandSupported</a>(in DOMString commandId);
+ DOMString <a href=#dom-document-querycommandvalue title=dom-document-queryCommandValue>queryCommandValue</a>(in DOMString commandId);
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-commands title=dom-document-commands>commands</a>;
+
+ // <a href=#event-handler-idl-attributes>event handler IDL attributes</a>
+ attribute <a href=#function>Function</a> <a href=#handler-onabort title=handler-onabort>onabort</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onblur title=handler-onblur>onblur</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncanplay title=handler-oncanplay>oncanplay</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncanplaythrough title=handler-oncanplaythrough>oncanplaythrough</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onchange title=handler-onchange>onchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onclick title=handler-onclick>onclick</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncontextmenu title=handler-oncontextmenu>oncontextmenu</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondblclick title=handler-ondblclick>ondblclick</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondrag title=handler-ondrag>ondrag</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragend title=handler-ondragend>ondragend</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragenter title=handler-ondragenter>ondragenter</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragleave title=handler-ondragleave>ondragleave</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragover title=handler-ondragover>ondragover</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragstart title=handler-ondragstart>ondragstart</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondrop title=handler-ondrop>ondrop</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondurationchange title=handler-ondurationchange>ondurationchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onemptied title=handler-onemptied>onemptied</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onended title=handler-onended>onended</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onerror title=handler-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onfocus title=handler-onfocus>onfocus</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onformchange title=handler-onformchange>onformchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onforminput title=handler-onforminput>onforminput</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oninput title=handler-oninput>oninput</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oninvalid title=handler-oninvalid>oninvalid</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeydown title=handler-onkeydown>onkeydown</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeypress title=handler-onkeypress>onkeypress</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeyup title=handler-onkeyup>onkeyup</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onload title=handler-onload>onload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadeddata title=handler-onloadeddata>onloadeddata</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadedmetadata title=handler-onloadedmetadata>onloadedmetadata</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadstart title=handler-onloadstart>onloadstart</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousedown title=handler-onmousedown>onmousedown</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousemove title=handler-onmousemove>onmousemove</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseout title=handler-onmouseout>onmouseout</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseover title=handler-onmouseover>onmouseover</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseup title=handler-onmouseup>onmouseup</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousewheel title=handler-onmousewheel>onmousewheel</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onpause title=handler-onpause>onpause</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onplay title=handler-onplay>onplay</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onplaying title=handler-onplaying>onplaying</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onprogress title=handler-onprogress>onprogress</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onratechange title=handler-onratechange>onratechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onreadystatechange title=handler-onreadystatechange>onreadystatechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onscroll title=handler-onscroll>onscroll</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onseeked title=handler-onseeked>onseeked</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onseeking title=handler-onseeking>onseeking</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onselect title=handler-onselect>onselect</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onshow title=handler-onshow>onshow</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onstalled title=handler-onstalled>onstalled</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onsubmit title=handler-onsubmit>onsubmit</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onsuspend title=handler-onsuspend>onsuspend</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ontimeupdate title=handler-ontimeupdate>ontimeupdate</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onvolumechange title=handler-onvolumechange>onvolumechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onwaiting title=handler-onwaiting>onwaiting</a>;
+};
+<a href=#document>Document</a> implements <a href=#htmldocument>HTMLDocument</a>;</pre>
+
+ <p>Since the <code><a href=#htmldocument>HTMLDocument</a></code> interface holds methods and
+ attributes related to a number of disparate features, the members of
+ this interface are described in various different sections.</p>
+
+
+ <h4 id=security-document><span class=secno>3.1.2 </span>Security</h4>
+
+ <p id=security>User agents <span class=impl>must</span> raise a
+ <code><a href=#security_err>SECURITY_ERR</a></code> exception whenever any of the members of
+ an <code><a href=#htmldocument>HTMLDocument</a></code> object are accessed by scripts whose
+ <a href=#effective-script-origin>effective script origin</a> is not the <a href=#same-origin title="same
+ origin">same</a> as the <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective
+ script origin</a>.</p>
+
+
+
+ <h4 id=resource-metadata-management><span class=secno>3.1.3 </span><dfn>Resource metadata management</dfn></h4>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-URL><a href=#dom-document-url>URL</a></code></dt>
+ <dd>
+ <p>Returns <a href="#the-document's-address">the document's address</a>.</p>
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-referrer><a href=#dom-document-referrer>referrer</a></code></dt>
+ <dd>
+ <p>Returns <a href="#the-document's-current-address" title="the document's current address">the
+ address</a> of the <code><a href=#document>Document</a></code> from which the user
+ navigated to this one, unless it was blocked or there was no such
+ document, in which case it returns the empty string.</p>
+ <p>The <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> link
+ type can be used to block the referrer.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-url title=dom-document-URL><code>URL</code></dfn>
+ attribute must return <a href="#the-document's-address">the document's address</a>.</p>
+
+ <p>The <dfn id=dom-document-referrer title=dom-document-referrer><code>referrer</code></dfn> attribute
+ must return either the <a href="#the-document's-current-address" title="the document's current
+ address">current address</a> of the <a href=#active-document>active document</a>
+ of the <a href=#source-browsing-context>source browsing context</a> <em>at the time the
+ navigation was started</em> (that is, the page which <a href=#navigate title=navigate>navigated</a> the <a href=#browsing-context>browsing context</a>
+ to the current document), with any <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component removed; or
+ the empty string if there is no such originating page, or if the UA
+ has been configured not to report referrers in this case, or if the
+ navigation was initiated for a <a href=#hyperlink>hyperlink</a> with a <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword.</p>
+
+ </div>
+
+ <p class=note>In the case of HTTP, the <code title=dom-document-referrer><a href=#dom-document-referrer>referrer</a></code> IDL attribute will
+ match the <code title=http-referer>Referer</code> (sic) header
+ that was sent when <a href=#fetch title=fetch>fetching</a> the current
+ page.</p>
+
+ <p class=note>Typically user agents are configured to not report
+ referrers in the case where the referrer uses an encrypted protocol
+ and the current page does not (e.g. when navigating from an <code title="">https:</code> page to an <code title="">http:</code>
+ page).</p>
+
+ <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-cookie><a href=#dom-document-cookie>cookie</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the HTTP cookies that apply to the
+ <code><a href=#document>Document</a></code>. If there are no cookies or cookies can't be
+ applied to this resource, the empty string will be returned.</p>
+ <p>Can be set, to add a new cookie to the element's set of HTTP
+ cookies.</p>
+ <p>If the contents are <a href=#sandboxed-origin-browsing-context-flag title="sandboxed origin browsing
+ context flag">sandboxed into a unique origin</a> (in an
+ <code><a href=#the-iframe-element>iframe</a></code> with the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute) or the
+ resource was labeled as <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code>, a
+ <code><a href=#security_err>SECURITY_ERR</a></code> exception will be thrown on getting and
+ setting.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-cookie title=dom-document-cookie><code>cookie</code></dfn>
+ attribute represents the cookies of the resource from which the
+ <code><a href=#document>Document</a></code> was created.</p>
+
+ <p>Some <code><a href=#document>Document</a></code> objects are <dfn id=cookie-free-document-object title="cookie-free
+ Document object">cookie-free <code>Document</code>
+ objects</dfn>. Any <code><a href=#document>Document</a></code> object created by the <code title="">createDocument()</code> or <code title=dom-DOMHTMLImplementation-createHTMLDocument><a href=#dom-domhtmlimplementation-createhtmldocument>createHTMLDocument()</a></code>
+ factory methods is a <a href=#cookie-free-document-object>cookie-free <code>Document</code>
+ object</a>. Any <code><a href=#document>Document</a></code> whose <a href="#the-document's-address" title="the
+ document's address">address</a> does not use a server-based
+ naming authority is a <a href=#cookie-free-document-object>cookie-free <code>Document</code>
+ object</a>. Other specifications can also define
+ <code><a href=#document>Document</a></code> objects as being <a href=#cookie-free-document-object title="cookie-free
+ Document object">cookie-free <code>Document</code>
+ objects</a>.</p>
+
+ <p id=sandboxCookies>On getting, if the document is a
+ <a href=#cookie-free-document-object>cookie-free <code>Document</code> object</a>, then the user
+ agent must return the empty string. Otherwise, if the
+ <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a> is not a
+ scheme/host/port tuple, the user agent must raise a
+ <code><a href=#security_err>SECURITY_ERR</a></code> exception. Otherwise, the user agent must
+ first <a href=#obtain-the-storage-mutex>obtain the storage mutex</a> and then return the
+ cookie-string for <a href="#the-document's-address">the document's address</a> for a
+ "non-HTTP" API. <a href=#refsCOOKIES>[COOKIES]</a></p>
+
+ <p>On setting, if the document is a <a href=#cookie-free-document-object>cookie-free
+ <code>Document</code> object</a>, then the user agent must do
+ nothing. Otherwise, if the <code><a href=#document>Document</a></code>'s
+ <a href=#origin>origin</a> is not a scheme/host/port tuple, the user agent
+ must raise a <code><a href=#security_err>SECURITY_ERR</a></code> exception. Otherwise, the
+ user agent must <a href=#obtain-the-storage-mutex>obtain the storage mutex</a> and then act
+ as it would when <span title="receives a
+ set-cookie-string">receiving a set-cookie-string</span> for
+ <a href="#the-document's-address">the document's address</a> via a "non-HTTP" API, consisting
+ of the new value. <a href=#refsCOOKIES>[COOKIES]</a></p>
+
+ <p class=note>Since the <code title=dom-document-cookie><a href=#dom-document-cookie>cookie</a></code> attribute is accessible
+ across frames, the path restrictions on cookies are only a tool to
+ help manage which cookies are sent to which parts of the site, and
+ are not in any way a security feature.</p>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-lastmodified><a href=#dom-document-lastmodified>lastModified</a></code></dt>
+ <dd>
+ <p>Returns the date of the last modification to the document, as
+ reported by the server, in the form "<code title="">MM/DD/YYYY&nbsp;hh:mm:ss</code>", in the user's local
+ time zone.</p>
+ <p>If the last modification date is not known, the current time is
+ returned instead.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-lastmodified title=dom-document-lastModified><code>lastModified</code></dfn>
+ attribute, on getting, must return the date and time of the
+ <code><a href=#document>Document</a></code>'s source file's last modification, in the
+ user's local time zone, in the following format:</p>
+
+ <ol><li> The month component of the date. </li>
+
+ <li> A U+002F SOLIDUS character (/). </li>
+
+ <li> The day component of the date. </li>
+
+ <li> A U+002F SOLIDUS character (/). </li>
+
+ <li> The year component of the date. </li>
+
+ <li> A U+0020 SPACE character. </li>
+
+ <li> The hours component of the time. </li>
+
+ <li> A U+003A COLON character (:). </li>
+
+ <li> The minutes component of the time. </li>
+
+ <li> A U+003A COLON character (:). </li>
+
+ <li> The seconds component of the time. </li>
+
+ </ol><p>All the numeric components above, other than the year, must be
+ given as two digits in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9) representing the number in base ten, zero-padded if
+ necessary. The year must be given as the shortest possible string of
+ four or more digits in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9) representing the number in base ten, zero-padded if
+ necessary.</p>
+
+ <p>The <code><a href=#document>Document</a></code>'s source file's last modification date
+ and time must be derived from relevant features of the networking
+ protocols used, e.g. from the value of the HTTP <code title=http-last-modified>Last-Modified</code> header of the
+ document, or from metadata in the file system for local files. If
+ the last modification date and time are not known, the attribute
+ must return the current date and time in the above format.</p>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-compatmode><a href=#dom-document-compatmode>compatMode</a></code></dt>
+ <dd>
+ <p>In a conforming document, returns the string "<code title="">CSS1Compat</code>". (In <a href=#quirks-mode>quirks mode</a>
+ documents, returns the string "<code title="">BackCompat</code>",
+ but a conforming document can never trigger <a href=#quirks-mode>quirks
+ mode</a>.)</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>A <code><a href=#document>Document</a></code> is always set to one of three modes:
+ <dfn id=no-quirks-mode>no-quirks mode</dfn>, the default; <dfn id=quirks-mode>quirks mode</dfn>, used
+ typically for legacy documents; and <dfn id=limited-quirks-mode>limited-quirks mode</dfn>,
+ also known as "almost standards" mode. The mode is only ever changed
+ from the default by the <a href=#html-parser>HTML parser</a>, based on the
+ presence, absence, or value of the DOCTYPE string.</p>
+
+ <p>The <dfn id=dom-document-compatmode title=dom-document-compatMode><code>compatMode</code></dfn> IDL
+ attribute must return the literal string "<code title="">CSS1Compat</code>" unless the document has been set to
+ <a href=#quirks-mode>quirks mode</a> by the <a href=#html-parser>HTML parser</a>, in which
+ case it must instead return the literal string "<code title="">BackCompat</code>".</p>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-charset><a href=#dom-document-charset>charset</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the <a href="#document's-character-encoding">document's character encoding</a>.</p>
+ <p>Can be set, to dynamically change the <a href="#document's-character-encoding">document's
+ character encoding</a>.</p>
+ <p>New values that are not IANA-registered aliases supported by the user agent are ignored.</p>
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-characterSet><a href=#dom-document-characterset>characterSet</a></code></dt>
+ <dd>
+ <p>Returns the <a href="#document's-character-encoding">document's character encoding</a>.</p>
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-defaultCharset><a href=#dom-document-defaultcharset>defaultCharset</a></code></dt>
+ <dd>
+ <p>Returns what might be the user agent's default character
+ encoding. (The user agent might return another character encoding
+ altogether, e.g. to protect the user's privacy, or if the user
+ agent doesn't use a single default encoding.)</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Documents have an associated <dfn id="document's-character-encoding" title="document's character
+ encoding">character encoding</dfn>. When a <code><a href=#document>Document</a></code>
+ object is created, the <a href="#document's-character-encoding">document's character encoding</a>
+ must be initialized to UTF-16. Various algorithms during page
+ loading affect this value, as does the <code title=dom-document-charset><a href=#dom-document-charset>charset</a></code> setter. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>
+
+ <p>The <dfn id=dom-document-charset title=dom-document-charset><code>charset</code></dfn>
+ IDL attribute must, on getting, return the <a href=#preferred-mime-name>preferred MIME
+ name</a> of the <a href="#document's-character-encoding">document's character encoding</a>. On
+ setting, if the new value is an IANA-registered alias for a
+ character encoding supported by the user agent, the <a href="#document's-character-encoding">document's
+ character encoding</a> must be set to that character
+ encoding. (Otherwise, nothing happens.)</p>
+
+ <p>The <dfn id=dom-document-characterset title=dom-document-characterSet><code>characterSet</code></dfn>
+ IDL attribute must, on getting, return the <a href=#preferred-mime-name>preferred MIME
+ name</a> of the <a href="#document's-character-encoding">document's character encoding</a>.</p>
+
+ <p>The <dfn id=dom-document-defaultcharset title=dom-document-defaultCharset><code>defaultCharset</code></dfn>
+ IDL attribute must, on getting, return the <a href=#preferred-mime-name>preferred MIME
+ name</a> of a character encoding, possibly the user's default
+ encoding, or an encoding associated with the user's current
+ geographical location, or any arbitrary encoding name.</p>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-readyState><a href=#dom-document-readystate>readyState</a></code></dt>
+ <dd>
+ <p>Returns "loading" while the <code><a href=#document>Document</a></code> is loading, and "complete" once it has loaded.</p>
+ <p>The <code title=event-readystatechange>readystatechange</code> event fires on the <code><a href=#document>Document</a></code> object when this value changes.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Each document has a <dfn id=current-document-readiness>current document readiness</dfn>. When a
+ <code><a href=#document>Document</a></code> object is created, it must have its
+ <a href=#current-document-readiness>current document readiness</a> set to the string "loading"
+ if the document is associated with an <a href=#html-parser>HTML parser</a> or an
+ <a href=#xml-parser>XML parser</a>, or to the string "complete"
+ otherwise. Various algorithms during page loading affect this
+ value. When the value is set, the user agent must <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-readystatechange>readystatechange</code> at the
+ <code><a href=#document>Document</a></code> object.</p>
+
+ <p>A <code><a href=#document>Document</a></code> is said to have an <dfn id=active-parser>active
+ parser</dfn> if it is associated with an <a href=#html-parser>HTML parser</a> or
+ an <a href=#xml-parser>XML parser</a> that has not yet been <a href=#stop-parsing title="stop
+ parsing">stopped</a> or aborted.</p>
+
+ <p>The <dfn id=dom-document-readystate title=dom-document-readyState><code>readyState</code></dfn> IDL
+ attribute must, on getting, return the <a href=#current-document-readiness>current document
+ readiness</a>.</p>
+
+ </div>
+
+
+
+ <h4 id=dom-tree-accessors><span class=secno>3.1.4 </span><dfn>DOM tree accessors</dfn></h4>
+
+ <p><dfn id=the-html-element>The <code>html</code> element</dfn> of a document is the
+ document's root element, if there is one and it's an
+ <code><a href=#the-html-element-0>html</a></code> element, or null otherwise.</p>
+
+ <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-head><a href=#dom-document-head>head</a></code></dt>
+ <dd>
+ <p>Returns <a href=#the-head-element>the <code>head</code> element</a>.</p>
+ </dd>
+
+ </dl><p><dfn id=the-head-element>The <code>head</code> element</dfn> of a document is the
+ first <code><a href=#the-head-element-0>head</a></code> element that is a child of <a href=#the-html-element>the
+ <code>html</code> element</a>, if there is one, or null
+ otherwise.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-document-head title=dom-document-head><code>head</code></dfn>
+ attribute, on getting, must return <a href=#the-head-element>the <code>head</code>
+ element</a> of the document (a <code><a href=#the-head-element-0>head</a></code> element or
+ null).</p>
+
+ </div>
+
+ <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-title><a href=#document.title>title</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the document's title, as given by <a href=#the-title-element>the
+ <code>title</code> element</a>.</p>
+ <p>Can be set, to update the document's title. If there is no
+ <a href=#the-head-element title="the head element"><code>head</code> element</a>,
+ the new value is ignored.</p>
+ <p>In SVG documents, the <code>SVGDocument</code> interface's
+ <code title=dom-svg-title>title</code> attribute takes
+ precedence.</p>
+ </dd>
+
+ </dl><p><dfn id=the-title-element>The <code>title</code> element</dfn> of a document is the
+ first <code><a href=#the-title-element-0>title</a></code> element in the document (in tree order), if
+ there is one, or null otherwise.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=document.title title=dom-document-title><code>title</code></dfn> attribute must,
+ on getting, run the following algorithm:</p>
+
+ <ol><li><p>If the <a href=#root-element>root element</a> is an <code><a href=#svg>svg</a></code>
+ element in the "<code title="">http://www.w3.org/2000/svg</code>"
+ namespace, and the user agent supports SVG, then return the value
+ that would have been returned by the IDL attribute of the same name
+ on the <code>SVGDocument</code> interface. <a href=#refsSVG>[SVG]</a></li>
+
+ <li><p>Otherwise, let <var title="">value</var> be a concatenation
+ of the data of all the child <a href=#text-node title="text node">text
+ nodes</a> of <a href=#the-title-element>the <code>title</code> element</a>, in
+ <a href=#tree-order>tree order</a>, or the empty string if <a href=#the-title-element>the
+ <code>title</code> element</a> is null.</li>
+
+ <li><p>Replace any sequence of one or more consecutive <a href=#space-character title="space character">space characters</a> in <var title="">value</var> with a single U+0020 SPACE character.</li>
+
+ <li><p>Remove any leading or trailing <a href=#space-character title="space
+ character">space characters</a> in <var title="">value</var>.</li>
+
+ <li><p>Return <var title="">value</var>.</li>
+
+ </ol><p>On setting, the following algorithm must be run. Mutation events
+ must be fired as appropriate.</p>
+
+ <ol><li><p>If the <a href=#root-element>root element</a> is an <code><a href=#svg>svg</a></code>
+ element in the "<code title="">http://www.w3.org/2000/svg</code>"
+ namespace, and the user agent supports SVG, then the setter must
+ defer to the setter for the IDL attribute of the same name on the
+ <code>SVGDocument</code> interface (if it is readonly, then this
+ will raise an exception). Stop the algorithm here. <a href=#refsSVG>[SVG]</a></li>
+
+ <li>If <a href=#the-title-element>the <code>title</code> element</a> is null and
+ <a href=#the-head-element>the <code>head</code> element</a> is null, then the
+ attribute must do nothing. Stop the algorithm here.</li>
+
+ <li>If <a href=#the-title-element>the <code>title</code> element</a> is null, then a
+ new <code><a href=#the-title-element-0>title</a></code> element must be created and appended to
+ <a href=#the-head-element>the <code>head</code> element</a>. Let <var title="">element</var> be that element. Otherwise, let <var title="">element</var> be <a href=#the-title-element>the <code>title</code>
+ element</a>.</li>
+
+ <li>The children of <var title="">element</var> (if any) must all
+ be removed.</li>
+
+ <li>A single <code><a href=#text>Text</a></code> node whose data is the new value
+ being assigned must be appended to <var title="">element</var>.</li>
+
+ </ol><p>The <code title=dom-document-title><a href=#document.title>title</a></code> attribute on
+ the <code><a href=#htmldocument>HTMLDocument</a></code> interface should shadow the attribute
+ of the same name on the <code>SVGDocument</code> interface when the
+ user agent supports both HTML and SVG. <a href=#refsSVG>[SVG]</a></p>
+
+ </div>
+
+ <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-body><a href=#dom-document-body>body</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns <a href=#the-body-element>the body element</a>.</p>
+ <p>Can be set, to replace <a href=#the-body-element>the body element</a>.</p>
+ <p>If the new value is not a <code><a href=#the-body-element-0>body</a></code> or <code><a href=#frameset>frameset</a></code> element, this will throw a <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> exception.</p>
+ </dd>
+
+ </dl><p><dfn id=the-body-element>The body element</dfn> of a document is the first child of
+ <a href=#the-html-element>the <code>html</code> element</a> that is either a
+ <code><a href=#the-body-element-0>body</a></code> element or a <code><a href=#frameset>frameset</a></code> element. If
+ there is no such element, it is null. <span class=impl>If the body
+ element is null, then when the specification requires that events be
+ fired at "the body element", they must instead be fired at the
+ <code><a href=#document>Document</a></code> object.</span></p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-document-body title=dom-document-body><code>body</code></dfn>
+ attribute, on getting, must return <a href=#the-body-element>the body element</a> of
+ the document (either a <code><a href=#the-body-element-0>body</a></code> element, a
+ <code><a href=#frameset>frameset</a></code> element, or null). On setting, the following
+ algorithm must be run:</p>
+
+ <ol><!-- if changes are requested:
+ http://lxr.mozilla.org/seamonkey/source/content/html/document/src/nsHTMLDocument.cpp
+ search for ::GetBody ::SetBody
+ http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/html/HTMLDocument.cpp
+ search for ::setBody
+ http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/dom/Document.cpp
+ search for ::body
+ --><li>If the new value is not a <code><a href=#the-body-element-0>body</a></code> or
+ <code><a href=#frameset>frameset</a></code> element, then raise a
+ <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li>Otherwise, if the new value is the same as <a href=#the-body-element>the body
+ element</a>, do nothing. Abort these steps.</li>
+
+ <li>Otherwise, if <a href=#the-body-element>the body element</a> is not null, then
+ replace that element with the new value in the DOM, as if the root
+ element's <code title="">replaceChild()</code> method had been
+ called with the new value and <a href=#the-body-element title="the body element">the
+ incumbent body element</a> as its two arguments respectively,
+ then abort these steps.</li>
+
+ <li>Otherwise, <a href=#the-body-element>the body element</a> is null. Append
+ the new value to the root element.</li>
+
+ </ol></div>
+
+ <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-images><a href=#dom-document-images>images</a></code></dt>
+ <dd>
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-img-element>img</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-embeds><a href=#dom-document-embeds>embeds</a></code></dt>
+ <dt><var title="">document</var> . <code title=dom-document-plugins><a href=#dom-document-plugins>plugins</a></code></dt>
+ <dd>
+ <p>Return an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-embed-element>embed</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-links><a href=#dom-document-links>links</a></code></dt>
+ <dd>
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements in the <code><a href=#document>Document</a></code> that have <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attributes.</p>
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-forms><a href=#dom-document-forms>forms</a></code></dt>
+ <dd>
+ <p>Return an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-form-element>form</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-scripts><a href=#dom-document-scripts>scripts</a></code></dt>
+ <dd>
+ <p>Return an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#script>script</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <!-- these all return the same object each time because of a rule in
+ the collection section -->
+
+ <p>The <dfn id=dom-document-images title=dom-document-images><code>images</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only
+ <code><a href=#the-img-element>img</a></code> elements.</p>
+
+ <p>The <dfn id=dom-document-embeds title=dom-document-embeds><code>embeds</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only
+ <code><a href=#the-embed-element>embed</a></code> elements.</p>
+
+ <p>The <dfn id=dom-document-plugins title=dom-document-plugins><code>plugins</code></dfn>
+ attribute must return the same object as that returned by the <code title=dom-document-embeds><a href=#dom-document-embeds>embeds</a></code> attribute.</p>
+
+ <p>The <dfn id=dom-document-links title=dom-document-links><code>links</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only <code><a href=#the-a-element>a</a></code>
+ elements with <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
+ attributes and <code><a href=#the-area-element>area</a></code> elements with <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attributes.</p>
+
+ <p>The <dfn id=dom-document-forms title=dom-document-forms><code>forms</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only
+ <code><a href=#the-form-element>form</a></code> elements.</p>
+
+ <p>The <dfn id=dom-document-scripts title=dom-document-scripts><code>scripts</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only
+ <code><a href=#script>script</a></code> elements.</p>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">collection</var> = <var title="">document</var> . <code title=dom-document-getElementsByName><a href=#dom-document-getelementsbyname>getElementsByName</a></code>(<var title="">name</var>)</dt>
+ <dd>
+ <p>Returns a <code><a href=#nodelist>NodeList</a></code> of elements in the
+ <code><a href=#document>Document</a></code> that have a <code title="">name</code>
+ attribute with the value <var title="">name</var>.</p>
+ </dd>
+
+ <dt><var title="">collection</var> = <var title="">document</var> . <code title=dom-document-getElementsByClassName><a href=#dom-document-getelementsbyclassname>getElementsByClassName(<var title="">classes</var>)</a></code></dt>
+ <dt><var title="">collection</var> = <var title="">element</var> . <code title=dom-getElementsByClassName><a href=#dom-getelementsbyclassname>getElementsByClassName(<var title="">classes</var>)</a></code></dt>
+ <dd>
+ <p>Returns a <code><a href=#nodelist>NodeList</a></code> of the elements in the object
+ on which the method was invoked (a <code><a href=#document>Document</a></code> or an
+ <code><a href=#element>Element</a></code>) that have all the classes given by <var title="">classes</var>.</p>
+ <p>The <var title="">classes</var> argument is interpreted as a
+ space-separated list of classes.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-getelementsbyname title=dom-document-getElementsByName><code>getElementsByName(<var title="">name</var>)</code></dfn> method takes a string <var title="">name</var>, and must return a <a href=#live>live</a>
+ <code><a href=#nodelist>NodeList</a></code> containing all the <a href=#html-elements>HTML elements</a>
+ in that document that have a <code title="">name</code> attribute
+ whose value is equal to the <var title="">name</var> argument (in a
+ <a href=#case-sensitive>case-sensitive</a> manner), in <a href=#tree-order>tree order</a>.
+ When the method is invoked on a <code><a href=#document>Document</a></code> object again
+ with the same argument, the user agent may return the same as the
+ object returned by the earlier call. In other cases, a new
+ <code><a href=#nodelist>NodeList</a></code> object must be returned.</p>
+
+ <p>The <dfn id=dom-document-getelementsbyclassname title=dom-document-getElementsByClassName><code>getElementsByClassName(<var title="">classNames</var>)</code></dfn> method takes a string that
+ contains a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a> representing
+ classes. When called, the method must return a <a href=#live>live</a>
+ <code><a href=#nodelist>NodeList</a></code> object containing all the elements in the
+ document, in <a href=#tree-order>tree order</a>, that have all the classes
+ specified in that argument, having obtained the classes by <a href=#split-a-string-on-spaces title="split a string on spaces">splitting a string on
+ spaces</a>. (Duplicates are ignored.) If there are no tokens
+ specified in the argument, then the method must return an empty
+ <code><a href=#nodelist>NodeList</a></code>. If the document is in <a href=#quirks-mode>quirks
+ mode</a>, then the comparisons for the classes must be done in an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> manner, otherwise, the
+ comparisons must be done in a <a href=#case-sensitive>case-sensitive</a> manner.
+ When the method is invoked on a <code><a href=#document>Document</a></code> object again
+ with the same argument, the user agent may return the same object as
+ the object returned by the earlier call. In other cases, a new
+ <code><a href=#nodelist>NodeList</a></code> object must be returned.</p>
+
+ <p>The <dfn id=dom-getelementsbyclassname title=dom-getElementsByClassName><code>getElementsByClassName(<var title="">classNames</var>)</code></dfn> method on the
+ <code><a href=#htmlelement>HTMLElement</a></code> interface must return a <a href=#live>live</a>
+ <code><a href=#nodelist>NodeList</a></code> with the nodes that the
+ <code><a href=#htmldocument>HTMLDocument</a></code> <code title=dom-document-getElementsByClassName><a href=#dom-document-getelementsbyclassname>getElementsByClassName()</a></code>
+ method would return when passed the same argument(s), excluding any
+ elements that are not descendants of the <code><a href=#htmlelement>HTMLElement</a></code>
+ object on which the method was invoked.
+ When the method is invoked on an <code><a href=#htmlelement>HTMLElement</a></code> object
+ again with the same argument, the user agent may return the same
+ object as the object returned by the earlier call. In other cases, a
+ new <code><a href=#nodelist>NodeList</a></code> object must be returned.</p>
+
+ </div>
+
+ <p>HTML, SVG, and MathML elements define which classes they are in
+ by having an attribute with no namespace with the name <code title="">class</code> containing a space-separated list of classes
+ to which the element belongs. Other specifications may also allow
+ elements in their namespaces to be labeled as being in specific
+ classes.</p>
+
+ <div class=example>
+
+ <p>Given the following XHTML fragment:</p>
+
+ <pre>&lt;div id="example"&gt;
+ &lt;p id="p1" class="aaa bbb"/&gt;
+ &lt;p id="p2" class="aaa ccc"/&gt;
+ &lt;p id="p3" class="bbb ccc"/&gt;
+&lt;/div&gt;</pre>
+
+ <p>A call to <code title="">document.getElementById('example').getElementsByClassName('aaa')</code>
+ would return a <code><a href=#nodelist>NodeList</a></code> with the two paragraphs <code title="">p1</code> and <code title="">p2</code> in it.</p>
+
+ <p>A call to <code title="">getElementsByClassName('ccc&nbsp;bbb')</code> would only
+ return one node, however, namely <code title="">p3</code>. A call
+ to <code title="">document.getElementById('example').getElementsByClassName('bbb&nbsp;&nbsp;ccc&nbsp;')</code>
+ would return the same thing.</p>
+
+ <p>A call to <code title="">getElementsByClassName('aaa,bbb')</code> would return no
+ nodes; none of the elements above are in the "aaa,bbb" class.</p>
+
+ </div>
+
+<!-- v2:
+> * xGetParentElementByClassName(rootElement, className, tagName) -
+> Navigates upwards until we hit a parent element with the given class name and
+> optional tag name.
+-->
+
+ <div class=impl>
+
+ <hr><p>The <code><a href=#htmldocument>HTMLDocument</a></code> interface <span title="support
+ named properties">supports named properties</span>. The <span>names
+ of the supported named properties</span> at any moment consist of
+ the values of the <code title=attr-name>name</code> content
+ attributes of all the <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-form-element>form</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
+ <a href=#fallback-free>fallback-free</a> <code><a href=#the-object-element>object</a></code> elements in the
+ <code><a href=#document>Document</a></code> that have <code title=attr-name>name</code>
+ content attributes, and the values of the <code title=attr-id><a href=#the-id-attribute>id</a></code> content attributes of all the
+ <code><a href=#the-applet-element>applet</a></code> and <a href=#fallback-free>fallback-free</a>
+ <code><a href=#the-object-element>object</a></code> elements in the <code><a href=#document>Document</a></code> that have
+ <code title=attr-id><a href=#the-id-attribute>id</a></code> content attributes, and the values
+ of the <code title=attr-id><a href=#the-id-attribute>id</a></code> content attributes of all the
+ <code><a href=#the-img-element>img</a></code> elements in the <code><a href=#document>Document</a></code> that have
+ both <code title=attr-name>name</code> content attributes and
+ <code title=attr-id><a href=#the-id-attribute>id</a></code> content attributes.</p>
+
+ <p>When <dfn id=dom-document-nameditem title=dom-document-namedItem>the
+ <code>HTMLDocument</code> object is indexed for property
+ retrieval</dfn> using a name <var title="">name</var>, then the user
+ agent must return the value obtained using the following steps:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">elements</var> be the list of <a href=#dom-document-nameditem-filter title=dom-document-namedItem-filter>named elements</a> with
+ the name <var title="">name</var> in the <code><a href=#document>Document</a></code>.
+
+ <p class=note>There will be at least one such element, by
+ definition.<!-- (If there wasn't, then this algorithm wouldn't
+ have been invoked by Web IDL.) --></p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">elements</var> has only one element, and that
+ element is an <code><a href=#the-iframe-element>iframe</a></code> element, then return the
+ <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#nested-browsing-context>nested browsing
+ context</a> represented by that <code><a href=#the-iframe-element>iframe</a></code> element,
+ and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise, if <var title="">elements</var> has only one
+ element, return that element and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only <a href=#dom-document-nameditem-filter title=dom-document-namedItem-filter>named elements</a> with
+ the name <var title="">name</var>.</p> <!-- the same one each time
+ is returned, because of the rule under collections -->
+
+ </li>
+
+ <!--
+ Note that this named getter overrides built-in properties, as in:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A...%3Ciframe%20name%3Dbody%3E%3C%2Fiframe%3E%3Cscript%3Ew(document.body)%3C%2Fscript%3E
+ This is what the "OverrideBuiltins" bit means in the IDL.
+ -->
+
+ </ol><p><dfn id=dom-document-nameditem-filter title=dom-document-nameditem-filter>Named elements</dfn>
+ with the name <var title="">name</var>, for the purposes of the
+ above algorithm, are those that are either:</p>
+
+ <ul><li><code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, or
+ <a href=#fallback-free>fallback-free</a> <code><a href=#the-object-element>object</a></code> elements that have a
+ <code title=attr-name>name</code> content attribute whose value
+ is <var title="">name</var>, or</li>
+
+ <li><code><a href=#the-applet-element>applet</a></code> or <a href=#fallback-free>fallback-free</a>
+ <code><a href=#the-object-element>object</a></code> elements that have an <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute whose value is <var title="">name</var>, or</li>
+
+ <li><code><a href=#the-img-element>img</a></code> elements that have an <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute whose value is <var title="">name</var>, and that have a <code title=attr-name>name</code> content attribute present also.</li>
+
+ </ul><p>An <code><a href=#the-object-element>object</a></code> element is said to be
+ <dfn id=fallback-free>fallback-free</dfn> if it has no <code><a href=#the-object-element>object</a></code> or
+ <code><a href=#the-embed-element>embed</a></code> descendants.</p>
+
+ </div>
+
+ <hr><p class=note>The <code title=dom-document-dir><a href=#dom-document-dir>dir</a></code>
+ attribute on the <code><a href=#htmldocument>HTMLDocument</a></code> interface is defined
+ along with the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> content
+ attribute.</p>
+
+
+
+ <h4 id=creating-documents><span class=secno>3.1.5 </span>Creating documents</h4>
+
+ <p><a href=#xml-documents>XML documents</a> can be created from script using the
+ <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>
+ method on the <code><a href=#domimplementation>DOMImplementation</a></code> interface.</p>
+
+ <p><a href=#html-documents>HTML documents</a> can be created using the <code title=dom-DOMHTMLImplementation-createHTMLDocument><a href=#dom-domhtmlimplementation-createhtmldocument>createHTMLDocument()</a></code>
+ method:</p>
+
+ <pre class=idl>[Supplemental, NoInterfaceObject]
+interface <dfn id=domhtmlimplementation>DOMHTMLImplementation</dfn> {
+ <a href=#document>Document</a> <a href=#dom-domhtmlimplementation-createhtmldocument title=dom-DOMHTMLImplementation-createHTMLDocument>createHTMLDocument</a>(in DOMString title);
+};
+<a href=#domimplementation>DOMImplementation</a> implements <a href=#domhtmlimplementation>DOMHTMLImplementation</a>;</pre>
+
+ <dl class=domintro><dt><var title="">document</var> = <var title="">document</var> . <code title=dom-document-implementation>implementation</code> . <code title=dom-DOMHTMLImplementation-createHTMLDocument><a href=#dom-domhtmlimplementation-createhtmldocument>createHTMLDocument</a></code>( <var title="">title</var> )</dt>
+ <dd>
+
+ <p>Returns a new <code><a href=#document>Document</a></code>, with a basic DOM already
+ constructed with an appropriate <code><a href=#the-title-element-0>title</a></code> element.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-domhtmlimplementation-createhtmldocument title=dom-DOMHTMLImplementation-createHTMLDocument><code>createHTMLDocument(<var title="">title</var>)</code></dfn> method, when invoked, must run the
+ following steps:</p>
+
+ <ol><li><p>Let <var title="">doc</var> be a newly created
+ <code><a href=#document>Document</a></code> object.</li>
+
+ <li><p>Mark <var title="">doc</var> as being an <a href=#html-documents title="HTML
+ documents">HTML document</a>.</li>
+
+ <li><p>Create a <code><a href=#documenttype>DocumentType</a></code> node with the <code title="">name</code> attribute set to the string "<code title="">html</code>", and the other attributes specific to
+ <code><a href=#documenttype>DocumentType</a></code> objects set to the empty string, null,
+ and empty lists, as appropriate. Append the newly created node to
+ <var title="">doc</var>.</li>
+
+ <li><p>Create an <code><a href=#the-html-element-0>html</a></code> element, and append it to <var title="">doc</var>.</li>
+
+ <li><p>Create a <code><a href=#the-head-element-0>head</a></code> element, and append it to the
+ <code><a href=#the-html-element-0>html</a></code> element created in the previous step.</p>
+
+ <li><p>Create a <code><a href=#the-title-element-0>title</a></code> element, and append it to the
+ <code><a href=#the-head-element-0>head</a></code> element created in the previous step.</p>
+
+ <li><p>Create a <code><a href=#text>Text</a></code> node, and set its <code title="">data</code> attribute to the string given by the method's
+ argument (which could be the empty string). Append it to the
+ <code><a href=#the-title-element-0>title</a></code> element created in the previous step.</p>
+
+ <li><p>Create a <code><a href=#the-body-element-0>body</a></code> element, and append it to the
+ <code><a href=#the-html-element-0>html</a></code> element created in the earlier step.</p>
+
+ <li><p>Return <var title="">doc</var>.</li>
+
+ </ol></div>
+
+
+
+ <h3 id=elements><span class=secno>3.2 </span>Elements</h3>
+
+ <h4 id=semantics-0><span class=secno>3.2.1 </span>Semantics</h4>
+
+ <p>Elements, attributes, and attribute values in HTML are defined
+ (by this specification) to have certain meanings (semantics). For
+ example, the <code><a href=#the-ol-element>ol</a></code> element represents an ordered list, and
+ the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute represents the
+ language of the content.</p>
+
+ <p>Authors must not use elements, attributes, or attribute values
+ for purposes other than their appropriate intended semantic
+ purpose. Authors must not use elements, attributes, or attribute
+ values that are not permitted by this specification or <a href=#other-applicable-specifications>other
+ applicable specifications</a>.</p>
+
+ <div class=example>
+ <p>For example, the following document is non-conforming, despite
+ being syntactically correct:</p>
+
+ <pre class=bad>&lt;!DOCTYPE HTML&gt;
+&lt;html lang="en-GB"&gt;
+ &lt;head&gt; &lt;title&gt; Demonstration &lt;/title&gt; &lt;/head&gt;
+ &lt;body&gt;
+ &lt;table&gt;
+ &lt;tr&gt; &lt;td&gt; My favourite animal is the cat. &lt;/td&gt; &lt;/tr&gt;
+ &lt;tr&gt;
+ &lt;td&gt;
+ &mdash;&lt;a href="http://example.org/~ernest/"&gt;&lt;cite&gt;Ernest&lt;/cite&gt;&lt;/a&gt;,
+ in an essay from 1992
+ &lt;/td&gt;
+ &lt;/tr&gt;
+ &lt;/table&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>...because the data placed in the cells is clearly not tabular
+ data (and the <code><a href=#the-cite-element>cite</a></code> element mis-used). A corrected
+ version of this document might be:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html lang="en-GB"&gt;
+ &lt;head&gt; &lt;title&gt; Demonstration &lt;/title&gt; &lt;/head&gt;
+ &lt;body&gt;
+ &lt;blockquote&gt;
+ &lt;p&gt; My favourite animal is the cat. &lt;/p&gt;
+ &lt;/blockquote&gt;
+ &lt;p&gt;
+ &mdash;&lt;a href="http://example.org/~ernest/"&gt;Ernest&lt;/a&gt;,
+ in an essay from 1992
+ &lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>This next document fragment, intended to represent the heading
+ of a corporate site, is similarly non-conforming because the second
+ line is not intended to be a heading of a subsection, but merely a
+ subheading or subtitle (a subordinate heading for the same
+ section).</p>
+
+ <pre class=bad>&lt;body&gt;
+ &lt;h1&gt;ABC Company&lt;/h1&gt;
+ &lt;h2&gt;Leading the way in widget design since 1432&lt;/h2&gt;
+ ...</pre>
+
+ <p>The <code><a href=#the-hgroup-element>hgroup</a></code> element is intended for these kinds of
+ situations:</p>
+
+ <pre>&lt;body&gt;
+ &lt;hgroup&gt;
+ &lt;h1&gt;ABC Company&lt;/h1&gt;
+ &lt;h2&gt;Leading the way in widget design since 1432&lt;/h2&gt;
+ &lt;/hgroup&gt;
+ ...</pre>
+
+ <p>In the next example, there is a non-conforming attribute value
+ ("carpet") and a non-conforming attribute ("texture"), which
+ is not permitted by this specification:</p>
+
+ <pre class=bad>&lt;label&gt;Carpet: &lt;input type="carpet" name="c" texture="deep pile"&gt;&lt;/label&gt;</pre>
+
+ <p>Here would be an alternative and correct way to mark this up:</p>
+
+ <pre>&lt;label&gt;Carpet: &lt;input type="text" class="carpet" name="c" data-texture="deep pile"&gt;&lt;/label&gt;</pre>
+
+ </div>
+
+ <p>Through scripting and using other mechanisms, the values of
+ attributes, text, and indeed the entire structure of the document
+ may change dynamically while a user agent is processing it. The
+ semantics of a document at an instant in time are those represented
+ by the state of the document at that instant in time, and the
+ semantics of a document can therefore change over time. User agents
+ <span class=impl>must</span> update their presentation of the
+ document as this occurs.</p>
+
+ <p class=example>HTML has a <code><a href=#the-progress-element>progress</a></code> element that
+ describes a progress bar. If its "value" attribute is dynamically
+ updated by a script, the UA would update the rendering to show the
+ progress changing.</p>
+
+
+
+ <h4 id=elements-in-the-dom><span class=secno>3.2.2 </span>Elements in the DOM</h4>
+
+ <p>The nodes representing <a href=#html-elements>HTML elements</a> in the DOM
+ <span class=impl>must</span> implement, and expose to scripts, the
+ interfaces listed for them in the relevant sections of this
+ specification. This includes <a href=#html-elements>HTML elements</a> in <a href=#xml-documents>XML
+ documents</a>, even when those documents are in another context
+ (e.g. inside an XSLT transform).</p>
+
+ <p>Elements in the DOM <a href=#represents title=represents>represent</a>
+ things; that is, they have intrinsic <em>meaning</em>, also known as
+ semantics.</p>
+
+ <p class=example>For example, an <code><a href=#the-ol-element>ol</a></code> element
+ represents an ordered list.</p>
+
+ <p>The basic interface, from which all the <a href=#html-elements>HTML
+ elements</a>' interfaces inherit, <span class=impl>and which
+ must be used by elements that have no additional
+ requirements,</span> is the <code><a href=#htmlelement>HTMLElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmlelement>HTMLElement</dfn> : <a href=#element>Element</a> {
+ // <a href=#dom-tree-accessors>DOM tree accessors</a>
+ NodeList <a href=#dom-getelementsbyclassname title=dom-getElementsByClassName>getElementsByClassName</a>(in DOMString classNames);
+
+ // <a href=#dynamic-markup-insertion>dynamic markup insertion</a>
+ attribute DOMString <a href=#dom-innerhtml title=dom-innerHTML>innerHTML</a>;
+ attribute DOMString <a href=#dom-outerhtml title=dom-outerHTML>outerHTML</a>;
+ void <a href=#dom-insertadjacenthtml title=dom-insertAdjacentHTML>insertAdjacentHTML</a>(in DOMString position, in DOMString text);
+
+ // <span>metadata attributes</span>
+ attribute DOMString <a href=#dom-id title=dom-id>id</a>;
+ attribute DOMString <a href=#dom-title title=dom-title>title</a>;
+ attribute DOMString <a href=#dom-lang title=dom-lang>lang</a>;
+ attribute DOMString <a href=#dom-dir title=dom-dir>dir</a>;
+ attribute <span>DOMString</span> <a href=#dom-classname title=dom-className>className</a>;
+ readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-classlist title=dom-classList>classList</a>;
+ readonly attribute <a href=#domstringmap>DOMStringMap</a> <a href=#dom-dataset title=dom-dataset>dataset</a>;
+
+ // <a href=#microdata>microdata</a> <!--WARNING: ALSO DUPLICATED IN MICRODATA SECTION-->
+ attribute boolean <a href=#dom-itemscope title=dom-itemScope>itemScope</a>;
+ attribute DOMString <a href=#dom-itemtype title=dom-itemType>itemType</a>;
+ attribute DOMString <a href=#dom-itemid title=dom-itemId>itemId</a>;
+ [PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemref title=dom-itemRef>itemRef</a>;
+ [PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemprop title=dom-itemProp>itemProp</a>;
+ readonly attribute <a href=#htmlpropertiescollection>HTMLPropertiesCollection</a> <a href=#dom-properties title=dom-properties>properties</a>;
+ attribute any <a href=#dom-itemvalue title=dom-itemValue>itemValue</a>;
+
+ // <a href=#editing>user interaction</a>
+ attribute boolean <a href=#dom-hidden title=dom-hidden>hidden</a>;
+ void <a href=#dom-click title=dom-click>click</a>();
+ void <a href=#dom-scrollintoview title=dom-scrollIntoView>scrollIntoView</a>();
+ void <a href=#dom-scrollintoview title=dom-scrollIntoView>scrollIntoView</a>(in boolean top);
+ attribute long <a href=#dom-tabindex title=dom-tabindex>tabIndex</a>;
+ void <a href=#dom-focus title=dom-focus>focus</a>();
+ void <a href=#dom-blur title=dom-blur>blur</a>();
+ attribute DOMString <a href=#dom-accesskey title=dom-accessKey>accessKey</a>;
+ readonly attribute DOMString <a href=#dom-accesskeylabel title=dom-accessKeyLabel>accessKeyLabel</a>;
+ attribute boolean <a href=#dom-draggable title=dom-draggable>draggable</a>;
+ attribute DOMString <a href=#dom-contenteditable title=dom-contentEditable>contentEditable</a>;
+ readonly attribute boolean <a href=#dom-iscontenteditable title=dom-isContentEditable>isContentEditable</a>;
+ attribute <a href=#htmlmenuelement>HTMLMenuElement</a> <a href=#dom-contextmenu title=dom-contextMenu>contextMenu</a>;
+ attribute DOMString <a href=#dom-spellcheck title=dom-spellcheck>spellcheck</a>;
+
+ // <a href=#command-api>command API</a>
+ readonly attribute DOMString <a href=#dom-command-ro-commandtype title=dom-command-ro-commandType>commandType</a>;
+ readonly attribute DOMString <a href=#dom-command-ro-label title=dom-command-ro-label>label</a>;
+ readonly attribute DOMString <a href=#dom-command-ro-icon title=dom-command-ro-icon>icon</a>;
+ readonly attribute boolean <a href=#dom-command-ro-disabled title=dom-command-ro-disabled>disabled</a>;
+ readonly attribute boolean <a href=#dom-command-ro-checked title=dom-command-ro-checked>checked</a>;<!-- v2COMMAND
+ readonly attribute <span>HTMLCollection</span> <span title="dom-command-ro-triggers">triggers</span>;-->
+
+ // <span>styling</span>
+ readonly attribute <span>CSSStyleDeclaration</span> <a href=#dom-style title=dom-style>style</a>;
+
+ // <a href=#event-handler-idl-attributes>event handler IDL attributes</a>
+ attribute <a href=#function>Function</a> <a href=#handler-onabort title=handler-onabort>onabort</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onblur title=handler-onblur>onblur</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncanplay title=handler-oncanplay>oncanplay</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncanplaythrough title=handler-oncanplaythrough>oncanplaythrough</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onchange title=handler-onchange>onchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onclick title=handler-onclick>onclick</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncontextmenu title=handler-oncontextmenu>oncontextmenu</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondblclick title=handler-ondblclick>ondblclick</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondrag title=handler-ondrag>ondrag</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragend title=handler-ondragend>ondragend</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragenter title=handler-ondragenter>ondragenter</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragleave title=handler-ondragleave>ondragleave</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragover title=handler-ondragover>ondragover</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragstart title=handler-ondragstart>ondragstart</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondrop title=handler-ondrop>ondrop</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondurationchange title=handler-ondurationchange>ondurationchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onemptied title=handler-onemptied>onemptied</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onended title=handler-onended>onended</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onerror title=handler-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onfocus title=handler-onfocus>onfocus</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onformchange title=handler-onformchange>onformchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onforminput title=handler-onforminput>onforminput</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oninput title=handler-oninput>oninput</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oninvalid title=handler-oninvalid>oninvalid</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeydown title=handler-onkeydown>onkeydown</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeypress title=handler-onkeypress>onkeypress</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeyup title=handler-onkeyup>onkeyup</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onload title=handler-onload>onload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadeddata title=handler-onloadeddata>onloadeddata</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadedmetadata title=handler-onloadedmetadata>onloadedmetadata</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadstart title=handler-onloadstart>onloadstart</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousedown title=handler-onmousedown>onmousedown</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousemove title=handler-onmousemove>onmousemove</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseout title=handler-onmouseout>onmouseout</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseover title=handler-onmouseover>onmouseover</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseup title=handler-onmouseup>onmouseup</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousewheel title=handler-onmousewheel>onmousewheel</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onpause title=handler-onpause>onpause</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onplay title=handler-onplay>onplay</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onplaying title=handler-onplaying>onplaying</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onprogress title=handler-onprogress>onprogress</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onratechange title=handler-onratechange>onratechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onreadystatechange title=handler-onreadystatechange>onreadystatechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onscroll title=handler-onscroll>onscroll</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onseeked title=handler-onseeked>onseeked</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onseeking title=handler-onseeking>onseeking</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onselect title=handler-onselect>onselect</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onshow title=handler-onshow>onshow</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onstalled title=handler-onstalled>onstalled</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onsubmit title=handler-onsubmit>onsubmit</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onsuspend title=handler-onsuspend>onsuspend</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ontimeupdate title=handler-ontimeupdate>ontimeupdate</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onvolumechange title=handler-onvolumechange>onvolumechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onwaiting title=handler-onwaiting>onwaiting</a>;
+};
+
+interface <dfn id=htmlunknownelement>HTMLUnknownElement</dfn> : <a href=#htmlelement>HTMLElement</a> { };</pre>
+
+ <p>The <code><a href=#htmlelement>HTMLElement</a></code> interface holds methods and
+ attributes related to a number of disparate features, and the
+ members of this interface are therefore described in various
+ different sections of this specification.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#htmlunknownelement>HTMLUnknownElement</a></code> interface must be used for
+ <a href=#html-elements>HTML elements</a> that are not defined by this
+ specification (or <a href=#other-applicable-specifications>other applicable specifications</a>).</p>
+
+ </div>
+
+
+
+ <h4 id=global-attributes><span class=secno>3.2.3 </span><dfn>Global attributes</dfn></h4>
+
+ <p>The following attributes are common to and may be specified on
+ all <a href=#html-elements>HTML elements</a><span class=impl> (even those not
+ defined in this specification)</span>:</p>
+
+ <ul class=brief><li><code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code></li>
+ <li><code title=attr-class><a href=#classes>class</a></code></li>
+ <li><code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code></li>
+ <li><code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code></li>
+ <li><code title=attr-dir><a href=#the-dir-attribute>dir</a></code></li>
+ <li><code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code></li>
+ <li><code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code></li>
+ <li><code title=attr-id><a href=#the-id-attribute>id</a></code></li>
+<!--WARNING: ALSO DUPLICATED IN MICRODATA SECTION -->
+ <li><code title=attr-itemid><a href=#attr-itemid>itemid</a></code></li>
+ <li><code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code></li>
+ <li><code title=attr-itemref><a href=#attr-itemref>itemref</a></code></li>
+ <li><code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code></li>
+ <li><code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code></li>
+
+ <li><code title=attr-lang><a href=#attr-lang>lang</a></code></li>
+ <li><code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code></li>
+ <li><code title=attr-style><a href=#the-style-attribute>style</a></code></li>
+ <li><code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code></li>
+ <li><code title=attr-title><a href=#the-title-attribute>title</a></code></li>
+ </ul><hr><p>The following <a href=#event-handler-content-attributes>event handler content attributes</a> may
+ be specified on any <a href=#html-elements title="HTML elements">HTML
+ element</a>:</p>
+
+ <ul class=brief><li><code title=handler-onabort><a href=#handler-onabort>onabort</a></code></li>
+ <li><code title=handler-onblur><a href=#handler-onblur>onblur</a></code>*</li>
+ <li><code title=handler-oncanplay><a href=#handler-oncanplay>oncanplay</a></code></li>
+ <li><code title=handler-oncanplaythrough><a href=#handler-oncanplaythrough>oncanplaythrough</a></code></li>
+ <li><code title=handler-onchange><a href=#handler-onchange>onchange</a></code></li>
+ <li><code title=handler-onclick><a href=#handler-onclick>onclick</a></code></li>
+ <li><code title=handler-oncontextmenu><a href=#handler-oncontextmenu>oncontextmenu</a></code></li>
+ <li><code title=handler-ondblclick><a href=#handler-ondblclick>ondblclick</a></code></li>
+ <li><code title=handler-ondrag><a href=#handler-ondrag>ondrag</a></code></li>
+ <li><code title=handler-ondragend><a href=#handler-ondragend>ondragend</a></code></li>
+ <li><code title=handler-ondragenter><a href=#handler-ondragenter>ondragenter</a></code></li>
+ <li><code title=handler-ondragleave><a href=#handler-ondragleave>ondragleave</a></code></li>
+ <li><code title=handler-ondragover><a href=#handler-ondragover>ondragover</a></code></li>
+ <li><code title=handler-ondragstart><a href=#handler-ondragstart>ondragstart</a></code></li>
+ <li><code title=handler-ondrop><a href=#handler-ondrop>ondrop</a></code></li>
+ <li><code title=handler-ondurationchange><a href=#handler-ondurationchange>ondurationchange</a></code></li>
+ <li><code title=handler-onemptied><a href=#handler-onemptied>onemptied</a></code></li>
+ <li><code title=handler-onended><a href=#handler-onended>onended</a></code></li>
+ <li><code title=handler-onerror><a href=#handler-onerror>onerror</a></code>*</li>
+ <li><code title=handler-onfocus><a href=#handler-onfocus>onfocus</a></code>*</li>
+ <li><code title=handler-onformchange><a href=#handler-onformchange>onformchange</a></code></li>
+ <li><code title=handler-onforminput><a href=#handler-onforminput>onforminput</a></code></li>
+ <li><code title=handler-oninput><a href=#handler-oninput>oninput</a></code></li>
+ <li><code title=handler-oninvalid><a href=#handler-oninvalid>oninvalid</a></code></li>
+ <li><code title=handler-onkeydown><a href=#handler-onkeydown>onkeydown</a></code></li>
+ <li><code title=handler-onkeypress><a href=#handler-onkeypress>onkeypress</a></code></li>
+ <li><code title=handler-onkeyup><a href=#handler-onkeyup>onkeyup</a></code></li>
+ <li><code title=handler-onload><a href=#handler-onload>onload</a></code>*</li>
+ <li><code title=handler-onloadeddata><a href=#handler-onloadeddata>onloadeddata</a></code></li>
+ <li><code title=handler-onloadedmetadata><a href=#handler-onloadedmetadata>onloadedmetadata</a></code></li>
+ <li><code title=handler-onloadstart><a href=#handler-onloadstart>onloadstart</a></code></li>
+ <li><code title=handler-onmousedown><a href=#handler-onmousedown>onmousedown</a></code></li>
+ <li><code title=handler-onmousemove><a href=#handler-onmousemove>onmousemove</a></code></li>
+ <li><code title=handler-onmouseout><a href=#handler-onmouseout>onmouseout</a></code></li>
+ <li><code title=handler-onmouseover><a href=#handler-onmouseover>onmouseover</a></code></li>
+ <li><code title=handler-onmouseup><a href=#handler-onmouseup>onmouseup</a></code></li>
+ <li><code title=handler-onmousewheel><a href=#handler-onmousewheel>onmousewheel</a></code></li>
+ <li><code title=handler-onpause><a href=#handler-onpause>onpause</a></code></li>
+ <li><code title=handler-onplay><a href=#handler-onplay>onplay</a></code></li>
+ <li><code title=handler-onplaying><a href=#handler-onplaying>onplaying</a></code></li>
+ <li><code title=handler-onprogress><a href=#handler-onprogress>onprogress</a></code></li>
+ <li><code title=handler-onratechange><a href=#handler-onratechange>onratechange</a></code></li>
+ <li><code title=handler-onreadystatechange><a href=#handler-onreadystatechange>onreadystatechange</a></code></li>
+ <li><code title=handler-onscroll><a href=#handler-onscroll>onscroll</a></code></li>
+ <li><code title=handler-onseeked><a href=#handler-onseeked>onseeked</a></code></li>
+ <li><code title=handler-onseeking><a href=#handler-onseeking>onseeking</a></code></li>
+ <li><code title=handler-onselect><a href=#handler-onselect>onselect</a></code></li>
+ <li><code title=handler-onshow><a href=#handler-onshow>onshow</a></code></li>
+ <li><code title=handler-onstalled><a href=#handler-onstalled>onstalled</a></code></li>
+ <li><code title=handler-onsubmit><a href=#handler-onsubmit>onsubmit</a></code></li>
+ <li><code title=handler-onsuspend><a href=#handler-onsuspend>onsuspend</a></code></li>
+ <li><code title=handler-ontimeupdate><a href=#handler-ontimeupdate>ontimeupdate</a></code></li>
+ <li><code title=handler-onvolumechange><a href=#handler-onvolumechange>onvolumechange</a></code></li>
+ <li><code title=handler-onwaiting><a href=#handler-onwaiting>onwaiting</a></code></li>
+ </ul><p class=note>The attributes marked with an asterisk have a
+ different meaning when specified on <code><a href=#the-body-element-0>body</a></code> elements as
+ those elements expose <a href=#event-handlers>event handlers</a> of the
+ <code><a href=#window>Window</a></code> object with the same names.</p>
+
+ <p class=note>While these attributes apply to all elements, they
+ are not useful on all elements. For example, only <a href=#media-element title="media
+ element">media elements</a> will ever receive a <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> event fired by
+ the user agent.</p>
+
+ <hr><p><a href=#custom-data-attribute title="custom data attribute">Custom data attributes</a>
+ (e.g. <code title="">data-foldername</code> or <code title="">data-msgid</code>) can be specified on any <a href=#html-elements title="HTML elements">HTML element</a>, to store custom data
+ specific to the page.</p>
+
+ <hr><p>In <a href=#html-documents>HTML documents</a>, elements in the <a href=#html-namespace-0>HTML
+ namespace</a> may have an <code title="">xmlns</code> attribute
+ specified, if, and only if, it has the exact value
+ "<code>http://www.w3.org/1999/xhtml</code>". This does not apply to
+ <a href=#xml-documents>XML documents</a>.</p>
+
+ <p class=note>In HTML, the <code title="">xmlns</code> attribute
+ has absolutely no effect. It is basically a talisman. It is allowed
+ merely to make migration to and from XHTML mildly easier. When
+ parsed by an <a href=#html-parser>HTML parser</a>, the attribute ends up in no
+ namespace, not the "<code>http://www.w3.org/2000/xmlns/</code>"
+ namespace like namespace declaration attributes in XML do.</p>
+
+ <p class=note>In XML, an <code title="">xmlns</code> attribute is
+ part of the namespace declaration mechanism, and an element cannot
+ actually have an <code title="">xmlns</code> attribute in no
+ namespace specified.</p>
+
+ <hr><p>To enable assistive technology products to expose a more
+ fine-grained interface than is otherwise possible with HTML elements
+ and attributes, a set of <a href=#annotations-for-assistive-technology-products-(aria)>annotations for assistive technology
+ products</a> can be specified (the ARIA <code title=attr-aria-role>role</code> and <code title=attr-aria-*>aria-*</code> attributes).</p>
+
+
+ <h5 id=the-id-attribute><span class=secno>3.2.3.1 </span>The <dfn title=attr-id><code>id</code></dfn> attribute</h5>
+
+ <p>The <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute specifies its
+ element's <dfn id=concept-id title=concept-id>unique identifier (ID)</dfn>. The
+ value must be unique amongst all the IDs in the element's <a href=#home-subtree>home
+ subtree</a> and must contain at least one character. The value
+ must not contain any <a href=#space-character title="space character">space
+ characters</a>.</p>
+
+ <!-- space characters are disallowed because space-separated lists
+ of IDs otherwise would not be able to reach all valid IDs -->
+
+ <p class=note>An element's <a href=#concept-id title=concept-id>unique
+ identifier</a> can be used for a variety of purposes, most
+ notably as a way to link to specific parts of a document using
+ fragment identifiers, as a way to target an element when scripting,
+ and as a way to style a specific element from CSS.</p>
+
+ <div class=impl>
+
+ <p>If the value is not the empty string, user agents must associate
+ the element with the given value (exactly, including any space
+ characters) for the purposes of ID matching within the element's
+ <a href=#home-subtree>home subtree</a> (e.g. for selectors in CSS or for the
+ <code title=dom-Document-getElementById><a href=#dom-document-getelementbyid>getElementById()</a></code>
+ method in the DOM).</p>
+
+ <p>Identifiers are opaque strings. Particular meanings should not be
+ derived from the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code>
+ attribute.</p>
+
+ <p>This specification doesn't preclude an element having multiple
+ IDs, if other mechanisms (e.g. DOM Core methods) can set an
+ element's ID in a way that doesn't conflict with the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute.</p>
+
+ <p>The <dfn id=dom-id title=dom-id><code>id</code></dfn> IDL attribute must
+ <a href=#reflect>reflect</a> the <code title=attr-id><a href=#the-id-attribute>id</a></code> content
+ attribute.</p>
+
+ </div>
+
+
+ <h5 id=the-title-attribute><span class=secno>3.2.3.2 </span>The <dfn title=attr-title><code>title</code></dfn> attribute</h5>
+
+ <p>The <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute
+ <a href=#represents>represents</a> advisory information for the element, such
+ as would be appropriate for a tooltip. On a link, this could be the
+ title or a description of the target resource; on an image, it could
+ be the image credit or a description of the image; on a paragraph,
+ it could be a footnote or commentary on the text; on a citation, it
+ could be further information about the source; and so forth. The
+ value is text.</p>
+
+ <p>If this attribute is omitted from an element, then it implies
+ that the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute of the
+ nearest ancestor <a href=#html-elements title="HTML elements">HTML element</a>
+ with a <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute set is also
+ relevant to this element. Setting the attribute overrides this,
+ explicitly stating that the advisory information of any ancestors is
+ not relevant to this element. Setting the attribute to the empty
+ string indicates that the element has no advisory information.</p>
+
+ <p>If the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute's value
+ contains U+000A LINE FEED (LF) characters, the content is split into
+ multiple lines. Each U+000A LINE FEED (LF) character represents a
+ line break.</p>
+
+ <div class=example>
+
+ <p>Caution is advised with respect to the use of newlines in <code title=attr-title><a href=#the-title-attribute>title</a></code> attributes.</p>
+
+ <p>For instance, the following snippet actually defines an
+ abbreviation's expansion <em>with a line break in it</em>:</p>
+
+ <pre class=bad>&lt;p&gt;My logs show that there was some interest in &lt;abbr title="Hypertext
+Transport Protocol"&gt;HTTP&lt;/abbr&gt; today.&lt;/p&gt;</pre>
+
+ </div>
+
+ <p>Some elements, such as <code><a href=#the-link-element>link</a></code>, <code><a href=#the-abbr-element>abbr</a></code>, and
+ <code><a href=#the-input-element>input</a></code>, define additional semantics for the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute beyond the semantics
+ described above.</p>
+
+ <div class=impl>
+
+ <hr><p>The <dfn id=dom-title title=dom-title><code>title</code></dfn> IDL attribute
+ must <a href=#reflect>reflect</a> the <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ content attribute.</p>
+
+ </div>
+
+
+
+ <h5 id=the-lang-and-xml:lang-attributes><span class=secno>3.2.3.3 </span>The <code title=attr-lang><a href=#attr-lang>lang</a></code> and <code title=attr-xml-lang><a href=#attr-xml-lang>xml:lang</a></code> attributes</h5>
+
+ <p>The <dfn id=attr-lang title=attr-lang><code>lang</code></dfn> attribute (in
+ no namespace) specifies the primary language for the element's
+ contents and for any of the element's attributes that contain
+ text. Its value must be a valid BCP 47 language tag, or the empty
+ string. Setting the attribute to the empty string indicates that the
+ primary language is unknown<!-- UA conformance requirements for this
+ are below -->. <a href=#refsBCP47>[BCP47]</a></p>
+
+ <p>The <dfn id=attr-xml-lang title=attr-xml-lang><code title="">lang</code></dfn>
+ attribute in the <a href=#xml-namespace>XML namespace</a> is defined in XML. <a href=#refsXML>[XML]</a></p>
+
+ <p>If these attributes are omitted from an element, then the
+ language of this element is the same as the language of its parent
+ element, if any.</p>
+
+ <p>The <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no namespace
+ may be used on any <a href=#html-elements title="HTML elements">HTML
+ element</a>.</p>
+
+ <p>The <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code>
+ attribute in the <span>XML namespace</span></a> may be used on
+ <a href=#html-elements>HTML elements</a> in <a href=#xml-documents>XML documents</a>, as well as
+ elements in other namespaces if the relevant specifications allow it
+ (in particular, MathML and SVG allow <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attributes in the
+ <span>XML namespace</span></a> to be specified on their
+ elements). If both the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute
+ in no namespace and the <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in the <span>XML
+ namespace</span></a> are specified on the same element, they must
+ have exactly the same value when compared in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner.</p>
+
+ <p>Authors must not use the <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in the <span>XML
+ namespace</span></a> on <a href=#html-elements>HTML elements</a> in <a href=#html-documents>HTML
+ documents</a>. To ease migration to and from XHTML, authors may
+ specify an attribute in no namespace with no prefix and with the
+ literal localname "<code title="">xml:lang</code>" on <a href=#html-elements>HTML
+ elements</a> in <a href=#html-documents>HTML documents</a>, but such attributes
+ must only be specified if a <code title=attr-lang><a href=#attr-lang>lang</a></code>
+ attribute in no namespace is also specified, and both attributes
+ must have the same value when compared in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner.</p>
+
+ <p class=note>The attribute in no namespace with no prefix and
+ with the literal localname "<code title="">xml:lang</code>" has no
+ effect on language processing.</p>
+
+ <div class=impl>
+
+ <hr><p>To determine the <dfn id=language>language</dfn> of a node, user agents must
+ look at the nearest ancestor element (including the element itself
+ if the node is an element) that has a <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in the
+ <span>XML namespace</span></a> set or is an <a href=#html-elements title="HTML
+ elements">HTML element</a> and has a <code title=attr-lang><a href=#attr-lang>lang</a></code> in no namespace attribute set. That
+ attribute specifies the language of the node (regardless of its
+ value).</p>
+
+ <p>If both the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no
+ namespace and the <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in the <span>XML
+ namespace</span></a> are set on an element, user agents must use
+ the <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute
+ in the <span>XML namespace</span></a>, and the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no namespace must be
+ <a href=#ignore title=ignore>ignored</a> for the purposes of determining
+ the element's language.</p>
+
+ <p>If none of the node's ancestors, including the <a href=#root-element>root
+ element</a>, have either attribute set, but there is a
+ <a href=#pragma-set-default-language>pragma-set default language</a> set, then that is the
+ language of the node. If there is no <a href=#pragma-set-default-language>pragma-set default
+ language</a> set, then language information from a higher-level
+ protocol (such as HTTP), if any, must be used as the final fallback
+ language instead. In the absence of any such language information,
+ and in cases where the higher-level protocol reports multiple
+ languages, the language of the node is unknown, and the
+ corresponding language tag is the empty string.</p>
+
+ <p>If the resulting value is not a recognized language tag, then it
+ must be treated as an unknown language having the given language
+ tag, distinct from all other languages. For the purposes of
+ round-tripping or communicating with other services that expect
+ language tags, user agents should pass unknown language tags
+ through unmodified.</p>
+
+ <p class=example>Thus, for instance, an element with <code title="">lang="xyzzy"</code> would be matched by the selector <code title="">:lang(xyzzy)</code> (e.g. in CSS), but it would not be
+ matched by <code title="">:lang(abcde)</code>, even though both are
+ equally invalid. Similarly, if a Web browser and screen reader
+ working in unison communicated about the language of the element,
+ the browser would tell the screen reader that the language was
+ "xyzzy", even if it knew it was invalid, just in case the screen
+ reader actually supported a language with that tag after all.</p>
+
+ <p>If the resulting value is the empty string, then it must be
+ interpreted as meaning that the language of the node is explicitly
+ unknown.</p>
+
+ <hr><p>User agents may use the element's language to determine proper
+ processing or rendering (e.g. in the selection of appropriate
+ fonts or pronunciations, or for dictionary selection). <!--User
+ agents must not use the element's language to determine text
+ directionality. (commented out because text directionality is a
+ rendering-level concern.)--></p>
+
+ <hr><p>The <dfn id=dom-lang title=dom-lang><code>lang</code></dfn> IDL attribute
+ must <a href=#reflect>reflect</a> the <code title=attr-lang><a href=#attr-lang>lang</a></code>
+ content attribute in no namespace.</p>
+
+ </div>
+
+
+
+ <h5 id=the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.4 </span>The <dfn title=attr-xml-base><code>xml:base</code></dfn>
+ attribute (XML only)</h5>
+
+ <p>The <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute is
+ defined in XML Base. <a href=#refsXMLBASE>[XMLBASE]</a></p>
+
+ <p>The <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute may be
+ used on elements of <a href=#xml-documents>XML documents</a>. Authors must not
+ use the <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute in
+ <a href=#html-documents>HTML documents</a>.</p>
+
+
+ <h5 id=the-dir-attribute><span class=secno>3.2.3.5 </span>The <dfn title=attr-dir><code>dir</code></dfn> attribute</h5>
+
+ <p>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute specifies the
+ element's text directionality. The attribute is an <a href=#enumerated-attribute>enumerated
+ attribute</a> with the keyword <code title="">ltr</code> mapping
+ to the state <i>ltr</i>, and the keyword <code title="">rtl</code>
+ mapping to the state <i>rtl</i>. The attribute has no <i>invalid
+ value default</i> and no <i>missing value default</i>.</p>
+
+ <div class=impl>
+
+ <p>The processing of this attribute is primarily performed by the
+ presentation layer. For example, the rendering section in this
+ specification defines a mapping from this attribute to the CSS
+ 'direction' and 'unicode-bidi' properties, and CSS defines rendering
+ in terms of those properties.</p>
+
+ </div>
+
+ <p><dfn id=the-directionality>The directionality</dfn> of an element, which is used in
+ particular by the <code><a href=#the-canvas-element>canvas</a></code> element's text rendering API,
+ is either 'ltr' or 'rtl'. If the user agent supports CSS and the
+ 'direction' property on this element has a computed value of either
+ 'ltr' or 'rtl', then that is <a href=#the-directionality>the directionality</a> of the
+ element. Otherwise, if the element is <a href=#being-rendered>being rendered</a>,
+ then <a href=#the-directionality>the directionality</a> of the element is the
+ directionality used by the presentation layer, potentially
+ determined from the value of the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
+ attribute on the element. Otherwise, if the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute has the state <i>ltr</i>, the
+ element's directionality is 'ltr' (left-to-right); if the attribute
+ has the state <i>rtl</i>, the element's directionality is 'rtl'
+ (right-to-left); and otherwise, the element's directionality is the
+ same as its parent element, or 'ltr' if there is no parent
+ element.</p>
+
+ <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-dir><a href=#dom-dir>dir</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value, if any.</p>
+ <p>Can be set, to either "<code title="">ltr</code>" or "<code title="">rtl</code>", to replace <a href=#the-html-element>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value.</p>
+ <p>If there is no <a href=#the-html-element title="the html element"><code>html</code> element</a>, returns the empty string and ignores new values.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-dir title=dom-dir><code>dir</code></dfn> IDL attribute on
+ an element must <a href=#reflect>reflect</a> the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> content attribute of that element,
+ <a href=#limited-to-only-known-values>limited to only known values</a>.</p>
+
+ <p>The <dfn id=dom-document-dir title=dom-document-dir><code>dir</code></dfn> IDL
+ attribute on <code><a href=#htmldocument>HTMLDocument</a></code> objects must
+ <a href=#reflect>reflect</a> the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> content
+ attribute of <a href=#the-html-element>the <code>html</code> element</a>, if any,
+ <a href=#limited-to-only-known-values>limited to only known values</a>. If there is no such
+ element, then the attribute must return the empty string and do
+ nothing on setting.</p>
+
+ </div>
+
+ <p class=note>Authors are strongly encouraged to use the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute to indicate text direction
+ rather than using CSS, since that way their documents will continue
+ to render correctly even in the absence of CSS (e.g. as interpreted
+ by search engines).</p>
+
+
+ <h5 id=classes><span class=secno>3.2.3.6 </span>The <dfn title=attr-class><code>class</code></dfn> attribute</h5>
+
+ <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have a
+ <code title=attr-class><a href=#classes>class</a></code> attribute specified.</p>
+
+ <p>The attribute, if specified, must have a value that is a
+ <a href=#set-of-space-separated-tokens>set of space-separated tokens</a> representing the various
+ classes that the element belongs to.</p>
+
+ <div class=impl>
+
+ <p>The classes that an <a href=#html-elements title="HTML elements">HTML
+ element</a> has assigned to it consists of all the classes
+ returned when the value of the <code title=attr-class><a href=#classes>class</a></code>
+ attribute is <a href=#split-a-string-on-spaces title="split a string on spaces">split on
+ spaces</a>. (Duplicates are ignored.)</p>
+
+ </div>
+
+ <p class=note>Assigning classes to an element affects class
+ matching in selectors in CSS, the <code title=dom-document-getElementsByClassName><a href=#dom-document-getelementsbyclassname>getElementsByClassName()</a></code>
+ method in the DOM, and other such features.</p>
+
+ <p>There are no additional restrictions on the tokens authors can
+ use in the <code title=attr-class><a href=#classes>class</a></code> attribute, but
+ authors are encouraged to use values that describe the nature of the
+ content, rather than values that describe the desired presentation
+ of the content.</p>
+
+ <div class=impl>
+
+ <hr><p>The <dfn id=dom-classname title=dom-className><code>className</code></dfn> and
+ <dfn id=dom-classlist title=dom-classList><code>classList</code></dfn> IDL
+ attributes must both <a href=#reflect>reflect</a> the <code title=attr-class><a href=#classes>class</a></code> content attribute.</p>
+
+ </div>
+
+
+
+ <h5 id=the-style-attribute><span class=secno>3.2.3.7 </span>The <dfn title=attr-style><code>style</code></dfn> attribute</h5>
+
+ <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-style><a href=#the-style-attribute>style</a></code> content attribute set. This is a
+ <span>CSS styling attribute</span> as defined by the CSS Styling
+ Attribute Syntax specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>
+
+ <div class=impl>
+
+ <p>In user agents that support CSS, the attribute's value must be
+ parsed when the attribute is added or has its value changed<!-- so
+ dynamic changes to the base URL don't affect the CSS -->, according
+ to the rules given for <span>CSS styling attributes</span>. <a href=#refsCSSATTR>[CSSATTR]</a></p>
+
+ </div>
+
+ <p>Documents that use <code title=attr-style><a href=#the-style-attribute>style</a></code>
+ attributes on any of their elements must still be comprehensible and
+ usable if those attributes were removed.</p>
+
+ <p class=note>In particular, using the <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute to hide and show content,
+ or to convey meaning that is otherwise not included in the document,
+ is non-conforming. (To hide and show content, use the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute.)</p>
+
+ <hr><dl class=domintro><dt><var title="">element</var> . <code title=dom-style><a href=#dom-style>style</a></code></dt>
+ <dd>
+ <p>Returns a <code>CSSStyleDeclaration</code> object for the element's <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-style title=dom-style><code>style</code></dfn> IDL attribute
+ must return a <code>CSSStyleDeclaration</code> whose value
+ represents the declarations specified in the attribute, if
+ present. Mutating the <code>CSSStyleDeclaration</code> object must
+ create a <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute on the
+ element (if there isn't one already) and then change its value to be
+ a value representing the serialized form of the
+ <code>CSSStyleDeclaration</code> object. The same object must be
+ returned each time. <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, the words that refer to colors are
+ marked up using the <code><a href=#the-span-element>span</a></code> element and the <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute to make those words show
+ up in the relevant colors in visual media.</p>
+
+ <pre>&lt;p&gt;My sweat suit is &lt;span style="color: green; background:
+transparent"&gt;green&lt;/span&gt; and my eyes are &lt;span style="color: blue;
+background: transparent"&gt;blue&lt;/span&gt;.&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h5 id=embedding-custom-non-visible-data><span class=secno>3.2.3.8 </span><dfn>Embedding custom non-visible data</dfn></h5>
+
+ <p>A <dfn id=custom-data-attribute>custom data attribute</dfn> is an attribute in no
+ namespace whose name starts with the string "<dfn id=attr-data-* title=attr-data-*><code>data-</code></dfn>", has at least one
+ character after the hyphen, is <a href=#xml-compatible>XML-compatible</a>, and
+ contains no characters in the range U+0041 to U+005A (LATIN CAPITAL
+ LETTER A to LATIN CAPITAL LETTER Z).</p>
+
+ <p class=note>All attributes on <a href=#html-elements>HTML elements</a> in
+ <a href=#html-documents>HTML documents</a> get ASCII-lowercased automatically, so
+ the restriction on ASCII uppercase letters doesn't affect such
+ documents.</p>
+
+ <p><a href=#custom-data-attribute title="custom data attribute">Custom data attributes</a>
+ are intended to store custom data private to the page or
+ application, for which there are no more appropriate attributes or
+ elements.</p>
+
+ <p>These attributes are not intended for use by software that is
+ independent of the site that uses the attributes.</p>
+
+ <div class=example>
+
+ <p>For instance, a site about music could annotate list items
+ representing tracks in an album with custom data attributes
+ containing the length of each track. This information could then be
+ used by the site itself to allow the user to sort the list by track
+ length, or to filter the list for tracks of certain lengths.</p>
+
+ <pre>&lt;ol&gt;
+ &lt;li data-length="2m11s"&gt;Beyond The Sea&lt;/li&gt;
+ ...
+&lt;/ol&gt;</pre>
+
+ <p>It would be inappropriate, however, for the user to use generic
+ software not associated with that music site to search for tracks
+ of a certain length by looking at this data.</p>
+
+ <p>This is because these attributes are intended for use by the
+ site's own scripts, and are not a generic extension mechanism for
+ publicly-usable metadata.</p>
+
+ </div>
+
+ <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have
+ any number of <a href=#custom-data-attribute title="custom data attribute">custom data
+ attributes</a> specified, with any value.</p>
+
+ <hr><dl class=domintro><dt><var title="">element</var> . <code title=dom-dataset><a href=#dom-dataset>dataset</a></code></dt>
+ <dd>
+
+ <p>Returns a <code><a href=#domstringmap>DOMStringMap</a></code> object for the element's <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes.</p>
+
+ <p>Hyphenated names become camel-cased. For example, <code title="">data-foo-bar=""</code> becomes <code title="">element.dataset.fooBar</code>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-dataset title=dom-dataset><code>dataset</code></dfn> IDL
+ attribute provides convenient accessors for all the <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes on an element. On
+ getting, the <code title=dom-dataset><a href=#dom-dataset>dataset</a></code> IDL attribute
+ must return a <code><a href=#domstringmap>DOMStringMap</a></code> object, associated with the
+ following algorithms, which expose these attributes on their
+ element:</p>
+
+ <dl><dt>The algorithm for getting the list of name-value pairs</dt>
+
+ <dd>
+ <ol><li>Let <var title="">list</var> be an empty list of name-value
+ pairs.</li>
+
+ <li>For each content attribute on the element whose first five
+ characters are the string "<code title="">data-</code>" and whose
+ remaining characters (if any) do not include any characters in
+ the range U+0041 to U+005A (LATIN CAPITAL LETTER A to LATIN
+ CAPITAL LETTER Z), add a name-value pair to <var title="">list</var> whose name is the attribute's name with the
+ first five characters removed and whose value is the attribute's
+ value.</li>
+
+ <li>For each name on the list, for each U+002D HYPHEN-MINUS
+ character (-) in the name that is followed by a character in the
+ range U+0061 to U+007A (U+0061 LATIN SMALL LETTER A to U+007A
+ LATIN SMALL LETTER Z), remove the U+002D HYPHEN-MINUS character
+ (-) and replace the character that followed it by the same
+ character <a href=#converted-to-ascii-uppercase>converted to ASCII uppercase</a>.</li>
+
+ <li>Return <var title="">list</var>.</li>
+
+ </ol></dd>
+
+ <dt>The algorithm for setting names to certain values</dt>
+
+ <dd>
+ <ol><li>Let <var title="">name</var> be the name passed to the
+ algorithm.</li>
+
+ <li>Let <var title="">value</var> be the value passed to the
+ algorithm.</li>
+
+ <li>If <var title="">name</var> contains a U+002D HYPHEN-MINUS
+ character (-) followed by a character in the range U+0061 to
+ U+007A (U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER
+ Z), throw a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li>For each character in the range U+0041 to U+005A (U+0041
+ LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z) in <var title="">name</var>, insert a U+002D HYPHEN-MINUS character (-)
+ before the character and replace the character with the same
+ character <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>
+
+ <li>Insert the string <code title="">data-</code> at the front of
+ <var title="">name</var>.</li>
+
+ <li>Set the value of the attribute with the name <var title="">name</var>, to the value <var title="">value</var>,
+ replacing any previous value if the attribute already existed. If
+ <code title="">setAttribute()</code> would have raised an
+ exception when setting an attribute with the name <var title="">name</var>, then this must raise the same
+ exception.</li>
+
+ </ol></dd>
+
+ <dt>The algorithm for deleting names</dt>
+
+ <dd>
+ <ol><li>Let <var title="">name</var> be the name passed to the
+ algorithm.</li>
+
+ <li>If <var title="">name</var> contains a U+002D HYPHEN-MINUS
+ character (-) followed by a character in the range U+0061 to
+ U+007A (U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER
+ Z), throw a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li>For each character in the range U+0041 to U+005A (U+0041
+ LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z) in <var title="">name</var>, insert a U+002D HYPHEN-MINUS character (-)
+ before the character and replace the character with the same
+ character <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>
+
+ <li>Insert the string <code title="">data-</code> at the front of
+ <var title="">name</var>.</li>
+
+ <li>Remove the attribute with the name <var title="">name</var>,
+ if such an attribute exists. Do nothing otherwise.</li>
+
+ </ol></dd>
+
+ </dl><p>The same object must be returned each time.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>If a Web page wanted an element to represent a space ship,
+ e.g. as part of a game, it would have to use the <code title=attr-class><a href=#classes>class</a></code> attribute along with <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes:</p>
+
+ <pre>&lt;div class="spaceship" data-ship-id="92432"
+ data-weapons="laser 2" data-shields="50%"
+ data-x="30" data-y="10" data-z="90"&gt;
+ &lt;button class="fire"
+ onclick="spaceships[this.parentNode.dataset.shipId].fire()"&gt;
+ Fire
+ &lt;/button&gt;
+&lt;/div&gt;</pre>
+
+ <p>Notice how the hyphenated attribute name becomes capitalized in
+ the API.</p>
+
+ </div>
+
+ <p>Authors should carefully design such extensions so that when the
+ attributes are ignored and any associated CSS dropped, the page is
+ still usable.</p>
+
+ <div class=impl>
+
+ <p>User agents must not derive any implementation behavior from
+ these attributes or values. Specifications intended for user agents
+ must not define these attributes to have any meaningful values.</p>
+
+ </div>
+
+ <p>JavaScript libraries may use the <a href=#custom-data-attribute title="custom data
+ attribute">custom data attributes</a>, as they are considered to
+ be part of the page on which they are used. Authors of libraries
+ that are reused by many authors are encouraged to include their name
+ in the attribute names, to reduce the risk of clashes.</p>
+
+ <div class=example>
+
+ <p>For example, a library called "DoQuery" could use attribute
+ names like <code title="">data-doquery-range</code>, and a library
+ called "jJo" could use attributes names like <code title="">data-jjo-range</code>.</p>
+
+ </div>
+
+
+ <h4 id=element-definitions><span class=secno>3.2.4 </span>Element definitions</h4>
+
+ <p>Each element in this specification has a definition that includes
+ the following information:</p>
+
+ <dl><dt>Categories</dt>
+
+ <dd>A list of <a href=#content-categories title="content categories">categories</a> to
+ which the element belongs. These are used when defining the
+ <a href=#content-models>content models</a> for each element.</dd>
+
+
+ <dt>Contexts in which this element may be used</dt>
+
+ <dd>A <em>non-normative</em> description of where the element can
+ be used. This information is redundant with the content models of
+ elements that allow this one as a child, and is provided only as a
+ convenience.</dd>
+
+
+ <dt>Content model</dt>
+
+ <dd>A normative description of what content must be included as
+ children and descendants of the element.</dd>
+
+
+ <dt>Content attributes</dt>
+
+ <dd>A normative list of attributes that may be specified on the
+ element (except where otherwise disallowed).</dd>
+
+
+ <dt>DOM interface</dt>
+
+ <dd>A normative definition of a DOM interface that such elements
+ must implement.</dd>
+
+ </dl><p>This is then followed by a description of what the element
+ <a href=#represents>represents</a>, along with any additional normative
+ conformance criteria that may apply to authors<span class=impl title=""> and implementations</span>. Examples are sometimes
+ also included.</p>
+
+
+ <h5 id=attributes><span class=secno>3.2.4.1 </span>Attributes</h5>
+
+ <p id=attribute-text>Except where otherwise specified, attributes
+ on <a href=#html-elements>HTML elements</a> may have any string value, including
+ the empty string. Except where explicitly stated, there is no
+ restriction on what text can be specified in such attributes.</p>
+
+
+
+ <h4 id=content-models><span class=secno>3.2.5 </span><dfn>Content models</dfn></h4>
+
+ <p>Each element defined in this specification has a content model: a
+ description of the element's expected contents. An <a href=#html-elements title="HTML
+ elements">HTML element</a> must have contents that match the
+ requirements described in the element's content model.</p>
+
+ <p class=note>As noted in the conformance and terminology
+ sections, for the purposes of determining if an element matches its
+ content model or not, <a href=#text-node title="text
+ node"><code>CDATASection</code> nodes in the DOM are treated as
+ equivalent to <code>Text</code> nodes</a>, and <a href=#entity-references>entity reference nodes are treated as if
+ they were expanded in place</a>.</p>
+
+ <p>The <a href=#space-character title="space character">space characters</a> are
+ always allowed between elements. User agents represent these
+ characters between elements in the source markup as text nodes in
+ the DOM.<!-- not a conf criteria since the parser now requires this
+ --> Empty <a href=#text-node title="text node">text nodes</a> and <a href=#text-node title="text node">text nodes</a> consisting of just sequences of
+ those characters are considered <dfn id=inter-element-whitespace>inter-element
+ whitespace</dfn>.</p>
+
+ <p><a href=#inter-element-whitespace>Inter-element whitespace</a>, comment nodes, and
+ processing instruction nodes must be ignored when establishing
+ whether an element's contents match the element's content model or
+ not, and must be ignored when following algorithms that define
+ document and element semantics.</p>
+
+ <p>An element <var title="">A</var> is said to be <dfn id=preceded-or-followed>preceded or
+ followed</dfn> by a second element <var title="">B</var> if <var title="">A</var> and <var title="">B</var> have the same parent node
+ and there are no other element nodes or text nodes (other than
+ <a href=#inter-element-whitespace>inter-element whitespace</a>) between them.</p>
+
+ <p>Authors must not use <a href=#html-elements>HTML elements</a> anywhere except
+ where they are explicitly allowed, as defined for each element, or
+ as explicitly required by other specifications. For XML compound
+ documents, these contexts could be inside elements from other
+ namespaces, if those elements are defined as providing the relevant
+ contexts.</p>
+
+ <div class=example>
+ <p>For example, the Atom specification defines a <code title="">content</code> element. When its <code title="">type</code> attribute has the value <code title="">xhtml</code>, the Atom specification requires that it
+ contain a single HTML <code><a href=#the-div-element>div</a></code> element. Thus, a
+ <code><a href=#the-div-element>div</a></code> element is allowed in that context, even though
+ this is not explicitly normatively stated by this specification. <a href=#refsATOM>[ATOM]</a></p>
+ </div>
+
+ <p>In addition, <a href=#html-elements>HTML elements</a> may be orphan nodes
+ (i.e. without a parent node).</p>
+
+ <div class=example>
+
+ <p>For example, creating a <code><a href=#the-td-element>td</a></code> element and storing it
+ in a global variable in a script is conforming, even though
+ <code><a href=#the-td-element>td</a></code> elements are otherwise only supposed to be used
+ inside <code><a href=#the-tr-element>tr</a></code> elements.</p>
+
+ <pre>var data = {
+ name: "Banana",
+ cell: document.createElement('td'),
+};</pre>
+
+ </div>
+
+
+ <h5 id=kinds-of-content><span class=secno>3.2.5.1 </span>Kinds of content</h5>
+
+ <p>Each element in HTML falls into zero or more <dfn id=content-categories title="content
+ categories">categories</dfn> that group elements with similar
+ characteristics together. The following broad categories are used in
+ this specification:</p>
+
+ <ul class=brief><li><a href=#metadata-content>Metadata content</a></li>
+ <li><a href=#flow-content>Flow content</a></li>
+ <li><a href=#sectioning-content>Sectioning content</a></li>
+ <li><a href=#heading-content>Heading content</a></li>
+ <li><a href=#phrasing-content>Phrasing content</a></li>
+ <li><a href=#embedded-content>Embedded content</a></li>
+ <li><a href=#interactive-content>Interactive content</a></li>
+ </ul><p class=note>Some elements also fall into other categories, which
+ are defined in other parts of this specification.</p>
+
+ <p>These categories are related as follows:</p>
+
+ <p><object data=images/content-venn.svg height=288 width=1000><img alt="Sectioning content, heading content, phrasing content, and
+ embedded content are all types of flow content. Embedded content is
+ also a type of phrasing content." src=images/content-venn.png></object></p>
+
+ <p>In addition, certain elements are categorized as <a href=#form-associated-element title="form-associated element">form-associated elements</a> and
+ further subcategorized to define their role in various form-related
+ processing models.</p>
+
+ <p>Some elements have unique requirements and do not fit into any
+ particular category.</p>
+
+
+ <h6 id=metadata-content-0><span class=secno>3.2.5.1.1 </span>Metadata content</h6>
+
+ <p><dfn id=metadata-content>Metadata content</dfn> is content that sets up the
+ presentation or behavior of the rest of the content, or that sets
+ up the relationship of the document with other documents, or that
+ conveys other "out of band" information.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-base-element>base</a></code></li>
+ <li><code><a href=#the-command>command</a></code></li>
+ <li><code><a href=#the-link-element>link</a></code></li>
+ <li><code><a href=#meta>meta</a></code></li>
+ <li><code><a href=#the-noscript-element>noscript</a></code></li>
+ <li><code><a href=#script>script</a></code></li>
+ <li><code><a href=#the-style-element>style</a></code></li>
+ <li><code><a href=#the-title-element-0>title</a></code></li>
+ </ul><p>Elements from other namespaces whose semantics are primarily
+ metadata-related (e.g. RDF) are also <a href=#metadata-content>metadata
+ content</a>.</p>
+
+ <div class=example>
+
+ <p>Thus, in the XML serialization, one can use RDF, like this:</p>
+
+ <pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt;
+ &lt;head&gt;
+ &lt;title&gt;Hedral's Home Page&lt;/title&gt;
+ &lt;r:RDF&gt;
+ &lt;Person xmlns="http://www.w3.org/2000/10/swap/pim/contact#"
+ r:about="http://hedral.example.com/#"&gt;
+ &lt;fullName&gt;Cat Hedral&lt;/fullName&gt;
+ &lt;mailbox r:resource="mailto:hedral@damowmow.com"/&gt;
+ &lt;personalTitle&gt;Sir&lt;/personalTitle&gt;
+ &lt;/Person&gt;
+ &lt;/r:RDF&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;h1&gt;My home page&lt;/h1&gt;
+ &lt;p&gt;I like playing with string, I guess. Sister says squirrels are fun
+ too so sometimes I follow her to play with them.&lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>This isn't possible in the HTML serialization, however.</p>
+
+ </div>
+
+
+ <h6 id=flow-content-0><span class=secno>3.2.5.1.2 </span>Flow content</h6>
+
+ <p>Most elements that are used in the body of documents and
+ applications are categorized as <dfn id=flow-content>flow content</dfn>.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-a-element>a</a></code></li>
+ <li><code><a href=#the-abbr-element>abbr</a></code></li>
+ <li><code><a href=#the-address-element>address</a></code></li>
+ <li><code><a href=#the-area-element>area</a></code> (if it is a descendant of a <code><a href=#the-map-element>map</a></code> element)</li>
+ <li><code><a href=#the-article-element>article</a></code></li>
+ <li><code><a href=#the-aside-element>aside</a></code></li>
+ <li><code><a href=#audio>audio</a></code></li>
+ <li><code><a href=#the-b-element>b</a></code></li>
+ <li><code><a href=#the-bdo-element>bdo</a></code></li>
+ <li><code><a href=#the-blockquote-element>blockquote</a></code></li>
+ <li><code><a href=#the-br-element>br</a></code></li>
+ <li><code><a href=#the-button-element>button</a></code></li>
+ <li><code><a href=#the-canvas-element>canvas</a></code></li>
+ <li><code><a href=#the-cite-element>cite</a></code></li>
+ <li><code><a href=#the-code-element>code</a></code></li>
+ <li><code><a href=#the-command>command</a></code></li>
+<!-- v2DATAGRID <li><code>datagrid</code></li> -->
+ <li><code><a href=#the-datalist-element>datalist</a></code></li>
+ <li><code><a href=#the-del-element>del</a></code></li>
+ <li><code><a href=#the-details-element>details</a></code></li>
+ <li><code><a href=#the-dfn-element>dfn</a></code></li>
+ <li><code><a href=#the-div-element>div</a></code></li>
+ <li><code><a href=#the-dl-element>dl</a></code></li>
+ <li><code><a href=#the-em-element>em</a></code></li>
+ <li><code><a href=#the-embed-element>embed</a></code></li>
+ <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
+ <li><code><a href=#the-figure-element>figure</a></code></li>
+ <li><code><a href=#the-footer-element>footer</a></code></li>
+ <li><code><a href=#the-form-element>form</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></li>
+ <li><code><a href=#the-header-element>header</a></code></li>
+ <li><code><a href=#the-hgroup-element>hgroup</a></code></li>
+ <li><code><a href=#the-hr-element>hr</a></code></li>
+ <li><code><a href=#the-i-element>i</a></code></li>
+ <li><code><a href=#the-iframe-element>iframe</a></code></li>
+ <li><code><a href=#the-img-element>img</a></code></li>
+ <li><code><a href=#the-input-element>input</a></code></li>
+ <li><code><a href=#the-ins-element>ins</a></code></li>
+ <li><code><a href=#the-kbd-element>kbd</a></code></li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-label-element>label</a></code></li>
+
+ <li><code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
+
+ <li><code><a href=#the-map-element>map</a></code></li>
+ <li><code><a href=#the-mark-element>mark</a></code></li>
+ <li><code><a href=#math>math</a></code></li>
+ <li><code><a href=#menus>menu</a></code></li>
+
+ <li><code><a href=#meta>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
+
+ <li><code><a href=#the-meter-element>meter</a></code></li>
+ <li><code><a href=#the-nav-element>nav</a></code></li>
+ <li><code><a href=#the-noscript-element>noscript</a></code></li>
+ <li><code><a href=#the-object-element>object</a></code></li>
+ <li><code><a href=#the-ol-element>ol</a></code></li>
+ <li><code><a href=#the-output-element>output</a></code></li>
+ <li><code><a href=#the-p-element>p</a></code></li>
+ <li><code><a href=#the-pre-element>pre</a></code></li>
+ <li><code><a href=#the-progress-element>progress</a></code></li>
+ <li><code><a href=#the-q-element>q</a></code></li>
+ <li><code><a href=#the-ruby-element>ruby</a></code></li>
+ <li><code><a href=#the-samp-element>samp</a></code></li>
+ <li><code><a href=#script>script</a></code></li>
+ <li><code><a href=#the-section-element>section</a></code></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-small-element>small</a></code></li>
+ <li><code><a href=#the-span-element>span</a></code></li>
+ <li><code><a href=#the-strong-element>strong</a></code></li>
+ <li><code><a href=#the-style-element>style</a></code> (if the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present)</li>
+ <li><code><a href=#the-sub-and-sup-elements>sub</a></code></li>
+ <li><code><a href=#the-sub-and-sup-elements>sup</a></code></li>
+ <li><code><a href=#svg>svg</a></code></li>
+ <li><code><a href=#the-table-element>table</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ <li><code><a href=#the-time-element>time</a></code></li>
+ <li><code><a href=#the-ul-element>ul</a></code></li>
+ <li><code><a href=#the-var-element>var</a></code></li>
+ <li><code><a href=#video>video</a></code></li>
+ <li><code><a href=#the-wbr-element>wbr</a></code></li>
+ <li><a href=#text-content title="text content">Text</a></li>
+ </ul><p>As a general rule, elements whose content model allows any
+ <a href=#flow-content>flow content</a> should have either at least one descendant
+ <a href=#text-node>text node</a> that is not <a href=#inter-element-whitespace>inter-element
+ whitespace</a>, or at least one descendant element node that is
+ <a href=#embedded-content>embedded content</a>. For the purposes of this requirement,
+ <code><a href=#the-del-element>del</a></code> elements and their descendants must not be counted
+ as contributing to the ancestors of the <code><a href=#the-del-element>del</a></code>
+ element.</p>
+
+ <p>This requirement is not a hard requirement, however, as there are
+ many cases where an element can be empty legitimately, for example
+ when it is used as a placeholder which will later be filled in by a
+ script, or when the element is part of a template and would on most
+ pages be filled in but on some pages is not relevant.</p>
+
+
+ <h6 id=sectioning-content-0><span class=secno>3.2.5.1.3 </span>Sectioning content</h6>
+
+ <p><dfn id=sectioning-content>Sectioning content</dfn> is content that defines the scope
+ of <a href=#heading-content title="heading content">headings</a> and <a href=#the-footer-element title=footer>footers</a>.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-article-element>article</a></code></li>
+ <li><code><a href=#the-aside-element>aside</a></code></li>
+ <li><code><a href=#the-nav-element>nav</a></code></li>
+ <li><code><a href=#the-section-element>section</a></code></li>
+ </ul><p>Each <a href=#sectioning-content>sectioning content</a> element potentially has a
+ heading and an <a href=#outline>outline</a>. See the section on
+ <a href=#headings-and-sections>headings and sections</a> for further details.</p>
+
+ <p class=note>There are also certain elements that are <a href=#sectioning-root title="sectioning root">sectioning roots</a>. These are distinct
+ from <a href=#sectioning-content>sectioning content</a>, but they can also have an
+ <a href=#outline>outline</a>.</p>
+
+
+ <h6 id=heading-content-0><span class=secno>3.2.5.1.4 </span>Heading content</h6>
+
+ <p><dfn id=heading-content>Heading content</dfn> defines the header of a section
+ (whether explicitly marked up using <a href=#sectioning-content>sectioning content</a>
+ elements, or implied by the heading content itself).</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code></li>
+ <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></li>
+ <li><code><a href=#the-hgroup-element>hgroup</a></code></li>
+ </ul><h6 id=phrasing-content-0><span class=secno>3.2.5.1.5 </span>Phrasing content</h6>
+
+ <p><dfn id=phrasing-content>Phrasing content</dfn> is the text of the document, as well
+ as elements that mark up that text at the intra-paragraph
+ level. Runs of <a href=#phrasing-content>phrasing content</a> form <a href=#paragraph title=paragraph>paragraphs</a>.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-a-element>a</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>)</li>
+ <li><code><a href=#the-abbr-element>abbr</a></code></li>
+ <li><code><a href=#the-area-element>area</a></code> (if it is a descendant of a <code><a href=#the-map-element>map</a></code> element)</li>
+ <li><code><a href=#audio>audio</a></code></li>
+ <li><code><a href=#the-b-element>b</a></code></li>
+ <li><code><a href=#the-bdo-element>bdo</a></code></li>
+ <li><code><a href=#the-br-element>br</a></code></li>
+ <li><code><a href=#the-button-element>button</a></code></li>
+ <li><code><a href=#the-canvas-element>canvas</a></code></li>
+ <li><code><a href=#the-cite-element>cite</a></code></li>
+ <li><code><a href=#the-code-element>code</a></code></li>
+ <li><code><a href=#the-command>command</a></code></li>
+ <li><code><a href=#the-datalist-element>datalist</a></code></li>
+ <li><code><a href=#the-del-element>del</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>)</li>
+ <li><code><a href=#the-dfn-element>dfn</a></code></li>
+ <li><code><a href=#the-em-element>em</a></code></li>
+ <li><code><a href=#the-embed-element>embed</a></code></li>
+ <li><code><a href=#the-i-element>i</a></code></li>
+ <li><code><a href=#the-iframe-element>iframe</a></code></li>
+ <li><code><a href=#the-img-element>img</a></code></li>
+ <li><code><a href=#the-input-element>input</a></code></li>
+ <li><code><a href=#the-ins-element>ins</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>)</li>
+ <li><code><a href=#the-kbd-element>kbd</a></code></li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-label-element>label</a></code></li>
+
+ <li><code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
+
+ <li><code><a href=#the-map-element>map</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>)</li>
+ <li><code><a href=#the-mark-element>mark</a></code></li>
+ <li><code><a href=#math>math</a></code></li>
+
+ <li><code><a href=#meta>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
+
+ <li><code><a href=#the-meter-element>meter</a></code></li>
+ <li><code><a href=#the-noscript-element>noscript</a></code></li>
+ <li><code><a href=#the-object-element>object</a></code></li>
+ <li><code><a href=#the-output-element>output</a></code></li>
+ <li><code><a href=#the-progress-element>progress</a></code></li>
+ <li><code><a href=#the-q-element>q</a></code></li>
+ <li><code><a href=#the-ruby-element>ruby</a></code></li>
+ <li><code><a href=#the-samp-element>samp</a></code></li>
+ <li><code><a href=#script>script</a></code></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-small-element>small</a></code></li>
+ <li><code><a href=#the-span-element>span</a></code></li>
+ <li><code><a href=#the-strong-element>strong</a></code></li>
+ <li><code><a href=#the-sub-and-sup-elements>sub</a></code></li>
+ <li><code><a href=#the-sub-and-sup-elements>sup</a></code></li>
+ <li><code><a href=#svg>svg</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ <li><code><a href=#the-time-element>time</a></code></li>
+ <li><code><a href=#the-var-element>var</a></code></li>
+ <li><code><a href=#video>video</a></code></li>
+ <li><code><a href=#the-wbr-element>wbr</a></code></li>
+ <li><a href=#text-content title="text content">Text</a></li>
+ </ul><p>As a general rule, elements whose content model allows any
+ <a href=#phrasing-content>phrasing content</a> should have either at least one
+ descendant <a href=#text-node>text node</a> that is not <a href=#inter-element-whitespace>inter-element
+ whitespace</a>, or at least one descendant element node that is
+ <a href=#embedded-content>embedded content</a>. For the purposes of this requirement,
+ nodes that are descendants of <code><a href=#the-del-element>del</a></code> elements must not be
+ counted as contributing to the ancestors of the <code><a href=#the-del-element>del</a></code>
+ element.</p>
+
+ <p class=note>Most elements that are categorized as phrasing
+ content can only contain elements that are themselves categorized as
+ phrasing content, not any flow content.</p>
+
+ <p><dfn id=text-content title="text content">Text</dfn>, in the context of content
+ models, means <a href=#text-node title="text node">text nodes</a>. <a href=#text-content title="text content">Text</a> is sometimes used as a content
+ model on its own, but is also <a href=#phrasing-content>phrasing content</a>, and can
+ be <a href=#inter-element-whitespace>inter-element whitespace</a> (if the <a href=#text-node title="text
+ node">text nodes</a> are empty or contain just <a href=#space-character title="space
+ character">space characters</a>).</p>
+
+
+ <h6 id=embedded-content-0><span class=secno>3.2.5.1.6 </span>Embedded content</h6>
+
+ <p><dfn id=embedded-content>Embedded content</dfn> is content that imports another
+ resource into the document, or content from another vocabulary that
+ is inserted into the document.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#audio>audio</a></code></li>
+ <li><code><a href=#the-canvas-element>canvas</a></code></li>
+ <li><code><a href=#the-embed-element>embed</a></code></li>
+ <li><code><a href=#the-iframe-element>iframe</a></code></li>
+ <li><code><a href=#the-img-element>img</a></code></li>
+ <li><code><a href=#math>math</a></code></li>
+ <li><code><a href=#the-object-element>object</a></code></li>
+ <li><code><a href=#svg>svg</a></code></li>
+ <li><code><a href=#video>video</a></code></li>
+ </ul><p>Elements that are from namespaces other than the <a href=#html-namespace-0>HTML
+ namespace</a> and that convey content but not metadata, are
+ <a href=#embedded-content>embedded content</a> for the purposes of the content models
+ defined in this specification. (For example, MathML, or SVG.)</p>
+
+ <p>Some embedded content elements can have <dfn id=fallback-content>fallback
+ content</dfn>: content that is to be used when the external resource
+ cannot be used (e.g. because it is of an unsupported format). The
+ element definitions state what the fallback is, if any.</p>
+
+
+ <h6 id=interactive-content-0><span class=secno>3.2.5.1.7 </span>Interactive content</h6>
+
+<!--
+TESTS:
+http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cp%20tabindex%3D1%3Etest%20%3Ca%20href%3D%22%22%3E%20%3Cem%3Etest%3C/em%3E%20%3C/a%3E%0A%3Cscript%3E%0A%20function%20test%20%28e%29%20%7B%20w%28e.type%20+%20%27%20on%20%27%20+%20e.target.tagName%20+%20%27%20through%20%27%20+%20e.currentTarget.tagName%29%3B%20%7D%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%3C/script%3E%0A
+http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Ca%20href%3Dhttp%3A//google.com/%20target%3Da%3EA%3C/a%3E%3Ca%20href%3Dhttp%3A//yahoo.com/%20target%3Db%3EB%3C/a%3E%3Cbr%3E%0A%3Ciframe%20name%3Da%3E%3C/iframe%3E%3Ciframe%20name%3Db%3E%3C/iframe%3E%0A%3Cscript%3E%0A%20var%20a%20%3D%20document.getElementsByTagName%28%27a%27%29%5B0%5D%3B%0A%20var%20b%20%3D%20document.getElementsByTagName%28%27a%27%29%5B1%5D%3B%0A%20a.appendChild%28b%29%3B%0A%3C/script%3E
+http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Cform%20action%3D%22http%3A//google.com/%22%20onsubmit%3D%22w%28%27onsubmit%27%29%22%3E%3Cem%3EA%3C/em%3E%3C/form%3E%0A%3Cscript%3E%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.attachEvent%28%27onsubmit%27%2C%20function%20%28%29%20%7B%20w%28%27submit%20fired%27%29%20%7D%29%3B%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.fireEvent%28%27onsubmit%27%29%3B%0A%3C/script%3E
+http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Cform%20action%3D%22http%3A//google.com/%22%3EX%3C/form%3E%0A%3Cscript%3E%0Avar%20evt%20%3D%20document.createEvent%28%22Events%22%29%3B%0Aevt.initEvent%28%22submit%22%2C%20true%2C%20true%29%3B%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.dispatchEvent%28evt%29%3B%0A%3C/script%3E
+-->
+
+ <p><dfn id=interactive-content>Interactive content</dfn> is content that is specifically
+ intended for user interaction.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-a-element>a</a></code></li>
+ <li><code><a href=#audio>audio</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)</li>
+ <li><code><a href=#the-button-element>button</a></code></li>
+<!-- v2DATAGRID <li><code>datagrid</code></li> -->
+ <li><code><a href=#the-details-element>details</a></code></li>
+ <li><code><a href=#the-embed-element>embed</a></code></li>
+ <li><code><a href=#the-iframe-element>iframe</a></code></li>
+ <li><code><a href=#the-img-element>img</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)</li>
+ <li><code><a href=#the-input-element>input</a></code> (if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state)</li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-label-element>label</a></code></li>
+ <li><code><a href=#menus>menu</a></code> (if the <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state)</li>
+ <li><code><a href=#the-object-element>object</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)<!-- see also comment in <object> section --></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ <li><code><a href=#video>video</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)</li>
+ </ul><p>Certain elements in HTML have an <a href=#activation-behavior>activation
+ behavior</a>, which means that the user can activate them. This
+ triggers a sequence of events dependent on the activation mechanism,
+ and normally culminating in a <code title=event-click><a href=#event-click>click</a></code>
+ event followed by a <code title=event-DOMActivate><a href=#event-domactivate>DOMActivate</a></code> event<span class=impl>, as described below</span>.</p>
+
+ <div class=impl>
+
+ <p>The user agent should allow the user to manually trigger elements
+ that have an <a href=#activation-behavior>activation behavior</a>, for instance using
+ keyboard or voice input, or through mouse clicks. When the user
+ triggers an element with a defined <a href=#activation-behavior>activation behavior</a>
+ in a manner other than clicking it, the default action of the
+ interaction event must be to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
+ steps</a> on the element.</p> <!-- interaction event spec point -->
+
+ <p>When a user agent is to <dfn id=run-synthetic-click-activation-steps>run synthetic click activation
+ steps</dfn> on an element, the user agent must <a href=#run-pre-click-activation-steps>run pre-click
+ activation steps</a> on the element, then <a href=#fire-a-click-event>fire a <code title=event-click>click</code> event</a> at the element. The
+ default action of this <code title=event-click><a href=#event-click>click</a></code> event
+ must be to <a href=#run-post-click-activation-steps>run post-click activation steps</a> on the
+ element. If the event is canceled, the user agent must <a href=#run-canceled-activation-steps>run
+ canceled activation steps</a> on the element instead.</p>
+
+ <p>Given an element <var title="">target</var>, the <dfn id=nearest-activatable-element>nearest
+ activatable element</dfn> is the element returned by the following
+ algorithm:</p>
+
+ <ol><li><p>If <var title="">target</var> has a defined <a href=#activation-behavior>activation
+ behavior</a>, then return <var title="">target</var> and abort
+ these steps.</li>
+
+ <li><p>If <var title="">target</var> has a parent element, then set
+ <var title="">target</var> to that parent element and return to the
+ first step.</li>
+
+ <li><p>Otherwise, there is no <a href=#nearest-activatable-element>nearest activatable
+ element</a>.</li>
+
+ </ol><p>When a pointing device is clicked, the user agent must run these
+ steps:</p>
+
+ <ol><li><p>Let <var title="">e</var> be the <span title="">nearest
+ activatable element</span> of the element designated by the user,
+ if any.</li>
+
+ <li><p>If there is an element <var title="">e</var>, <a href=#run-pre-click-activation-steps>run
+ pre-click activation steps</a> on it.</li>
+
+ <li>
+
+ <p>Dispatch the required <code title=event-click><a href=#event-click>click</a></code>
+ event.</p> <!-- interaction event spec point -->
+
+ <p>If there is an element <var title="">e</var>, then the default
+ action of the <code title=event-click><a href=#event-click>click</a></code> event must be
+ to <a href=#run-post-click-activation-steps>run post-click activation steps</a> on element <var title="">e</var>.</p>
+
+ <p>If there is an element <var title="">e</var> but the event is
+ canceled, the user agent must <a href=#run-canceled-activation-steps>run canceled activation
+ steps</a> on element <var title="">e</var>.</p>
+
+ </li>
+
+ </ol><p class=note>The above doesn't happen for arbitrary synthetic
+ events dispatched by author script. However, the <code title=dom-click><a href=#dom-click>click()</a></code> method can be used to make it
+ happen programmatically.</p>
+
+ <p>When a user agent is to <dfn id=run-pre-click-activation-steps>run pre-click activation steps</dfn>
+ on an element, it must run the <dfn id=pre-click-activation-steps>pre-click activation steps</dfn>
+ defined for that element, if any.</p>
+
+ <p>When a user agent is to <dfn id=run-post-click-activation-steps>run post-click activation
+ steps</dfn> on an element, the user agent must <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-DOMActivate><a href=#event-domactivate>DOMActivate</a></code> that is cancelable at
+ that element. The default action of this event must be to <a href=#run-final-activation-steps>run
+ final activation steps</a> on that element. If the event is
+ canceled, the user agent must <a href=#run-canceled-activation-steps>run canceled activation
+ steps</a> on the element instead.</p>
+
+ <p>When a user agent is to <dfn id=run-canceled-activation-steps>run canceled activation steps</dfn>
+ on an element, it must run the <dfn id=canceled-activation-steps>canceled activation steps</dfn>
+ defined for that element, if any.</p>
+
+ <p>When a user agent is to <dfn id=run-final-activation-steps>run final activation steps</dfn> on
+ an element, it must run the <dfn id=activation-behavior>activation behavior</dfn> defined
+ for that element. Activation behaviors can refer to the <code title=event-click><a href=#event-click>click</a></code> and <code title=event-DOMActivate><a href=#event-domactivate>DOMActivate</a></code> events that were fired
+ by the steps above leading up to this point.</p>
+
+ </div>
+
+
+ <h5 id=transparent-content-models><span class=secno>3.2.5.2 </span>Transparent content models</h5>
+
+ <p>Some elements are described as <dfn id=transparent>transparent</dfn>; they have
+ "transparent" in the description of their content model.</p>
+
+ <p>When a content model includes a part that is "transparent", those
+ parts must not contain content that would not be conformant if all
+ transparent elements in the tree were replaced, in their parent
+ element, by the children in the "transparent" part of their content
+ model, retaining order.</p>
+
+ <div class=example>
+
+ <p>Consider the following markup fragment:</p>
+
+ <pre>&lt;p&gt;Hello &lt;a href="world.html"&gt;&lt;em&gt;wonderful&lt;/em&gt; world&lt;/a&gt;!&lt;/p&gt;</pre>
+
+ <p>Its DOM looks like the following:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">Hello </span><li class=t1><code><a href=#the-a-element>a</a></code> <span class=t2 title=""><code class="attribute name">href</code>="<code class="attribute value">world.html</code>"</span><ul><li class=t1><code><a href=#the-em-element>em</a></code><ul><li class=t3><code>#text</code>: <span title="">wonderful</span></ul><li class=t3><code>#text</code>: <span title=""> world</span></ul><li class=t3><code>#text</code>: <span title="">!</span></ul></ul><p>The content model of the <code><a href=#the-a-element>a</a></code> element is
+ <a href=#transparent>transparent</a>. To see if its contents are conforming,
+ therefore, the element is replaced by its contents:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">Hello </span><li class=t1><code><a href=#the-em-element>em</a></code><ul><li class=t3><code>#text</code>: <span title="">wonderful</span></ul><li class=t3><code>#text</code>: <span title=""> world</span><li class=t3><code>#text</code>: <span title="">!</span></ul></ul><p>Since that is conforming, the contents of the <code><a href=#the-a-element>a</a></code> are
+ conforming in the original fragment.</p>
+
+ </div>
+
+ <p>When a transparent element has no parent, then the part of its
+ content model that is "transparent" must instead be treated as
+ accepting any <a href=#flow-content>flow content</a>.</p>
+
+
+ <h5 id=paragraphs><span class=secno>3.2.5.3 </span>Paragraphs</h5>
+
+ <p class=note>The term <a href=#paragraph>paragraph</a> as defined in this
+ section is distinct from (though related to) the <code><a href=#the-p-element>p</a></code>
+ element defined later. The <a href=#paragraph>paragraph</a> concept defined
+ here is used to describe how to interpret documents.</p>
+
+ <p>A <dfn id=paragraph>paragraph</dfn> is typically a run of <a href=#phrasing-content>phrasing
+ content</a> that forms a block of text with one or more sentences
+ that discuss a particular topic, as in typography, but can also be
+ used for more general thematic grouping. For instance, an address is
+ also a paragraph, as is a part of a form, a byline, or a stanza in a
+ poem.</p>
+
+ <div class=example>
+
+ <p>In the following example, there are two paragraphs in a
+ section. There is also a heading, which contains phrasing content
+ that is not a paragraph. Note how the comments and
+ <a href=#inter-element-whitespace>inter-element whitespace</a> do not form paragraphs.</p>
+
+ <pre>&lt;section&gt;
+ &lt;h1&gt;Example of paragraphs&lt;/h1&gt;
+ This is the &lt;em&gt;first&lt;/em&gt; paragraph in this example.
+ &lt;p&gt;This is the second.&lt;/p&gt;
+ &lt;!-- This is not a paragraph. --&gt;
+&lt;/section&gt;</pre>
+
+ </div>
+
+ <p>Paragraphs in <a href=#flow-content>flow content</a> are defined relative to
+ what the document looks like without the <code><a href=#the-a-element>a</a></code>,
+ <code><a href=#the-ins-element>ins</a></code>, <code><a href=#the-del-element>del</a></code>, and <code><a href=#the-map-element>map</a></code> elements
+ complicating matters, since those elements, with their hybrid
+ content models, can straddle paragraph boundaries, as shown in the
+ first two examples below.</p>
+
+ <p class=note>Generally, having elements straddle paragraph
+ boundaries is best avoided. Maintaining such markup can be
+ difficult.</p>
+
+ <div class=example>
+
+ <p>The following example takes the markup from the earlier example
+ and puts <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements around some
+ of the markup to show that the text was changed (though in this
+ case, the changes admittedly don't make much sense). Notice how
+ this example has exactly the same paragraphs as the previous one,
+ despite the <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements &mdash;
+ the <code><a href=#the-ins-element>ins</a></code> element straddles the heading and the first
+ paragraph, and the <code><a href=#the-del-element>del</a></code> element straddles the boundary
+ between the two paragraphs.</p>
+
+ <pre>&lt;section&gt;
+ &lt;ins&gt;&lt;h1&gt;Example of paragraphs&lt;/h1&gt;
+ This is the &lt;em&gt;first&lt;/em&gt; paragraph in&lt;/ins&gt; this example&lt;del&gt;.
+ &lt;p&gt;This is the second.&lt;/p&gt;&lt;/del&gt;
+ &lt;!-- This is not a paragraph. --&gt;
+&lt;/section&gt;</pre>
+
+ </div>
+
+ <div class=impl>
+
+ <p>Let <var title="">view</var> be a view of the DOM that replaces
+ all <code><a href=#the-a-element>a</a></code>, <code><a href=#the-ins-element>ins</a></code>, <code><a href=#the-del-element>del</a></code>, and
+ <code><a href=#the-map-element>map</a></code> elements in the document with their contents. Then,
+ in <var title="">view</var>, for each run of sibling <a href=#phrasing-content>phrasing
+ content</a> nodes uninterrupted by other types of content, in an
+ element that accepts content other than <a href=#phrasing-content>phrasing
+ content</a> as well as <a href=#phrasing-content>phrasing content</a>, let <var title="">first</var> be the first node of the run, and let <var title="">last</var> be the last node of the run. For each such run
+ that consists of at least one node that is neither <a href=#embedded-content>embedded
+ content</a> nor <a href=#inter-element-whitespace>inter-element whitespace</a>, a
+ paragraph exists in the original DOM from immediately before <var title="">first</var> to immediately after <var title="">last</var>. (Paragraphs can thus span across
+ <code><a href=#the-a-element>a</a></code>, <code><a href=#the-ins-element>ins</a></code>, <code><a href=#the-del-element>del</a></code>, and
+ <code><a href=#the-map-element>map</a></code> elements.)</p>
+
+ <p>Conformance checkers may warn authors of cases where they have
+ paragraphs that overlap each other (this can happen with
+ <code><a href=#the-object-element>object</a></code>, <code><a href=#video>video</a></code>, <code><a href=#audio>audio</a></code>, and
+ <code><a href=#the-canvas-element>canvas</a></code> elements, and indirectly through elements in
+ other namespaces that allow HTML to be further embedded therein,
+ like <code><a href=#svg>svg</a></code> or <code><a href=#math>math</a></code>).</p> <!-- example below
+ -->
+
+ </div>
+
+ <p>A <a href=#paragraph>paragraph</a> is also formed explicitly by
+ <code><a href=#the-p-element>p</a></code> elements.</p>
+
+ <p class=note>The <code><a href=#the-p-element>p</a></code> element can be used to wrap
+ individual paragraphs when there would otherwise not be any content
+ other than phrasing content to separate the paragraphs from each
+ other.</p>
+
+ <div class=example>
+
+ <p>In the following example, the link spans half of the first
+ paragraph, all of the heading separating the two paragraphs, and
+ half of the second paragraph. It straddles the paragraphs and the
+ heading.</p>
+
+ <pre>&lt;aside&gt;
+ Welcome!
+ &lt;a href="about.html"&gt;
+ This is home of...
+ &lt;h1&gt;The Falcons!&lt;/h1&gt;
+ The Lockheed Martin multirole jet fighter aircraft!
+ &lt;/a&gt;
+ This page discusses the F-16 Fighting Falcon's innermost secrets.
+&lt;/aside&gt;</pre>
+
+ <p>Here is another way of marking this up, this time showing the
+ paragraphs explicitly, and splitting the one link element into
+ three:</p>
+
+ <pre>&lt;aside&gt;
+ &lt;p&gt;Welcome! &lt;a href="about.html"&gt;This is home of...&lt;/a&gt;&lt;/p&gt;
+ &lt;h1&gt;&lt;a href="about.html"&gt;The Falcons!&lt;/a&gt;&lt;/h1&gt;
+ &lt;p&gt;&lt;a href="about.html"&gt;The Lockheed Martin multirole jet
+ fighter aircraft!&lt;/a&gt; This page discusses the F-16 Fighting
+ Falcon's innermost secrets.&lt;/p&gt;
+&lt;/aside&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <!-- I don't know if there's a better way to deal with this, but if
+ there is, let me know... -->
+
+ <p>It is possible for paragraphs to overlap when using certain
+ elements that define fallback content. For example, in the
+ following section:</p>
+
+ <pre>&lt;section&gt;
+ &lt;h1&gt;My Cats&lt;/h1&gt;
+ You can play with my cat simulator.
+ &lt;object data="cats.sim"&gt;
+ To see the cat simulator, use one of the following links:
+ &lt;ul&gt;
+ &lt;li&gt;&lt;a href="cats.sim"&gt;Download simulator file&lt;/a&gt;
+ &lt;li&gt;&lt;a href="http://sims.example.com/watch?v=LYds5xY4INU"&gt;Use online simulator&lt;/a&gt;
+ &lt;/ul&gt;
+ Alternatively, upgrade to the Mellblom Browser.
+ &lt;/object&gt;
+ I'm quite proud of it.
+&lt;/section&gt;</pre>
+
+ <p>There are five paragraphs:</p>
+
+ <ol class=brief><li>The paragraph that says "You can play with my cat
+ simulator. <i title="">object</i> I'm quite proud of it.", where
+ <i title="">object</i> is the <code><a href=#the-object-element>object</a></code> element.</li>
+
+ <li>The paragraph that says "To see the cat simulator, use one of
+ the following links:".</li>
+
+ <li>The paragraph that says "Download simulator file".</li>
+
+ <li>The paragraph that says "Use online simulator".</li>
+
+ <li>The paragraph that says "Alternatively, upgrade to the Mellblom Browser.".</li>
+
+ </ol><p>The first paragraph is overlapped by the other four. A user
+ agent that supports the "cats.sim" resource will only show the
+ first one, but a user agent that shows the fallback will
+ confusingly show the first sentence of the first paragraph as
+ if it was in the same paragraph as the second one, and will show
+ the last paragraph as if it was at the start of the second sentence
+ of the first paragraph.</p>
+
+ <p>To avoid this confusion, explicit <code><a href=#the-p-element>p</a></code> elements can be
+ used.</p>
+
+ </div>
+
+
+
+ <h4 id=annotations-for-assistive-technology-products-(aria)><span class=secno>3.2.6 </span><dfn>Annotations for assistive technology products</dfn> (ARIA)</h4>
+
+ <p>Authors may use the ARIA <code title=attr-aria-role>role</code>
+ and <code title=attr-aria-*>aria-*</code> attributes on <a href=#html-elements>HTML
+ elements</a>, in accordance with the requirements described in
+ the ARIA specifications, except where these conflict with the
+ <span>strong native semantics</span> described below. These
+ exceptions are intended to prevent authors from making assistive
+ technology products report nonsensical states that do not represent
+ the actual state of the document. <a href=#refsARIA>[ARIA]</a></p>
+
+ <div class=impl>
+
+ <p>User agents are required to implement ARIA semantics on all
+ <a href=#html-elements>HTML elements</a>, as defined in the ARIA
+ specifications. The <span>implicit ARIA semantics</span> defined
+ below must be recognized by implementations. <a href=#refsARIAIMPL>[ARIAIMPL]</a></p>
+
+ </div>
+
+ <p>The following table defines the <span>strong native
+ semantics</span> <span class=impl>and corresponding <span>implicit
+ ARIA semantics</span></span> that apply to <a href=#html-elements>HTML
+ elements</a>. Each language feature (element or attribute) in a
+ cell in the first column implies the ARIA semantics (role, states,
+ and/or properties) given in the cell in the second column of the
+ same row. Authors must not set the ARIA <code title=attr-aria-role>role</code> and <code title=attr-aria-*>aria-*</code> attributes in a manner that
+ conflicts with the semantics described in the following table. <span class=impl>When multiple rows apply to an element, the role from
+ the last row to define a role must be applied, and the states and
+ properties from all the rows must be combined.</span></p>
+
+ <table><thead><tr><th>Language feature
+ <th>Strong native semantics <span class=impl>and implied ARIA semantics</span>
+
+ <tbody><tr><td><code><a href=#the-a-element>a</a></code> element that represents a <a href=#hyperlink>hyperlink</a>
+ <td><code title=attr-aria-role-link>link</code> role
+
+ <tr><td><code><a href=#the-area-element>area</a></code> element that represents a <a href=#hyperlink>hyperlink</a>
+ <td><code title=attr-aria-role-link>link</code> role
+
+ <tr><td><code><a href=#the-button-element>button</a></code> element
+ <td><code title=attr-aria-role-button>button</code> role
+
+ <tr><td><code><a href=#the-datalist-element>datalist</a></code> element
+ <td><code title=attr-aria-role-listbox>listbox</code> role, with the <code title=attr-aria-multiselectable>aria-multiselectable</code> property set to "false"
+
+ <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
+ <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
+
+ <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
+ <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
+
+ <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
+ <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
+
+ <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
+ <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
+
+ <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
+ <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
+
+ <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
+ <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
+
+ <tr><td><code><a href=#the-hgroup-element>hgroup</a></code> element
+ <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
+
+ <tr><td><code><a href=#the-hr-element>hr</a></code> element
+ <td><code title=attr-aria-role-separator>separator</code> role
+
+ <tr><td><code><a href=#the-img-element>img</a></code> element whose <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value is empty
+ <td><code title=attr-aria-role-presentation>presentation</code> role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#button-state title=attr-input-type-button>Button</a> state
+ <td><code title=attr-aria-role-button>button</code> role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state
+ <td><code title=attr-aria-role-checkbox>checkbox</code> role, with the <code title=attr-aria-checked>aria-checked</code> state set to "mixed" if the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is true, or "true" if the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is true, or "false" otherwise
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#color-state title=attr-input-type-color>Color</a> state
+ <td>No role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#date-state title=attr-input-type-date>Date</a> state
+ <td>No role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#date-and-time-state title=attr-input-type-datetime>Date and Time</a> state
+ <td>No role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#local-date-and-time-state title=attr-input-type-datetime-local>Local Date and Time</a> state
+ <td>No role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#e-mail-state title=attr-input-type-email>E-mail</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
+ <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state
+ <td><code title=attr-aria-role-button>button</code> role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state
+ <td>No role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state
+ <td><code title=attr-aria-role-button>button</code> role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#month-state title=attr-input-type-month>Month</a> state
+ <td>No role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#number-state title=attr-input-type-number>Number</a> state
+ <td><code title=attr-aria-role-spinbutton>spinbutton</code> role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute, the <code title=attr-aria-valuemax>aria-valuemax</code> property set to the element's <a href=#concept-input-max title=concept-input-max>maximum</a>, the <code title=attr-aria-valuemin>aria-valuemin</code> property set to the element's <a href=#concept-input-min title=concept-input-min>minimum</a>, and, if the result of applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point number values</a> to the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, with the <code title=attr-aria-valuenow>aria-valuenow</code> property set to that number
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#password-state title=attr-input-type-password>Password</a> state
+ <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a> state
+ <td><code title=attr-aria-role-radio>radio</code> role, with the <code title=attr-aria-checked>aria-checked</code> state set to "true" if the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is true, or "false" otherwise
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#range-state title=attr-input-type-range>Range</a> state
+ <td><code title=attr-aria-role-slider>slider</code> role, with the <code title=attr-aria-valuemax>aria-valuemax</code> property set to the element's <a href=#concept-input-max title=concept-input-max>maximum</a>, the <code title=attr-aria-valuemin>aria-valuemin</code> property set to the element's <a href=#concept-input-min title=concept-input-min>minimum</a>, and the <code title=attr-aria-valuenow>aria-valuenow</code> property set to the result of applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point number values</a> to the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, if that that results in a number, or the <a href=#concept-input-value-default-range title=concept-input-value-default-range>default value</a> otherwise
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#reset-button-state title=attr-input-type-reset>Reset Button</a> state
+ <td><code title=attr-aria-role-button>button</code> role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#text-state-and-search-state title=attr-input-type-search>Search</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
+ <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a> state
+ <td><code title=attr-aria-role-button>button</code> role
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#telephone-state title=attr-input-type-tel>Telephone</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
+ <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
+ <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a>, <a href=#text-state-and-search-state title=attr-input-type-search>Search</a>, <a href=#telephone-state title=attr-input-type-tel>Telephone</a>, <a href=#url-state title=attr-input-type-url>URL</a>, or <a href=#e-mail-state title=attr-input-type-email>E-mail</a> states with a <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
+ <td><code title=attr-aria-role-combobox>combobox</code> role, with the <code title=attr-aria-owns>aria-owns</code> property set to the same value as the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute, and the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#time-state title=attr-input-type-time>Time</a> state
+ <td>No role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#url-state title=attr-input-type-url>URL</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
+ <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#week-state title=attr-input-type-week>Week</a> state
+ <td>No role, with the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-link-element>link</a></code> element that represents a <a href=#hyperlink>hyperlink</a>
+ <td><code title=attr-aria-role-link>link</code> role
+
+ <tr><td><code><a href=#menus>menu</a></code> element with a <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#context-menu-state title="context menu state">context menu</a> state
+ <td>No role
+
+ <tr><td><code><a href=#menus>menu</a></code> element with a <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#list-state title="list state">list</a> state
+ <td><code title=attr-aria-role-menu>menu</code> role
+
+ <tr><td><code><a href=#menus>menu</a></code> element with a <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#toolbar-state title="toolbar state">toolbar</a> state
+ <td><code title=attr-aria-role-toolbar>toolbar</code> role
+
+ <tr><td><code><a href=#the-nav-element>nav</a></code> element
+ <td><code title=attr-aria-role-navigation>navigation</code> role
+
+ <tr><td><code><a href=#the-option-element>option</a></code> element that is in a <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> or that represents a suggestion in a <code><a href=#the-datalist-element>datalist</a></code> element
+ <td><code title=attr-aria-role-option>option</code> role, with the <code title=attr-aria-selected>aria-selected</code> state set to "true" if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, or "false" otherwise.
+
+ <tr><td><code><a href=#the-progress-element>progress</a></code> element
+ <td><code title=attr-aria-role-progressbar>progressbar</code> role, with, if the progress bar is determinate, the <code title=attr-aria-valuemax>aria-valuemax</code> property set to the maximum value of the progress bar, the <code title=attr-aria-valuemin>aria-valuemin</code> property set to zero, and the <code title=attr-aria-valuenow>aria-valuenow</code> property set to the current value of the progress bar
+
+ <tr><td><code><a href=#the-select-element>select</a></code> element with a <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
+ <td><code title=attr-aria-role-listbox>listbox</code> role, with the <code title=attr-aria-multiselectable>aria-multiselectable</code> property set to "true"
+
+ <tr><td><code><a href=#the-select-element>select</a></code> element with no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
+ <td><code title=attr-aria-role-listbox>listbox</code> role, with the <code title=attr-aria-multiselectable>aria-multiselectable</code> property set to "false"
+
+ <tr><td><code><a href=#the-td-element>td</a></code> element
+ <td><code title=attr-aria-role-gridcell>gridcell</code> role, with the <code title=attr-aria-labelledby>aria-labelledby</code> property set to the value of the <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute, if any
+
+ <tr><td><code><a href=#the-textarea-element>textarea</a></code> element
+ <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-multiline>aria-multiline</code> property set to "true", and the <code title=title-aria-readonly>aria-readonly</code> state set to "true" if the element has a <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute
+
+ <tr><td><code><a href=#the-th-element>th</a></code> element that is neither a <a href=#column-header>column header</a> nor a <a href=#row-header>row header</a>
+ <td><code title=attr-aria-role-gridcell>gridcell</code> role, with the <code title=attr-aria-labelledby>aria-labelledby</code> property set to the value of the <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute, if any
+
+ <tr><td><code><a href=#the-th-element>th</a></code> element that is a <a href=#column-header>column header</a>
+ <td><code title=attr-aria-role-columnheader>columnheader</code> role, with the <code title=attr-aria-labelledby>aria-labelledby</code> property set to the value of the <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute, if any
+
+ <tr><td><code><a href=#the-th-element>th</a></code> element that is a <a href=#row-header>row header</a>
+ <td><code title=attr-aria-role-rowheader>rowheader</code> role, with the <code title=attr-aria-labelledby>aria-labelledby</code> property set to the value of the <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute, if any
+
+ <tr><td><code><a href=#the-tr-element>tr</a></code> element
+ <td><code title=attr-aria-role-row>row</code> role
+
+ <tr><td>An element that <a href=#concept-command title=concept-command>defines a command</a>, whose <a href=#command-facet-type title=command-facet-type>Type</a> facet is "checkbox", and that is a descendant of a <code><a href=#menus>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#list-state title="list state">list</a> state
+ <td><code title=attr-aria-role-menuitemcheckbox>menuitemcheckbox</code> role, with the <code title=attr-aria-checked>aria-checked</code> state set to "true" if the command's <a href=#command-facet-checkedstate title=command-facet-checkedstate>Checked State</a> facet is true, and "false" otherwise
+
+ <tr><td>An element that <a href=#concept-command title=concept-command>defines a command</a>, whose <a href=#command-facet-type title=command-facet-type>Type</a> facet is "command", and that is a descendant of a <code><a href=#menus>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#list-state title="list state">list</a> state
+ <td><code title=attr-aria-role-menuitem>menuitem</code> role
+
+ <tr><td>An element that <a href=#concept-command title=concept-command>defines a command</a>, whose <a href=#command-facet-type title=command-facet-type>Type</a> facet is "radio", and that is a descendant of a <code><a href=#menus>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#list-state title="list state">list</a> state
+ <td><code title=attr-aria-role-menuitemradio>menuitemradio</code> role, with the <code title=attr-aria-checked>aria-checked</code> state set to "true" if the command's <a href=#command-facet-checkedstate title=command-facet-checkedstate>Checked State</a> facet is true, and "false" otherwise
+
+ <tr><td>Elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>
+ <td>The <code title=title-aria-disabled>aria-disabled</code> state set to "true"
+
+ <tr><td>Elements that are <a href=#concept-input-required title=concept-input-required>required</a>
+ <td>The <code title=title-aria-required>aria-required</code> state set to "true"
+
+ </table><p>Some <a href=#html-elements>HTML elements</a> have native semantics that can be
+ overridden. The following table lists these elements<span class=impl> and their <span>implicit ARIA semantics</span></span>,
+ along with the restrictions that apply to those elements. Each
+ language feature (element or attribute) in a cell in the first
+ column implies, unless otherwise overriden, the ARIA semantic (role,
+ state, or property) given in the cell in the second column of the
+ same row, but this semantic may be overridden under the conditions
+ listed in the cell in the third column of that row.</p>
+
+ <table><thead><tr><th>Language feature
+ <th>Default implied ARIA semantic
+ <th>Restrictions
+
+ <tbody><tr><td><code><a href=#the-address-element>address</a></code> element
+ <td>No role
+ <td>If specified, role must be <code title=attr-aria-role-contentinfo>contentinfo</code> (ARIA restricts usage of this role to one per page)
+
+ <tr><td><code><a href=#the-article-element>article</a></code> element
+ <td><code title=attr-aria-role-article>article</code> role
+ <td>Role must be either <code title=attr-aria-role-article>article</code>, <code title=attr-aria-role-document>document</code>, <code title=attr-aria-role-application>application</code>, or <code title=attr-aria-role-main>main</code> (ARIA restricts usage of this role to one per page)
+
+ <tr><td><code><a href=#the-aside-element>aside</a></code> element
+ <td><code title=attr-aria-role-note>note</code> role
+ <td>Role must be either <code title=attr-aria-role-note>note</code>, <code title=attr-aria-role-complementary>complementary</code>, or <code title=attr-aria-role-search>search</code>
+
+ <tr><td><code><a href=#the-footer-element>footer</a></code> element
+ <td>No role
+ <td>If specified, role must be <code title=attr-aria-role-contentinfo>contentinfo</code> (ARIA restricts usage of this role to one per page)
+
+ <tr><td><code><a href=#the-header-element>header</a></code> element
+ <td>No role
+ <td>If specified, role must be <code title=attr-aria-role-banner>banner</code> (ARIA restricts usage of this role to one per page)
+
+ <tr><td><code><a href=#the-li-element>li</a></code> element whose parent is an <code><a href=#the-ol-element>ol</a></code> or <code><a href=#the-ul-element>ul</a></code> element
+ <td><code title=attr-aria-role-listitem>listitem</code> role
+ <td>Role must be either <code title=attr-aria-role-listitem>listitem</code> or <code title=attr-aria-role-treeitem>treeitem</code>
+
+ <tr><td><code><a href=#the-ol-element>ol</a></code> element
+ <td><code title=attr-aria-role-list>list</code> role
+ <td>Role must be either <code title=attr-aria-role-list>list</code>, <code title=attr-aria-role-tree>tree</code>, or <code title=attr-aria-role-directory>directory</code>
+
+ <tr><td><code><a href=#the-output-element>output</a></code> element
+ <td><code title=attr-aria-role-status>status</code> role
+ <td>No restrictions
+
+ <tr><td><code><a href=#the-section-element>section</a></code> element
+ <td><code title=attr-aria-role-region>region</code> role
+ <td>Role must be either <code title=attr-aria-role-region>region</code>, <code title=attr-aria-role-document>document</code>, <code title=attr-aria-role-application>application</code>, <code title=attr-aria-role-contentinfo>contentinfo</code> (ARIA restricts usage of this role to one per page), <code title=attr-aria-role-main>main</code> (ARIA restricts usage of this role to one per page), <code title=attr-aria-role-search>search</code>, <code title=attr-aria-role-alert>alert</code>, <code title=attr-aria-role-dialog>dialog</code>, <code title=attr-aria-role-alertdialog>alertdialog</code>, <code title=attr-aria-role-status>status</code>, or <code title=attr-aria-role-log>log</code>
+
+ <tr><td><code><a href=#the-table-element>table</a></code> element
+ <td><code title=attr-aria-role-grid>grid</code> role
+ <td>Role must be either <code title=attr-aria-role-grid>grid</code> or <code title=attr-aria-role-treegrid>treegrid</code>
+
+ <tr><td><code><a href=#the-ul-element>ul</a></code> element
+ <td><code title=attr-aria-role-list>list</code> role
+ <td>Role must be either <code title=attr-aria-role-list>list</code> or <code title=attr-aria-role-tree>tree</code>, or <code title=attr-aria-role-directory>directory</code>
+
+ <tr><td><a href=#the-body-element>The body element</a>
+ <td><code title=attr-aria-role-document>document</code> role
+ <td>Role must be either <code title=attr-aria-role-document>document</code> or <code title=attr-aria-role-application>application</code>
+
+ </table><div class=impl>
+
+ <p>User agents may apply different defaults than those described in
+ this section in order to expose the semantics of <a href=#html-elements>HTML
+ elements</a> in a manner more fine-grained than possible with the
+ above definitions.</p>
+
+ <p>Conformance checkers are encouraged to phrase errors such that
+ authors are encouraged to use more appropriate elements rather than
+ remove accessibility annotations. For example, if an <code><a href=#the-a-element>a</a></code>
+ element is marked as having the <code title=attr-aria-role-button>button</code> role, a conformance
+ checker could say "Either a <code><a href=#the-button-element>button</a></code> element or an
+ <code><a href=#the-input-element>input</a></code> element is required when using the <code title=attr-aria-role-button>button</code> role" rather than "The
+ <code title=attr-aria-role-button>button</code> role cannot be
+ used with <code><a href=#the-a-element>a</a></code> elements".</p>
+
+ </div>
+
+
+ <h3 id=apis-in-html-documents><span class=secno>3.3 </span>APIs in HTML documents</h3>
+
+ <p>For <a href=#html-documents>HTML documents</a>, and for <a href=#html-elements>HTML
+ elements</a> in <a href=#html-documents>HTML documents</a>, certain APIs defined
+ in DOM Core become case-insensitive or case-changing, as sometimes
+ defined in DOM Core, and as summarized <span class=impl>or
+ required</span> below. <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <p>This does not apply to <a href=#xml-documents>XML documents</a> or to elements
+ that are not in the <a href=#html-namespace-0>HTML namespace</a> despite being in
+ <a href=#html-documents>HTML documents</a>.</p>
+
+ <dl><dt><code title=dom-Element-tagName><a href=#dom-element-tagname>Element.tagName</a></code> and <code title=dom-Node-nodeName>Node.nodeName</code></dt>
+
+ <dd>
+
+ <p>These attributes <span class=impl>must</span> return element
+ names <a href=#converted-to-ascii-uppercase>converted to ASCII uppercase</a>, regardless of the case
+ with which they were created.</p>
+
+ </dd>
+
+
+ <dt><code title=dom-Document-createElement>Document.createElement()</code></dt>
+
+ <dd>
+
+ <p>The canonical form of HTML markup is all-lowercase; thus, this
+ method will <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">lowercase</a>
+ the argument before creating the requisite element. <span class=impl>Also, the element created must be in the <a href=#html-namespace-0>HTML
+ namespace</a></span>.</p>
+
+ <p class=note>This doesn't apply to <code title="">Document.createElementNS()</code>. Thus, it is possible,
+ by passing this last method a tag name in the wrong case, to
+ create an element that appears to have the same tag name as that
+ of an element defined in this specification when its <code title=dom-Element-tagName><a href=#dom-element-tagname>tagName</a></code> attribute is examined, but that
+ doesn't support the corresponding interfaces. The "real" element
+ name (unaffected by case conversions) can be obtained from the
+ <code title=dom-Node-localName><a href=#dom-node-localname>localName</a></code> attribute.</p>
+
+ </dd>
+
+
+ <dt><code title=dom-Element-setAttribute>Element.setAttribute()</code></dt>
+ <dt><code title=dom-Element-setAttributeNode>Element.setAttributeNode()</code></dt>
+
+ <dd>
+
+ <p>Attribute names are <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</p>
+
+ <div class=impl>
+
+ <p>Specifically: when an attribute is set on an <a href=#html-elements title="HTML
+ elements">HTML element</a> using <code title="">Element.setAttribute()</code>, the name argument must be
+ <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> before the element is
+ affected; and when an <code><a href=#attr>Attr</a></code> node is set on an <a href=#html-elements title="HTML elements">HTML element</a> using <code title="">Element.setAttributeNode()</code>, it must have its name
+ <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> before the element is
+ affected.</p>
+
+ </div>
+
+ <p class=note>This doesn't apply to <code title="">Element.setAttributeNS()</code> and <code title="">Element.setAttributeNodeNS()</code>.</p>
+
+ </dd>
+
+
+ <dt><code title=dom-Element-getAttribute>Element.getAttribute()</code></dt>
+ <dt><code title=dom-Element-getAttributeNode>Element.getAttributeNode()</code></dt>
+
+ <dd>
+
+ <p>Attribute names are <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</p>
+
+ <div class=impl>
+
+ <p>Specifically: When the <code title="">Element.getAttribute()</code> method or the <code title="">Element.getAttributeNode()</code> method is invoked on
+ an <a href=#html-elements title="HTML elements">HTML element</a>, the name
+ argument must be <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> before the
+ element's attributes are examined.</p>
+
+ </div>
+
+ <p class=note>This doesn't apply to <code title="">Element.getAttributeNS()</code> and <code title="">Element.getAttributeNodeNS()</code>.</p>
+
+ </dd>
+
+
+ <dt><code title=dom-Document-getElementsByTagName>Document.getElementsByTagName()</code></dt>
+ <dt><code title=dom-Element-getElementsByTagName>Element.getElementsByTagName()</code></dt>
+
+ <dd>
+
+ <p>HTML elements match by lower-casing the argument before
+ comparison, elements from other namespaces are treated as in XML
+ (case-sensitively).</p>
+
+ <div class=impl>
+
+ <p>Specifically, these methods (but not their namespaced
+ counterparts) must compare the given argument in a
+ <a href=#case-sensitive>case-sensitive</a> manner, but when looking at <a href=#html-elements title="HTML elements">HTML elements</a>, the argument must
+ first be <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</p>
+
+ </div>
+
+ <p class=note>Thus, in an <a href=#html-documents title="HTML documents">HTML
+ document</a> with nodes in multiple namespaces, these methods
+ will effectively be both case-sensitive and case-insensitive at
+ the same time.</p>
+
+ </dd>
+
+
+ </dl><div class=impl>
+
+ <h3 id=interactions-with-xpath-and-xslt><span class=secno>3.4 </span>Interactions with XPath and XSLT</h3>
+
+ <p id=xpath-1.0-processors>Implementations of XPath 1.0 that
+ operate on HTML documents parsed or created in the manners described
+ in this specification (e.g. as part of the <code title="">document.evaluate()</code> API) must act as if the
+ following edit was applied to the XPath 1.0 specification.</p>
+
+ <p>First, remove this paragraph:</p>
+
+ <blockquote cite=http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests>
+
+ <p>A <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> in the
+ node test is expanded into an <a href=http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name>expanded-name</a>
+ using the namespace declarations from the expression context. This
+ is the same way expansion is done for element type names in start
+ and end-tags except that the default namespace declared with <code title="">xmlns</code> is not used: if the <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> does
+ not have a prefix, then the namespace URI is null (this is the same
+ way attribute names are expanded). It is an error if the <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> has a
+ prefix for which there is no namespace declaration in the
+ expression context.</p>
+
+ </blockquote>
+
+ <p>Then, insert in its place the following:</p>
+
+ <blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">
+
+ <p>A QName in the node test is expanded into an expanded-name using
+ the namespace declarations from the expression context. If the
+ QName has a prefix, then there must be a<!-- added 2009-10-27 -
+ http://www.w3.org/Bugs/Public/show_bug.cgi?id=8062 --> namespace
+ declaration for this prefix in the expression context, and the
+ corresponding<!-- typo fixed 2009-10-27 -
+ http://www.w3.org/Bugs/Public/show_bug.cgi?id=8063 --> namespace
+ URI is the one that is associated with this prefix. It is an error
+ if the QName has a prefix for which there is no namespace
+ declaration in the expression context. </p>
+
+ <p>If the QName has no prefix and the principal node type of the
+ axis is element, then the default element namespace is
+ used. Otherwise if the QName has no prefix, the namespace URI is
+ null. The default element namespace is a member of the context for
+ the XPath expression. The value of the default element namespace
+ when executing an XPath expression through the DOM3 XPath API is
+ determined in the following way:</p>
+
+ <ol><li>If the context node is from an HTML DOM, the default element
+ namespace is "http://www.w3.org/1999/xhtml".</li>
+
+ <li>Otherwise, the default element namespace URI is null.</li>
+
+ </ol><p class=note>This is equivalent to adding the default element
+ namespace feature of XPath 2.0 to XPath 1.0, and using the HTML
+ namespace as the default element namespace for HTML documents. It
+ is motivated by the desire to have implementations be compatible
+ with legacy HTML content while still supporting the changes that
+ this specification introduces to HTML regarding the namespace used
+ for HTML elements, and by the desire to use XPath 1.0 rather than
+ XPath 2.0.</p>
+
+ </blockquote>
+
+ <p class=note>This change is a <a href=#willful-violation>willful violation</a> of
+ the XPath 1.0 specification, motivated by desire to have
+ implementations be compatible with legacy content while still
+ supporting the changes that this specification introduces to HTML
+ regarding which namespace is used for HTML elements. <a href=#refsXPATH10>[XPATH10]</a></p> <!-- note: version matters for
+ this ref -->
+
+ <hr><p id=dom-based-xslt-1.0-processors>XSLT 1.0 processors outputting
+ to a DOM when the output method is "html" (either explicitly or via
+ the defaulting rule in XSLT 1.0) are affected as follows:</p>
+
+ <p>If the transformation program outputs an element in no namespace,
+ the processor must, prior to constructing the corresponding DOM
+ element node, change the namespace of the element to the <a href=#html-namespace-0>HTML
+ namespace</a>, <a href=#converted-to-ascii-lowercase title="converted to ASCII
+ lowercase">ASCII-lowercase</a> the element's local name, and
+ <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">ASCII-lowercase</a>
+ the names of any non-namespaced attributes on the element.</p>
+
+ <p class=note>This requirement is a <a href=#willful-violation>willful violation</a>
+ of the XSLT 1.0 specification, required because this specification
+ changes the namespaces and case-sensitivity rules of HTML in a
+ manner that would otherwise be incompatible with DOM-based XSLT
+ transformations. (Processors that serialize the output are
+ unaffected.) <a href=#refsXSLT10>[XSLT10]</a></p> <!-- note:
+ version matters for this ref -->
+
+ </div>
+
+
+
+ <h3 id=dynamic-markup-insertion><span class=secno>3.5 </span><dfn>Dynamic markup insertion</dfn></h3>
+
+ <p class=note>APIs for dynamically inserting markup into the
+ document interact with the parser, and thus their behavior varies
+ depending on whether they are used with <a href=#html-documents>HTML documents</a>
+ (and the <a href=#html-parser>HTML parser</a>) or XHTML in <a href=#xml-documents>XML
+ documents</a> (and the <a href=#xml-parser>XML parser</a>).</p>
+
+
+
+ <h4 id=opening-the-input-stream><span class=secno>3.5.1 </span>Opening the input stream</h4>
+
+ <p>The <dfn id=dom-document-open title=dom-document-open><code>open()</code></dfn>
+ method comes in several variants with different numbers of
+ arguments.</p>
+
+ <dl class=domintro><dt><var title="">document</var> = <var title="">document</var> . <code title=dom-document-open><a href=#dom-document-open>open</a></code>( [ <var title="">type</var> [, <var title="">replace</var> ] ] )</dt>
+
+ <dd>
+
+ <p>Causes the <code><a href=#document>Document</a></code> to be replaced in-place, as if
+ it was a new <code><a href=#document>Document</a></code> object, but reusing the
+ previous object, which is then returned.</p>
+
+ <p>If the <var title="">type</var> argument is omitted or has the
+ value "<code><a href=#text/html>text/html</a></code>", then the resulting
+ <code><a href=#document>Document</a></code> has an HTML parser associated with it, which
+ can be given data to parse using <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code>. Otherwise, all
+ content passed to <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> will be parsed
+ as plain text.</p>
+
+ <p>If the <var title="">replace</var> argument is present and has
+ the value "<code title="">replace</code>", the existing entries in
+ the session history for the <code><a href=#document>Document</a></code> object are
+ removed.</p>
+
+ <p>The method has no effect if the <code><a href=#document>Document</a></code> is still
+ being parsed.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if the
+ <code><a href=#document>Document</a></code> is an <a href=#xml-documents title="XML documents">XML
+ document</a>.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> = <var title="">document</var> . <code title=dom-document-open><a href=#dom-document-open>open</a></code>( <var title="">url</var>, <var title="">name</var>, <var title="">features</var> [, <var title="">replace</var> ] )</dt>
+
+ <dd>
+
+ <p>Works like the <code title=dom-open><a href=#dom-open>window.open()</a></code>
+ method.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>When called with two or fewer arguments, the method must act as
+ follows:</p>
+
+ <ol><li>If the <code><a href=#document>Document</a></code> object is not flagged as an <a href=#html-documents title="HTML documents">HTML document</a>, throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li><p>Let <var title="">type</var> be the value of the first
+ argument, if there is one, or "<code><a href=#text/html>text/html</a></code>"
+ otherwise.</li>
+
+ <li><p>Let <var title="">replace</var> be true if there is a second
+ argument and it is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
+ the value "replace", and false otherwise.</li>
+
+ <li>
+
+ <p>If the document has an <a href=#active-parser>active parser</a> that isn't a
+ <a href=#script-created-parser>script-created parser</a>, and the <a href=#insertion-point>insertion
+ point</a> associated with that parser's <a href=#the-input-stream>input
+ stream</a> is not undefined (that is, it <em>does</em> point to
+ somewhere in the input stream), then the method does
+ nothing. Abort these steps and return the <code><a href=#document>Document</a></code>
+ object on which the method was invoked.</p>
+
+ <p class=note>This basically causes <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> to be ignored
+ when it's called in an inline script found during the parsing of
+ data sent over the network, while still letting it have an effect
+ when called asynchronously or on a document that is itself being
+ spoon-fed using these APIs.</p>
+
+ </li>
+
+ <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>
+
+ <li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to
+ unload</a> the <code><a href=#document>Document</a></code> object. If the user
+ <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then
+ these steps must be aborted.</li>
+
+ <li><p><a href=#unload-a-document title="unload a document">Unload</a> the
+ <code><a href=#document>Document</a></code> object, with the <var title="">recycle</var>
+ parameter set to true.</li>
+
+ <li><p>If the document has an <a href=#active-parser>active parser</a>, then
+ <a href=#abort-an-html-parser title="abort an HTML parser">abort that
+ parser</a>.</li>
+
+ <li><p>Unregister all event listeners registered on the
+ <code><a href=#document>Document</a></code> node and its descendants.</p>
+
+ <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a>
+ associated with the <code><a href=#document>Document</a></code> in any <a href=#task-source>task
+ source</a>.</li> <!-- removes callbacks that fired between
+ this algorithm starting and the times and databases being aborted
+ in the "unload" step above -->
+
+ <li><p>Remove all child nodes of the document, without firing any
+ mutation events.</li> <!-- as of 2009-03-30, only WebKit fired
+ mutation events here. -->
+
+ <li><p>Replace the <code><a href=#document>Document</a></code>'s singleton objects with
+ new instances of those objects. (This includes in particular the
+ <code><a href=#window>Window</a></code>, <code><a href=#location>Location</a></code>, <code><a href=#history-0>History</a></code>,
+ <code><a href=#applicationcache>ApplicationCache</a></code>, <code><a href=#undomanager>UndoManager</a></code>,
+ <code><a href=#navigator>Navigator</a></code>, and <code><a href=#selection-0>Selection</a></code> objects, the
+ various <code><a href=#barprop>BarProp</a></code> objects, the two <code>Storage</code>
+ objects, and the various <code><a href=#htmlcollection>HTMLCollection</a></code> objects. It
+ also includes all the Web IDL prototypes in the JavaScript binding,
+ including the <code><a href=#document>Document</a></code> object's prototype.)</li>
+
+ <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%20src%3D%22document%22%3E%3C%2Fiframe%3E%0A%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20f%20%3D%20document.getElementsByTagName('iframe')%5B0%5D%3B%20d%20%3D%20f.contentWindow.document%3B%20%7D%3C%2Fscript%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22w(d.documentElement.innerHTML)%22%20value%3D%22dump%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cscript%3Evar%20x%20%3D%20new%20XMLHttpRequest()%3Bx.open(%26quot%3BGET%26quot%3B%2C%20%26quot%3BGET%26quot%3B)%3Bx.onreadystatechange%3Dfunction()%20%7B%20alert(x.readyState)%3B%20%7D%3Bx.send(null)%3B%3C%2Fscript%3E')%3Bd.close()%3B%20setTimeout(function()%20%7B%20d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%20%7D%2C%200)%3B%22%20value%3D%22xhr%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.onclick%20%3D%20function()%20%7B%20w('click')%20%7D%22%20value%3D%22add%20click%20handler%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3E%3Cscript%3Ei%20%3D%200%3B%20setTimeout(%26quot%3Bparent.w(i%2B%2B)%26quot%3B%2C%202000)%3C%2Fscript%3E%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%20with%20timer%22%3E -->
+ <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A...%3Ciframe%3E%3C%2Fiframe%3E%0D%0A%3Cscript%3E%0D%0Aonload%20%3D%20function%20()%20%7B%0D%0A%20frames%5B0%5D.test%20%3D%201%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20var%20a%20%3D%20frames%5B0%5D.document.location.assign%3B%0D%0A%20w(a)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%20frames%5B0%5D.document.open()%3B%0D%0A%20frames%5B0%5D.document.write('%3Cscript%3Edocument.write(test)%3C%5C%2Fscript%3E')%3B%0D%0A%20frames%5B0%5D.document.close()%3B%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E -->
+
+ <li><p>Change the <a href="#document's-character-encoding">document's character encoding</a> to
+ UTF-16.</li>
+
+ <li><p>Change <a href="#the-document's-address">the document's address</a> to the
+ <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
+ document">document</a>'s <a href="#the-document's-address" title="the document's
+ address">address</a>.</li>
+
+ <li><p>Create a new <a href=#html-parser>HTML parser</a> and associate it with
+ the document. This is a <dfn id=script-created-parser>script-created parser</dfn> (meaning
+ that it can be closed by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> and <code title=dom-document-close><a href=#dom-document-close>document.close()</a></code> methods, and
+ that the tokenizer will wait for an explicit call to <code title=dom-document-close><a href=#dom-document-close>document.close()</a></code> before emitting
+ an end-of-file token). The encoding <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
+ <i>irrelevant</i>.</li>
+
+ <li>
+
+ <!-- text/plain handling -->
+
+ <p>If the <var title="">type</var> string contains a U+003B
+ SEMICOLON character (;), remove the first such character and all
+ characters from it up to the end of the string.</p>
+
+ <p>Strip all leading and trailing <a href=#space-character title="space
+ character">space characters</a> from <var title="">type</var>.</p>
+
+ <p>If <var title="">type</var> is <em>not</em> now an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string
+ "<code><a href=#text/html>text/html</a></code>", then act as if the tokenizer had emitted
+ a start tag token with the tag name "pre", then switch the
+ <a href=#html-parser>HTML parser</a>'s tokenizer to the <a href=#plaintext-state>PLAINTEXT
+ state</a>.</p>
+
+ <!--
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20%0D%0A%20%20var%20d%20%3D%20document.getElementsByTagName('iframe')%5B0%5D.contentDocument%3B%0D%0A%20%20d.open('image%2Fsvg%2Bxml')%3B%0D%0A%20%20d.write(%22%3Cinput%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%20value%3D'(x)html'%2F%3E%22)%3B%0D%0A%20%20d.close()%3B%0D%0A%7D%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20%0D%0A%20%20var%20d%20%3D%20document.getElementsByTagName('iframe')%5B0%5D.contentDocument%3B%0D%0A%20%20d.open('image%2Fgif')%3B%0D%0A%20%20var%20a%20%3D%20%5B%200x47%2C%200x49%2C%200x46%2C%200x38%2C%200x39%2C%200x61%2C%200x01%2C%200x00%2C%200x01%2C%200x00%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x80%2C%200xff%2C%200x00%2C%200xc0%2C%200xc0%2C%200xc0%2C%200x00%2C%200x00%2C%200x00%2C%200x21%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200xf9%2C%200x04%2C%200x01%2C%200x00%2C%200x00%2C%200x00%2C%200x00%2C%200x2c%2C%200x00%2C%200x00%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x00%2C%200x00%2C%200x01%2C%200x00%2C%200x01%2C%200x00%2C%200x00%2C%200x02%2C%200x02%2C%200x44%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x01%2C%200x00%2C%200x3b%20%5D%3B%0D%0A%20%20var%20s%20%3D%20%22%22%3B%0D%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20a.length%3B%20i%20%2B%3D%201)%0D%0A%20%20%20%20s%20%2B%3D%20String.fromCharCode(a%5Bi%5D)%3B%0D%0A%20%20d.write(s)%3B%0D%0A%20%20d.close()%3B%0D%0A%7D%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27Text%2Fplain%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27%20text%2Fplain%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27text%2Fplain%3B%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
+ -->
+
+ </li>
+
+ <li>
+
+ <p>Remove all the entries in the <a href=#browsing-context>browsing context</a>'s
+ <a href=#session-history>session history</a> after the <a href=#current-entry>current
+ entry</a>. If the <a href=#current-entry>current entry</a> is the last entry
+ in the session history, then no entries are removed.</p>
+
+ <p class=note>This <a href=#history-notes>doesn't necessarily
+ have to affect</a> the user agent's user interface.</p>
+
+ </li>
+
+ <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> queued by
+ the <a href=#history-traversal-task-source>history traversal task source</a>.</li>
+
+ <li>Remove any earlier entries that share the same
+ <code><a href=#document>Document</a></code>.</li>
+
+ <li><p>If <var title="">replace</var> is false, then add a new
+ entry, just before the last entry, and associate with the new entry
+ the text that was parsed by the previous parser associated with the
+ <code><a href=#document>Document</a></code> object, as well as the state of the document
+ at the start of these steps. (This allows the user to step
+ backwards in the session history to see the page before it was
+ blown away by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> call.)</li>
+
+ <li><p>Finally, set the <a href=#insertion-point>insertion point</a> to point at
+ just before the end of the <a href=#the-input-stream>input stream</a> (which at this
+ point will be empty).</li>
+
+ <li><p>Return the <code><a href=#document>Document</a></code> on which the method was
+ invoked.</li>
+
+ </ol><p>When called with three or more arguments, the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method on the
+ <code><a href=#htmldocument>HTMLDocument</a></code> object must call the <code title=dom-open><a href=#dom-open>open()</a></code> method on the <code><a href=#window>Window</a></code>
+ object of the <code><a href=#htmldocument>HTMLDocument</a></code> object, with the same
+ arguments as the original call to the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method, and return whatever
+ that method returned. If the <code><a href=#htmldocument>HTMLDocument</a></code> object has no
+ <code><a href=#window>Window</a></code> object, then the method must raise an
+ <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception.</p>
+
+ </div>
+
+
+
+ <h4 id=closing-the-input-stream><span class=secno>3.5.2 </span>Closing the input stream</h4>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-close><a href=#dom-document-close>close</a></code>()</dt>
+
+ <dd>
+
+ <p>Closes the input stream that was opened by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if the
+ <code><a href=#document>Document</a></code> is an <a href=#xml-documents title="XML documents">XML
+ document</a>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-close title=dom-document-close><code>close()</code></dfn>
+ method must run the following steps:</p>
+
+ <ol><li><p>If the <code><a href=#document>Document</a></code> object is not flagged as an
+ <a href=#html-documents title="HTML documents">HTML document</a>, throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li><p>If there is no <a href=#script-created-parser>script-created parser</a> associated
+ with the document, then abort these steps.</li>
+
+ <li><p>Insert an <a href=#explicit-eof-character>explicit "EOF" character</a> at the end
+ of the parser's <a href=#the-input-stream>input stream</a>.</li>
+
+ <li><p>If there is a <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>,
+ then abort these steps.</li>
+
+ <li><p>Run the tokenizer, processing resulting tokens as they are
+ emitted, and stopping when the tokenizer reaches the <a href=#explicit-eof-character>explicit
+ "EOF" character</a> or <a href=#spin-the-event-loop title="spin the event loop">spins
+ the event loop</a>.</li>
+
+ </ol></div>
+
+
+
+ <h4 id=document.write()><span class=secno>3.5.3 </span><code title=dom-document-write><a href=#dom-document-write>document.write()</a></code></h4>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-write><a href=#dom-document-write>write</a></code>(<var title="">text</var>...)</dt>
+
+ <dd>
+
+ <p>Adds the given string(s) to the <code><a href=#document>Document</a></code>'s input
+ stream. If necessary, calls the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method implicitly
+ first.</p>
+
+ <p>This method throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception
+ when invoked on <a href=#xml-documents>XML documents</a>.</p>
+
+ <p>Unless called from the body of a <code><a href=#script>script</a></code> element
+ while the document is being parsed, or called on a script-created
+ document, calling this method will clear the current page first,
+ as if <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> had
+ been called.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-write title=dom-document-write><code>document.write(...)</code></dfn>
+ method must act as follows:</p>
+
+ <ol><li>
+
+ <p>If the method was invoked on an <a href=#xml-documents title="XML documents">XML
+ document</a>, throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code>
+ exception and abort these steps.</p>
+
+ <!--
+ Where would document.write() insert?
+ Consider: data:text/xml,<script xmlns="http://www.w3.org/1999/xhtml"><![CDATA[ document.write('<foo>Test</foo>'); ]]></script>
+ -->
+
+ </li>
+
+ <li>
+
+ <p>If the <a href=#insertion-point>insertion point</a> is undefined, the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method must be called
+ (with no arguments) on the <code title=Document><a href=#document>document</a></code>
+ object. If the user <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be
+ unloaded</a>, then these steps must be aborted. Otherwise, the
+ <a href=#insertion-point>insertion point</a> will point at just before the end of
+ the (empty) <a href=#the-input-stream>input stream</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>The string consisting of the concatenation of all the arguments
+ to the method must be inserted into the <a href=#the-input-stream>input stream</a>
+ just before the <a href=#insertion-point>insertion point</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>, then the
+ method must now return without further processing of the
+ <a href=#the-input-stream>input stream</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise, the tokenizer must process the characters that were
+ inserted, one at a time, processing resulting tokens as they are
+ emitted, and stopping when the tokenizer reaches the insertion
+ point or when the processing of the tokenizer is aborted by the
+ tree construction stage (this can happen if a <code><a href=#script>script</a></code>
+ end tag token is emitted by the tokenizer).
+
+ <p class=note>If the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> method was
+ called from script executing inline (i.e. executing because the
+ parser parsed a set of <code><a href=#script>script</a></code> tags), then this is a
+ <a href=#nestedParsing>reentrant invocation of the
+ parser</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Finally, the method must return.</p>
+
+ </li>
+
+ </ol></div>
+
+
+ <h4 id=document.writeln()><span class=secno>3.5.4 </span><code title=dom-document-writeln><a href=#dom-document-writeln>document.writeln()</a></code></h4>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-writeln><a href=#dom-document-writeln>writeln</a></code>(<var title="">text</var>...)</dt>
+
+ <dd>
+
+ <p>Adds the given string(s) to the <code><a href=#document>Document</a></code>'s input
+ stream, followed by a newline character. If necessary, calls the
+ <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method implicitly
+ first.</p>
+
+ <p>This method throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception
+ when invoked on <a href=#xml-documents>XML documents</a>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-writeln title=dom-document-writeln><code>document.writeln(...)</code></dfn>
+ method, when invoked, must act as if the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> method had been
+ invoked with the same argument(s), plus an extra argument consisting
+ of a string containing a single line feed character (U+000A).</p>
+
+ </div>
+
+
+
+ <h4 id=innerhtml><span class=secno>3.5.5 </span><code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code></h4>
+
+ <p>The <dfn id=dom-innerhtml title=dom-innerHTML><code>innerHTML</code></dfn> IDL
+ attribute represents the markup of the node's contents.</p>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns a fragment of HTML or XML that represents the
+ <code><a href=#document>Document</a></code>.</p>
+
+ <p>Can be set, to replace the <code><a href=#document>Document</a></code>'s contents
+ with the result of parsing the given string.</p>
+
+ <p>In the case of <a href=#xml-documents>XML documents</a>, will throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <code><a href=#document>Document</a></code> cannot
+ be serialized to XML, and a <code><a href=#syntax_err>SYNTAX_ERR</a></code> if the given
+ string is not well-formed.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns a fragment of HTML or XML that represents the element's
+ contents.</p>
+
+ <p>Can be set, to replace the contents of the element with nodes
+ parsed from the given string.</p>
+
+ <p>In the case of <a href=#xml-documents>XML documents</a>, will throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the element cannot be serialized
+ to XML, and a <code><a href=#syntax_err>SYNTAX_ERR</a></code> if the given string is not
+ well-formed.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>On getting, if the node's document is an <a href=#html-documents title="HTML
+ documents">HTML document</a>, then the attribute must return the
+ result of running the <a href=#html-fragment-serialization-algorithm>HTML fragment serialization
+ algorithm</a> on the node; otherwise, the node's document is an
+ <a href=#xml-documents title="XML documents">XML document</a>, and the attribute
+ must return the result of running the <a href=#xml-fragment-serialization-algorithm>XML fragment
+ serialization algorithm</a> on the node instead (this might raise
+ an exception instead of returning a string).</p>
+
+ <p>On setting, the following steps must be run:</p>
+
+ <ol><li>
+
+ <p>If the node's document is an <a href=#html-documents title="HTML documents">HTML
+ document</a>: Invoke the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing
+ algorithm</a>.</p>
+
+ <p>If the node's document is an <a href=#xml-documents title="XML documents">XML
+ document</a>: Invoke the <a href=#xml-fragment-parsing-algorithm>XML fragment parsing
+ algorithm</a>.</p>
+
+ <p>In either case, the algorithm must be invoked with the string
+ being assigned into the <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> attribute as the <var title="">input</var>. If the node is an <code><a href=#element>Element</a></code>
+ node, then, in addition, that element must be passed as the <var title="">context</var> element.</p>
+
+ <p>If this raises an exception, then abort these steps.</p>
+
+ <p>Otherwise, let <var title="">new children</var> be the nodes
+ returned.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the attribute is being set on a <code><a href=#document>Document</a></code> node,
+ and that document has an <a href=#active-parser>active parser</a>, then abort
+ that parser.</p>
+
+ </li>
+
+ <li>
+
+ <p>Remove the child nodes of the node whose <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> attribute is being set,
+ firing appropriate mutation events.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the attribute is being set on a <code><a href=#document>Document</a></code>
+ node, let <var title="">target document</var> be that
+ <code><a href=#document>Document</a></code> node. Otherwise, the attribute is being
+ set on an <code><a href=#element>Element</a></code> node; let <var title="">target
+ document</var> be the <code title="">ownerDocument</code> of
+ that <code><a href=#element>Element</a></code>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Set the <code title="">ownerDocument</code> of all the nodes in
+ <var title="">new children</var> to the <var title="">target
+ document</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Append all the <var title="">new children</var> nodes to the
+ node whose <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> attribute
+ is being set, preserving their order, and firing mutation events
+ as if a <code><a href=#documentfragment>DocumentFragment</a></code> containing the <var title="">new children</var> had been inserted.</p>
+
+ </li>
+
+ </ol></div>
+
+
+
+ <h4 id=outerhtml><span class=secno>3.5.6 </span><code title=dom-outerHTML><a href=#dom-outerhtml>outerHTML</a></code></h4>
+
+ <p>The <dfn id=dom-outerhtml title=dom-outerHTML><code>outerHTML</code></dfn> IDL
+ attribute represents the markup of the element and its contents.</p>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-outerHTML><a href=#dom-outerhtml>outerHTML</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns a fragment of HTML or XML that represents the element
+ and its contents.</p>
+
+ <p>Can be set, to replace the element with nodes parsed from the
+ given string.</p>
+
+ <p>In the case of <a href=#xml-documents>XML documents</a>, will throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the element cannot be serialized
+ to XML, and a <code><a href=#syntax_err>SYNTAX_ERR</a></code> if the given string is not
+ well-formed.</p>
+
+ <p>Throws a <code><a href=#no_modification_allowed_err>NO_MODIFICATION_ALLOWED_ERR</a></code> exception if
+ the parent of the element is the <code><a href=#document>Document</a></code>
+ node.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>On getting, if the node's document is an <a href=#html-documents title="HTML
+ documents">HTML document</a>, then the attribute must return the
+ result of running the <a href=#html-fragment-serialization-algorithm>HTML fragment serialization
+ algorithm</a> on a fictional node whose only child is the node on
+ which the attribute was invoked; otherwise, the node's document is
+ an <a href=#xml-documents title="XML documents">XML document</a>, and the
+ attribute must return the result of running the <a href=#xml-fragment-serialization-algorithm>XML fragment
+ serialization algorithm</a> on that fictional node instead (this
+ might raise an exception instead of returning a string).</p>
+
+ <p>On setting, the following steps must be run:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">target</var> be the element whose <code title=dom-outerHTML><a href=#dom-outerhtml>outerHTML</a></code> attribute is being
+ set.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">target</var> has no parent node, then abort
+ these steps. There would be no way to obtain a reference to the
+ nodes created even if the remaining steps were run.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">target</var>'s parent node is a
+ <code><a href=#document>Document</a></code> object, throw a
+ <code><a href=#no_modification_allowed_err>NO_MODIFICATION_ALLOWED_ERR</a></code> exception and abort these
+ steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">parent</var> be <var title="">target</var>'s
+ parent node, unless that is a <code><a href=#documentfragment>DocumentFragment</a></code> node,
+ in which case let <var title="">parent</var> be an arbitrary
+ <code><a href=#the-body-element-0>body</a></code> element.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">target</var>'s document is an <a href=#html-documents title="HTML documents">HTML document</a>: Invoke the <a href=#html-fragment-parsing-algorithm>HTML
+ fragment parsing algorithm</a>.</p>
+
+ <p>If <var title="">target</var>'s document is an <a href=#xml-documents title="XML
+ documents">XML document</a>: Invoke the <a href=#xml-fragment-parsing-algorithm>XML fragment
+ parsing algorithm</a>.</p>
+
+ <p>In either case, the algorithm must be invoked with the string
+ being assigned into the <code title=dom-outerHTML><a href=#dom-outerhtml>outerHTML</a></code> attribute as the <var title="">input</var>, and <var title="">parent</var> as the <var title="">context</var> element.</p>
+
+ <p>If this raises an exception, then abort these steps.</p>
+
+ <p>Otherwise, let <var title="">new children</var> be the nodes
+ returned.</p>
+
+ </li>
+
+ <li>
+
+ <p>Set the <code title="">ownerDocument</code> of all the nodes in
+ <var title="">new children</var> to <var title="">target</var>'s
+ document.</p>
+
+ </li>
+
+ <li>
+
+ <p>Remove <var title="">target</var> from its parent node, firing
+ mutation events as appropriate, and then insert in its place all
+ the <var title="">new children</var> nodes, preserving their
+ order, and again firing mutation events as if a
+ <code><a href=#documentfragment>DocumentFragment</a></code> containing the <var title="">new
+ children</var> had been inserted.</p>
+
+ </li>
+
+ </ol></div>
+
+
+
+ <h4 id=insertadjacenthtml()><span class=secno>3.5.7 </span><code title=dom-insertAdjacentHTML><a href=#dom-insertadjacenthtml>insertAdjacentHTML()</a></code></h4>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-insertAdjacentHTML><a href=#dom-insertadjacenthtml>insertAdjacentHTML</a></code>(<var title="">position</var>, <var title="">text</var>)</dt>
+
+ <dd>
+
+ <p>Parses the given string <var title="">text</var> as HTML or XML
+ and inserts the resulting nodes into the tree in the position
+ given by the <var title="">position</var> argument, as
+ follows:</p>
+
+ <dl><dt>"beforebegin"</dt>
+ <dd>Before the element itself.</dd>
+ <dt>"afterbegin"</dt>
+ <dd>Just inside the element, before its first child.</dd>
+ <dt>"beforeend"</dt>
+ <dd>Just inside the element, after its last child.</dd>
+ <dt>"afterend"</dt>
+ <dd>After the element itself.</dd>
+ </dl><p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if the arguments
+ have invalid values (e.g., in the case of <a href=#xml-documents>XML
+ documents</a>, if the given string is not well-formed).</p>
+
+ <p>Throws a <code><a href=#no_modification_allowed_err>NO_MODIFICATION_ALLOWED_ERR</a></code> exception if
+ the given position isn't possible (e.g. inserting elements after
+ the root element of a <code><a href=#document>Document</a></code>).</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-insertadjacenthtml title=dom-insertAdjacentHTML><code>insertAdjacentHTML(<var title="">position</var>, <var title="">text</var>)</code></dfn>
+ method, when invoked, must run the following algorithm:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">position</var> and <var title="">text</var>
+ be the method's first and second arguments, respectively.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">target</var> be the element on which the
+ method was invoked.</p>
+
+ </li>
+
+ <li>
+
+ <p>Use the first matching item from this list:</p>
+
+ <dl><dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "beforebegin"</dt>
+ <dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "afterend"</dt>
+
+ <dd>
+
+ <p>If <var title="">target</var> has no parent node, then abort
+ these steps.</p>
+
+ <p>If <var title="">target</var>'s parent node is a
+ <code><a href=#document>Document</a></code> object, then throw a
+ <code><a href=#no_modification_allowed_err>NO_MODIFICATION_ALLOWED_ERR</a></code> exception and abort
+ these steps.
+
+ <p>Otherwise, let <var title="">context</var> be the parent node
+ of <var title="">target</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "afterbegin"</dt>
+ <dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "beforeend"</dt>
+
+ <dd>
+
+ <p>Let <var title="">context</var> be the same as <var title="">target</var>.</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>Throw a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>If <var title="">target</var>'s document is an <a href=#html-documents title="HTML documents">HTML document</a>: Invoke the <a href=#html-fragment-parsing-algorithm>HTML
+ fragment parsing algorithm</a>.</p>
+
+ <p>If <var title="">target</var>'s document is an <a href=#xml-documents title="XML
+ documents">XML document</a>: Invoke the <a href=#xml-fragment-parsing-algorithm>XML fragment
+ parsing algorithm</a>.</p>
+
+ <p>In either case, the algorithm must be invoked with <var title="">text</var> as the <var title="">input</var>, and the
+ element selected in by the previous step as the <var title="">context</var> element.</p>
+
+ <p>If this raises an exception, then abort these steps.</p>
+
+ <p>Otherwise, let <var title="">new children</var> be the nodes
+ returned.</p>
+
+ </li>
+
+ <li>
+
+ <p>Set the <code title="">ownerDocument</code> of all the nodes in
+ <var title="">new children</var> to <var title="">target</var>'s
+ document.</p>
+
+ </li>
+
+ <li>
+
+ <p>Use the first matching item from this list:</p>
+
+ <dl><dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "beforebegin"</dt>
+
+ <dd>
+
+ <p>Insert all the <var title="">new children</var> nodes
+ immediately before <var title="">target</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "afterbegin"</dt>
+
+ <dd>
+
+ <p>Insert all the <var title="">new children</var> nodes before
+ the first child of <var title="">target</var>, if there is
+ one. If there is no such child, append them all to <var title="">target</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "beforeend"</dt>
+
+ <dd>
+
+ <p>Append all the <var title="">new children</var> nodes to <var title="">target</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">position</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "afterend"</dt>
+
+ <dd>
+
+ <p>Insert all the <var title="">new children</var> nodes
+ immediately after <var title="">target</var>.</p>
+
+ </dd>
+
+ </dl><p>The <var title="">new children</var> nodes must be inserted in
+ a manner that preserves their order and fires mutation events as
+ if a <code><a href=#documentfragment>DocumentFragment</a></code> containing the <var title="">new children</var> had been inserted.</p>
+
+ </li>
+
+ </ol></div>
+
+
+
+ <h2 id=semantics><span class=secno>4 </span>The elements of HTML</h2>
+
+ <h3 id=the-root-element><span class=secno>4.1 </span>The root element</h3>
+
+ <h4 id=the-html-element-0><span class=secno>4.1.1 </span>The <dfn><code>html</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As the root element of a document.</dd>
+ <dd>Wherever a subdocument fragment is allowed in a compound document.</dd>
+ <dt>Content model:</dt>
+ <dd>A <code><a href=#the-head-element-0>head</a></code> element followed by a <code><a href=#the-body-element-0>body</a></code> element.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlhtmlelement>HTMLHtmlElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-html-element-0>html</a></code> element <a href=#represents>represents</a> the root of
+ an HTML document.</p>
+
+ <p>The <dfn id=attr-html-manifest title=attr-html-manifest><code>manifest</code></dfn>
+ attribute gives the address of the document's <a href=#application-cache>application
+ cache</a> <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>, if there is
+ one. If the attribute is present, the attribute's value must be a
+ <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</a>.</p>
+
+ <p>The <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute
+ only <a href=#concept-appcache-init title=concept-appcache-init>has an effect</a> during
+ the early stages of document load. Changing the attribute
+ dynamically thus has no effect (and thus, no DOM API is provided for
+ this attribute).</p>
+
+ <p class=note>For the purposes of <a href=#concept-appcache-init title=concept-appcache-init>application cache selection</a>,
+ later <code><a href=#the-base-element>base</a></code> elements cannot affect the <a href=#resolve-a-url title="resolve a url">resolving of relative URLs</a> in <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attributes, as the
+ attributes are processed before those elements are seen.</p>
+
+ <p class=note>The <code title=dom-applicationCache><a href=#dom-applicationcache>window.applicationCache</a></code> IDL
+ attribute provides scripted access to the offline <a href=#application-cache>application
+ cache</a> mechanism.</p>
+
+ <div class=example>
+
+ <p>The <code><a href=#the-html-element-0>html</a></code> element in the following example declares
+ that the document's language is English.</p>
+
+ <pre>&lt;!DOCTYPE html&gt;
+<strong>&lt;html lang="en"&gt;</strong>
+&lt;head&gt;
+&lt;title&gt;Swapping Songs&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;h1&gt;Swapping Songs&lt;/h1&gt;
+&lt;p&gt;Tonight I swapped some of the songs I wrote with some friends, who
+gave me some of the songs they wrote. I love sharing my music.&lt;/p&gt;
+&lt;/body&gt;
+<strong>&lt;/html&gt;</strong></pre>
+
+ </div>
+
+
+
+
+ <h3 id=document-metadata><span class=secno>4.2 </span>Document metadata</h3>
+
+ <h4 id=the-head-element-0><span class=secno>4.2.1 </span>The <dfn><code>head</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As the first element in an <code><a href=#the-html-element-0>html</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a> or if title information is available from a higher-level protocol: Zero or more elements of <a href=#metadata-content>metadata content</a>.</dd>
+ <dd>Otherwise: One or more elements of <a href=#metadata-content>metadata content</a>, of which exactly one is a <code><a href=#the-title-element-0>title</a></code> element.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlheadelement>HTMLHeadElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-head-element-0>head</a></code> element <a href=#represents>represents</a> a
+ collection of metadata for the <code><a href=#document>Document</a></code>.</p>
+
+ <div class=example>
+
+ <p>The collection of metadata in a <code><a href=#the-head-element-0>head</a></code> element can be
+ large or small. Here is an example of a very short one:</p>
+
+ <pre>&lt;!doctype html&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;A document with a short head&lt;/title&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ ...</pre>
+
+ <p>Here is an example of a longer one:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+ &lt;META CHARSET="UTF-8"&gt;
+ &lt;BASE HREF="http://www.example.com/"&gt;
+ &lt;TITLE&gt;An application with a long head&lt;/TITLE&gt;
+ &lt;LINK REL="STYLESHEET" HREF="default.css"&gt;
+ &lt;LINK REL="STYLESHEET ALTERNATE" HREF="big.css" TITLE="Big Text"&gt;
+ &lt;SCRIPT SRC="support.js"&gt;&lt;/SCRIPT&gt;
+ &lt;META NAME="APPLICATION-NAME" CONTENT="Long headed application"&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+ ...</pre>
+
+ </div>
+
+ <p class=note>The <code><a href=#the-title-element-0>title</a></code> element is a required child
+ in most situations, but when a higher-level protocol provides title
+ information, e.g. in the Subject line of an e-mail when HTML is used
+ as an e-mail authoring format, the <code><a href=#the-title-element-0>title</a></code> element can be
+ omitted.</p>
+
+
+
+ <h4 id=the-title-element-0><span class=secno>4.2.2 </span>The <dfn><code>title</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>In a <code><a href=#the-head-element-0>head</a></code> element containing no other <code><a href=#the-title-element-0>title</a></code> elements.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#text-content title="text content">Text</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmltitleelement>HTMLTitleElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-title-text title=dom-title-text>text</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-title-element-0>title</a></code> element <a href=#represents>represents</a> the
+ document's title or name. Authors should use titles that identify
+ their documents even when they are used out of context, for example
+ in a user's history or bookmarks, or in search results. The
+ document's title is often different from its first heading, since the
+ first heading does not have to stand alone when taken out of
+ context.</p>
+
+ <p>There must be no more than one <code><a href=#the-title-element-0>title</a></code> element per
+ document.</p>
+
+ <dl class=domintro><dt><var title="">title</var> . <code title=dom-title-text><a href=#dom-title-text>text</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the contents of the element, ignoring child nodes that
+ aren't <a href=#text-node title="text node">text nodes</a>.</p>
+
+ <p>Can be set, to replace the element's children with the given
+ value.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The IDL attribute <dfn id=dom-title-text title=dom-title-text><code>text</code></dfn> must return a
+ concatenation of the contents of all the <a href=#text-node title="text
+ node">text nodes</a> that are direct children of the
+ <code><a href=#the-title-element-0>title</a></code> element (ignoring any other nodes such as
+ comments or elements), in tree order. On setting, it must act the
+ same way as the <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here are some examples of appropriate titles, contrasted with
+ the top-level headings that might be used on those same pages.</p>
+
+ <pre> &lt;title&gt;Introduction to The Mating Rituals of Bees&lt;/title&gt;
+ ...
+ &lt;h1&gt;Introduction&lt;/h1&gt;
+ &lt;p&gt;This companion guide to the highly successful
+ &lt;cite&gt;Introduction to Medieval Bee-Keeping&lt;/cite&gt; book is...</pre>
+
+ <p>The next page might be a part of the same site. Note how the
+ title describes the subject matter unambiguously, while the first
+ heading assumes the reader knows what the context is and therefore
+ won't wonder if the dances are Salsa or Waltz:</p>
+
+ <pre> &lt;title&gt;Dances used during bee mating rituals&lt;/title&gt;
+ ...
+ &lt;h1&gt;The Dances&lt;/h1&gt;</pre>
+
+ </div>
+
+ <p>The string to use as the document's title is given by the <code title=dom-document-title><a href=#document.title>document.title</a></code> IDL
+ attribute. <span class=impl>User agents should use the document's
+ title when referring to the document in their user
+ interface.</span></p>
+
+
+ <h4 id=the-base-element><span class=secno>4.2.3 </span>The <dfn><code>base</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>In a <code><a href=#the-head-element-0>head</a></code> element containing no other <code><a href=#the-base-element>base</a></code> elements.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-base-href><a href=#attr-base-href>href</a></code></dd>
+ <dd><code title=attr-base-target><a href=#attr-base-target>target</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlbaseelement>HTMLBaseElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-base-href title=dom-base-href>href</a>;
+ attribute DOMString <a href=#dom-base-target title=dom-base-target>target</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-base-element>base</a></code> element allows authors to specify the
+ <a href=#document-base-url>document base URL</a> for the purposes of <a href=#resolve-a-url title="resolve a url">resolving relative URLs</a>, and the name
+ of the default <a href=#browsing-context>browsing context</a> for the purposes of
+ <a href=#following-hyperlinks>following hyperlinks</a>. The element does not <a href=#represents title=represents>represent</a> any content beyond this
+ information.</p>
+
+ <p>There must be no more than one <code><a href=#the-base-element>base</a></code> element per
+ document.</p>
+
+ <p>A <code><a href=#the-base-element>base</a></code> element must have either an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, a <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute, or both.</p>
+
+ <p>The <dfn id=attr-base-href title=attr-base-href><code>href</code></dfn> content
+ attribute, if specified, must contain a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially
+ surrounded by spaces</a>.</p>
+
+ <p>A <code><a href=#the-base-element>base</a></code> element, if it has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, must come before any
+ other elements in the tree that have attributes defined as taking
+ <a href=#url title=URL>URLs</a>, except the <code><a href=#the-html-element-0>html</a></code> element
+ (its <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute
+ isn't affected by <code><a href=#the-base-element>base</a></code> elements).</p>
+
+ <div class=impl>
+
+ <p class=note>If there are multiple <code><a href=#the-base-element>base</a></code> elements
+ with <code title=attr-base-href><a href=#attr-base-href>href</a></code> attributes, all but the
+ first are ignored.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-base-target title=attr-base-target><code>target</code></dfn>
+ attribute, if specified, must contain a <a href=#valid-browsing-context-name-or-keyword>valid browsing context
+ name or keyword</a>, which specifies which <a href=#browsing-context>browsing
+ context</a> is to be used as the default when <a href=#hyperlink title=hyperlink>hyperlinks</a> and <a href=#the-form-element title=form>forms</a> in the <code><a href=#document>Document</a></code> cause <a href=#navigate title=navigate>navigation</a>.</p>
+
+ <p>A <code><a href=#the-base-element>base</a></code> element, if it has a <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute, must come before
+ any elements in the tree that represent <a href=#hyperlink title=hyperlink>hyperlinks</a>.</p>
+
+ <div class=impl>
+
+ <p class=note>If there are multiple <code><a href=#the-base-element>base</a></code> elements
+ with <code title=attr-base-target><a href=#attr-base-target>target</a></code> attributes, all but
+ the first are ignored.</p>
+
+ <p>The <dfn id=dom-base-href title=dom-base-href><code>href</code></dfn> and <dfn id=dom-base-target title=dom-base-target><code>target</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, a <code><a href=#the-base-element>base</a></code> element is used to set the
+ <a href=#document-base-url>document base URL</a>:</p>
+
+ <pre>&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;This is an example for the &amp;lt;base&amp;gt; element&lt;/title&gt;
+ &lt;base href="http://www.example.com/news/index.html"&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;p&gt;Visit the &lt;a href="archives.html"&gt;archives&lt;/a&gt;.&lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>The link in the above example would be a link to "<code title="">http://www.example.com/news/archives.html</code>".</p>
+
+ </div>
+
+
+
+
+ <h4 id=the-link-element><span class=secno>4.2.4 </span>The <dfn><code>link</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+
+ <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#flow-content>flow content</a>.</dd>
+ <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#phrasing-content>phrasing content</a>.</dd>
+
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#metadata-content>metadata content</a> is expected.</dd>
+ <dd>In a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element-0>head</a></code> element.</dd>
+
+ <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-link-href><a href=#attr-link-href>href</a></code></dd>
+ <dd><code title=attr-link-rel><a href=#attr-link-rel>rel</a></code></dd>
+ <dd><code title=attr-link-media><a href=#attr-link-media>media</a></code></dd>
+ <dd><code title=attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code></dd>
+ <dd><code title=attr-link-type><a href=#attr-link-type>type</a></code></dd>
+ <dd><code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code></dd>
+ <dd>Also, the <code title=attr-link-title><a href=#attr-link-title>title</a></code> attribute has special semantics on this element.</dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmllinkelement>HTMLLinkElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-link-disabled title=dom-link-disabled>disabled</a>;
+ attribute DOMString <a href=#dom-link-href title=dom-link-href>href</a>;
+ attribute DOMString <a href=#dom-link-rel title=dom-link-rel>rel</a>;
+ readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-link-rellist title=dom-link-relList>relList</a>;
+ attribute DOMString <a href=#dom-link-media title=dom-link-media>media</a>;
+ attribute DOMString <a href=#dom-link-hreflang title=dom-link-hreflang>hreflang</a>;
+ attribute DOMString <a href=#dom-link-type title=dom-link-type>type</a>;
+ [PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-link-sizes title=dom-link-sizes>sizes</a>;
+};
+<a href=#htmllinkelement>HTMLLinkElement</a> implements <span>LinkStyle</span>;</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-link-element>link</a></code> element allows authors to link their
+ document to other resources.</p>
+
+ <p>The destination of the link(s) is given by the <dfn id=attr-link-href title=attr-link-href><code>href</code></dfn> attribute, which must
+ be present and must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially
+ surrounded by spaces</a>. <span class=impl>If the <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute is absent, then the
+ element does not define a link.</span></p>
+
+
+ <p>A <code><a href=#the-link-element>link</a></code> element must have either a <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute, or an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute, or both.</p>
+
+ <p>The types of link indicated (the relationships) are given by the
+ value of the <dfn id=attr-link-rel title=attr-link-rel><code>rel</code></dfn>
+ attribute, which, if present, must have a value that is a <a href=#set-of-space-separated-tokens>set
+ of space-separated tokens</a>. The <a href=#linkTypes>allowed
+ values and their meanings</a> are defined in a later section. <span class=impl>If the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute
+ is absent, or if none of the values used are allowed according to
+ the definitions in this specification, then the element does not
+ define a link.</span></p>
+
+ <p>Two categories of links can be created using the
+ <code><a href=#the-link-element>link</a></code> element. <dfn id=external-resource-link title="external resource link">Links
+ to external resources</dfn> are links to resources that are to be
+ used to augment the current document, and <dfn id=hyperlink-link title="hyperlink
+ link">hyperlink links</dfn> are <a href=#hyperlink title=hyperlink>links to
+ other documents</a>. The <a href=#linkTypes>link types
+ section</a> defines whether a particular link type is an external
+ resource or a hyperlink. One element can create multiple links (of
+ which some might be external resource links and some might be
+ hyperlinks); exactly which and how many links are created depends on
+ the keywords given in the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code>
+ attribute. User agents must process the links on a per-link basis,
+ not a per-element basis.</p>
+
+ <p class=note>Each link is handled separately. For instance, if
+ there are two <code><a href=#the-link-element>link</a></code> elements with <code title="">rel="stylesheet"</code>, they each count as a separate
+ external resource, and each is affected by its own attributes
+ independently.</p>
+
+ <p>The exact behavior for links to external resources depends on the
+ exact relationship, as defined for the relevant link type. Some of
+ the attributes control whether or not the external resource is to be
+ applied (as defined below).</p>
+
+ <div class=impl>
+
+ <p>For external resources that are represented in the
+ DOM (for example, style sheets), the DOM representation must be made
+ available even if the resource is not applied. To <dfn id=concept-link-obtain title=concept-link-obtain>obtain the resource</dfn>, the user
+ agent must run the following steps:</p>
+
+ <ol><li><p>If the <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute's
+ value is the empty string, then abort these steps.</li>
+
+ <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the
+ <a href=#url>URL</a> given by the <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute, relative to the
+ element.</li>
+
+ <li><p>If the previous step fails, then abort these steps.</li>
+
+ <li><p><a href=#fetch>Fetch</a> the resulting <a href=#absolute-url>absolute
+ URL</a>.</li> <!-- http-origin privacy sensitive -->
+
+ </ol><p>User agents may opt to only try to obtain such resources when
+ they are needed, instead of pro-actively <a href=#fetch title=fetch>fetching</a> all the external resources that are
+ not applied.</p>
+
+ <p>The semantics of the protocol used (e.g. HTTP) must be followed
+ when fetching external resources. (For example, redirects will be
+ followed and 404 responses will cause the external resource to not
+ be applied.)</p>
+
+ <!-- the next few paragraph are similar to text in the <style> section -->
+ <p>Once the attempts to obtain the resource and its <a href=#critical-subresources>critical
+ subresources</a> are complete, the user agent must, if the loads
+ were successful, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-load>load</code> at the
+ <code><a href=#the-link-element>link</a></code> element, or, if the resource or one of its
+ <a href=#critical-subresources>critical subresources</a> failed to completely load for any
+ reason (e.g. DNS error, HTTP 404 response, a connection being
+ prematurely closed, unsupported Content-Type), <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-link-element>link</a></code>
+ element. Non-network errors in processing the resource or its
+ subresources (e.g. CSS parse errors, PNG decoding errors) are not
+ failures for the purposes of this paragraph.</p>
+
+ <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#dom-manipulation-task-source>DOM manipulation task
+ source</a>.</p>
+
+ <p>The element must <a href=#delay-the-load-event>delay the load event</a> of the
+ element's document until all the attempts to obtain the resource and
+ its <a href=#critical-subresources>critical subresources</a> are complete. (Resources that
+ the user agent has not yet attempted to obtain, e.g. because it is
+ waiting for the resource to be needed, do not <a href=#delay-the-load-event>delay the load
+ event</a>.)</p>
+
+ <hr><p id=linkui>Interactive user agents may provide users with a
+ means to <a href=#following-hyperlinks title="following hyperlinks">follow the
+ hyperlinks</a> created using the <code><a href=#the-link-element>link</a></code> element,
+ somewhere within their user interface. The exact interface is not
+ defined by this specification, but it could include the following
+ information (obtained from the element's attributes, again as
+ defined below), in some form or another (possibly simplified), for
+ each hyperlink created with each <code><a href=#the-link-element>link</a></code> element in the
+ document:</p>
+
+ <ul><!-- the order here is the order that makes most sense for a UI --><li>The relationship between this document and the resource (given
+ by the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute)</li>
+
+ <li>The title of the resource (given by the <code title=attr-link-title><a href=#attr-link-title>title</a></code> attribute).</li>
+
+ <li>The address of the resource (given by the <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute).</li>
+
+ <li>The language of the resource (given by the <code title=attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code> attribute).</li>
+
+ <li>The optimum media for the resource (given by the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute).</li>
+
+ </ul><p>User agents could also include other information, such as the
+ type of the resource (as given by the <code title=attr-link-type><a href=#attr-link-type>type</a></code> attribute).</p>
+
+ </div>
+
+ <p class=note>Hyperlinks created with the <code><a href=#the-link-element>link</a></code>
+ element and its <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute
+ apply to the whole page. This contrasts with the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute of <code><a href=#the-a-element>a</a></code>
+ and <code><a href=#the-area-element>area</a></code> elements, which indicates the type of a link
+ whose context is given by the link's location within the
+ document.</p>
+
+ <p>The <dfn id=attr-link-media title=attr-link-media><code>media</code></dfn>
+ attribute says which media the resource applies to. The value must
+ be a <a href=#valid-media-query>valid media query</a>.</p>
+
+ <div class=impl>
+
+ <p>If the link is a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>
+ then the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute is
+ purely advisory, and describes for which media the document in
+ question was designed.</p>
+
+ <p>However, if the link is an <a href=#external-resource-link>external resource link</a>,
+ then the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute is
+ prescriptive. The user agent must apply the external resource when
+ the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute's value
+ <a href=#matches-the-environment>matches the environment</a> and the other relevant
+ conditions apply, and must not apply it otherwise.</p><!-- note
+ similar text in <style> section -->
+
+ <p class=note>The external resource might have further
+ restrictions defined within that limit its applicability. For
+ example, a CSS style sheet might have some <code title="">@media</code> blocks. This specification does not override
+ such further restrictions or requirements.</p><!-- note similar text
+ in <style> section -->
+
+ </div>
+
+ <p id=default-media>The default, if the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute is omitted, is "<code title="">all</code>", meaning that by default links apply to all
+ media.</p>
+
+ <p>The <dfn id=attr-link-hreflang title=attr-link-hreflang><code>hreflang</code></dfn>
+ attribute on the <code><a href=#the-link-element>link</a></code> element has the same semantics as
+ the <a href=#attr-hyperlink-hreflang title=attr-hyperlink-hreflang><code>hreflang</code>
+ attribute on hyperlink elements</a>.</p>
+
+ <p>The <dfn id=attr-link-type title=attr-link-type><code>type</code></dfn> attribute
+ gives the <a href=#mime-type>MIME type</a> of the linked resource. It is
+ purely advisory. The value must be a <a href=#valid-mime-type>valid MIME
+ type</a>.</p>
+
+ <p>For <a href=#external-resource-link title="external resource link">external resource
+ links</a>, the <code title=attr-link-type><a href=#attr-link-type>type</a></code> attribute
+ is used as a hint to user agents so that they can avoid fetching
+ resources they do not support. <span class=impl>If the attribute
+ is present, then the user agent must assume that the resource is of
+ the given type (even if that is not a <a href=#valid-mime-type>valid MIME type</a>,
+ e.g. the empty string). If the attribute is omitted, but the
+ external resource link type has a default type defined, then the
+ user agent must assume that the resource is of that type. If the UA
+ does not support the given <a href=#mime-type>MIME type</a> for the given link
+ relationship, then the UA should not <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource; if the UA
+ does support the given <a href=#mime-type>MIME type</a> for the given link
+ relationship, then the UA should <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource. If the
+ attribute is omitted, and the external resource link type does not
+ have a default type defined, but the user agent would <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource if the type
+ was known and supported, then the user agent should <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource under the
+ assumption that it will be supported.</span></p>
+
+ <div class=impl>
+
+ <p>User agents must not consider the <code title=attr-link-type><a href=#attr-link-type>type</a></code> attribute authoritative &mdash;
+ upon fetching the resource, user agents must not use the <code title=attr-link-type><a href=#attr-link-type>type</a></code> attribute to determine its actual
+ type. Only the actual type (as defined in the next paragraph) is
+ used to determine whether to <em>apply</em> the resource, not the
+ aforementioned assumed type.</p>
+
+ <p id=concept-link-type-sniffing>If the external resource link
+ type defines rules for processing the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a>, then those rules
+ apply. Otherwise, if the resource is expected to be an image, user
+ agents may apply the <a href=#content-type-sniffing:-image title="Content-Type sniffing:
+ image">image sniffing rules</a>, with the <var title="">official
+ type</var> being the type determined from the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a>, and use the
+ resulting sniffed type of the resource as if it was the actual
+ type. Otherwise, if neither of these conditions apply or if the user
+ agent opts not to apply the image sniffing rules, then the user
+ agent must use the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a> to determine the
+ type of the resource. If there is no type metadata, but the external
+ resource link type has a default type defined, then the user agent
+ must assume that the resource is of that type.</p>
+
+ <p class=note>The <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code>
+ link type defines rules for processing the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a>.</p>
+
+ <p>Once the user agent has established the type of the resource, the
+ user agent must apply the resource if it is of a supported type and
+ the other relevant conditions apply, and must ignore the resource
+ otherwise.</p>
+
+ <div class=example>
+
+ <p>If a document contains style sheet links labeled as follows:</p>
+
+ <pre>&lt;link rel="stylesheet" href="A" type="text/plain"&gt;
+&lt;link rel="stylesheet" href="B" type="text/css"&gt;
+&lt;link rel="stylesheet" href="C"&gt;</pre>
+
+ <p>...then a compliant UA that supported only CSS style sheets
+ would fetch the B and C files, and skip the A file (since
+ <code>text/plain</code> is not the <a href=#mime-type>MIME type</a> for CSS style
+ sheets).</p>
+
+ <p>For files B and C, it would then check the actual types returned
+ by the server. For those that are sent as <code>text/css</code>, it
+ would apply the styles, but for those labeled as
+ <code>text/plain</code>, or any other type, it would not.</p>
+
+ <p>If one of the two files was returned without a
+ <a href=#content-type>Content-Type</a> metadata, or with a syntactically
+ incorrect type like <code title="">Content-Type:&nbsp;"null"</code>, then the default type
+ for <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> links would kick
+ in. Since that default type is <code title="">text/css</code>, the
+ style sheet <em>would</em> nonetheless be applied.</p>
+
+ </div>
+
+ </div>
+
+ <p>The <dfn id=attr-link-title title=attr-link-title><code>title</code></dfn>
+ attribute gives the title of the link. With one exception, it is
+ purely advisory. The value is text. The exception is for style sheet
+ links, where the <code title=attr-link-title><a href=#attr-link-title>title</a></code>
+ attribute defines <span>alternative style sheet sets</span>.</p>
+
+ <p class=note>The <code title=attr-link-title><a href=#attr-link-title>title</a></code>
+ attribute on <code><a href=#the-link-element>link</a></code> elements differs from the global
+ <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute of most other
+ elements in that a link without a title does not inherit the title
+ of the parent element: it merely has no title.</p>
+
+ <p>The <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> attribute is used
+ with the <code title=rel-icon><a href=#rel-icon>icon</a></code> link type. The attribute
+ must not be specified on <code><a href=#the-link-element>link</a></code> elements that do not have
+ a <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute that specifies
+ the <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword.</p>
+
+ <div class=impl>
+
+ <p>Some versions of HTTP defined a <code title="">Link:</code>
+ header, to be processed like a series of <code><a href=#the-link-element>link</a></code> elements.
+ If supported, for the purposes of ordering links defined by HTTP
+ headers must be assumed to come before any links in the document, in
+ the order that they were given in the HTTP entity header. (URIs in
+ these headers are to be processed and resolved according to the
+ rules given in HTTP; the rules of <em>this</em> specification don't
+ apply.) <a href=#refsHTTP>[HTTP]</a> <a href=#refsWEBLINK>[WEBLINK]</a></p> <!-- WEBLINK is ref for Link: header -->
+
+ <p>The IDL attributes <dfn id=dom-link-href title=dom-link-href><code>href</code></dfn>, <dfn id=dom-link-rel title=dom-link-rel><code>rel</code></dfn>, <dfn id=dom-link-media title=dom-link-media><code>media</code></dfn>, <dfn id=dom-link-hreflang title=dom-link-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-link-type title=dom-link-type><code>type</code></dfn>, and <dfn id=dom-link-sizes title=dom-link-sizes><code>sizes</code></dfn> each must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The IDL attribute <dfn id=dom-link-rellist title=dom-link-rellist><code>relList</code></dfn> <span class=impl>must</span> <a href=#reflect title=reflect>reflect</a> the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> content attribute.</p>
+
+ </div>
+
+ <p>The IDL attribute <dfn id=dom-link-disabled title=dom-link-disabled><code>disabled</code></dfn> only applies
+ to style sheet links. When the <code><a href=#the-link-element>link</a></code> element defines a
+ style sheet link, then the <code title=dom-link-disabled><a href=#dom-link-disabled>disabled</a></code> attribute behaves as
+ defined <a href=#dom-linkstyle-disabled title=dom-linkstyle-disabled>for the alternative
+ style sheets DOM</a>. For all other <code><a href=#the-link-element>link</a></code> elements it
+ always return false and does nothing on setting.</p> <!-- that is
+ normatively required in the definition of dom-linkstyle-disabled -->
+
+ <p>The <code>LinkStyle</code> interface is also implemented by
+ this element; the <a href=#styling>styling processing model</a> defines
+ how. <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <div class=example>
+
+ <p>Here, a set of <code><a href=#the-link-element>link</a></code> elements provide some style
+ sheets:</p>
+
+ <pre>&lt;!-- a persistent style sheet --&gt;
+&lt;link rel="stylesheet" href="default.css"&gt;
+
+&lt;!-- the preferred alternate style sheet --&gt;
+&lt;link rel="stylesheet" href="green.css" title="Green styles"&gt;
+
+&lt;!-- some alternate style sheets --&gt;
+&lt;link rel="alternate stylesheet" href="contrast.css" title="High contrast"&gt;
+&lt;link rel="alternate stylesheet" href="big.css" title="Big fonts"&gt;
+&lt;link rel="alternate stylesheet" href="wide.css" title="Wide screen"&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how you can specify versions of the
+ page that use alternative formats, are aimed at other languages,
+ and that are intended for other media:</p>
+
+ <pre>&lt;link rel=alternate href="/en/html" hreflang=en type=text/html title="English HTML"&gt;
+&lt;link rel=alternate href="/fr/html" hreflang=fr type=text/html title="French HTML"&gt;
+&lt;link rel=alternate href="/en/html/print" hreflang=en type=text/html media=print title="English HTML (for printing)"&gt;
+&lt;link rel=alternate href="/fr/html/print" hreflang=fr type=text/html media=print title="French HTML (for printing)"&gt;
+&lt;link rel=alternate href="/en/pdf" hreflang=en type=application/pdf title="English PDF"&gt;
+&lt;link rel=alternate href="/fr/pdf" hreflang=fr type=application/pdf title="French PDF"&gt;</pre>
+
+ </div>
+
+
+
+
+
+ <h4 id=meta><span class=secno>4.2.5 </span>The <dfn><code>meta</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+
+ <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#flow-content>flow content</a>.</dd>
+ <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#phrasing-content>phrasing content</a>.</dd>
+
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>If the <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute is present, or if the element's <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is in the <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration state</a>: in a <code><a href=#the-head-element-0>head</a></code> element.</dd>
+ <dd>If the <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is present but not in the <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration state</a>: in a <code><a href=#the-head-element-0>head</a></code> element.</dd>
+ <dd>If the <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is present but not in the <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration state</a>: in a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element-0>head</a></code> element.</dd>
+ <dd>If the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute is present: where <a href=#metadata-content>metadata content</a> is expected.</dd>
+
+ <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#metadata-content>metadata content</a> is expected.</dd>
+ <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-meta-name><a href=#attr-meta-name>name</a></code></dd>
+ <dd><code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code></dd>
+ <dd><code title=attr-meta-content><a href=#attr-meta-content>content</a></code></dd>
+ <dd><code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlmetaelement>HTMLMetaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-meta-name title=dom-meta-name>name</a>;
+ attribute DOMString <a href=#dom-meta-httpequiv title=dom-meta-httpEquiv>httpEquiv</a>;
+ attribute DOMString <a href=#dom-meta-content title=dom-meta-content>content</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#meta>meta</a></code> element <a href=#represents>represents</a> various
+ kinds of metadata that cannot be expressed using the
+ <code><a href=#the-title-element-0>title</a></code>, <code><a href=#the-base-element>base</a></code>, <code><a href=#the-link-element>link</a></code>,
+ <code><a href=#the-style-element>style</a></code>, and <code><a href=#script>script</a></code> elements.</p>
+
+ <p>The <code><a href=#meta>meta</a></code> element can represent document-level
+ metadata with the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>
+ attribute, pragma directives with the <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute, and the
+ file's <a href=#character-encoding-declaration>character encoding declaration</a> when an HTML
+ document is serialized to string form (e.g. for transmission over
+ the network or for disk storage) with the <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute.</p>
+
+
+ <p>Exactly one of the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>,
+ <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>, <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code>, and <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attributes must be
+ specified.</p>
+
+ <p>If either <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>, <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>, or <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> is specified, then the <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute must also be
+ specified. Otherwise, it must be omitted.</p>
+
+ <p>The <dfn id=attr-meta-charset title=attr-meta-charset><code>charset</code></dfn>
+ attribute specifies the character encoding used by the
+ document. This is a <a href=#character-encoding-declaration>character encoding declaration</a>. If
+ the attribute is present in an <a href=#xml-documents title="XML documents">XML
+ document</a>, its value must be an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">UTF-8</code>" (and the document is therefore forced to use
+ UTF-8 as its encoding).</p>
+
+ <p class=note>The <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code>
+ attribute on the <code><a href=#meta>meta</a></code> element has no effect in XML
+ documents, and is only allowed in order to facilitate migration to
+ and from XHTML.</p>
+
+ <p>There must not be more than one <code><a href=#meta>meta</a></code> element with a
+ <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute per
+ document.</p>
+
+ <p>The <dfn id=attr-meta-content title=attr-meta-content><code>content</code></dfn>
+ attribute gives the value of the document metadata or pragma
+ directive when the element is used for those purposes. The allowed
+ values depend on the exact context, as described in subsequent
+ sections of this specification.</p>
+
+ <p>If a <code><a href=#meta>meta</a></code> element has a <dfn id=attr-meta-name title=attr-meta-name><code>name</code></dfn> attribute, it sets
+ document metadata. Document metadata is expressed in terms of
+ name/value pairs, the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>
+ attribute on the <code><a href=#meta>meta</a></code> element giving the name, and the
+ <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute on the same
+ element giving the value. The name specifies what aspect of metadata
+ is being set; valid names and the meaning of their values are
+ described in the following sections. If a <code><a href=#meta>meta</a></code> element
+ has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute,
+ then the value part of the metadata name/value pair is the empty
+ string.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-meta-name title=dom-meta-name><code>name</code></dfn> and <dfn id=dom-meta-content title=dom-meta-content><code>content</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name. The IDL attribute <dfn id=dom-meta-httpequiv title=dom-meta-httpEquiv><code>httpEquiv</code></dfn> must
+ <a href=#reflect>reflect</a> the content attribute <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>.</p>
+
+ </div>
+
+
+ <h5 id=standard-metadata-names><span class=secno>4.2.5.1 </span>Standard metadata names</h5>
+
+ <p>This specification defines a few names for the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute of the
+ <code><a href=#meta>meta</a></code> element.</p>
+
+ <p>Names are case-insensitive<span class=impl>, and must be compared
+ in an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> manner</span>.</p>
+
+ <dl><dt><dfn id=meta-application-name title=meta-application-name><code>application-name</code></dfn></dt>
+
+ <dd><p>The value must be a short free-form string giving the name
+ of the Web application that the page represents. If the page is not
+ a Web application, the <code title=meta-application-name><a href=#meta-application-name>application-name</a></code> metadata name
+ must not be used. There must not be more than one <code><a href=#meta>meta</a></code>
+ element with its <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute
+ set to the value <code title=meta-application-name><a href=#meta-application-name>application-name</a></code> per
+ document. <span class=impl>User agents may use the application
+ name in UI in preference to the page's <code><a href=#the-title-element-0>title</a></code>, since
+ the title might include status messages and the like relevant to
+ the status of the page at a particular moment in time instead of
+ just being the name of the application.</span></dd>
+
+ <dt><dfn id=meta-author title=meta-author><code>author</code></dfn></dt>
+
+ <dd><p>The value must be a free-form string giving the name of one
+ of the page's authors.</dd>
+
+ <dt><dfn id=meta-description title=meta-description><code>description</code></dfn></dt>
+
+ <dd><p>The value must be a free-form string that describes the
+ page. The value must be appropriate for use in a directory of
+ pages, e.g. in a search engine. There must not be more than one
+ <code><a href=#meta>meta</a></code> element with its <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute set to the value <code title=meta-description><a href=#meta-description>description</a></code> per document.</dd>
+
+ <dt><dfn id=meta-generator title=meta-generator><code>generator</code></dfn></dt>
+
+ <dd>
+
+ <p>The value must be a free-form string that identifies one of the
+ software packages used to generate the document. This value must
+ not be used on hand-authored pages.</p>
+
+ <div class=example>
+
+ <p>Here is what a tool called "Frontweaver" could include in its
+ output, in the page's <code><a href=#the-head-element-0>head</a></code> element, to identify
+ itself as the tool used to generate the page:</p>
+
+ <pre>&lt;meta name=generator content="Frontweaver 8.2"&gt;</pre>
+
+ </div>
+
+ </dd>
+
+ <dt><dfn id=meta-keywords title=meta-keywords><code>keywords</code></dfn></dt>
+
+ <dd>
+
+ <p>The value must be a <a href=#set-of-comma-separated-tokens>set of comma-separated tokens</a>,
+ each of which is a keyword relevant to the page.</p>
+
+ <div class=example>
+
+ <p>This page about typefaces on British motorways uses a
+ <code><a href=#meta>meta</a></code> element to specify some keywords that users
+ might use to look for the page:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Typefaces on UK motorways&lt;/title&gt;
+ &lt;meta name="keywords" content="british,type face,font,fonts,highway,highways"&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ ...</pre>
+
+ </div>
+
+ <p class=note>Many search engines do not consider such keywords,
+ because this feature has historically been used unreliably and
+ even misleadingly as a way to spam search engine results in a way
+ that is not helpful for users.</p>
+
+ <div class=impl>
+
+ <p>To obtain the list of keywords that the author has specified as
+ applicable to the page, the user agent must run the following
+ steps:</p>
+
+ <ol><li><p>Let <var title="">keywords</var> be an empty
+ list.</li>
+
+ <li>
+
+ <p>For each <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute and a <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute and whose
+ <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute's value is
+ <code title=meta-keywords><a href=#meta-keywords>keywords</a></code>, run the following
+ substeps:</p>
+
+ <ol><li><p><a href=#split-a-string-on-commas title="split a string on commas">Split the value
+ of the element's <code title=attr-meta-content>content</code>
+ attribute on commas</a>.</li>
+
+ <li><p>Add the resulting tokens, if any, to <var title="">keywords</var>.</li>
+
+ </ol></li>
+
+ <li><p>Remove any duplicates from <var title="">keywords</var>.</li>
+
+ <li><p>Return <var title="">keywords</var>. This is the list of
+ keywords that the author has specified as applicable to the
+ page.</li>
+
+ </ol><p>User agents should not use this information when there is
+ insufficient confidence in the reliability of the value.</p>
+
+ <p class=example>For instance, it would be reasonable for a
+ content management system to use the keyword information of pages
+ within the system to populate the index of a site-specific search
+ engine, but a large-scale content aggregator that used this
+ information would likely find that certain users would try to game
+ its ranking mechanism through the use of inappropriate
+ keywords.</p>
+
+ </div>
+
+ </dd>
+
+ </dl><h5 id=other-metadata-names><span class=secno>4.2.5.2 </span>Other metadata names</h5>
+
+ <p><dfn id=concept-meta-extensions title=concept-meta-extensions>Extensions to the predefined
+ set of metadata names</dfn> may be registered in the <a href=http://wiki.whatwg.org/wiki/MetaExtensions>WHATWG Wiki
+ MetaExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+
+ <p>Anyone is free to edit the WHATWG Wiki MetaExtensions page at any
+ time to add a type. These new names must be specified with the
+ following information:</p>
+
+ <dl><dt>Keyword</dt>
+
+ <dd><p>The actual name being defined. The name should not be
+ confusingly similar to any other defined name (e.g. differing only
+ in case).</dd>
+
+
+ <dt>Brief description</dt>
+
+ <dd><p>A short non-normative description of what the metadata
+ name's meaning is, including the format the value is required to be
+ in.</dd>
+
+
+ <dt>Specification</dt>
+
+ <dd>A link to a more detailed description of the metadata name's
+ semantics and requirements. It could be another page on the Wiki,
+ or a link to an external page.</dd>
+
+
+ <dt>Synonyms</dt>
+
+ <dd><p>A list of other names that have exactly the same processing
+ requirements. Authors should not use the names defined to be
+ synonyms, they are only intended to allow user agents to support
+ legacy content. Anyone may remove synonyms that are not used in
+ practice; only names that need to be processed as synonyms for
+ compatibility with legacy content are to be registered in this
+ way.</dd>
+
+
+ <dt>Status</dt>
+
+ <dd>
+
+ <p>One of the following:</p>
+
+ <dl><dt>Proposed</dt>
+
+ <dd>The name has not received wide peer review and
+ approval. Someone has proposed it and is, or soon will be, using
+ it.</dd>
+
+ <dt>Ratified</dt>
+
+ <dd>The name has received wide peer review and approval. It has a
+ specification that unambiguously defines how to handle pages that
+ use the name, including when they use it in incorrect ways.</dd>
+
+ <dt>Discontinued</dt>
+
+ <dd>The metadata name has received wide peer review and it has
+ been found wanting. Existing pages are using this metadata name,
+ but new pages should avoid it. The "brief description" and
+ "specification" entries will give details of what authors should
+ use instead, if anything.</dd>
+
+ </dl><p>If a metadata name is found to be redundant with existing
+ values, it should be removed and listed as a synonym for the
+ existing value.</p>
+
+ <p>If a metadata name is registered in the "proposed" state for a
+ period of a month or more without being used or specified, then it
+ may be removed from the registry.</p>
+
+ <p>If a metadata name is added with the "proposed" status and
+ found to be redundant with existing values, it should be removed
+ and listed as a synonym for the existing value. If a metadata name
+ is added with the "proposed" status and found to be harmful, then
+ it should be changed to "discontinued" status.</p>
+
+ <p>Anyone can change the status at any time, but should only do so
+ in accordance with the definitions above.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Conformance checkers must use the information given on the WHATWG
+ Wiki MetaExtensions page to establish if a value is allowed or not:
+ values defined in this specification or marked as "proposed" or
+ "ratified" must be accepted, whereas values marked as "discontinued"
+ or not listed in either this specification or on the aforementioned
+ page must be rejected as invalid. Conformance checkers may cache
+ this information (e.g. for performance reasons or to avoid the use
+ of unreliable network connectivity).</p>
+
+ <p>When an author uses a new metadata name not defined by either
+ this specification or the Wiki page, conformance checkers should
+ offer to add the value to the Wiki, with the details described
+ above, with the "proposed" status.</p>
+
+ </div>
+
+ <p>Metadata names whose values are to be <a href=#url title=URL>URLs</a> must not be proposed or accepted. Links must
+ be represented using the <code><a href=#the-link-element>link</a></code> element, not the
+ <code><a href=#meta>meta</a></code> element.</p>
+
+
+
+ <h5 id=pragma-directives><span class=secno>4.2.5.3 </span>Pragma directives</h5>
+
+ <p>When the <dfn id=attr-meta-http-equiv title=attr-meta-http-equiv><code>http-equiv</code></dfn> attribute
+ is specified on a <code><a href=#meta>meta</a></code> element, the element is a pragma
+ directive.</p>
+
+ <p>The <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The following
+ table lists the keywords defined for this attribute. The states
+ given in the first cell of the rows with keywords give the states to
+ which those keywords map. <!--<span class="impl">Some of the
+ keywords are non-conforming, as noted in the last
+ column.</span>--></p>
+
+<!-- things that are neither conforming nor do anything are commented out -->
+<!-- if you add something non-conforming, uncomment out the last sentence above -->
+ <table><thead><tr><th>State
+ <th>Keywords
+ <th>Notes
+ <tbody><tr><td><a href=#attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content Language</a>
+ <td><code title="">content-language</code>
+ <td>Conformance checkers will include a warning
+ <tr><td><a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration</a>
+ <td><code title="">content-type</code>
+ <td>
+<!--
+ <tr class="impl">
+ <td><span title="attr-meta-http-equiv-content-script-type">Content-Script-Type</span>
+ <td><code title="">Content-Script-Type</code>
+ <td>Non-conforming
+ <tr class="impl">
+ <td><span title="attr-meta-http-equiv-content-style-type">Content-Style-Type</span>
+ <td><code title="">Content-Style-Type</code>
+ <td>Non-conforming
+-->
+ <tr><td><a href=#attr-meta-http-equiv-default-style title=attr-meta-http-equiv-default-style>Default style</a>
+ <td><code title="">default-style</code>
+ <td>
+ <tr><td><a href=#attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh</a>
+ <td><code title="">refresh</code>
+ <td>
+ </table><!--
+DATA: According to Henri's validator stats, here are common
+non-conforming values used by people who validate (sample of 400
+pages):
+
+COUNT ERROR
+ 20 Bad value "Content-Language" for attribute "http-equiv" on element "meta".
+ 17 Bad value "Content-Style-Type" for attribute "http-equiv" on element "meta".
+ 12 Bad value "Expires" for attribute "http-equiv" on element "meta".
+ 11 Bad value "Pragma" for attribute "http-equiv" on element "meta".
+ 11 Bad value "imagetoolbar" for attribute "http-equiv" on element "meta".
+ 10 Bad value "Content-Script-Type" for attribute "http-equiv" on element "meta".
+ 10 Bad value "content-language" for attribute "http-equiv" on element "meta".
+ [...]
+http://hsivonen.iki.fi/test/moz/analysis.txt
+
+Here's some more data, this time from Philip`, on a sample of 15k pages.
+
+ COUNT VALUE
+ 1181 Content-Language
+ 430 Content-Style-Type
+ 342 imagetoolbar
+ 276 content-language
+ 269 Pragma
+ 260 expires
+ 227 Expires
+ 211 pragma
+ 146 Content-Script-Type
+ 132 keywords
+ 119 Page-Enter
+ 116 description
+ 106 reply-to
+ 102 Cache-Control
+ [...]
+http://philip.html5.org/data/meta-http-equiv.txt
+
+These numbers are low; further study is required to establish what
+people expect to have work and what is necessary.
+--><div class=impl>
+
+ <p>When a <code><a href=#meta>meta</a></code> element is <a href=#insert-an-element-into-a-document title="insert an
+ element into a document">inserted into the document</a>, if its
+ <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is
+ present and represents one of the above states, then the user agent
+ must run the algorithm appropriate for that state, as described in
+ the following list:</p>
+
+ </div>
+
+ <dl><dt><dfn id=attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content language state</dfn> (<code title="">http-equiv="content-language"</code>)
+
+ <dd>
+
+ <p>This pragma sets the <dfn id=pragma-set-default-language>pragma-set default
+ language</dfn>. Until the pragma is successfully processed, there
+ is no <a href=#pragma-set-default-language>pragma-set default language</a>.</p>
+
+ <p class=note>Conformance checkers will include a warning if
+ this pragma is used. Authors are encouraged to use the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute instead.</p>
+
+ <div class=impl>
+
+ <ol><li><p>If another <code><a href=#meta>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content
+ Language state</a> has already been successfully processed
+ (i.e. when it was inserted the user agent processed it and
+ reached the last step of this list of steps), then abort these
+ steps.</li>
+
+ <li><p>If the <code><a href=#meta>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, or if that
+ attribute's value is the empty string, then abort these
+ steps.</li>
+
+ <li><p>If the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute contains a
+ U+002C COMMA character (,) then abort these steps.</li><!--
+ if you remove this, un-comment-out the corresponding bits in the
+ step below. -->
+
+ <li><p>Let <var title="">input</var> be the value of the
+ element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>
+ attribute.</li>
+
+ <li><p>Let <var title="">position</var> point at the first
+ character of <var title="">input</var>.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters title="collect a sequence of characters">Collect a
+ sequence of characters</a> that are not<!--neither--> <a href=#space-character title="space character">space characters</a><!-- nor a U+002C
+ COMMA character (,)-->.</li>
+
+ <li><p>Let the <a href=#pragma-set-default-language>pragma-set default language</a> be the
+ string that resulted from the previous step.</li>
+
+ </ol></div>
+
+ <p>For <code><a href=#meta>meta</a></code> elements with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content
+ Language state</a>, the <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute must have a
+ value consisting of a valid BCP 47 language tag. <a href=#refsBCP47>[BCP47]</a></p>
+
+ <p class=note>This pragma is not exactly equivalent to the HTTP
+ <code>Content-Language</code> header, for instance it only
+ supports one language. <a href=#refsHTTP>[HTTP]</a></p>
+
+ </dd>
+
+ <dt><dfn id=attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration state</dfn> (<code title="">http-equiv="content-type"</code>)
+
+ <dd>
+
+ <p>The <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding
+ declaration state</a> is just an alternative form of setting
+ the <code title=meta-charset>charset</code> attribute: it is a
+ <a href=#character-encoding-declaration>character encoding declaration</a>. <span class=impl>This state's user agent requirements are all handled
+ by the parsing section of the specification.</span></p>
+
+ <p>For <code><a href=#meta>meta</a></code> elements with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding
+ declaration state</a>, the <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute must have a
+ value that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for a
+ string that consists of: the literal string "<code title="">text/html;</code>", optionally followed by any number of
+ <a href=#space-character title="space character">space characters</a>, followed by
+ the literal string "<code title="">charset=</code>", followed by
+ the character encoding name of the <a href=#character-encoding-declaration>character encoding
+ declaration</a>.</p>
+
+ <p>If the document contains a <code><a href=#meta>meta</a></code> element with an
+ <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in
+ the <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding
+ declaration state</a>, then the document must not contain a
+ <code><a href=#meta>meta</a></code> element with the <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute present.</p>
+
+ <p>The <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding
+ declaration state</a> may be used in <a href=#html-documents>HTML
+ documents</a>, but elements with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in that
+ state must not be used in <a href=#xml-documents>XML documents</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=attr-meta-http-equiv-default-style title=attr-meta-http-equiv-default-style>Default style state</dfn> (<code title="">http-equiv="default-style"</code>)
+
+ <dd>
+
+ <p>This pragma sets the name of the default <span title="alternative style sheet sets">alternative style sheet
+ set</span>.</p>
+
+ <div class=impl>
+
+ <ol><li><p>If the <code><a href=#meta>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, or if that
+ attribute's value is the empty string, then abort these
+ steps.</li>
+
+ <li><p>Set the <span>preferred style sheet set</span> to the
+ value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute. <a href=#refsCSSOM>[CSSOM]</a></li>
+
+ </ol></div>
+
+ </dd>
+
+ <dt><dfn id=attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh state</dfn> (<code title="">http-equiv="refresh"</code>)
+
+ <dd>
+
+ <p>This pragma acts as timed redirect.</p>
+
+ <div class=impl>
+
+ <ol><!-- TESTS: http://www.hixie.ch/tests/adhoc/html/meta/refresh/ --><li><p>If another <code><a href=#meta>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh state</a>
+ has already been successfully processed (i.e. when it was
+ inserted the user agent processed it and reached the last step of
+ this list of steps), then abort these steps.</li>
+
+ <li><p>If the <code><a href=#meta>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, or if that
+ attribute's value is the empty string, then abort these
+ steps.</li>
+
+ <li><p>Let <var title="">input</var> be the value of the
+ element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>
+ attribute.</li>
+
+ <li><p>Let <var title="">position</var> point at the first
+ character of <var title="">input</var>.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters title="collect a sequence of characters">Collect a
+ sequence of characters</a> in the range U+0030 DIGIT ZERO (0)
+ to U+0039 DIGIT NINE (9), and parse the resulting string using
+ the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>. If the
+ sequence of characters collected is the empty string, then no
+ number will have been parsed; abort these steps. Otherwise, let
+ <var title="">time</var> be the parsed number.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters title="collect a sequence of characters">Collect a
+ sequence of characters</a> in the range U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9) and U+002E FULL STOP (.). Ignore any collected
+ characters.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>Let <var title="">url</var> be the address of the current
+ page.</li>
+
+ <li><p>If the character in <var title="">input</var> pointed to
+ by <var title="">position</var> is a U+003B SEMICOLON ("<code title="">;</code>"), then advance <var title="">position</var> to
+ the next character. Otherwise, jump to the last step.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If the character in <var title="">input</var> pointed to
+ by <var title="">position</var> is a U+0055 LATIN CAPITAL LETTER
+ U character (U) or a U+0075 LATIN SMALL LETTER U character (u),
+ then advance <var title="">position</var> to the next
+ character. Otherwise, jump to the last step.</li>
+
+ <li><p>If the character in <var title="">input</var> pointed to
+ by <var title="">position</var> is a U+0052 LATIN CAPITAL LETTER
+ R character (R) or a U+0072 LATIN SMALL LETTER R character (r),
+ then advance <var title="">position</var> to the next
+ character. Otherwise, jump to the last step.</li>
+
+ <li><p>If the character in <var title="">input</var> pointed to
+ by <var title="">position</var> is s U+004C LATIN CAPITAL LETTER
+ L character (L) or a U+006C LATIN SMALL LETTER L character (l),
+ then advance <var title="">position</var> to the next
+ character. Otherwise, jump to the last step.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If the character in <var title="">input</var> pointed to
+ by <var title="">position</var> is a U+003D EQUALS SIGN ("<code title="">=</code>"), then advance <var title="">position</var> to
+ the next character. Otherwise, jump to the last step.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If the character in <var title="">input</var> pointed to
+ by <var title="">position</var> is either a U+0027 APOSTROPHE
+ character (') or U+0022 QUOTATION MARK character ("), then let
+ <var title="">quote</var> be that character, and advance <var title="">position</var> to the next character. Otherwise, let
+ <var title="">quote</var> be the empty string.</li>
+
+ <li><p>Let <var title="">url</var> be equal to the substring of
+ <var title="">input</var> from the character at <var title="">position</var> to the end of the string.</li>
+
+ <li><p>If <var title="">quote</var> is not the empty string, and
+ there is a character in <var title="">url</var> equal to <var title="">quote</var>, then truncate <var title="">url</var> at
+ that character, so that it and all subsequent characters are
+ removed.</p>
+
+ <li><p>Strip any trailing <a href=#space-character title="space character">space
+ characters</a> from the end of <var title="">url</var>.</li>
+
+ <li><p>Strip any U+0009 CHARACTER TABULATION, U+000A LINE FEED
+ (LF), and U+000D CARRIAGE RETURN (CR) characters from <var title="">url</var>.</li>
+
+ <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">url</var> value to an <a href=#absolute-url>absolute URL</a>,
+ relative to the <code><a href=#meta>meta</a></code> element. If this fails, abort
+ these steps.</li>
+
+ <li>
+
+ <p>Perform one or more of the following steps:</p>
+
+ <ul><li><p>Set a timer so that in <var title="">time</var> seconds,
+ adjusted to take into account user or user agent preferences,
+ if the user has not canceled the redirect and if the
+ <code><a href=#meta>meta</a></code> element's <code><a href=#document>Document</a></code>'s
+ <a href=#browsing-context>browsing context</a> did not have the <a href=#sandboxed-automatic-features-browsing-context-flag>sandboxed
+ automatic features browsing context flag</a> set when the
+ <code><a href=#document>Document</a></code> was created, the user agent <a href=#navigate title=navigate>navigates</a> the <code><a href=#document>Document</a></code>'s
+ <a href=#browsing-context>browsing context</a> to <var title="">url</var>, with
+ <a href=#replacement-enabled>replacement enabled</a>, and with the
+ <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> as the
+ <a href=#source-browsing-context>source browsing context</a>.</li>
+
+ <li><p>Provide the user with an interface that, when selected,
+ <a href=#navigate title=navigate>navigates</a> a <a href=#browsing-context>browsing
+ context</a> to <var title="">url</var>, with the document's
+ browsing context as the <a href=#source-browsing-context>source browsing
+ context</a>.</li>
+
+ <li><p>Do nothing.</li>
+
+ </ul><p>In addition, the user agent may, as with anything, inform the
+ user of any and all aspects of its operation, including the
+ state of any timers, the destinations of any timed redirects,
+ and so forth.</p>
+
+ </li>
+
+ </ol></div>
+
+ <p>For <code><a href=#meta>meta</a></code> elements with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh state</a>,
+ the <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute must
+ have a value consisting either of:</p>
+
+ <ul><li> just a <a href=#valid-non-negative-integer>valid non-negative integer</a>, or</li>
+
+ <li> a <a href=#valid-non-negative-integer>valid non-negative integer</a>, followed by a
+ U+003B SEMICOLON character (;), followed by one or more <a href=#space-character title="space character">space characters</a>, followed by
+ either a U+0055 LATIN CAPITAL LETTER U character (U) or a U+0075
+ LATIN SMALL LETTER U character (u), a U+0052 LATIN CAPITAL LETTER
+ R character (R) or a U+0072 LATIN SMALL LETTER R character (r), a
+ U+004C LATIN CAPITAL LETTER L character (L) or a U+006C LATIN
+ SMALL LETTER L character (l), a U+003D EQUALS SIGN character (=),
+ and then a <a href=#valid-url>valid URL</a>.</li>
+
+ </ul><p>In the former case, the integer represents a number of seconds
+ before the page is to be reloaded; in the latter case the integer
+ represents a number of seconds before the page is to be replaced
+ by the page at the given <a href=#url>URL</a>.</p>
+
+ <div class=example>
+
+ <p>A news organization's front page could include the following
+ markup in the page's <code><a href=#the-head-element-0>head</a></code> element, to ensure that
+ the page automatically reloads from the server every five
+ minutes:</p>
+
+ <pre>&lt;meta http-equiv="Refresh" content="300"&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>A sequence of pages could be used as an automated slide show
+ by making each page refresh to the next page in the sequence,
+ using markup such as the following:</p>
+
+ <pre>&lt;meta http-equiv="Refresh" content="20; URL=page4.html"&gt;</pre>
+
+ </div>
+
+ </dd>
+
+ </dl><p>There must not be more than one <code><a href=#meta>meta</a></code> element with
+ any particular state in the document at a time.</p>
+
+
+ <h5 id=other-pragma-directives><span class=secno>4.2.5.4 </span>Other pragma directives</h5>
+
+ <p><dfn id=concept-http-equiv-extensions title=concept-http-equiv-extensions>Extensions to the
+ predefined set of pragma directives</dfn> may, under certain
+ conditions, be registered in the <a href=http://wiki.whatwg.org/wiki/PragmaExtensions>WHATWG Wiki
+ PragmaExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+
+ <p>Such extensions must use a name that is identical to an HTTP
+ header registered in the Permanent Message Header Field Registry,
+ and must have behavior identical to that described for the HTTP
+ header. <a href=#refsIANAPERMHEADERS>[IANAPERMHEADERS]</a></p>
+
+ <p>Pragma directives corresponding to headers describing metadata,
+ or not requiring specific user agent processing, must not be
+ registered; instead, use <a href=#concept-meta-extensions title=concept-meta-extensions>metadata names</a>. Pragma
+ directives corresponding to headers that affect the HTTP processing
+ model (e.g. caching) must not be registered, as they would result in
+ HTTP-level behavior being different for user agents that implement
+ HTML than for user agents that do not.</p>
+
+ <p>Anyone is free to edit the WHATWG Wiki PragmaExtensions page at
+ any time to add a pragma directive satisfying these conditions. Such
+ registrations must specify the following information:</p>
+
+ <dl><dt>Keyword</dt>
+
+ <dd><p>The actual name being defined. The name must match a
+ previously-registered HTTP name with the same
+ requirements.</dd>
+
+
+ <dt>Brief description</dt>
+
+ <dd><p>A short non-normative description of the purpose of the
+ pragma directive.</dd>
+
+
+ <dt>Specification</dt>
+
+ <dd>A link to the specification defining the corresponding HTTP
+ header.</dd>
+
+ </dl><div class=impl>
+
+ <p>Conformance checkers must use the information given on the WHATWG
+ Wiki PragmaExtensions page to establish if a value is allowed or
+ not: values defined in this specification or listed on the
+ aforementioned page must be accepted, whereas values not listed in
+ either this specification or on the aforementioned page must be
+ rejected as invalid. Conformance checkers may cache this information
+ (e.g. for performance reasons or to avoid the use of unreliable
+ network connectivity).</p>
+
+ </div>
+
+
+
+
+ <h5 id=charset><span class=secno>4.2.5.5 </span>Specifying the document's character encoding</h5>
+
+ <!-- READ ME WHEN EDITING: if we ever move this to the "writing
+ HTML" section, then we have to duplicate the requirements in the
+ parsing section for conformance checkers, and we have to make sure
+ that the requirements for charset="" apply even in XML, for the
+ polyglot hack. -->
+
+ <p>A <dfn id=character-encoding-declaration>character encoding declaration</dfn> is a mechanism by
+ which the character encoding used to store or transmit a document is
+ specified.</p>
+
+ <p>The following restrictions apply to character encoding
+ declarations:</p>
+
+ <ul><li>The character encoding name given must be the name of the
+ character encoding used to serialize the file.</li>
+
+ <li>The value must be a valid character encoding name, and must be
+ an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
+ <a href=#preferred-mime-name>preferred MIME name</a> for that encoding. <a href=#refsIANACHARSET>[IANACHARSET]</a></li>
+
+ <li>The character encoding declaration must be serialized without
+ the use of <a href=#syntax-charref title=syntax-charref>character references</a>
+ or character escapes of any kind.</li>
+
+ <li id=charset512>The element containing the character encoding
+ declaration must be serialized completely within the first 512
+ bytes of the document.</li>
+
+ <li>There can only be one character encoding declaration in the
+ document.</li> <!-- conformance criteria for this one are given in
+ the XML spec, the <meta> section just after defining charset="",
+ and the character encoding pragma section. And actually this
+ statement isn't quite true, since you can have an XML one and an
+ HTML one at the same time if they match. -->
+
+ </ul><p>If an <a href=#html-documents title="HTML documents">HTML document</a> does not
+ start with a BOM, and if its encoding is not explicitly given by
+ <a href=#content-type title=Content-Type>Content-Type metadata</a>, and the
+ document is not <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, then the
+ character encoding used must be an <a href=#ascii-compatible-character-encoding>ASCII-compatible character
+ encoding</a>, and, in addition, if that encoding isn't US-ASCII
+ itself, then the encoding must be specified using a
+ <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
+ <code><a href=#meta>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration
+ state</a>.</p>
+
+ <p>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, the
+ document must not have a <a href=#character-encoding-declaration>character encoding
+ declaration</a>. (In this case, the source is already decoded,
+ since it is part of the document that contained the
+ <code><a href=#the-iframe-element>iframe</a></code>.)</p>
+
+ <p>If an <a href=#html-documents title="HTML documents">HTML document</a> contains
+ a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
+ <code><a href=#meta>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration
+ state</a>, then the character encoding used must be an
+ <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>.</p>
+
+ <p>Authors are encouraged to use UTF-8. Conformance checkers may
+ advise authors against using legacy encodings.</p>
+
+ <div class=impl>
+
+ <p>Authoring tools should default to using UTF-8 for newly-created
+ documents.</p>
+
+ </div>
+
+ <p>Encodings in which a series of bytes in the range 0x20 to 0x7E
+ can encode characters other than the corresponding characters in the
+ range U+0020 to U+007E represent a potential security vulnerability:
+ a user agent that does not support the encoding (or does not support
+ the label used to declare the encoding, or does not use the same
+ mechanism to detect the encoding of unlabelled content as another
+ user agent) might end up interpreting technically benign plain text
+ content as HTML tags and JavaScript. For example, this applies to
+ encodings in which the bytes corresponding to "<code title="">&lt;script&gt;</code>" in ASCII can encode a different
+ string. Authors should not use such encodings, which are known to
+ include JIS_C6226-1983<!-- aka JIS-X-0208, x-JIS0208 -->,
+ JIS_X0212-1990<!-- aka JIS-X-0212 -->, HZ-GB-2312<!-- has crazy
+ handling of ASCII "~" -->, JOHAB <!-- a supplementary encoding in KS
+ C 5601-1992 Annex 3 (= KS X 1001:1998 Annex 3) --> (Windows code
+ page 1361), encodings based on ISO-2022<!--
+ http://krijnhoetmer.nl/irc-logs/whatwg/20090628#l-422 and
+ http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-October/023797.html
+ -->, and encodings based on EBCDIC. Furthermore, authors must not
+ use the CESU-8, UTF-7, BOCU-1 and SCSU encodings, which also fall
+ into this category, because these encodings were never intended for
+ use for Web content.
+ <a href=#refsRFC1345>[RFC1345]</a><!-- for the JIS types -->
+ <a href=#refsRFC1842>[RFC1842]</a><!-- HZ-GB-2312 -->
+ <a href=#refsRFC1468>[RFC1468]</a><!-- ISO-2022-JP -->
+ <a href=#refsRFC2237>[RFC2237]</a><!-- ISO-2022-JP-1 -->
+ <a href=#refsRFC1554>[RFC1554]</a><!-- ISO-2022-JP-2 -->
+ <a href=#refsRFC1922>[RFC1922]</a><!-- ISO-2022-CN and ISO-2022-CN-EXT -->
+ <a href=#refsRFC1557>[RFC1557]</a><!-- ISO-2022-KR -->
+ <a href=#refsCESU8>[CESU8]</a>
+ <a href=#refsUTF7>[UTF7]</a>
+ <a href=#refsBOCU1>[BOCU1]</a>
+ <a href=#refsSCSU>[SCSU]</a>
+ <!-- no idea what to reference for JOHAB or EBCDIC, so... -->
+ </p>
+
+ <p>Authors should not use UTF-32, as the encoding detection
+ algorithms described in this specification intentionally do not
+ distinguish it from UTF-16. <a href=#refsUNICODE>[UNICODE]</a></p>
+
+ <p class=note>Using non-UTF-8 encodings can have unexpected
+ results on form submission and URL encodings, which use the
+ <a href="#document's-character-encoding">document's character encoding</a> by default.</p>
+
+ <p>In XHTML, the XML declaration should be used for inline character
+ encoding information, if necessary.</p>
+
+ <div class=example>
+
+ <p>In HTML, to declare that the character encoding is UTF-8, the
+ author could include the following markup near the top of the
+ document (in the <code><a href=#the-head-element-0>head</a></code> element):</p>
+
+ <pre>&lt;meta charset="utf-8"&gt;</pre>
+
+ <p>In XML, the XML declaration would be used instead, at the very
+ top of the markup:</p>
+
+ <pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-style-element><span class=secno>4.2.6 </span>The <dfn><code>style</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+ <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present: <a href=#flow-content>flow content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is absent: where <a href=#metadata-content>metadata content</a> is expected.</dd>
+ <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is absent: in a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element-0>head</a></code> element.</dd>
+ <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present: where <a href=#flow-content>flow content</a> is expected, but before any other <a href=#flow-content>flow content</a> other than other <code><a href=#the-style-element>style</a></code> elements and <a href=#inter-element-whitespace>inter-element whitespace</a>.</dd>
+ <dt>Content model:</dt>
+ <dd>Depends on the value of the <code title=attr-style-type><a href=#attr-style-type>type</a></code> attribute, but must match requirements described in prose below.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-style-media><a href=#attr-style-media>media</a></code></dd>
+ <dd><code title=attr-style-type><a href=#attr-style-type>type</a></code></dd>
+ <dd><code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code></dd>
+ <dd>Also, the <code title=attr-style-title><a href=#attr-style-title>title</a></code> attribute has special semantics on this element.</dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlstyleelement>HTMLStyleElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-style-disabled title=dom-style-disabled>disabled</a>;
+ attribute DOMString <a href=#dom-style-media title=dom-style-media>media</a>;
+ attribute DOMString <a href=#dom-style-type title=dom-style-type>type</a>;
+ attribute boolean <a href=#dom-style-scoped title=dom-style-scoped>scoped</a>;
+};
+<a href=#htmlstyleelement>HTMLStyleElement</a> implements <span>LinkStyle</span>;</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-style-element>style</a></code> element allows authors to embed style
+ information in their documents. The <code><a href=#the-style-element>style</a></code> element is
+ one of several inputs to the <a href=#styling>styling processing
+ model</a>. The element does not <a href=#represents title=represents>represent</a> content for the user.</p>
+
+ <p>The <dfn id=attr-style-type title=attr-style-type><code>type</code></dfn>
+ attribute gives the styling language. If the attribute is present,
+ its value must be a <a href=#valid-mime-type>valid MIME type</a> that designates a
+ styling language. The <code title="">charset</code> parameter must
+ not be specified. The default, which is used if the attribute is
+ absent, is "<code title="">text/css</code>". <a href=#refsRFC2318>[RFC2318]</a></p>
+
+ <div class=impl>
+
+ <!-- this paragraph is also present in the <script> section -->
+ <p>When examining types to determine if they support the language,
+ user agents must not ignore unknown MIME parameters &mdash; types
+ with unknown parameters must be assumed to be unsupported. The <code title="">charset</code> parameter must be treated as an unknown
+ parameter for the purpose of comparing <a href=#mime-type title="MIME type">MIME
+ types</a> here.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-style-media title=attr-style-media><code>media</code></dfn>
+ attribute says which media the styles apply to. The value must be a
+ <a href=#valid-media-query>valid media query</a>. <span class=impl>The user agent
+ must apply the styles when the <code title=attr-style-media><a href=#attr-style-media>media</a></code> attribute's value
+ <a href=#matches-the-environment>matches the environment</a> and the other relevant
+ conditions apply, and must not apply them otherwise.</span></p><!--
+ note similar text in <link> section -->
+
+ <div class=impl>
+
+ <p class=note>The styles might be further limited in scope,
+ e.g. in CSS with the use of <code title="">@media</code>
+ blocks. This specification does not override such further
+ restrictions or requirements.</p><!-- note similar text in <link>
+ section -->
+
+ </div>
+
+ <p id=style-default-media>The default, if the <code title=attr-style-media><a href=#attr-style-media>media</a></code> attribute is omitted, is
+ "<code title="">all</code>", meaning that by default styles apply to
+ all media.</p>
+
+ <p>The <dfn id=attr-style-scoped title=attr-style-scoped><code>scoped</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. If set, it indicates
+ that the styles are intended just for the subtree rooted at the
+ <code><a href=#the-style-element>style</a></code> element's parent element, as opposed to the whole
+ <code><a href=#document>Document</a></code>.</p>
+
+ <div class=impl>
+
+ <p>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is
+ present, then the user agent must apply the specified style
+ information only to the <code><a href=#the-style-element>style</a></code> element's parent element
+ (if any), and that element's child nodes. Otherwise, the specified
+ styles must, if applied, be applied to the entire document.</p>
+
+ </div>
+
+ <p id=title-on-style>The <dfn id=attr-style-title title=attr-style-title><code>title</code></dfn> attribute on
+ <code><a href=#the-style-element>style</a></code> elements defines <span>alternative style sheet
+ sets</span>. If the <code><a href=#the-style-element>style</a></code> element has no <code title=attr-style-title><a href=#attr-style-title>title</a></code> attribute, then it has no
+ title; the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute of
+ ancestors does not apply to the <code><a href=#the-style-element>style</a></code> element. <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <p class=note>The <code title=attr-style-title><a href=#attr-style-title>title</a></code>
+ attribute on <code><a href=#the-style-element>style</a></code> elements, like the <code title=attr-link-title><a href=#attr-link-title>title</a></code> attribute on <code><a href=#the-link-element>link</a></code>
+ elements, differs from the global <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute in that a
+ <code><a href=#the-style-element>style</a></code> block without a title does not inherit the title
+ of the parent element: it merely has no title.</p>
+
+ <p>The <code><a href=#textcontent>textContent</a></code> of a <code><a href=#the-style-element>style</a></code> element must
+ match the <code title="">style</code> production in the following
+ ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
+
+ <pre>style = no-c-start *( c-start no-c-end c-end no-c-start )
+no-c-start = &lt;any string that doesn't contain a substring that matches c-start &gt;
+c-start = "&lt;!--"
+no-c-end = &lt;any string that doesn't contain a substring that matches c-end &gt;
+c-end = "--&gt;"</pre>
+
+ <!-- Unmatched comment-like syntax is invalid on a temporary basis,
+ waiting for IE, WebKit, and Opera to fix their parsing bug
+ whereby such comments trigger a weird escape in which </style>
+ is ignored. Otherwise, parsing behaviour in those browsers
+ could differ substantially from the parsing behaviour of HTML5.
+ Once everyone follows the HTML5 spec, we can drop this
+ requirement.
+ -->
+
+ <div class=impl>
+
+ <p>All descendant elements must be processed, according to their
+ semantics, before the <code><a href=#the-style-element>style</a></code> element itself is
+ evaluated. For styling languages that consist of pure text, user
+ agents must evaluate <code><a href=#the-style-element>style</a></code> elements by passing the
+ concatenation of the contents of all the <a href=#text-node title="text
+ node">text nodes</a> that are direct children of the
+ <code><a href=#the-style-element>style</a></code> element (not any other nodes such as comments or
+ elements), in <a href=#tree-order>tree order</a>, to the style system. For
+ XML-based styling languages, user agents must pass all the child
+ nodes of the <code><a href=#the-style-element>style</a></code> element to the style system.</p>
+
+ <p>All <a href=#url title=URL>URLs</a> found by the styling language's
+ processor must be <a href=#resolve-a-url title="resolve a url">resolved</a>,
+ relative to the element (or as defined by the styling language),
+ when the processor is invoked.<!-- so dynamic changes to the base
+ URL don't affect the CSS --></p>
+
+ <!-- the next few paragraph are similar to text in the <style> section -->
+ <p>Once the attempts to obtain the style sheet's <a href=#critical-subresources>critical
+ subresources</a>, if any, are complete, or, if the style sheet
+ has no <a href=#critical-subresources>critical subresources</a>, once the style sheet has
+ been parsed and processed, the user agent must, if the loads were
+ successful or there were none, <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#the-style-element>style</a></code> element,
+ or, if one of the style sheet's <a href=#critical-subresources>critical subresources</a>
+ failed to completely load for any reason (e.g. DNS error, HTTP 404
+ response, a connection being prematurely closed, unsupported
+ Content-Type), <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-error>error</code> at the
+ <code><a href=#the-style-element>style</a></code> element. Non-network errors in processing the
+ style sheet or its subresources (e.g. CSS parse errors, PNG decoding
+ errors) are not failures for the purposes of this paragraph.</p>
+
+ <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#dom-manipulation-task-source>DOM manipulation task
+ source</a>.</p>
+
+ <p>The element must <a href=#delay-the-load-event>delay the load event</a> of the
+ element's document until all the attempts to obtain the style
+ sheet's <a href=#critical-subresources>critical subresources</a>, if any, are
+ complete.</p>
+
+ </div>
+
+ <p class=note>This specification does not specify a style system,
+ but CSS is expected to be supported by most Web browsers. <a href=#refsCSS>[CSS]</a></p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-style-media title=dom-style-media><code>media</code></dfn>, <dfn id=dom-style-type title=dom-style-type><code>type</code></dfn> and <dfn id=dom-style-scoped title=dom-style-scoped><code>scoped</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name.</p>
+
+ </div>
+
+ <p>The <dfn id=dom-style-disabled title=dom-style-disabled><code>disabled</code></dfn>
+ IDL attribute behaves as defined <a href=#dom-linkstyle-disabled title=dom-linkstyle-disabled>for the alternative style sheets
+ DOM</a>.</p>
+
+ <p>The <code>LinkStyle</code> interface is also implemented by
+ this element; the <a href=#styling>styling processing model</a> defines
+ how. <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <div class=example>
+
+ <p>The following document has its emphasis styled as bright red
+ text rather than italics text, while leaving titles of works and
+ Latin words in their default italics. It shows how using
+ appropriate elements enables easier restyling of documents.</p>
+
+ <pre>&lt;!DOCTYPE html&gt;
+&lt;html lang="en-US"&gt;
+ &lt;head&gt;
+ &lt;title&gt;My favorite book&lt;/title&gt;
+ &lt;style&gt;
+ body { color: black; background: white; }
+ em { font-style: normal; color: red; }
+ &lt;/style&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;p&gt;My &lt;em&gt;favorite&lt;/em&gt; book of all time has &lt;em&gt;got&lt;/em&gt; to be
+ &lt;cite&gt;A Cat's Life&lt;/cite&gt;. It is a book by P. Rahmel that talks
+ about the &lt;i lang="la"&gt;Felis Catus&lt;/i&gt; in modern human society.&lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ </div>
+
+
+
+
+ <h4 id=styling><span class=secno>4.2.7 </span><dfn title="styling processing model">Styling</dfn></h4>
+
+ <p>The <code><a href=#the-link-element>link</a></code> and <code><a href=#the-style-element>style</a></code> elements can provide
+ styling information for the user agent to use when rendering the
+ document. The DOM Styling specification specifies what styling
+ information is to be used by the user agent and how it is to be
+ used. <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <p>The <code><a href=#the-style-element>style</a></code> and <code><a href=#the-link-element>link</a></code> elements implement
+ the <code>LinkStyle</code> interface. <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <div class=impl>
+
+ <p>For <code><a href=#the-style-element>style</a></code> elements, if the user agent does not
+ support the specified styling language, then the <code title=dom-LinkStyle-sheet>sheet</code> attribute of the element's
+ <code>LinkStyle</code> interface must return null. Similarly,
+ <code><a href=#the-link-element>link</a></code> elements that do not represent <a href=#link-type-stylesheet title=rel-stylesheet>external resource links that contribute to
+ the styling processing model</a> (i.e. that do not have a <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword in their <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute), and <code><a href=#the-link-element>link</a></code>
+ elements whose specified resource has not yet been fetched, or is
+ not in a supported styling language, must have their
+ <code>LinkStyle</code> interface's <code title=dom-LinkStyle-sheet>sheet</code> attribute return null.</p>
+
+ <p>Otherwise, the <code>LinkStyle</code> interface's <code title=dom-LinkStyle-sheet>sheet</code> attribute must return a
+ <code>StyleSheet</code> object with the following properties: <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <dl><dt>The style sheet type</dt>
+
+ <dd><p>The style sheet type must be the same as the style's specified
+ type. For <code><a href=#the-style-element>style</a></code> elements, this is the same as the
+ <code title=attr-style-type><a href=#attr-style-type>type</a></code> content attribute's
+ value, or <code title="">text/css</code> if that is omitted. For
+ <code><a href=#the-link-element>link</a></code> elements, this is the <a href=#content-type title=Content-Type>Content-Type metadata of the specified
+ resource</a>.</dd>
+
+ <dt>The style sheet location</dt>
+
+ <dd><p>For <code><a href=#the-link-element>link</a></code> elements, the location must be the
+ result of <a href=#resolve-a-url title="resolve a url">resolving</a> the
+ <a href=#url>URL</a> given by the element's <code title=attr-link-href><a href=#attr-link-href>href</a></code> content attribute, relative to
+ the element, or the empty string if that fails. For
+ <code><a href=#the-style-element>style</a></code> elements, there is no location.</dd> <!--
+ note that this might not match the style sheet URL, if the base URL
+ has changed for instance -->
+
+ <dt>The style sheet media</dt>
+
+ <dd><p>The media must be the same as the value of the element's
+ <code title="">media</code> content attribute, or the empty string,
+ if the attribute is omitted.</dd>
+
+ <dt>The style sheet title</dt>
+
+ <dd><p>The title must be the same as the value of the element's
+ <code title=dom-title><a href=#dom-title>title</a></code> content attribute, if the
+ attribute is present and has a non-empty value. If the attribute is
+ absent or its value is the empty string, then the style sheet does
+ not have a title (it is the empty string). The title is used for
+ defining <span>alternative style sheet sets</span>.</dd>
+
+ <dt>The style sheet alternate flag</dt>
+
+ <dd><p>For <code><a href=#the-link-element>link</a></code> elements, true if <a href=#the-link-is-an-alternative-stylesheet>the link is an
+ alternative stylesheet</a>. In all other cases, false.</dd>
+
+<!--
+ <dt>The style sheet disabled flag</dt>
+ (not included, because I assume CSSOM will change to not require
+ this spec to initialise the value, but will instead initialise it
+ based on the other values)
+-->
+
+ </dl><p>The same object must be returned each time.</p>
+
+ <p>The <dfn id=dom-linkstyle-disabled title=dom-LinkStyle-disabled><code>disabled</code></dfn> IDL
+ attribute on <code><a href=#the-link-element>link</a></code> and <code><a href=#the-style-element>style</a></code> elements must
+ return false and do nothing on setting, if the <code title=dom-linkstyle-sheet>sheet</code> attribute of their
+ <code>LinkStyle</code> interface is null. Otherwise, it must return
+ the value of the <code>StyleSheet</code> interface's <code title=dom-stylesheet-disabled>disabled</code> attribute on
+ getting, and forward the new value to that same attribute on
+ setting.</p>
+
+ <!-- [CSSOM] covers the following: the term "alternative style sheet
+ sets", the term "default style sheet set", preferred stylesheets,
+ alternative stylesheets, persistent stylesheets, ordering of
+ stylesheets, dynamic additions/removals, window.styleSheets, style
+ sheets given by HTTP Link: headers, and the alternative style sheet
+ API -->
+
+ <p id=alternate-style-sheets>The rules for handling alternative
+ style sheets are defined in the CSS object model specification. <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <hr><p>Style sheets, whether added by a <code><a href=#the-link-element>link</a></code> element, a
+ <code><a href=#the-style-element>style</a></code> element, an <code>&lt;?xml-stylesheet&gt;</code> PI,
+ an HTTP <code title=http-link>Link:</code> header, or some other
+ mechanism, have a <dfn id=style-sheet-ready>style sheet ready</dfn> flag, which is
+ initially unset.</p>
+
+ <p>When a style sheet is ready to be applied, its <a href=#style-sheet-ready>style sheet
+ ready</a> flag must be set. If the style sheet referenced no
+ other resources (e.g. it was an internal style sheet given by a
+ <code><a href=#the-style-element>style</a></code> element with no <code title="">@import</code>
+ rules), then the style rules must be synchronously made available to
+ script; otherwise, the style rules must only be made available to
+ script once the <a href=#event-loop>event loop</a> reaches its "update the
+ rendering" step.</p>
+
+ <p>A style sheet in the context of the <code><a href=#document>Document</a></code> of an
+ <a href=#html-parser>HTML parser</a> or <a href=#xml-parser>XML parser</a> is said to be
+ <dfn id=a-style-sheet-blocking-scripts>a style sheet blocking scripts</dfn> if the element was created
+ by that <code><a href=#document>Document</a></code>'s parser, and the element is either a
+ <code><a href=#the-style-element>style</a></code> element or a <code><a href=#the-link-element>link</a></code> element that was
+ an <a href=#link-type-stylesheet title=rel-stylesheet>external resource link that
+ contributes to the styling processing model</a> when the element
+ was created by the parser, and the element's style sheet was enabled
+ when the element was created by the parser, and the element's
+ <a href=#style-sheet-ready>style sheet ready</a> flag is not yet set, and, the last
+ time the <a href=#event-loop>event loop</a> reached step 1, the element was
+ <a href=#in-a-document title="in a document">in that <code>Document</code></a>,
+ and the user agent hasn't given up on that particular style sheet
+ yet. A user agent may give up on a style sheet at any time.</p>
+
+ </div>
+
+
+
+ <h3 id=scripting-1><span class=secno>4.3 </span>Scripting</h3>
+
+ <p>Scripts allow authors to add interactivity to their documents.</p>
+
+ <p>Authors are encouraged to use declarative alternatives to
+ scripting where possible, as declarative mechanisms are often more
+ maintainable, and many users disable scripting.</p>
+
+ <div class=example>
+ <p>For example, instead of using script to show or hide a section
+ to show more details, the <code><a href=#the-details-element>details</a></code> element could be
+ used.</p>
+ </div>
+
+ <p>Authors are also encouraged to make their applications degrade
+ gracefully in the absence of scripting support.</p>
+
+ <div class=example>
+ <p>For example, if an author provides a link in a table header to
+ dynamically resort the table, the link could also be made to
+ function without scripts by requesting the sorted table from the
+ server.</p>
+ </div>
+
+
+ <h4 id=script><span class=secno>4.3.1 </span>The <dfn><code>script</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#metadata-content>metadata content</a> is expected.</dd>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>If there is no <code title=attr-script-src><a href=#attr-script-src>src</a></code>
+ attribute, depends on the value of the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute, but must match
+ <a href=#restrictions-for-contents-of-script-elements>script content restrictions</a>.</dd>
+ <dd>If there <em>is</em> a <code title=attr-script-src><a href=#attr-script-src>src</a></code>
+ attribute, the element must be either empty or contain only
+ <a href=#inline-documentation-for-external-scripts>script documentation</a> that also matches <a href=#restrictions-for-contents-of-script-elements>script
+ content restrictions</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-script-src><a href=#attr-script-src>src</a></code></dd>
+ <dd><code title=attr-script-async><a href=#attr-script-async>async</a></code></dd>
+ <dd><code title=attr-script-defer><a href=#attr-script-defer>defer</a></code></dd>
+ <dd><code title=attr-script-type><a href=#attr-script-type>type</a></code></dd>
+ <dd><code title=attr-script-charset><a href=#attr-script-charset>charset</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlscriptelement>HTMLScriptElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-script-src title=dom-script-src>src</a>;
+ attribute boolean <a href=#dom-script-async title=dom-script-async>async</a>;
+ attribute boolean <a href=#dom-script-defer title=dom-script-defer>defer</a>;
+ attribute DOMString <a href=#dom-script-type title=dom-script-type>type</a>;
+ attribute DOMString <a href=#dom-script-charset title=dom-script-charset>charset</a>;
+ attribute DOMString <a href=#dom-script-text title=dom-script-text>text</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#script>script</a></code> element allows authors to include dynamic
+ script and data blocks in their documents. The element does not
+ <a href=#represents title=represents>represent</a> content for the user.</p>
+
+ <p>When used to include dynamic scripts, the scripts may either be
+ embedded inline or may be imported from an external file using the
+ <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute. If the language
+ is not that described by "<code title="">text/javascript</code>",
+ then the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute must
+ be present, as described below.</p>
+
+ <p>When used to include data blocks (as opposed to scripts), the
+ data must be embedded inline, the format of the data must be given
+ using the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute, and
+ the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute must not be
+ specified.</p>
+
+ <p>The <dfn id=attr-script-type title=attr-script-type><code>type</code></dfn>
+ attribute gives the language of the script or format of the data. If
+ the attribute is present, its value must be a <a href=#valid-mime-type>valid MIME
+ type</a>. The <code title="">charset</code> parameter must not be
+ specified. The default, which is used if the attribute is absent,
+ is "<code title="">text/javascript</code>".</p>
+
+ <p>The <dfn id=attr-script-src title=attr-script-src><code>src</code></dfn>
+ attribute, if specified, gives the address of the external script
+ resource to use. The value of the attribute must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid
+ non-empty URL potentially surrounded by spaces</a> identifying a
+ script resource of the type given by the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute, if the attribute is
+ present, or of the type "<code title="">text/javascript</code>", if
+ the attribute is absent. A resource is a script resource of a given
+ type if that type identifies a scripting language and the resource
+ conforms with the requirements of that language's specification.</p>
+
+ <p>The <dfn id=attr-script-charset title=attr-script-charset><code>charset</code></dfn>
+ attribute gives the character encoding of the external script
+ resource. The attribute must not be specified if the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is not present. If the
+ attribute is set, its value must be a valid character encoding name,
+ must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
+ <a href=#preferred-mime-name>preferred MIME name</a> for that encoding, and must match
+ the encoding given in the <code title="">charset</code> parameter of
+ the <a href=#content-type title=Content-Type>Content-Type metadata</a> of the
+ external file, if any. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>
+
+ <p>The <dfn id=attr-script-async title=attr-script-async><code>async</code></dfn> and
+ <dfn id=attr-script-defer title=attr-script-defer><code>defer</code></dfn> attributes
+ are <a href=#boolean-attribute title="boolean attribute">boolean attributes</a> that
+ indicate how the script should be executed. The <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> and <code title=attr-script-async><a href=#attr-script-async>async</a></code> attributes must not be
+ specified if the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute
+ is not present.</p>
+
+ <p>There are three possible modes that can be selected using these
+ attributes. If the <code title=attr-script-async><a href=#attr-script-async>async</a></code>
+ attribute is present, then the script will be executed
+ asynchronously, as soon as it is available. If the <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute is not present but
+ the <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> attribute is
+ present, then the script is executed when the page has finished
+ parsing. If neither attribute is present, then the script is
+ fetched and executed immediately, before the user agent continues
+ parsing the page.</p>
+
+ <p class=note>The exact processing details for these attributes
+ are, for mostly historical reasons, somewhat non-trivial, involving
+ a number of aspects of HTML. The implementation requirements are
+ therefore by necessity scattered throughout the specification. The
+ algorithms below (in this section) describe the core of this
+ processing, but these algorithms reference and are referenced by the
+ parsing rules for <code><a href=#script>script</a></code> <a href=#scriptTag>start</a>
+ and <a href=#scriptEndTag>end</a> tags in HTML, <a href=#scriptForeignEndTag>in foreign content</a>, and <a href=#scriptTagXML>in XML</a>, the rules for the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> method, the
+ handling of <a href=#scripting>scripting</a>, etc.</p>
+
+ <p>The <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> attribute may be
+ specified even if the <code title=attr-script-async><a href=#attr-script-async>async</a></code>
+ attribute is specified, to cause legacy Web browsers that only
+ support <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> (and not <code title=attr-script-async><a href=#attr-script-async>async</a></code>) to fall back to the <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> behavior instead of the
+ synchronous blocking behavior that is the default.</p>
+
+ <p>Changing the <code title=attr-script-src><a href=#attr-script-src>src</a></code>, <code title=attr-script-type><a href=#attr-script-type>type</a></code>, <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code>, <code title=attr-script-async><a href=#attr-script-async>async</a></code>, and <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> attributes dynamically has no
+ direct effect; these attribute are only used at specific times
+ described below.</p> <!-- by implication, changes to the base URL
+ also have no effect -->
+
+ <div class=impl>
+
+ <p>A <code><a href=#script>script</a></code> element has several associated pieces of
+ state.</p>
+
+ <p>The first is a flag indicating whether or not the script block
+ has been <dfn id=already-started>"already started"</dfn>. Initially,
+ <code><a href=#script>script</a></code> elements must have this flag unset (script
+ blocks, when created, are not "already started"). When a
+ <code><a href=#script>script</a></code> element is cloned, the "already started" flag,
+ if set, must be propagated to the clone when it is created.</p>
+
+ <p>The second is a flag indicating whether the element was
+ <dfn id=parser-inserted>"parser-inserted"</dfn>. Initially, <code><a href=#script>script</a></code>
+ elements must have this flag unset. It is set by the <a href=#html-parser>HTML
+ parser</a> and the <a href=#xml-parser>XML parser</a> on <code><a href=#script>script</a></code>
+ elements they insert and affects the processing of those
+ elements.</p>
+
+ <p>The third is a flag indicating whether or not the script block is
+ <dfn id=ready-to-be-parser-executed>"ready to be parser-executed"</dfn>. Initially,
+ <code><a href=#script>script</a></code> elements must have this flag unset (script
+ blocks, when created, are not "ready to be parser-executed"). This
+ flag is used only for elements that are also
+ <a href=#parser-inserted>"parser-inserted"</a>, to let the parser know when to
+ execute the script.</p>
+
+ <p>The fourth and fifth pieces of state are <dfn id="the-script-block's-type"><var>the script
+ block's type</var></dfn> and <dfn id="the-script-block's-character-encoding"><var>the script block's character
+ encoding</var></dfn>. They are determined when the script is run,
+ based on the attributes on the element at that time.</p>
+
+ <p>When a <code><a href=#script>script</a></code> element that is neither marked as
+ having <a href=#already-started>"already started"</a> nor marked as being
+ <a href=#parser-inserted>"parser-inserted"</a> experiences one of the events listed
+ in the following list, the user agent must synchronously <a href=#running-a-script title="running a script">run</a> the <code><a href=#script>script</a></code>
+ element:</p>
+
+ <ul><li>The <code><a href=#script>script</a></code> element gets <a href=#insert-an-element-into-a-document title="insert an
+ element into a document">inserted into a document</a>.</li>
+
+ <li>The <code><a href=#script>script</a></code> element is <a href=#in-a-document>in a
+ <code>Document</code></a> and its child nodes are changed.</li>
+
+ <li>The <code><a href=#script>script</a></code> element is <a href=#in-a-document>in a
+ <code>Document</code></a> and has a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute set where previously
+ the element had no such attribute.</li>
+
+ </ul><p><dfn id=running-a-script title="running a script">Running a script</dfn>: When a
+ <code><a href=#script>script</a></code> element is to be run, the user agent must act as
+ follows:</p>
+
+ <ol><li id=script-processing-prepare>
+
+ <p>If either:</p>
+
+ <ul class=brief><li>the <code><a href=#script>script</a></code> element has a <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute and its value is
+ the empty string, or</li>
+
+ <li>the <code><a href=#script>script</a></code> element has no <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute but it has a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute and
+ <em>that</em> attribute's value is the empty string, or</li>
+
+ <li>the <code><a href=#script>script</a></code> element has neither a <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute nor a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute, then</li>
+
+ </ul><p>...let <var><a href="#the-script-block's-type">the script block's type</a></var> for this
+ <code><a href=#script>script</a></code> element be "<code title="">text/javascript</code>".</p>
+
+ <p>Otherwise, if the <code><a href=#script>script</a></code> element has a <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute, let <var><a href="#the-script-block's-type">the
+ script block's type</a></var> for this <code><a href=#script>script</a></code> element be
+ the value of that attribute with any leading or trailing sequences
+ of <a href=#space-character title="space character">space characters</a>
+ removed.</p>
+
+ <p>Otherwise, the element has a non-empty <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute; let
+ <var><a href="#the-script-block's-type">the script block's type</a></var> for this <code><a href=#script>script</a></code>
+ element be the concatenation of the string "<code title="">text/</code>" followed by the value of the <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute.</p> <!--
+ user agents already support, e.g., type="text/javascript1.3", so
+ we don't have to support that separately. -->
+
+ <p class=note>The <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute is never
+ conforming, and is always ignored if there is a <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute present.</p>
+
+ </li>
+
+ <li id=script-processing-encoding>
+
+ <p>If the <code><a href=#script>script</a></code> element has a <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code> attribute, then let
+ <var><a href="#the-script-block's-character-encoding">the script block's character encoding</a></var> for this
+ <code><a href=#script>script</a></code> element be the encoding given by the <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code> attribute.</p>
+
+ <p>Otherwise, let <var><a href="#the-script-block's-character-encoding">the script block's character encoding</a></var>
+ for this <code><a href=#script>script</a></code> element be the same as <a href="#document's-character-encoding" title="document's character encoding">the encoding of the document
+ itself</a>.</p>
+
+ </li>
+
+ <li id=script-processing-for>
+
+ <p>If the <code><a href=#script>script</a></code> element has an <code title=attr-script-event><a href=#attr-script-event>event</a></code> attribute and a <code title=attr-script-for><a href=#attr-script-for>for</a></code> attribute, then run these
+ substeps:</p>
+
+ <ol><li><p>Let <var title="">for</var> be the value of the <code title=attr-script-for><a href=#attr-script-for>for</a></code> attribute.</li>
+
+ <li><p>Let <var title="">event</var> be the value of the <code title=attr-script-event><a href=#attr-script-event>event</a></code> attribute.</li>
+
+ <li><p><a href=#strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from
+ <var title="">event</var> and <var title="">for</var>.</li>
+
+ <li><p>If <var title="">for</var> is not an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">window</code>", then the user agent must abort these
+ steps at this point. The script is not executed.</li>
+
+ <li><p>If <var title="">event</var> is not an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for either the string "<code title="">onload</code>" or the string "<code title="">onload()</code>", then the user agent must abort these
+ steps at this point. The script is not executed.</li>
+
+ </ol></li>
+
+ <li id=script-processing-noscript>
+
+ <p>If <a href=#concept-n-noscript title=concept-n-noscript>scripting is
+ disabled</a> for the <code><a href=#script>script</a></code> element, or if the
+ user agent does not <a href=#support-the-scripting-language>support the scripting language</a>
+ given by <var><a href="#the-script-block's-type">the script block's type</a></var> for this
+ <code><a href=#script>script</a></code> element, then the user agent must abort these
+ steps at this point. The script is not executed.</p>
+
+ </li>
+
+ <li id=script-processing-empty>
+
+ <p>If the element has no <code title=attr-script-src><a href=#attr-script-src>src</a></code>
+ attribute, and its child nodes consist only of comment nodes and
+ empty <a href=#text-node title="text node">text nodes</a>, then the user
+ agent must abort these steps at this point. The script is not
+ executed.</p>
+
+ </li>
+
+ <li id=script-processing-start>
+
+ <p>The user agent must set the element's <a href=#already-started>"already
+ started"</a> flag.</p>
+
+ </li>
+
+ <li id=script-processing-src-prepare>
+
+ <p>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code>
+ attribute whose value is not the empty string, then the value of
+ that attribute must be <a href=#resolve-a-url title="resolve a url">resolved</a>
+ relative to the element, and if that is successful, the specified
+ resource must then be <a href=#fetch title=fetch>fetched</a>, from the
+ <a href=#origin>origin</a> of the element's <code><a href=#document>Document</a></code>.</p>
+ <!-- not http-origin privacy sensitive -->
+
+ <p>If the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute's
+ value is the empty string or if it could not be resolved, then the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-error>error</code> at the
+ element, and abort these steps.</p>
+
+ <p>For historical reasons, if the <a href=#url>URL</a> is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code>
+ URL</a>, then the user agent must not, despite the requirements
+ in the definition of the <a href=#fetch title=fetch>fetching</a>
+ algorithm, actually execute the script in the URL; instead the
+ user agent must act as if it had received an empty HTTP 400
+ response.</p>
+
+ <p>Once the resource's <a href=#content-type title=Content-Type>Content Type
+ metadata</a> is available, if it ever is, apply the
+ <a href=#algorithm-for-extracting-an-encoding-from-a-content-type>algorithm for extracting an encoding from a
+ Content-Type</a> to it. If this returns an encoding, and the
+ user agent supports that encoding, then let <var><a href="#the-script-block's-character-encoding">the script
+ block's character encoding</a></var> be that encoding.</p>
+
+ <p>For performance reasons, user agents may start fetching the
+ script as soon as the attribute is set, instead, in the hope that
+ the element will be inserted into the document. Either way, once
+ the element is <a href=#insert-an-element-into-a-document title="insert an element into a
+ document">inserted into the document</a>, the load must have
+ started. If the UA performs such prefetching, but the element is
+ never inserted in the document, or the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is dynamically
+ changed,<!-- or the base URL is dynamically changed,--> then the
+ user agent will not execute the script, and the fetching process
+ will have been effectively wasted.</p>
+
+ </li>
+
+ <li>
+
+ <p>Then, the first of the following options that describes the
+ situation must be followed:</p>
+
+ <dl class=switch><dt id=script-processing-defer>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute, and the element has
+ a <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> attribute, and the
+ element has been flagged as <a href=#parser-inserted>"parser-inserted"</a>, and
+ the element does not have an <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute</dt>
+
+ <dd>
+
+ <p>The element must be added to the end of the <dfn id=list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of
+ scripts that will execute when the document has finished
+ parsing</dfn>.</p>
+
+ <p>The <a href=#concept-task title=concept-task>task</a> that the
+ <a href=#networking-task-source>networking task source</a> places on the <a href=#task-queue>task
+ queue</a> once the <a href=#fetch title=fetch>fetching
+ algorithm</a> has completed must set the element's
+ <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag. The parser will
+ handle executing the script.</p>
+
+ </dd>
+
+
+ <dt id=script-processing-parser-inserted>If the element has a
+ <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute, and the
+ element has been flagged as <a href=#parser-inserted>"parser-inserted"</a>, and
+ the element does not have an <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute</dt>
+
+ <dd>
+
+ <p>The element is the <a href=#pending-parsing-blocking-script>pending parsing-blocking
+ script</a>. (There can only be one such script at a
+ time.)</p>
+
+ <p>The <a href=#concept-task title=concept-task>task</a> that the
+ <a href=#networking-task-source>networking task source</a> places on the <a href=#task-queue>task
+ queue</a> once the <a href=#fetch title=fetch>fetching
+ algorithm</a> has completed must set the element's
+ <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag. The parser will
+ handle executing the script.</p>
+
+ </dd>
+
+
+ <dt id=script-processing-style-delayed>If the element does not
+ have a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute, but
+ there is <a href=#a-style-sheet-blocking-scripts>a style sheet blocking scripts</a>, and the
+ element has been flagged as <a href=#parser-inserted>"parser-inserted"</a></dt>
+
+ <dd>
+
+ <p>The element is the <a href=#pending-parsing-blocking-script>pending parsing-blocking
+ script</a>. (There can only be one such script at a
+ time.)</p>
+
+ <p>Set the element's <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a>
+ flag. The parser will handle executing the script.</p>
+
+ </dd>
+
+
+ <dt id=script-processing-src>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute</dt>
+
+ <dd>
+
+ <p>The element must be added to the <dfn id=set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that
+ will execute as soon as possible</dfn>.</p>
+
+ <p>The <a href=#concept-task title=concept-task>task</a> that the
+ <a href=#networking-task-source>networking task source</a> places on the <a href=#task-queue>task
+ queue</a> once the <a href=#fetch title=fetch>fetching
+ algorithm</a> has completed must <a href=#executing-a-script-block title="executing a
+ script block">execute the script block</a> and then remove
+ the element from the <a href=#set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as
+ soon as possible</a>.</p>
+
+ </dd>
+
+
+ <dt id=script-processing-inline>Otherwise</dt>
+
+ <dd>The user agent must immediately <a href=#executing-a-script-block title="executing a
+ script block">execute the script block</a>, even if other
+ scripts are already executing.</dd>
+
+ </dl></li>
+
+ </ol><!-- similar text in various places --><p>Fetching an external script must <a href=#delay-the-load-event>delay the load
+ event</a> of the element's document until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
+ task">queued</a> by the <a href=#networking-task-source>networking task source</a> once
+ the resource has been <a href=#fetch title=fetch>fetched</a> (defined
+ above) has been run.</p>
+
+ <p>The <dfn id=pending-parsing-blocking-script>pending parsing-blocking script</dfn> is used by the
+ parser.</p>
+
+ <p><dfn id=executing-a-script-block title="executing a script block">Executing a script
+ block</dfn>: When the steps above require that the script block be
+ executed, the user agent must act as follows:</p>
+
+ <dl class=switch><dt>If the load resulted in an error (for example a DNS error, or
+ an HTTP 404 error)</dt>
+
+ <dd><p>Executing the script block must just consist of <a href=#fire-a-simple-event title="fire a simple event">firing a simple event</a> named
+ <code title=event-error>error</code> at the element.</dd>
+
+ <dt>If the load was successful</dt>
+
+ <!-- SCRIPT EXEC -->
+ <dd>
+
+ <ol><li>
+
+ <p>Initialize <dfn id="the-script-block's-source"><var>the script block's source</var></dfn> as
+ follows:</p>
+
+ <dl class=switch><dt>If the script is from an external file and <var><a href="#the-script-block's-type">the script block's type</a></var> is a text-based language</dt>
+
+ <dd>
+
+ <p>The contents of that file, interpreted as string of
+ Unicode characters, are the script source.</p>
+
+ <p>For each of the rows in the following table, starting with
+ the first one and going down, if the file has as many or more
+ bytes available than the number of bytes in the first column,
+ and the first bytes of the file match the bytes given in the
+ first column, then set <var><a href="#the-script-block's-character-encoding">the script block's character
+ encoding</a></var> to the encoding given in the cell in the second
+ column of that row, irrespective of any previous value:</p>
+
+ <!-- this table is present in several forms in this file; keep them in sync -->
+ <table><thead><tr><th>Bytes in Hexadecimal
+ <th>Encoding
+ <tbody><!-- nobody uses this
+ <tr>
+ <td>00 00 FE FF
+ <td>UTF-32BE
+ <tr>
+ <td>FF FE 00 00
+ <td>UTF-32LE
+--><tr><td>FE FF
+ <td>UTF-16BE
+ <tr><td>FF FE
+ <td>UTF-16LE
+ <tr><td>EF BB BF
+ <td>UTF-8
+<!-- nobody uses this
+ <tr>
+ <td>DD 73 66 73
+ <td>UTF-EBCDIC
+-->
+ </table><p class=note>This step looks for Unicode Byte Order Marks
+ (BOMs).</p>
+
+ <p>The file must then be converted to Unicode using the
+ character encoding given by <var><a href="#the-script-block's-character-encoding">the script block's character
+ encoding</a></var>.</p>
+
+ </dd>
+
+ <dt>If the script is from an external file and <var><a href="#the-script-block's-type">the script block's type</a></var> is an XML-based language</dt>
+
+ <dd>
+
+ <p>The external file is the script source. When it is later
+ executed, it must be interpreted in a manner consistent with
+ the specification defining the language given by <var><a href="#the-script-block's-type">the
+ script block's type</a></var>.</p>
+
+ </dd>
+
+ <dt>If the script is inline and <var><a href="#the-script-block's-type">the script block's type</a></var> is a text-based language</dt>
+
+ <dd>
+
+ <p>The value of the <code title=dom-script-text><a href=#dom-script-text>text</a></code>
+ IDL attribute at the time the element's <a href=#already-started>"already
+ started"</a> flag was set is the script source.</p>
+
+ </dd>
+
+ <dt>If the script is inline and <var><a href="#the-script-block's-type">the script block's type</a></var> is an XML-based language</dt>
+
+ <dd>
+
+ <p>The child nodes of the <code><a href=#script>script</a></code> element at the
+ time the element's <a href=#already-started>"already started"</a> flag was set
+ are the script source.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li>
+
+ <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a
+ script</a> from the <code><a href=#script>script</a></code> element node, using
+ <var><a href="#the-script-block's-source">the script block's source</a></var> and <var><a href="#the-script-block's-type">the script
+ block's type</a></var>.</p>
+
+ <p class=note>This is where the script is compiled and
+ actually executed.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the script is from an external file, <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-load>load</code> at the
+ <code><a href=#script>script</a></code> element.</p>
+
+ <p>Otherwise, the script is internal; <a href=#queue-a-task>queue a task</a>
+ to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#script>script</a></code>
+ element.</p>
+
+ </li>
+
+ </ol></dd>
+
+ </dl><p>The IDL attributes <dfn id=dom-script-src title=dom-script-src><code>src</code></dfn>, <dfn id=dom-script-type title=dom-script-type><code>type</code></dfn>, <dfn id=dom-script-charset title=dom-script-charset><code>charset</code></dfn>, <dfn id=dom-script-async title=dom-script-async><code>async</code></dfn>, and <dfn id=dom-script-defer title=dom-script-defer><code>defer</code></dfn>, each must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">script</var> . <code title=dom-script-text><a href=#dom-script-text>text</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the contents of the element, ignoring child nodes that
+ aren't <a href=#text-node title="text node">text nodes</a>.</p>
+
+ <p>Can be set, to replace the element's children with the given
+ value.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The IDL attribute <dfn id=dom-script-text title=dom-script-text><code>text</code></dfn> must return a
+ concatenation of the contents of all the <a href=#text-node title="text
+ node">text nodes</a> that are direct children of the
+ <code><a href=#script>script</a></code> element (ignoring any other nodes such as
+ comments or elements), in tree order. On setting, it must act the
+ same way as the <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>
+
+ </div>
+
+ <p class=note>When inserted using the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> method,
+ <code><a href=#script>script</a></code> elements execute (typically synchronously), but
+ when inserted using <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> and <code title=dom-outerHTML><a href=#dom-outerhtml>outerHTML</a></code> attributes, they do not
+ execute at all.</p>
+
+ <div class=example>
+
+ <p>In this example, two <code><a href=#script>script</a></code> elements are used. One
+ embeds an external script, and the other includes some data.</p>
+
+ <pre>&lt;script src="game-engine.js"&gt;&lt;/script&gt;
+&lt;script type="text/x-game-map"&gt;
+........U.........e
+o............A....e
+.....A.....AAA....e
+.A..AAA...AAAAA...e
+&lt;/script&gt;</pre>
+
+ <p>The data in this case might be used by the script to generate
+ the map of a video game. The data doesn't have to be used that way,
+ though; maybe the map data is actually embedded in other parts of
+ the page's markup, and the data block here is just used by the
+ site's search engine to help users who are looking for particular
+ features in their game maps.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following sample shows how a script element can be used to
+ define a function that is then used by other parts of the
+ document. It also shows how a <code><a href=#script>script</a></code> element can be
+ used to invoke script while the document is being parsed, in this
+ case to initialize the form's output.</p>
+
+ <pre>&lt;script&gt;
+ function calculate(form) {
+ var price = 52000;
+ if (form.elements.brakes.checked)
+ price += 1000;
+ if (form.elements.radio.checked)
+ price += 2500;
+ if (form.elements.turbo.checked)
+ price += 5000;
+ if (form.elements.sticker.checked)
+ price += 250;
+ form.elements.result.value = price;
+ }
+&lt;/script&gt;
+&lt;form name="pricecalc" onsubmit="return false"&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt;Work out the price of your car&lt;/legend&gt;
+ &lt;p&gt;Base cost: &pound;52000.&lt;/p&gt;
+ &lt;p&gt;Select additional options:&lt;/p&gt;
+ &lt;ul&gt;
+ &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=brakes&gt; Ceramic brakes (&pound;1000)&lt;/label&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=radio&gt; Satellite radio (&pound;2500)&lt;/label&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=turbo&gt; Turbo charger (&pound;5000)&lt;/label&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=sticker&gt; "XZ" sticker (&pound;250)&lt;/label&gt;&lt;/li&gt;
+ &lt;/ul&gt;
+ &lt;p&gt;Total: &pound;&lt;output name=result onformchange="calculate(form)"&gt;&lt;/output&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;script&gt;
+ document.forms.pricecalc.dispatchFormChange();
+ &lt;/script&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+
+
+ <h5 id=scriptingLanguages><span class=secno>4.3.1.1 </span>Scripting languages</h5>
+
+ <div class=impl>
+
+ <p>A user agent is said to <dfn id=support-the-scripting-language>support the scripting language</dfn>
+ if <var><a href="#the-script-block's-type">the script block's type</a></var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the <a href=#mime-type>MIME type</a> string
+ of a scripting language that the user agent implements.</p>
+
+ </div>
+
+ <p>The following lists some <a href=#mime-type>MIME type</a> strings and the
+ languages to which they refer:</p>
+
+ <dl><dt>"<code>application/ecmascript</code>"</dt>
+ <dt>"<code>application/javascript</code>"</dt>
+ <dt>"<code>application/x-ecmascript</code>"</dt>
+ <dt>"<code>application/x-javascript</code>"</dt>
+ <dt>"<code>text/ecmascript</code>"</dt>
+ <dt>"<code>text/javascript</code>"</dt>
+ <dt>"<code>text/javascript1.0</code>"</dt>
+ <dt>"<code>text/javascript1.1</code>"</dt>
+ <dt>"<code>text/javascript1.2</code>"</dt>
+ <dt>"<code>text/javascript1.3</code>"</dt>
+ <dt>"<code>text/javascript1.4</code>"</dt>
+ <dt>"<code>text/javascript1.5</code>"</dt>
+ <dt>"<code>text/jscript</code>"</dt>
+ <dt>"<code>text/livescript</code>"</dt>
+ <dt>"<code>text/x-ecmascript</code>"</dt>
+ <dt>"<code>text/x-javascript</code>"</dt>
+ <dd>JavaScript. <a href=#refsECMA262>[ECMA262]</a></dd>
+
+ <dt>"<code>text/javascript;e4x=1</code>"</dt>
+ <dd>JavaScript with ECMAScript for XML. <a href=#refsECMA357>[ECMA357]</a></dd>
+
+ </dl><div class=impl>
+
+ <p>User agents may support other <a href=#mime-type title="MIME type">MIME
+ types</a> and other languages.</p>
+
+ <!-- this paragraph is also present in the <style> section -->
+ <p>When examining types to determine if they support the language,
+ user agents must not ignore unknown MIME parameters &mdash; types
+ with unknown parameters must be assumed to be unsupported. The <code title="">charset</code> parameter must be treated as an unknown
+ parameter for the purpose of comparing <a href=#mime-type title="MIME type">MIME
+ types</a> here.</p>
+
+ </div>
+
+
+ <h5 id=restrictions-for-contents-of-script-elements><span class=secno>4.3.1.2 </span><dfn title="script content restrictions">Restrictions for contents of <code>script</code> elements</dfn></h5>
+
+ <p>The <code><a href=#textcontent>textContent</a></code> of a <code><a href=#script>script</a></code> element must match the
+ <code title="">script</code> production in the following ABNF, the
+ character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
+
+ <pre>script = data1 *( escape [ script-start data3 ] "--&gt;" data1 ) [ escape ]
+escape = "&lt;!--" data2 *( script-start data3 script-end data2 )
+
+data1 = &lt;any string that doesn't contain a substring that matches not-data1&gt;
+not-data1 = <!-- script-end / -->"&lt;!--" <!-- the script-end is redundant here since it would close the element -->
+
+data2 = &lt;any string that doesn't contain a substring that matches not-data2&gt;
+not-data2 = <!-- script-end / -->script-start / "--&gt;" <!-- the script-end is redundant here since it would close the element -->
+
+data3 = &lt;any string that doesn't contain a substring that matches not-data3&gt;
+not-data3 = script-end / "--&gt;"
+
+script-start = lt s c r i p t tag-end
+script-end = lt slash s c r i p t tag-end
+
+lt = %x003C ; U+003C LESS-THAN SIGN character (&lt;)
+slash = %x002F ; U+002F SOLIDUS character (/)
+
+s = %x0053 ; U+0053 LATIN CAPITAL LETTER S
+s =/ %x0073 ; U+0073 LATIN SMALL LETTER S
+c = %x0043 ; U+0043 LATIN CAPITAL LETTER C
+c =/ %x0063 ; U+0063 LATIN SMALL LETTER C
+r = %x0052 ; U+0052 LATIN CAPITAL LETTER R
+r =/ %x0072 ; U+0072 LATIN SMALL LETTER R
+i = %x0049 ; U+0049 LATIN CAPITAL LETTER I
+i =/ %x0069 ; U+0069 LATIN SMALL LETTER I
+p = %x0050 ; U+0050 LATIN CAPITAL LETTER P
+p =/ %x0070 ; U+0070 LATIN SMALL LETTER P
+t = %x0054 ; U+0054 LATIN CAPITAL LETTER T
+t =/ %x0074 ; U+0074 LATIN SMALL LETTER T
+
+tag-end = %x0009 ; U+0009 CHARACTER TABULATION
+tag-end =/ %x000A ; U+000A LINE FEED (LF)
+tag-end =/ %x000C ; U+000C FORM FEED (FF)
+tag-end =/ %x0020 ; U+0020 SPACE
+tag-end =/ %x002F ; U+002F SOLIDUS (/)
+tag-end =/ %x003E ; U+003E GREATER-THAN SIGN (&gt;)</pre>
+
+ <p>When a <code><a href=#script>script</a></code> element contains <a href=#inline-documentation-for-external-scripts>script
+ documentation</a>, there are further restrictions on the contents
+ of the element, as described in the section below.</p>
+
+
+ <h5 id=inline-documentation-for-external-scripts><span class=secno>4.3.1.3 </span><dfn title="script documentation">Inline documentation for external scripts</dfn></h5>
+
+ <p>If a <code><a href=#script>script</a></code> element's <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is specified, then the
+ contents of the <code><a href=#script>script</a></code> element, if any, must be such
+ that the value of the <code title=dom-script-text><a href=#dom-script-text>text</a></code> IDL
+ attribute, which is derived from the element's contents, matches the
+ <code title="">documentation</code> production in the following
+ ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
+
+ <pre>documentation = *( *( space / tab / comment ) [ line-comment ] newline )
+comment = slash star *( not-star / star not-slash ) 1*star slash
+line-comment = slash slash *not-newline
+
+; characters
+tab = %x0009 ; U+0009 TAB
+newline = %x000A ; U+000A LINE FEED (LF)
+space = %x0020 ; U+0020 SPACE
+star = %x002A ; U+002A ASTERISK (*)
+slash = %x002F ; U+002F SOLIDUS (/)
+not-newline = %x0000-0009 / %x000B-10FFFF
+ ; a Unicode character other than U+000A LINE FEED (LF)
+not-star = %x0000-0029 / %x002B-10FFFF
+ ; a Unicode character other than U+002A ASTERISK (*)
+not-slash = %x0000-002E / %x0030-10FFFF
+ ; a Unicode character other than U+002F SOLIDUS (/)</pre>
+
+ <p class=note>This corresponds to putting the contents of the
+ element in JavaScript comments.</p>
+
+ <p class=note>This requirement is in addition to the earlier
+ restrictions on the syntax of contents of <code><a href=#script>script</a></code>
+ elements.</p>
+
+ <div class=example>
+
+ <p>This allows authors to include documentation, such as license
+ information or API information, inside their documents while still
+ referring to external script files. The syntax is constrained so
+ that authors don't accidentally include what looks like valid
+ script while also providing a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute.</p>
+
+ <pre>&lt;script src="cool-effects.js"&gt;
+ // create new instances using:
+ // var e = new Effect();
+ // start the effect using .play, stop using .stop:
+ // e.play();
+ // e.stop();
+&lt;/script&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-noscript-element><span class=secno>4.3.2 </span>The <dfn><code>noscript</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>In a <code><a href=#the-head-element-0>head</a></code> element of an <a href=#html-documents title="HTML documents">HTML document</a>, if there are no ancestor <code><a href=#the-noscript-element>noscript</a></code> elements.</dd>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected in <a href=#html-documents>HTML documents</a>, if there are no ancestor <code><a href=#the-noscript-element>noscript</a></code> elements.</dd>
+ <dt>Content model:</dt>
+ <dd>When <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a>, in a <code><a href=#the-head-element-0>head</a></code> element: in any order, zero or more <code><a href=#the-link-element>link</a></code> elements, zero or more <code><a href=#the-style-element>style</a></code> elements, and zero or more <code><a href=#meta>meta</a></code> elements.</dd>
+ <dd>When <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a>, not in a <code><a href=#the-head-element-0>head</a></code> element: <a href=#transparent>transparent</a>, but there must be no <code><a href=#the-noscript-element>noscript</a></code> element descendants.</dd>
+ <dd>Otherwise: text that conforms to the requirements given in the prose.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-noscript-element>noscript</a></code> element <a href=#represents>represents</a> nothing
+ if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a>, and
+ <a href=#represents>represents</a> its children if <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a>. It is used
+ to present different markup to user agents that support scripting
+ and those that don't support scripting, by affecting how the
+ document is parsed.</p>
+
+ <p>When used in <a href=#html-documents>HTML documents</a>, the allowed content
+ model is as follows:</p>
+
+ <dl><dt>In a <code><a href=#the-head-element-0>head</a></code> element, if <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a> for the
+ <code><a href=#the-noscript-element>noscript</a></code> element</dt>
+
+ <dd><p>The <code><a href=#the-noscript-element>noscript</a></code> element must contain only
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-style-element>style</a></code>, and <code><a href=#meta>meta</a></code>
+ elements.</dd>
+
+ <dt>In a <code><a href=#the-head-element-0>head</a></code> element, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the
+ <code><a href=#the-noscript-element>noscript</a></code> element</dt>
+
+ <dd><p>The <code><a href=#the-noscript-element>noscript</a></code> element must contain only text,
+ except that invoking the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing
+ algorithm</a> <!-- (which disables <script> execution) --> with
+ the <code><a href=#the-noscript-element>noscript</a></code> element as the <var title="">context</var> element and the text contents as the <var title="">input</var> must result in a list of nodes that consists
+ only of <code><a href=#the-link-element>link</a></code>, <code><a href=#the-style-element>style</a></code>, and
+ <code><a href=#meta>meta</a></code> elements that would be conforming if they were
+ children of the <code><a href=#the-noscript-element>noscript</a></code> element, and no <a href=#parse-error title="parse error">parse errors</a>.</dd>
+
+ <dt>Outside of <code><a href=#the-head-element-0>head</a></code> elements, if <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a> for the
+ <code><a href=#the-noscript-element>noscript</a></code> element</dt>
+
+ <dd><p>The <code><a href=#the-noscript-element>noscript</a></code> element's content model is
+ <a href=#transparent>transparent</a>, with the additional restriction that a
+ <code><a href=#the-noscript-element>noscript</a></code> element must not have a <code><a href=#the-noscript-element>noscript</a></code>
+ element as an ancestor (that is, <code><a href=#the-noscript-element>noscript</a></code> can't be
+ nested).</dd>
+
+ <dt>Outside of <code><a href=#the-head-element-0>head</a></code> elements, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the
+ <code><a href=#the-noscript-element>noscript</a></code> element</dt>
+
+ <dd>
+
+ <p>The <code><a href=#the-noscript-element>noscript</a></code> element must contain only text,
+ except that the text must be such that running the following
+ algorithm results in a conforming document with no
+ <code><a href=#the-noscript-element>noscript</a></code> elements and no <code><a href=#script>script</a></code>
+ elements, and such that no step in the algorithm causes an
+ <a href=#html-parser>HTML parser</a> to flag a <a href=#parse-error>parse error</a>:</p>
+
+ <ol><li>Remove every <code><a href=#script>script</a></code> element from the
+ document.</li>
+
+ <li>Make a list of every <code><a href=#the-noscript-element>noscript</a></code> element in the
+ document. For every <code><a href=#the-noscript-element>noscript</a></code> element in that list,
+ perform the following steps:
+
+ <ol><li>Let the <var title="">parent element</var> be the parent
+ element of the <code><a href=#the-noscript-element>noscript</a></code> element.</li>
+
+ <li>Take all the children of the <var title="">parent element</var>
+ that come before the <code><a href=#the-noscript-element>noscript</a></code> element, and call these
+ elements <var title="">the before children</var>.</li>
+
+ <li>Take all the children of the <var title="">parent element</var>
+ that come <em>after</em> the <code><a href=#the-noscript-element>noscript</a></code> element, and
+ call these elements <var title="">the after children</var>.</li>
+
+ <li>Let <var title="">s</var> be the concatenation of all the
+ <a href=#text-node>text node</a> children of the <code><a href=#the-noscript-element>noscript</a></code>
+ element.</li>
+
+ <li>Set the <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code>
+ attribute of the <var title="">parent element</var> to the value
+ of <var title="">s</var>. (This, as a side-effect, causes the
+ <code><a href=#the-noscript-element>noscript</a></code> element to be removed from the
+ document.)</li>
+
+ <li>Insert <var title="">the before children</var> at the start of
+ the <var title="">parent element</var>, preserving their original
+ relative order.</li>
+
+ <li>Insert <var title="">the after children</var> at the end of the
+ <var title="">parent element</var>, preserving their original
+ relative order.</li>
+
+ </ol></li>
+
+ </ol></dd>
+
+ </dl><p class=note>All these contortions are required because, for
+ historical reasons, the <code><a href=#the-noscript-element>noscript</a></code> element is handled
+ differently by the <a href=#html-parser>HTML parser</a> based on whether <a href=#scripting-flag title="scripting flag">scripting was enabled or not</a> when the
+ parser was invoked.</p>
+
+ <p>The <code><a href=#the-noscript-element>noscript</a></code> element must not be used in <a href=#xml-documents>XML
+ documents</a>.</p>
+
+ <p class=note><strong>The <code><a href=#the-noscript-element>noscript</a></code> element is only
+ effective in <a href=#syntax>the HTML syntax</a>, it has no effect in
+ <a href=#the-xhtml-syntax>the XHTML syntax</a>.</strong></p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-noscript-element>noscript</a></code> element has no other requirements. In
+ particular, children of the <code><a href=#the-noscript-element>noscript</a></code> element are not
+ exempt from <a href=#form-submission>form submission</a>, scripting, and so forth,
+ even when <a href=#concept-n-script title=concept-n-script>scripting is enabled</a>
+ for the element.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, a <code><a href=#the-noscript-element>noscript</a></code> element is
+ used to provide fallback for a script.</p>
+
+ <pre>&lt;form action="calcSquare.php"&gt;
+ &lt;p&gt;
+ &lt;label for=x&gt;Number&lt;/label&gt;:
+ &lt;input id="x" name="x" type="number"&gt;
+ &lt;/p&gt;
+ &lt;script&gt;
+ var x = document.getElementById('x');
+ var output = document.createElement('p');
+ output.textContent = 'Type a number; it will be squared right then!';
+ x.form.appendChild(output);
+ x.form.onsubmit = function () { return false; }
+ x.oninput = function () {
+ var v = x.valueAsNumber;
+ output.textContent = v + ' squared is ' + v * v;
+ };
+ &lt;/script&gt;
+ &lt;noscript&gt;
+ &lt;input type=submit value="Calculate Square"&gt;
+ &lt;/noscript&gt;
+&lt;/form&gt;</pre>
+
+ <p>When script is disabled, a button appears to do the calculation
+ on the server side. When script is enabled, the value is computed
+ on-the-fly instead.</p>
+
+ <p>The <code><a href=#the-noscript-element>noscript</a></code> element is a blunt
+ instrument. Sometimes, scripts might be enabled, but for some
+ reason the page's script might fail. For this reason, it's
+ generally better to avoid using <code><a href=#the-noscript-element>noscript</a></code>, and to
+ instead design the script to change the page from being a
+ scriptless page to a scripted page on the fly, as in the next
+ example:</p>
+
+ <pre>&lt;form action="calcSquare.php"&gt;
+ &lt;p&gt;
+ &lt;label for=x&gt;Number&lt;/label&gt;:
+ &lt;input id="x" name="x" type="number"&gt;
+ &lt;/p&gt;
+ <strong>&lt;input id="submit" type=submit value="Calculate Square"&gt;</strong>
+ &lt;script&gt;
+ var x = document.getElementById('x');
+ var output = document.createElement('p');
+ output.textContent = 'Type a number; it will be squared right then!';
+ x.form.appendChild(output);
+ x.form.onsubmit = function () { return false; }
+ x.oninput = function () {
+ var v = x.valueAsNumber;
+ output.textContent = v + ' squared is ' + v * v;
+ };
+<strong> var submit = document.getElementById('submit');
+ submit.parentNode.removeChild(submit);</strong>
+ &lt;/script&gt;
+&lt;/form&gt;</pre>
+
+ <p>The above technique is also useful in XHTML, since
+ <code><a href=#the-noscript-element>noscript</a></code> is not supported in <a href=#the-xhtml-syntax>the XHTML
+ syntax</a>.</p>
+
+ </div>
+
+
+
+ <h3 id=sections><span class=secno>4.4 </span>Sections</h3>
+
+ <h4 id=the-body-element-0><span class=secno>4.4.1 </span>The <dfn><code>body</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As the second element in an <code><a href=#the-html-element-0>html</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code></dd>
+ <dd><code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code></dd>
+ <dd><code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code></dd>
+ <dd><code title=handler-window-onblur><a href=#handler-window-onblur>onblur</a></code></dd>
+ <dd><code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code></dd>
+ <dd><code title=handler-window-onfocus><a href=#handler-window-onfocus>onfocus</a></code></dd>
+ <dd><code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code></dd>
+ <dd><code title=handler-window-onload><a href=#handler-window-onload>onload</a></code></dd>
+ <dd><code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code></dd>
+ <dd><code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code></dd>
+ <dd><code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code></dd>
+ <dd><code title=handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code></dd>
+ <dd><code title=handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code></dd>
+ <dd><code title=handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code></dd>
+ <dd><code title=handler-window-onredo><a href=#handler-window-onredo>onredo</a></code></dd>
+ <dd><code title=handler-window-onresize><a href=#handler-window-onresize>onresize</a></code></dd>
+ <dd><code title=handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code></dd>
+ <dd><code title=handler-window-onundo><a href=#handler-window-onundo>onundo</a></code></dd>
+ <dd><code title=handler-window-onunload><a href=#handler-window-onunload>onunload</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlbodyelement>HTMLBodyElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute <a href=#function>Function</a> <a href=#handler-window-onafterprint title=handler-window-onafterprint>onafterprint</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeprint title=handler-window-onbeforeprint>onbeforeprint</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onblur title=handler-window-onblur>onblur</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onerror title=handler-window-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onfocus title=handler-window-onfocus>onfocus</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onload title=handler-window-onload>onload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-ononline title=handler-window-ononline>ononline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpopstate title=handler-window-onpopstate>onpopstate</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpagehide title=handler-window-onpagehide>onpagehide</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpageshow title=handler-window-onpageshow>onpageshow</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onredo title=handler-window-onredo>onredo</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onresize title=handler-window-onresize>onresize</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onstorage title=handler-window-onstorage>onstorage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onundo title=handler-window-onundo>onundo</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onunload title=handler-window-onunload>onunload</a>;
+};</pre>
+</dd>
+ </dl><p>The <code><a href=#the-body-element-0>body</a></code> element <a href=#represents>represents</a> the main
+ content of the document.</p>
+
+ <p>In conforming documents, there is only one <code><a href=#the-body-element-0>body</a></code>
+ element. The <code title=dom-document-body><a href=#dom-document-body>document.body</a></code>
+ IDL attribute provides scripts with easy access to a document's
+ <code><a href=#the-body-element-0>body</a></code> element.</p>
+
+ <div class=impl>
+
+ <p class=note>Some DOM operations (for example, parts of the
+ <a href=#dnd>drag and drop</a> model) are defined in terms of "<a href=#the-body-element>the
+ body element</a>". This refers to a particular element in the
+ DOM, as per the definition of the term, and not any arbitrary
+ <code><a href=#the-body-element-0>body</a></code> element.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-body-element-0>body</a></code> element exposes as <a href=#event-handler-content-attributes>event handler
+ content attributes</a> a number of the <a href=#event-handlers>event
+ handlers</a> of the <code><a href=#window>Window</a></code> object. It also mirrors
+ their <a href=#event-handler-idl-attributes>event handler IDL attributes</a>.</p>
+
+ <p>The <code title=handler-window-onblur><a href=#handler-window-onblur>onblur</a></code>, <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code>, <code title=handler-window-onfocus><a href=#handler-window-onfocus>onfocus</a></code>, and <code title=handler-window-onload><a href=#handler-window-onload>onload</a></code> <a href=#event-handlers>event
+ handlers</a> of the <code><a href=#window>Window</a></code> object, exposed on the
+ <code><a href=#the-body-element-0>body</a></code> element, shadow the generic <a href=#event-handlers>event
+ handlers</a> with the same names normally supported by <a href=#html-elements>HTML
+ elements</a>.</p>
+
+ <p class=example>Thus, for example, a bubbling <code title=event-error>error</code> event fired on a child of <a href=#the-body-element>the
+ body element</a> of a <code><a href=#document>Document</a></code> would first trigger
+ the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> <a href=#event-handler-content-attributes>event handler
+ content attributes</a> of that element, then that of the root
+ <code><a href=#the-html-element-0>html</a></code> element, and only <em>then</em> would it trigger
+ the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> <a href=#event-handler-content-attributes title="event handler content attributes">event handler content
+ attribute</a> on the <code><a href=#the-body-element-0>body</a></code> element. This is because
+ the event would bubble from the target, to the <code><a href=#the-body-element-0>body</a></code>, to
+ the <code><a href=#the-html-element-0>html</a></code>, to the <code><a href=#document>Document</a></code>, to the
+ <code><a href=#window>Window</a></code>, and the <a href=#event-handlers title="event handlers">event
+ handler</a> on the <code><a href=#the-body-element-0>body</a></code> is watching the
+ <code><a href=#window>Window</a></code> not the <code><a href=#the-body-element-0>body</a></code>. A regular event
+ listener attached to the <code><a href=#the-body-element-0>body</a></code> using <code title="">addEventListener()</code>, however, would fire when the
+ event bubbled through the <code><a href=#the-body-element-0>body</a></code> and not when it reaches
+ the <code><a href=#window>Window</a></code> object.</p>
+
+ <div class=example>
+
+ <p>This page updates an indicator to show whether or not the user
+ is online:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Online or offline?&lt;/title&gt;
+ &lt;script&gt;
+ function update(online) {
+ document.getElementById('status').textContent =
+ online ? 'Online' : 'Offline';
+ }
+ &lt;/script&gt;
+ &lt;/head&gt;
+ &lt;body ononline="update(true)"
+ onoffline="update(false)"
+ onload="update(navigator.onLine)"&gt;
+ &lt;p&gt;You are: &lt;span id="status"&gt;(Unknown)&lt;/span&gt;&lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-section-element><span class=secno>4.4.2 </span>The <dfn><code>section</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-section-element>section</a></code> element <a href=#represents>represents</a> a
+ generic section of a document or application. A section, in this
+ context, is a thematic grouping of content, typically with a
+ heading.</p>
+
+ <p class=example>Examples of sections would be chapters, the
+ various tabbed pages in a tabbed dialog box, or the numbered
+ sections of a thesis. A Web site's home page could be split into
+ sections for an introduction, news items, contact information.</p>
+
+ <p class=note>Authors are encouraged to use the
+ <code><a href=#the-article-element>article</a></code> element instead of the <code><a href=#the-section-element>section</a></code>
+ element when it would make sense to syndicate the contents of the
+ element.</p>
+
+ <p class=note id=use-div-for-wrappers>The <code><a href=#the-section-element>section</a></code>
+ element is not a generic container element. When an element is
+ needed for styling purposes or as a convenience for scripting,
+ authors are encouraged to use the <code><a href=#the-div-element>div</a></code> element
+ instead. A general rule is that the <code><a href=#the-section-element>section</a></code> element is
+ appropriate only if the element's contents would be listed
+ explicitly in the document's <a href=#outline>outline</a>.</p>
+
+ <div class=example>
+
+ <p>In the following example, we see an article (part of a larger
+ Web page) about apples, containing two short sections.</p>
+
+ <pre>&lt;article&gt;
+ &lt;hgroup&gt;
+ &lt;h1&gt;Apples&lt;/h1&gt;
+ &lt;h2&gt;Tasty, delicious fruit!&lt;/h2&gt;
+ &lt;/hgroup&gt;
+ &lt;p&gt;The apple is the pomaceous fruit of the apple tree.&lt;/p&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Red Delicious&lt;/h1&gt;
+ &lt;p&gt;These bright red apples are the most common found in many
+ supermarkets.&lt;/p&gt;
+ &lt;/section&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Granny Smith&lt;/h1&gt;
+ &lt;p&gt;These juicy, green apples make a great filling for
+ apple pies.&lt;/p&gt;
+ &lt;/section&gt;
+&lt;/article&gt;</pre>
+
+ <p>Notice how the use of <code><a href=#the-section-element>section</a></code> means that the author
+ can use <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements throughout, without having to
+ worry about whether a particular section is at the top level, the
+ second level, the third level, and so on.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is a graduation programme with two sections, one for the
+ list of people graduating, and one for the description of the
+ ceremony.</p>
+
+ <pre>&lt;!DOCTYPE Html&gt;
+&lt;Html
+ &gt;&lt;Head
+ &gt;&lt;Title
+ &gt;Graduation Ceremony Summer 2022&lt;/Title
+ &gt;&lt;/Head
+ &gt;&lt;Body
+ &gt;&lt;H1
+ &gt;Graduation&lt;/H1
+ &gt;&lt;Section
+ &gt;&lt;H1
+ &gt;Ceremony&lt;/H1
+ &gt;&lt;P
+ &gt;Opening Procession&lt;/P
+ &gt;&lt;P
+ &gt;Speech by Validactorian&lt;/P
+ &gt;&lt;P
+ &gt;Speech by Class President&lt;/P
+ &gt;&lt;P
+ &gt;Presentation of Diplomas&lt;/P
+ &gt;&lt;P
+ &gt;Closing Speech by Headmaster&lt;/P
+ &gt;&lt;/Section
+ &gt;&lt;Section
+ &gt;&lt;H1
+ &gt;Graduates&lt;/H1
+ &gt;&lt;Ul
+ &gt;&lt;Li
+ &gt;Molly Carpenter&lt;/Li
+ &gt;&lt;Li
+ &gt;Anastasia Luccio&lt;/Li
+ &gt;&lt;Li
+ &gt;Ebenezar McCoy&lt;/Li
+ &gt;&lt;Li
+ &gt;Karrin Murphy&lt;/Li
+ &gt;&lt;Li
+ &gt;Thomas Raith&lt;/Li
+ &gt;&lt;Li
+ &gt;Susan Rodriguez&lt;/Li
+ &gt;&lt;/Ul
+ &gt;&lt;/Section
+ &gt;&lt;/Body
+&gt;&lt;/Html&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-nav-element><span class=secno>4.4.3 </span>The <dfn><code>nav</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-nav-element>nav</a></code> element <a href=#represents>represents</a> a section of
+ a page that links to other pages or to parts within the page: a
+ section with navigation links.</p>
+
+ <p>Not all groups of links on a page need to be in a
+ <code><a href=#the-nav-element>nav</a></code> element &mdash; only sections that consist of major
+ navigation blocks are appropriate for the <code><a href=#the-nav-element>nav</a></code>
+ element. In particular, it is common for footers to have a short
+ list of links to various pages of a site, such as the terms of
+ service, the home page, and a copyright page. The
+ <code><a href=#the-footer-element>footer</a></code> element alone is sufficient for such cases,
+ without a <code><a href=#the-nav-element>nav</a></code> element.</p>
+
+ <p class=note>User agents (such as screen readers) that are
+ targeted at users who can benefit from navigation information being
+ omitted in the initial rendering, or who can benefit from navigation
+ information being immediately available, can use this element as a
+ way to determine what content on the page to initially skip and/or
+ provide on request.</p>
+
+ <div class=example>
+
+ <p>In the following example, the page has several places where
+ links are present, but only one of those places is considered a
+ navigation section.</p>
+
+ <pre>&lt;body&gt;
+ &lt;header&gt;
+ &lt;h1&gt;Wake up sheeple!&lt;/h1&gt;
+ &lt;p&gt;&lt;a href="news.html"&gt;News&lt;/a&gt; -
+ &lt;a href="blog.html"&gt;Blog&lt;/a&gt; -
+ &lt;a href="forums.html"&gt;Forums&lt;/a&gt;&lt;/p&gt;
+ &lt;p&gt;Last Modified: &lt;time&gt;2009-04-01&lt;/time&gt;&lt;/p&gt;
+ &lt;nav&gt;
+ &lt;h1&gt;Navigation&lt;/h1&gt;
+ &lt;ul&gt;
+ &lt;li&gt;&lt;a href="articles.html"&gt;Index of all articles&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="today.html"&gt;Things sheeple need to wake up for today&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="successes.html"&gt;Sheeple we have managed to wake&lt;/a&gt;&lt;/li&gt;
+ &lt;/ul&gt;
+ &lt;/nav&gt;
+ &lt;/header&gt;
+ &lt;div&gt;
+ &lt;article&gt;
+ &lt;header&gt;
+ &lt;h1&gt;My Day at the Beach&lt;/h1&gt;
+ &lt;/header&gt;
+ &lt;div&gt;
+ &lt;p&gt;Today I went to the beach and had a lot of fun.&lt;/p&gt;
+ <em>...more content...</em>
+ &lt;/div&gt;
+ &lt;footer&gt;
+ &lt;p&gt;Posted &lt;time pubdate datetime="2009-10-10T14:36-08:00"&gt;Thursday&lt;/time&gt;.&lt;/p&gt;
+ &lt;/footer&gt;
+ &lt;/article&gt;
+ <em>...more blog posts...</em>
+ &lt;/div&gt;
+ &lt;footer&gt;
+ &lt;p&gt;Copyright &copy; 2006 The Example Company&lt;/p&gt;
+ &lt;p&gt;&lt;a href="about.html"&gt;About&lt;/a&gt; -
+ &lt;a href="policy.html"&gt;Privacy Policy&lt;/a&gt; -
+ &lt;a href="contact.html"&gt;Contact Us&lt;/a&gt;&lt;/p&gt;
+ &lt;/footer&gt;
+&lt;/body&gt;</pre>
+
+ <p>Notice the <code><a href=#the-div-element>div</a></code> elements being used to wrap all the
+ contents of the page other than the header and footer, and all the
+ contents of the blog entry other than its header and footer.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, there are two <code><a href=#the-nav-element>nav</a></code>
+ elements, one for primary navigation around the site, and one for
+ secondary navigation around the page itself.</p>
+
+ <pre>&lt;body&gt;
+ &lt;h1&gt;The Wiki Center Of Exampland&lt;/h1&gt;
+ &lt;nav&gt;
+ &lt;ul&gt;
+ &lt;li&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="/events"&gt;Current Events&lt;/a&gt;&lt;/li&gt;
+ <em>...more...</em>
+ &lt;/ul&gt;
+ &lt;/nav&gt;
+ &lt;article&gt;
+ &lt;header&gt;
+ &lt;h1&gt;Demos in Exampland&lt;/h1&gt;
+ &lt;p&gt;Written by A. N. Other.&lt;/p&gt;
+ &lt;/header&gt;
+ &lt;nav&gt;
+ &lt;ul&gt;
+ &lt;li&gt;&lt;a href="#public"&gt;Public demonstrations&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="#destroy"&gt;Demolitions&lt;/a&gt;&lt;/li&gt;
+ <em>...more...</em>
+ &lt;/ul&gt;
+ &lt;/nav&gt;
+ &lt;div&gt;
+ &lt;section id="public"&gt;
+ &lt;h1&gt;Public demonstrations&lt;/h1&gt;
+ &lt;p&gt;<em>...more...</em>&lt;/p&gt;
+ &lt;/section&gt;
+ &lt;section id="destroy"&gt;
+ &lt;h1&gt;Demolitions&lt;/h1&gt;
+ &lt;p&gt;<em>...more...</em>&lt;/p&gt;
+ &lt;/section&gt;
+ <em>...more...</em>
+ &lt;/div&gt;
+ &lt;footer&gt;
+ &lt;p&gt;&lt;a href="?edit"&gt;Edit&lt;/a&gt; | &lt;a href="?delete"&gt;Delete&lt;/a&gt; | &lt;a href="?Rename"&gt;Rename&lt;/a&gt;&lt;/p&gt;
+ &lt;/footer&gt;
+ &lt;/article&gt;
+ &lt;footer&gt;
+ &lt;p&gt;&lt;small&gt;&copy; copyright 1998 Exampland Emperor&lt;/small&gt;&lt;/p&gt;
+ &lt;/footer&gt;
+&lt;/body&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-article-element><span class=secno>4.4.4 </span>The <dfn><code>article</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-article-element>article</a></code> element <a href=#represents>represents</a> a
+ self-contained composition in a document, page, application, or site
+ and that is intended to be independently distributable or reusable,
+ e.g. in syndication. This could be a forum post, a magazine or
+ newspaper article, a blog entry, a user-submitted comment, an
+ interactive widget or gadget, or any other independent item of
+ content.</p>
+
+ <p>When <code><a href=#the-article-element>article</a></code> elements are nested, the inner
+ <code><a href=#the-article-element>article</a></code> elements represent articles that are in
+ principle related to the contents of the outer article. For
+ instance, a blog entry on a site that accepts user-submitted
+ comments could represent the comments as <code><a href=#the-article-element>article</a></code>
+ elements nested within the <code><a href=#the-article-element>article</a></code> element for the blog
+ entry.</p>
+
+ <p>Author information associated with an <code><a href=#the-article-element>article</a></code>
+ element (q.v. the <code><a href=#the-address-element>address</a></code> element) does not apply to
+ nested <code><a href=#the-article-element>article</a></code> elements.</p>
+
+ <p class=note>When used specifically with content to be
+ redistributed in syndication, the <code><a href=#the-article-element>article</a></code> element is
+ similar in purpose to the <code title="">entry</code> element in
+ Atom. <a href=#refsATOM>[ATOM]</a>
+
+ <p class=note>The <code><a href=#the-time-element>time</a></code> element's <code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code> attribute can be used to
+ provide the publication date for an <code><a href=#the-article-element>article</a></code>
+ element.</p>
+
+ <div class=example id=article-example>
+
+ <p>This example shows a blog post using the <code><a href=#the-article-element>article</a></code>
+ element:</p>
+
+ <pre>&lt;article&gt;
+ &lt;header&gt;
+ &lt;h1&gt;The Very First Rule of Life&lt;/h1&gt;
+ &lt;p&gt;&lt;time pubdate datetime="2009-10-09T14:28-08:00"&gt;&lt;/time&gt;&lt;/p&gt;
+ &lt;/header&gt;
+ &lt;p&gt;If there's a microphone anywhere near you, assume it's hot and
+ sending whatever you're saying to the world. Seriously.&lt;/p&gt;
+ &lt;p&gt;<em>...</em>&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;a href="?comments=1"&gt;Show comments...&lt;/a&gt;
+ &lt;/footer&gt;
+&lt;/article&gt;</pre>
+
+ <p>Here is that same blog post, but showing some of the comments:</p>
+
+ <pre>&lt;article&gt;
+ &lt;header&gt;
+ &lt;h1&gt;The Very First Rule of Life&lt;/h1&gt;
+ &lt;p&gt;&lt;time pubdate datetime="2009-10-09T14:28-08:00"&gt;&lt;/time&gt;&lt;/p&gt;
+ &lt;/header&gt;
+ &lt;p&gt;If there's a microphone anywhere near you, assume it's hot and
+ sending whatever you're saying to the world. Seriously.&lt;/p&gt;
+ &lt;p&gt;<em>...</em>&lt;/p&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Comments&lt;/h1&gt;
+ &lt;article&gt;
+ &lt;footer&gt;
+ &lt;p&gt;Posted by: George Washington&lt;/p&gt;
+ &lt;p&gt;&lt;time pubdate datetime="2009-10-10T19:10-08:00"&gt;&lt;/time&gt;&lt;/p&gt;
+ &lt;/footer&gt;
+ &lt;p&gt;Yeah! Especially when talking about your lobbyist friends!&lt;/p&gt;
+ &lt;/article&gt;
+ &lt;article&gt;
+ &lt;footer&gt;
+ &lt;p&gt;Posted by: George Hammond&lt;/p&gt;
+ &lt;p&gt;&lt;time pubdate datetime="2009-10-10T19:15-08:00"&gt;&lt;/time&gt;&lt;/p&gt;
+ &lt;/footer&gt;
+ &lt;p&gt;Hey, you have the same first name as me.&lt;/p&gt;
+ &lt;/article&gt;
+ &lt;/section&gt;
+&lt;/article&gt;</pre>
+
+ <p>Notice the use of <code><a href=#the-footer-element>footer</a></code> to give the information
+ each comment (such as who wrote it and when): the
+ <code><a href=#the-footer-element>footer</a></code> element <em>can</em> appear at the start of its
+ section when appropriate, such as in this case. (Using
+ <code><a href=#the-header-element>header</a></code> in this case wouldn't be wrong either; it's
+ mostly a matter of authoring preference.)</p>
+
+ </div>
+
+
+
+
+ <h4 id=the-aside-element><span class=secno>4.4.5 </span>The <dfn><code>aside</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-aside-element>aside</a></code> element <a href=#represents>represents</a> a section
+ of a page that consists of content that is tangentially related to
+ the content around the <code><a href=#the-aside-element>aside</a></code> element, and which could
+ be considered separate from that content. Such sections are often
+ represented as sidebars in printed typography.</p>
+
+ <p>The element can be used for typographical effects like pull
+ quotes or sidebars, for advertising, for groups of <code><a href=#the-nav-element>nav</a></code>
+ elements, and for other content that is considered separate from the
+ main content of the page.</p>
+
+ <p class=note>It's not appropriate to use the <code><a href=#the-aside-element>aside</a></code>
+ element just for parentheticals, since those are part of the main
+ flow of the document.</p>
+
+ <div class=example>
+
+ <p>The following example shows how an aside is used to mark up
+ background material on Switzerland in a much longer news story on
+ Europe.</p>
+
+ <pre>&lt;aside&gt;
+ &lt;h1&gt;Switzerland&lt;/h1&gt;
+ &lt;p&gt;Switzerland, a land-locked country in the middle of geographic
+ Europe, has not joined the geopolitical European Union, though it is
+ a signatory to a number of European treaties.&lt;/p&gt;
+&lt;/aside&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how an aside is used to mark up
+ a pull quote in a longer article.</p>
+
+ <pre>...
+
+&lt;p&gt;He later joined a large company, continuing on the same work.
+&lt;q&gt;I love my job. People ask me what I do for fun when I'm not at
+work. But I'm paid to do my hobby, so I never know what to
+answer. Some people wonder what they would do if they didn't have to
+work... but I know what I would do, because I was unemployed for a
+year, and I filled that time doing exactly what I do now.&lt;/q&gt;&lt;/p&gt;
+
+&lt;aside&gt;
+ &lt;q&gt; People ask me what I do for fun when I'm not at work. But I'm
+ paid to do my hobby, so I never know what to answer. &lt;/q&gt;
+&lt;/aside&gt;
+
+&lt;p&gt;Of course his work &mdash; or should that be hobby? &mdash;
+isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;
+
+...</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following extract shows how <code><a href=#the-aside-element>aside</a></code> can be used
+ for blogrolls and other side content on a blog:</p>
+
+ <pre>&lt;body&gt;
+ &lt;header&gt;
+ &lt;h1&gt;My wonderful blog&lt;/h1&gt;
+ &lt;p&gt;My tagline&lt;/p&gt;
+ &lt;/header&gt;
+ &lt;aside&gt;
+ &lt;!-- <em>this aside contains two sections that are tangentially related
+ to the page, namely, links to other blogs, and links to blog posts
+ from this blog</em> --&gt;
+ &lt;nav&gt;
+ &lt;h1&gt;My blogroll&lt;/h1&gt;
+ &lt;ul&gt;
+ &lt;li&gt;&lt;a href="http://blog.example.com/"&gt;Example Blog&lt;/a&gt;
+ &lt;/ul&gt;
+ &lt;/nav&gt;
+ &lt;nav&gt;
+ &lt;h1&gt;Archives&lt;/h1&gt;
+ &lt;ol reversed&gt;
+ &lt;li&gt;&lt;a href="/last-post"&gt;My last post&lt;/a&gt;
+ &lt;li&gt;&lt;a href="/first-post"&gt;My first post&lt;/a&gt;
+ &lt;/ol&gt;
+ &lt;/nav&gt;
+ &lt;/aside&gt;
+ &lt;aside&gt;
+ &lt;!-- <em>this aside is tangentially related to the page also, it
+ contains twitter messages from the blog author</em> --&gt;
+ &lt;h1&gt;Twitter Feed&lt;/h1&gt;
+ &lt;blockquote cite="http://twitter.example.net/t31351234"&gt;
+ I'm on vacation, writing my blog.
+ &lt;/blockquote&gt;
+ &lt;blockquote cite="http://twitter.example.net/t31219752"&gt;
+ I'm going to go on vacation soon.
+ &lt;/blockquote&gt;
+ &lt;/aside&gt;
+ &lt;article&gt;
+ &lt;!-- <em>this is a blog post</em> --&gt;
+ &lt;h1&gt;My last post&lt;/h1&gt;
+ &lt;p&gt;This is my last post.&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;p&gt;&lt;a href="/last-post" rel=bookmark&gt;Permalink&lt;/a&gt;
+ &lt;/footer&gt;
+ &lt;/article&gt;
+ &lt;article&gt;
+ &lt;!-- <em>this is also a blog post</em> --&gt;
+ &lt;h1&gt;My first post&lt;/h1&gt;
+ &lt;p&gt;This is my first post.&lt;/p&gt;
+ &lt;aside&gt;
+ &lt;!-- <em>this aside is about the blog post, since it's inside the
+ &lt;article&gt; element; it would be wrong, for instance, to put the
+ blogroll here, since the blogroll isn't really related to this post
+ specifically, only to the page as a whole</em> --&gt;
+ &lt;h1&gt;Posting&lt;/h1&gt;
+ &lt;p&gt;While I'm thinking about it, I wanted to say something about
+ posting. Posting is fun!&lt;/p&gt;
+ &lt;/aside&gt;
+ &lt;footer&gt;
+ &lt;p&gt;&lt;a href="/first-post" rel=bookmark&gt;Permalink&lt;/a&gt;
+ &lt;/footer&gt;
+ &lt;/article&gt;
+ &lt;footer&gt;
+ &lt;nav&gt;
+ &lt;a href="/archives"&gt;Archives&lt;/a&gt; &mdash;
+ &lt;a href="/about"&gt;About me&lt;/a&gt; &mdash;
+ &lt;a href="/copyright"&gt;Copyright&lt;/a&gt;
+ &lt;/nav&gt;
+ &lt;/footer&gt;
+&lt;/body&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><span class=secno>4.4.6 </span>The <dfn><code>h1</code></dfn>, <dfn><code>h2</code></dfn>,
+ <dfn><code>h3</code></dfn>, <dfn><code>h4</code></dfn>,
+ <dfn><code>h5</code></dfn>, and <dfn><code>h6</code></dfn>
+ elements</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#heading-content>Heading content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of an <code><a href=#the-hgroup-element>hgroup</a></code> element.</dd>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlheadingelement>HTMLHeadingElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>These elements <a href=#represents title=represents>represent</a> headings
+ for their sections.</p>
+
+ <p>The semantics and meaning of these elements are defined in the
+ section on <a href=#headings-and-sections>headings and sections</a>.</p>
+
+ <p>These elements have a <dfn id=rank>rank</dfn> given by the number in
+ their name. The <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element is said to have the highest
+ rank, the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element has the lowest rank, and two
+ elements with the same name have equal rank.</p>
+
+ <div class=example>
+
+ <p>These two snippets are equivalent:</p>
+
+ <pre>&lt;body&gt;
+&lt;h1&gt;Let's call it a draw(ing surface)&lt;/h1&gt;
+&lt;h2&gt;Diving in&lt;/h2&gt;
+&lt;h2&gt;Simple shapes&lt;/h2&gt;
+&lt;h2&gt;Canvas coordinates&lt;/h2&gt;
+&lt;h3&gt;Canvas coordinates diagram&lt;/h3&gt;
+&lt;h2&gt;Paths&lt;/h2&gt;
+&lt;/body&gt;</pre>
+
+ <pre>&lt;body&gt;
+ &lt;h1&gt;Let's call it a draw(ing surface)&lt;/h1&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Diving in&lt;/h1&gt;
+ &lt;/section&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Simple shapes&lt;/h1&gt;
+ &lt;/section&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Canvas coordinates&lt;/h1&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Canvas coordinates diagram&lt;/h1&gt;
+ &lt;/section&gt;
+ &lt;/section&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Paths&lt;/h1&gt;
+ &lt;/section&gt;
+&lt;/body&gt;</pre>
+
+ </div>
+
+
+
+
+ <h4 id=the-hgroup-element><span class=secno>4.4.7 </span>The <dfn><code>hgroup</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#heading-content>Heading content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>One or more <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, and/or <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-hgroup-element>hgroup</a></code> element <a href=#represents>represents</a> the
+ heading of a section. The element is used to group a set of
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements when the heading has
+ multiple levels, such as subheadings, alternative titles, or
+ taglines.</p>
+
+ <p>For the purposes of document summaries, outlines, and the like,
+ the text of <code><a href=#the-hgroup-element>hgroup</a></code> elements is defined to be the text
+ of the highest <a href=#rank title=rank>ranked</a>
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element descendant of the
+ <code><a href=#the-hgroup-element>hgroup</a></code> element, if there are any such elements, and the
+ first such element if there are multiple elements with that
+ <a href=#rank>rank</a>. If there are no such elements, then the text of
+ the <code><a href=#the-hgroup-element>hgroup</a></code> element is the empty string.</p>
+
+ <p>Other elements of <a href=#heading-content>heading content</a> in the
+ <code><a href=#the-hgroup-element>hgroup</a></code> element indicate subheadings or subtitles.</p>
+
+ <p>The <a href=#rank>rank</a> of an <code><a href=#the-hgroup-element>hgroup</a></code> element is the
+ rank of the highest-ranked <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>
+ element descendant of the <code><a href=#the-hgroup-element>hgroup</a></code> element, if there are
+ any such elements, or otherwise the same as for an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
+ element (the highest rank).</p>
+
+ <p>The section on <a href=#headings-and-sections>headings and sections</a>
+ defines how <code><a href=#the-hgroup-element>hgroup</a></code> elements are assigned to individual
+ sections.</p>
+
+ <div class=example>
+
+ <p>Here are some examples of valid headings. In each case, the
+ emphasized text represents the text that would be used as the
+ heading in an application extracting heading data and ignoring
+ subheadings.</p>
+
+ <pre>&lt;hgroup&gt;
+ &lt;h1&gt;<strong>The reality dysfunction</strong>&lt;/h1&gt;
+ &lt;h2&gt;Space is not the only void&lt;/h2&gt;
+&lt;/hgroup&gt;</pre>
+
+ <pre>&lt;hgroup&gt;
+ &lt;h1&gt;<strong>Dr. Strangelove</strong>&lt;/h1&gt;
+ &lt;h2&gt;Or: How I Learned to Stop Worrying and Love the Bomb&lt;/h2&gt;
+&lt;/hgroup&gt;</pre>
+
+ <p>The point of using <code><a href=#the-hgroup-element>hgroup</a></code> in these examples is to
+ mask the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element (which acts as a secondary title)
+ from the <a href=#outline>outline</a> algorithm.</p><!--
+ http://www.brucelawson.co.uk/2009/html-5-is-a-mess/#comment-618895
+ -->
+
+ </div>
+
+
+ <h4 id=the-header-element><span class=secno>4.4.8 </span>The <dfn><code>header</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-header-element>header</a></code> or
+ <code><a href=#the-footer-element>footer</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-header-element>header</a></code> element <a href=#represents>represents</a> a group
+ of introductory or navigational aids.</p>
+
+ <p class=note>A <code><a href=#the-header-element>header</a></code> element is intended to usually
+ contain the section's heading (an
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element or an
+ <code><a href=#the-hgroup-element>hgroup</a></code> element), but this is not required. The
+ <code><a href=#the-header-element>header</a></code> element can also be used to wrap a section's
+ table of contents, a search form, or any relevant logos.</p>
+
+ <div class=example>
+
+ <p>Here are some sample headers. This first one is for a game:</p>
+
+ <pre>&lt;header&gt;
+ &lt;p&gt;Welcome to...&lt;/p&gt;
+ &lt;h1&gt;Voidwars!&lt;/h1&gt;
+&lt;/header&gt;</pre>
+
+ <p>The following snippet shows how the element can be used to mark
+ up a specification's header:</p>
+
+ <pre>&lt;header&gt;
+ &lt;hgroup&gt;
+ &lt;h1&gt;Scalable Vector Graphics (SVG) 1.2&lt;/h1&gt;
+ &lt;h2&gt;W3C Working Draft 27 October 2004&lt;/h2&gt;
+ &lt;/hgroup&gt;
+ &lt;dl&gt;
+ &lt;dt&gt;This version:&lt;/dt&gt;
+ &lt;dd&gt;&lt;a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/"&gt;http://www.w3.org/TR/2004/WD-SVG12-20041027/&lt;/a&gt;&lt;/dd&gt;
+ &lt;dt&gt;Previous version:&lt;/dt&gt;
+ &lt;dd&gt;&lt;a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/"&gt;http://www.w3.org/TR/2004/WD-SVG12-20040510/&lt;/a&gt;&lt;/dd&gt;
+ &lt;dt&gt;Latest version of SVG 1.2:&lt;/dt&gt;
+ &lt;dd&gt;&lt;a href="http://www.w3.org/TR/SVG12/"&gt;http://www.w3.org/TR/SVG12/&lt;/a&gt;&lt;/dd&gt;
+ &lt;dt&gt;Latest SVG Recommendation:&lt;/dt&gt;
+ &lt;dd&gt;&lt;a href="http://www.w3.org/TR/SVG/"&gt;http://www.w3.org/TR/SVG/&lt;/a&gt;&lt;/dd&gt;
+ &lt;dt&gt;Editor:&lt;/dt&gt;
+ &lt;dd&gt;Dean Jackson, W3C, &lt;a href="mailto:dean@w3.org"&gt;dean@w3.org&lt;/a&gt;&lt;/dd&gt;
+ &lt;dt&gt;Authors:&lt;/dt&gt;
+ &lt;dd&gt;See &lt;a href="#authors"&gt;Author List&lt;/a&gt;&lt;/dd&gt;
+ &lt;/dl&gt;
+ &lt;p class="copyright"&gt;&lt;a href="http://www.w3.org/Consortium/Legal/ipr-notic <em>...</em>
+&lt;/header&gt;</pre>
+
+ </div>
+
+ <p class=note>The <code><a href=#the-header-element>header</a></code> element is not
+ <a href=#sectioning-content>sectioning content</a>; it doesn't introduce a new
+ section.</p>
+
+ <div class=example>
+
+ <p>In this example, the page has a page heading given by the
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element, and two subsections whose headings are
+ given by <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> elements. The content after the
+ <code><a href=#the-header-element>header</a></code> element is still part of the last subsection
+ started in the <code><a href=#the-header-element>header</a></code> element, because the
+ <code><a href=#the-header-element>header</a></code> element doesn't take part in the
+ <a href=#outline>outline</a> algorithm.</p>
+
+ <pre>&lt;body&gt;
+ &lt;header&gt;
+ &lt;h1&gt;Little Green Guys With Guns&lt;/h1&gt;
+ &lt;nav&gt;
+ &lt;ul&gt;
+ &lt;li&gt;&lt;a href="/games"&gt;Games&lt;/a&gt;
+ &lt;li&gt;&lt;a href="/forum"&gt;Forum&lt;/a&gt;
+ &lt;li&gt;&lt;a href="/download"&gt;Download&lt;/a&gt;
+ &lt;/ul&gt;
+ &lt;/nav&gt;
+ &lt;h2&gt;Important News&lt;/h2&gt; &lt;!-- this starts a second subsection --&gt;
+ &lt;!-- this is part of the subsection entitled "Important News" --&gt;
+ &lt;p&gt;To play today's games you will need to update your client.&lt;/p&gt;
+ &lt;h2&gt;Games&lt;/h2&gt; &lt;!-- this starts a third subsection --&gt;
+ &lt;/header&gt;
+ &lt;p&gt;You have three active games:&lt;/p&gt;
+ &lt;!-- this is still part of the subsection entitled "Games" --&gt;
+ ...</pre>
+
+ </div>
+
+
+
+
+ <h4 id=the-footer-element><span class=secno>4.4.9 </span>The <dfn><code>footer</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-header-element>header</a></code> or
+ <code><a href=#the-footer-element>footer</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-footer-element>footer</a></code> element <a href=#represents>represents</a> a footer
+ for its nearest ancestor <a href=#sectioning-content>sectioning content</a> or
+ <a href=#sectioning-root>sectioning root</a> element. A footer typically contains
+ information about its section such as who wrote it, links to related
+ documents, copyright data, and the like.</p>
+
+ <p class=note>Contact information for the author or editor of a
+ section belongs in an <code><a href=#the-address-element>address</a></code> element, possibly itself
+ inside a <code><a href=#the-footer-element>footer</a></code>.</p>
+
+ <p>Footers don't necessarily have to appear at the <em>end</em> of a
+ section, though they usually do.</p>
+
+ <p>When the <code><a href=#the-footer-element>footer</a></code> element contains entire sections,
+ they <a href=#represents title=represents>represent</a> appendices, indexes,
+ long colophons, verbose license agreements, and other such
+ content.</p>
+
+ <p class=note>The <code><a href=#the-footer-element>footer</a></code> element is not
+ <a href=#sectioning-content>sectioning content</a>; it doesn't introduce a new
+ section.</p>
+
+ <p>When the nearest ancestor <a href=#sectioning-content>sectioning content</a> or
+ <a href=#sectioning-root>sectioning root</a> element is <a href=#the-body-element>the body
+ element</a>, then it applies to the whole page.</p>
+
+ <div class=example>
+
+ <p>Here is a page with two footers, one at the top and one at the
+ bottom, with the same content:</p>
+
+ <pre>&lt;body&gt;
+ &lt;footer&gt;&lt;a href="../"&gt;Back to index...&lt;/a&gt;&lt;/footer&gt;
+ &lt;hgroup&gt;
+ &lt;h1&gt;Lorem ipsum&lt;/h1&gt;
+ &lt;h2&gt;The ipsum of all lorems&lt;/h2&gt;
+ &lt;/hgroup&gt;
+ &lt;p&gt;A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in
+ voluptate velit esse cillum dolore eu fugiat nulla
+ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+ culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
+ &lt;footer&gt;&lt;a href="../"&gt;Back to index...&lt;/a&gt;&lt;/footer&gt;
+&lt;/body&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example which shows the <code><a href=#the-footer-element>footer</a></code> element
+ being used both for a site-wide footer and for a section
+ footer.</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;HTML&gt;&lt;HEAD&gt;
+&lt;TITLE&gt;The Ramblings of a Scientist&lt;/TITLE&gt;
+&lt;BODY&gt;
+&lt;H1&gt;The Ramblings of a Scientist&lt;/H1&gt;
+&lt;ARTICLE&gt;
+ &lt;H1&gt;Episode 15&lt;/H1&gt;
+ &lt;VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD&gt;
+ &lt;P&gt;&lt;A HREF="/fm/015.ogv"&gt;Download video&lt;/A&gt;.&lt;/P&gt;
+ &lt;/VIDEO&gt;
+ &lt;FOOTER&gt; &lt;!-- footer for article --&gt;
+ &lt;P&gt;Published &lt;TIME PUBDATE DATETIME="2009-10-21T18:26-07:00"&gt;&lt;/TIME&gt;&lt;/P&gt;
+ &lt;/FOOTER&gt;
+&lt;/ARTICLE&gt;
+&lt;ARTICLE&gt;
+ &lt;H1&gt;My Favorite Trains&lt;/H1&gt;
+ &lt;P&gt;I love my trains. My favorite train of all time is a K&ouml;f.&lt;/P&gt;
+ &lt;P&gt;It is fun to see them pull some coal cars because they look so
+ dwarfed in comparison.&lt;/P&gt;
+ &lt;FOOTER&gt; &lt;!-- footer for article --&gt;
+ &lt;P&gt;Published &lt;TIME PUBDATE DATETIME="2009-09-15T14:54-07:00"&gt;&lt;/TIME&gt;&lt;/P&gt;
+ &lt;/FOOTER&gt;
+&lt;/ARTICLE&gt;
+&lt;FOOTER&gt; &lt;!-- site wide footer --&gt;
+ &lt;NAV&gt;
+ &lt;P&gt;&lt;A HREF="/credits.html"&gt;Credits&lt;/A&gt; &mdash;
+ &lt;A HREF="/tos.html"&gt;Terms of Service&lt;/A&gt; &mdash;
+ &lt;A HREF="/index.html"&gt;Blog Index&lt;/A&gt;&lt;/P&gt;
+ &lt;/NAV&gt;
+ &lt;P&gt;Copyright &copy; 2009 Gordon Freeman&lt;/P&gt;
+&lt;/FOOTER&gt;
+&lt;/BODY&gt;
+&lt;/HTML&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-address-element><span class=secno>4.4.10 </span>The <dfn><code>address</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>, but with no <a href=#heading-content>heading
+ content</a> descendants, no <a href=#sectioning-content>sectioning content</a>
+ descendants, and no <code><a href=#the-header-element>header</a></code>, <code><a href=#the-footer-element>footer</a></code>, or
+ <code><a href=#the-address-element>address</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-address-element>address</a></code> element <a href=#represents>represents</a> the
+ contact information for its nearest <code><a href=#the-article-element>article</a></code> or
+ <code><a href=#the-body-element-0>body</a></code> element ancestor. If that is <a href=#the-body-element>the body
+ element</a>, then the contact information applies to the document
+ as a whole.</p>
+
+ <div class=example>
+ <p>For example, a page at the W3C Web site related to HTML might
+ include the following contact information:</p>
+ <pre>&lt;ADDRESS&gt;
+ &lt;A href="../People/Raggett/"&gt;Dave Raggett&lt;/A&gt;,
+ &lt;A href="../People/Arnaud/"&gt;Arnaud Le Hors&lt;/A&gt;,
+ contact persons for the &lt;A href="Activity"&gt;W3C HTML Activity&lt;/A&gt;
+&lt;/ADDRESS&gt;</pre>
+ </div>
+
+ <p>The <code><a href=#the-address-element>address</a></code> element must not be used to represent
+ arbitrary addresses (e.g. postal addresses), unless those addresses
+ are in fact the relevant contact information. (The <code><a href=#the-p-element>p</a></code>
+ element is the appropriate element for marking up postal addresses
+ in general.)</p>
+
+ <p>The <code><a href=#the-address-element>address</a></code> element must not contain information
+ other than contact information.</p>
+
+ <div class=example>
+ <p>For example, the following is non-conforming use of the
+ <code><a href=#the-address-element>address</a></code> element:</p>
+ <pre class=bad>&lt;ADDRESS&gt;Last Modified: 1999/12/24 23:37:50&lt;/ADDRESS&gt;</pre>
+ </div>
+
+ <p>Typically, the <code><a href=#the-address-element>address</a></code> element would be included
+ along with other information in a <code><a href=#the-footer-element>footer</a></code> element.</p>
+
+ <div class=impl>
+
+ <p>The contact information for a node <var title="">node</var> is a
+ collection of <code><a href=#the-address-element>address</a></code> elements defined by the first
+ applicable entry from the following list:</p>
+
+ <dl class=switch><dt>If <var title="">node</var> is an <code><a href=#the-article-element>article</a></code> element</dt>
+ <dt>If <var title="">node</var> is a <code><a href=#the-body-element-0>body</a></code> element</dt>
+
+ <dd>
+
+ <p>The contact information consists of all the
+ <code><a href=#the-address-element>address</a></code> elements that have <var title="">node</var>
+ as an ancestor and do not have another <code><a href=#the-body-element-0>body</a></code> or
+ <code><a href=#the-article-element>article</a></code> element ancestor that is a descendant of <var title="">node</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">node</var> has an ancestor element that is an <code><a href=#the-article-element>article</a></code> element</dt>
+ <dt>If <var title="">node</var> has an ancestor element that is a <code><a href=#the-body-element-0>body</a></code> element</dt>
+
+ <dd>
+
+ <p>The contact information of <var title="">node</var> is the same
+ as the contact information of the nearest <code><a href=#the-article-element>article</a></code> or
+ <code><a href=#the-body-element-0>body</a></code> element ancestor, whichever is nearest.</p>
+
+ </dd>
+
+ <dt>If <var title="">node</var>'s <code><a href=#document>Document</a></code> has <a href=#the-body-element title="the body element">a body element</a></dt>
+
+ <dd>
+
+ <p>The contact information of <var title="">node</var> is the same
+ as the contact information <a href=#the-body-element>the body element</a> of the
+ <code><a href=#document>Document</a></code>.</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>There is no contact information for <var title="">node</var>.</p>
+
+ </dd>
+
+ </dl><p>User agents may expose the contact information of a node to the
+ user, or use it for other purposes, such as indexing sections based
+ on the sections' contact information.</p>
+
+ </div>
+
+
+
+ <h4 id=headings-and-sections><span class=secno>4.4.11 </span><dfn>Headings and sections</dfn></h4>
+
+ <p>The <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements and the
+ <code><a href=#the-hgroup-element>hgroup</a></code> element are headings.</p>
+
+ <p>The first element of <a href=#heading-content>heading content</a> in an element
+ of <a href=#sectioning-content>sectioning content</a> <a href=#represents>represents</a> the
+ heading for that section. Subsequent headings of equal or higher
+ <a href=#rank>rank</a> start new (implied) sections, headings of lower
+ <a href=#rank>rank</a> start implied subsections that are part of the
+ previous one. In both cases, the element <a href=#represents>represents</a> the
+ heading of the implied section.</p>
+
+ <p>Certain elements are said to be <dfn id=sectioning-root title="sectioning
+ root">sectioning roots</dfn>, including <code><a href=#the-blockquote-element>blockquote</a></code> and
+ <code><a href=#the-td-element>td</a></code> elements. These elements can have their own
+ outlines, but the sections and headings inside these elements do not
+ contribute to the outlines of their ancestors.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-blockquote-element>blockquote</a></code></li>
+ <li><code><a href=#the-body-element-0>body</a></code></li>
+<!-- v2DATAGRID <li><code>datagrid</code></li> -->
+ <li><code><a href=#the-details-element>details</a></code></li>
+ <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
+ <li><code><a href=#the-figure-element>figure</a></code></li>
+ <li><code><a href=#the-td-element>td</a></code></li>
+ </ul><!-- a root element isn't a sectioning root. This means, for
+ instance, that you don't get an outline if you just have a random
+ XML file with <html:h1> elements in it. Other vocabs need to define
+ what their sectioning root is. --><p><a href=#sectioning-content>Sectioning content</a> elements are always considered
+ subsections of their nearest ancestor <a href=#sectioning-root>sectioning root</a>
+ or their nearest ancestor element of <a href=#sectioning-content>sectioning
+ content</a>, whichever is nearest, regardless of what implied
+ sections other headings may have created.</p>
+
+ <div class=example>
+ <p>For the following fragment:</p>
+ <pre>&lt;body&gt;
+ &lt;h1&gt;Foo&lt;/h1&gt;
+ &lt;h2&gt;Bar&lt;/h2&gt;
+ &lt;blockquote&gt;
+ &lt;h3&gt;Bla&lt;/h3&gt;
+ &lt;/blockquote&gt;
+ &lt;p&gt;Baz&lt;/p&gt;
+ &lt;h2&gt;Quux&lt;/h2&gt;
+ &lt;section&gt;
+ &lt;h3&gt;Thud&lt;/h3&gt;
+ &lt;/section&gt;
+ &lt;p&gt;Grunt&lt;/p&gt;
+&lt;/body&gt;</pre>
+ <p>...the structure would be:</p>
+ <ol><li>
+ Foo (heading of explicit <code><a href=#the-body-element-0>body</a></code> section, containing the "Grunt" paragraph)
+ <ol><li>
+ Bar (heading starting implied section, containing a block quote and the "Baz" paragraph)
+ </li>
+ <li>
+ Quux (heading starting implied section with no content other than the heading itself)
+ </li>
+ <li>
+ Thud (heading of explicit <code><a href=#the-section-element>section</a></code> section)
+ </li>
+ </ol></li>
+ </ol><p>Notice how the <code><a href=#the-section-element>section</a></code> ends the earlier implicit
+ section so that a later paragraph ("Grunt") is back at the top
+ level.</p>
+ </div>
+
+ <p>Sections may contain headings of any <a href=#rank>rank</a>, but
+ authors are strongly encouraged to either use only <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
+ elements, or to use elements of the appropriate <a href=#rank>rank</a>
+ for the section's nesting level.</p>
+
+ <p>Authors are also encouraged to explicitly wrap sections in
+ elements of <a href=#sectioning-content>sectioning content</a>, instead of relying on
+ the implicit sections generated by having multiple headings in one
+ element of <a href=#sectioning-content>sectioning content</a>.</p>
+
+ <div class=example>
+ <p>For example, the following is correct:</p>
+
+ <pre>&lt;body&gt;
+ &lt;h4&gt;Apples&lt;/h4&gt;
+ &lt;p&gt;Apples are fruit.&lt;/p&gt;
+ &lt;section&gt;
+ &lt;h2&gt;Taste&lt;/h2&gt;
+ &lt;p&gt;They taste lovely.&lt;/p&gt;
+ &lt;h6&gt;Sweet&lt;/h6&gt;
+ &lt;p&gt;Red apples are sweeter than green ones.&lt;/p&gt;
+ &lt;h1&gt;Color&lt;/h1&gt;
+ &lt;p&gt;Apples come in various colors.&lt;/p&gt;
+ &lt;/section&gt;
+&lt;/body&gt;</pre>
+
+ <p>However, the same document would be more clearly expressed
+ as:</p>
+
+ <pre>&lt;body&gt;
+ &lt;h1&gt;Apples&lt;/h1&gt;
+ &lt;p&gt;Apples are fruit.&lt;/p&gt;
+ &lt;section&gt;
+ &lt;h2&gt;Taste&lt;/h2&gt;
+ &lt;p&gt;They taste lovely.&lt;/p&gt;
+ &lt;section&gt;
+ &lt;h3&gt;Sweet&lt;/h3&gt;
+ &lt;p&gt;Red apples are sweeter than green ones.&lt;/p&gt;
+ &lt;/section&gt;
+ &lt;/section&gt;
+ &lt;section&gt;
+ &lt;h2&gt;Color&lt;/h2&gt;
+ &lt;p&gt;Apples come in various colors.&lt;/p&gt;
+ &lt;/section&gt;
+&lt;/body&gt;</pre>
+
+ <p>Both of the documents above are semantically identical and would
+ produce the same outline in compliant user agents.</p>
+
+ </div>
+
+
+ <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>
+
+ <div class=impl>
+
+ <!-- v2 idea: It would be nice if there was a way to use this to
+ autogenerate a table of contents or some such -->
+
+ <p>This section defines an algorithm for creating an outline for a
+ <a href=#sectioning-content>sectioning content</a> element or a <a href=#sectioning-root>sectioning
+ root</a> element. It is defined in terms of a walk over the nodes
+ of a DOM tree, in tree order, with each node being visited when it
+ is <i>entered</i> and when it is <i>exited</i> during the walk.</p>
+
+ </div>
+
+ <p>The <dfn id=outline>outline</dfn> for a <a href=#sectioning-content>sectioning content</a>
+ element or a <a href=#sectioning-root>sectioning root</a> element consists of a list
+ of one or more potentially nested <a href=#concept-section title=concept-section>sections</a>. A <dfn id=concept-section title=concept-section>section</dfn> is a container that
+ corresponds to some nodes in the original DOM tree. Each section can
+ have one heading associated with it, and can contain any number of
+ further nested sections. <span class=impl>The algorithm for the
+ outline also associates each node in the DOM tree with a particular
+ section and potentially a heading.</span> (The sections in the
+ outline aren't <code><a href=#the-section-element>section</a></code> elements, though some may
+ correspond to such elements &mdash; they are merely conceptual
+ sections.)</p>
+
+ <div class=example>
+
+ <p>The following markup fragment:</p>
+
+ <pre>&lt;body&gt;
+ &lt;h1&gt;A&lt;/h1&gt;
+ &lt;p&gt;B&lt;/p&gt;
+ &lt;h2&gt;C&lt;/h2&gt;
+ &lt;p&gt;D&lt;/p&gt;
+ &lt;h2&gt;E&lt;/h2&gt;
+ &lt;p&gt;F&lt;/p&gt;
+&lt;/body&gt;</pre>
+
+ <p>...results in the following outline being created for the
+ <code><a href=#the-body-element-0>body</a></code> node (and thus the entire document):</p>
+
+ <ol class=brief><li>
+ <p>Section created for <code><a href=#the-body-element-0>body</a></code> node.</p>
+ <p>Associated with heading "A".</p>
+ <p>Also associated with paragraph "B".</p>
+ <p>Nested sections:</p>
+ <ol class=brief><li>
+ <p>Section implied for first <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element.</p>
+ <p>Associated with heading "C".</p>
+ <p>Also associated with paragraph "D".</p>
+ <p>No nested sections.</p>
+ </li>
+ <li>
+ <p>Section implied for second <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element.</p>
+ <p>Associated with heading "E".</p>
+ <p>Also associated with paragraph "F".</p>
+ <p>No nested sections.</p>
+ </li>
+ </ol></li>
+ </ol></div>
+
+ <div class=impl>
+
+ <p>The algorithm that must be followed during a walk of a DOM
+ subtree rooted at a <a href=#sectioning-content>sectioning content</a> element or a
+ <a href=#sectioning-root>sectioning root</a> element to determine that element's
+ <a href=#outline>outline</a> is as follows:</p>
+
+ <ol><li><p>Let <var title="">current outlinee</var> be null. (It holds
+ the element whose <a href=#outline>outline</a> is being created.)</li>
+
+ <li><p>Let <var title="">current section</var> be null. (It holds a
+ pointer to a <a href=#concept-section title=concept-section>section</a>, so that
+ elements in the DOM can all be associated with a section.)</li>
+
+ <li><p>Create a stack to hold elements, which is used to handle
+ nesting. Initialize this stack to empty.</li>
+
+ <li>
+
+ <p>As you walk over the DOM in <a href=#tree-order>tree order</a>, trigger
+ the first relevant step below for each element as you enter and
+ exit it.</p>
+
+ <dl class=switch><dt>If the top of the stack is an element, and you are exiting
+ that element</dt>
+
+ <dd>
+
+ <p class=note>The element being exited is a <a href=#heading-content>heading
+ content</a> element.</p>
+
+ <p>Pop that element from the stack.</p>
+
+ </dd>
+
+
+ <dt>If the top of the stack is a <a href=#heading-content>heading content</a>
+ element</dt>
+
+ <dd><p>Do nothing.</dd>
+
+
+ <dt>When entering a <a href=#sectioning-content>sectioning content</a> element or a
+ <a href=#sectioning-root>sectioning root</a> element</dt>
+
+ <dd>
+
+ <p>If <var title="">current outlinee</var> is not null, and the
+ <var title="">current section</var> has no heading, create an
+ implied heading and let that be the heading for the <var title="">current section</var>.</p>
+
+ <p>If <var title="">current outlinee</var> is not null, push
+ <var title="">current outlinee</var> onto the stack.</p>
+
+ <p>Let <var title="">current outlinee</var> be the element
+ that is being entered.</p>
+
+ <p>Let <var title="">current section</var> be a newly created
+ <a href=#concept-section title=concept-section>section</a> for the <var title="">current outlinee</var> element.</p>
+
+ <p>Let there be a new <a href=#outline>outline</a> for the new <var title="">current outlinee</var>, initialized with just the new
+ <var title="">current section</var> as the only <a href=#concept-section title=concept-section>section</a> in the outline.</p>
+
+ </dd>
+
+
+ <dt>When exiting a <a href=#sectioning-content>sectioning content</a> element, if
+ the stack is not empty</dt>
+
+ <dd>
+
+ <p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p>
+
+ <p>Let <var title="">current section</var> be the last section
+ in the <a href=#outline>outline</a> of the <var title="">current
+ outlinee</var> element.</p>
+
+ <p>Append the <a href=#outline>outline</a> of the <a href=#sectioning-content>sectioning
+ content</a> element being exited to the <var title="">current
+ section</var>. (This does not change which section is the last
+ section in the <a href=#outline>outline</a>.)</p>
+
+ </dd>
+
+
+ <dt>When exiting a <a href=#sectioning-root>sectioning root</a> element, if the
+ stack is not empty</dt>
+
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</li>
+
+ <li><p>Let <var title="">current section</var> be the last
+ section in the <a href=#outline>outline</a> of the <var title="">current
+ outlinee</var> element.</li>
+
+ <li><p><i>Finding the deepest child</i>: If <var title="">current section</var> has no child sections, stop
+ these steps.</li>
+
+ <li><p>Let <var title="">current section</var> be the last
+ child <a href=#concept-section title=concept-section>section</a> of the
+ current <var title="">current section</var>.</li>
+
+ <li><p>Go back to the substep labeled <i>finding the deepest
+ child</i>.</li>
+
+ </ol></dd>
+
+
+ <dt>When exiting a <a href=#sectioning-content>sectioning content</a> element or a
+ <a href=#sectioning-root>sectioning root</a> element</dt>
+
+ <dd>
+
+ <p class=note>The <var title="">current outlinee</var> is
+ the element being exited.</p>
+
+ <p>Let <var title="">current section</var> be the first <a href=#concept-section title=concept-section>section</a> in the
+ <a href=#outline>outline</a> of the <var title="">current outlinee</var>
+ element.</p>
+
+ <p>Skip to the next step in the overall set of steps. (The walk
+ is over.)</p>
+
+ </dd>
+
+
+ <dt>If the <var title="">current outlinee</var> is null</dt>
+
+ <dd><p>Do nothing.</dd>
+
+
+ <dt>When entering a <a href=#heading-content>heading content</a> element</dt>
+
+ <dd>
+
+ <p>If the <var title="">current section</var> has no heading,
+ let the element being entered be the heading for the <var title="">current section</var>.</p>
+
+ <p>Otherwise, if the element being entered has a
+ <a href=#rank>rank</a> equal to or greater than the heading of the
+ last section of the <a href=#outline>outline</a> of the <var title="">current outlinee</var>, then create a new <a href=#concept-section title=concept-section>section</a> and append it to the
+ <a href=#outline>outline</a> of the <var title="">current outlinee</var>
+ element, so that this new section is the new last section of
+ that outline. Let <var title="">current section</var> be that
+ new section. Let the element being entered be the new heading
+ for the <var title="">current section</var>.</p>
+
+ <p>Otherwise, run these substeps:</p>
+
+ <ol><li><p>Let <var title="">candidate section</var> be <var title="">current section</var>.</li>
+
+ <li><p>If the element being entered has a <a href=#rank>rank</a>
+ lower than the <a href=#rank>rank</a> of the heading of the <var title="">candidate section</var>, then create a new <a href=#concept-section title=concept-section>section</a>, and append it to <var title="">candidate section</var>. (This does not change which
+ section is the last section in the outline.) Let <var title="">current section</var> be this new section. Let the
+ element being entered be the new heading for the <var title="">current section</var>. Abort these substeps.</p>
+
+ <li><p>Let <var title="">new candidate section</var> be the
+ <a href=#concept-section title=concept-section>section</a> that contains <var title="">candidate section</var> in the <a href=#outline>outline</a> of
+ <var title="">current outlinee</var>.</li>
+
+ <li><p>Let <var title="">candidate section</var> be <var title="">new candidate section</var>.</li>
+
+ <li><p>Return to step 2.</li>
+
+ </ol><p>Push the element being entered onto the stack. (This causes
+ the algorithm to skip any descendants of the element.)</p>
+
+ <p class=note>Recall that <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> has the
+ <em>highest</em> rank, and <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> has the lowest
+ rank.</p>
+
+ </dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd><p>Do nothing.</dd>
+
+ </dl><p id=associatedSection>In addition, whenever you exit a node,
+ after doing the steps above, if <var title="">current
+ section</var> is not null, associate the node with the <a href=#concept-section title=concept-section>section</a> <var title="">current
+ section</var>.</p>
+
+ </li>
+
+ <li><p>If the <var title="">current outlinee</var> is null,
+ then there was no <a href=#sectioning-content>sectioning content</a> element or
+ <a href=#sectioning-root>sectioning root</a> element in the DOM. There is no
+ <a href=#outline>outline</a>. Abort these steps.</li>
+
+ <li><p>Associate any nodes that were not associated with a <a href=#concept-section title=concept-section>section</a> in the steps above with <var title="">current outlinee</var> as their section.</li>
+
+ <li><p>Associate all nodes with the heading of the <a href=#concept-section title=concept-section>section</a> with which they are
+ associated, if any.</li>
+
+ <li><p>If <var title="">current outlinee</var> is <a href=#the-body-element>the body
+ element</a>, then the outline created for that element is the
+ <a href=#outline>outline</a> of the entire document.</li>
+
+ </ol><p>The tree of sections created by the algorithm above, or a proper
+ subset thereof, must be used when generating document outlines, for
+ example when generating tables of contents.</p>
+
+ <p>When creating an interactive table of contents, entries should
+ jump the user to the relevant <a href=#sectioning-content>sectioning content</a>
+ element, if the <a href=#concept-section title=concept-section>section</a> was
+ created for a real element in the original document, or to the
+ relevant <a href=#heading-content>heading content</a> element, if the <a href=#concept-section title=concept-section>section</a> in the tree was generated for
+ a heading in the above process.</p>
+
+ <p class=note>Selecting the first <a href=#concept-section title=concept-section>section</a> of the document therefore
+ always takes the user to the top of the document, regardless of
+ where the first heading in the <code><a href=#the-body-element-0>body</a></code> is to be found.</p>
+
+ <p>The <dfn id=outline-depth>outline depth</dfn> of a <a href=#heading-content>heading content</a>
+ element associated with a <a href=#concept-section title=concept-section>section</a> <var title="">section</var>
+ is the number of <a href=#concept-section title=concept-section>sections</a> that
+ are ancestors of <var title="">section</var> in the
+ <a href=#outline>outline</a> that <var title="">section</var> finds itself
+ in when the <a href=#outline title=outline>outlines</a> of its
+ <code><a href=#document>Document</a></code>'s elements are created, plus 1. The
+ <a href=#outline-depth>outline depth</a> of a <a href=#heading-content>heading content</a> element
+ not associated with a <a href=#concept-section title=concept-section>section</a>
+ is 1.</p>
+
+ <p>User agents should provide default headings for sections that do
+ not have explicit section headings.</p>
+
+ <div class=example>
+
+ <p>Consider the following snippet:</p>
+
+ <pre>&lt;body&gt;
+ &lt;nav&gt;
+ &lt;p&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/p&gt;
+ &lt;/nav&gt;
+ &lt;p&gt;Hello world.&lt;/p&gt;
+ &lt;aside&gt;
+ &lt;p&gt;My cat is cute.&lt;/p&gt;
+ &lt;/aside&gt;
+&lt;/body&gt;</pre>
+
+ <p>Although it contains no headings, this snippet has three
+ sections: a document (the <code><a href=#the-body-element-0>body</a></code>) with two subsections
+ (a <code><a href=#the-nav-element>nav</a></code> and an <code><a href=#the-aside-element>aside</a></code>). A user agent could
+ present the outline as follows:</p>
+
+ <ol class=brief><li>Untitled document
+ <ol><li>Navigation</li>
+ <li>Sidebar</li>
+ </ol></li>
+ </ol><p>These default headings ("Untitled document", "Navigation",
+ "Sidebar") are not specified by this specification, and might vary
+ with the user's language, the page's language, the user's
+ preferences, the user agent implementor's preferences, etc.</p>
+
+ </div>
+
+ <div class=note>
+
+ <p>The following JavaScript function shows how the tree walk could
+ be implemented. The <var title="">root</var> argument is the root
+ of the tree to walk, and the <var title="">enter</var> and <var title="">exit</var> arguments are callbacks that are called with
+ the nodes as they are entered and exited. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ <pre>function (root, enter, exit) {
+ var node = root;
+ start: while (node) {
+ enter(node);
+ if (node.firstChild) {
+ node = node.firstChild;
+ continue start;
+ }
+ while (node) {
+ exit(node);
+ if (node.nextSibling) {
+ node = node.nextSibling;
+ continue start;
+ }
+ if (node == root)
+ node = null;
+ else
+ node = node.parentNode;
+ }
+ }
+}</pre>
+
+ </div>
+
+ </div>
+
+
+
+ <h3 id=grouping-content><span class=secno>4.5 </span>Grouping content</h3>
+
+ <h4 id=the-p-element><span class=secno>4.5.1 </span>The <dfn><code>p</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlparagraphelement>HTMLParagraphElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-p-element>p</a></code> element <a href=#represents>represents</a> a
+ <a href=#paragraph>paragraph</a>.</p>
+
+ <div class=example>
+ <p>The following examples are conforming HTML fragments:</p>
+ <pre>&lt;p&gt;The little kitten gently seated himself on a piece of
+carpet. Later in his life, this would be referred to as the time the
+cat sat on the mat.&lt;/p&gt;</pre>
+ <pre>&lt;fieldset&gt;
+ &lt;legend&gt;Personal information&lt;/legend&gt;
+ &lt;p&gt;
+ &lt;label&gt;Name: &lt;input name="n"&gt;&lt;/label&gt;
+ &lt;label&gt;&lt;input name="anon" type="checkbox"&gt; Hide from other users&lt;/label&gt;
+ &lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Address: &lt;textarea name="a"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;/fieldset&gt;</pre>
+ <pre>&lt;p&gt;There was once an example from Femley,&lt;br&gt;
+Whose markup was of dubious quality.&lt;br&gt;
+The validator complained,&lt;br&gt;
+So the author was pained,&lt;br&gt;
+To move the error from the markup to the rhyming.&lt;/p&gt;</pre>
+ </div>
+
+ <p>The <code><a href=#the-p-element>p</a></code> element should not be used when a more
+ specific element is more appropriate.</p>
+
+ <div class=example>
+
+ <p>The following example is technically correct:</p>
+
+<pre>&lt;section&gt;
+ &lt;!-- ... --&gt;
+ &lt;p&gt;Last modified: 2001-04-23&lt;/p&gt;
+ &lt;p&gt;Author: fred@example.com&lt;/p&gt;
+&lt;/section&gt;</pre>
+
+ <p>However, it would be better marked-up as:</p>
+
+<pre>&lt;section&gt;
+ &lt;!-- ... --&gt;
+ &lt;footer&gt;Last modified: 2001-04-23&lt;/footer&gt;
+ &lt;address&gt;Author: fred@example.com&lt;/address&gt;
+&lt;/section&gt;</pre>
+
+ <p>Or:</p>
+
+<pre>&lt;section&gt;
+ &lt;!-- ... --&gt;
+ &lt;footer&gt;
+ &lt;p&gt;Last modified: 2001-04-23&lt;/p&gt;
+ &lt;address&gt;Author: fred@example.com&lt;/address&gt;
+ &lt;/footer&gt;
+&lt;/section&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-hr-element><span class=secno>4.5.2 </span>The <dfn><code>hr</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlhrelement>HTMLHRElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-hr-element>hr</a></code> element <a href=#represents>represents</a> a
+ <a href=#paragraph>paragraph</a>-level thematic break, e.g. a scene change in
+ a story, or a transition to another topic within a section of a
+ reference book.</p>
+
+ <div class=example>
+
+ <p>The following fictional extract from a project manual shows two
+ sections that use the <code><a href=#the-hr-element>hr</a></code> element to separate topics
+ within the section.</p>
+
+ <pre>&lt;section&gt;
+ &lt;h1&gt;Communication&lt;/h1&gt;
+ &lt;p&gt;There are various methods of communication. This section
+ covers a few of the important ones used by the project.&lt;/p&gt;
+ <strong>&lt;hr&gt;</strong>
+ &lt;p&gt;Communication stones seem to come in pairs and have mysterious
+ properties:&lt;/p&gt;
+ &lt;ul&gt;
+ &lt;li&gt;They can transfer thoughts in two directions once activated
+ if used alone.&lt;/li&gt;
+ &lt;li&gt;If used with another device, they can transfer one's
+ consciousness to another body.&lt;/li&gt;
+ &lt;li&gt;If both stones are used with another device, the
+ consciousnesses switch bodies.&lt;/li&gt;
+ &lt;/ul&gt;
+ <strong>&lt;hr&gt;</strong>
+ &lt;p&gt;Radios use the electromagnetic spectrum in the meter range and
+ longer.&lt;/p&gt;
+ <strong>&lt;hr&gt;</strong>
+ &lt;p&gt;Signal flares use the electromagnetic spectrum in the
+ nanometer range.&lt;/p&gt;
+&lt;/section&gt;
+&lt;section&gt;
+ &lt;h1&gt;Food&lt;/h1&gt;
+ &lt;p&gt;All food at the project is rationed:&lt;/p&gt;
+ &lt;dl&gt;
+ &lt;dt&gt;Potatoes&lt;/dt&gt;
+ &lt;dd&gt;Two per day&lt;/dd&gt;
+ &lt;dt&gt;Soup&lt;/dt&gt;
+ &lt;dd&gt;One bowl per day&lt;/dd&gt;
+ &lt;/dl&gt;
+ <strong>&lt;hr&gt;</strong>
+ &lt;p&gt;Cooking is done by the chefs on a set rotation.&lt;/p&gt;
+&lt;/section&gt;</pre>
+
+ <p>There is no need for an <code><a href=#the-hr-element>hr</a></code> element between the
+ sections themselves, since the <code><a href=#the-section-element>section</a></code> elements and
+ the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements imply thematic changes themselves.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following extract from <cite>Pandora's Star</cite> by Peter
+ F. Hamilton shows two paragraphs that precede a scene change and
+ the paragraph that follows it. The scene change, represented in the
+ printed book by a gap containing a solitary centered star between
+ the second and third paragraphs, is here represented using the
+ <code><a href=#the-hr-element>hr</a></code> element.</p>
+
+ <!-- ISBN 1-4050-0020-1; bottom of page 14 -->
+
+ <pre lang=en-GB>&lt;p&gt;Dudley was ninety-two, in his second life, and fast approaching
+time for another rejuvenation. Despite his body having the physical
+age of a standard fifty-year-old, the prospect of a long degrading
+campaign within academia was one he regarded with dread. For a
+supposedly advanced civilization, the Intersolar Commonwearth could be
+appallingly backward at times, not to mention cruel.&lt;/p&gt;
+&lt;p&gt;&lt;i&gt;Maybe it won't be that bad&lt;/i&gt;, he told himself. The lie was
+comforting enough to get him through the rest of the night's
+shift.&lt;/p&gt;
+<strong>&lt;hr&gt;</strong>
+&lt;p&gt;The Carlton AllLander drove Dudley home just after dawn. Like the
+astronomer, the vehicle was old and worn, but perfectly capable of
+doing its job. It had a cheap diesel engine, common enough on a
+semi-frontier world like Gralmond, although its drive array was a
+thoroughly modern photoneural processor. With its high suspension and
+deep-tread tyres it could plough along the dirt track to the
+observatory in all weather and seasons, including the metre-deep snow
+of Gralmond's winters.&lt;/p&gt;</pre>
+
+ </div>
+
+ <p class=note>The <code><a href=#the-hr-element>hr</a></code> element does not affect the
+ document's <a href=#outline>outline</a>.</p>
+
+
+ <h4 id=the-pre-element><span class=secno>4.5.3 </span>The <dfn><code>pre</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlpreelement>HTMLPreElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-pre-element>pre</a></code> element <a href=#represents>represents</a> a block of
+ preformatted text, in which structure is represented by typographic
+ conventions rather than by elements.</p>
+
+ <p class=note>In <a href=#syntax>the HTML syntax</a>, a leading
+ newline character immediately following the <code><a href=#the-pre-element>pre</a></code> element
+ start tag is stripped.</p>
+
+ <p>Some examples of cases where the <code><a href=#the-pre-element>pre</a></code> element could
+ be used:</p>
+
+ <ul><li>Including an e-mail, with paragraphs indicated by blank lines,
+ lists indicated by lines prefixed with a bullet, and so on.</li>
+
+ <li>Including fragments of computer code, with structure indicated
+ according to the conventions of that language.</li>
+
+ <li>Displaying ASCII art.</li>
+
+ </ul><p class=note>Authors are encouraged to consider how preformatted
+ text will be experienced when the formatting is lost, as will be the
+ case for users of speech synthesizers, braille displays, and the
+ like. For cases like ASCII art, it is likely that an alternative
+ presentation, such as a textual description, would be more
+ universally accessible to the readers of the document.</p>
+
+ <p>To represent a block of computer code, the <code><a href=#the-pre-element>pre</a></code>
+ element can be used with a <code><a href=#the-code-element>code</a></code> element; to represent a
+ block of computer output the <code><a href=#the-pre-element>pre</a></code> element can be used
+ with a <code><a href=#the-samp-element>samp</a></code> element. Similarly, the <code><a href=#the-kbd-element>kbd</a></code>
+ element can be used within a <code><a href=#the-pre-element>pre</a></code> element to indicate
+ text that the user is to enter.</p>
+
+ <div class=example>
+
+ <p>In the following snippet, a sample of computer code is
+ presented.</p>
+
+ <pre>&lt;p&gt;This is the &lt;code&gt;Panel&lt;/code&gt; constructor:&lt;/p&gt;
+&lt;pre&gt;&lt;code&gt;function Panel(element, canClose, closeHandler) {
+ this.element = element;
+ this.canClose = canClose;
+ this.closeHandler = function () { if (closeHandler) closeHandler() };
+}&lt;/code&gt;&lt;/pre&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following snippet, <code><a href=#the-samp-element>samp</a></code> and <code><a href=#the-kbd-element>kbd</a></code>
+ elements are mixed in the contents of a <code><a href=#the-pre-element>pre</a></code> element to
+ show a session of Zork I.</p>
+
+ <pre>&lt;pre&gt;&lt;samp&gt;You are in an open field west of a big white house with a boarded
+front door.
+There is a small mailbox here.
+
+&gt;&lt;/samp&gt; &lt;kbd&gt;open mailbox&lt;/kbd&gt;
+
+&lt;samp&gt;Opening the mailbox reveals:
+A leaflet.
+
+&gt;&lt;/samp&gt;&lt;/pre&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following shows a contemporary poem that uses the
+ <code><a href=#the-pre-element>pre</a></code> element to preserve its unusual formatting, which
+ forms an intrinsic part of the poem itself.</p>
+
+ <pre>&lt;pre&gt; maxling
+
+it is with a heart
+ heavy
+
+that i admit loss of a feline
+ so loved
+
+a friend lost to the
+ unknown
+ (night)
+
+~cdr 11dec07&lt;/pre&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-blockquote-element><span class=secno>4.5.4 </span>The <dfn><code>blockquote</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlquoteelement>HTMLQuoteElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-quote-cite title=dom-quote-cite>cite</a>;
+};</pre>
+ <p class=note>The <code><a href=#htmlquoteelement>HTMLQuoteElement</a></code> interface is
+ also used by the <code><a href=#the-q-element>q</a></code> element.</p>
+ </dd>
+ </dl><p>The <code><a href=#the-blockquote-element>blockquote</a></code> element <a href=#represents>represents</a> a
+ section that is quoted from another source.</p>
+
+ <p>Content inside a <code><a href=#the-blockquote-element>blockquote</a></code> must be quoted from
+ another source, whose address, if it has one, may be cited in the
+ <dfn id=attr-blockquote-cite title=attr-blockquote-cite><code>cite</code></dfn>
+ attribute.</p>
+
+ <p>If the <code title=attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code> attribute
+ is present, it must be a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by
+ spaces</a>. <span class=impl>To obtain the corresponding
+ citation link, the value of the attribute must be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element. User
+ agents should allow users to follow such citation links.</span></p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-quote-cite title=dom-quote-cite><code>cite</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the element's <code title="">cite</code> content attribute.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This next example shows the use of <code><a href=#the-cite-element>cite</a></code> alongside
+ <code><a href=#the-blockquote-element>blockquote</a></code>:</p>
+
+ <pre>&lt;p&gt;His next piece was the aptly named &lt;cite&gt;Sonnet 130&lt;/cite&gt;:&lt;/p&gt;
+&lt;blockquote cite="http://quotes.example.org/s/sonnet130.html"&gt;
+ &lt;p&gt;My mistress' eyes are nothing like the sun,&lt;br&gt;
+ Coral is far more red, than her lips red,&lt;br&gt;
+ ...</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>This example shows how a forum post could use
+ <code><a href=#the-blockquote-element>blockquote</a></code> to show what post a user is replying
+ to. The <code><a href=#the-article-element>article</a></code> element is used for each post, to mark
+ up the threading.</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;&lt;a href="http://bacon.example.com/?blog=109431"&gt;Bacon on a crowbar&lt;/a&gt;&lt;/h1&gt;
+ &lt;article&gt;
+ &lt;header&gt;&lt;strong&gt;t3yw&lt;/strong&gt; 12 points 1 hour ago&lt;/header&gt;
+ &lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;
+ &lt;footer&gt;&lt;a href="?pid=29578"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
+ &lt;article&gt;
+ &lt;header&gt;&lt;strong&gt;greg&lt;/strong&gt; 8 points 1 hour ago&lt;/header&gt;
+ &lt;blockquote&gt;&lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;&lt;/blockquote&gt;
+ &lt;p&gt;Dude narwhals don't eat bacon.&lt;/p&gt;
+ &lt;footer&gt;&lt;a href="?pid=29579"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
+ &lt;article&gt;
+ &lt;header&gt;&lt;strong&gt;t3yw&lt;/strong&gt; 15 points 1 hour ago&lt;/header&gt;
+ &lt;blockquote&gt;
+ &lt;blockquote&gt;&lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;&lt;/blockquote&gt;
+ &lt;p&gt;Dude narwhals don't eat bacon.&lt;/p&gt;
+ &lt;/blockquote&gt;
+ &lt;p&gt;Next thing you'll be saying they don't get capes and wizard
+ hats either!&lt;/p&gt;
+ &lt;footer&gt;&lt;a href="?pid=29580"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
+ &lt;article&gt;
+ &lt;article&gt;
+ &lt;header&gt;&lt;strong&gt;boing&lt;/strong&gt; -5 points 1 hour ago&lt;/header&gt;
+ &lt;p&gt;narwhals are worse than ceiling cat&lt;/p&gt;
+ &lt;footer&gt;&lt;a href="?pid=29581"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
+ &lt;/article&gt;
+ &lt;/article&gt;
+ &lt;/article&gt;
+ &lt;/article&gt;
+ &lt;article&gt;
+ &lt;header&gt;&lt;strong&gt;fred&lt;/strong&gt; 1 points 23 minutes ago&lt;/header&gt;
+ &lt;blockquote&gt;&lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;&lt;/blockquote&gt;
+ &lt;p&gt;I bet they'd love to peel a banana too.&lt;/p&gt;
+ &lt;footer&gt;&lt;a href="?pid=29582"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
+ &lt;/article&gt;
+ &lt;/article&gt;
+&lt;/article&gt;</pre>
+
+ </div>
+
+ <p class=note><a href=#conversations>Examples of how to
+ represent a conversation</a> are shown in a later section; it is not
+ appropriate to use the <code><a href=#the-cite-element>cite</a></code> and <code><a href=#the-blockquote-element>blockquote</a></code>
+ elements for this purpose.</p>
+
+
+
+ <h4 id=the-ol-element><span class=secno>4.5.5 </span>The <dfn><code>ol</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-li-element>li</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code></dd>
+ <dd><code title=attr-ol-start><a href=#attr-ol-start>start</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlolistelement>HTMLOListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-ol-reversed title=dom-ol-reversed>reversed</a>;
+ attribute long <a href=#dom-ol-start title=dom-ol-start>start</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-ol-element>ol</a></code> element <a href=#represents>represents</a> a list of
+ items, where the items have been intentionally ordered, such that
+ changing the order would change the meaning of the document.</p>
+
+ <p>The items of the list are the <code><a href=#the-li-element>li</a></code> element child nodes
+ of the <code><a href=#the-ol-element>ol</a></code> element, in <a href=#tree-order>tree order</a>.</p>
+
+ <p>The <dfn id=attr-ol-reversed title=attr-ol-reversed><code>reversed</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. If present, it
+ indicates that the list is a descending list (..., 3, 2, 1). If the
+ attribute is omitted, the list is an ascending list (1, 2, 3,
+ ...).</p>
+
+ <p>The <dfn id=attr-ol-start title=attr-ol-start><code>start</code></dfn>
+ attribute, if present, must be a <a href=#valid-integer>valid integer</a> giving
+ the ordinal value of the first list item.</p>
+
+ <div class=impl>
+
+ <p>If the <code title=attr-ol-start><a href=#attr-ol-start>start</a></code> attribute is
+ present, user agents must <a href=#rules-for-parsing-integers title="rules for parsing
+ integers">parse it as an integer</a>, in order to determine the
+ attribute's value. The default value, used if the attribute is
+ missing or if the value cannot be converted to a number according to
+ the referenced algorithm, is 1 if the element has no <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> attribute, and is the
+ number of child <code><a href=#the-li-element>li</a></code> elements otherwise.</p>
+
+ <p>The first item in the list has the ordinal value given by the
+ <code><a href=#the-ol-element>ol</a></code> element's <code title=attr-ol-start><a href=#attr-ol-start>start</a></code>
+ attribute, unless that <code><a href=#the-li-element>li</a></code> element has a <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute with a value that can
+ be successfully parsed, in which case it has the ordinal value given
+ by that <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute.</p>
+
+ <p>Each subsequent item in the list has the ordinal value given by
+ its <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute, if it has
+ one, or, if it doesn't, the ordinal value of the previous item, plus
+ one if the <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> is absent,
+ or minus one if it is present.</p>
+
+ <p>The <dfn id=dom-ol-reversed title=dom-ol-reversed><code>reversed</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the value of the <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-ol-start title=dom-ol-start><code>start</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the value of the <code title=attr-ol-start><a href=#attr-ol-start>start</a></code> content attribute.</p>
+
+ </div>
+
+ <!-- v2: resuming numbering of lists from previous lists? -->
+
+ <div class=example>
+
+ <p>The following markup shows a list where the order matters, and
+ where the <code><a href=#the-ol-element>ol</a></code> element is therefore appropriate. Compare
+ this list to the equivalent list in the <code><a href=#the-ul-element>ul</a></code> section to
+ see an example of the same items using the <code><a href=#the-ul-element>ul</a></code>
+ element.</p>
+
+ <pre>&lt;p&gt;I have lived in the following countries (given in the order of when
+I first lived there):&lt;/p&gt;
+&lt;ol&gt;
+ &lt;li&gt;Switzerland
+ &lt;li&gt;United Kingdom
+ &lt;li&gt;United States
+ &lt;li&gt;Norway
+&lt;/ol&gt;</pre>
+
+ <p>Note how changing the order of the list changes the meaning of
+ the document. In the following example, changing the relative order
+ of the first two items has changed the birthplace of the
+ author:</p>
+
+ <pre>&lt;p&gt;I have lived in the following countries (given in the order of when
+I first lived there):&lt;/p&gt;
+&lt;ol&gt;
+ &lt;li&gt;United Kingdom
+ &lt;li&gt;Switzerland
+ &lt;li&gt;United States
+ &lt;li&gt;Norway
+&lt;/ol&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-ul-element><span class=secno>4.5.6 </span>The <dfn><code>ul</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-li-element>li</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlulistelement>HTMLUListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-ul-element>ul</a></code> element <a href=#represents>represents</a> a list of
+ items, where the order of the items is not important &mdash; that
+ is, where changing the order would not materially change the meaning
+ of the document.</p>
+
+ <p>The items of the list are the <code><a href=#the-li-element>li</a></code> element child nodes
+ of the <code><a href=#the-ul-element>ul</a></code> element.</p>
+
+ <div class=example>
+
+ <p>The following markup shows a list where the order does not
+ matter, and where the <code><a href=#the-ul-element>ul</a></code> element is therefore
+ appropriate. Compare this list to the equivalent list in the
+ <code><a href=#the-ol-element>ol</a></code> section to see an example of the same items using
+ the <code><a href=#the-ol-element>ol</a></code> element.</p>
+
+ <pre>&lt;p&gt;I have lived in the following countries:&lt;/p&gt;
+&lt;ul&gt;
+ &lt;li&gt;Norway
+ &lt;li&gt;Switzerland
+ &lt;li&gt;United Kingdom
+ &lt;li&gt;United States
+&lt;/ul&gt;</pre>
+
+ <p>Note that changing the order of the list does not change the
+ meaning of the document. The items in the snippet above are given
+ in alphabetical order, but in the snippet below they are given in
+ order of the size of their current account balance in 2007, without
+ changing the meaning of the document whatsoever:</p>
+
+ <pre>&lt;p&gt;I have lived in the following countries:&lt;/p&gt;
+&lt;ul&gt;
+ &lt;li&gt;Switzerland
+ &lt;li&gt;Norway
+ &lt;li&gt;United Kingdom
+ &lt;li&gt;United States
+&lt;/ul&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-li-element><span class=secno>4.5.7 </span>The <dfn><code>li</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Inside <code><a href=#the-ol-element>ol</a></code> elements.</dd>
+ <dd>Inside <code><a href=#the-ul-element>ul</a></code> elements.</dd>
+ <dd>Inside <code><a href=#menus>menu</a></code> elements.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd>If the element is a child of an <code><a href=#the-ol-element>ol</a></code> element: <code title=attr-li-value><a href=#attr-li-value>value</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmllielement>HTMLLIElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute long <a href=#dom-li-value title=dom-li-value>value</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-li-element>li</a></code> element <a href=#represents>represents</a> a list
+ item. If its parent element is an <code><a href=#the-ol-element>ol</a></code>, <code><a href=#the-ul-element>ul</a></code>,
+ or <code><a href=#menus>menu</a></code> element, then the element is an item of the
+ parent element's list, as defined for those elements. Otherwise, the
+ list item has no defined list-related relationship to any other
+ <code><a href=#the-li-element>li</a></code> element.</p>
+
+ <p>The <dfn id=attr-li-value title=attr-li-value><code>value</code></dfn>
+ attribute, if present, must be a <a href=#valid-integer>valid integer</a> giving
+ the ordinal value of the list item.</p>
+
+ <div class=impl>
+
+ <p>If the <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute is
+ present, user agents must <a href=#rules-for-parsing-integers title="rules for parsing
+ integers">parse it as an integer</a>, in order to determine the
+ attribute's value. If the attribute's value cannot be converted to a
+ number, the attribute must be treated as if it was absent. The
+ attribute has no default value.</p>
+
+ <p>The <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute is
+ processed relative to the element's parent <code><a href=#the-ol-element>ol</a></code> element
+ (q.v.), if there is one. If there is not, the attribute has no
+ effect.</p>
+
+ <p>The <dfn id=dom-li-value title=dom-li-value><code>value</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the value of the <code title=dom-li-value><a href=#dom-li-value>value</a></code> content attribute.</p>
+
+ </div>
+
+ <div class=example>
+ <p>The following example, the top ten movies are listed (in reverse
+ order). Note the way the list is given a title by using a
+ <code><a href=#the-figure-element>figure</a></code> element and its <code><a href=#the-figcaption-element>figcaption</a></code>
+ element.</p>
+ <pre>&lt;figure&gt;
+ &lt;figcaption&gt;The top 10 movies of all time&lt;/figcaption&gt;
+ &lt;ol&gt;
+ &lt;li value="10"&gt;&lt;cite&gt;Josie and the Pussycats&lt;/cite&gt;, 2001&lt;/li&gt;
+ &lt;li value="9"&gt;&lt;cite lang="sh"&gt;&#1062;&#1088;&#1085;&#1072; &#1084;&#1072;&#1095;&#1082;&#1072;, &#1073;&#1077;&#1083;&#1080; &#1084;&#1072;&#1095;&#1086;&#1088;&lt;/cite&gt;, 1998&lt;/li&gt;
+ &lt;li value="8"&gt;&lt;cite&gt;A Bug's Life&lt;/cite&gt;, 1998&lt;/li&gt;
+ &lt;li value="7"&gt;&lt;cite&gt;Toy Story&lt;/cite&gt;, 1995&lt;/li&gt;
+ &lt;li value="6"&gt;&lt;cite&gt;Monsters, Inc&lt;/cite&gt;, 2001&lt;/li&gt;
+ &lt;li value="5"&gt;&lt;cite&gt;Cars&lt;/cite&gt;, 2006&lt;/li&gt;
+ &lt;li value="4"&gt;&lt;cite&gt;Toy Story 2&lt;/cite&gt;, 1999&lt;/li&gt;
+ &lt;li value="3"&gt;&lt;cite&gt;Finding Nemo&lt;/cite&gt;, 2003&lt;/li&gt;
+ &lt;li value="2"&gt;&lt;cite&gt;The Incredibles&lt;/cite&gt;, 2004&lt;/li&gt;
+ &lt;li value="1"&gt;&lt;cite&gt;Ratatouille&lt;/cite&gt;, 2007&lt;/li&gt;
+ &lt;/ol&gt;
+&lt;/figure&gt;</pre>
+
+ <p>The markup could also be written as follows, using the <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> attribute on the
+ <code><a href=#the-ol-element>ol</a></code> element:</p>
+
+ <pre>&lt;figure&gt;
+ &lt;figcaption&gt;The top 10 movies of all time&lt;/figcaption&gt;
+ &lt;ol reversed&gt;
+ &lt;li&gt;&lt;cite&gt;Josie and the Pussycats&lt;/cite&gt;, 2001&lt;/li&gt;
+ &lt;li&gt;&lt;cite lang="sh"&gt;&#1062;&#1088;&#1085;&#1072; &#1084;&#1072;&#1095;&#1082;&#1072;, &#1073;&#1077;&#1083;&#1080; &#1084;&#1072;&#1095;&#1086;&#1088;&lt;/cite&gt;, 1998&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;A Bug's Life&lt;/cite&gt;, 1998&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;Toy Story&lt;/cite&gt;, 1995&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;Monsters, Inc&lt;/cite&gt;, 2001&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;Cars&lt;/cite&gt;, 2006&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;Toy Story 2&lt;/cite&gt;, 1999&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;Finding Nemo&lt;/cite&gt;, 2003&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;The Incredibles&lt;/cite&gt;, 2004&lt;/li&gt;
+ &lt;li&gt;&lt;cite&gt;Ratatouille&lt;/cite&gt;, 2007&lt;/li&gt;
+ &lt;/ol&gt;
+&lt;/figure&gt;</pre>
+ </div>
+
+ <p class=note>If the <code><a href=#the-li-element>li</a></code> element is the child of a
+ <code><a href=#menus>menu</a></code> element and itself has a child that defines a
+ <a href=#concept-command title=concept-command>command</a>, then the
+ <code><a href=#the-li-element>li</a></code> element will match the <code title=selector-enabled><a href=#selector-enabled>:enabled</a></code> and <code title=selector-disabled><a href=#selector-disabled>:disabled</a></code> pseudo-classes in the
+ same way as the first such child element does.</p>
+
+
+
+ <h4 id=the-dl-element><span class=secno>4.5.8 </span>The <dfn><code>dl</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more groups each consisting of one or more
+ <code><a href=#the-dt-element>dt</a></code> elements followed by one or more <code><a href=#the-dd-element>dd</a></code>
+ elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmldlistelement>HTMLDListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-dl-element>dl</a></code> element <a href=#represents>represents</a> an
+ association list consisting of zero or more name-value groups (a
+ description list). Each group must consist of one or more names
+ (<code><a href=#the-dt-element>dt</a></code> elements) followed by one or more values
+ (<code><a href=#the-dd-element>dd</a></code> elements). Within a single <code><a href=#the-dl-element>dl</a></code> element,
+ there should not be more than one <code><a href=#the-dt-element>dt</a></code> element for each
+ name.</p>
+
+ <p>Name-value groups may be terms and definitions, metadata topics
+ and values, or any other groups of name-value data.</p>
+
+ <p>The values within a group are alternatives; multiple paragraphs
+ forming part of the same value must all be given within the same
+ <code><a href=#the-dd-element>dd</a></code> element.</p>
+
+ <p>The order of the list of groups, and of the names and values
+ within each group, may be significant.</p>
+
+ <div class=impl>
+
+ <p>If a <code><a href=#the-dl-element>dl</a></code> element is empty, it contains no groups.</p>
+
+ <p>If a <code><a href=#the-dl-element>dl</a></code> element contains non-<a href=#inter-element-whitespace title="inter-element whitespace">whitespace</a> <a href=#text-node title="text
+ node">text nodes</a>, or elements other than <code><a href=#the-dt-element>dt</a></code> and
+ <code><a href=#the-dd-element>dd</a></code>, then those elements or <a href=#text-node title="text node">text
+ nodes</a> do not form part of any groups in that
+ <code><a href=#the-dl-element>dl</a></code>.</p>
+
+ <p>If a <code><a href=#the-dl-element>dl</a></code> element contains only <code><a href=#the-dt-element>dt</a></code>
+ elements, then it consists of one group with names but no
+ values.</p>
+
+ <p>If a <code><a href=#the-dl-element>dl</a></code> element contains only <code><a href=#the-dd-element>dd</a></code>
+ elements, then it consists of one group with values but no
+ names.</p>
+
+ <p>If a <code><a href=#the-dl-element>dl</a></code> element starts with one or more
+ <code><a href=#the-dd-element>dd</a></code> elements, then the first group has no associated
+ name.</p>
+
+ <p>If a <code><a href=#the-dl-element>dl</a></code> element ends with one or more
+ <code><a href=#the-dt-element>dt</a></code> elements, then the last group has no associated
+ value.</p>
+
+ <p class=note>When a <code><a href=#the-dl-element>dl</a></code> element doesn't match its
+ content model, it is often due to accidentally using <code><a href=#the-dd-element>dd</a></code>
+ elements in the place of <code><a href=#the-dt-element>dt</a></code> elements and vice
+ versa. Conformance checkers can spot such mistakes and might be able
+ to advise authors how to correctly use the markup.</p>
+
+ </div>
+
+ <div class=example>
+ <p>In the following example, one entry ("Authors") is linked to two
+ values ("John" and "Luke").</p>
+ <pre>&lt;dl&gt;
+ &lt;dt&gt; Authors
+ &lt;dd&gt; John
+ &lt;dd&gt; Luke
+ &lt;dt&gt; Editor
+ &lt;dd&gt; Frank
+&lt;/dl&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>In the following example, one definition is linked to two
+ terms.</p>
+ <pre>&lt;dl&gt;
+ &lt;dt lang="en-US"&gt; &lt;dfn&gt;color&lt;/dfn&gt; &lt;/dt&gt;
+ &lt;dt lang="en-GB"&gt; &lt;dfn&gt;colour&lt;/dfn&gt; &lt;/dt&gt;
+ &lt;dd&gt; A sensation which (in humans) derives from the ability of
+ the fine structure of the eye to distinguish three differently
+ filtered analyses of a view. &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>The following example illustrates the use of the <code><a href=#the-dl-element>dl</a></code>
+ element to mark up metadata of sorts. At the end of the example,
+ one group has two metadata labels ("Authors" and "Editors") and two
+ values ("Robert Rothman" and "Daniel Jackson").</p>
+ <pre>&lt;dl&gt;
+ &lt;dt&gt; Last modified time &lt;/dt&gt;
+ &lt;dd&gt; 2004-12-23T23:33Z &lt;/dd&gt;
+ &lt;dt&gt; Recommended update interval &lt;/dt&gt;
+ &lt;dd&gt; 60s &lt;/dd&gt;
+ &lt;dt&gt; Authors &lt;/dt&gt;
+ &lt;dt&gt; Editors &lt;/dt&gt;
+ &lt;dd&gt; Robert Rothman &lt;/dd&gt;
+ &lt;dd&gt; Daniel Jackson &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows the <code><a href=#the-dl-element>dl</a></code> element used to
+ give a set of instructions. The order of the instructions here is
+ important (in the other examples, the order of the blocks was not
+ important).</p>
+
+ <pre>&lt;p&gt;Determine the victory points as follows (use the
+first matching case):&lt;/p&gt;
+&lt;dl&gt;
+ &lt;dt&gt; If you have exactly five gold coins &lt;/dt&gt;
+ &lt;dd&gt; You get five victory points &lt;/dd&gt;
+ &lt;dt&gt; If you have one or more gold coins, and you have one or more silver coins &lt;/dt&gt;
+ &lt;dd&gt; You get two victory points &lt;/dd&gt;
+ &lt;dt&gt; If you have one or more silver coins &lt;/dt&gt;
+ &lt;dd&gt; You get one victory point &lt;/dd&gt;
+ &lt;dt&gt; Otherwise &lt;/dt&gt;
+ &lt;dd&gt; You get no victory points &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>The following snippet shows a <code><a href=#the-dl-element>dl</a></code> element being used
+ as a glossary. Note the use of <code><a href=#the-dfn-element>dfn</a></code> to indicate the
+ word being defined.</p>
+ <pre>&lt;dl&gt;
+ &lt;dt&gt;&lt;dfn&gt;Apartment&lt;/dfn&gt;, n.&lt;/dt&gt;
+ &lt;dd&gt;An execution context grouping one or more threads with one or
+ more COM objects.&lt;/dd&gt;
+ &lt;dt&gt;&lt;dfn&gt;Flat&lt;/dfn&gt;, n.&lt;/dt&gt;
+ &lt;dd&gt;A deflated tire.&lt;/dd&gt;
+ &lt;dt&gt;&lt;dfn&gt;Home&lt;/dfn&gt;, n.&lt;/dt&gt;
+ &lt;dd&gt;The user's login directory.&lt;/dd&gt;
+&lt;/dl&gt;</pre>
+ </div>
+
+ <p class=note>The <code><a href=#the-dl-element>dl</a></code> element is inappropriate for
+ marking up dialogue. <a href=#conversations>Examples of how to
+ mark up dialogue</a> are shown below.</p>
+
+
+
+ <h4 id=the-dt-element><span class=secno>4.5.9 </span>The <dfn><code>dt</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Before <code><a href=#the-dd-element>dd</a></code> or <code><a href=#the-dt-element>dt</a></code> elements inside <code><a href=#the-dl-element>dl</a></code> elements.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-dt-element>dt</a></code> element <a href=#represents>represents</a> the term, or
+ name, part of a term-description group in a description list
+ (<code><a href=#the-dl-element>dl</a></code> element).</p>
+
+ <p class=note>The <code><a href=#the-dt-element>dt</a></code> element itself, when used in a
+ <code><a href=#the-dl-element>dl</a></code> element, does not indicate that its contents are a
+ term being defined, but this can be indicated using the
+ <code><a href=#the-dfn-element>dfn</a></code> element.</p>
+
+ <div class=example>
+
+ <p>This example shows a list of frequently asked questions (a FAQ)
+ marked up using the <code><a href=#the-dt-element>dt</a></code> element for questions and the
+ <code><a href=#the-dd-element>dd</a></code> element for answers.</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;FAQ&lt;/h1&gt;
+ &lt;dl&gt;
+ &lt;dt&gt;What do we want?&lt;/dt&gt;
+ &lt;dd&gt;Our data.&lt;/dd&gt;
+ &lt;dt&gt;When do we want it?&lt;/dt&gt;
+ &lt;dd&gt;Now.&lt;/dd&gt;
+ &lt;dt&gt;Where is it?&lt;/dt&gt;
+ &lt;dd&gt;We are not sure.&lt;/dd&gt;
+ &lt;/dl&gt;
+&lt;/article&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-dd-element><span class=secno>4.5.10 </span>The <dfn><code>dd</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>After <code><a href=#the-dt-element>dt</a></code> or <code><a href=#the-dd-element>dd</a></code> elements inside <code><a href=#the-dl-element>dl</a></code> elements.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-dd-element>dd</a></code> element <a href=#represents>represents</a> the
+ description, definition, or value, part of a term-description group
+ in a description list (<code><a href=#the-dl-element>dl</a></code> element).</p>
+
+ <div class=example>
+
+ <p>A <code><a href=#the-dl-element>dl</a></code> can be used to define a vocabulary list, like
+ in a dictionary. In the following example, each entry, given by a
+ <code><a href=#the-dt-element>dt</a></code> with a <code><a href=#the-dfn-element>dfn</a></code>, has several
+ <code><a href=#the-dd-element>dd</a></code>s, showing the various parts of the definition.</p>
+
+ <!-- the actual pronunciations below are nonsense. -->
+ <pre>&lt;dl&gt;
+ &lt;dt&gt;&lt;dfn&gt;happiness&lt;/dfn&gt;&lt;/dt&gt;
+ &lt;dd class="pronunciation"&gt;/'h&aelig; p. nes/&lt;/dd&gt;
+ &lt;dd class="part-of-speech"&gt;&lt;i&gt;&lt;abbr&gt;n.&lt;/abbr&gt;&lt;/i&gt;&lt;/dd&gt;
+ &lt;dd&gt;The state of being happy.&lt;/dd&gt;
+ &lt;dd&gt;Good fortune; success. &lt;q&gt;Oh &lt;b&gt;happiness&lt;/b&gt;! It worked!&lt;/q&gt;&lt;/dd&gt;
+ &lt;dt&gt;&lt;dfn&gt;rejoice&lt;/dfn&gt;&lt;/dt&gt;
+ &lt;dd class="pronunciation"&gt;/ri jois'/&lt;/dd&gt;
+ &lt;dd&gt;&lt;i class="part-of-speech"&gt;&lt;abbr&gt;v.intr.&lt;/abbr&gt;&lt;/i&gt; To be delighted oneself.&lt;/dd&gt;
+ &lt;dd&gt;&lt;i class="part-of-speech"&gt;&lt;abbr&gt;v.tr.&lt;/abbr&gt;&lt;/i&gt; To cause one to be delighted.&lt;/dd&gt;
+&lt;/dl&gt;</pre>
+ </div>
+
+
+ <h4 id=the-figure-element><span class=secno>4.5.11 </span>The <dfn><code>figure</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Either: One <code><a href=#the-figcaption-element>figcaption</a></code> element followed by <a href=#flow-content>flow content</a>.</dd>
+ <dd>Or: <a href=#flow-content>Flow content</a> followed by one <code><a href=#the-figcaption-element>figcaption</a></code> element.</dd>
+ <dd>Or: <a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><!-- v2: Add a <credit> element for photo credits --><p>The <code><a href=#the-figure-element>figure</a></code> element <a href=#represents>represents</a> some
+ <a href=#flow-content>flow content</a>, optionally with a caption, that is
+ self-contained and is typically referenced as a single unit from the
+ main flow of the document.</p>
+
+ <p>The element can thus be used to annotate illustrations, diagrams,
+ photos, code listings, etc, that are referred to from the main
+ content of the document, but that could, without affecting the flow
+ of the document, be moved away from that primary content, e.g. to
+ the side of the page, to dedicated pages, or to an appendix.</p>
+
+ <p>The <span class=impl>first</span> <code><a href=#the-figcaption-element>figcaption</a></code>
+ element child of the element, if any, represents the caption of the
+ <code><a href=#the-figure-element>figure</a></code> element's contents. If there is no child
+ <code><a href=#the-figcaption-element>figcaption</a></code> element, then there is no caption.</p>
+
+ <div class=example>
+
+ <p>This example shows the <code><a href=#the-figure-element>figure</a></code> element to mark up a
+ code listing.</p>
+
+ <pre>&lt;p&gt;In &lt;a href="#l4"&gt;listing 4&lt;/a&gt; we see the primary core interface
+API declaration.&lt;/p&gt;
+&lt;figure id="l4"&gt;
+ &lt;figcaption&gt;Listing 4. The primary core interface API declaration.&lt;/figcaption&gt;
+ &lt;pre&gt;&lt;code&gt;interface PrimaryCore {
+ boolean verifyDataLine();
+ void sendData(in sequence&amp;lt;byte&gt; data);
+ void initSelfDestruct();
+}&lt;/code&gt;&lt;/pre&gt;
+&lt;/figure&gt;
+&lt;p&gt;The API is designed to use UTF-8.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here we see a <code><a href=#the-figure-element>figure</a></code> element to mark up a
+ photo.</p>
+
+ <pre>&lt;figure&gt;
+ &lt;img src="bubbles-work.jpeg"
+ alt="Bubbles, sitting in his office chair, works on his
+ latest project intently."&gt;
+ &lt;figcaption&gt;Bubbles at work&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, we see an image that is <em>not</em>
+ a figure, as well as an image and a video that are.</p>
+
+ <pre>&lt;h2&gt;Malinko's comics&lt;/h2&gt;
+
+&lt;p&gt;This case centered on some sort of "intellectual property"
+infringement related to a comic (see Exhibit A). The suit started
+after a trailer ending with these words:
+
+&lt;blockquote&gt;
+ &lt;img src="promblem-packed-action.png" alt="ROUGH COPY! Promblem-Packed Action!"&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;...was aired. A lawyer, armed with a Bigger Notebook, launched a
+preemptive strike using snowballs. A complete copy of the trailer is
+included with Exhibit B.
+
+&lt;figure&gt;
+ &lt;img src="ex-a.png" alt="Two squiggles on a dirty piece of paper."&gt;
+ &lt;figcaption&gt;Exhibit A. The alleged &lt;cite&gt;rough copy&lt;/cite&gt; comic.&lt;/figcaption&gt;
+&lt;/figure&gt;
+
+&lt;figure&gt;
+ &lt;video src="ex-b.mov"&gt;&lt;/video&gt;
+ &lt;figcaption&gt;Exhibit B. The &lt;cite&gt;Rough Copy&lt;/cite&gt; trailer.&lt;/figcaption&gt;
+&lt;/figure&gt;
+
+&lt;p&gt;The case was resolved out of court.</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here, a part of a poem is marked up using
+ <code><a href=#the-figure-element>figure</a></code>.</p>
+
+ <pre>&lt;figure&gt;
+ &lt;p&gt;'Twas brillig, and the slithy toves&lt;br&gt;
+ Did gyre and gimble in the wabe;&lt;br&gt;
+ All mimsy were the borogoves,&lt;br&gt;
+ And the mome raths outgrabe.&lt;/p&gt;
+ &lt;figcaption&gt;&lt;cite&gt;Jabberwocky&lt;/cite&gt; (first verse). Lewis Carroll, 1832-98&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, which could be part of a much larger work
+ discussing a castle, the figure has three images in it.</p>
+
+ <pre>&lt;figure&gt;
+ &lt;img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423."
+ alt="The castle has one tower, and a tall wall around it."&gt;
+ &lt;img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858."
+ alt="The castle now has two towers and two walls."&gt;
+ &lt;img src="castle1999.jpeg" title="Film photograph. Peter Jankle, 1999."
+ alt="The castle lies in ruins, the original tower all that remains in one piece."&gt;
+ &lt;figcaption&gt;The castle through the ages: 1423, 1858, and 1999 respectively.&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-figcaption-element><span class=secno>4.5.12 </span>The <dfn><code>figcaption</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As the first or last child of a <code><a href=#the-figure-element>figure</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-figcaption-element>figcaption</a></code> element <a href=#represents>represents</a> a
+ caption or legend for the rest of the contents of the
+ <code><a href=#the-figcaption-element>figcaption</a></code> element's parent <code><a href=#the-figure-element>figure</a></code>
+ element<span class=impl>, if any</span>.</p>
+
+
+
+ <h4 id=the-div-element><span class=secno>4.5.13 </span>The <dfn><code>div</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmldivelement>HTMLDivElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-div-element>div</a></code> element has no special meaning at all. It
+ <a href=#represents>represents</a> its children. It can be used with the <code title=attr-class><a href=#classes>class</a></code>, <code title=attr-lang><a href=#attr-lang>lang</a></code>, and <code title=attr-title><a href=#the-title-attribute>title</a></code> attributes to mark up semantics
+ common to a group of consecutive elements.</p>
+
+ <p class=note>Authors are strongly encouraged to view the
+ <code><a href=#the-div-element>div</a></code> element as an element of last resort, for when no
+ other element is suitable. Use of the <code><a href=#the-div-element>div</a></code> element
+ instead of more appropriate elements leads to poor accessibility for
+ readers and poor maintainability for authors.</p>
+
+ <div class=example>
+
+ <p>For example, a blog post would be marked up using
+ <code><a href=#the-article-element>article</a></code>, a chapter using <code><a href=#the-section-element>section</a></code>, a
+ page's navigation aids using <code><a href=#the-nav-element>nav</a></code>, and a group of form
+ controls using <code><a href=#the-fieldset-element>fieldset</a></code>.</p>
+
+ <p>On the other hand, <code><a href=#the-div-element>div</a></code> elements can be useful for
+ stylistic purposes or to wrap multiple paragraphs within a section
+ that are all to be annotated in a similar way. In the following
+ example, we see <code><a href=#the-div-element>div</a></code> elements used as a way to set the
+ language of two paragraphs at once, instead of setting the language
+ on the two paragraph elements separately:</p>
+
+ <pre>&lt;article lang="en-US"&gt;
+ &lt;h1&gt;My use of language and my cats&lt;/h1&gt;
+ &lt;p&gt;My cat's behavior hasn't changed much since her absence, except
+ that she plays her new physique to the neighbors regularly, in an
+ attempt to get pets.&lt;/p&gt;
+ &lt;div lang="en-GB"&gt;
+ &lt;p&gt;My other cat, coloured black and white, is a sweetie. He followed
+ us to the pool today, walking down the pavement with us. Yesterday
+ he apparently visited our neighbours. I wonder if he recognises that
+ their flat is a mirror image of ours.&lt;/p&gt;
+ &lt;p&gt;Hm, I just noticed that in the last paragraph I used British
+ English. But I'm supposed to write in American English. So I
+ shouldn't say "pavement" or "flat" or "colour"...&lt;/p&gt;
+ &lt;/div&gt;
+ &lt;p&gt;I should say "sidewalk" and "apartment" and "color"!&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ </div>
+
+
+ <h3 id=text-level-semantics><span class=secno>4.6 </span>Text-level semantics</h3>
+
+ <h4 id=the-a-element><span class=secno>4.6.1 </span>The <dfn><code>a</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd>When the element only contains <a href=#phrasing-content>phrasing content</a>: <a href=#phrasing-content>phrasing content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#transparent>Transparent</a>, but there must be no <a href=#interactive-content>interactive content</a> descendant.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code></dd>
+ <dd><code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code></dd>
+<!--PING-->
+ <dd><code title=attr-hyperlink-ping><a href=#ping>ping</a></code></dd>
+<!--PING-->
+ <dd><code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code></dd>
+ <dd><code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code></dd>
+ <dd><code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code></dd>
+ <dd><code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlanchorelement>HTMLAnchorElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ stringifier attribute DOMString <a href=#dom-a-href title=dom-a-href>href</a>;
+ attribute DOMString <a href=#dom-a-target title=dom-a-target>target</a>;
+<!--PING-->
+ attribute DOMString <a href=#dom-a-ping title=dom-a-ping>ping</a>;
+<!--PING-->
+ attribute DOMString <a href=#dom-a-rel title=dom-a-rel>rel</a>;
+ readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-a-rellist title=dom-a-relList>relList</a>;
+ attribute DOMString <a href=#dom-a-media title=dom-a-media>media</a>;
+ attribute DOMString <a href=#dom-a-hreflang title=dom-a-hreflang>hreflang</a>;
+ attribute DOMString <a href=#dom-a-type title=dom-a-type>type</a>;
+
+ attribute DOMString <a href=#dom-a-text title=dom-a-text>text</a>;
+
+ // <a href=#url-decomposition-idl-attributes>URL decomposition IDL attributes</a>
+ attribute DOMString <a href=#dom-a-protocol title=dom-a-protocol>protocol</a>;
+ attribute DOMString <a href=#dom-a-host title=dom-a-host>host</a>;
+ attribute DOMString <a href=#dom-a-hostname title=dom-a-hostname>hostname</a>;
+ attribute DOMString <a href=#dom-a-port title=dom-a-port>port</a>;
+ attribute DOMString <a href=#dom-a-pathname title=dom-a-pathname>pathname</a>;
+ attribute DOMString <a href=#dom-a-search title=dom-a-search>search</a>;
+ attribute DOMString <a href=#dom-a-hash title=dom-a-hash>hash</a>;
+};</pre>
+ </dd>
+ </dl><p>If the <code><a href=#the-a-element>a</a></code> element has an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, then it
+ <a href=#represents>represents</a> a <a href=#hyperlink>hyperlink</a> (a hypertext
+ anchor).</p>
+
+ <!-- v2: Eric Meyer requests the ability to nest links so that a big
+ hyperlink, e.g. representing a calendar event, can be clickable,
+ while within it there are subareas that represent links to distinct
+ areas, e.g. a link to see photos of the event, or to edit the event,
+ or some such. -->
+
+ <p>If the <code><a href=#the-a-element>a</a></code> element has no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, then the element
+ <a href=#represents>represents</a> a placeholder for where a link might
+ otherwise have been placed, if it had been relevant.</p>
+
+ <p>The <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>,
+<!--PING-->
+ <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>,
+<!--PING-->
+ <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes must be omitted
+ if the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute is
+ not present.</p>
+
+ <div class=example>
+ <p>If a site uses a consistent navigation toolbar on every page,
+ then the link that would normally link to the page itself could be
+ marked up using an <code><a href=#the-a-element>a</a></code> element:</p>
+ <pre>&lt;nav&gt;
+ &lt;ul&gt;
+ &lt;li&gt; &lt;a href="/"&gt;Home&lt;/a&gt; &lt;/li&gt;
+ &lt;li&gt; &lt;a href="/news"&gt;News&lt;/a&gt; &lt;/li&gt;
+ &lt;li&gt; &lt;a&gt;Examples&lt;/a&gt; &lt;/li&gt;
+ &lt;li&gt; &lt;a href="/legal"&gt;Legal&lt;/a&gt; &lt;/li&gt;
+ &lt;/ul&gt;
+&lt;/nav&gt;</pre>
+ </div>
+
+ <div class=impl>
+
+ <p>The <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>, <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>
+<!--PING-->
+ and <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>
+<!--PING-->
+ attributes affect what
+ happens when users <a href=#following-hyperlinks title="following hyperlinks">follow
+ hyperlinks</a> created using the <code><a href=#the-a-element>a</a></code> element. The
+ <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes may be used to
+ indicate to the user the likely nature of the target resource before
+ the user follows the link.</p>
+
+ <p>The <a href=#activation-behavior>activation behavior</a> of <code><a href=#the-a-element>a</a></code> elements
+ that represent <a href=#hyperlink title=hyperlink>hyperlinks</a> is to run
+ the following steps:</p>
+
+ <ol><li><p>If the <code title=event-DOMActivate><a href=#event-domactivate>DOMActivate</a></code>
+ event in question is not <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> (i.e. a <code title=dom-click><a href=#dom-click>click()</a></code> method call was the reason for the
+ event being dispatched), and the <code><a href=#the-a-element>a</a></code> element's <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute is such that
+ applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
+ browsing context name</a>, using the value of the <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute as the
+ browsing context name, would result in there not being a chosen
+ browsing context, then raise an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code>
+ exception and abort these steps.</li>
+
+ <li><p>If the target of the <code title=event-click><a href=#event-click>click</a></code>
+ event is an <code><a href=#the-img-element>img</a></code> element with an <code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> attribute specified, then
+ server-side image map processing must be performed, as follows:</p>
+
+ <ol><!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A...%3Ca%20href%3D%22%23%22%3E%3Cimg%20ismap%20usemap%3D%22%23a%22%20src%3D/resources/images/smallcats%3E%3C/a%3E%0A%3Cmap%20name%3Da%3E%3Carea%20shape%3Drect%20coords%3D0%2C0%2C50%2C50%20href%3Db%3E%3C/map%3E --><li>If the <code title=event-DOMActivate><a href=#event-domactivate>DOMActivate</a></code>
+ event was dispatched as the result of a real
+ pointing-device-triggered <code title=event-click><a href=#event-click>click</a></code>
+ event on the <code><a href=#the-img-element>img</a></code> element, then let <var title="">x</var> be the distance in CSS pixels from the left edge
+ of the image's left border, if it has one, or the left edge of
+ the image otherwise, to the location of the click, and let <var title="">y</var> be the distance in CSS pixels from the top edge
+ of the image's top border, if it has one, or the top edge of the
+ image otherwise, to the location of the click. Otherwise, let
+ <var title="">x</var> and <var title="">y</var> be zero.</li>
+
+ <li>Let the <dfn id=hyperlink-suffix><var>hyperlink suffix</var></dfn> be a U+003F
+ QUESTION MARK character, the value of <var title="">x</var>
+ expressed as a base-ten integer using ASCII digits, a U+002C
+ COMMA character (,), and the value of <var title="">y</var>
+ expressed as a base-ten integer using ASCII digits. ASCII digits
+ are the characters in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9).</li>
+
+ </ol></li>
+
+ <li><p>Finally, the user agent must <a href=#following-hyperlinks title="following
+ hyperlinks">follow the hyperlink</a> defined by the
+ <code><a href=#the-a-element>a</a></code> element. If the steps above defined a <var><a href=#hyperlink-suffix>hyperlink
+ suffix</a></var>, then take that into account when following the
+ hyperlink.</li>
+
+ </ol></div>
+
+ <dl class=domintro><dt><var title="">a</var> . <code title=dom-a-text><a href=#dom-a-text>text</a></code></dt>
+
+ <dd>
+
+ <p>Same as <code><a href=#textcontent>textContent</a></code>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The IDL attributes <dfn id=dom-a-href title=dom-a-href><code>href</code></dfn>,
+<!--PING-->
+ <dfn id=dom-a-ping title=dom-a-ping><code>ping</code></dfn>,
+<!--PING-->
+ <dfn id=dom-a-target title=dom-a-target><code>target</code></dfn>, <dfn id=dom-a-rel title=dom-a-rel><code>rel</code></dfn>, <dfn id=dom-a-media title=dom-a-media><code>media</code></dfn>, <dfn id=dom-a-hreflang title=dom-a-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-a-type title=dom-a-type><code>type</code></dfn>, must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The IDL attribute <dfn id=dom-a-rellist title=dom-a-rellist><code>relList</code></dfn> must
+ <a href=#reflect>reflect</a> the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>
+ content attribute.</p>
+
+ <p>The <dfn id=dom-a-text title=dom-a-text><code>text</code></dfn> IDL
+ attribute, on getting, must return the same value as the
+ <code><a href=#textcontent>textContent</a></code> IDL attribute on the element, and on
+ setting, must act as if the <code><a href=#textcontent>textContent</a></code> IDL attribute
+ on the element had been set to the new value.</p>
+
+ <p>The <code><a href=#the-a-element>a</a></code> element also supports the complement of
+ <a href=#url-decomposition-idl-attributes>URL decomposition IDL attributes</a>, <dfn id=dom-a-protocol title=dom-a-protocol><code>protocol</code></dfn>, <dfn id=dom-a-host title=dom-a-host><code>host</code></dfn>, <dfn id=dom-a-port title=dom-a-port><code>port</code></dfn>, <dfn id=dom-a-hostname title=dom-a-hostname><code>hostname</code></dfn>, <dfn id=dom-a-pathname title=dom-a-pathname><code>pathname</code></dfn>, <dfn id=dom-a-search title=dom-a-search><code>search</code></dfn>, and <dfn id=dom-a-hash title=dom-a-hash><code>hash</code></dfn>. These must follow the
+ rules given for URL decomposition IDL attributes, with the <a href=#concept-uda-input title=concept-uda-input>input</a> being the result of <a href=#resolve-a-url title="resolve a url">resolving</a> the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute relative to the
+ element, if there is such an attribute and resolving it is
+ successful, or the empty string otherwise; and the <a href=#concept-uda-setter title=concept-uda-setter>common setter action</a> being the
+ same as setting the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute to the new output
+ value.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The <code><a href=#the-a-element>a</a></code> element may be wrapped around entire
+ paragraphs, lists, tables, and so forth, even entire sections, so
+ long as there is no interactive content within (e.g. buttons or
+ other links). This example shows how this can be used to make an
+ entire advertising block into a link:</p>
+
+ <pre>&lt;aside class="advertising"&gt;
+ &lt;h1&gt;Advertising&lt;/h1&gt;
+ &lt;a href="http://ad.example.com/?adid=1929&amp;amp;pubid=1422"&gt;
+ &lt;section&gt;
+ &lt;h1&gt;Mellblomatic 9000!&lt;/h1&gt;
+ &lt;p&gt;Turn all your widgets into mellbloms!&lt;/p&gt;
+ &lt;p&gt;Only $9.99 plus shipping and handling.&lt;/p&gt;
+ &lt;/section&gt;
+ &lt;/a&gt;
+ &lt;a href="http://ad.example.com/?adid=375&amp;amp;pubid=1422"&gt;
+ &lt;section&gt;
+ &lt;h1&gt;The Mellblom Browser&lt;/h1&gt;
+ &lt;p&gt;Web browsing at the speed of light.&lt;/p&gt;
+ &lt;p&gt;No other browser goes faster!&lt;/p&gt;
+ &lt;/section&gt;
+ &lt;/a&gt;
+&lt;/aside&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-em-element><span class=secno>4.6.2 </span>The <dfn><code>em</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-em-element>em</a></code> element <a href=#represents>represents</a> stress
+ emphasis of its contents.</p>
+
+ <p>The level of emphasis that a particular piece of content has is
+ given by its number of ancestor <code><a href=#the-em-element>em</a></code> elements.</p>
+
+ <p>The placement of emphasis changes the meaning of the sentence.
+ The element thus forms an integral part of the content. The precise
+ way in which emphasis is used in this way depends on the
+ language.</p>
+
+ <div class=example>
+
+ <p>These examples show how changing the emphasis changes the
+ meaning. First, a general statement of fact, with no emphasis:</p>
+
+ <pre>&lt;p&gt;Cats are cute animals.&lt;/p&gt;</pre>
+
+ <p>By emphasizing the first word, the statement implies that the
+ kind of animal under discussion is in question (maybe someone is
+ asserting that dogs are cute):</p>
+
+ <pre>&lt;p&gt;&lt;em&gt;Cats&lt;/em&gt; are cute animals.&lt;/p&gt;</pre>
+
+ <p>Moving the emphasis to the verb, one highlights that the truth
+ of the entire sentence is in question (maybe someone is saying cats
+ are not cute):</p>
+
+ <pre>&lt;p&gt;Cats &lt;em&gt;are&lt;/em&gt; cute animals.&lt;/p&gt;</pre>
+
+ <p>By moving it to the adjective, the exact nature of the cats
+ is reasserted (maybe someone suggested cats were <em>mean</em>
+ animals):</p>
+
+ <pre>&lt;p&gt;Cats are &lt;em&gt;cute&lt;/em&gt; animals.&lt;/p&gt;</pre>
+
+ <p>Similarly, if someone asserted that cats were vegetables,
+ someone correcting this might emphasize the last word:</p>
+
+ <pre>&lt;p&gt;Cats are cute &lt;em&gt;animals&lt;/em&gt;.&lt;/p&gt;</pre>
+
+ <p>By emphasizing the entire sentence, it becomes clear that the
+ speaker is fighting hard to get the point across. This kind of
+ emphasis also typically affects the punctuation, hence the
+ exclamation mark here.</p>
+
+ <pre>&lt;p&gt;&lt;em&gt;Cats are cute animals!&lt;/em&gt;&lt;/p&gt;</pre>
+
+ <p>Anger mixed with emphasizing the cuteness could lead to markup
+ such as:</p>
+
+ <pre>&lt;p&gt;&lt;em&gt;Cats are &lt;em&gt;cute&lt;/em&gt; animals!&lt;/em&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=note>
+
+ <p>The <code><a href=#the-em-element>em</a></code> element isn't a generic "italics"
+ element. Sometimes, text is intended to stand out from the rest of
+ the paragraph, as if it was in a different mood or voice. For this,
+ the <code><a href=#the-i-element>i</a></code> element is more appropriate.</p>
+
+ <p>The <code><a href=#the-em-element>em</a></code> element also isn't intended to convey
+ importance; for that purpose, the <code><a href=#the-strong-element>strong</a></code> element is
+ more appropriate.</p>
+
+ <!--
+
+ Thus the following is a bad use of <em>:
+
+ <p><em>Note</em>: ...</p>
+
+ You should use <strong> or <i> for this instead (depending on
+ exactly what you're doing).
+
+ -->
+
+ </div>
+
+
+
+ <h4 id=the-strong-element><span class=secno>4.6.3 </span>The <dfn><code>strong</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-strong-element>strong</a></code> element <a href=#represents>represents</a> strong
+ importance for its contents.</p>
+
+ <p>The relative level of importance of a piece of content is given
+ by its number of ancestor <code><a href=#the-strong-element>strong</a></code> elements; each
+ <code><a href=#the-strong-element>strong</a></code> element increases the importance of its
+ contents.</p>
+
+ <p>Changing the importance of a piece of text with the
+ <code><a href=#the-strong-element>strong</a></code> element does not change the meaning of the
+ sentence.</p>
+
+ <div class=example>
+ <p>Here is an example of a warning notice in a game, with the
+ various parts marked up according to how important they are:</p>
+ <!-- DO NOT REFLOW THIS EXAMPLE it has been carefully balanced -->
+ <pre>&lt;p&gt;&lt;strong&gt;Warning.&lt;/strong&gt; This dungeon is dangerous.
+&lt;strong&gt;Avoid the ducks.&lt;/strong&gt; Take any gold you find.
+&lt;strong&gt;&lt;strong&gt;Do not take any of the diamonds&lt;/strong&gt;,
+they are explosive and &lt;strong&gt;will destroy anything within
+ten meters.&lt;/strong&gt;&lt;/strong&gt; You have been warned.&lt;/p&gt;</pre>
+ </div>
+
+
+ <h4 id=the-small-element><span class=secno>4.6.4 </span>The <dfn><code>small</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-small-element>small</a></code> element <a href=#represents>represents</a> side
+ comments such as small print.</p>
+
+ <p class=note>Small print typically features disclaimers, caveats,
+ legal restrictions, or copyrights. Small print is also sometimes
+ used for attribution, or for satisfying licensing requirements.</p>
+
+ <p class=note>The <code><a href=#the-small-element>small</a></code> element does not
+ "de-emphasize" or lower the importance of text emphasized by the
+ <code><a href=#the-em-element>em</a></code> element or marked as important with the
+ <code><a href=#the-strong-element>strong</a></code> element. To mark text as not emphasized or
+ important, simply do not mark it up with the <code><a href=#the-em-element>em</a></code> or
+ <code><a href=#the-strong-element>strong</a></code> elements respectively.</p>
+
+ <p>The <code><a href=#the-small-element>small</a></code> element should not be used for extended
+ spans of text, such as multiple paragraphs, lists, or sections of
+ text. It is only intended for short runs of text. The text of a page
+ listing terms of use, for instance, would not be a suitable
+ candidate for the <code><a href=#the-small-element>small</a></code> element: in such a case, the
+ text is not a side comment, it is the main content of the page.</p>
+
+ <div class=example>
+
+ <p>In this example the footer contains contact information and a
+ copyright notice.</p>
+
+ <pre>&lt;footer&gt;
+ &lt;address&gt;
+ For more details, contact
+ &lt;a href="mailto:js@example.com"&gt;John Smith&lt;/a&gt;.
+ &lt;/address&gt;
+ &lt;p&gt;&lt;small&gt;&copy; copyright 2038 Example Corp.&lt;/small&gt;&lt;/p&gt;
+&lt;/footer&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this second example, the <code><a href=#the-small-element>small</a></code> element is used
+ for a side comment in an article.</p>
+
+ <pre>&lt;p&gt;Example Corp today announced record profits for the
+second quarter &lt;small&gt;(Full Disclosure: Foo News is a subsidiary of
+Example Corp)&lt;/small&gt;, leading to speculation about a third quarter
+merger with Demo Group.&lt;/p&gt;</pre>
+
+ <p>This is distinct from a sidebar, which might be multiple
+ paragraphs long and is removed from the main flow of text. In the
+ following example, we see a sidebar from the same article. This
+ sidebar also has small print, indicating the source of the
+ information in the sidebar.</p>
+
+ <pre>&lt;aside&gt;
+ &lt;h1&gt;Example Corp&lt;/h1&gt;
+ &lt;p&gt;This company mostly creates small software and Web
+ sites.&lt;/p&gt;
+ &lt;p&gt;The Example Corp company mission is "To provide entertainment
+ and news on a sample basis".&lt;/p&gt;
+ &lt;p&gt;&lt;small&gt;Information obtained from &lt;a
+ href="http://example.com/about.html"&gt;example.com&lt;/a&gt; home
+ page.&lt;/small&gt;&lt;/p&gt;
+&lt;/aside&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this last example, the <code><a href=#the-small-element>small</a></code> element is marked
+ as being <em>important</em> small print.</p>
+
+ <pre>&lt;p&gt;&lt;strong&gt;&lt;small&gt;Continued use of this service will result in a kiss.&lt;/small&gt;&lt;/strong&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-cite-element><span class=secno>4.6.5 </span>The <dfn><code>cite</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-cite-element>cite</a></code> element <a href=#represents>represents</a> the title
+ of a work (e.g.
+ a book,
+ a paper,
+ an essay,
+ a poem,
+ a score,
+ a song,
+ a script,
+ a film,
+ a TV show,
+ a game,
+ a sculpture,
+ a painting,
+ a theatre production,
+ a play,
+ an opera,
+ a musical,
+ an exhibition,
+ a legal case report,
+ etc). This can be a work that is being quoted or
+ referenced in detail (i.e. a citation), or it can just be a work
+ that is mentioned in passing.</p>
+
+ <p>A person's name is not the title of a work &mdash; even if people
+ call that person a piece of work &mdash; and the element must
+ therefore not be used to mark up people's names. (In some cases, the
+ <code><a href=#the-b-element>b</a></code> element might be appropriate for names; e.g. in a
+ gossip article where the names of famous people are keywords
+ rendered with a different style to draw attention to them. In other
+ cases, if an element is <em>really</em> needed, the
+ <code><a href=#the-span-element>span</a></code> element can be used.)</p>
+
+<!--(some people argue a ship is a work)
+ <p>A ship is similarly not a work, and the element must not be used
+ to mark up ship names (the <code>i</code> element can be used for
+ that purpose).</p>
+-->
+
+ <div class=example>
+
+ <p>This next example shows a typical use of the <code><a href=#the-cite-element>cite</a></code>
+ element:</p>
+
+ <pre>&lt;p&gt;My favorite book is &lt;cite&gt;The Reality Dysfunction&lt;/cite&gt; by
+Peter F. Hamilton. My favorite comic is &lt;cite&gt;Pearls Before
+Swine&lt;/cite&gt; by Stephan Pastis. My favorite track is &lt;cite&gt;Jive
+Samba&lt;/cite&gt; by the Cannonball Adderley Sextet.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>This is correct usage:</p>
+
+ <pre>&lt;p&gt;According to the Wikipedia article &lt;cite&gt;HTML&lt;/cite&gt;, as it
+stood in mid-February 2008, leaving attribute values unquoted is
+unsafe. This is obviously an over-simplification.&lt;/p&gt;</pre>
+
+ <p>The following, however, is incorrect usage, as the
+ <code><a href=#the-cite-element>cite</a></code> element here is containing far more than the
+ title of the work:</p>
+
+ <pre class=bad>&lt;!-- do not copy this example, it is an example of bad usage! --&gt;
+&lt;p&gt;According to &lt;cite&gt;the Wikipedia article on HTML&lt;/cite&gt;, as it
+stood in mid-February 2008, leaving attribute values unquoted is
+unsafe. This is obviously an over-simplification.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The <code><a href=#the-cite-element>cite</a></code> element is obviously a key part of any
+ citation in a bibliography, but it is only used to mark the
+ title:</p>
+
+ <pre>&lt;p&gt;&lt;cite&gt;Universal Declaration of Human Rights&lt;/cite&gt;, United Nations,
+December 1948. Adopted by General Assembly resolution 217 A (III).&lt;/p&gt;</pre>
+
+ </div>
+
+ <p class=note>A <em>citation</em> is not a <em>quote</em> (for
+ which the <code><a href=#the-q-element>q</a></code> element is appropriate).</p>
+
+ <div class=example>
+
+ <p>This is incorrect usage, because <code><a href=#the-cite-element>cite</a></code> is not for
+ quotes:</p>
+
+ <pre>&lt;p&gt;&lt;cite&gt;This is wrong!&lt;/cite&gt;, said Ian.&lt;/p&gt;</pre>
+
+ <p>This is also incorrect usage, because a person is not a
+ work:</p>
+
+ <pre>&lt;p&gt;&lt;q&gt;This is still wrong!&lt;/q&gt;, said &lt;cite&gt;Ian&lt;/cite&gt;.&lt;/p&gt;</pre>
+
+ <p>The correct usage does not use a <code><a href=#the-cite-element>cite</a></code> element:</p>
+
+ <pre>&lt;p&gt;&lt;q&gt;This is correct&lt;/q&gt;, said Ian.&lt;/p&gt;</pre>
+
+ <p>As mentioned above, the <code><a href=#the-b-element>b</a></code> element might be relevant
+ for marking names as being keywords in certain kinds of
+ documents:</p>
+
+ <pre>&lt;p&gt;And then &lt;b&gt;Ian&lt;/b&gt; said &lt;q&gt;this might be right, in a
+gossip column, maybe!&lt;/q&gt;.&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-q-element><span class=secno>4.6.6 </span>The <dfn><code>q</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-q-cite><a href=#attr-q-cite>cite</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlquoteelement>HTMLQuoteElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-q-element>q</a></code> element <a href=#represents>represents</a> some <a href=#phrasing-content title="phrasing content">phrasing content</a> quoted from another
+ source.</p>
+
+ <p>Quotation punctuation (such as quotation marks) that is quoting
+ the contents of the element must not appear immediately before,
+ after, or inside <code><a href=#the-q-element>q</a></code> elements; they will be inserted into
+ the rendering by the user agent.</p>
+
+ <p>Content inside a <code><a href=#the-q-element>q</a></code> element must be quoted from
+ another source, whose address, if it has one, may be cited in the
+ <dfn id=attr-q-cite title=attr-q-cite><code>cite</code></dfn> attribute. The
+ source may be fictional, as when quoting characters in a novel or
+ screenplay.</p>
+
+ <p>If the <code title=attr-q-cite><a href=#attr-q-cite>cite</a></code> attribute is
+ present, it must be a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by
+ spaces</a>. <span class=impl>To obtain the corresponding
+ citation link, the value of the attribute must be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element. User
+ agents should allow users to follow such citation links.</span></p>
+
+ <p>The <code><a href=#the-q-element>q</a></code> element must not be used in place of quotation
+ marks that do not represent quotes; for example, it is inappropriate
+ to use the <code><a href=#the-q-element>q</a></code> element for marking up sarcastic
+ statements.</p>
+
+ <p>The use of <code><a href=#the-q-element>q</a></code> elements to mark up quotations is
+ entirely optional; using explicit quotation punctuation without
+ <code><a href=#the-q-element>q</a></code> elements is just as correct.</p>
+
+ <div class=example>
+
+ <p>Here is a simple example of the use of the <code><a href=#the-q-element>q</a></code>
+ element:</p>
+
+ <pre>&lt;p&gt;The man said &lt;q&gt;Things that are impossible just take
+longer&lt;/q&gt;. I disagreed with him.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example with both an explicit citation link in the
+ <code><a href=#the-q-element>q</a></code> element, and an explicit citation outside:</p>
+
+ <pre>&lt;p&gt;The W3C page &lt;cite&gt;About W3C&lt;/cite&gt; says the W3C's
+mission is &lt;q cite="http://www.w3.org/Consortium/"&gt;To lead the
+World Wide Web to its full potential by developing protocols and
+guidelines that ensure long-term growth for the Web&lt;/q&gt;. I
+disagree with this mission.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, the quotation itself contains a
+ quotation:</p>
+
+ <pre>&lt;p&gt;In &lt;cite&gt;Example One&lt;/cite&gt;, he writes &lt;q&gt;The man
+said &lt;q&gt;Things that are impossible just take longer&lt;/q&gt;. I
+disagreed with him&lt;/q&gt;. Well, I disagree even more!&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, quotation marks are used instead of
+ the <code><a href=#the-q-element>q</a></code> element:</p>
+
+ <pre>&lt;p&gt;His best argument was &#10077;I disagree&#10078;, which
+I thought was laughable.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, there is no quote &mdash; the
+ quotation marks are used to name a word. Use of the <code><a href=#the-q-element>q</a></code>
+ element in this case would be inappropriate.</p>
+
+ <pre>&lt;p&gt;The word "ineffable" could have been used to describe the disaster
+resulting from the campaign's mismanagement.&lt;/p&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-dfn-element><span class=secno>4.6.7 </span>The <dfn><code>dfn</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <code><a href=#the-dfn-element>dfn</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd>Also, the <code title=attr-dfn-title><a href=#attr-dfn-title>title</a></code> attribute has special semantics on this element.</dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-dfn-element>dfn</a></code> element <a href=#represents>represents</a> the defining
+ instance of a term. The <a href=#paragraph title=paragraph>paragraph</a>,
+ <a href=#the-dl-element title=dl>description list group</a>, or <a href=#sectioning-content title="sectioning content">section</a> that is the nearest
+ ancestor of the <code><a href=#the-dfn-element>dfn</a></code> element must also contain the
+ definition(s) for the <a href=#defining-term title="defining term">term</a> given
+ by the <code><a href=#the-dfn-element>dfn</a></code> element.</p>
+
+ <p><dfn id=defining-term>Defining term</dfn>: If the <code><a href=#the-dfn-element>dfn</a></code> element has a
+ <dfn id=attr-dfn-title title=attr-dfn-title><code>title</code></dfn> attribute, then
+ the exact value of that attribute is the term being defined.
+ Otherwise, if it contains exactly one element child node and no
+ child <a href=#text-node title="text node">text nodes</a>, and that child
+ element is an <code><a href=#the-abbr-element>abbr</a></code> element with a <code title=attr-abbr-title><a href=#attr-abbr-title>title</a></code> attribute, then the exact value
+ of <em>that</em> attribute is the term being defined. Otherwise, it
+ is the exact <code><a href=#textcontent>textContent</a></code> of the <code><a href=#the-dfn-element>dfn</a></code>
+ element that gives the term being defined.</p>
+
+ <!-- note that this means <dfn>x \n x</dfn> won't match <span>x x</span> -->
+
+ <p>If the <code title=attr-dfn-title><a href=#attr-dfn-title>title</a></code> attribute of the
+ <code><a href=#the-dfn-element>dfn</a></code> element is present, then it must contain only the
+ term being defined.</p>
+
+ <p class=note>The <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute
+ of ancestor elements does not affect <code><a href=#the-dfn-element>dfn</a></code> elements.</p>
+
+ <p>An <code><a href=#the-a-element>a</a></code> element that links to a <code><a href=#the-dfn-element>dfn</a></code>
+ element represents an instance of the term defined by the
+ <code><a href=#the-dfn-element>dfn</a></code> element.</p>
+
+ <div class=example>
+
+ <p>In the following fragment, the term "GDO" is first defined in
+ the first paragraph, then used in the second.</p>
+
+ <pre>&lt;p&gt;The &lt;dfn&gt;&lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;&lt;/dfn&gt;
+is a device that allows off-world teams to open the iris.&lt;/p&gt;
+&lt;!-- ... later in the document: --&gt;
+&lt;p&gt;Teal'c activated his &lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;
+and so Hammond ordered the iris to be opened.&lt;/p&gt;</pre>
+
+ <p>With the addition of an <code><a href=#the-a-element>a</a></code> element, the reference
+ can be made explicit:</p>
+
+ <pre>&lt;p&gt;The &lt;dfn id=gdo&gt;&lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;&lt;/dfn&gt;
+is a device that allows off-world teams to open the iris.&lt;/p&gt;
+&lt;!-- ... later in the document: --&gt;
+&lt;p&gt;Teal'c activated his &lt;a href=#gdo&gt;&lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;&lt;/a&gt;
+and so Hammond ordered the iris to be opened.&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-abbr-element><span class=secno>4.6.8 </span>The <dfn><code>abbr</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd>Also, the <code title=attr-abbr-title><a href=#attr-abbr-title>title</a></code> attribute has special semantics on this element.</dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-abbr-element>abbr</a></code> element <a href=#represents>represents</a> an
+ abbreviation or acronym, optionally with its expansion. The <dfn id=attr-abbr-title title=attr-abbr-title><code>title</code></dfn> attribute may be
+ used to provide an expansion of the abbreviation. The attribute, if
+ specified, must contain an expansion of the abbreviation, and
+ nothing else.</p>
+
+ <div class=example>
+ <p>The paragraph below contains an abbreviation marked up with the
+ <code><a href=#the-abbr-element>abbr</a></code> element. This paragraph <a href=#defining-term title="defining
+ term">defines the term</a> "Web Hypertext Application Technology
+ Working Group".</p>
+ <pre>&lt;p&gt;The &lt;dfn id=whatwg&gt;&lt;abbr
+title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;&lt;/dfn&gt;
+is a loose unofficial collaboration of Web browser manufacturers and
+interested parties who wish to develop new technologies designed to
+allow authors to write and deploy Applications over the World Wide
+Web.&lt;/p&gt;</pre>
+ <p>An alternative way to write this would be:</p>
+ <pre>&lt;p&gt;The &lt;dfn id=whatwg&gt;Web Hypertext Application Technology
+Working Group&lt;/dfn&gt; (&lt;abbr
+title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;)
+is a loose unofficial collaboration of Web browser manufacturers and
+interested parties who wish to develop new technologies designed to
+allow authors to write and deploy Applications over the World Wide
+Web.&lt;/p&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>This paragraph has two abbreviations. Notice how only one is
+ defined; the other, with no expansion associated with it, does not
+ use the <code><a href=#the-abbr-element>abbr</a></code> element.</p>
+ <pre>&lt;p&gt;The
+&lt;abbr title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;
+started working on HTML5 in 2004.&lt;/p&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>This paragraph links an abbreviation to its definition.</p>
+ <pre>&lt;p&gt;The &lt;a href="#whatwg"&gt;&lt;abbr
+title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;&lt;/a&gt;
+community does not have much representation from Asia.&lt;/p&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>This paragraph marks up an abbreviation without giving an
+ expansion, possibly as a hook to apply styles for abbreviations
+ (e.g. smallcaps).</p>
+ <pre>&lt;p&gt;Philip` and Dashiva both denied that they were going to
+get the issue counts from past revisions of the specification to
+backfill the &lt;abbr&gt;WHATWG&lt;/abbr&gt; issue graph.&lt;/p&gt;</pre>
+ </div>
+
+ <p>If an abbreviation is pluralized, the expansion's grammatical
+ number (plural vs singular) must match the grammatical number of the
+ contents of the element.</p>
+
+ <div class=example>
+
+ <p>Here the plural is outside the element, so the expansion is in
+ the singular:</p>
+
+ <pre>&lt;p&gt;Two &lt;abbr title="Working Group"&gt;WG&lt;/abbr&gt;s worked on
+this specification: the &lt;abbr&gt;WHATWG&lt;/abbr&gt; and the
+&lt;abbr&gt;HTMLWG&lt;/abbr&gt;.&lt;/p&gt;</pre>
+
+ <p>Here the plural is inside the element, so the expansion is in
+ the plural:</p>
+
+ <pre>&lt;p&gt;Two &lt;abbr title="Working Groups"&gt;WGs&lt;/abbr&gt; worked on
+this specification: the &lt;abbr&gt;WHATWG&lt;/abbr&gt; and the
+&lt;abbr&gt;HTMLWG&lt;/abbr&gt;.&lt;/p&gt;</pre>
+
+ </div>
+
+ <p>Abbreviations do not have to be marked up using this element. It
+ is expected to be useful in the following cases:</p>
+
+ <ul><li>Abbreviations for which the author wants to give expansions,
+ where using the <code><a href=#the-abbr-element>abbr</a></code> element with a <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute is an alternative to
+ including the expansion inline (e.g. in parentheses).</li>
+
+ <li>Abbreviations that are likely to be unfamiliar to the
+ document's readers, for which authors are encouraged to either mark
+ up the abbreviation using a <code><a href=#the-abbr-element>abbr</a></code> element with a <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute or include the expansion
+ inline in the text the first time the abbreviation is used.</li>
+
+ <li>Abbreviations whose presence needs to be semantically
+ annotated, e.g. so that they can be identified from a style sheet
+ and given specific styles, for which the <code><a href=#the-abbr-element>abbr</a></code> element
+ can be used without a <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute.</li>
+
+ </ul><p title=note>Providing an expansion in a <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute once will not necessarily
+ cause other <code><a href=#the-abbr-element>abbr</a></code> elements in the same document with the
+ same contents but without a <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute to behave as if they had the same expansion. Every
+ <code><a href=#the-abbr-element>abbr</a></code> element is independent.</p>
+
+
+
+
+ <h4 id=the-time-element><span class=secno>4.6.9 </span>The <dfn><code>time</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <code><a href=#the-time-element>time</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code></dd>
+ <dd><code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmltimeelement>HTMLTimeElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-time-datetime title=dom-time-datetime>dateTime</a>;
+ attribute boolean <a href=#dom-time-pubdate title=dom-time-pubDate>pubDate</a>;
+ readonly attribute <span>Date</span> <a href=#dom-time-valueasdate title=dom-time-valueAsDate>valueAsDate</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-time-element>time</a></code> element <a href=#represents>represents</a> either a
+ time on a 24 hour clock, or a precise date in the proleptic
+ Gregorian calendar, optionally with a time and a time-zone
+ offset. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
+
+ <p>This element is intended as a way to encode modern dates and
+ times in a machine-readable way so that, for example, user agents
+ can offer to add birthday reminders or scheduled events to the
+ user's calendar.</p>
+
+ <!-- it's also intended for restyling to local conventions
+ (2000-12-31 vs 31-12-2000 vs 12-31-2000), but CSS doesn't support
+ that yet. -->
+
+ <div class=note>
+
+ <p>The <code><a href=#the-time-element>time</a></code> element is not intended for encoding times
+ for which a precise date or time cannot be established. For
+ example, it would be inappropriate for encoding times like "one
+ millisecond after the big bang", "the early part of the Jurassic
+ period", or "a winter around 250 BCE".</p>
+
+ <p>For dates before the introduction of the Gregorian calendar,
+ authors are encouraged to not use the <code><a href=#the-time-element>time</a></code> element, or
+ else to be very careful about converting dates and times from the
+ period to the Gregorian calendar. This is complicated by the manner
+ in which the Gregorian calendar was phased in, which occurred at
+ different times in different countries, ranging from partway
+ through the 16th century all the way to early in the 20th.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-time-pubdate title=attr-time-pubdate><code>pubdate</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. If specified, it
+ indicates that the date and time given by the element is the
+ publication date and time of the nearest ancestor
+ <code><a href=#the-article-element>article</a></code> element, or, if the element has no ancestor
+ <code><a href=#the-article-element>article</a></code> element, of the document as a whole. If the
+ element has a <code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code>
+ attribute specified, then the element <dfn id=needs-a-date>needs a date</dfn>. For
+ each <code><a href=#the-article-element>article</a></code> element, there must no more than one
+ <code><a href=#the-time-element>time</a></code> element with a <code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code> attribute whose nearest
+ ancestor is that <code><a href=#the-article-element>article</a></code> element. Furthermore, for each
+ <code><a href=#document>Document</a></code>, there must be no more than one
+ <code><a href=#the-time-element>time</a></code> element with a <code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code> attribute that does not
+ have an ancestor <code><a href=#the-article-element>article</a></code> element.</p>
+
+ <p>The <dfn id=attr-time-datetime title=attr-time-datetime><code>datetime</code></dfn>
+ attribute, if present, gives the date or time being
+ specified. Otherwise, the date or time is given by the element's
+ contents.</p>
+
+ <p>If the element <i><a href=#needs-a-date>needs a date</a></i>, and the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute is present,
+ then the attribute's value must be a <a href=#valid-date-string-with-optional-time>valid date string with
+ optional time</a>.</p>
+
+ <p>If the element <i><a href=#needs-a-date>needs a date</a></i>, but the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute is not present,
+ then the element's <code><a href=#textcontent>textContent</a></code> must be a <a href=#valid-date-string-in-content-with-optional-time>valid
+ date string in content with optional time</a>.</p>
+
+ <p>If the element does not <i>need a date</i>, and the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute is present,
+ then the attribute's value must be a <a href=#valid-date-or-time-string>valid date or time
+ string</a>.</p>
+
+ <p>If the element does not <i>need a date</i>, but the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute is not present,
+ then the element's <code><a href=#textcontent>textContent</a></code> must be a <a href=#valid-date-or-time-string-in-content>valid
+ date or time string in content</a>.</p>
+
+ <p>The date, if any, must be expressed using the Gregorian
+ calendar.</p>
+
+ <div class=impl>
+
+ <p>If the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute
+ is present, the user agent should convey the attribute's value to
+ the user when rendering the element.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The <code><a href=#the-time-element>time</a></code> element can be used to encode dates, for
+ example in Microformats. The following shows a hypothetical way of
+ encoding an event using a variant on hCalendar that uses the
+ <code><a href=#the-time-element>time</a></code> element:</p>
+
+ <pre>&lt;div class="vevent"&gt;
+ &lt;a class="url" href="http://www.web2con.com/"&gt;http://www.web2con.com/&lt;/a&gt;
+ &lt;span class="summary"&gt;Web 2.0 Conference&lt;/span&gt;:
+ &lt;time class="dtstart" datetime="2007-10-05"&gt;October 5&lt;/time&gt; -
+ &lt;time class="dtend" datetime="2007-10-20"&gt;19&lt;/time&gt;,
+ at the &lt;span class="location"&gt;Argent Hotel, San Francisco, CA&lt;/span&gt;
+ &lt;/div&gt;</pre>
+
+ <p>(The end date is encoded as one day after the last date of the
+ event because in the iCalendar format, end dates are
+ <em>exclusive</em>, not inclusive.)</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The <code><a href=#the-time-element>time</a></code> element is not necessary for encoding
+ dates or times. In the following snippet, the time is encoded using
+ <code><a href=#the-time-element>time</a></code>, so that it can be restyled (e.g. using XBL2) to
+ match local conventions, while the year is not marked up at all,
+ since marking it up would not be particularly useful.</p>
+
+ <pre>&lt;p&gt;I usually have a snack at &lt;time&gt;16:00&lt;/time&gt;.&lt;/p&gt;
+&lt;p&gt;I've liked model trains since at least 1983.&lt;/p&gt;</pre>
+
+ <p>Using a styling technology that supports restyling times, the
+ first paragraph from the above snippet could be rendered as follows:</p>
+
+ <blockquote><p>I usually have a snack at 4pm.</blockquote>
+
+ <p>Or it could be rendered as follows:</p>
+
+ <blockquote><p>I usually have a snack at 16h00.</blockquote>
+
+ </div>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-time-datetime title=dom-time-datetime><code>dateTime</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-time-pubdate title=dom-time-pubDate><code>pubDate</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code> content attribute.</p>
+
+ <p>User agents, to obtain the <dfn id=concept-time-date title=concept-time-date>date</dfn>, <dfn id=concept-time-time title=concept-time-time>time</dfn>, and <dfn id=concept-time-timezone title=concept-time-timezone>time-zone offset</dfn> represented by
+ a <code><a href=#the-time-element>time</a></code> element, must follow these steps:</p>
+
+ <ol><li>If the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code>
+ attribute is present, then use the rules to <a href=#parse-a-date-or-time-string>parse a date or
+ time string</a> with the flag <i>in attribute</i> from the value
+ of that attribute, and let the result be <var title="">result</var>.</li>
+
+ <li>Otherwise, use the rules to <a href=#parse-a-date-or-time-string>parse a date or time
+ string</a> with the flag <i>in content</i> from the element's
+ <code><a href=#textcontent>textContent</a></code>, and let the result be <var title="">result</var>.</li>
+
+ <li>If <var title="">result</var> is empty (because the parsing
+ failed), then the <a href=#concept-time-date title=concept-time-date>date</a> is
+ unknown, the <a href=#concept-time-time title=concept-time-time>time</a> is
+ unknown, and the <a href=#concept-time-timezone title=concept-time-timezone>time-zone
+ offset</a> is unknown.</li>
+
+ <li>Otherwise: if <var title="">result</var> contains a date, then
+ that is the <a href=#concept-time-date title=concept-time-date>date</a>; if <var title="">result</var> contains a time, then that is the <a href=#concept-time-time title=concept-time-time>time</a>; and if <var title="">result</var> contains a time-zone offset, then the
+ time-zone offset is the element's <a href=#concept-time-timezone title=concept-time-timezone>time-zone offset</a>. (A time-zone
+ offset can only be present if both a date and a time are also
+ present.)</li>
+
+ </ol></div>
+
+ <dl class=domintro><dt><var title="">time</var> . <code title=dom-time-valueAsDate><a href=#dom-time-valueasdate>valueAsDate</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code>Date</code> object representing the specified date and time.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-time-valueasdate title=dom-time-valueAsDate><code>valueAsDate</code></dfn> IDL
+ attribute must return either null or a new <code>Date</code> object
+ initialised to the relevant value as defined by the following
+ list:</p>
+
+ <dl><dt>If the <a href=#concept-time-date title=concept-time-date>date</a> is known but
+ the <a href=#concept-time-time title=concept-time-time>time</a> is not</dt>
+
+ <dd>The time corresponding to midnight UTC (i.e. the first second)
+ of the given <a href=#concept-time-date title=concept-time-date>date</a>.</dd>
+
+ <dt>If the <a href=#concept-time-time title=concept-time-time>time</a> is known but
+ the <a href=#concept-time-date title=concept-time-date>date</a> is not</dt>
+
+ <dd>The time corresponding to the given <a href=#concept-time-time title=concept-time-time>time</a> of 1970-01-01, with the time
+ zone UTC.</dd>
+
+ <dt>If both the <a href=#concept-time-date title=concept-time-date>date</a> and the
+ <a href=#concept-time-time title=concept-time-time>time</a> are known</dt>
+
+ <dd>The time corresponding to the <a href=#concept-time-date title=concept-time-date>date</a> and <a href=#concept-time-time title=concept-time-time>time</a>, with the given <a href=#concept-time-timezone title=concept-time-timezone>time-zone offset</a>.</dd>
+
+ <dt>If neither the <a href=#concept-time-date title=concept-time-date>date</a> nor
+ the <a href=#concept-time-time title=concept-time-time>time</a> are known</dt>
+
+ <dd>The null value.</dd>
+
+ </dl><p>When a <code>Date</code> object is to be returned, a new one must
+ be constructed.</p> <!-- yes, this means .valueAsDate !=
+ .valueAsDate, but the object is mutable, so it'd be weird if we
+ didn't do that -->
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following snippet:</p>
+
+ <pre>&lt;p&gt;Our first date was &lt;time datetime="2006-09-23"&gt;a Saturday&lt;/time&gt;.&lt;/p&gt;</pre>
+
+ <p>...the <code><a href=#the-time-element>time</a></code> element's <code title=dom-time-valueAsDate><a href=#dom-time-valueasdate>valueAsDate</a></code> attribute would
+ have the value 1,158,969,600,000ms.</p>
+
+ </div>
+
+ <!-- <pre>&lt;p>We stopped talking at &lt;time datetime="2006-09-24T05:00-07:00">5am the next morning&lt;/time>.&lt;/p></pre> -->
+
+ <div class=example>
+
+ <p>In the following snippet:</p>
+
+ <pre>&lt;p&gt;Many people get up at &lt;time&gt;08:00&lt;/time&gt;.&lt;/p&gt;</pre>
+
+ <p>...the <code><a href=#the-time-element>time</a></code> element's <code title=dom-time-valueAsDate><a href=#dom-time-valueasdate>valueAsDate</a></code> attribute would
+ have the value 28,800,000ms.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, an article's publication date is marked up
+ using <code><a href=#the-time-element>time</a></code>:</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;Small tasks&lt;/h1&gt;
+ &lt;footer&gt;Published &lt;time pubdate&gt;2009-08-30&lt;/time&gt;.&lt;/footer&gt;
+ &lt;p&gt;I put a bike bell on his bike.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ <p>Here is another way that could be marked up. In this example,
+ legacy user agents would say "today", while newer user agents would
+ render the time in a locale-specific manner based on the value of
+ the attribute.</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;Small tasks&lt;/h1&gt;
+ &lt;footer&gt;Published &lt;time pubdate datetime="2009-08-30"&gt;today&lt;/time&gt;.&lt;/footer&gt;
+ &lt;p&gt;I put a bike bell on his bike.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ <p>Here is the same thing but with the time included only. Because
+ the element is empty, legacy user agents will not show anything
+ useful; user agents that implement this specification, on the other
+ hand, would show the date and time in a locale-specific manner.</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;Small tasks&lt;/h1&gt;
+ &lt;footer&gt;Published &lt;time pubdate datetime="2009-08-30T07:13Z"&gt;&lt;/time&gt;.&lt;/footer&gt;
+ &lt;p&gt;I put a bike bell on his bike.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-code-element><span class=secno>4.6.10 </span>The <dfn><code>code</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-code-element>code</a></code> element <a href=#represents>represents</a> a fragment
+ of computer code. This could be an XML element name, a filename, a
+ computer program, or any other string that a computer would
+ recognize.</p>
+
+ <p>Although there is no formal way to indicate the language of
+ computer code being marked up, authors who wish to mark
+ <code><a href=#the-code-element>code</a></code> elements with the language used, e.g. so that
+ syntax highlighting scripts can use the right rules, may do so by
+ adding a class prefixed with "<code title="">language-</code>" to
+ the element.</p>
+
+ <div class=example>
+
+ <p>The following example shows how the element can be used in a
+ paragraph to mark up element names and computer code, including
+ punctuation.</p>
+
+ <pre>&lt;p&gt;The &lt;code&gt;code&lt;/code&gt; element represents a fragment of computer
+code.&lt;/p&gt;
+
+&lt;p&gt;When you call the &lt;code&gt;activate()&lt;/code&gt; method on the
+&lt;code&gt;robotSnowman&lt;/code&gt; object, the eyes glow.&lt;/p&gt;
+
+&lt;p&gt;The example below uses the &lt;code&gt;begin&lt;/code&gt; keyword to indicate
+the start of a statement block. It is paired with an &lt;code&gt;end&lt;/code&gt;
+keyword, which is followed by the &lt;code&gt;.&lt;/code&gt; punctuation character
+(full stop) to indicate the end of the program.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how a block of code could be marked
+ up using the <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-code-element>code</a></code> elements.</p>
+
+ <pre>&lt;pre&gt;&lt;code class="language-pascal"&gt;var i: Integer;
+begin
+ i := 1;
+end.&lt;/code&gt;&lt;/pre&gt;</pre>
+
+ <p>A class is used in that example to indicate the language
+ used.</p>
+
+ </div>
+
+ <p class=note>See the <code><a href=#the-pre-element>pre</a></code> element for more details.</p>
+
+
+ <h4 id=the-var-element><span class=secno>4.6.11 </span>The <dfn><code>var</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-var-element>var</a></code> element <a href=#represents>represents</a> a
+ variable. This could be an actual variable in a mathematical
+ expression or programming context, or it could just be a term used
+ as a placeholder in prose.</p>
+
+ <div class=example>
+ <p>In the paragraph below, the letter "n" is being used as a
+ variable in prose:</p>
+ <pre>&lt;p&gt;If there are &lt;var&gt;n&lt;/var&gt; pipes leading to the ice
+cream factory then I expect at &lt;em&gt;least&lt;/em&gt; &lt;var&gt;n&lt;/var&gt;
+flavors of ice cream to be available for purchase!&lt;/p&gt;</pre>
+ </div>
+
+ <p>For mathematics, in particular for anything beyond the simplest
+ of expressions, MathML is more appropriate. However, the
+ <code><a href=#the-var-element>var</a></code> element can still be used to refer to specific
+ variables that are then mentioned in MathML expressions.</p>
+
+ <div class=example>
+
+ <p>In this example, an equation is shown, with a legend that
+ references the variables in the equation. The expression itself is
+ marked up with MathML, but the variables are mentioned in the
+ figure's legend using <code><a href=#the-var-element>var</a></code>.</p>
+
+ <pre>&lt;figure&gt;
+ &lt;math&gt;
+ &lt;mi&gt;a&lt;/mi&gt;
+ &lt;mo&gt;=&lt;/mo&gt;
+ &lt;msqrt&gt;
+ &lt;msup&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;
+ &lt;mi&gt;+&lt;/mi&gt;
+ &lt;msup&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;
+ &lt;/msqrt&gt;
+ &lt;/math&gt;
+ &lt;figcaption&gt;
+ Using Pythagoras' theorem to solve for the hypotenuse &lt;var&gt;a&lt;/var&gt; of
+ a triangle with sides &lt;var&gt;b&lt;/var&gt; and &lt;var&gt;c&lt;/var&gt;
+ &lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-samp-element><span class=secno>4.6.12 </span>The <dfn><code>samp</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-samp-element>samp</a></code> element <a href=#represents>represents</a> (sample)
+ output from a program or computing system.</p>
+
+ <p class=note>See the <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-kbd-element>kbd</a></code>
+ elements for more details.</p>
+
+ <div class=example>
+ <p>This example shows the <code><a href=#the-samp-element>samp</a></code> element being used
+ inline:</p>
+ <pre>&lt;p&gt;The computer said &lt;samp&gt;Too much cheese in tray
+two&lt;/samp&gt; but I didn't know what that meant.&lt;/p&gt;</pre>
+
+ <p>This second example shows a block of sample output. Nested
+ <code><a href=#the-samp-element>samp</a></code> and <code><a href=#the-kbd-element>kbd</a></code> elements allow for the
+ styling of specific elements of the sample output using a
+ style sheet.</p>
+
+ <pre>&lt;pre&gt;&lt;samp&gt;&lt;span class="prompt"&gt;jdoe@mowmow:~$&lt;/span&gt; &lt;kbd&gt;ssh demo.example.com&lt;/kbd&gt;
+Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1
+Linux demo 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189 #1 SMP Tue Feb 1 11:22:36 PST 2005 i686 unknown
+
+&lt;span class="prompt"&gt;jdoe@demo:~$&lt;/span&gt; &lt;span class="cursor"&gt;_&lt;/span&gt;&lt;/samp&gt;&lt;/pre&gt;</pre>
+ </div>
+
+
+ <h4 id=the-kbd-element><span class=secno>4.6.13 </span>The <dfn><code>kbd</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-kbd-element>kbd</a></code> element <a href=#represents>represents</a> user input
+ (typically keyboard input, although it may also be used to represent
+ other input, such as voice commands).</p>
+
+ <p>When the <code><a href=#the-kbd-element>kbd</a></code> element is nested inside a
+ <code><a href=#the-samp-element>samp</a></code> element, it represents the input as it was echoed
+ by the system.</p>
+
+ <p>When the <code><a href=#the-kbd-element>kbd</a></code> element <em>contains</em> a
+ <code><a href=#the-samp-element>samp</a></code> element, it represents input based on system
+ output, for example invoking a menu item.</p>
+
+ <p>When the <code><a href=#the-kbd-element>kbd</a></code> element is nested inside another
+ <code><a href=#the-kbd-element>kbd</a></code> element, it represents an actual key or other
+ single unit of input as appropriate for the input mechanism.</p>
+
+ <div class=example>
+ <p>Here the <code><a href=#the-kbd-element>kbd</a></code> element is used to indicate keys to press:</p>
+ <pre>&lt;p&gt;To make George eat an apple, press &lt;kbd&gt;&lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;F3&lt;/kbd&gt;&lt;/kbd&gt;&lt;/p&gt;</pre>
+
+ <p>In this second example, the user is told to pick a particular
+ menu item. The outer <code><a href=#the-kbd-element>kbd</a></code> element marks up a block of
+ input, with the inner <code><a href=#the-kbd-element>kbd</a></code> elements representing each
+ individual step of the input, and the <code><a href=#the-samp-element>samp</a></code> elements
+ inside them indicating that the steps are input based on something
+ being displayed by the system, in this case menu labels:</p>
+
+ <pre>&lt;p&gt;To make George eat an apple, select
+ &lt;kbd&gt;&lt;kbd&gt;&lt;samp&gt;File&lt;/samp&gt;&lt;/kbd&gt;|&lt;kbd&gt;&lt;samp&gt;Eat Apple...&lt;/samp&gt;&lt;/kbd&gt;&lt;/kbd&gt;
+&lt;/p&gt;</pre>
+
+ <p>Such precision isn't necessary; the following is equally fine:</p>
+
+ <pre>&lt;p&gt;To make George eat an apple, select &lt;kbd&gt;File | Eat Apple...&lt;/kbd&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-sub-and-sup-elements><span class=secno>4.6.14 </span>The <dfn><code>sub</code></dfn> and <dfn><code>sup</code></dfn> elements</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which these elements may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Use <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-sub-and-sup-elements>sup</a></code> element <a href=#represents>represents</a> a
+ superscript and the <code><a href=#the-sub-and-sup-elements>sub</a></code> element <a href=#represents>represents</a>
+ a subscript.</p>
+
+ <p>These elements must be used only to mark up typographical
+ conventions with specific meanings, not for typographical
+ presentation for presentation's sake. For example, it would be
+ inappropriate for the <code><a href=#the-sub-and-sup-elements>sub</a></code> and <code><a href=#the-sub-and-sup-elements>sup</a></code> elements
+ to be used in the name of the LaTeX document preparation system. In
+ general, authors should use these elements only if the
+ <em>absence</em> of those elements would change the meaning of the
+ content.</p>
+
+ <p>In certain languages, superscripts are part of the typographical
+ conventions for some abbreviations.</p>
+
+ <div class=example>
+ <pre>&lt;p&gt;The most beautiful women are
+&lt;span lang="fr"&gt;&lt;abbr&gt;M&lt;sup&gt;lle&lt;/sup&gt;&lt;/abbr&gt; Gwendoline&lt;/span&gt; and
+&lt;span lang="fr"&gt;&lt;abbr&gt;M&lt;sup&gt;me&lt;/sup&gt;&lt;/abbr&gt; Denise&lt;/span&gt;.&lt;/p&gt;</pre>
+ </div>
+
+ <p>The <code><a href=#the-sub-and-sup-elements>sub</a></code> element can be used inside a
+ <code><a href=#the-var-element>var</a></code> element, for variables that have subscripts.</p>
+
+ <div class=example>
+
+ <p>Here, the <code><a href=#the-sub-and-sup-elements>sub</a></code> element is used to represents the
+ subscript that identifies the variable in a family of
+ variables:</p>
+
+ <pre>&lt;p&gt;The coordinate of the &lt;var&gt;i&lt;/var&gt;th point is
+(&lt;var&gt;x&lt;sub&gt;&lt;var&gt;i&lt;/var&gt;&lt;/sub&gt;&lt;/var&gt;, &lt;var&gt;y&lt;sub&gt;&lt;var&gt;i&lt;/var&gt;&lt;/sub&gt;&lt;/var&gt;).
+For example, the 10th point has coordinate
+(&lt;var&gt;x&lt;sub&gt;10&lt;/sub&gt;&lt;/var&gt;, &lt;var&gt;y&lt;sub&gt;10&lt;/sub&gt;&lt;/var&gt;).&lt;/p&gt;</pre>
+ </div>
+
+ <p>Mathematical expressions often use subscripts and superscripts.
+ Authors are encouraged to use MathML for marking up mathematics, but
+ authors may opt to use <code><a href=#the-sub-and-sup-elements>sub</a></code> and <code><a href=#the-sub-and-sup-elements>sup</a></code> if
+ detailed mathematical markup is not desired. <a href=#refsMATHML>[MATHML]</a></p>
+
+ <div class=example>
+ <pre>&lt;var&gt;E&lt;/var&gt;=&lt;var&gt;m&lt;/var&gt;&lt;var&gt;c&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt;</pre>
+ <pre>f(&lt;var&gt;x&lt;/var&gt;, &lt;var&gt;n&lt;/var&gt;) = log&lt;sub&gt;4&lt;/sub&gt;&lt;var&gt;x&lt;/var&gt;&lt;sup&gt;&lt;var&gt;n&lt;/var&gt;&lt;/sup&gt;</pre>
+ </div>
+
+
+
+ <h4 id=the-i-element><span class=secno>4.6.15 </span>The <dfn><code>i</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-i-element>i</a></code> element <a href=#represents>represents</a> a span of text
+ in an alternate voice or mood, or otherwise offset from the normal
+ prose, such as a taxonomic designation, a technical term, an
+ idiomatic phrase from another language, a thought, a ship name, or
+ some other prose whose typical typographic presentation is
+ italicized.</p>
+
+ <p>Terms in languages different from the main text should be
+ annotated with <code title=attr-lang><a href=#attr-lang>lang</a></code> attributes (or,
+ in XML, <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code>
+ attributes in the <span>XML namespace</span></a>).</p>
+
+ <div class=example>
+ <p>The examples below show uses of the <code><a href=#the-i-element>i</a></code> element:</p>
+ <pre>&lt;p&gt;The &lt;i class="taxonomy"&gt;Felis silvestris catus&lt;/i&gt; is cute.&lt;/p&gt;
+&lt;p&gt;The term &lt;i&gt;prose content&lt;/i&gt; is defined above.&lt;/p&gt;
+&lt;p&gt;There is a certain &lt;i lang="fr"&gt;je ne sais quoi&lt;/i&gt; in the air.&lt;/p&gt;</pre>
+ <p>In the following example, a dream sequence is marked up using
+ <code><a href=#the-i-element>i</a></code> elements.</p>
+ <pre>&lt;p&gt;Raymond tried to sleep.&lt;/p&gt;
+&lt;p&gt;&lt;i&gt;The ship sailed away on Thursday&lt;/i&gt;, he
+dreamt. &lt;i&gt;The ship had many people aboard, including a beautiful
+princess called Carey. He watched her, day-in, day-out, hoping she
+would notice him, but she never did.&lt;/i&gt;&lt;/p&gt;
+&lt;p&gt;&lt;i&gt;Finally one night he picked up the courage to speak with
+her&mdash;&lt;/i&gt;&lt;/p&gt;
+&lt;p&gt;Raymond woke with a start as the fire alarm rang out.&lt;/p&gt;</pre>
+ </div>
+
+ <p>Authors are encouraged to use the <code title=attr-class><a href=#classes>class</a></code> attribute on the <code><a href=#the-i-element>i</a></code>
+ element to identify why the element is being used, so that if the
+ style of a particular use (e.g. dream sequences as opposed to
+ taxonomic terms) is to be changed at a later date, the author
+ doesn't have to go through the entire document (or series of related
+ documents) annotating each use. Similarly, authors are encouraged to
+ consider whether other elements might be more applicable than the
+ <code><a href=#the-i-element>i</a></code> element, for instance the <code><a href=#the-em-element>em</a></code> element for
+ marking up stress emphasis, or the <code><a href=#the-dfn-element>dfn</a></code> element to mark
+ up the defining instance of a term.</p>
+
+ <p class=note>Style sheets can be used to format <code><a href=#the-i-element>i</a></code>
+ elements, just like any other element can be restyled. Thus, it is
+ not the case that content in <code><a href=#the-i-element>i</a></code> elements will
+ necessarily be italicized.</p>
+
+
+ <h4 id=the-b-element><span class=secno>4.6.16 </span>The <dfn><code>b</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-b-element>b</a></code> element <a href=#represents>represents</a> a span of text
+ to be stylistically offset from the normal prose without conveying
+ any extra importance, such as key words in a document abstract,
+ product names in a review, or other spans of text whose typical
+ typographic presentation is boldened.</p>
+
+ <div class=example>
+ <p>The following example shows a use of the <code><a href=#the-b-element>b</a></code> element
+ to highlight key words without marking them up as important:</p>
+ <pre>&lt;p&gt;The &lt;b&gt;frobonitor&lt;/b&gt; and &lt;b&gt;barbinator&lt;/b&gt; components are fried.&lt;/p&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>In the following example, objects in a text adventure are
+ highlighted as being special by use of the <code><a href=#the-b-element>b</a></code>
+ element.</p>
+ <pre>&lt;p&gt;You enter a small room. Your &lt;b&gt;sword&lt;/b&gt; glows
+brighter. A &lt;b&gt;rat&lt;/b&gt; scurries past the corner wall.&lt;/p&gt;</pre>
+ </div>
+
+ <div class=example>
+ <p>Another case where the <code><a href=#the-b-element>b</a></code> element is appropriate is
+ in marking up the lede (or lead) sentence or paragraph. The
+ following example shows how a <a href=http://news.bbc.co.uk/2/hi/uk_news/scotland/north_east/7101506.stm>BBC
+ article about kittens adopting a rabbit as their own</a> could be
+ marked up:</p>
+ <pre>&lt;article&gt;
+ &lt;h2&gt;Kittens 'adopted' by pet rabbit&lt;/h2&gt;
+ &lt;p&gt;&lt;b class="lede"&gt;Six abandoned kittens have found an
+ unexpected new mother figure &mdash; a pet rabbit.&lt;/b&gt;&lt;/p&gt;
+ &lt;p&gt;Veterinary nurse Melanie Humble took the three-week-old
+ kittens to her Aberdeen home.&lt;/p&gt;
+<i>[...]</i></pre>
+ </div>
+
+ <p>As with the <code><a href=#the-i-element>i</a></code> element, authors are encouraged to use
+ the <code title=attr-class><a href=#classes>class</a></code> attribute on the
+ <code><a href=#the-b-element>b</a></code> element to identify why the element is being used, so
+ that if the style of a particular use is to be changed at a later
+ date, the author doesn't have to go through annotating each use.</p>
+
+ <p>The <code><a href=#the-b-element>b</a></code> element should be used as a last resort when
+ no other element is more appropriate. In particular, headings should
+ use the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> to <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements, stress emphasis
+ should use the <code><a href=#the-em-element>em</a></code> element, importance should be denoted
+ with the <code><a href=#the-strong-element>strong</a></code> element, and text marked or highlighted
+ should use the <code><a href=#the-mark-element>mark</a></code> element.</p>
+
+ <div class=example>
+ <p>The following would be <em>incorrect</em> usage:</p>
+ <pre class=bad>&lt;p&gt;&lt;b&gt;WARNING!&lt;/b&gt; Do not frob the barbinator!&lt;/p&gt;</pre>
+ <p>In the previous example, the correct element to use would have
+ been <code><a href=#the-strong-element>strong</a></code>, not <code><a href=#the-b-element>b</a></code>.</p>
+ </div>
+
+ <p class=note>Style sheets can be used to format <code><a href=#the-b-element>b</a></code>
+ elements, just like any other element can be restyled. Thus, it is
+ not the case that content in <code><a href=#the-b-element>b</a></code> elements will
+ necessarily be boldened.</p>
+
+
+
+ <h4 id=the-mark-element><span class=secno>4.6.17 </span>The <dfn><code>mark</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><!-- v2: attribute that means "highlight this on the scrollbar" --><p>The <code><a href=#the-mark-element>mark</a></code> element <a href=#represents>represents</a> a run of
+ text in one document marked or highlighted for reference purposes,
+ due to its relevance in another context. When used in a quotation or
+ other block of text referred to from the prose, it indicates a
+ highlight that was not originally present but which has been added
+ to bring the reader's attention to a part of the text that might not
+ have been considered important by the original author when the block
+ was originally written, but which is now under previously unexpected
+ scrutiny. When used in the main prose of a document, it indicates a
+ part of the document that has been highlighted due to its likely
+ relevance to the user's current activity.</p>
+
+ <div class=example>
+ <p>This example shows how the <code><a href=#the-mark-element>mark</a></code> element can be used
+ to bring attention to a particular part of a quotation:</p>
+ <pre>&lt;p lang="en-US"&gt;Consider the following quote:&lt;/p&gt;
+&lt;blockquote lang="en-GB"&gt;
+ &lt;p&gt;Look around and you will find, no-one's really
+ &lt;mark&gt;colour&lt;/mark&gt; blind.&lt;/p&gt;
+&lt;/blockquote&gt;
+&lt;p lang="en-US"&gt;As we can tell from the &lt;em&gt;spelling&lt;/em&gt; of the word,
+the person writing this quote is clearly not American.&lt;/p&gt;</pre>
+ </div>
+
+ <div class=example>
+
+ <p>Another example of the <code><a href=#the-mark-element>mark</a></code> element is highlighting
+ parts of a document that are matching some search string. If
+ someone looked at a document, and the server knew that the user was
+ searching for the word "kitten", then the server might return the
+ document with one paragraph modified as follows:</p>
+
+ <pre>&lt;p&gt;I also have some &lt;mark&gt;kitten&lt;/mark&gt;s who are visiting me
+these days. They're really cute. I think they like my garden! Maybe I
+should adopt a &lt;mark&gt;kitten&lt;/mark&gt;.&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following snippet, a paragraph of text refers to a
+ specific part of a code fragment.</p>
+
+ <pre>&lt;p&gt;The highlighted part below is where the error lies:&lt;/p&gt;
+&lt;pre&gt;&lt;code&gt;var i: Integer;
+begin
+ i := &lt;mark&gt;1.1&lt;/mark&gt;;
+end.&lt;/code&gt;&lt;/pre&gt;</pre>
+
+ <p>This is separate from <em>syntax highlighting</em>, for which
+ <code><a href=#the-span-element>span</a></code> is more appropriate. Combining both, one would
+ get:</p>
+
+ <pre>&lt;p&gt;The highlighted part below is where the error lies:&lt;/p&gt;
+&lt;pre&gt;&lt;code&gt;&lt;span class=keyword&gt;var&lt;/span&gt; &lt;span class=ident&gt;i&lt;/span&gt;: &lt;span class=type&gt;Integer&lt;/span&gt;;
+&lt;span class=keyword&gt;begin&lt;/span&gt;
+ &lt;span class=ident&gt;i&lt;/span&gt; := &lt;span class=literal&gt;&lt;mark&gt;1.1&lt;/mark&gt;&lt;/span&gt;;
+&lt;span class=keyword&gt;end&lt;/span&gt;.&lt;/code&gt;&lt;/pre&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>This is another example showing the use of <code><a href=#the-mark-element>mark</a></code> to
+ highlight a part of quoted text that was originally not
+ emphasized. In this example, common typographic conventions have
+ led the author to explicitly style <code><a href=#the-mark-element>mark</a></code> elements in
+ quotes to render in italics.</p>
+
+ <pre>&lt;article&gt;
+ &lt;style scoped&gt;
+ blockquote mark, q mark {
+ font: inherit; font-style: italic;
+ text-decoration: none;
+ background: transparent; color: inherit;
+ }
+ .bubble em {
+ font: inherit; font-size: larger;
+ text-decoration: underline;
+ }
+ &lt;/style&gt;
+ &lt;h1&gt;She knew&lt;/h1&gt;
+ &lt;p&gt;Did you notice the subtle joke in the joke on panel 4?&lt;/p&gt;
+ &lt;blockquote&gt;
+ &lt;p class="bubble"&gt;I didn't &lt;em&gt;want&lt;/em&gt; to believe. &lt;mark&gt;Of course
+ on some level I realized it was a known-plaintext attack.&lt;/mark&gt; But I
+ couldn't admit it until I saw for myself.&lt;/p&gt;
+ &lt;/blockquote&gt;
+ &lt;p&gt;(Emphasis mine.) I thought that was great. It's so pedantic, yet it
+ explains everything neatly.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ <p>Note, incidentally, the distinction between the <code><a href=#the-em-element>em</a></code>
+ element in this example, which is part of the original text being
+ quoted, and the <code><a href=#the-mark-element>mark</a></code> element, which is highlighting a
+ part for comment.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows the difference between denoting the
+ <em>importance</em> of a span of text (<code><a href=#the-strong-element>strong</a></code>) as
+ opposed to denoting the <em>relevance</em> of a span of text
+ (<code><a href=#the-mark-element>mark</a></code>). It is an extract from a textbook, where the
+ extract has had the parts relevant to the exam highlighted. The
+ safety warnings, important though they may be, are apparently not
+ relevant to the exam.</p>
+
+ <pre>&lt;h3&gt;Wormhole Physics Introduction&lt;/h3&gt;
+
+&lt;p&gt;&lt;mark&gt;A wormhole in normal conditions can be held open for a
+maximum of just under 39 minutes.&lt;/mark&gt; Conditions that can increase
+the time include a powerful energy source coupled to one or both of
+the gates connecting the wormhole, and a large gravity well (such as a
+black hole).&lt;/p&gt;
+
+&lt;p&gt;&lt;mark&gt;Momentum is preserved across the wormhole. Electromagnetic
+radiation can travel in both directions through a wormhole,
+but matter cannot.&lt;/mark&gt;&lt;/p&gt;
+
+&lt;p&gt;When a wormhole is created, a vortex normally forms.
+&lt;strong&gt;Warning: The vortex caused by the wormhole opening will
+annihilate anything in its path.&lt;/strong&gt; Vortexes can be avoided when
+using sufficiently advanced dialing technology.&lt;/p&gt;
+
+&lt;p&gt;&lt;mark&gt;An obstruction in a gate will prevent it from accepting a
+wormhole connection.&lt;/mark&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-ruby-element><span class=secno>4.6.18 </span>The <dfn><code>ruby</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>One or more groups of: <a href=#phrasing-content>phrasing content</a> followed either by a single <code><a href=#the-rt-element>rt</a></code> element, or an <code><a href=#the-rp-element>rp</a></code> element, an <code><a href=#the-rt-element>rt</a></code> element, and another <code><a href=#the-rp-element>rp</a></code> element.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-ruby-element>ruby</a></code> element allows one or more spans of
+ phrasing content to be marked with ruby annotations. Ruby
+ annotations are short runs of text presented alongside base text,
+ primarily used in East Asian typography as a guide for
+ pronunciation or to include other annotations. In Japanese, this
+ form of typography is also known as <i>furigana</i>.</p>
+
+ <p>A <code><a href=#the-ruby-element>ruby</a></code> element <a href=#represents>represents</a> the spans of
+ phrasing content it contains, ignoring all the child <code><a href=#the-rt-element>rt</a></code>
+ and <code><a href=#the-rp-element>rp</a></code> elements and their descendants. Those spans of
+ phrasing content have associated annotations created using the
+ <code><a href=#the-rt-element>rt</a></code> element.</p>
+
+ <div class=example>
+
+ <!-- this is the hiragana for the word "kanji" ("chinese character") in japanese -->
+ <!-- in japanese, ruby-like typography is called "furigana" -->
+
+ <p>In this example, each ideograph in the Japanese text <span lang=ja title="">&#28450;&#23383;</span> is annotated with its
+ reading in hiragana.</p>
+
+ <pre lang=ja>...
+&lt;ruby&gt;
+ &#28450; &lt;rt&gt; &#12363;&#12435; &lt;/rt&gt;
+ &#23383; &lt;rt&gt; &#12376;&#12288; &lt;/rt&gt;
+&lt;/ruby&gt;
+...</pre>
+
+ <p>This might be rendered as:</p>
+
+ <p><img alt="The two main ideographs, each with its annotation in hiragana rendered in a smaller font above it." src=images/sample-ruby-ja.png></p>
+
+ </div>
+
+ <div class=example>
+
+ <!-- this is the bopomofo for the word "hanzi" ("chinese character") in traditional chinese, as used in taiwan -->
+
+ <p>In this example, each ideograph in the traditional Chinese text
+ <span lang=zh-TW title="">&#28450;&#23383;</span> is annotated
+ with its bopomofo reading.</p>
+
+ <pre lang=zh-TW>&lt;ruby&gt;
+ &#28450; &lt;rt&gt; &#12559;&#12578;&#715; &lt;/rt&gt;
+ &#23383; &lt;rt&gt; &#12567;&#715;&#12288; &lt;/rt&gt;
+&lt;/ruby&gt;</pre>
+
+ <p>This might be rendered as:</p>
+
+ <p><img alt="The two main ideographs, each with its bopomofo annotation rendered in a smaller font next to it." src=images/sample-ruby-bopomofo.png></p>
+
+ </div>
+
+ <div class=example>
+
+ <!-- this is the pinyin for the word "hanzi" ("chinese character") in simplified chinese, as used in mainland china -->
+
+ <p>In this example, each ideograph in the simplified Chinese text
+ <span lang=zh-CN title="">&#27721;&#23383;</span> is annotated
+ with its pinyin reading.</p>
+
+ <pre lang=zh-CN>...
+&lt;ruby&gt;
+ &#27721; &lt;rt&gt; h&agrave;n &lt;/rt&gt;
+ &#23383; &lt;rt&gt; z&igrave;&nbsp; &lt;/rt&gt;
+&lt;/ruby&gt;
+...</pre>
+
+ <p>This might be rendered as:</p>
+
+ <p><img alt="The two main ideographs, each with its pinyin annotation rendered in a smaller font above it." src=images/sample-ruby-pinyin.png></p>
+
+ </div>
+
+ <!-- Note: Examples are 32px/16px Stone Sans Sem ITC TT -->
+
+
+ <h4 id=the-rt-element><span class=secno>4.6.19 </span>The <dfn><code>rt</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-ruby-element>ruby</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-rt-element>rt</a></code> element marks the ruby text component of a
+ ruby annotation.</p>
+
+ <p>An <code><a href=#the-rt-element>rt</a></code> element <span class=impl>that is a child of
+ a <code><a href=#the-ruby-element>ruby</a></code> element</span> <a href=#represents>represents</a> an
+ annotation (given by its children) for the zero or more nodes of
+ phrasing content that immediately precedes it in the
+ <code><a href=#the-ruby-element>ruby</a></code> element, ignoring <code><a href=#the-rp-element>rp</a></code> elements.</p>
+
+ <div class=impl>
+
+ <p>An <code><a href=#the-rt-element>rt</a></code> element that is not a child of a
+ <code><a href=#the-ruby-element>ruby</a></code> element represents the same thing as its
+ children.</p>
+
+ </div>
+
+
+ <h4 id=the-rp-element><span class=secno>4.6.20 </span>The <dfn><code>rp</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-ruby-element>ruby</a></code> element, either immediately before or immediately after an <code><a href=#the-rt-element>rt</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+<!--
+ <dd>If the <code>rp</code> element is immediately after an <code>rt</code> element that is immediately preceded by another <code>rp</code> element: a single character from Unicode character class Pe.</dd>
+ <dd>Otherwise: a single character from Unicode character class Ps.</dd>
+-->
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-rp-element>rp</a></code> element can be used to provide parentheses
+ around a ruby text component of a ruby annotation, to be shown by
+ user agents that don't support ruby annotations.</p>
+
+ <p>An <code><a href=#the-rp-element>rp</a></code> element <span class=impl>that is a child of
+ a <code><a href=#the-ruby-element>ruby</a></code> element</span> <a href=#represents>represents</a>
+ nothing<span class=impl> and its contents must be
+ ignored</span>. <span class=impl>An <code><a href=#the-rp-element>rp</a></code> element whose
+ parent element is not a <code><a href=#the-ruby-element>ruby</a></code> element
+ <a href=#represents>represents</a> its children.</span></p>
+
+ <div class=example>
+
+ <p>The example above, in which each ideograph in the text <span lang=ja title="">&#28450;&#23383;</span> is annotated with its
+ phonetic reading, could be expanded to use <code><a href=#the-rp-element>rp</a></code> so that in
+ legacy user agents the readings are in parentheses:</p>
+
+ <pre lang=ja>...
+&lt;ruby&gt;
+ &#28450; &lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;&#12363;&#12435;&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;
+ &#23383; &lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;&#12376;&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;
+&lt;/ruby&gt;
+...</pre>
+
+ <p>In conforming user agents the rendering would be as above, but
+ in user agents that do not support ruby, the rendering would
+ be:</p>
+
+ <pre lang=ja>... &#28450; (&#12363;&#12435;) &#23383; (&#12376;) ...</pre>
+
+ </div>
+
+
+ <h4 id=the-bdo-element><span class=secno>4.6.21 </span>The <dfn><code>bdo</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd>Also, the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global attribute has special semantics on this element.</dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-bdo-element>bdo</a></code> element <a href=#represents>represents</a> explicit
+ text directionality formatting control for its children. It allows
+ authors to override the Unicode bidirectional algorithm by
+ explicitly specifying a direction override. <a href=#refsBIDI>[BIDI]</a></p>
+
+ <p>Authors must specify the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
+ attribute on this element, with the value <code>ltr</code> to
+ specify a left-to-right override and with the value <code>rtl</code>
+ to specify a right-to-left override.</p>
+
+ <div class=impl>
+
+ <p>If the element has the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
+ attribute set to the exact value <code>ltr</code>, then for the
+ purposes of the bidi algorithm, the user agent must act as if there
+ was a U+202D LEFT-TO-RIGHT OVERRIDE character at the start of the
+ element, and a U+202C POP DIRECTIONAL FORMATTING at the end of the
+ element.</p>
+
+ <p>If the element has the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
+ attribute set to the exact value <code>rtl</code>, then for the
+ purposes of the bidi algorithm, the user agent must act as if there
+ was a U+202E RIGHT-TO-LEFT OVERRIDE character at the start of the
+ element, and a U+202C POP DIRECTIONAL FORMATTING at the end of the
+ element.</p>
+
+ <p>The requirements on handling the <code><a href=#the-bdo-element>bdo</a></code> element for the
+ bidi algorithm may be implemented indirectly through the style
+ layer. For example, an HTML+CSS user agent should implement these
+ requirements by implementing the CSS 'unicode-bidi' property. <a href=#refsCSS>[CSS]</a></p>
+
+ </div>
+
+
+
+ <h4 id=the-span-element><span class=secno>4.6.22 </span>The <dfn><code>span</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlspanelement>HTMLSpanElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-span-element>span</a></code> element doesn't mean anything on its own,
+ but can be useful when used together with other attributes,
+ e.g. <code title=attr-class><a href=#classes>class</a></code>, <code title=attr-lang><a href=#attr-lang>lang</a></code>, or <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>. It <a href=#represents>represents</a> its
+ children.</p>
+
+ <div class=example>
+
+ <p>In this example, a code fragment is marked up using
+ <code><a href=#the-span-element>span</a></code> elements and <code title=attr-class><a href=#classes>class</a></code> attributes so that its keywords and
+ identifiers can be color-coded from CSS:</p>
+
+ <!-- extract from http://www.cs.cmu.edu/~dst/DeCSS/Gallery/vlc-dvd_css-c.txt -->
+
+ <pre>&lt;pre&gt;&lt;code class="lang-c"&gt;&lt;span class="keyword"&gt;for&lt;/span&gt; (&lt;span class="ident"&gt;j&lt;/span&gt; = 0; &lt;span class="ident"&gt;j&lt;/span&gt; &amp;lt; 256; &lt;span class="ident"&gt;j&lt;/span&gt;++) {
+ &lt;span class="ident"&gt;i_t3&lt;/span&gt; = (&lt;span class="ident"&gt;i_t3&lt;/span&gt; &amp; 0x1ffff) | (&lt;span class="ident"&gt;j&lt;/span&gt; &amp;lt;&amp;lt; 17);
+ &lt;span class="ident"&gt;i_t6&lt;/span&gt; = (((((((&lt;span class="ident"&gt;i_t3&lt;/span&gt; &gt;&gt; 3) ^ &lt;span class="ident"&gt;i_t3&lt;/span&gt;) &gt;&gt; 1) ^ &lt;span class="ident"&gt;i_t3&lt;/span&gt;) &gt;&gt; 8) ^ &lt;span class="ident"&gt;i_t3&lt;/span&gt;) &gt;&gt; 5) &amp; 0xff;
+ &lt;span class="keyword"&gt;if&lt;/span&gt; (&lt;span class="ident"&gt;i_t6&lt;/span&gt; == &lt;span class="ident"&gt;i_t1&lt;/span&gt;)
+ &lt;span class="keyword"&gt;break&lt;/span&gt;;
+}&lt;/code&gt;&lt;/pre&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-br-element><span class=secno>4.6.23 </span>The <dfn><code>br</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlbrelement>HTMLBRElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-br-element>br</a></code> element <a href=#represents>represents</a> a line
+ break.</p>
+
+ <p><code><a href=#the-br-element>br</a></code> elements must be used only for line breaks that
+ are actually part of the content, as in poems or addresses.</p>
+
+ <div class=example>
+
+ <p>The following example is correct usage of the <code><a href=#the-br-element>br</a></code>
+ element:</p>
+
+ <pre>&lt;p&gt;P. Sherman&lt;br&gt;
+42 Wallaby Way&lt;br&gt;
+Sydney&lt;/p&gt;</pre>
+
+ </div>
+
+ <p><code><a href=#the-br-element>br</a></code> elements must not be used for separating thematic
+ groups in a paragraph.</p>
+
+ <div class=example>
+
+ <p>The following examples are non-conforming, as they abuse the
+ <code><a href=#the-br-element>br</a></code> element:</p>
+
+ <pre>&lt;p&gt;&lt;a ...&gt;34 comments.&lt;/a&gt;&lt;br&gt;
+&lt;a ...&gt;Add a comment.&lt;/a&gt;&lt;/p&gt;</pre>
+
+ <pre>&lt;p&gt;&lt;label&gt;Name: &lt;input name="name"&gt;&lt;/label&gt;&lt;br&gt;
+&lt;label&gt;Address: &lt;input name="address"&gt;&lt;/label&gt;&lt;/p&gt;</pre>
+
+ <p>Here are alternatives to the above, which are correct:</p>
+
+ <pre>&lt;p&gt;&lt;a ...&gt;34 comments.&lt;/a&gt;&lt;/p&gt;
+&lt;p&gt;&lt;a ...&gt;Add a comment.&lt;/a&gt;&lt;/p&gt;</pre>
+
+ <pre>&lt;p&gt;&lt;label&gt;Name: &lt;input name="name"&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;p&gt;&lt;label&gt;Address: &lt;input name="address"&gt;&lt;/label&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+ <p>If a <a href=#paragraph>paragraph</a> consists of nothing but a single
+ <code><a href=#the-br-element>br</a></code> element, it represents a placeholder blank line
+ (e.g. as in a template). Such blank lines must not be used for
+ presentation purposes.</p>
+
+ <div class=impl>
+
+ <p>Any content inside <code><a href=#the-br-element>br</a></code> elements must not be
+ considered part of the surrounding text.</p>
+
+ <p>A <code><a href=#the-br-element>br</a></code> element does not separate paragraphs for the
+ purposes of the Unicode bidirectional algorithm. <a href=#refsBIDI>[BIDI]</a></p>
+
+ </div>
+
+
+ <h4 id=the-wbr-element><span class=secno>4.6.24 </span>The <dfn><code>wbr</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-wbr-element>wbr</a></code> element <a href=#represents>represents</a> a line break
+ opportunity.</p>
+
+ <div class=example>
+
+ <p>In the following example, someone is quoted as saying something
+ which, for effect, is written as one long word. However, to ensure
+ that the text can be wrapped in a readable fashion, the individual
+ words in the quote are separated using a <code><a href=#the-wbr-element>wbr</a></code>
+ element.</p>
+
+ <pre>&lt;p&gt;So then he pointed at the tiger and screamed
+"there&lt;wbr&gt;is&lt;wbr&gt;no&lt;wbr&gt;way&lt;wbr&gt;you&lt;wbr&gt;are&lt;wbr&gt;ever&lt;wbr&gt;going&lt;wbr&gt;to&lt;wbr&gt;catch&lt;wbr&gt;me"!&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=impl>
+
+ <p>Any content inside <code><a href=#the-wbr-element>wbr</a></code> elements must not be
+ considered part of the surrounding text.</p>
+
+ </div>
+
+
+
+ <h4 id=usage-summary><span class=secno>4.6.25 </span>Usage summary</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <table><thead><tr><th>Element
+ <th>Purpose
+ <th>Example
+ <tbody><tr><td><code><a href=#the-a-element>a</a></code>
+ <td>Hyperlinks
+ <td><pre class=example>Visit my <strong>&lt;a href="drinks.html"&gt;drinks&lt;/a&gt;</strong> page.</pre>
+
+ <tr><td><code><a href=#the-em-element>em</a></code>
+ <td>Stress emphasis
+ <td><pre class=example>I must say I <strong>&lt;em&gt;adore&lt;/em&gt;</strong> lemonade.</pre>
+
+ <tr><td><code><a href=#the-strong-element>strong</a></code>
+ <td>Importance
+ <td><pre class=example>This tea is <strong>&lt;strong&gt;very hot&lt;/strong&gt;</strong>.</pre>
+
+ <tr><td><code><a href=#the-small-element>small</a></code>
+ <td>Side comments
+ <td><pre class=example>These grapes are made into wine. <strong>&lt;small&gt;Alcohol is addictive.&lt;/small&gt;</strong></pre>
+
+ <tr><td><code><a href=#the-cite-element>cite</a></code>
+ <td>Titles of works
+ <td><pre class=example>The case <strong>&lt;cite&gt;Hugo v. Danielle&lt;/cite&gt;</strong> is relevant here.</pre>
+
+ <tr><td><code><a href=#the-q-element>q</a></code>
+ <td>Quotations
+ <td><pre class=example>The judge said <strong>&lt;q&gt;You can drink water from the fish tank&lt;/q&gt;</strong> but advised against it.</pre>
+
+ <tr><td><code><a href=#the-dfn-element>dfn</a></code>
+ <td>Defining instance
+ <td><pre class=example>The term <strong>&lt;dfn&gt;organic food&lt;/dfn&gt;</strong> refers to food produced without synthetic chemicals.</pre>
+
+ <tr><td><code><a href=#the-abbr-element>abbr</a></code>
+ <td>Abbreviations
+ <td><pre class=example>Organic food in Ireland is certified by the <strong>&lt;abbr title="Irish Organic Farmers and Growers Association"&gt;IOFGA&lt;/abbr&gt;</strong>.</pre>
+
+ <tr><td><code><a href=#the-time-element>time</a></code>
+ <td>Date and/or time
+ <td><pre class=example>Published <strong>&lt;time&gt;2009-10-21&lt;/time&gt;</strong>.</pre>
+
+ <tr><td><code><a href=#the-code-element>code</a></code>
+ <td>Computer code
+ <td><pre class=example>The <strong>&lt;code&gt;fruitdb&lt;/code&gt;</strong> program can be used for tracking fruit production.</pre>
+
+ <tr><td><code><a href=#the-var-element>var</a></code>
+ <td>Variables
+ <td><pre class=example>If there are <strong>&lt;var&gt;n&lt;/var&gt;</strong> fruit in the bowl, at least <strong>&lt;var&gt;n&lt;/var&gt;</strong>&divide;2 will be ripe.</pre>
+
+ <tr><td><code><a href=#the-samp-element>samp</a></code>
+ <td>Computer output
+ <td><pre class=example>The computer said <strong>&lt;samp&gt;Unknown error -3&lt;/samp&gt;</strong>.</pre>
+
+ <tr><td><code><a href=#the-kbd-element>kbd</a></code>
+ <td>User input
+ <td><pre class=example>Hit <strong>&lt;kbd&gt;F1&lt;/kbd&gt;</strong> to continue.</pre>
+
+ <tr><td><code><a href=#the-sub-and-sup-elements>sub</a></code>
+ <td>Subscripts
+ <td><pre class=example>Water is H<strong>&lt;sub&gt;2&lt;/sub&gt;</strong>O.</pre>
+
+ <tr><td><code><a href=#the-sub-and-sup-elements>sup</a></code>
+ <td>Superscripts
+ <td><pre class=example>The Hydrogen in heavy water is usually <strong>&lt;sup&gt;2&lt;/sup&gt;</strong>H.</pre>
+
+ <tr><td><code><a href=#the-i-element>i</a></code>
+ <td>Alternative voice
+ <td><pre class=example>Lemonade consists primarily of <strong>&lt;i&gt;Citrus limon&lt;/i&gt;</strong>.</pre>
+
+ <tr><td><code><a href=#the-b-element>b</a></code>
+ <td>Keywords
+ <td><pre class=example>Take a <strong>&lt;b&gt;lemon&lt;/b&gt;</strong> and squeeze it with a <strong>&lt;b&gt;juicer&lt;/b&gt;</strong>.</pre>
+
+ <tr><td><code><a href=#the-mark-element>mark</a></code>
+ <td>Highlight
+ <td><pre class=example>Elderflower cordial, with one <strong>&lt;mark&gt;part&lt;/mark&gt;</strong> cordial to ten <strong>&lt;mark&gt;part&lt;/mark&gt;</strong>s water, stands a<strong>&lt;mark&gt;part&lt;/mark&gt;</strong> from the rest.</pre>
+
+ <tr><td><code><a href=#the-ruby-element>ruby</a></code>, <code><a href=#the-rt-element>rt</a></code>, <code><a href=#the-rp-element>rp</a></code>
+ <td>Ruby annotations
+ <td><pre class=example><strong>&lt;ruby&gt; OJ &lt;rp&gt;(&lt;rt&gt;Orange Juice&lt;rp&gt;)&lt;/ruby&gt;</strong></pre>
+
+ <tr><td><code><a href=#the-bdo-element>bdo</a></code>
+ <td>Text directionality formatting
+ <td><pre class=example>The proposal is to write English, but in reverse order. "Juice" would become "<strong>&lt;bdo dir=rtl&gt;Juice&lt;/bdo&gt;</strong>"</pre>
+
+ <tr><td><code><a href=#the-span-element>span</a></code>
+ <td>Other
+ <td><pre class=example>In French we call it <strong>&lt;span lang="fr"&gt;sirop de sureau&lt;/span&gt;</strong>.</pre>
+
+ <tr><td><code><a href=#the-br-element>br</a></code>
+ <td>Line break
+ <td><pre class=example>Simply Orange Juice Company<strong>&lt;br&gt;</strong>Apopka, FL 32703<strong>&lt;br&gt;</strong>U.S.A.</pre>
+
+ <tr><td><code><a href=#the-wbr-element>wbr</a></code>
+ <td>Line breaking opportunity
+ <td><pre class=example>www.simply<strong>&lt;wbr&gt;</strong>orange<strong>&lt;wbr&gt;</strong>juice.com</pre>
+
+ </table><h3 id=edits><span class=secno>4.7 </span>Edits</h3>
+
+ <p>The <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements represent
+ edits to the document.</p>
+
+
+ <h4 id=the-ins-element><span class=secno>4.7.1 </span>The <dfn><code>ins</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd>When the element only contains <a href=#phrasing-content>phrasing content</a>: <a href=#phrasing-content>phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#transparent>Transparent</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code></dd>
+ <dd><code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses the <code><a href=#htmlmodelement>HTMLModElement</a></code> interface.</dd>
+ </dl><p>The <code><a href=#the-ins-element>ins</a></code> element <a href=#represents>represents</a> an addition
+ to the document.</p>
+
+ <div class=example>
+
+ <p>The following represents the addition of a single paragraph:</p>
+
+ <pre>&lt;aside&gt;
+ &lt;ins&gt;
+ &lt;p&gt; I like fruit. &lt;/p&gt;
+ &lt;/ins&gt;
+&lt;/aside&gt;</pre>
+
+ <p>As does this, because everything in the <code><a href=#the-aside-element>aside</a></code>
+ element here counts as <a href=#phrasing-content>phrasing content</a> and therefore
+ there is just one <a href=#paragraph>paragraph</a>:</p>
+
+ <pre>&lt;aside&gt;
+ &lt;ins&gt;
+ Apples are &lt;em&gt;tasty&lt;/em&gt;.
+ &lt;/ins&gt;
+ &lt;ins&gt;
+ So are pears.
+ &lt;/ins&gt;
+&lt;/aside&gt;</pre>
+
+ </div>
+
+ <p><code><a href=#the-ins-element>ins</a></code> elements should not cross <a href=#paragraph title=paragraph>implied paragraph</a> boundaries.</p>
+
+ <div class=example>
+
+ <p>The following example represents the addition of two paragraphs,
+ the second of which was inserted in two parts. The first
+ <code><a href=#the-ins-element>ins</a></code> element in this example thus crosses a paragraph
+ boundary, which is considered poor form.</p>
+
+ <pre class=bad>&lt;aside&gt;
+ &lt;!-- don't do this --&gt;
+ &lt;ins datetime="2005-03-16T00:00Z"&gt;
+ &lt;p&gt; I like fruit. &lt;/p&gt;
+ Apples are &lt;em&gt;tasty&lt;/em&gt;.
+ &lt;/ins&gt;
+ &lt;ins datetime="2007-12-19T00:00Z"&gt;
+ So are pears.
+ &lt;/ins&gt;
+&lt;/aside&gt;</pre>
+
+ <p>Here is a better way of marking this up. It uses more elements,
+ but none of the elements cross implied paragraph boundaries.</p>
+
+ <pre>&lt;aside&gt;
+ &lt;ins datetime="2005-03-16T00:00Z"&gt;
+ &lt;p&gt; I like fruit. &lt;/p&gt;
+ &lt;/ins&gt;
+ &lt;ins datetime="2005-03-16T00:00Z"&gt;
+ Apples are &lt;em&gt;tasty&lt;/em&gt;.
+ &lt;/ins&gt;
+ &lt;ins datetime="2007-12-19T00:00Z"&gt;
+ So are pears.
+ &lt;/ins&gt;
+&lt;/aside&gt;</pre>
+
+ <!-- Those dates aren't random. They're the start and end of
+ something. Can you guess what? -->
+
+ </div>
+
+
+ <h4 id=the-del-element><span class=secno>4.7.2 </span>The <dfn><code>del</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd>When the element only contains <a href=#phrasing-content>phrasing content</a>: <a href=#phrasing-content>phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#transparent>Transparent</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code></dd>
+ <dd><code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses the <code><a href=#htmlmodelement>HTMLModElement</a></code> interface.</dd>
+ </dl><p>The <code><a href=#the-del-element>del</a></code> element <a href=#represents>represents</a> a removal
+ from the document.</p>
+
+ <p><code><a href=#the-del-element>del</a></code> elements should not cross <a href=#paragraph title=paragraph>implied paragraph</a> boundaries.</p>
+
+ <div class=example>
+
+ <p>The following shows a "to do" list where items that have been
+ done are crossed-off with the date and time of their
+ completion.</p>
+
+ <pre>&lt;h1&gt;To Do&lt;/h1&gt;
+&lt;ul&gt;
+ &lt;li&gt;Empty the dishwasher&lt;/li&gt;
+ &lt;li&gt;&lt;del datetime="2009-10-11T01:25-07:00"&gt;Watch Walter Lewin's lectures&lt;/del&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;del datetime="2009-10-10T23:38-07:00"&gt;Download more tracks&lt;/del&gt;&lt;/li&gt;
+ &lt;li&gt;Buy a printer&lt;/li&gt;
+&lt;/ul&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=attributes-common-to-ins-and-del-elements><span class=secno>4.7.3 </span>Attributes common to <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements</h4>
+
+ <p>The <dfn id=attr-mod-cite title=attr-mod-cite><code>cite</code></dfn> attribute
+ may be used to specify the address of a document that explains the
+ change. When that document is long, for instance the minutes of a
+ meeting, authors are encouraged to include a fragment identifier
+ pointing to the specific part of that document that discusses the
+ change.</p>
+
+ <p>If the <code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code> attribute is
+ present, it must be a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by
+ spaces</a> that explains the change. <span class=impl>To obtain
+ the corresponding citation link, the value of the attribute must be
+ <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the
+ element. User agents should allow users to follow such citation
+ links.</span></p>
+
+
+ <p>The <dfn id=attr-mod-datetime title=attr-mod-datetime><code>datetime</code></dfn>
+ attribute may be used to specify the time and date of the change.</p>
+
+ <p>If present, the <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code>
+ attribute must be a <a href=#valid-global-date-and-time-string>valid global date and time string</a>
+ value.</p>
+
+ <div class=impl>
+
+ <p>User agents must parse the <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> attribute according to the
+ <a href=#parse-a-global-date-and-time-string>parse a global date and time string</a> algorithm. If that
+ doesn't return a time, then the modification has no associated
+ timestamp (the value is non-conforming; it is not a <a href=#valid-global-date-and-time-string>valid
+ global date and time string</a>). Otherwise, the modification is
+ marked as having been made at the given datetime. User agents should
+ use the associated time-zone offset information to determine which
+ time zone to present the given datetime in.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements <span class=impl>must</span> implement the <code><a href=#htmlmodelement>HTMLModElement</a></code>
+ interface:</p>
+
+ <pre class=idl>interface <dfn id=htmlmodelement>HTMLModElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-mod-cite title=dom-mod-cite>cite</a>;
+ attribute DOMString <a href=#dom-mod-datetime title=dom-mod-datetime>dateTime</a>;
+};</pre>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-mod-cite title=dom-mod-cite><code>cite</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the element's <code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code> content attribute. The <dfn id=dom-mod-datetime title=dom-mod-datetime><code>dateTime</code></dfn> IDL attribute
+ must <a href=#reflect>reflect</a> the element's <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> content attribute.</p>
+
+ </div>
+
+
+
+ <h4 id=edits-and-paragraphs><span class=secno>4.7.4 </span>Edits and paragraphs</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Since the <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements do not
+ affect <a href=#paragraph title=paragraph>paragraphing</a>, it is possible,
+ in some cases where paragraphs are <a href=#paragraph title=paragraph>implied</a> (without explicit <code><a href=#the-p-element>p</a></code>
+ elements), for an <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element to
+ span both an entire paragraph or other non-<a href=#phrasing-content>phrasing
+ content</a> elements and part of another paragraph. For
+ example:</p>
+
+ <pre>&lt;section&gt;
+ &lt;ins&gt;
+ &lt;p&gt;
+ This is a paragraph that was inserted.
+ &lt;/p&gt;
+ This is another paragraph whose first sentence was inserted
+ at the same time as the paragraph above.
+ &lt;/ins&gt;
+ This is a second sentence, which was there all along.
+&lt;/section&gt;</pre>
+
+ <p>By only wrapping some paragraphs in <code><a href=#the-p-element>p</a></code> elements, one
+ can even get the end of one paragraph, a whole second paragraph,
+ and the start of a third paragraph to be covered by the same
+ <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element (though this is very
+ confusing, and not considered good practice):</p>
+
+ <pre class=bad>&lt;section&gt;
+ This is the first paragraph. &lt;ins&gt;This sentence was
+ inserted.
+ &lt;p&gt;This second paragraph was inserted.&lt;/p&gt;
+ This sentence was inserted too.&lt;/ins&gt; This is the
+ third paragraph in this example.
+ &lt;!-- (don't do this) --&gt;
+&lt;/section&gt;</pre>
+
+ <p>However, due to the way <a href=#paragraph title=paragraph>implied
+ paragraphs</a> are defined, it is not possible to mark up the
+ end of one paragraph and the start of the very next one using the
+ same <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element. You instead have
+ to use one (or two) <code><a href=#the-p-element>p</a></code> element(s) and two
+ <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> elements, as for example:</p>
+
+ <pre>&lt;section&gt;
+ &lt;p&gt;This is the first paragraph. &lt;del&gt;This sentence was
+ deleted.&lt;/del&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;del&gt;This sentence was deleted too.&lt;/del&gt; That
+ sentence needed a separate &amp;lt;del&amp;gt; element.&lt;/p&gt;
+&lt;/section&gt;</pre>
+
+ <p>Partly because of the confusion described above, authors are
+ strongly encouraged to always mark up all paragraphs with the
+ <code><a href=#the-p-element>p</a></code> element, instead of having <code><a href=#the-ins-element>ins</a></code> or
+ <code><a href=#the-del-element>del</a></code> elements that cross <a href=#paragraph title=paragraph>implied
+ paragraphs</a> boundaries.</p>
+
+
+ <h4 id=edits-and-lists><span class=secno>4.7.5 </span>Edits and lists</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The content models of the <code><a href=#the-ol-element>ol</a></code> and <code><a href=#the-ul-element>ul</a></code>
+ elements do not allow <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements
+ as children. Lists always represent all their items, including items
+ that would otherwise have been marked as deleted.</p>
+
+ <p>To indicate that an item is inserted or deleted, an
+ <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element can be wrapped around
+ the contents of the <code><a href=#the-li-element>li</a></code> element. To indicate that an
+ item has been replaced by another, a single <code><a href=#the-li-element>li</a></code> element
+ can have one or more <code><a href=#the-del-element>del</a></code> elements followed by one or
+ more <code><a href=#the-ins-element>ins</a></code> elements.</p>
+
+ <div class=example>
+
+ <p>In the following example, a list that started empty had items
+ added and removed from it over time. The bits in the example that
+ have been emphasized show the parts that are the "current" state of
+ the list. The list item numbers don't take into account the edits,
+ though.</p>
+
+ <pre>&lt;h1&gt;Stop-ship bugs&lt;/h1&gt;
+&lt;ol&gt;
+ &lt;li&gt;&lt;ins datetime="2008-02-12T15:20Z"&gt;<em>Bug 225:
+ Rain detector doesn't work in snow</em>&lt;/ins&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;del datetime="2008-03-01T20:22Z"&gt;&lt;ins datetime="2008-02-14T12:02Z"&gt;Bug 228:
+ Water buffer overflows in April&lt;/ins&gt;&lt;/del&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;ins datetime="2008-02-16T13:50Z"&gt;<em>Bug 230:
+ Water heater doesn't use renewable fuels</em>&lt;/ins&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;del datetime="2008-02-20T21:15Z"&gt;&lt;ins datetime="2008-02-16T14:25Z"&gt;Bug 232:
+ Carbon dioxide emissions detected after startup&lt;/ins&gt;&lt;/del&gt;&lt;/li&gt;
+&lt;/ol&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, a list that started with just fruit
+ was replaced by a list with just colors.</p>
+
+ <pre>&lt;h1&gt;List of &lt;del&gt;fruits&lt;/del&gt;&lt;ins&gt;colors&lt;/ins&gt;&lt;/h1&gt;
+&lt;ul&gt;
+ &lt;li&gt;&lt;del&gt;Lime&lt;/del&gt;&lt;ins&gt;Green&lt;/ins&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;del&gt;Apple&lt;/del&gt;&lt;/li&gt;
+ &lt;li&gt;Orange&lt;/li&gt;
+ &lt;li&gt;&lt;del&gt;Pear&lt;/del&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;ins&gt;Teal&lt;/ins&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;del&gt;Lemon&lt;/del&gt;&lt;ins&gt;Yellow&lt;/ins&gt;&lt;/li&gt;
+ &lt;li&gt;Olive&lt;/li&gt;
+ &lt;li&gt;&lt;ins&gt;Purple&lt;/ins&gt;&lt;/li&gt;
+&lt;/ul&gt;</pre>
+
+ </div>
+
+
+
+
+ <h3 id=embedded-content-1><span class=secno>4.8 </span>Embedded content</h3>
+
+
+ <h4 id=the-img-element><span class=secno>4.8.1 </span>The <dfn><code>img</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#embedded-content>Embedded content</a>.</dd>
+ <dd>If the element has a <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-img-alt><a href=#attr-img-alt>alt</a></code></dd>
+ <dd><code title=attr-img-src><a href=#attr-img-src>src</a></code></dd>
+ <dd><code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code></dd>
+ <dd><code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code></dd>
+ <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code></dd>
+ <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>[NamedConstructor=<a href=#dom-image title=dom-image>Image</a>(),
+ NamedConstructor=<a href=#dom-image-w title=dom-image-w>Image</a>(in unsigned long width),
+ NamedConstructor=<a href=#dom-image-wh title=dom-image-wh>Image</a>(in unsigned long width, in unsigned long height)]
+interface <dfn id=htmlimageelement>HTMLImageElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-img-alt title=dom-img-alt>alt</a>;
+ attribute DOMString <a href=#dom-img-src title=dom-img-src>src</a>;
+ attribute DOMString <a href=#dom-img-usemap title=dom-img-useMap>useMap</a>;
+ attribute boolean <a href=#dom-img-ismap title=dom-img-isMap>isMap</a>;
+ attribute unsigned long <a href=#dom-img-width title=dom-img-width>width</a>;
+ attribute unsigned long <a href=#dom-img-height title=dom-img-height>height</a>;
+ readonly attribute unsigned long <a href=#dom-img-naturalwidth title=dom-img-naturalWidth>naturalWidth</a>;
+ readonly attribute unsigned long <a href=#dom-img-naturalheight title=dom-img-naturalHeight>naturalHeight</a>;
+ readonly attribute boolean <a href=#dom-img-complete title=dom-img-complete>complete</a>;
+};</pre>
+ </dd>
+ </dl><p>An <code><a href=#the-img-element>img</a></code> element represents an image.</p>
+
+ <!-- v2 ideas for <img>:
+
+ * Maps sites would like to know which images are already cached,
+ so that they can use images that are vaguely suitable while
+ they wait for the most appropriate image to download.
+
+ Almost like lowsrc="", except that many images might be
+ appropriate.
+
+ Slight hitch: their images are at a different origin, and we
+ don't want to allow arbitrary cross-origin inspection (privacy
+ leak risk).
+
+ * See note at rel=noreferrer.
+
+ -->
+
+ <p>The image given by the <dfn id=attr-img-src title=attr-img-src><code>src</code></dfn> attribute is the
+ embedded content, and the value of the <dfn id=attr-img-alt title=attr-img-alt><code>alt</code></dfn> attribute is the
+ <code><a href=#the-img-element>img</a></code> element's <a href=#fallback-content>fallback content</a>.</p>
+
+ <p>The <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute must be
+ present, and must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially
+ surrounded by spaces</a> referencing a non-interactive,
+ optionally animated, image resource that is neither paged nor
+ scripted.</p>
+
+ <p class=note>Images can thus be static bitmaps (e.g. PNGs, GIFs,
+ JPEGs), single-page vector documents (single-page PDFs, XML files
+ with an SVG root element), animated bitmaps (APNGs, animated GIFs),
+ animated vector graphics (XML files with an SVG root element that
+ use declarative SMIL animation), and so forth. However, this also
+ precludes SVG files with script, multipage PDF files, interactive
+ MNG files, HTML documents, plain text documents, and so forth.</p>
+
+ <p>The requirements on the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute's value are described <a href=#alt>in the next
+ section</a>.
+ </p>
+
+ <p>The <code><a href=#the-img-element>img</a></code> must not be used as a layout tool. In
+ particular, <code><a href=#the-img-element>img</a></code> elements should not be used to display
+ transparent images, as they rarely convey meaning and rarely add
+ anything useful to the document.</p>
+
+ <div class=impl>
+
+ <hr><p>Unless the user agent cannot support images, or its support for
+ images has been disabled, or the user agent only fetches elements on
+ demand, then, when an <code><a href=#the-img-element>img</a></code> is created with a <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, and whenever the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set subsequently, the
+ user agent must run the following steps:</p> <!-- Note how this does
+ NOT happen when the base URL changes. -->
+
+ <ol><li><p>If the element's <code title=attr-img-src><a href=#attr-img-src>src</a></code>
+ attribute's value is the empty string, then <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-img-element>img</a></code> element,
+ and abort these steps.</li>
+
+ <li>
+
+ <p>Otherwise, <a href=#resolve-a-url title="resolve a url">resolve</a> the value
+ of that attribute, relative to the element, and if that is
+ successful must then <a href=#fetch>fetch</a> that resource.</p> <!--
+ http-origin privacy sensitive -->
+
+ <!-- same text in <input type=image> section and similar text
+ elsewhere --> <p>Fetching the image must <a href=#delay-the-load-event>delay the load
+ event</a> of the element's document until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
+ task">queued</a> by the <a href=#networking-task-source>networking task source</a>
+ once the resource has been <a href=#fetch title=fetch>fetched</a> (<a href=#img-load>defined below</a>) has been run.</p>
+
+ <p class=warning>This, unfortunately, can be used to perform a
+ rudimentary port scan of the user's local network (especially in
+ conjunction with scripting, though scripting isn't actually
+ necessary to carry out such an attack). User agents may implement
+ <a href=#origin title=origin>cross-origin</a> access control policies
+ that mitigate this attack.</p>
+
+ </li>
+
+ </ol><p>If the image is in a supported image type and its dimensions are
+ known, then the image is said to be <dfn id=img-available title=img-available><i>available</i></dfn> (this affects exactly
+ what the element represents, as defined below). This can be true
+ even before the image is completely downloaded, if the user agent
+ supports incremental rendering of images; in such cases, each <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
+ task">queued</a> by the <a href=#networking-task-source>networking task source</a> while
+ the image is being <a href=#fetch title=fetch>fetched</a> must update
+ the presentation of the image appropriately. It can also stop being
+ true, e.g. if the user agent finds, after obtaining the image's
+ dimensions, that the image data is actually fatally corrupted.</p>
+
+ <p>If the image was not fetched (e.g. because the UA's image support
+ is disabled, or because the <code title=attr-img-src><a href=#attr-img-src>src</a></code>
+ attribute's value is the empty string, or if the conditions in the
+ previous paragraph are not met, then the image is <em>not</em> <i title=img-available><a href=#img-available>available</a></i>.</p>
+
+ <p>Whether the image is fetched successfully or not (e.g. whether
+ the response code was a 2xx code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>) must be
+ ignored when determining the image's type and whether it is a valid
+ image.</p>
+
+ <p class=note>This allows servers to return images with error
+ responses, and have them displayed.</p>
+
+ <p>The user agents should apply the <a href=#content-type-sniffing:-image title="Content-Type
+ sniffing: image">image sniffing rules</a> to determine the type
+ of the image, with the image's <a href=#content-type title=Content-Type>associated
+ Content-Type headers</a> giving the <var title="">official
+ type</var>. If these rules are not applied, then the type of the
+ image must be the type given by the image's <a href=#content-type title=Content-Type>associated Content-Type headers</a>.</p>
+
+ <p>User agents must not support non-image resources with the
+ <code><a href=#the-img-element>img</a></code> element (e.g. XML files whose root element is an
+ HTML element). User agents must not run executable code
+ (e.g. scripts) embedded in the image resource. User agents must only
+ display the first page of a multipage resource (e.g. a PDF
+ file). User agents must not allow the resource to act in an
+ interactive fashion, but should honor any animation in the
+ resource.</p>
+
+ <p>This specification does not specify which image types are to be
+ supported.</p>
+
+ <p id=img-load>The <a href=#concept-task title=concept-task>task</a> that is
+ <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>networking
+ task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a>, must act as appropriate given the
+ following alternatives:</p>
+
+ <dl class=switch><dt>If the download was successful and the image is <i title=img-available><a href=#img-available>available</a></i></dt>
+
+ <dd><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-load>load</code> at the <code><a href=#the-img-element>img</a></code>
+ element (this happens after <code title=dom-img-complete><a href=#dom-img-complete>complete</a></code> starts returning
+ true).</dd>
+
+ <dt>Otherwise (the fetching process failed without a response from
+ the remote server, or completed but the image is not a supported
+ image)</dt>
+
+ <dd><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-error>error</code> on the
+ <code><a href=#the-img-element>img</a></code> element.</dd>
+
+ </dl><p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#dom-manipulation-task-source>DOM manipulation
+ task source</a>.</p>
+
+ <hr><p>What an <code><a href=#the-img-element>img</a></code> element represents depends on the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>
+
+ <dl class=switch><dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set
+ and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is set to
+ the empty string</dt>
+
+ <dd>
+
+ <p>The image is either decorative or supplemental to the rest of
+ the content, redundant with some other information in the
+ document.</p>
+
+ <p>If the image is <i title=img-available><a href=#img-available>available</a></i> and the
+ user agent is configured to display that image, then the element
+ <a href=#represents>represents</a> the image specified by the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute.</p>
+
+ <p>Otherwise, the element <a href=#represents>represents</a> nothing, and may
+ be omitted completely from the rendering. User agents may provide
+ the user with a notification that an image is present but has been
+ omitted from the rendering.</p>
+
+ </dd>
+
+ <dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set
+ and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is set to a
+ value that isn't empty</dt>
+
+ <dd>
+
+ <p>The image is a key part of the content; the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute gives a textual
+ equivalent or replacement for the image.</p>
+
+ <p>If the image is <i title=img-available><a href=#img-available>available</a></i> and the
+ user agent is configured to display that image, then the element
+ <a href=#represents>represents</a> the image specified by the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute.</p>
+
+ <p>Otherwise, the element <a href=#represents>represents</a> the text given
+ by the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute. User
+ agents may provide the user with a notification that an image is
+ present but has been omitted from the rendering.</p>
+
+ </dd>
+
+ <dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set
+ and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is not</dt>
+
+ <dd>
+
+ <p>The image might be a key part of the content, and there is no
+ textual equivalent of the image available.</p>
+
+ <p class=note>In a conforming document, the absence of the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute indicates that the image
+ is a key part of the content but that a textual replacement for
+ the image was not available when the image was generated.</p>
+
+ <p>If the image is <i title=img-available><a href=#img-available>available</a></i>, the
+ element <a href=#represents>represents</a> the image specified by the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute.</p>
+
+ <p>If the image is not <i title=img-available><a href=#img-available>available</a></i> or
+ if the user agent is not configured to display the image, then the
+ user agent should display some sort of indicator that there is an
+ image that is not being rendered, and may, if requested by the
+ user, or if so configured, or when required to provide contextual
+ information in response to navigation, provide caption information
+ for the image, derived as follows:</p>
+
+ <ol><!-- when editing this list, search for the two other occurrences
+ of 'critical-no-alt' --><li><p>If the image has a <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute whose value is not the empty string, then the value of
+ that attribute is the caption information; abort these
+ steps.</li>
+
+ <li><p>If the image is the child of a <code><a href=#the-figure-element>figure</a></code> element
+ that has a child <code><a href=#the-figcaption-element>figcaption</a></code> element, then the
+ contents of the first such <code><a href=#the-figcaption-element>figcaption</a></code> element are
+ the caption information; abort these steps.</li>
+
+ </ol></dd>
+
+ <dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is not
+ set and either the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute
+ is set to the empty string or the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is not set at all</dt>
+
+ <dd>
+
+ <p>The element <a href=#represents>represents</a> nothing.</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>The element <a href=#represents>represents</a> the text given by the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>
+
+ </dd>
+
+ </dl><p>The <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute does not
+ represent advisory information. User agents must not present the
+ contents of the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute in
+ the same way as content of the <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute.</p>
+
+ <p>User agents may always provide the user with the option to
+ display any image, or to prevent any image from being
+ displayed. User agents may also apply heuristics to help the user
+ make use of the image when the user is unable to see it, e.g. due to
+ a visual disability or because they are using a text terminal with
+ no graphics capabilities. Such heuristics could include, for
+ instance, optical character recognition (OCR) of text found within
+ the image.</p>
+
+ <p class=warning>While user agents are encouraged to repair cases
+ of missing <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attributes, authors
+ must not rely on such behavior. <a href=#alt>Requirements for
+ providing text to act as an alternative for images</a> are described
+ in detail below.</p>
+
+ <p>The <em>contents</em> of <code><a href=#the-img-element>img</a></code> elements, if any, are
+ ignored for the purposes of rendering.</p>
+
+ </div>
+
+ <hr><p>The <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute,
+ if present, can indicate that the image has an associated
+ <a href=#image-map>image map</a>.</p>
+
+ <p>The <dfn id=attr-img-ismap title=attr-img-ismap><code>ismap</code></dfn>
+ attribute, when used on an element that is a descendant of an
+ <code><a href=#the-a-element>a</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, indicates by its
+ presence that the element provides access to a server-side image
+ map. This affects how events are handled on the corresponding
+ <code><a href=#the-a-element>a</a></code> element.</p>
+
+ <p>The <code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> attribute is a
+ <a href=#boolean-attribute>boolean attribute</a>. The attribute must not be specified
+ on an element that does not have an ancestor <code><a href=#the-a-element>a</a></code> element
+ with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute.</p>
+
+ <p>The <code><a href=#the-img-element>img</a></code> element supports <a href=#dimension-attributes>dimension
+ attributes</a>.</p>
+
+ <div class=impl>
+
+ <p>The IDL attributes <dfn id=dom-img-alt title=dom-img-alt><code>alt</code></dfn>, <dfn id=dom-img-src title=dom-img-src><code>src</code></dfn>, <dfn id=dom-img-usemap title=dom-img-useMap><code>useMap</code></dfn>, and <dfn id=dom-img-ismap title=dom-img-isMap><code>isMap</code></dfn> each must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">image</var> . <code title=dom-img-width><a href=#dom-img-width>width</a></code> [ = <var title="">value</var> ]</dt>
+ <dt><var title="">image</var> . <code title=dom-img-height><a href=#dom-img-height>height</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>These attributes return the actual rendered dimensions of the
+ image, or zero if the dimensions are not known.</p>
+
+ <p>They can be set, to change the corresponding content
+ attributes.</p>
+
+ </dd>
+
+ <dt><var title="">image</var> . <code title=dom-img-naturalWidth><a href=#dom-img-naturalwidth>naturalWidth</a></code></dt>
+ <dt><var title="">image</var> . <code title=dom-img-naturalHeight><a href=#dom-img-naturalheight>naturalHeight</a></code></dt>
+
+ <dd>
+
+ <p>These attributes return the intrinsic dimensions of the image,
+ or zero if the dimensions are not known.</p>
+
+ </dd>
+
+ <dt><var title="">image</var> . <code title=dom-img-complete><a href=#dom-img-complete>complete</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the image has been downloaded, decoded, and
+ found to be valid; otherwise, returns false.</p>
+
+ </dd>
+
+ <dt><var title="">image</var> = new <code title=dom-image><a href=#dom-image>Image</a></code>( [ <var title="">width</var> [, <var title="">height</var> ] ] )</dt>
+
+ <dd>
+
+ <p>Returns a new <code><a href=#the-img-element>img</a></code> element, with the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes set to the values
+ passed in the relevant arguments, if applicable.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The IDL attributes <dfn id=dom-img-width title=dom-img-width><code>width</code></dfn> and <dfn id=dom-img-height title=dom-img-height><code>height</code></dfn> must return the
+ rendered width and height of the image, in CSS pixels, if the image
+ is <a href=#being-rendered>being rendered</a>, and is being rendered to a visual
+ medium; or else the intrinsic width and height of the image, in CSS
+ pixels, if the image is <i title=img-available><a href=#img-available>available</a></i> but
+ not being rendered to a visual medium; or else 0, if the image is
+ not <i title=img-available><a href=#img-available>available</a></i>. <a href=#refsCSS>[CSS]</a></p>
+
+ <p>On setting, they must act as if they <a href=#reflect title=reflect>reflected</a> the respective content attributes
+ of the same name.</p>
+
+ <p>The IDL attributes <dfn id=dom-img-naturalwidth title=dom-img-naturalWidth><code>naturalWidth</code></dfn> and
+ <dfn id=dom-img-naturalheight title=dom-img-naturalHeight><code>naturalHeight</code></dfn>
+ must return the intrinsic width and height of the image, in CSS
+ pixels, if the image is <i title=img-available><a href=#img-available>available</a></i>, or
+ else 0. <a href=#refsCSS>[CSS]</a></p>
+
+ <p>The IDL attribute <dfn id=dom-img-complete title=dom-img-complete><code>complete</code></dfn> must return
+ true if the user agent has fetched the image specified in the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, and it is in a supported
+ image type (i.e. it was decoded without fatal errors), even if the
+ final <a href=#concept-task title=concept-task>task</a> queued by the
+ <a href=#networking-task-source>networking task source</a> for the <a href=#fetch title=fetch>fetching</a> of the image resource has not yet been
+ processed. Otherwise, the attribute must return false.</p>
+
+ <p class=note>The value of <code title=dom-img-complete><a href=#dom-img-complete>complete</a></code> can thus change while a
+ <a href=#concept-script title=concept-script>script</a> is executing.</p>
+
+ <p>Three constructors are provided for creating
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code> objects (in addition to the factory
+ methods from DOM Core such as <code title="">createElement()</code>): <dfn id=dom-image title=dom-image><code>Image()</code></dfn>, <dfn id=dom-image-w title=dom-image-w><code>Image(<var title="">width</var>)</code></dfn>, and <dfn id=dom-image-wh title=dom-image-wh><code>Image(<var title="">width</var>, <var title="">height</var>)</code></dfn>. When invoked as constructors,
+ these must return a new <code><a href=#htmlimageelement>HTMLImageElement</a></code> object (a new
+ <code><a href=#the-img-element>img</a></code> element). If the <var title="">width</var> argument
+ is present, the new object's <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> content attribute must be set to
+ <var title="">width</var>. If the <var title="">height</var>
+ argument is also present, the new object's <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> content attribute must be set
+ to <var title="">height</var>. The element's document must be the
+ <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a> of
+ the <code><a href=#window>Window</a></code> object on which the interface object of the
+ invoked constructor is found.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>A single image can have different appropriate alternative text
+ depending on the context.</p>
+
+ <p>In each of the following cases, the same image is used, yet the
+ <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> text is different each
+ time. The image is the coat of arms of the Carouge municipality in
+ the canton Geneva in Switzerland.</p>
+
+ <p>Here it is used as a supplementary icon:</p>
+ <pre>&lt;p&gt;I lived in &lt;img src="carouge.svg" alt=""&gt; Carouge.&lt;/p&gt;</pre>
+
+ <p>Here it is used as an icon representing the town:</p>
+ <pre>&lt;p&gt;Home town: &lt;img src="carouge.svg" alt="Carouge"&gt;&lt;/p&gt;</pre>
+
+ <p>Here it is used as part of a text on the town:</p>
+
+ <pre>&lt;p&gt;Carouge has a coat of arms.&lt;/p&gt;
+&lt;p&gt;&lt;img src="carouge.svg" alt="The coat of arms depicts a lion, sitting in front of a tree."&gt;&lt;/p&gt;
+&lt;p&gt;It is used as decoration all over the town.&lt;/p&gt;</pre>
+
+ <p>Here it is used as a way to support a similar text where the
+ description is given as well as, instead of as an alternative to,
+ the image:</p>
+
+ <pre>&lt;p&gt;Carouge has a coat of arms.&lt;/p&gt;
+&lt;p&gt;&lt;img src="carouge.svg" alt=""&gt;&lt;/p&gt;
+&lt;p&gt;The coat of arms depicts a lion, sitting in front of a tree.
+It is used as decoration all over the town.&lt;/p&gt;</pre>
+
+ <p>Here it is used as part of a story:</p>
+
+ <pre>&lt;p&gt;He picked up the folder and a piece of paper fell out.&lt;/p&gt;
+&lt;p&gt;&lt;img src="carouge.svg" alt="Shaped like a shield, the paper had a
+red background, a green tree, and a yellow lion with its tongue
+hanging out and whose tail was shaped like an S."&gt;&lt;/p&gt;
+&lt;p&gt;He stared at the folder. S! The answer he had been looking for all
+this time was simply the letter S! How had he not seen that before? It all
+came together now. The phone call where Hector had referred to a lion's tail,
+the time Marco had stuck his tongue out...&lt;/p&gt;</pre>
+
+ <p>Here it is not known at the time of publication what the image
+ will be, only that it will be a coat of arms of some kind, and thus
+ no replacement text can be provided, and instead only a brief
+ caption for the image is provided, in the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute:</p>
+
+ <pre>&lt;p&gt;The last user to have uploaded a coat of arms uploaded this one:&lt;/p&gt;
+&lt;p&gt;&lt;img src="last-uploaded-coat-of-arms.cgi" title="User-uploaded coat of arms."&gt;&lt;/p&gt;</pre>
+
+ <p>Ideally, the author would find a way to provide real replacement
+ text even in this case, e.g. by asking the previous user. Not
+ providing replacement text makes the document more difficult to use
+ for people who are unable to view images, e.g. blind users, or
+ users or very low-bandwidth connections or who pay by the byte, or
+ users who are forced to use a text-only Web browser.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here are some more examples showing the same picture used in
+ different contexts, with different appropriate alternate texts each
+ time.</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;My cats&lt;/h1&gt;
+ &lt;h2&gt;Fluffy&lt;/h2&gt;
+ &lt;p&gt;Fluffy is my favorite.&lt;/p&gt;
+ &lt;img src="fluffy.jpg" alt="She likes playing with a ball of yarn."&gt;
+ &lt;p&gt;She's just too cute.&lt;/p&gt;
+ &lt;h2&gt;Miles&lt;/h2&gt;
+ &lt;p&gt;My other cat, Miles just eats and sleeps.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;Photography&lt;/h1&gt;
+ &lt;h2&gt;Shooting moving targets indoors&lt;/h2&gt;
+ &lt;p&gt;The trick here is to know how to anticipate; to know at what speed and
+ what distance the subject will pass by.&lt;/p&gt;
+ &lt;img src="fluffy.jpg" alt="A cat flying by, chasing a ball of yarn, can be
+ photographed quite nicely using this technique."&gt;
+ &lt;h2&gt;Nature by night&lt;/h2&gt;
+ &lt;p&gt;To achieve this, you'll need either an extremely sensitive film, or
+ immense flash lights.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;About me&lt;/h1&gt;
+ &lt;h2&gt;My pets&lt;/h2&gt;
+ &lt;p&gt;I've got a cat named Fluffy and a dog named Miles.&lt;/p&gt;
+ &lt;img src="fluffy.jpg" alt="Fluffy, my cat, tends to keep itself busy."&gt;
+ &lt;p&gt;My dog Miles and I like go on long walks together.&lt;/p&gt;
+ &lt;h2&gt;music&lt;/h2&gt;
+ &lt;p&gt;After our walks, having emptied my mind, I like listening to Bach.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;Fluffy and the Yarn&lt;/h1&gt;
+ &lt;p&gt;Fluffy was a cat who liked to play with yarn. He also liked to jump.&lt;/p&gt;
+ &lt;aside&gt;&lt;img src="fluffy.jpg" alt="" title="Fluffy"&gt;&lt;/aside&gt;
+ &lt;p&gt;He would play in the morning, he would play in the evening.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ </div>
+
+
+
+ <h5 id=alt><span class=secno>4.8.1.1 </span>Requirements for providing text to act as an alternative for images</h5>
+
+ <p>Except where otherwise specified, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be specified and its
+ value must not be empty; the value must be an appropriate
+ replacement for the image. The specific requirements for the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute depend on what the image
+ is intended to represent, as described in the following
+ sections.</p>
+
+
+ <h6 id=a-link-or-button-containing-nothing-but-the-image><span class=secno>4.8.1.1.1 </span>A link or button containing nothing but the image</h6>
+
+ <p>When an <a href=#the-a-element>a</a> element that is a <a href=#hyperlink>hyperlink</a>,
+ or a <code><a href=#the-button-element>button</a></code> element, has no textual content but
+ contains one or more images, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attributes must contain text that
+ together convey the purpose of the link or button.</p>
+
+ <div class=example>
+
+ <p>In this example, a user is asked to pick his preferred color
+ from a list of three. Each color is given by an image, but for
+ users who have configured their user agent not to display images,
+ the color names are used instead:</p>
+
+ <pre>&lt;h1&gt;Pick your color&lt;/h1&gt;
+&lt;ul&gt;
+ &lt;li&gt;&lt;a href="green.html"&gt;<strong>&lt;img src="green.jpeg" alt="Green"&gt;</strong>&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="blue.html"&gt;<strong>&lt;img src="blue.jpeg" alt="Blue"&gt;</strong>&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="red.html"&gt;<strong>&lt;img src="red.jpeg" alt="Red"&gt;</strong>&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, each button has a set of images to indicate the
+ kind of color output desired by the user. The first image is used
+ in each case to give the alternative text.</p>
+
+ <pre>&lt;button name="rgb"&gt;<strong>&lt;img src="red" alt="RGB"&gt;&lt;img src="green" alt=""&gt;&lt;img src="blue" alt=""&gt;</strong>&lt;/button&gt;
+&lt;button name="cmyk"&gt;<strong>&lt;img src="cyan" alt="CMYK"&gt;&lt;img src="magenta" alt=""&gt;&lt;img src="yellow" alt=""&gt;&lt;img src="black" alt=""&gt;</strong>&lt;/button&gt;</pre>
+
+ <p>Since each image represents one part of the text, it could also
+ be written like this:</p>
+
+ <pre>&lt;button name="rgb"&gt;<strong>&lt;img src="red" alt="R"&gt;&lt;img src="green" alt="G"&gt;&lt;img src="blue" alt="B"&gt;</strong>&lt;/button&gt;
+&lt;button name="cmyk"&gt;<strong>&lt;img src="cyan" alt="C"&gt;&lt;img src="magenta" alt="M"&gt;&lt;img src="yellow" alt="Y"&gt;&lt;img src="black" alt="K"&gt;</strong>&lt;/button&gt;</pre>
+
+ <p>However, with other alternative text, this might not work, and
+ putting all the alternative text into one image in each case might
+ make more sense:</p>
+
+ <pre>&lt;button name="rgb"&gt;<strong>&lt;img src="red" alt="sRGB profile"&gt;&lt;img src="green" alt=""&gt;&lt;img src="blue" alt=""&gt;</strong>&lt;/button&gt;
+&lt;button name="cmyk"&gt;<strong>&lt;img src="cyan" alt="CMYK profile"&gt;&lt;img src="magenta" alt=""&gt;&lt;img src="yellow" alt=""&gt;&lt;img src="black" alt=""&gt;</strong>&lt;/button&gt;</pre>
+
+ </div>
+
+
+
+ <h6 id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations><span class=secno>4.8.1.1.2 </span>A phrase or paragraph with an alternative graphical representation: charts, diagrams, graphs, maps, illustrations</h6>
+
+ <p>Sometimes something can be more clearly stated in graphical
+ form, for example as a flowchart, a diagram, a graph, or a simple
+ map showing directions. In such cases, an image can be given using
+ the <code><a href=#the-img-element>img</a></code> element, but the lesser textual version must
+ still be given, so that users who are unable to view the image
+ (e.g. because they have a very slow connection, or because they
+ are using a text-only browser, or because they are listening to
+ the page being read out by a hands-free automobile voice Web
+ browser, or simply because they are blind) are still able to
+ understand the message being conveyed.</p>
+
+ <p>The text must be given in the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute, and must convey the
+ same message as the image specified in the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute.</p>
+
+ <p>It is important to realize that the alternative text is a
+ <em>replacement</em> for the image, not a description of the
+ image.</p>
+
+ <div class=example>
+
+ <p>In the following example we have <a href=images/parsing-model-overview.png>a flowchart</a> in image
+ form, with text in the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute rephrasing the flowchart in prose form:</p>
+
+ <pre>&lt;p&gt;In the common case, the data handled by the tokenization stage
+comes from the network, but it can also come from script.&lt;/p&gt;
+&lt;p&gt;<strong>&lt;img src="images/parsing-model-overview.png" alt="The network
+passes data to the Tokenizer stage, which passes data to the Tree
+Construction stage. From there, data goes to both the DOM and to
+Script Execution. Script Execution is linked to the DOM, and, using
+document.write(), passes data to the Tokenizer."&gt;</strong>&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here's another example, showing a good solution and a bad
+ solution to the problem of including an image in a
+ description.</p>
+
+ <p>First, here's the good solution. This sample shows how the
+ alternative text should just be what you would have put in the
+ prose if the image had never existed.</p>
+
+ <pre>&lt;!-- This is the correct way to do things. --&gt;
+&lt;p&gt;
+ You are standing in an open field west of a house.
+ <strong>&lt;img src="house.jpeg" alt="The house is white, with a boarded front door."&gt;</strong>
+ There is a small mailbox here.
+&lt;/p&gt;</pre>
+
+ <p>Second, here's the bad solution. In this incorrect way of
+ doing things, the alternative text is simply a description of the
+ image, instead of a textual replacement for the image. It's bad
+ because when the image isn't shown, the text doesn't flow as well
+ as in the first example.</p>
+
+ <pre class=bad>&lt;!-- <em>This is the wrong way to do things.</em> --&gt;
+&lt;p&gt;
+ You are standing in an open field west of a house.
+ &lt;img src="house.jpeg" alt="A white house, with a boarded front door."&gt;
+ There is a small mailbox here.
+&lt;/p&gt;</pre>
+
+ <p>Text such as "Photo of white house with boarded door" would be
+ equally bad alternative text (though it could be suitable for the
+ <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute or in the
+ <code><a href=#the-figcaption-element>figcaption</a></code> element of a <code><a href=#the-figure-element>figure</a></code> with this
+ image).</p>
+
+ </div>
+
+
+ <h6 id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos><span class=secno>4.8.1.1.3 </span>A short phrase or label with an alternative graphical representation: icons, logos</h6>
+
+ <p>A document can contain information in iconic form. The icon is
+ intended to help users of visual browsers to recognize features at
+ a glance.</p>
+
+ <p>In some cases, the icon is supplemental to a text label
+ conveying the same meaning. In those cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be present but must
+ be empty.</p>
+
+ <div class=example>
+
+ <p>Here the icons are next to text that conveys the same meaning,
+ so they have an empty <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute:</p>
+
+ <pre>&lt;nav&gt;
+ &lt;p&gt;&lt;a href="/help/"&gt;<strong>&lt;img src="/icons/help.png" alt=""&gt;</strong> Help&lt;/a&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;a href="/configure/"&gt;<strong>&lt;img src="/icons/configuration.png" alt=""&gt;</strong>
+ Configuration Tools&lt;/a&gt;&lt;/p&gt;
+&lt;/nav&gt;</pre>
+
+ </div>
+
+ <p>In other cases, the icon has no text next to it describing what
+ it means; the icon is supposed to be self-explanatory. In those
+ cases, an equivalent textual label must be given in the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>
+
+ <div class=example>
+
+ <p>Here, posts on a news site are labeled with an icon
+ indicating their topic.</p>
+
+ <pre>&lt;body&gt;
+ &lt;article&gt;
+ &lt;header&gt;
+ &lt;h1&gt;Ratatouille wins &lt;i&gt;Best Movie of the Year&lt;/i&gt; award&lt;/h1&gt;
+ &lt;p&gt;<strong>&lt;img src="movies.png" alt="Movies"&gt;</strong>&lt;/p&gt;
+ &lt;/header&gt;
+ &lt;p&gt;Pixar has won yet another &lt;i&gt;Best Movie of the Year&lt;/i&gt; award,
+ making this its 8th win in the last 12 years.&lt;/p&gt;
+ &lt;/article&gt;
+ &lt;article&gt;
+ &lt;header&gt;
+ &lt;h1&gt;Latest TWiT episode is online&lt;/h1&gt;
+ &lt;p&gt;<strong>&lt;img src="podcasts.png" alt="Podcasts"&gt;</strong>&lt;/p&gt;
+ &lt;/header&gt;
+ &lt;p&gt;The latest TWiT episode has been posted, in which we hear
+ several tech news stories as well as learning much more about the
+ iPhone. This week, the panelists compare how reflective their
+ iPhones' Apple logos are.&lt;/p&gt;
+ &lt;/article&gt;
+&lt;/body&gt;</pre>
+
+ </div>
+
+ <p>Many pages include logos, insignia, flags, or emblems, which
+ stand for a particular entity such as a company, organization,
+ project, band, software package, country, or some such.</p>
+
+ <p>If the logo is being used to represent the entity, e.g. as a page
+ heading, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must
+ contain the name of the entity being represented by the logo. The
+ <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must <em>not</em>
+ contain text like the word "logo", as it is not the fact that it is
+ a logo that is being conveyed, it's the entity itself.</p>
+
+ <p>If the logo is being used next to the name of the entity that
+ it represents, then the logo is supplemental, and its <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must instead be
+ empty.</p>
+
+ <p>If the logo is merely used as decorative material (as branding,
+ or, for example, as a side image in an article that mentions the
+ entity to which the logo belongs), then the entry below on purely
+ decorative images applies. If the logo is actually being
+ discussed, then it is being used as a phrase or paragraph (the
+ description of the logo) with an alternative graphical
+ representation (the logo itself), and the first entry above
+ applies.</p>
+
+ <div class=example>
+
+ <p>In the following snippets, all four of the above cases are
+ present. First, we see a logo used to represent a company:</p>
+
+ <pre>&lt;h1&gt;<strong>&lt;img src="XYZ.gif" alt="The XYZ company"&gt;</strong>&lt;/h1&gt;</pre>
+
+ <p>Next, we see a paragraph which uses a logo right next to the
+ company name, and so doesn't have any alternative text:
+
+ <pre>&lt;article&gt;
+ &lt;h2&gt;News&lt;/h2&gt;
+ &lt;p&gt;We have recently been looking at buying the <strong>&lt;img src="alpha.gif"
+ alt=""&gt; &Alpha;&Beta;&Gamma; company</strong>, a small Greek company
+ specializing in our type of product.&lt;/p&gt;</pre>
+
+ <p>In this third snippet, we have a logo being used in an aside,
+ as part of the larger article discussing the acquisition:</p>
+
+<pre> <strong>&lt;aside&gt;&lt;p&gt;&lt;img src="alpha-large.gif" alt=""&gt;&lt;/p&gt;&lt;/aside&gt;</strong>
+ &lt;p&gt;The &Alpha;&Beta;&Gamma; company has had a good quarter, and our
+ pie chart studies of their accounts suggest a much bigger blue slice
+ than its green and orange slices, which is always a good sign.&lt;/p&gt;
+&lt;/article&gt;</pre>
+
+ <p>Finally, we have an opinion piece talking about a logo, and
+ the logo is therefore described in detail in the alternative
+ text.</p>
+
+ <pre>&lt;p&gt;Consider for a moment their logo:&lt;/p&gt;
+
+<strong>&lt;p&gt;&lt;img src="/images/logo" alt="It consists of a green circle with a
+green question mark centered inside it."&gt;&lt;/p&gt;</strong>
+
+&lt;p&gt;How unoriginal can you get? I mean, oooooh, a question mark, how
+&lt;em&gt;revolutionary&lt;/em&gt;, how utterly &lt;em&gt;ground-breaking&lt;/em&gt;, I'm
+sure everyone will rush to adopt those specifications now! They could
+at least have tried for some sort of, I don't know, sequence of
+rounded squares with varying shades of green and bold white outlines,
+at least that would look good on the cover of a blue book.&lt;/p&gt;</pre>
+
+ <p>This example shows how the alternative text should be written
+ such that if the image isn't <i title=img-available><a href=#img-available>available</a></i>, and the text is used instead,
+ the text flows seamlessly into the surrounding text, as if the
+ image had never been there in the first place.</p>
+
+ </div>
+
+
+ <h6 id=text-that-has-been-rendered-to-a-graphic-for-typographical-effect><span class=secno>4.8.1.1.4 </span>Text that has been rendered to a graphic for typographical effect</h6>
+
+ <p>Sometimes, an image just consists of text, and the purpose of the
+ image is not to highlight the actual typographic effects used to
+ render the text, but just to convey the text itself.</p>
+
+ <p>In such cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute must be present but must consist of the same text as
+ written in the image itself.</p>
+
+ <div class=example>
+
+ <p>Consider a graphic containing the text "Earth Day", but with the
+ letters all decorated with flowers and plants. If the text is
+ merely being used as a heading, to spice up the page for graphical
+ users, then the correct alternative text is just the same text
+ "Earth Day", and no mention need be made of the decorations:</p>
+
+ <pre>&lt;h1&gt;<strong>&lt;img src="earthdayheading.png" alt="Earth Day"&gt;</strong>&lt;/h1&gt;</pre>
+
+ </div>
+
+
+
+ <h6 id=a-graphical-representation-of-some-of-the-surrounding-text><span class=secno>4.8.1.1.5 </span>A graphical representation of some of the surrounding text</h6>
+
+ <p>In many cases, the image is actually just supplementary, and
+ its presence merely reinforces the surrounding text. In these
+ cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be
+ present but its value must be the empty string.</p>
+
+ <p>In general, an image falls into this category if removing the
+ image doesn't make the page any less useful, but including the
+ image makes it a lot easier for users of visual browsers to
+ understand the concept.</p>
+
+ <div class=example>
+
+ <p>A flowchart that repeats the previous paragraph in graphical form:</p>
+
+ <pre>&lt;p&gt;The network passes data to the Tokenizer stage, which
+passes data to the Tree Construction stage. From there, data goes
+to both the DOM and to Script Execution. Script Execution is
+linked to the DOM, and, using document.write(), passes data to
+the Tokenizer.&lt;/p&gt;
+<strong>&lt;p&gt;&lt;img src="images/parsing-model-overview.png" alt=""&gt;&lt;/p&gt;</strong></pre>
+
+ <p>In these cases, it would be wrong to include alternative text
+ that consists of just a caption. If a caption is to be included,
+ then either the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute can
+ be used, or the <code><a href=#the-figure-element>figure</a></code> and <code><a href=#the-figcaption-element>figcaption</a></code>
+ elements can be used. In the latter case, the image would in fact
+ be a phrase or paragraph with an alternative graphical
+ representation, and would thus require alternative text.</p>
+
+ <pre>&lt;!-- Using the title="" attribute --&gt;
+&lt;p&gt;The network passes data to the Tokenizer stage, which
+passes data to the Tree Construction stage. From there, data goes
+to both the DOM and to Script Execution. Script Execution is
+linked to the DOM, and, using document.write(), passes data to
+the Tokenizer.&lt;/p&gt;
+&lt;p&gt;<strong>&lt;img src="images/parsing-model-overview.png" alt=""
+ title="Flowchart representation of the parsing model."&gt;</strong>&lt;/p&gt;</pre>
+
+ <pre>&lt;!-- Using &lt;figure&gt; and &lt;figcaption&gt; --&gt;
+&lt;p&gt;The network passes data to the Tokenizer stage, which
+passes data to the Tree Construction stage. From there, data goes
+to both the DOM and to Script Execution. Script Execution is
+linked to the DOM, and, using document.write(), passes data to
+the Tokenizer.&lt;/p&gt;
+&lt;figure&gt;
+ <strong>&lt;img src="images/parsing-model-overview.png" alt="The Network leads
+ to the Tokenizer, which leads to the Tree Construction. The Tree
+ Construction leads to two items. The first is Script Execution, which
+ leads via document.write() back to the Tokenizer. The second item
+ from which Tree Construction leads is the DOM. The DOM is related to
+ the Script Execution."&gt;</strong>
+ &lt;figcaption&gt;Flowchart representation of the parsing model.&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ <pre class=bad>&lt;!-- This is WRONG. Do not do this. Instead, do what the above examples do. --&gt;
+&lt;p&gt;The network passes data to the Tokenizer stage, which
+passes data to the Tree Construction stage. From there, data goes
+to both the DOM and to Script Execution. Script Execution is
+linked to the DOM, and, using document.write(), passes data to
+the Tokenizer.&lt;/p&gt;
+&lt;p&gt;&lt;img src="images/parsing-model-overview.png"
+ alt="Flowchart representation of the parsing model."&gt;&lt;/p&gt;
+&lt;!-- Never put the image's caption in the alt="" attribute! --&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>A graph that repeats the previous paragraph in graphical form:</p>
+
+ <pre>&lt;p&gt;According to a study covering several billion pages,
+about 62% of documents on the Web in 2007 triggered the Quirks
+rendering mode of Web browsers, about 30% triggered the Almost
+Standards mode, and about 9% triggered the Standards mode.&lt;/p&gt;
+<strong>&lt;p&gt;&lt;img src="rendering-mode-pie-chart.png" alt=""&gt;&lt;/p&gt;</strong></pre>
+
+ </div>
+
+
+
+ <h6 id="a-purely-decorative-image-that-doesn't-add-any-information"><span class=secno>4.8.1.1.6 </span>A purely decorative image that doesn't add any information</h6>
+
+ <p>In general, if an image is decorative but isn't especially
+ page-specific, for example an image that forms part of a site-wide
+ design scheme, the image should be specified in the site's CSS,
+ not in the markup of the document.</p>
+
+ <p>However, a decorative image that isn't discussed by the
+ surrounding text but still has some relevance can be included in a page
+ using the <code><a href=#the-img-element>img</a></code> element. Such images are decorative, but
+ still form part of the content. In these cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be present but its
+ value must be the empty string.</p>
+
+ <div class=example>
+
+ <p>Examples where the image is purely decorative despite being
+ relevant would include things like a photo of the Black Rock City
+ landscape in a blog post about an event at Burning Man, or an
+ image of a painting inspired by a poem, on a page reciting that
+ poem. The following snippet shows an example of the latter
+ case (only the first verse is included in this snippet):</p>
+
+ <pre>&lt;h1&gt;The Lady of Shalott&lt;/h1&gt;
+<strong>&lt;p&gt;&lt;img src="shalott.jpeg" alt=""&gt;&lt;/p&gt;</strong>
+&lt;p&gt;On either side the river lie&lt;br&gt;
+Long fields of barley and of rye,&lt;br&gt;
+That clothe the wold and meet the sky;&lt;br&gt;
+And through the field the road run by&lt;br&gt;
+To many-tower'd Camelot;&lt;br&gt;
+And up and down the people go,&lt;br&gt;
+Gazing where the lilies blow&lt;br&gt;
+Round an island there below,&lt;br&gt;
+The island of Shalott.&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h6 id=a-group-of-images-that-form-a-single-larger-picture-with-no-links><span class=secno>4.8.1.1.7 </span>A group of images that form a single larger picture with no links</h6>
+
+ <p>When a picture has been sliced into smaller image files that are
+ then displayed together to form the complete picture again, one of
+ the images must have its <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute set as per the relevant rules that would be appropriate
+ for the picture as a whole, and then all the remaining images must
+ have their <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute set to
+ the empty string.</p>
+
+ <div class=example>
+
+ <p>In the following example, a picture representing a company logo
+ for <span title="">XYZ Corp</span> has been split into two pieces,
+ the first containing the letters "XYZ" and the second with the word
+ "Corp". The alternative text ("XYZ Corp") is all in the first
+ image.</p>
+
+ <pre>&lt;h1&gt;<strong>&lt;img src="logo1.png" alt="XYZ Corp"&gt;&lt;img src="logo2.png" alt=""&gt;</strong>&lt;/h1&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, a rating is shown as three filled
+ stars and two empty stars. While the alternative text could have
+ been "&#9733;&#9733;&#9733;&#9734;&#9734;", the author has
+ instead decided to more helpfully give the rating in the form "3
+ out of 5". That is the alternative text of the first image, and the
+ rest have blank alternative text.</p>
+
+ <pre>&lt;p&gt;Rating: &lt;meter max=5 value=3&gt;<strong>&lt;img src="1" alt="3 out of 5"
+ &gt;&lt;img src="1" alt=""&gt;&lt;img src="1" alt=""&gt;&lt;img src="0" alt=""
+ &gt;&lt;img src="0" alt=""&gt;</strong>&lt;/meter&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h6 id=a-group-of-images-that-form-a-single-larger-picture-with-links><span class=secno>4.8.1.1.8 </span>A group of images that form a single larger picture with links</h6>
+
+ <p>Generally, <a href=#image-map title="image map">image maps</a> should be
+ used instead of slicing an image for links.</p>
+
+ <p>However, if an image is indeed sliced and any of the components
+ of the sliced picture are the sole contents of links, then one image
+ per link must have alternative text in its <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute representing the purpose
+ of the link.</p>
+
+ <div class=example>
+
+ <p>In the following example, a picture representing the flying
+ spaghetti monster emblem, with each of the left noodly appendages
+ and the right noodly appendages in different images, so that the
+ user can pick the left side or the right side in an adventure.</p>
+
+ <pre>&lt;h1&gt;The Church&lt;/h1&gt;
+&lt;p&gt;You come across a flying spaghetti monster. Which side of His
+Noodliness do you wish to reach out for?&lt;/p&gt;
+<strong>&lt;p&gt;&lt;a href="?go=left" &gt;&lt;img src="fsm-left.png" alt="Left side. "&gt;&lt;/a
+ &gt;&lt;img src="fsm-middle.png" alt=""
+ &gt;&lt;a href="?go=right"&gt;&lt;img src="fsm-right.png" alt="Right side."&gt;&lt;/a&gt;&lt;/p&gt;</strong></pre>
+
+ </div>
+
+
+
+ <h6 id=a-key-part-of-the-content><span class=secno>4.8.1.1.9 </span>A key part of the content</h6>
+
+ <p>In some cases, the image is a critical part of the
+ content. This could be the case, for instance, on a page that is
+ part of a photo gallery. The image is the whole <em>point</em> of
+ the page containing it.</p>
+
+ <p>How to provide alternative text for an image that is a key part
+ of the content depends on the image's provenance.</p>
+
+ <dl><dt>The general case</dt>
+
+ <dd>
+
+ <p>When it is possible for detailed alternative text to be
+ provided, for example if the image is part of a series of
+ screenshots in a magazine review, or part of a comic strip, or is
+ a photograph in a blog entry about that photograph, text that can
+ serve as a substitute for the image must be given as the contents
+ of the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>
+
+ <div class=example>
+
+ <p>A screenshot in a gallery of screenshots for a new OS, with
+ some alternative text:</p>
+
+ <pre>&lt;figure&gt;
+ <strong>&lt;img src="KDE%20Light%20desktop.png"
+ alt="The desktop is blue, with icons along the left hand side in
+ two columns, reading System, Home, K-Mail, etc. A window is
+ open showing that menus wrap to a second line if they
+ cannot fit in the window. The window has a list of icons
+ along the top, with an address bar below it, a list of
+ icons for tabs along the left edge, a status bar on the
+ bottom, and two panes in the middle. The desktop has a bar
+ at the bottom of the screen with a few buttons, a pager, a
+ list of open applications, and a clock."&gt;</strong>
+ &lt;figcaption&gt;Screenshot of a KDE desktop.&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>A graph in a financial report:</p>
+
+ <pre><strong>&lt;img src="sales.gif"
+ title="Sales graph"
+ alt="From 1998 to 2005, sales increased by the following percentages
+ with each year: 624%, 75%, 138%, 40%, 35%, 9%, 21%"&gt;</strong></pre>
+
+ <p>Note that "sales graph" would be inadequate alternative text
+ for a sales graph. Text that would be a good <em>caption</em> is
+ not generally suitable as replacement text.</p>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Images that defy a complete description</dt>
+
+ <dd>
+
+ <p>In certain cases, the nature of the image might be such that
+ providing thorough alternative text is impractical. For example,
+ the image could be indistinct, or could be a complex fractal, or
+ could be a detailed topographical map.</p>
+
+ <p>In these cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute must contain some suitable alternative text, but it may
+ be somewhat brief.</p>
+
+ <div class=example>
+
+ <p>Sometimes there simply is no text that can do justice to an
+ image. For example, there is little that can be said to usefully
+ describe a Rorschach inkblot test. However, a description, even
+ if brief, is still better than nothing:</p>
+
+ <pre>&lt;figure&gt;
+ <strong>&lt;img src="/commons/a/a7/Rorschach1.jpg" alt="A shape with left-right
+ symmetry with indistinct edges, with a small gap in the center, two
+ larger gaps offset slightly from the center, with two similar gaps
+ under them. The outline is wider in the top half than the bottom
+ half, with the sides extending upwards higher than the center, and
+ the center extending below the sides."&gt;</strong>
+ &lt;figcaption&gt;A black outline of the first of the ten cards
+ in the Rorschach inkblot test.&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ <p>Note that the following would be a very bad use of alternative
+ text:</p>
+
+ <pre class=bad>&lt;!-- This example is wrong. Do not copy it. --&gt;
+&lt;figure&gt;
+ &lt;img src="/commons/a/a7/Rorschach1.jpg" alt="A black outline
+ of the first of the ten cards in the Rorschach inkblot test."&gt;
+ &lt;figcaption&gt;A black outline of the first of the ten cards
+ in the Rorschach inkblot test.&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ <p>Including the caption in the alternative text like this isn't
+ useful because it effectively duplicates the caption for users
+ who don't have images, taunting them twice yet not helping them
+ any more than if they had only read or heard the caption
+ once.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Another example of an image that defies full description is a
+ fractal, which, by definition, is infinite in detail.</p>
+
+ <p>The following example shows one possible way of providing
+ alternative text for the full view of an image of the Mandelbrot
+ set.</p>
+
+ <pre><strong>&lt;img src="ms1.jpeg" alt="The Mandelbrot set appears as a cardioid with
+its cusp on the real axis in the positive direction, with a smaller
+bulb aligned along the same center line, touching it in the negative
+direction, and with these two shapes being surrounded by smaller bulbs
+of various sizes."&gt;</strong></pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt id=unknown-images>Images whose contents are not known</dt>
+
+ <dd>
+
+ <p>In some unfortunate cases, there might be no alternative text
+ available at all, either because the image is obtained in some
+ automated fashion without any associated alternative text (e.g. a
+ Webcam), or because the page is being generated by a script using
+ user-provided images where the user did not provide suitable or
+ usable alternative text (e.g. photograph sharing sites), or
+ because the author does not himself know what the images represent
+ (e.g. a blind photographer sharing an image on his blog).</p>
+
+ <p>In such cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute's value may be omitted, but one of the following
+ conditions must be met as well:</p>
+
+ <ul><!-- when editing this list, search for the two other occurrences
+ of 'critical-no-alt' --><li>The <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute is
+ present and has a non-empty value.</li>
+
+ <li>The <code><a href=#the-img-element>img</a></code> element is in a <code><a href=#the-figure-element>figure</a></code>
+ element that contains a <code><a href=#the-figcaption-element>figcaption</a></code> element that
+ contains content other than <a href=#inter-element-whitespace>inter-element
+ whitespace</a>.</li>
+
+ </ul><p class=note>Such cases are to be kept to an absolute
+ minimum. If there is even the slightest possibility of the author
+ having the ability to provide real alternative text, then it would
+ not be acceptable to omit the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
+ attribute.</p>
+
+ <div class=example>
+
+ <p>A photo on a photo-sharing site, if the site received the
+ image with no metadata other than the caption, could be marked up
+ as follows:</p>
+
+ <pre>&lt;figure&gt;
+ <strong>&lt;img src="1100670787_6a7c664aef.jpg"&gt;</strong>
+ &lt;figcaption&gt;Bubbles traveled everywhere with us.&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ <p>It would be better, however, if a detailed description of the
+ important parts of the image obtained from the user and included
+ on the page.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>A blind user's blog in which a photo taken by the user is
+ shown. Initially, the user might not have any idea what the photo
+ he took shows:</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;I took a photo&lt;/h1&gt;
+ &lt;p&gt;I went out today and took a photo!&lt;/p&gt;
+ &lt;figure&gt;
+ <strong>&lt;img src="photo2.jpeg"&gt;</strong>
+ &lt;figcaption&gt;A photograph taken blindly from my front porch.&lt;/figcaption&gt;
+ &lt;/figure&gt;
+&lt;/article&gt;</pre>
+
+ <p>Eventually though, the user might obtain a description of the
+ image from his friends and could then include alternative text:</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;I took a photo&lt;/h1&gt;
+ &lt;p&gt;I went out today and took a photo!&lt;/p&gt;
+ &lt;figure&gt;
+ <strong>&lt;img src="photo2.jpeg" alt="The photograph shows my hummingbird
+ feeder hanging from the edge of my roof. It is half full, but there
+ are no birds around. In the background, out-of-focus trees fill the
+ shot. The feeder is made of wood with a metal grate, and it contains
+ peanuts. The edge of the roof is wooden too, and is painted white
+ with light blue streaks."&gt;</strong>
+ &lt;figcaption&gt;A photograph taken blindly from my front porch.&lt;/figcaption&gt;
+ &lt;/figure&gt;
+&lt;/article&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Sometimes the entire point of the image is that a textual
+ description is not available, and the user is to provide the
+ description. For instance, the point of a CAPTCHA image is to see
+ if the user can literally read the graphic. Here is one way to
+ mark up a CAPTCHA (note the <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute):</p>
+
+ <pre>&lt;p&gt;&lt;label&gt;What does this image say?
+<strong>&lt;img src="captcha.cgi?id=8934" title="CAPTCHA"&gt;</strong>
+&lt;input type=text name=captcha&gt;&lt;/label&gt;
+(If you cannot see the image, you can use an &lt;a
+href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
+
+ <p>Another example would be software that displays images and
+ asks for alternative text precisely for the purpose of then
+ writing a page with correct alternative text. Such a page could
+ have a table of images, like this:</p>
+
+ <pre>&lt;table&gt;
+ &lt;thead&gt;
+ &lt;tr&gt; &lt;th&gt; Image &lt;th&gt; Description
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;td&gt; <strong>&lt;img src="2421.png" title="Image 640 by 100, filename 'banner.gif'"&gt;</strong>
+ &lt;td&gt; &lt;input name="alt2421"&gt;
+ &lt;tr&gt;
+ &lt;td&gt; <strong>&lt;img src="2422.png" title="Image 200 by 480, filename 'ad3.gif'"&gt;</strong>
+ &lt;td&gt; &lt;input name="alt2422"&gt;
+&lt;/table&gt;</pre>
+
+ <p>Notice that even in this example, as much useful information
+ as possible is still included in the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute.</p>
+
+ </div>
+
+ <p class=note>Since some users cannot use images at all
+ (e.g. because they have a very slow connection, or because they
+ are using a text-only browser, or because they are listening to
+ the page being read out by a hands-free automobile voice Web
+ browser, or simply because they are blind), the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is only allowed to be
+ omitted rather than being provided with replacement text when no
+ alternative text is available and none can be made available, as
+ in the above examples. Lack of effort from the part of the author
+ is not an acceptable reason for omitting the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>
+
+ </dd>
+
+ </dl><h6 id=an-image-not-intended-for-the-user><span class=secno>4.8.1.1.10 </span>An image not intended for the user</h6>
+
+ <p>Generally authors should avoid using <code><a href=#the-img-element>img</a></code> elements
+ for purposes other than showing images.</p>
+
+ <p>If an <code><a href=#the-img-element>img</a></code> element is being used for purposes other
+ than showing an image, e.g. as part of a service to count page
+ views, then the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must
+ be the empty string.</p>
+
+ <p>In such cases, the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes should both
+ be set to zero.</p>
+
+
+
+ <h6 id=an-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images><span class=secno>4.8.1.1.11 </span>An image in an e-mail or private document intended for a specific person who is known to be able to view images</h6>
+
+ <p><i>This section does not apply to documents that are publicly
+ accessible, or whose target audience is not necessarily personally
+ known to the author, such as documents on a Web site, e-mails sent
+ to public mailing lists, or software documentation.</i></p>
+
+ <p>When an image is included in a private communication (such as an
+ HTML e-mail) aimed at a specific person who is known to be able to
+ view images, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute may
+ be omitted. However, even in such cases it is strongly recommended
+ that alternative text be included (as appropriate according to the
+ kind of image involved, as described in the above entries), so that
+ the e-mail is still usable should the user use a mail client that
+ does not support images, or should the document be forwarded on to
+ other users whose abilities might not include easily seeing
+ images.</p>
+
+
+
+ <h6 id=general-guidelines><span class=secno>4.8.1.1.12 </span>General guidelines</h6>
+
+ <p>The most general rule to consider when writing alternative text
+ is the following: <strong>the intent is that replacing every image
+ with the text of its <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute
+ not change the meaning of the page</strong>.</p>
+
+ <p>So, in general, alternative text can be written by considering
+ what one would have written had one not been able to include the
+ image.</p>
+
+ <p>A corollary to this is that the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value should never
+ contain text that could be considered the image's <em>caption</em>,
+ <em>title</em>, or <em>legend</em>. It is supposed to contain
+ replacement text that could be used by users <em>instead</em> of the
+ image; it is not meant to supplement the image. The <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute can be used for
+ supplemental information.</p>
+
+ <p class=note>One way to think of alternative text is to think
+ about how you would read the page containing the image to someone
+ over the phone, without mentioning that there is an image
+ present. Whatever you say instead of the image is typically a good
+ start for writing the alternative text.</p>
+
+
+ <div class=impl>
+
+ <h6 id=guidance-for-markup-generators><span class=secno>4.8.1.1.13 </span>Guidance for markup generators</h6>
+
+ <p>Markup generators (such as WYSIWYG authoring tools) should,
+ wherever possible, obtain alternative text from their
+ users. However, it is recognized that in many cases, this will not
+ be possible.</p>
+
+ <p>For images that are the sole contents of links, markup generators
+ should examine the link target to determine the title of the target,
+ or the URL of the target, and use information obtained in this
+ manner as the alternative text.</p>
+
+ <p>As a last resort, implementors should either set the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute to the empty string, under
+ the assumption that the image is a purely decorative image that
+ doesn't add any information but is still specific to the surrounding
+ content, or omit the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute
+ altogether, under the assumption that the image is a key part of the
+ content.</p>
+
+ <p>Markup generators should generally avoid using the image's own
+ file name as the alternative text. Similarly, markup generators
+ should avoid generating alternative text from any content that will
+ be equally available to presentation user agents (e.g. Web
+ browsers).</p>
+
+ <p class=note>This is because once a page is generated, it will
+ typically not be updated, whereas the browsers that later read the
+ page can be updated by the user, therefore the browser is likely to
+ have more up-to-date and finely-tuned heuristics than the markup
+ generator did when generating the page.</p>
+
+ </div>
+
+ <div class=impl>
+
+ <h6 id=guidance-for-conformance-checkers><span class=secno>4.8.1.1.14 </span>Guidance for conformance checkers</h6>
+
+ <p>A conformance checker must report the lack of an <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute as an error unless one of
+ the conditions listed below applies:</p>
+
+ <ul><!-- when editing this list, search for the two other occurrences
+ of 'critical-no-alt' --><li>The <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute is present
+ and has a non-empty value (as <a href=#unknown-images>described
+ above</a>).</li>
+
+ <li>The <code><a href=#the-img-element>img</a></code> element is in a <code><a href=#the-figure-element>figure</a></code>
+ element that contains a <code><a href=#the-figcaption-element>figcaption</a></code> element that
+ contains content other than <a href=#inter-element-whitespace>inter-element whitespace</a>
+ (as <a href=#unknown-images>described above</a>).</li>
+
+ <!-- the following are additional entries not included in the
+ aforementioned list, as they apply only to conformance checkers -->
+
+ <li>The conformance checker has been configured to assume that the
+ document is an e-mail or document intended for a specific person
+ who is known to be able to view images.</li>
+
+ <li>The document has a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute whose value is an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title=meta-generator><a href=#meta-generator>generator</a></code>". (This case does not
+ represent a case where the document is conforming, only that the
+ generator could not determine appropriate alternative text &mdash;
+ validators are required to not show an error in this case to
+ discourage markup generators from including bogus alternative text
+ purely in an attempt to silence validators.)</li>
+
+ </ul></div>
+
+
+
+ <h4 id=the-iframe-element><span class=secno>4.8.2 </span>The <dfn><code>iframe</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#embedded-content>Embedded content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Text that conforms to the requirements given in the prose.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code></dd>
+ <dd><code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code></dd>
+ <dd><code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code></dd>
+ <dd><code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code></dd>
+ <dd><code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code></dd>
+ <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code></dd>
+ <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmliframeelement>HTMLIFrameElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-iframe-src title=dom-iframe-src>src</a>;
+ attribute DOMString <a href=#dom-iframe-srcdoc title=dom-iframe-srcdoc>srcdoc</a>;
+ attribute DOMString <a href=#dom-iframe-name title=dom-iframe-name>name</a>;
+ [PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-iframe-sandbox title=dom-iframe-sandbox>sandbox</a>;
+ attribute boolean <a href=#dom-iframe-seamless title=dom-iframe-seamless>seamless</a>;
+ attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
+ attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
+ readonly attribute Document <a href=#dom-iframe-contentdocument title=dom-iframe-contentDocument>contentDocument</a>;
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-iframe-contentwindow title=dom-iframe-contentWindow>contentWindow</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-iframe-element>iframe</a></code> element <a href=#represents>represents</a> a
+ <a href=#nested-browsing-context>nested browsing context</a>.</p>
+
+ <p>The <dfn id=attr-iframe-src title=attr-iframe-src><code>src</code></dfn> attribute
+ gives the address of a page that the <a href=#nested-browsing-context>nested browsing
+ context</a> is to contain. The attribute, if present, must be a
+ <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</a>.</p>
+
+ <p>The <dfn id=attr-iframe-srcdoc title=attr-iframe-srcdoc><code>srcdoc</code></dfn>
+ attribute gives the content of the page that the <a href=#nested-browsing-context>nested
+ browsing context</a> is to contain. The value of the attribute
+ in is <dfn id=an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</dfn>.</p>
+
+ <p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#html-documents>HTML documents</a>,
+ the attribute, if present, must have a value using <a href=#syntax>the HTML
+ syntax</a> that consists of the following syntactic components,
+ in the given order:</p>
+
+ <ol><li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li>Optionally, a <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>.
+
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li>The root element, in the form of an <code><a href=#the-html-element-0>html</a></code> <a href=#syntax-elements title=syntax-elements>element</a>.</li>
+
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ </ol><p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#xml-documents>XML documents</a>,
+ the attribute, if present, must have a value that matches the
+ production labeled <code><a href=#document>document</a></code> in the XML
+ specification. <a href=#refsXML>[XML]</a></p>
+
+ <p>If the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute and the
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute are both
+ specified together, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>
+ attribute takes priority. This allows authors to provide a fallback
+ <a href=#url>URL</a> for legacy user agents that do not support the
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute.</p>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-iframe-element>iframe</a></code> element is first <a href=#insert-an-element-into-a-document title="insert
+ an element into a document">inserted into a document</a>, the
+ user agent must create a <a href=#nested-browsing-context>nested browsing context</a>, and
+ then <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a> for the
+ first time.</p>
+
+ <p>Whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a <a href=#nested-browsing-context>nested
+ browsing context</a> has its <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute set or changed,
+ the user agent must <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a>.</p>
+
+ <p>Similarly, whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a
+ <a href=#nested-browsing-context>nested browsing context</a> but with no <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute specified has its
+ <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute set or changed,
+ the user agent must <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a>.</p> <!-- It doesn't happen when the base URL is
+ changed, though. -->
+
+ <p>When the user agent is to <dfn id=process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</dfn>, it must run the first appropriate steps from the
+ following list:</p>
+
+ <dl class=switch><dt>If the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute
+ is specified</dt>
+
+ <dd><p><a href=#navigate>Navigate</a> the element's <a href=#browsing-context>browsing
+ context</a> to a resource whose <a href=#content-type>Content-Type</a> is
+ <code><a href=#text/html>text/html</a></code>, whose <a href=#url>URL</a> is
+ <code><a href=#about:srcdoc>about:srcdoc</a></code>, and whose data consists of the value of
+ the attribute.</dd>
+
+ <dt>If the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code>
+ attribute is specified but the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not</dt>
+
+ <dd>
+
+ <ol><li><p>If the value of the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is the empty string,
+ jump to the <i title="">empty</i> step below.</li>
+
+ <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of
+ the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute, relative
+ to the <code><a href=#the-iframe-element>iframe</a></code> element.</li>
+
+ <li><p>If that is not successful, then jump to the <i title="">empty</i> step below.</li>
+
+ <li><p>If the resulting <a href=#absolute-url>absolute URL</a> is an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
+ "<code><a href=#about:blank>about:blank</a></code>", and the user agent is processing this
+ <code><a href=#the-iframe-element>iframe</a></code>'s attributes for the first time, then jump to
+ the <i title="">empty</i> step below. (In cases other than the
+ first time, <code><a href=#about:blank>about:blank</a></code> is loaded
+ normally.)</li>
+
+ <li><p><a href=#navigate>Navigate</a> the element's <a href=#browsing-context>browsing
+ context</a> to the resulting <a href=#absolute-url>absolute
+ URL</a>.</li>
+
+ </ol><p><i>Empty</i>: When the steps above require the user agent to
+ jump to the <i title="">empty</i> step, if the user agent is
+ processing this <code><a href=#the-iframe-element>iframe</a></code>'s attributes for the first
+ time, then the user agent must <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#the-iframe-element>iframe</a></code>
+ element. (After jumping to this step, the above steps are not
+ resumed.)</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-load>load</code> at the
+ <code><a href=#the-iframe-element>iframe</a></code> element.</p>
+
+ </dd>
+
+ </dl><p>Any <a href=#navigate title=navigate>navigation</a> required of the user
+ agent in the <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>
+ algorithm must be completed with the <code><a href=#the-iframe-element>iframe</a></code> element's
+ document's <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source
+ browsing context</a>.</p>
+
+ <p>Furthermore, if the <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a> algorithm was invoked for the first time for this
+ element (i.e. as a result of the element being <a href=#insert-an-element-into-a-document title="insert
+ an element into a document">inserted into a document</a>), then
+ any <a href=#navigate title=navigate>navigation</a> required of the user
+ agent in that algorithm must be completed with <a href=#replacement-enabled>replacement
+ enabled</a>.</p>
+
+ </div>
+
+ <p class=note>If, when the element is created, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not set, and
+ the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is either
+ also not set or set but its value cannot be <a href=#resolve-a-url title="resolve a
+ url">resolved</a>, the browsing context will remain at the
+ initial <code><a href=#about:blank>about:blank</a></code> page.</p>
+
+ <p class=note>If the user <a href=#navigate title=navigate>navigates</a>
+ away from this page, the <code><a href=#the-iframe-element>iframe</a></code>'s corresponding
+ <code><a href=#windowproxy>WindowProxy</a></code> object will proxy new <code><a href=#window>Window</a></code>
+ objects for new <code><a href=#document>Document</a></code> objects, but the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute will not change.</p>
+
+ <div class=example>
+
+ <p>Here a blog uses the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute in conjunction
+ with the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> and <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attributes described
+ below to provide users of user agents that support this feature
+ with an extra layer of protection from script injection in the blog
+ post comments:</p>
+
+ <pre>&lt;article&gt;
+ &lt;h1&gt;I got my own magazine!&lt;/h1&gt;
+ &lt;p&gt;After much effort, I've finally found a publisher, and so now I
+ have my own magazine! Isn't that awesome?! The first issue will come
+ out in September, and we have articles about getting food, and about
+ getting in boxes, it's going to be great!&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;p&gt;Written by &lt;a href="/users/cap"&gt;cap&lt;/a&gt;.
+ &lt;time pubdate&gt;2009-08-21T23:32Z&lt;/time&gt;&lt;/p&gt;
+ &lt;/footer&gt;
+ &lt;article&gt;
+ &lt;footer&gt; At &lt;time pubdate&gt;2009-08-21T23:35Z&lt;/time&gt;, &lt;a href="/users/ch"&gt;ch&lt;/a&gt; writes: &lt;/footer&gt;
+ &lt;iframe seamless sandbox="allow-same-origin" srcdoc="&lt;p&gt;did you get a cover picture yet?"&gt;&lt;/iframe&gt;
+ &lt;/article&gt;
+ &lt;article&gt;
+ &lt;footer&gt; At &lt;time pubdate&gt;2009-08-21T23:44Z&lt;/time&gt;, &lt;a href="/users/cap"&gt;cap&lt;/a&gt; writes: &lt;/footer&gt;
+ &lt;iframe seamless sandbox="allow-same-origin" srcdoc="&lt;p&gt;Yeah, you can see it &lt;a href=&amp;quot;/gallery?mode=cover&amp;amp;amp;page=1&amp;quot;&gt;in my gallery&lt;/a&gt;."&gt;&lt;/iframe&gt;
+ &lt;/article&gt;
+ &lt;article&gt;
+ &lt;footer&gt; At &lt;time pubdate&gt;2009-08-21T23:58Z&lt;/time&gt;, &lt;a href="/users/ch"&gt;ch&lt;/a&gt; writes: &lt;/footer&gt;
+ &lt;iframe seamless sandbox="allow-same-origin" srcdoc="&lt;p&gt;hey that's earl's table.
+&lt;p&gt;you should get earl&amp;amp;amp;me on the next cover."&gt;&lt;/iframe&gt;
+ &lt;/article&gt;</pre>
+
+ <p>Notice the way that quotes have to be escaped (otherwise the
+ <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute would
+ end prematurely), and the way raw ampersands (e.g. in URLs or in
+ prose) mentioned in the sandboxed content have to be
+ <em>doubly</em> escaped &mdash; once so that the ampersand is
+ preserved when originally parsing the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, and once more
+ to prevent the ampersand from being misinterpreted when parsing the
+ sandboxed content.</p>
+
+ </div>
+
+ <p class=note>In <a href=#syntax>the HTML syntax</a>, authors need only
+ remember to use U+0022 QUOTATION MARK characters (") to wrap the
+ attribute contents and then to escape all U+0022 QUOTATION MARK (")
+ and U+0026 AMPERSAND (&amp;) characters, and to specify the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, to ensure safe
+ embedding of content.</p>
+
+ <p class=note>Due to restrictions of <span>the XML syntax</span>,
+ in XML a number of other characters need to be escaped also to
+ ensure correctness.</p>
+
+ <hr><p>The <dfn id=attr-iframe-name title=attr-iframe-name><code>name</code></dfn>
+ attribute, if present, must be a <a href=#valid-browsing-context-name>valid browsing context
+ name</a>. The given value is used to name the <a href=#nested-browsing-context>nested
+ browsing context</a>. <span class=impl>When the browsing
+ context is created, if the attribute is present, the <a href=#browsing-context-name>browsing
+ context name</a> must be set to the value of this attribute;
+ otherwise, the <a href=#browsing-context-name>browsing context name</a> must be set to the
+ empty string.</span></p>
+
+ <div class=impl>
+
+ <p>Whenever the <code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code> attribute
+ is set, the nested <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-name title="browsing context name">name</a> must be changed to the new
+ value. If the attribute is removed, the <a href=#browsing-context-name>browsing context
+ name</a> must be set to the empty string.</p>
+
+ <p>When content loads in an <code><a href=#the-iframe-element>iframe</a></code>, after any <code title=event-load>load</code> events are fired within the content
+ itself, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
+ a simple event</a> named <code title=event-load>load</code> at
+ the <code><a href=#the-iframe-element>iframe</a></code> element. When content whose <a href=#url>URL</a>
+ has the <a href=#same-origin>same origin</a> as the <code><a href=#the-iframe-element>iframe</a></code>
+ element's <code><a href=#document>Document</a></code> fails to load (e.g. due to a DNS
+ error, network error, or if the server returned a 4xx or 5xx status
+ code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or
+ equivalent</a>), then the user agent must <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the element instead. (This event
+ does not fire for <a href=#parse-error title="parse error">parse errors</a>,
+ script errors, or any errors for cross-origin resources.)</p>
+
+ <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#dom-manipulation-task-source>DOM manipulation
+ task source</a>.</p>
+
+ <p class=note>A <code title=event-load>load</code> event is also
+ fired at the <code><a href=#the-iframe-element>iframe</a></code> element when it is created if no
+ other data is loaded in it.</p>
+
+ <p>When there is an <a href=#active-parser>active parser</a> in the
+ <code><a href=#the-iframe-element>iframe</a></code>, and when anything in the <code><a href=#the-iframe-element>iframe</a></code> is
+ <a href=#delay-the-load-event title="delay the load event">delaying the load event</a> of
+ the <code><a href=#the-iframe-element>iframe</a></code>'s <a href=#browsing-context>browsing context</a>'s
+ <a href=#active-document>active document</a>, the <code><a href=#the-iframe-element>iframe</a></code> must
+ <a href=#delay-the-load-event>delay the load event</a> of its document.</p>
+
+ <p class=note>If, during the handling of the <code title=event-load>load</code> event, the <a href=#browsing-context>browsing
+ context</a> in the <code><a href=#the-iframe-element>iframe</a></code> is again <a href=#navigate title=navigate>navigated</a>, that will further <a href=#delay-the-load-event>delay the
+ load event</a>.</p>
+
+ </div>
+
+ <hr><p>The <dfn id=attr-iframe-sandbox title=attr-iframe-sandbox><code>sandbox</code></dfn>
+ attribute, when specified, enables a set of extra restrictions on
+ any content hosted by the <code><a href=#the-iframe-element>iframe</a></code>. Its value must be an
+ <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a>. The
+ allowed values are <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>,
+ <code title=attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>,
+ <code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>,
+ and <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>. When
+ the attribute is set, the content is treated as being from a unique
+ <a href=#origin>origin</a>, forms and scripts are disabled, links are
+ prevented from targeting other <a href=#browsing-context title="browsing
+ context">browsing contexts</a>, and plugins are disabled. The
+ <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>
+ keyword allows the content to be treated as being from the same
+ origin instead of forcing it into a unique origin, the <code title=attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>
+ keyword allows the content to <a href=#navigate>navigate</a> its
+ <a href=#top-level-browsing-context>top-level browsing context</a>, and the <code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code> and <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>
+ keywords re-enable forms and scripts respectively (though scripts
+ are still prevented from creating popups).</p>
+
+ <p class=warning>Setting both the <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> and
+ <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>
+ keywords together when the embedded page has the <a href=#same-origin>same
+ origin</a> as the page containing the <code><a href=#the-iframe-element>iframe</a></code> allows
+ the embedded page to simply remove the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute.</p>
+
+ <p class=warning>Sandboxing hostile content is of minimal help if
+ an attacker can convince the user to just visit the hostile content
+ directly, rather than in the <code><a href=#the-iframe-element>iframe</a></code>. To limit the
+ damage that can be caused by hostile HTML content, it should be
+ served using the <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> MIME type.</p>
+
+ <div class=impl>
+
+ <!-- v2: Add a new attribute that enables new restrictions, e.g.:
+ - disallow cross-origin loads of any kind (networking
+ override that only allows same-origin URLs or about:,
+ javascript:, data:)
+ - block access to 'parent.frames' from sandbox
+ -->
+
+ <p>While the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>
+ attribute is specified, the <code><a href=#the-iframe-element>iframe</a></code> element's
+ <a href=#nested-browsing-context>nested browsing context</a> must have the flags given in
+ the following list set. In addition, any browsing contexts <a href=#nested-browsing-context title="nested browsing context">nested</a> within an
+ <code><a href=#the-iframe-element>iframe</a></code>, either directly or indirectly, must have all
+ the flags set on them as were set on the <code><a href=#the-iframe-element>iframe</a></code>'s
+ <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> when the
+ <code><a href=#the-iframe-element>iframe</a></code>'s <code><a href=#document>Document</a></code> was created.</p>
+
+ <dl><dt>The <dfn id=sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</dfn></dt>
+
+ <dd>
+
+ <p>This flag <a href=#sandboxLinks>prevents content from
+ navigating browsing contexts other than the sandboxed browsing
+ context itself</a> (or browsing contexts further nested inside
+ it), and the <a href=#top-level-browsing-context>top-level browsing context</a> (which is
+ protected by the <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing
+ context flag</a> defined next).</p>
+
+ <p>This flag also <a href=#sandboxWindowOpen>prevents content
+ from creating new auxiliary browsing contexts</a>, e.g. using the
+ <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute or the
+ <code title=dom-open><a href=#dom-open>window.open()</a></code> method.</p>
+
+ </dd>
+
+
+ <dt>The <dfn id=sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context
+ flag</dfn>, unless the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute's value, when
+ <a href=#split-a-string-on-spaces title="split a string on spaces">split on spaces</a>, is
+ found to have the <dfn id=attr-iframe-sandbox-allow-top-navigation title=attr-iframe-sandbox-allow-top-navigation><code>allow-top-navigation</code></dfn>
+ keyword set</dt>
+
+ <dd>
+
+ <p>This flag <a href=#sandboxLinks>prevents content from
+ navigating their <span>top-level browsing context</span></a>.</p>
+
+ <p>When the <code title=attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>
+ is set, content can navigate its <a href=#top-level-browsing-context>top-level browsing
+ context</a>, but other <a href=#browsing-context title="browsing context">browsing
+ contexts</a> are still protected by the <a href=#sandboxed-navigation-browsing-context-flag>sandboxed
+ navigation browsing context flag</a> defined above.</p>
+
+ </dd>
+
+
+ <dt>The <dfn id=sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</dfn></dt>
+
+ <dd>
+
+ <p>This flag prevents content from instantiating <a href=#plugin title=plugin>plugins</a>, whether using <a href=#sandboxPluginEmbed>the <code>embed</code> element</a>, <a href=#sandboxPluginObject>the <code>object</code> element</a>,
+ <a href=#sandboxPluginApplet>the <code>applet</code>
+ element</a>, or through <a href=#sandboxPluginNavigate>navigation</a> of a <a href=#nested-browsing-context>nested
+ browsing context</a>.</p>
+
+ </dd>
+
+
+ <dt>The <dfn id=sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</dfn></dt>
+
+ <dd>
+
+ <p>This flag prevents content from using the <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attribute on
+ descendant <code><a href=#the-iframe-element>iframe</a></code> elements.</p>
+
+ <p class=note>This prevents a page inserted using the <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>
+ keyword from using a CSS-selector-based method of probing the DOM
+ of other pages on the same site (in particular, pages that contain
+ user-sensitive information).</p>
+
+ <!-- http://lists.w3.org/Archives/Public/public-web-security/2009Dec/thread.html#msg51 -->
+
+ </dd>
+
+
+ <dt>The <dfn id=sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</dfn>, unless
+ the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute's
+ value, when <a href=#split-a-string-on-spaces title="split a string on spaces">split on
+ spaces</a>, is found to have the <dfn id=attr-iframe-sandbox-allow-same-origin title=attr-iframe-sandbox-allow-same-origin><code>allow-same-origin</code></dfn>
+ keyword set</dt>
+
+ <dd>
+
+ <p>This flag <a href=#sandboxOrigin>forces content into a unique
+ origin</a>, thus preventing it from accessing other content from
+ the same <a href=#origin>origin</a>.</p>
+
+ <p>This flag also <a href=#sandboxCookies>prevents script from
+ reading from or writing to the <code title=dom-document-cookie>document.cookie</code> IDL
+ attribute</a>, and blocks access to <code title=dom-localStorage>localStorage</code> and <code title=dom-opendatabase>openDatabase()</code>.
+
+ <a href=#refsWEBSTORAGE>[WEBSTORAGE]</a>
+
+ <a href=#refsWEBSQL>[WEBSQL]</a>
+ </p>
+
+ <div class=note>
+
+ <p>The <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>
+ attribute is intended for two cases.</p>
+
+ <p>First, it can be used to allow content from the same site to
+ be sandboxed to disable scripting, while still allowing access to
+ the DOM of the sandboxed content.</p>
+
+ <p>Second, it can be used to embed content from a third-party
+ site, sandboxed to prevent that site from opening popup windows,
+ etc, without preventing the embedded page from communicating back
+ to its originating site, using the database APIs to store data,
+ etc.</p>
+
+ </div>
+
+ </dd>
+
+
+ <dt>The <dfn id=sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</dfn>, unless
+ the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute's
+ value, when <a href=#split-a-string-on-spaces title="split a string on spaces">split on
+ spaces</a>, is found to have the <dfn id=attr-iframe-sandbox-allow-forms title=attr-iframe-sandbox-allow-forms><code>allow-forms</code></dfn>
+ keyword set</dt>
+
+ <dd>
+
+ <p>This flag <a href=#sandboxSubmitBlocked>blocks form
+ submission</a>.</p>
+
+ </dd>
+
+
+ <dt>The <dfn id=sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag</dfn>, unless
+ the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute's
+ value, when <a href=#split-a-string-on-spaces title="split a string on spaces">split on
+ spaces</a>, is found to have the <dfn id=attr-iframe-sandbox-allow-scripts title=attr-iframe-sandbox-allow-scripts><code>allow-scripts</code></dfn>
+ keyword set</dt>
+
+ <dd>
+
+ <p>This flag <a href=#sandboxScriptBlocked>blocks script
+ execution</a>.</p>
+
+ </dd>
+
+
+ <dt>The <dfn id=sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context
+ flag</dfn>, unless the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute's value, when
+ <a href=#split-a-string-on-spaces title="split a string on spaces">split on spaces</a>, is
+ found to have the <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>
+ keyword (defined above) set</dt>
+
+ <dd>
+
+ <p>This flag blocks features that trigger automatically, such as
+ <a href=#attr-media-autoplay title=attr-media-autoplay>automatically playing a
+ video</a> or <a href=#attr-fe-autofocus title=attr-fe-autofocus>automatically
+ focusing a form control</a>. It is relaxed by the same flag as
+ scripts, because when scripts are enabled these features are
+ trivially possible anyway, and it would be unfortunate to force
+ authors to use script to do them when sandboxed rather than
+ allowing them to use the declarative features.</p>
+
+ </dd>
+
+ </dl><p>These flags must not be set unless the conditions listed above
+ define them as being set.</p>
+
+ <p class=warning>These flags only take effect when the
+ <a href=#nested-browsing-context>nested browsing context</a> of the <code><a href=#the-iframe-element>iframe</a></code> is
+ <a href=#navigate title=navigate>navigated</a>. Removing then, or removing
+ the entire <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>
+ attribute, has no effect on an already-loaded page.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, some completely-unknown, potentially hostile,
+ user-provided HTML content is embedded in a page. Because it is
+ sandboxed, it is treated by the user agent as being from a unique
+ origin, despite the content being served from the same site. Thus
+ it is affected by all the normal cross-site restrictions. In
+ addition, the embedded page has scripting disabled, plugins
+ disabled, forms disabled, and it cannot navigate any frames or
+ windows other than itself (or any frames or windows it itself
+ embeds).</p>
+
+ <pre>&lt;p&gt;We're not scared of you! Here is your content, unedited:&lt;/p&gt;
+&lt;iframe sandbox src="getusercontent.cgi?id=12193"&gt;&lt;/iframe&gt;</pre>
+
+ <p>Note that cookies are still sent to the server in the <code title="">getusercontent.cgi</code> request, though they are not
+ visible in the <code title=dom-document-cookie><a href=#dom-document-cookie>document.cookie</a></code> IDL
+ attribute.</p>
+
+ <p class=warning>It is important that the server serve the
+ user-provided HTML using the <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> MIME
+ type so that if the attacker convinces the user to visit that page
+ directly, the page doesn't run in the context of the site's origin,
+ which would make the user vulnerable to any attack found in the
+ page.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, a gadget from another site is embedded. The
+ gadget has scripting and forms enabled, and the origin sandbox
+ restrictions are lifted, allowing the gadget to communicate with
+ its originating server. The sandbox is still useful, however, as it
+ disables plugins and popups, thus reducing the risk of the user
+ being exposed to malware and other annoyances.</p>
+
+ <pre>&lt;iframe sandbox="allow-same-origin allow-forms allow-scripts"
+ src="http://maps.example.com/embedded.html"&gt;&lt;/iframe&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Suppose a file A contained the following fragment:</p>
+
+ <pre>&lt;iframe sandbox="allow-same-origin allow-forms" src=B&gt;&lt;/iframe&gt;</pre>
+
+ <p>Suppose that file B contained an iframe also:</p>
+
+ <pre>&lt;iframe sandbox="allow-scripts" src=C&gt;&lt;/iframe&gt;</pre>
+
+ <p>Further, suppose that file C contained a link:</p>
+
+ <pre>&lt;a href=D&gt;Link&lt;/a&gt;</pre>
+
+ <p>For this example, suppose all the files were served as
+ <code><a href=#text/html>text/html</a></code>.</p>
+
+ <p>Page C in this scenario has all the sandboxing flags
+ set. Scripts are disabled, because the <code><a href=#the-iframe-element>iframe</a></code> in A has
+ scripts disabled, and this overrides the <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>
+ keyword set on the <code><a href=#the-iframe-element>iframe</a></code> in B. Forms are also
+ disabled, because the inner <code><a href=#the-iframe-element>iframe</a></code> (in B) does not
+ have the <code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code> keyword
+ set.</p>
+
+ <p>Suppose now that a script in A removes all the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attributes in A and
+ B. This would change nothing immediately. If the user clicked the
+ link in C, loading page D into the <code><a href=#the-iframe-element>iframe</a></code> in B, page D
+ would now act as if the <code><a href=#the-iframe-element>iframe</a></code> in B had the <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>
+ and <code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code> keywords
+ set, because that was the state of the <a href=#nested-browsing-context>nested browsing
+ context</a> in the <code><a href=#the-iframe-element>iframe</a></code> in A when page B was
+ loaded.</p>
+
+ <p>Generally speaking, dynamically removing or changing the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute is
+ ill-advised, because it can make it quite hard to reason about what
+ will be allowed and what will not.</p>
+
+ </div>
+
+ <p class=note>Potentially hostile files can be served from the
+ same server as the file containing the <code><a href=#the-iframe-element>iframe</a></code> element
+ by labeling them as <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> instead of
+ <code><a href=#text/html>text/html</a></code>. This ensures that scripts in the files are
+ unable to attack the site (as if they were actually served from
+ another server), even if the user is tricked into visiting those
+ pages directly, without the protection of the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute.</p>
+
+ <p class=warning>If the <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>
+ keyword is set along with <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>
+ keyword, and the file is from the <a href=#same-origin>same origin</a> as the
+ <code><a href=#the-iframe-element>iframe</a></code>'s <code><a href=#document>Document</a></code>, then a script in the
+ "sandboxed" iframe could just reach out, remove the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, and then
+ reload itself, effectively breaking out of the sandbox
+ altogether.</p>
+
+
+ <hr><!-- v2: Might be interesting to have a value on seamless that
+ allowed event propagation of some sort, maybe based on the WICD
+ work: http://www.w3.org/TR/WICD/ --><p>The <dfn id=attr-iframe-seamless title=attr-iframe-seamless><code>seamless</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. When specified, it
+ indicates that the <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#browsing-context>browsing
+ context</a> is to be rendered in a manner that makes it appear to
+ be part of the containing document (seamlessly included in the
+ parent document). <span class=impl>Specifically, when the
+ attribute is set on an <code><a href=#the-iframe-element>iframe</a></code> element whose owner
+ <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> did not have
+ the <a href=#sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</a> set when that
+ <code><a href=#document>Document</a></code> was created, and while either the
+ <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> has the
+ <a href=#same-origin>same origin</a> as the <code><a href=#the-iframe-element>iframe</a></code> element's
+ document, or the <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active
+ document</a>'s <em><a href="#the-document's-address" title="the document's
+ address">address</a></em> has the <a href=#same-origin>same origin</a> as the
+ <code><a href=#the-iframe-element>iframe</a></code> element's document, the following requirements
+ apply:</span></p>
+
+ <div class=impl>
+
+ <ul><li><p>The user agent must set the <dfn id=seamless-browsing-context-flag>seamless browsing
+ context flag</dfn> to true for that <a href=#browsing-context>browsing
+ context</a>. This will <a href=#seamlessLinks>cause links to
+ open in the parent browsing context</a>.</li>
+
+ <li><p>In a CSS-supporting user agent: the user agent must add all
+ the style sheets that apply to the <code><a href=#the-iframe-element>iframe</a></code> element to
+ the cascade of the <a href=#active-document>active document</a> of the
+ <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>,
+ at the appropriate cascade levels, before any style sheets
+ specified by the document itself.</li>
+
+ <li><p>In a CSS-supporting user agent: the user agent must, for the
+ purpose of CSS property inheritance only, treat the root element of
+ the <a href=#active-document>active document</a> of the <code><a href=#the-iframe-element>iframe</a></code>
+ element's <a href=#nested-browsing-context>nested browsing context</a> as being a child of
+ the <code><a href=#the-iframe-element>iframe</a></code> element. (Thus inherited properties on the
+ root element of the document in the <code><a href=#the-iframe-element>iframe</a></code> will
+ inherit the computed values of those properties on the
+ <code><a href=#the-iframe-element>iframe</a></code> element instead of taking their initial
+ values.)</li>
+
+ <li><p>In visual media, in a CSS-supporting user agent: the user agent
+ should set the intrinsic width of the <code><a href=#the-iframe-element>iframe</a></code> to the
+ width that the element would have if it was a non-replaced
+ block-level element with 'width: auto'.</li>
+
+ <li><p>In visual media, in a CSS-supporting user agent: the user
+ agent should set the intrinsic height of the <code><a href=#the-iframe-element>iframe</a></code> to
+ the height of the bounding box around the content rendered in the
+ <code><a href=#the-iframe-element>iframe</a></code> at its current width (as given in the previous
+ bullet point), as it would be if the scrolling position was such
+ that the top of the viewport for the content rendered in the
+ <code><a href=#the-iframe-element>iframe</a></code> was aligned with the origin of that content's
+ canvas.</li>
+
+ <li>
+
+ <p>In visual media, in a CSS-supporting user agent: the user agent
+ must force the height of the initial containing block of the
+ <a href=#active-document>active document</a> of the <a href=#nested-browsing-context>nested browsing
+ context</a> of the <code><a href=#the-iframe-element>iframe</a></code> to zero.</p>
+
+ <p class=note>This is intended to get around the otherwise
+ circular dependency of percentage dimensions that depend on the
+ height of the containing block, thus affecting the height of the
+ document's bounding box, thus affecting the height of the
+ viewport, thus affecting the size of the initial containing
+ block.</p>
+
+ </li>
+
+ <li><p>In speech media, the user agent should render the <a href=#nested-browsing-context>nested
+ browsing context</a> without announcing that it is a separate
+ document.</li>
+
+ <li>
+
+ <p>User agents should, in general, act as if the <a href=#active-document>active
+ document</a> of the <code><a href=#the-iframe-element>iframe</a></code>'s <a href=#nested-browsing-context>nested browsing
+ context</a> was part of the document that the
+ <code><a href=#the-iframe-element>iframe</a></code> is in.</p>
+
+ <p class=example>For example if the user agent supports listing
+ all the links in a document, links in "seamlessly" nested
+ documents would be included in that list without being
+ significantly distinguished from links in the document itself.</p>
+
+ </li>
+
+ </ul><p>If the attribute is not specified, or if the <a href=#origin>origin</a>
+ conditions listed above are not met, then the user agent should
+ render the <a href=#nested-browsing-context>nested browsing context</a> in a manner that is
+ clearly distinguishable as a separate <a href=#browsing-context>browsing context</a>,
+ and the <a href=#seamless-browsing-context-flag>seamless browsing context flag</a> must be set to
+ false for that <a href=#browsing-context>browsing context</a>.</p>
+
+ <p class=warning>It is important that user agents recheck the
+ above conditions whenever the <a href=#active-document>active document</a> of the
+ <a href=#nested-browsing-context>nested browsing context</a> of the <code><a href=#the-iframe-element>iframe</a></code>
+ changes, such that the <a href=#seamless-browsing-context-flag>seamless browsing context flag</a>
+ gets unset if the <a href=#nested-browsing-context>nested browsing context</a> is <a href=#navigate title=navigate>navigated</a> to another origin.</p>
+
+ </div>
+
+ <p class=note>The attribute can be set or removed dynamically,
+ with the rendering updating in tandem.</p>
+
+ <div class=example>
+
+ <p>In this example, the site's navigation is embedded using a
+ client-side include using an <code><a href=#the-iframe-element>iframe</a></code>. Any links in the
+ <code><a href=#the-iframe-element>iframe</a></code> will, in new user agents, be automatically
+ opened in the <code><a href=#the-iframe-element>iframe</a></code>'s parent browsing context; for
+ legacy user agents, the site could also include a <code><a href=#the-base-element>base</a></code>
+ element with a <code title=attr-base-target><a href=#attr-base-target>target</a></code>
+ attribute with the value <code title="">_parent</code>. Similarly,
+ in new user agents the styles of the parent page will be
+ automatically applied to the contents of the frame, but to support
+ legacy user agents authors might wish to include the styles
+ explicitly.</p>
+
+ <pre>&lt;nav&gt;&lt;iframe seamless src="nav.include.html"&gt;&lt;/iframe&gt;&lt;/nav&gt;</pre>
+
+ </div>
+
+
+ <hr><p>The <code><a href=#the-iframe-element>iframe</a></code> element supports <a href=#dimension-attributes>dimension
+ attributes</a> for cases where the embedded content has specific
+ dimensions (e.g. ad units have well-defined dimensions).</p>
+
+ <p>An <code><a href=#the-iframe-element>iframe</a></code> element never has <a href=#fallback-content>fallback
+ content</a>, as it will always create a nested <a href=#browsing-context>browsing
+ context</a>, regardless of whether the specified initial contents
+ are successfully used.</p>
+
+ <p>Descendants of <code><a href=#the-iframe-element>iframe</a></code> elements represent
+ nothing. (In legacy user agents that do not support
+ <code><a href=#the-iframe-element>iframe</a></code> elements, the contents would be parsed as markup
+ that could act as fallback content.)</p>
+
+ <p>When used in <a href=#html-documents>HTML documents</a>, the allowed content
+ model of <code><a href=#the-iframe-element>iframe</a></code> elements is text, except that invoking
+ the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a> with the
+ <code><a href=#the-iframe-element>iframe</a></code> element as the <var title="">context</var>
+ element and the text contents as the <var title="">input</var> must
+ result in a list of nodes that are all <a href=#phrasing-content>phrasing
+ content</a>, with no <a href=#parse-error title="parse error">parse
+ errors</a> having occurred, with no <code><a href=#script>script</a></code> elements
+ being anywhere in the list or as descendants of elements in the
+ list, and with all the elements in the list (including their
+ descendants) being themselves conforming.</p>
+
+ <p>The <code><a href=#the-iframe-element>iframe</a></code> element must be empty in <a href=#xml-documents>XML
+ documents</a>.</p>
+
+ <p class=note>The <a href=#html-parser>HTML parser</a> treats markup inside
+ <code><a href=#the-iframe-element>iframe</a></code> elements as text.</p>
+
+ <div class=impl>
+
+ <p>The IDL attributes <dfn id=dom-iframe-src title=dom-iframe-src><code>src</code></dfn>, <dfn id=dom-iframe-srcdoc title=dom-iframe-srcdoc><code>srcdoc</code></dfn>, <dfn id=dom-iframe-name title=dom-iframe-name><code>name</code></dfn>, <dfn id=dom-iframe-sandbox title=dom-iframe-sandbox><code>sandbox</code></dfn>, and <dfn id=dom-iframe-seamless title=dom-iframe-seamless><code>seamless</code></dfn> must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The <dfn id=dom-iframe-contentdocument title=dom-iframe-contentDocument><code>contentDocument</code></dfn>
+ IDL attribute must return the <code><a href=#document>Document</a></code> object of the
+ <a href=#active-document>active document</a> of the <code><a href=#the-iframe-element>iframe</a></code> element's
+ <a href=#nested-browsing-context>nested browsing context</a>.</p>
+
+ <p>The <dfn id=dom-iframe-contentwindow title=dom-iframe-contentWindow><code>contentWindow</code></dfn>
+ IDL attribute must return the <code><a href=#windowproxy>WindowProxy</a></code> object of the
+ <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing
+ context</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example of a page using an <code><a href=#the-iframe-element>iframe</a></code> to
+ include advertising from an advertising broker:</p>
+
+ <pre>&lt;iframe src="http://ads.example.com/?customerid=923513721&amp;amp;format=banner"
+ width="468" height="60"&gt;&lt;/iframe&gt;</pre>
+
+ </div>
+
+
+
+
+ <h4 id=the-embed-element><span class=secno>4.8.3 </span>The <dfn><code>embed</code></dfn> element</h4>
+
+<!-- (v2?)
+ we have all kinds of quirks we should define if they come up during
+ testing, as e.g. shown in:
+ http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsObjectFrame.cpp
+ http://trac.webkit.org/browser/trunk/WebCore/html/HTMLEmbedElement.cpp
+ http://trac.webkit.org/browser/trunk/WebCore/rendering/RenderPartObject.cpp (updateWidget)
+ e.g. - 240x200 default
+ - the attributes/params are sent in a name/value pair list as follows (for Gecko):
+ + attributes of the element, in source order
+ + a synthesised 'src' attribute, if there was no 'src' but
+ there was a 'data', with the value of the 'data' attribute
+ + the params, in source order
+ (WebKit does something different still)
+ - the HIDDEN attribute (might be moot now)
+-->
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#embedded-content>Embedded content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-embed-src><a href=#attr-embed-src>src</a></code></dd>
+ <dd><code title=attr-embed-type><a href=#attr-embed-type>type</a></code></dd>
+ <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code></dd>
+ <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code></dd>
+ <dd>Any other attribute that has no namespace (see prose).</dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlembedelement>HTMLEmbedElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-embed-src title=dom-embed-src>src</a>;
+ attribute DOMString <a href=#dom-embed-type title=dom-embed-type>type</a>;
+ attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
+ attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
+};</pre>
+ <div class=impl>
+ <p>Depending on the type of content instantiated by the
+ <code><a href=#the-embed-element>embed</a></code> element, the node may also support other
+ interfaces.</p>
+ </div>
+ </dd>
+ </dl><p>The <code><a href=#the-embed-element>embed</a></code> element <a href=#represents>represents</a> an
+ integration point for an external (typically non-HTML) application
+ or interactive content.</p>
+
+ <p>The <dfn id=attr-embed-src title=attr-embed-src><code>src</code></dfn> attribute
+ gives the address of the resource being embedded. The attribute, if
+ present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially
+ surrounded by spaces</a>.</p>
+
+ <p>The <dfn id=attr-embed-type title=attr-embed-type><code>type</code></dfn>
+ attribute, if present, gives the <a href=#mime-type>MIME type</a> by which the
+ plugin to instantiate is selected. The value must be a <a href=#valid-mime-type>valid
+ MIME type</a>. If both the <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute and the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute are present, then the
+ <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute must specify the
+ same type as the <a href=#content-type title=Content-Type>explicit Content-Type
+ metadata</a> of the resource given by the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute.</p>
+
+ <div class=impl>
+
+ <p>When the element is created with neither a <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute nor a <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute, and when attributes
+ are removed such that neither attribute is present on the element
+ anymore, and when the element has a <a href=#media-element>media element</a>
+ ancestor, and when the element has an ancestor <code><a href=#the-object-element>object</a></code>
+ element that is <em>not</em> showing its <a href=#fallback-content>fallback
+ content</a>, any plugins instantiated for the element must be
+ removed, and the <code><a href=#the-embed-element>embed</a></code> element represents nothing.</p>
+
+ <p id=sandboxPluginEmbed>If either:
+
+ <ul><li>the <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> was
+ set on the <a href=#browsing-context>browsing context</a> for which the
+ <code><a href=#the-embed-element>embed</a></code> element's <code><a href=#document>Document</a></code> is the
+ <a href=#active-document>active document</a> when that <code><a href=#document>Document</a></code> was
+ created, or</li>
+
+ <li>the <code><a href=#the-embed-element>embed</a></code> element's <code><a href=#document>Document</a></code> was
+ parsed from a resource whose <a href=#content-type-sniffing-0 title="Content-Type
+ sniffing">sniffed type</a> as determined during <a href=#navigate title=navigate>navigation</a> is
+ <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code></li>
+
+ </ul><p>...then the user agent must render the <code><a href=#the-embed-element>embed</a></code> element
+ in a manner that conveys that the <a href=#plugin>plugin</a> was
+ disabled. The user agent may offer the user the option to override
+ the sandbox and instantiate the <a href=#plugin>plugin</a> anyway; if the
+ user invokes such an option, the user agent must act as if the
+ conditions above did not apply for the purposes of this element.</p>
+
+ <p class=warning>Plugins are disabled in sandboxed browsing
+ contexts because they might not honor the restrictions imposed by
+ the sandbox (e.g. they might allow scripting even when scripting in
+ the sandbox is disabled). User agents should convey the danger of
+ overriding the sandbox to the user if an option to do so is
+ provided.</p>
+
+ <p>An <code><a href=#the-embed-element>embed</a></code> element is said to be <dfn id=concept-embed-active title=concept-embed-active>potentially active</dfn> when the
+ following conditions are all met simultaneously:</p>
+
+ <ul class=brief><li>The element is <a href=#in-a-document title="in a document">in a <code>Document</code></a>.</li>
+ <li>The element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>.</li>
+ <li>The element has either a <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute set or a <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute set (or both).</li>
+ <li>The element's <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute is either absent or its value is the empty string.</li>
+ <li>The element is not in a <code><a href=#document>Document</a></code> whose <a href=#browsing-context>browsing context</a> had the <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> set when the <code><a href=#document>Document</a></code> was created (unless this has been overridden as described above).</li>
+ <li>The element's <code><a href=#document>Document</a></code> was not parsed from a resource whose <a href=#content-type-sniffing-0 title="Content-Type sniffing">sniffed type</a> as determined during <a href=#navigate title=navigate>navigation</a> is <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> (unless this has been overridden as described above).</li>
+ <li>The element is not a descendant of a <a href=#media-element>media element</a>.</li>
+ <li>The element is not a descendant of an <code><a href=#the-object-element>object</a></code> element that is not showing its <a href=#fallback-content>fallback content</a>.</li>
+ </ul><p>Whenever an <code><a href=#the-embed-element>embed</a></code> element that was not <a href=#concept-embed-active title=concept-embed-active>potentially active</a> becomes <a href=#concept-embed-active title=concept-embed-active>potentially active</a>, and whenever
+ a <a href=#concept-embed-active title=concept-embed-active>potentially active</a>
+ <code><a href=#the-embed-element>embed</a></code> element's <code title=attr-embed-type><a href=#attr-embed-type>src</a></code> attribute is set, changed, or
+ removed, and whenever a <a href=#concept-embed-active title=concept-embed-active>potentially active</a>
+ <code><a href=#the-embed-element>embed</a></code> element's <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute is set, changed, or
+ removed, the appropriate set of steps from the following is then
+ applied:</p>
+
+ <dl class=switch><dt>If the element has a <code title=attr-embed-src><a href=#attr-embed-src>src</a></code>
+ attribute set</dt>
+
+ <dd>
+
+ <p>The user agent must <a href=#resolve-a-url title="resolve a url">resolve</a>
+ the value of the element's <code title=attr-embed-src><a href=#attr-embed-src>src</a></code>
+ attribute, relative to the element. If that is successful, the
+ user agent should <a href=#fetch>fetch</a> the resulting <a href=#absolute-url>absolute
+ URL</a>, from the element's <a href=#browsing-context-scope-origin>browsing context scope
+ origin</a> if it has one<!-- potentially http-origin privacy
+ sensitive -->. The <a href=#concept-task title=concept-task>task</a> that is
+ <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>networking
+ task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> must find and instantiate an
+ appropriate <a href=#plugin>plugin</a> based on the <a href=#concept-embed-type title=concept-embed-type>content's type</a>, and hand that
+ <a href=#plugin>plugin</a> the content of the resource, replacing any
+ previously instantiated plugin for the element.</p> <!-- Note that
+ this doesn't happen when the base URL changes. -->
+
+ <p>Fetching the resource must <a href=#delay-the-load-event>delay the load event</a> of
+ the element's document.</p>
+ <!-- if we add load/error events, then replace the previous
+ paragraph with the text one: -->
+ <!-- similar text in various places -->
+ <!--<p>Fetching the resource must <span>delay the load
+ event</span> of the element's document until the final <span
+ title="concept-task">task</span> that is <span title="queue a
+ task">queued</span> by the <span>networking task source</span>
+ once the resource has been <span title="fetch">fetched</span> has
+ been run.</p>-->
+
+ </dd>
+
+ <dt>If the element has no <code title=attr-embed-src><a href=#attr-embed-src>src</a></code>
+ attribute set</dt>
+
+ <dd><p>The user agent should find and instantiate an appropriate
+ <a href=#plugin>plugin</a> based on the value of the <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute.</p>
+
+ </dl><p>Whenever an <code><a href=#the-embed-element>embed</a></code> element that was <a href=#concept-embed-active title=concept-embed-active>potentially active</a> stops being
+ <a href=#concept-embed-active title=concept-embed-active>potentially active</a>, any
+ <a href=#plugin>plugin</a> that had been instantiated for that element must
+ be unloaded.</p>
+
+ <p class=note>The <code><a href=#the-embed-element>embed</a></code> element is unaffected by the
+ CSS 'display' property. The selected plugin is instantiated even if
+ the element is hidden with a 'display:none' CSS style.</p>
+
+ <p>The <dfn id=concept-embed-type title=concept-embed-type>type of the content</dfn>
+ being embedded is defined as follows:</p>
+
+ <ol><li><p>If the element has a <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute, and that attribute's
+ value is a type that a <a href=#plugin>plugin</a> supports, then the value
+ of the <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute is the
+ <a href=#concept-embed-type title=concept-embed-type>content's type</a>.</li>
+
+ <li>
+
+ <!-- if we get to this point we know we can successfully parsed
+ the URL, since this algorithm is only used after fetching the
+ resource in the steps above -->
+
+ <p>Otherwise, if the <a href=#url-path title=url-path>&lt;path&gt;</a>
+ component of the <a href=#url>URL</a> of the specified resource (after
+ any redirects) matches a pattern that a <a href=#plugin>plugin</a>
+ supports, then the <a href=#concept-embed-type title=concept-embed-type>content's
+ type</a> is the type that that plugin can handle.</p>
+
+ <p class=example>For example, a plugin might say that it can
+ handle resources with <a href=#url-path title=url-path>&lt;path&gt;</a>
+ components that end with the four character string "<code title="">.swf</code>".</p>
+
+ <!-- it's sad that we have to do extension sniffing. sigh. -->
+ <!-- see also <object> which has a similar step -->
+
+ </li>
+
+ <li><p>Otherwise, if the specified resource has <a href=#content-type title=Content-Type>explicit Content-Type metadata</a>, then
+ that is the <a href=#concept-embed-type title=concept-embed-type>content's
+ type</a>.</li>
+
+ <li><p>Otherwise, the content has no type and there can be no
+ appropriate <a href=#plugin>plugin</a> for it.</li>
+
+ <!-- This algorithm is a monument to bad design. Go legacy! -->
+
+ </ol><p>The <code><a href=#the-embed-element>embed</a></code> element has no <a href=#fallback-content>fallback
+ content</a>. If the user agent can't find a suitable plugin, then
+ the user agent must use a default plugin. (This default could be as
+ simple as saying "Unsupported Format".)</p>
+
+ <p>Whether the resource is fetched successfully or not (e.g. whether
+ the response code was a 2xx code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>) must be
+ ignored when determining the resource's type and when handing the
+ resource to the plugin.</p>
+
+ <p class=note>This allows servers to return data for plugins even
+ with error responses (e.g. HTTP 500 Internal Server Error codes can
+ still contain plugin data).</p>
+
+ </div>
+
+ <p>Any namespace-less attribute other than <code title=attr-embed-name><a href=#attr-embed-name>name</a></code>, <code title=attr-embed-align><a href=#attr-embed-align>align</a></code>, <code title=attr-embed-hspace><a href=#attr-embed-hspace>hspace</a></code>, and <code title=attr-embed-vspace><a href=#attr-embed-vspace>vspace</a></code> <!-- when editing, see also
+ note below --> may be specified on the <code><a href=#the-embed-element>embed</a></code> element,
+ so long as its name is <a href=#xml-compatible>XML-compatible</a> and contains no
+ characters in the range U+0041 to U+005A (LATIN CAPITAL LETTER A to
+ LATIN CAPITAL LETTER Z). These attributes are then passed as
+ parameters to the <a href=#plugin>plugin</a>.</p>
+
+ <p class=note>All attributes in <a href=#html-documents>HTML documents</a> get
+ lowercased automatically, so the restriction on uppercase letters
+ doesn't affect such documents.</p>
+
+ <p class=note>The four exceptions are to exclude legacy attributes
+ that have side-effects beyond just sending parameters to the
+ <a href=#plugin>plugin</a>.</p>
+
+ <div class=impl>
+
+ <p>The user agent should pass the names and values of all the
+ attributes of the <code><a href=#the-embed-element>embed</a></code> element that have no namespace
+ to the <a href=#plugin>plugin</a> used, when it is instantiated.</p>
+
+ <p>If the <a href=#plugin>plugin</a> instantiated for the
+ <code><a href=#the-embed-element>embed</a></code> element supports a scriptable interface, the
+ <code><a href=#htmlembedelement>HTMLEmbedElement</a></code> object representing the element should
+ expose that interface while the element is instantiated.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-embed-element>embed</a></code> element supports <a href=#dimension-attributes>dimension
+ attributes</a>.</p>
+
+ <div class=impl>
+
+ <p>The IDL attributes <dfn id=dom-embed-src title=dom-embed-src><code>src</code></dfn> and <dfn id=dom-embed-type title=dom-embed-type><code>type</code></dfn> each must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here's a way to embed a resource that requires a proprietary
+ plug-in, like Flash:</p>
+
+ <pre>&lt;embed src="catgame.swf"&gt;</pre>
+
+ <p>If the user does not have the plug-in (for example if the
+ plug-in vendor doesn't support the user's platform), then the user
+ will be unable to use the resource.</p>
+
+ <p>To pass the plugin a parameter "quality" with the value "high",
+ an attribute can be specified:</p>
+
+ <pre>&lt;embed src="catgame.swf" quality="high"&gt;</pre>
+
+ <p>This would be equivalent to the following, when using an
+ <code><a href=#the-object-element>object</a></code> element instead:</p>
+
+ <pre>&lt;object data="catgame.swf"&gt;
+ &lt;param name="quality" value="high"&gt;
+&lt;/object&gt;</pre>
+
+ </div>
+
+
+
+
+ <h4 id=the-object-element><span class=secno>4.8.4 </span>The <dfn><code>object</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#embedded-content>Embedded content</a>.</dd>
+ <dd>If the element has a <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd> <!-- also when showing a plugin or a nested browsing context, but checking that statically is hard...) -->
+ <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-submit title=category-submit>submittable</a>, <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-param-element>param</a></code> elements, then, <a href=#transparent>transparent</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-object-data><a href=#attr-object-data>data</a></code></dd>
+ <dd><code title=attr-object-type><a href=#attr-object-type>type</a></code></dd>
+ <dd><code title=attr-object-name><a href=#attr-object-name>name</a></code></dd>
+ <dd><code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code></dd>
+ <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlobjectelement>HTMLObjectElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-object-data title=dom-object-data>data</a>;
+ attribute DOMString <a href=#dom-object-type title=dom-object-type>type</a>;
+ attribute DOMString <a href=#dom-object-name title=dom-object-name>name</a>;
+ attribute DOMString <a href=#dom-object-usemap title=dom-object-useMap>useMap</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
+ attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
+ readonly attribute Document <a href=#dom-object-contentdocument title=dom-object-contentDocument>contentDocument</a>;
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-object-contentwindow title=dom-object-contentWindow>contentWindow</a>;
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+};</pre>
+ <div class=impl>
+ <p>Depending on the type of content instantiated by the
+ <code><a href=#the-object-element>object</a></code> element, the node also supports other
+ interfaces.</p>
+ </div>
+ </dd>
+ </dl><p>The <code><a href=#the-object-element>object</a></code> element can represent an external
+ resource, which, depending on the type of the resource, will either
+ be treated as an image, as a <a href=#nested-browsing-context>nested browsing context</a>,
+ or as an external resource to be processed by a
+ <a href=#plugin>plugin</a>.</p>
+
+ <p>The <dfn id=attr-object-data title=attr-object-data><code>data</code></dfn>
+ attribute, if present, specifies the address of the resource. If
+ present, the attribute must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty
+ URL potentially surrounded by spaces</a>.</p>
+
+ <p>The <dfn id=attr-object-type title=attr-object-type><code>type</code></dfn>
+ attribute, if present, specifies the type of the resource. If
+ present, the attribute must be a <a href=#valid-mime-type>valid MIME type</a>.</p>
+
+ <p>At least one of either the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute or the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute must be present.</p>
+
+ <p>The <dfn id=attr-object-name title=attr-object-name><code>name</code></dfn>
+ attribute, if present, must be a <a href=#valid-browsing-context-name>valid browsing context
+ name</a>. The given value is used to name the <a href=#nested-browsing-context>nested
+ browsing context</a>, if applicable.</p>
+
+ <div class=impl>
+
+ <p>When the element is created, when it is popped off the
+ <a href=#stack-of-open-elements>stack of open elements</a> of an <a href=#html-parser>HTML parser</a>
+ or <a href=#xml-parser>XML parser</a>, and subsequently whenever the element is
+ <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into a
+ document</a> or <a href=#remove-an-element-from-a-document title="remove an element from a
+ document">removed from a document</a>; and whenever the element's
+ <code><a href=#document>Document</a></code> changes whether it is <a href=#fully-active>fully
+ active</a>; and whenever an ancestor <code><a href=#the-object-element>object</a></code> element
+ changes to or from showing its <a href=#fallback-content>fallback content</a>; and
+ whenever the element's <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute is set,
+ changed, or removed; and, when its <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute is not present,
+ whenever its <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute is
+ set, changed, or removed; and, when neither its <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute nor its <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute are present, whenever
+ its <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute is set,
+ changed, or removed: the user agent must <a href=#queue-a-task>queue a task</a>
+ to run the following steps to (re)determine what the
+ <code><a href=#the-object-element>object</a></code> element represents. The <a href=#task-source>task source</a>
+ for this <a href=#concept-task title=concept-task>task</a> is the <a href=#dom-manipulation-task-source>DOM
+ manipulation task source</a>.</p> <!-- Changing the base URL
+ doesn't trigger this. -->
+
+ <ol><li>
+
+ <p>If the user has indicated a preference that this
+ <code><a href=#the-object-element>object</a></code> element's <a href=#fallback-content>fallback content</a> be
+ shown instead of the element's usual behavior, then jump to the
+ last step in the overall set of steps (fallback).</p>
+
+ <p class=note>For example, a user could ask for the element's
+ <a href=#fallback-content>fallback content</a> to be shown because that content
+ uses a format that the user finds more accessible.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the element has an ancestor <a href=#media-element>media element</a>, or
+ has an ancestor <code><a href=#the-object-element>object</a></code> element that is <em>not</em>
+ showing its <a href=#fallback-content>fallback content</a>, or if the element is
+ not <a href=#in-a-document title="in a document">in a <code>Document</code></a>
+ with a <a href=#browsing-context>browsing context</a>, or if the element's
+ <code><a href=#document>Document</a></code> is not <a href=#fully-active>fully active</a>, or if the
+ element is still in the <a href=#stack-of-open-elements>stack of open elements</a> of an
+ <a href=#html-parser>HTML parser</a> or <a href=#xml-parser>XML parser</a>, then jump to
+ the last step in the overall set of steps (fallback).</p>
+
+ </li>
+
+ <li>
+
+ <!-- what if it's not in the document? if that should prevent
+ plugin instantiation, then here just skip to the last step -->
+
+ <p>If the <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code>
+ attribute is present, and has a value that isn't the empty string,
+ then: if the user agent can find a <a href=#plugin>plugin</a> suitable
+ according to the value of the <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute, and <a href=#sandboxPluginObject>plugins aren't being sandboxed</a>,
+ then that <a href=#plugin>plugin</a> <a href=#object-plugin>should be
+ used</a>, and the value of the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute, if any, should be
+ passed to the <a href=#plugin>plugin</a>. If no suitable
+ <a href=#plugin>plugin</a> can be found, or if the <a href=#plugin>plugin</a>
+ reports an error, jump to the last step in the overall set of
+ steps (fallback).</p>
+
+ <!--
+ case insensitive:
+ is "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" -> application/x-shockwave-flash
+ is "clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa" -> audio/x-pn-realaudio-plugin
+ is "clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" -> video/quicktime
+ is "clsid:166b1bca-3f9c-11cf-8075-444553540000" -> application/x-director
+ is "clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" -> application/x-mplayer2
+ starts with "java:" -> application/x-java-vm
+ starts with "clsid:" -> application/x-oleobject
+ -->
+
+ </li>
+
+ <!-- (v2?)
+ we may have to define magic fallback to <param> if it turns out to
+ be needed in testing:
+ <hyatt> apparently your url can come from <param>
+ <hyatt> not just the data attribute
+ <hyatt> our code looks for params with "src", "movie", "code" and "url"
+ <hyatt> and also tries to find the type on a param
+ <Hixie> oh that's you trying to have hacky activex support
+ <Hixie> opera does that too
+ <hyatt> yeah we support activex versions of plugins that are common
+ <hyatt> like flash and quicktime and realaudio
+ <Hixie> that would be a step 1b. if no data attribute, then look for a <param> to get you a URL instead.
+ <Hixie> and if you find one, carry on as if that was your data="".
+ -->
+
+ <li><p>If the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute
+ is present and its value is not the empty string, then:</p>
+
+ <ol><li><p>If the <code title=attr-object-type><a href=#attr-object-type>type</a></code>
+ attribute is present and its value is not a type that the user
+ agent supports, and is not a type that the user agent can find a
+ <a href=#plugin>plugin</a> for, then the user agent may jump to the last
+ step in the overall set of steps (fallback) without fetching the
+ content to examine its real type.</li>
+
+ <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the
+ <a href=#url>URL</a> specified by the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute, relative to the
+ element.</li>
+
+ <li><p>If that failed, <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-error>error</code> at the element, then jump
+ to the last step in the overall set of steps (fallback).</li>
+
+ <li>
+
+ <p><a href=#fetch>Fetch</a> the resulting <a href=#absolute-url>absolute URL</a>,
+ from the element's <a href=#browsing-context-scope-origin>browsing context scope origin</a> if
+ it has one<!-- potentially http-origin privacy sensitive
+ -->.</p>
+
+ <!-- similar text in various places --> <p>Fetching the resource
+ must <a href=#delay-the-load-event>delay the load event</a> of the element's document
+ until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>networking task
+ source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> (defined next) has been run.</p>
+
+ </li>
+
+ <li><p>If the resource is not yet available (e.g. because the
+ resource was not available in the cache, so that loading the
+ resource required making a request over the network), then jump
+ to the last step in the overall set of steps (fallback). The
+ <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue
+ a task">queued</a> by the <a href=#networking-task-source>networking task source</a>
+ once the resource is available must restart this algorithm from
+ this step. Resources can load incrementally; user agents may opt
+ to consider a resource "available" whenever enough data has been
+ obtained to begin processing the resource.</li>
+
+ <li><p>If the load failed (e.g. there was an HTTP 404 error,
+ there was a DNS error), <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-error>error</code> at the element, then jump
+ to the last step in the overall set of steps (fallback).</li>
+
+ <li id=object-type-detection>
+
+ <p>Determine the <var title="">resource type</var>, as follows:</p>
+
+<!-- Hopefully this step is exactly equivalent to the following:
+
+ START
+ |
+ V
+ Is there a Content-Type and is the UA going to obey it blindly?
+ | |
+ | YES | NO
+ | V YES
+ | Is there a type="" attribute whose value is a plugin type? ============================================-.
+ | | |
+ | | NO |
+ | V NO YES |
+ | Is there a Content type? ========-> Is there a type="" attribute? ==========> Let TYPE be type="" |
+ | | | attribute value |
+ | | YES | NO | |
+ V NO V | V |
+ +-<============== Is it text/plain or application/octet-stream? `==> Let TYPE be =====>+ |
+ | | | Sniffed type | |
+ | | text/plain | octet-stream V |
+ | V YES V Is TYPE |
+ | Does the page sniff as binary? ======> Is there a type="" attribute? application/octet-stream? |
+ | | | | | | |
+ | | NO | YES | NO | YES | NO |
+ | | | YES V V | |
+ | | application/octet-stream? =====> Extension that is plugin type? | |
+ | | | | | | |
+ | | | NO | NO | YES | |
+ | | V | | | |
+ | | Type attribute is XML or YES V | | |
+ | | doesn't start with image/* ======> FALLBACK | | |
+ | | and is not a plugin type? | | |
+ | | | | | |
+ | | | NO | | V
+ V V V V V Use
+ Use Use Use it (will be Use Use type=""
+ Content-Type text/plain bitmap or plugin) extension TYPE attribute
+ | | | | | |
+ | V V V V |
+ `================->-+========================================>-+==============>-+-<============-+-<==============+-<======'
+ |
+ V
+ Continue following rules in the spec, which might
+ result in a plugin, a browsing context, an image,
+ or using fallback, depending on the UA and the type.
+
+
+ "Extension that is plugin type?" means "Is there an extension that matches one that a plugin supports?".
+ Plugins are not allowed to register text/plain or application/octet-stream.
+
+-->
+
+ <ol><li>
+
+ <p>Let the <var title="">resource type</var> be unknown.</p>
+
+ </li>
+
+ <li>
+
+ <!-- by request: http://www.w3.org/Bugs/Public/show_bug.cgi?id=8479 -->
+
+ <p>If the user agent is configured to strictly obey
+ Content-Type headers for this resource, and the resource has
+ <a href=#content-type title=Content-Type>associated Content-Type
+ metadata</a>, then let the <var title="">resource
+ type</var> be the type specified in <a href=#content-type title=Content-Type>the resource's Content-Type
+ metadata</a>, and jump to the step below labeled
+ <i>handler</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <code title=attr-object-type><a href=#attr-object-type>type</a></code>
+ attribute present on the <code><a href=#the-object-element>object</a></code> element, and that
+ attribute's value is not a type that the user agent supports,
+ but it <em>is</em> a type that a <a href=#plugin>plugin</a> supports,
+ then let the <var title="">resource type</var> be the type
+ specified in that <code title=attr-object-type><a href=#attr-object-type>type</a></code>
+ attribute, and jump to the step below labeled
+ <i>handler</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Run the approprate set of steps from the following
+ list:</p>
+
+ <dl class=switch><dt>The resource has <a href=#content-type title=Content-Type>associated
+ Content-Type metadata</a></dt>
+
+ <dd>
+
+ <ol><li>
+
+ <p>Let <var title="">binary</var> be false.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the type specified in <a href=#content-type title=Content-Type>the
+ resource's Content-Type metadata</a> is
+ "<code>text/plain</code>", and the result of applying the
+ <a href=#content-type-sniffing:-text-or-binary title="Content-Type sniffing: text or binary">rules
+ for distingushing if a resource is text or binary</a>
+ to the resource is that the resource is not
+ <code>text/plain</code>, then set <var title="">binary</var> to true.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the type specified in <a href=#content-type title=Content-Type>the
+ resource's Content-Type metadata</a> is
+ "<code>application/octet-stream</code>", then set <var title="">binary</var> to true.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">binary</var> is false, then let the
+ <var title="">resource type</var> be the type specified in
+ <a href=#content-type title=Content-Type>the resource's Content-Type
+ metadata</a>, and jump to the step below labeled
+ <i>handler</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute present on
+ the <code><a href=#the-object-element>object</a></code> element, and its value is not
+ <code>application/octet-stream</code>, then run the
+ following steps:</p>
+
+ <ol><li>
+
+ <p>If the attribute's value is a type that a <a href=#plugin>plugin</a> supports, or
+ the attribute's value is a type that starts with "<code>image/</code>" that is not also an <a href=#xml-mime-type>XML MIME type</a>,
+ then let the <var title="">resource type</var> be the type specified in that <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute.</p>
+
+ </li>
+
+ <li>
+
+ <p>Jump to the step below labeled <i>handler</i>.</p>
+
+ </li>
+
+ </ol></li>
+
+ </ol></dd>
+
+ <dt>The resource does not have <a href=#content-type title=Content-Type>associated Content-Type
+ metadata</a></dt>
+
+ <dd>
+
+ <ol><li>
+
+ <p>If there is a <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute present on
+ the <code><a href=#the-object-element>object</a></code> element, then let the <var title="">tentative type</var> be the type specified in that
+ <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute.</p>
+
+ <p>Otherwise, let <var title="">tentative type</var> be the
+ <a href=#content-type-sniffing-0 title="content-type sniffing">sniffed type of the
+ resource</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">tentative type</var> is <em>not</em>
+ <code>application/octet-stream</code>, then let <var title="">resource type</var> be <var title="">tentative
+ type</var> and jump to the step below labeled
+ <i>handler</i>.</p>
+
+ </li>
+
+ </ol></dd>
+
+ </dl></li>
+
+ <li>
+
+ <!-- if we get to this point we know we can successfully
+ parsed the URL, since this algorithm is only used after
+ fetching the resource in the steps above -->
+
+ <p>If the <a href=#url-path title=url-path>&lt;path&gt;</a> component
+ of the <a href=#url>URL</a> of the specified resource (after any
+ redirects) matches a pattern that a <a href=#plugin>plugin</a>
+ supports, then let <var title="">resource type</var> be the
+ type that that plugin can handle.</p>
+
+ <p class=example>For example, a plugin might say that it can
+ handle resources with <a href=#url-path title=url-path>&lt;path&gt;</a> components that end with
+ the four character string "<code title="">.swf</code>".</p>
+
+ <!-- it's sad that we have to do extension sniffing. sigh. -->
+ <!-- see also <embed> which has a similar step -->
+
+ </li>
+
+ </ol><p class=note>It is possible for this step to finish with <var title="">resource type</var> still being unknown, or for one of
+ the substeps above to jump straight to the next step. In both
+ cases, the next step will trigger fallback.</p>
+
+ </li>
+
+ <li><p><i>Handler</i>: Handle the content as given by the first
+ of the following cases that matches:</p>
+
+ <dl class=switch><dt>If the <var title="">resource type</var> is not a type that
+ the user agent supports, but it <em>is</em> a type that a
+ <a href=#plugin>plugin</a> supports</dt>
+
+ <dd>
+
+ <p>If <a href=#sandboxPluginObject>plugins are being
+ sandboxed</a>, jump to the last step in the overall set of
+ steps (fallback).</p>
+
+ <p>Otherwise, the user agent should <a href=#object-plugin>use the plugin that supports <var title="">resource type</var></a> and pass the content of the
+ resource to that <a href=#plugin>plugin</a>. If the
+ <a href=#plugin>plugin</a> reports an error, then jump to the last
+ step in the overall set of steps (fallback).</p>
+
+ </dd>
+
+
+ <dt>If the <var title="">resource type</var> is an <a href=#xml-mime-type>XML MIME
+ type</a>, or
+ <!-- (redundant with the next one) if the <var title="">resource type</var> is HTML, or -->
+ if the <var title="">resource type</var> does not start with
+ "<code>image/</code>"</dt>
+
+ <dd>
+
+ <p>The <code><a href=#the-object-element>object</a></code> element must be associated with a
+ newly created <a href=#nested-browsing-context>nested browsing context</a>, if it does
+ not already have one.</p>
+
+ <p>If the <a href=#url>URL</a> of the given resource is not
+ <code><a href=#about:blank>about:blank</a></code>, the element's <a href=#nested-browsing-context>nested browsing
+ context</a> must then be <a href=#navigate title=navigate>navigated</a> to that resource, with
+ <a href=#replacement-enabled>replacement enabled</a>, and with the
+ <code><a href=#the-object-element>object</a></code> element's document's <a href=#browsing-context>browsing
+ context</a> as the <a href=#source-browsing-context>source browsing
+ context</a>. (The <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute of the
+ <code><a href=#the-object-element>object</a></code> element doesn't get updated if the
+ browsing context gets further navigated to other
+ locations.)</p>
+
+ <p>If the <a href=#url>URL</a> of the given resource <em>is</em>
+ <code><a href=#about:blank>about:blank</a></code>, then, instead, the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-load>load</code> at the
+ <code><a href=#the-object-element>object</a></code> element.</p>
+
+ <p>The <code><a href=#the-object-element>object</a></code> element <a href=#represents>represents</a> the
+ <a href=#nested-browsing-context>nested browsing context</a>.</p>
+
+ <p>If the <code title=attr-object-name><a href=#attr-object-name>name</a></code> attribute
+ is present, the <a href=#browsing-context-name>browsing context name</a> must be set
+ to the value of this attribute; otherwise, the <a href=#browsing-context-name>browsing
+ context name</a> must be set to the empty string.</p>
+
+ <p class=note>It's possible that the <a href=#navigate title=navigate>navigation</a> of the <a href=#browsing-context>browsing
+ context</a> will actually obtain the resource from a
+ different <a href=#application-cache>application cache</a>. Even if the resource
+ is then found to have a different type, it is still used as
+ part of a <a href=#nested-browsing-context>nested browsing context</a>; this algorithm
+ doesn't restart with the new resource.</p>
+
+ <!-- note that malformed XML files don't cause fallback -->
+
+ </dd>
+
+
+ <dt>If the <var title="">resource type</var> starts with
+ "<code>image/</code>", and support for images has not been
+ disabled</dt>
+
+ <dd>
+
+ <p>Apply the <a href=#content-type-sniffing:-image title="content-type sniffing: image">image
+ sniffing</a> rules to determine the type of the image.</p>
+
+ <p>The <code><a href=#the-object-element>object</a></code> element <a href=#represents>represents</a> the
+ specified image. The image is not a <a href=#nested-browsing-context>nested browsing
+ context</a>.</p>
+
+ <p>If the image cannot be rendered, e.g. because it is
+ malformed or in an unsupported format, jump to the last step
+ in the overall set of steps (fallback).</p>
+
+ </dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>The given <var title="">resource type</var> is not
+ supported. Jump to the last step in the overall set of steps
+ (fallback).</p>
+
+ <p class=note>If the previous step ended with the <var title="">resource type</var> being unknown, this is the case
+ that is triggered.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li><p>The element's contents are not part of what the
+ <code><a href=#the-object-element>object</a></code> element represents.</p>
+
+ <li>
+
+ <p>Once the resource is completely loaded, <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the element.</p>
+
+ <p>The <a href=#task-source>task source</a> for this task<!--tasks mentioned
+ in this section--> is the <a href=#dom-manipulation-task-source>DOM manipulation task
+ source</a>.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li><p>If the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute
+ is absent but the <code title=attr-object-type><a href=#attr-object-type>type</a></code>
+ attribute is present, <a href=#sandboxPluginObject>plugins aren't
+ being sandboxed</a>, and the user agent can find a
+ <a href=#plugin>plugin</a> suitable according to the value of the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute, then that
+ <a href=#plugin>plugin</a> <a href=#object-plugin>should be used</a>. If
+ no suitable <a href=#plugin>plugin</a> can be found, or if the
+ <a href=#plugin>plugin</a> reports an error, jump to the next step
+ (fallback).</li>
+
+ <li><p>(Fallback.) The <code><a href=#the-object-element>object</a></code> element
+ <a href=#represents>represents</a> the element's children, ignoring any
+ leading <code><a href=#the-param-element>param</a></code> element children. This is the element's
+ <a href=#fallback-content>fallback content</a>. If the element has an instantiated
+ <a href=#plugin>plugin</a>, then unload it.</li>
+
+ </ol><p id=object-plugin>When the algorithm above instantiates a
+ <a href=#plugin>plugin</a>, the user agent should pass to the
+ <a href=#plugin>plugin</a> used the names and values of all the attributes
+ on the element, in the order they were added to the element, with
+ the attributes added by the parser being ordered in source order,
+ followed by a parameter named "PARAM" whose value is null,
+ followed by all the names and values of <a href=#concept-param-parameter title=concept-param-parameter>parameters</a> given by
+ <code><a href=#the-param-element>param</a></code> elements that are children of the
+ <code><a href=#the-object-element>object</a></code> element, in <a href=#tree-order>tree order</a>. If the
+ <a href=#plugin>plugin</a> supports a scriptable interface, the
+ <code><a href=#htmlobjectelement>HTMLObjectElement</a></code> object representing the element
+ should expose that interface. The <code><a href=#the-object-element>object</a></code> element
+ <a href=#represents>represents</a> the <a href=#plugin>plugin</a>. The
+ <a href=#plugin>plugin</a> is not a nested <a href=#browsing-context>browsing
+ context</a>.</p>
+
+ <p id=sandboxPluginObject>If either:</p>
+
+ <ul><li>the <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> was
+ set on the <code><a href=#the-object-element>object</a></code> element's <code><a href=#document>Document</a></code>'s
+ <a href=#browsing-context>browsing context</a> when the <code><a href=#document>Document</a></code> was
+ created, or</li>
+
+ <li>the <code><a href=#the-object-element>object</a></code> element's <code><a href=#document>Document</a></code> was
+ parsed from a resource whose <a href=#content-type-sniffing-0 title="Content-Type
+ sniffing">sniffed type</a> as determined during <a href=#navigate title=navigate>navigation</a> is
+ <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code></li>
+
+ </ul><p>...then the steps above must always act as if they had failed to
+ find a <a href=#plugin>plugin</a>, even if one would otherwise have been
+ used.</p>
+
+ <p class=note>The above algorithm is independent of CSS properties
+ (including 'display', 'overflow', and 'visibility'). For example, it
+ runs even if the element is hidden with a 'display:none' CSS style,
+ and does not run <em>again</em> if the element's visibility
+ changes.</p>
+
+ <p>Due to the algorithm above, the contents of <code><a href=#the-object-element>object</a></code>
+ elements act as <a href=#fallback-content>fallback content</a>, used only when
+ referenced resources can't be shown (e.g. because it returned a 404
+ error). This allows multiple <code><a href=#the-object-element>object</a></code> elements to be
+ nested inside each other, targeting multiple user agents with
+ different capabilities, with the user agent picking the first one it
+ supports.</p>
+
+ <p>Whenever the <code title=attr-object-name><a href=#attr-object-name>name</a></code> attribute
+ is set, if the <code><a href=#the-object-element>object</a></code> element has a nested
+ <a href=#browsing-context>browsing context</a>, its <a href=#browsing-context-name title="browsing context
+ name">name</a> must be changed to the new value. If the attribute
+ is removed, if the <code><a href=#the-object-element>object</a></code> element has a <a href=#browsing-context>browsing
+ context</a>, the <a href=#browsing-context-name>browsing context name</a> must be set
+ to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute,
+ if present while the <code><a href=#the-object-element>object</a></code> element represents an
+ image, can indicate that the object has an associated <a href=#image-map>image
+ map</a>. <span class=impl>The attribute must be ignored if the
+ <code><a href=#the-object-element>object</a></code> element doesn't represent an image.</span></p>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-object-element>object</a></code> element with its
+ <a href=#form-owner>form owner</a>.</p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: <code><a href=#the-object-element>object</a></code>
+ elements are always <a href=#barred-from-constraint-validation>barred from constraint
+ validation</a>.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-object-element>object</a></code> element supports <a href=#dimension-attributes>dimension
+ attributes</a>.</p>
+
+ <div class=impl>
+
+ <p>The IDL attributes <dfn id=dom-object-data title=dom-object-data><code>data</code></dfn>, <dfn id=dom-object-type title=dom-object-type><code>type</code></dfn>, <dfn id=dom-object-name title=dom-object-name><code>name</code></dfn>, and <dfn id=dom-object-usemap title=dom-object-useMap><code>useMap</code></dfn> each must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The <dfn id=dom-object-contentdocument title=dom-object-contentDocument><code>contentDocument</code></dfn>
+ IDL attribute must return the <code><a href=#document>Document</a></code> object of the
+ <a href=#active-document>active document</a> of the <code><a href=#the-object-element>object</a></code> element's
+ <a href=#nested-browsing-context>nested browsing context</a>, if it has one; otherwise, it
+ must return null.</p>
+
+ <p>The <dfn id=dom-object-contentwindow title=dom-object-contentWindow><code>contentWindow</code></dfn>
+ IDL attribute must return the <code><a href=#windowproxy>WindowProxy</a></code> object of the
+ <code><a href=#the-object-element>object</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>,
+ if it has one; otherwise, it must return null.</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute is part of the
+ element's forms API.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, a Java applet is embedded in a page
+ using the <code><a href=#the-object-element>object</a></code> element. (Generally speaking, it is
+ better to avoid using applets like these and instead use native
+ JavaScript and HTML to provide the functionality, since that way
+ the application will work on all Web browsers without requiring a
+ third-party plugin. Many devices, especially embedded devices, do
+ not support third-party technologies like Java.)</p>
+
+ <pre>&lt;figure&gt;
+ &lt;object type="application/x-java-applet"&gt;
+ &lt;param name="code" value="MyJavaClass"&gt;
+ &lt;p&gt;You do not have Java available, or it is disabled.&lt;/p&gt;
+ &lt;/object&gt;
+ &lt;figcaption&gt;My Java Clock&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In this example, an HTML page is embedded in another using the
+ <code><a href=#the-object-element>object</a></code> element.</p>
+
+ <pre>&lt;figure&gt;
+ &lt;object data="clock.html"&gt;&lt;/object&gt;
+ &lt;figcaption&gt;My HTML Clock&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how a plugin can be used in HTML (in
+ this case the Flash plugin, to show a video file). Fallback is
+ provided for users who do not have Flash enabled, in this case
+ using the <code><a href=#video>video</a></code> element to show the video for those
+ using user agents that support <code><a href=#video>video</a></code>, and finally
+ providing a link to the video for those who have neither Flash nor
+ a <code><a href=#video>video</a></code>-capable browser.</p>
+
+ <pre>&lt;p&gt;Look at my video:
+ &lt;object type="application/x-shockwave-flash"&gt;
+ &lt;param name=movie value="http://video.example.com/library/watch.swf"&gt;
+ &lt;param name=allowfullscreen value=true&gt;
+ &lt;param name=flashvars value="http://video.example.com/vids/315981"&gt;
+ &lt;video controls src="http://video.example.com/vids/315981"&gt;
+ &lt;a href="http://video.example.com/vids/315981"&gt;View video&lt;/a&gt;.
+ &lt;/video&gt;
+ &lt;/object&gt;
+&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-param-element><span class=secno>4.8.5 </span>The <dfn><code>param</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of an <code><a href=#the-object-element>object</a></code> element, before any <a href=#flow-content>flow content</a>.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-param-name><a href=#attr-param-name>name</a></code></dd>
+ <dd><code title=attr-param-value><a href=#attr-param-value>value</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlparamelement>HTMLParamElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-param-name title=dom-param-name>name</a>;
+ attribute DOMString <a href=#dom-param-value title=dom-param-value>value</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-param-element>param</a></code> element defines parameters for plugins
+ invoked by <code><a href=#the-object-element>object</a></code> elements. It does not <a href=#represents title=represents>represent</a> anything on its own.</p>
+
+ <p>The <dfn id=attr-param-name title=attr-param-name><code>name</code></dfn>
+ attribute gives the name of the parameter.</p>
+
+ <p>The <dfn id=attr-param-value title=attr-param-value><code>value</code></dfn>
+ attribute gives the value of the parameter.</p>
+
+ <p>Both attributes must be present. They may have any value.</p>
+
+ <div class=impl>
+
+ <p>If both attributes are present, and if the parent element of the
+ <code><a href=#the-param-element>param</a></code> is an <code><a href=#the-object-element>object</a></code> element, then the
+ element defines a <dfn id=concept-param-parameter title=concept-param-parameter>parameter</dfn> with the given
+ name/value pair.</p>
+
+ <p>The IDL attributes <dfn id=dom-param-name title=dom-param-name><code>name</code></dfn> and <dfn id=dom-param-value title=dom-param-value><code>value</code></dfn> must both
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how the <code><a href=#the-param-element>param</a></code> element
+ can be used to pass a parameter to a plugin, in this case the O3D
+ plugin.</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html lang="en"&gt;
+ &lt;head&gt;
+ &lt;title&gt;O3D test page&lt;/title&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;p&gt;
+ &lt;object type="application/vnd.o3d.auto"&gt;
+ <strong>&lt;param name="o3d_features" value="FloatingPointTextures"&gt;</strong>
+ This page requires the use of a proprietary technology. Since you
+ have not installed the software product required to view this
+ page, you should try visiting another site that instead uses open
+ vendor-neutral technologies.
+ &lt;/object&gt;
+ &lt;script src="o3dtest.js"&gt;&lt;/script&gt;
+ &lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ </div>
+
+
+ <h4 id=video><span class=secno>4.8.6 </span>The <dfn><code>video</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#embedded-content>Embedded content</a>.</dd>
+ <dd>If the element has a <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>If the element has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute:
+<!--TT-->
+ zero or more <code><a href=#the-track-element>track</a></code> elements, then
+<!--TT-->
+ <a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
+ <dd>If the element does not have a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute: one or more <code><a href=#the-source-element>source</a></code> elements, then
+<!--TT-->
+ zero or more <code><a href=#the-track-element>track</a></code> elements, then
+<!--TT-->
+ <a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-media-src><a href=#attr-media-src>src</a></code></dd>
+ <dd><code title=attr-video-poster><a href=#attr-video-poster>poster</a></code></dd>
+ <dd><code title=attr-media-preload><a href=#attr-media-preload>preload</a></code></dd>
+ <dd><code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code></dd>
+ <dd><code title=attr-media-loop><a href=#attr-media-loop>loop</a></code></dd>
+ <dd><code title=attr-media-controls><a href=#attr-media-controls>controls</a></code></dd>
+ <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code></dd>
+ <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlvideoelement>HTMLVideoElement</dfn> : <a href=#htmlmediaelement>HTMLMediaElement</a> {
+ attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
+ attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
+ readonly attribute unsigned long <a href=#dom-video-videowidth title=dom-video-videoWidth>videoWidth</a>;
+ readonly attribute unsigned long <a href=#dom-video-videoheight title=dom-video-videoHeight>videoHeight</a>;
+ attribute DOMString <a href=#dom-video-poster title=dom-video-poster>poster</a>;
+};</pre>
+ </dd>
+ </dl><p>A <code><a href=#video>video</a></code> element is used for playing videos or
+ movies.</p>
+
+ <p>Content may be provided inside the <code><a href=#video>video</a></code>
+ element<span class=impl>. User agents should not show this content
+ to the user</span>; it is intended for older Web browsers which do
+ not support <code><a href=#video>video</a></code>, so that legacy video plugins can be
+ tried, or to show text to the users of these older browsers informing
+ them of how to access the video contents.</p>
+
+ <p class=note>In particular, this content is not intended to
+ address accessibility concerns. To make video content accessible to
+ the blind, deaf, and those with other physical or cognitive
+ disabilities, authors are expected to provide alternative media
+ streams and/or to embed accessibility aids (such as caption or
+ subtitle tracks, audio description tracks, or sign-language
+ overlays) into their media streams.</p>
+
+ <p>The <code><a href=#video>video</a></code> element is a <a href=#media-element>media element</a>
+ whose <a href=#media-data>media data</a> is ostensibly video data, possibly
+ with associated audio data.</p>
+
+ <p>The <code title=attr-media-src><a href=#attr-media-src>src</a></code>, <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>, <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>, <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>, and <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attributes are <a href=#media-element-attributes title="media element attributes">the attributes common to all media
+ elements</a>.</p>
+
+ <p>The <dfn id=attr-video-poster title=attr-video-poster><code>poster</code></dfn>
+ attribute gives the address of an image file that the user agent can
+ show while no video data is available. The attribute, if present,
+ must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</a>. <span class=impl>If the specified resource is to be
+ used, then, when the element is created or when the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> attribute is set, if its
+ value is not the empty string, its value must be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element, and
+ if that is successful, the resulting <a href=#absolute-url>absolute URL</a> must
+ be <a href=#fetch title=fetch>fetched</a>, from the element's
+ <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>; this must <a href=#delay-the-load-event>delay
+ the load event</a> of the element's document. The <dfn id=poster-frame>poster
+ frame</dfn> is then the image obtained from that resource, if
+ any.</span></p> <!-- thus it is unaffected by changes to the base
+ URL. -->
+
+ <p class=note>The image given by the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> attribute, the <i><a href=#poster-frame>poster
+ frame</a></i>, is intended to be a representative frame of the video
+ (typically one of the first non-blank frames) that gives the user an
+ idea of what the video is like.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-video-poster title=dom-video-poster><code>poster</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> content attribute.</p>
+
+ <hr><p>When no video data is available (the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either
+ <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, or <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> but no video
+ data has yet been obtained at all), the <code><a href=#video>video</a></code> element
+ <a href=#represents>represents</a> either the <a href=#poster-frame>poster frame</a>, or
+ nothing.</p>
+
+ <p>When a <code><a href=#video>video</a></code> element is <a href=#dom-media-paused title=dom-media-paused>paused</a> and the <a href=#current-playback-position title="current
+ playback position">current playback position</a> is the first
+ frame of video, the element <a href=#represents>represents</a> either the frame
+ of video corresponding to the <a href=#current-playback-position title="current playback
+ position">current playback position</a> or the <a href=#poster-frame>poster
+ frame</a>, at the discretion of the user agent.</p>
+
+ <p>Notwithstanding the above, the <a href=#poster-frame>poster frame</a> should
+ be preferred over nothing, but the <a href=#poster-frame>poster frame</a> should
+ not be shown again after a frame of video has been shown.</p>
+
+ <p>When a <code><a href=#video>video</a></code> element is <a href=#dom-media-paused title=dom-media-paused>paused</a> at any other position, the
+ element <a href=#represents>represents</a> the frame of video corresponding to
+ the <a href=#current-playback-position title="current playback position">current playback
+ position</a>, or, if that is not yet available (e.g. because the
+ video is seeking or buffering), the last frame of the video to have
+ been rendered.</p>
+
+ <p>When a <code><a href=#video>video</a></code> element is <a href=#potentially-playing>potentially
+ playing</a>, it <a href=#represents>represents</a> the frame of video at the
+ continuously increasing <a href=#current-playback-position title="current playback
+ position">"current" position</a>. When the <a href=#current-playback-position>current playback
+ position</a> changes such that the last frame rendered is no
+ longer the frame corresponding to the <a href=#current-playback-position>current playback
+ position</a> in the video, the new frame must be
+ rendered. Similarly, any audio associated with the video must, if
+ played, be played synchronized with the <a href=#current-playback-position>current playback
+ position</a>, at the specified <a href=#dom-media-volume title=dom-media-volume>volume</a> with the specified <a href=#dom-media-muted title=dom-media-muted>mute state</a>.</p>
+
+ <p>When a <code><a href=#video>video</a></code> element is neither <a href=#potentially-playing>potentially
+ playing</a> nor <a href=#dom-media-paused title=dom-media-paused>paused</a>
+ (e.g. when seeking or stalled), the element <a href=#represents>represents</a>
+ the last frame of the video to have been rendered.</p>
+
+ <p class=note>Which frame in a video stream corresponds to a
+ particular playback position is defined by the video stream's
+ format.</p>
+
+ <p>In addition to the above, the user agent may provide messages to
+ the user (such as "buffering", "no video loaded", "error", or more
+ detailed information) by overlaying text or icons on the video or
+ other areas of the element's playback area, or in another
+ appropriate manner.</p>
+
+ <p>User agents that cannot render the video may instead make the
+ element <a href=#represents title=represents>represent</a> a link to an
+ external video playback utility or to the video data itself.</p>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">video</var> . <code title=dom-video-videoWidth><a href=#dom-video-videowidth>videoWidth</a></code></dt>
+ <dt><var title="">video</var> . <code title=dom-video-videoHeight><a href=#dom-video-videoheight>videoHeight</a></code></dt>
+
+ <dd>
+
+ <p>These attributes return the intrinsic dimensions of the video,
+ or zero if the dimensions are not known.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic
+ width</dfn> and <dfn id=concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</dfn> of the
+ <a href=#media-resource>media resource</a> are the dimensions of the resource in
+ CSS pixels after taking into account the resource's dimensions,
+ aspect ratio, clean aperture, resolution, and so forth, as defined
+ for the format used by the resource. If an anamorphic format does
+ not define how to apply the aspect ratio to the video data's
+ dimensions to obtain the "correct" dimensions, then the user agent
+ must apply the ratio by increasing one dimension and leaving the
+ other unchanged.</p>
+
+ <p>The <dfn id=dom-video-videowidth title=dom-video-videoWidth><code>videoWidth</code></dfn> IDL
+ attribute must return the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> of the
+ video in CSS pixels. The <dfn id=dom-video-videoheight title=dom-video-videoHeight><code>videoHeight</code></dfn> IDL
+ attribute must return the <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a> of
+ the video in CSS pixels. If the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then the
+ attributes must return 0.</p>
+
+ </div>
+
+ <p>The <code><a href=#video>video</a></code> element supports <a href=#dimension-attributes>dimension
+ attributes</a>.</p>
+
+ <div class=impl>
+
+ <p>Video content should be rendered inside the element's playback
+ area such that the video content is shown centered in the playback
+ area at the largest possible size that fits completely within it,
+ with the video content's aspect ratio being preserved. Thus, if the
+ aspect ratio of the playback area does not match the aspect ratio of
+ the video, the video will be shown letterboxed or pillarboxed. Areas
+ of the element's playback area that do not contain the video
+ represent nothing.</p>
+
+ <p>The intrinsic width of a <code><a href=#video>video</a></code> element's playback
+ area is the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic
+ width</a> of the video resource, if that is available; otherwise
+ it is the intrinsic width of the <a href=#poster-frame>poster frame</a>, if that
+ is available; otherwise it is 300 CSS pixels.</p>
+
+ <p>The intrinsic height of a <code><a href=#video>video</a></code> element's playback
+ area is the <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic
+ height</a> of the video resource, if that is available; otherwise
+ it is the intrinsic height of the <a href=#poster-frame>poster frame</a>, if that
+ is available; otherwise it is 150 CSS pixels.</p>
+
+ <hr><p>User agents should provide controls to enable or disable the
+ display of closed captions, audio description tracks, and other
+ additional data associated with the video stream, though such
+ features should, again, not interfere with the page's normal
+ rendering.</p>
+
+ <p>User agents may allow users to view the video content in manners
+ more suitable to the user (e.g. full-screen or in an independent
+ resizable window). As for the other user interface features,
+ controls to enable this should not interfere with the page's normal
+ rendering unless the user agent is <a href=#expose-a-user-interface-to-the-user title="expose a user
+ interface to the user">exposing a user interface</a>. In such an
+ independent context, however, user agents may make full user
+ interfaces visible, with, e.g., play, pause, seeking, and volume
+ controls, even if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is absent.</p>
+
+ <p>User agents may allow video playback to affect system features
+ that could interfere with the user's experience; for example, user
+ agents could disable screensavers while video playback is in
+ progress.</p>
+
+ <p class=warning>User agents should not provide a public API to
+ cause videos to be shown full-screen. A script, combined with a
+ carefully crafted video file, could trick the user into thinking a
+ system-modal dialog had been shown, and prompt the user for a
+ password. There is also the danger of "mere" annoyance, with pages
+ launching full-screen videos when links are clicked or pages
+ navigated. Instead, user-agent-specific interface features may be
+ provided to easily allow the user to obtain a full-screen playback
+ mode.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This example shows how to detect when a video has failed to play
+ correctly:</p>
+
+ <pre>&lt;script&gt;
+ function failed(e) {
+ // video playback failed - show a message saying why
+ switch (e.target.error.code) {
+ case e.target.error.MEDIA_ERR_ABORTED:
+ alert('You aborted the video playback.');
+ break;
+ case e.target.error.MEDIA_ERR_NETWORK:
+ alert('A network error caused the video download to fail part-way.');
+ break;
+ case e.target.error.MEDIA_ERR_DECODE:
+ alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
+ break;
+ case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
+ alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
+ break;
+ default:
+ alert('An unknown error occurred.');
+ break;
+ }
+ }
+&lt;/script&gt;
+&lt;p&gt;&lt;video src="tgif.vid" autoplay controls onerror="failed(event)"&gt;&lt;/video&gt;&lt;/p&gt;
+&lt;p&gt;&lt;a href="tgif.vid"&gt;Download the video file&lt;/a&gt;.&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+
+ <!--CODECS
+
+ <div class="impl">
+
+ <h5>Video and audio codecs for <code>video</code> elements</h5>
+
+ <p>User agents may support any video and audio codecs and container
+ formats.</p>
+
+ <p class="note">Certain user agents might support no codecs at all,
+ e.g. text browsers running over SSH connections.</p>
+
+ <!- - similar note in audio codecs section - ->
+ <p class="note">Implementations are free to implement support for
+ video codecs either natively, or using platform-specific APIs, or
+ using plugins: this specification does not specify how codecs are to
+ be implemented.</p>
+
+ </div>
+
+ (when replacing this text, also fix "- -" nested comments)-->
+
+
+
+
+
+ <h4 id=audio><span class=secno>4.8.7 </span>The <dfn><code>audio</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#embedded-content>Embedded content</a>.</dd>
+ <dd>If the element has a <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>If the element has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute:
+<!--TT-->
+zero or more <code><a href=#the-track-element>track</a></code> elements, then
+<!--TT-->
+<a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
+ <dd>If the element does not have a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute: one or more <code><a href=#the-source-element>source</a></code> elements, then
+<!--TT-->
+ zero or more <code><a href=#the-track-element>track</a></code> elements, then
+<!--TT-->
+ <a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-media-src><a href=#attr-media-src>src</a></code></dd>
+ <dd><code title=attr-media-preload><a href=#attr-media-preload>preload</a></code></dd>
+ <dd><code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code></dd>
+ <dd><code title=attr-media-loop><a href=#attr-media-loop>loop</a></code></dd>
+ <dd><code title=attr-media-controls><a href=#attr-media-controls>controls</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>[NamedConstructor=<a href=#dom-audio title=dom-Audio>Audio</a>(),
+ NamedConstructor=<a href=#dom-audio-s title=dom-Audio-s>Audio</a>(in DOMString src)]
+interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediaelement>HTMLMediaElement</a> {};</pre>
+ </dd>
+ </dl><p>An <code><a href=#audio>audio</a></code> element <a href=#represents>represents</a> a sound or
+ audio stream.</p>
+
+ <!-- v2 (actually v3) suggestions:
+ * Audio syntesis. Use cases from Charles Pritchard:
+ > Use a sound of varying pitch to hint to a user the location of their
+ > mouse (is it hovering over a button, is it x/y pixels away from the edge
+ > of the screen, how close is it to the center).
+ >
+ > Alter the pitch of a sound to make a very cheap midi instrument.
+ >
+ > Pre-mix a few generated sounds, because the client processor is slow.
+ >
+ > Alter the pitch of an actual audio recording, and pre-mix it, to give
+ > different sounding voices to pre-recorded readings of a single text. As
+ > has been tried for "male" "female" sound fonts.
+ >
+ > Support very simple audio codecs, and programmable synthesizers.
+ -->
+
+ <p>Content may be provided inside the <code><a href=#audio>audio</a></code>
+ element<span class=impl>. User agents should not show this content
+ to the user</span>; it is intended for older Web browsers which do
+ not support <code><a href=#audio>audio</a></code>, so that legacy audio plugins can be
+ tried, or to show text to the users of these older browsers informing
+ them of how to access the audio contents.</p>
+
+ <p class=note>In particular, this content is not intended to
+ address accessibility concerns. To make audio content accessible to
+ the deaf or to those with other physical or cognitive disabilities,
+ authors are expected to provide alternative media streams and/or to
+ embed accessibility aids (such as transcriptions) into their media
+ streams.</p>
+
+ <p>The <code><a href=#audio>audio</a></code> element is a <a href=#media-element>media element</a>
+ whose <a href=#media-data>media data</a> is ostensibly audio data.</p>
+
+ <p>The <code title=attr-media-src><a href=#attr-media-src>src</a></code>, <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>, <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>, <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>, and <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attributes are <a href=#media-element-attributes title="media element attributes">the attributes common to all media
+ elements</a>.</p>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#audio>audio</a></code> element is <a href=#potentially-playing>potentially
+ playing</a>, it must have its audio data played synchronized with
+ the <a href=#current-playback-position>current playback position</a>, at the specified <a href=#dom-media-volume title=dom-media-volume>volume</a> with the specified <a href=#dom-media-muted title=dom-media-muted>mute state</a>.</p>
+
+ <p>When an <code><a href=#audio>audio</a></code> element is not <a href=#potentially-playing>potentially
+ playing</a>, audio must not play for the element.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">audio</var> = new <code title=dom-Audio><a href=#dom-audio>Audio</a></code>( [ <var title="">url</var> ] )</dt>
+
+ <dd>
+
+ <p>Returns a new <code><a href=#audio>audio</a></code> element, with the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute set to the value
+ passed in the argument, if applicable.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Two constructors are provided for creating
+ <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> objects (in addition to the factory
+ methods from DOM Core such as <code title="">createElement()</code>): <dfn id=dom-audio title=dom-Audio><code>Audio()</code></dfn> and <dfn id=dom-audio-s title=dom-Audio-s><code>Audio(<var title="">src</var>)</code></dfn>. When invoked as constructors,
+ these must return a new <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> object (a new
+ <code><a href=#audio>audio</a></code> element). The element must have its <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute set to the
+ literal value "<code title=attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>". If the <var title="">src</var> argument is present, the object created must have
+ its <code title=attr-media-src><a href=#attr-media-src>src</a></code> content attribute set to
+ the provided value, and the user agent must invoke the object's
+ <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> before returning. The element's document must be
+ the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
+ context</a> of the <code><a href=#window>Window</a></code> object on which the
+ interface object of the invoked constructor is found.</p>
+
+ </div>
+
+
+
+ <!--CODECS
+
+ <div class="impl">
+
+ <h5>Audio codecs for <code>audio</code> elements</h5>
+
+ <p>User agents may support any audio codecs and container
+ formats.</p>
+
+ <p>User agents must support the WAVE container format with audio
+ encoded using the 16 bit PCM (LE) codec, at sampling frequencies of
+ 11.025kHz, 22.050kHz, and 44.100kHz, and for both mono and
+ stereo. <a href="#- -refsWAVE">[WAVE]</a></p>
+
+ <!- -
+ <dt id="- -refsWAVE">WAVE</dt>
+ <dd>http://en.wikipedia.org/wiki/WAV? </dd>
+ - ->
+
+ <!- - similar note in video codecs section - ->
+ <p class="note">Implementations are free to implement support for
+ audio codecs either natively, or using platform-specific APIs, or
+ using plugins: this specification does not specify how codecs are to
+ be implemented.</p>
+
+ </div>
+
+ (when replacing this text, also fix "- -" nested comments)-->
+
+
+
+ <h4 id=the-source-element><span class=secno>4.8.8 </span>The <dfn><code>source</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <a href=#media-element>media element</a>, before any <a href=#flow-content>flow content</a>
+<!--TT-->
+ or <code><a href=#the-track-element>track</a></code> elements.</dd>
+<!--TT-->
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-source-src><a href=#attr-source-src>src</a></code></dd>
+ <dd><code title=attr-source-type><a href=#attr-source-type>type</a></code></dd>
+ <dd><code title=attr-source-media><a href=#attr-source-media>media</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlsourceelement>HTMLSourceElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-source-src title=dom-source-src>src</a>;
+ attribute DOMString <a href=#dom-source-type title=dom-source-type>type</a>;
+ attribute DOMString <a href=#dom-source-media title=dom-source-media>media</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-source-element>source</a></code> element allows authors to specify
+ multiple alternative <a href=#media-resource title="media resource">media
+ resources</a> for <a href=#media-element title="media element">media
+ elements</a>. It does not <a href=#represents title=represents>represent</a> anything on its own.</p>
+
+ <p>The <dfn id=attr-source-src title=attr-source-src><code>src</code></dfn> attribute
+ gives the address of the <a href=#media-resource>media resource</a>. The value must
+ be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</a>. This attribute must be present.</p>
+
+ <p>The <dfn id=attr-source-type title=attr-source-type><code>type</code></dfn>
+ attribute gives the type of the <a href=#media-resource>media resource</a>, to help
+ the user agent determine if it can play this <a href=#media-resource>media
+ resource</a> before fetching it. If specified, its value must be
+ a <a href=#valid-mime-type>valid MIME type</a>. The <code title="">codecs</code>
+ parameter may be specified and might be necessary to specify exactly
+ how the resource is encoded. <a href=#refsRFC4281>[RFC4281]</a></p>
+
+ <div class=example>
+
+ <p>The following list shows some examples of how to use the <code title="">codecs=</code> MIME parameter in the <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute.</p>
+
+ <dl><dt>H.264 Simple baseline profile video (main and extended video compatible) level 3 and Low-Complexity AAC audio in MP4 container</dt>
+ <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'&gt;</pre></dd>
+
+ <dt>H.264 Extended profile video (baseline-compatible) level 3 and Low-Complexity AAC audio in MP4 container</dt>
+ <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.58A01E, mp4a.40.2"'&gt;</pre></dd>
+
+ <dt>H.264 Main profile video level 3 and Low-Complexity AAC audio in MP4 container</dt>
+ <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'&gt;</pre></dd>
+
+ <dt>H.264 'High' profile video (incompatible with main, baseline, or extended profiles) level 3 and Low-Complexity AAC audio in MP4 container</dt>
+ <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.64001E, mp4a.40.2"'&gt;</pre></dd>
+
+
+ <dt>MPEG-4 Visual Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container</dt>
+ <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="mp4v.20.8, mp4a.40.2"'&gt;</pre></dd>
+
+ <dt>MPEG-4 Advanced Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container</dt>
+ <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="mp4v.20.240, mp4a.40.2"'&gt;</pre></dd>
+
+ <dt>MPEG-4 Visual Simple Profile Level 0 video and AMR audio in 3GPP container</dt>
+ <dd><pre>&lt;source src='video.3gp' type='video/3gpp; codecs="mp4v.20.8, samr"'&gt;</pre></dd>
+
+
+ <dt>Theora video and Vorbis audio in Ogg container</dt>
+ <dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'&gt;</pre></dd>
+
+ <dt>Theora video and Speex audio in Ogg container</dt>
+ <dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="theora, speex"'&gt;</pre></dd>
+
+ <dt>Vorbis audio alone in Ogg container</dt>
+ <dd><pre>&lt;source src='audio.ogg' type='audio/ogg; codecs=vorbis'&gt;</pre></dd>
+
+ <dt>Speex audio alone in Ogg container</dt>
+ <dd><pre>&lt;source src='audio.spx' type='audio/ogg; codecs=speex'&gt;</pre></dd>
+
+ <dt>FLAC audio alone in Ogg container</dt>
+ <dd><pre>&lt;source src='audio.oga' type='audio/ogg; codecs=flac'&gt;</pre></dd>
+
+ <dt>Dirac video and Vorbis audio in Ogg container</dt>
+ <dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="dirac, vorbis"'&gt;</pre></dd>
+
+ <dt>Theora video and Vorbis audio in Matroska container</dt>
+ <dd><pre>&lt;source src='video.mkv' type='video/x-matroska; codecs="theora, vorbis"'&gt;</pre></dd>
+
+<!-- awaiting definition by the Ogg or BBC guys:
+ <dt>Dirac video and Vorbis audio in Matroska container</dt>
+ <dd><pre>&lt;source src='video.mkv' type='video/x-matroska; codecs='></pre></dd>
+-->
+
+
+<!-- awaiting definition by the Microsoft guys:
+
+ <dt>WMV9 video and WMA 2 audio in ASF container</dt>
+ <dd><pre>&lt;source src='video.wmv' type='video/x-ms-wmv; codecs='></pre></dd>
+
+ <dt>WMV8 video and WMA 2 audio in ASF container</dt>
+ <dd><pre>&lt;source src='video.wmv' type='video/x-ms-wmv; codecs='></pre></dd>
+
+ <dt>VC-1 video and WMA 10 Pro audio in ASF container</dt>
+ <dd><pre>&lt;source src='video.wmv' type='video/x-ms-wmv; codecs='></pre></dd>
+
+ <dt>XviD video and MP3 audio in AVI container</dt>
+ <dd><pre>&lt;source src='video.avi' type='video/x-msvideo; codecs='></pre></dd>
+
+ <dt>Motion-JPEG video and uncompressed PCM audio in AVI container</dt>
+ <dd><pre>&lt;source src='video.avi' type='video/x-msvideo; codecs='></pre></dd>
+
+-->
+
+
+<!-- awaiting definition by Real:
+ <dt>Real Video 10 video and High-Efficiency AAC audio in Real Media container</dt>
+ <dd><pre>&lt;source src='video.rm' type='application/vnd.rn-realmedia; codecs='></pre></dd>
+-->
+
+
+<!-- undefined:
+ <dt>MPEG-1 video and MPEG-1 Audio Layer II audio in MPEG-1 program stream</dt>
+ <dd><pre>&lt;source src='video.mpg' type='video/mpeg; codecs='></pre></dd>
+-->
+
+ </dl></div>
+
+ <p>The <dfn id=attr-source-media title=attr-source-media><code>media</code></dfn>
+ attribute gives the intended media type of the <a href=#media-resource>media
+ resource</a>, to help the user agent determine if this
+ <a href=#media-resource>media resource</a> is useful to the user before fetching
+ it. Its value must be a <a href=#valid-media-query>valid media query</a>.</p>
+
+ <p id=source-default-media>The default, if the <code title=attr-srouce-media>media</code> attribute is omitted, is
+ "<code title="">all</code>", meaning that by default the <a href=#media-resource>media
+ resource</a> is suitable for all media.</p>
+
+ <div class=impl>
+
+ <p>If a <code><a href=#the-source-element>source</a></code> element is inserted as a child of a
+ <a href=#media-element>media element</a> that has no <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute and whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> has the value
+ <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, the user
+ agent must invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</p>
+
+ <p>The IDL attributes <dfn id=dom-source-src title=dom-source-src><code>src</code></dfn>, <dfn id=dom-source-type title=dom-source-type><code>type</code></dfn>, and <dfn id=dom-source-media title=dom-source-media><code>media</code></dfn> must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>If the author isn't sure if the user agents will all be able to
+ render the media resources provided, the author can listen to the
+ <code title=event-error>error</code> event on the last
+ <code><a href=#the-source-element>source</a></code> element and trigger fallback behavior:</p>
+
+ <pre>&lt;script&gt;
+ function fallback(video) {
+ // replace &lt;video&gt; with its contents
+ while (video.hasChildNodes()) {
+ if (video.firstChild instanceof HTMLSourceElement)
+ video.removeChild(video.firstChild);
+ else
+ video.parentNode.insertBefore(video.firstChild, video);
+ }
+ video.parentNode.removeChild(video);
+ }
+&lt;/script&gt;
+&lt;video controls autoplay&gt;
+ &lt;source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'&gt;
+ &lt;source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'
+ onerror="fallback(parentNode)"&gt;
+ ...
+&lt;/video&gt;</pre>
+
+ </div>
+
+
+
+<!--TT-->
+
+ <h4 id=the-track-element><span class=secno>4.8.9 </span>The <dfn><code>track</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <a href=#media-element>media element</a>, before any <a href=#flow-content>flow content</a>.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-track-kind><a href=#attr-track-kind>kind</a></code></dd>
+ <dd><code title=attr-track-label><a href=#attr-track-label>label</a></code></dd>
+ <dd><code title=attr-track-src><a href=#attr-track-src>src</a></code></dd>
+ <dd><code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmltrackelement>HTMLTrackElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-track-kind title=dom-track-kind>kind</a>;
+ attribute DOMString <a href=#dom-track-label title=dom-track-label>label</a>;
+ attribute DOMString <a href=#dom-track-src title=dom-track-src>src</a>;
+ attribute DOMString <a href=#dom-track-srclang title=dom-track-srclang>srclang</a>;
+
+ readonly attribute <a href=#timedtrack>TimedTrack</a> <a href=#dom-track-track title=dom-track-track>track</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-track-element>track</a></code> element allows authors to specify explicit
+ external <a href=#timed-track title="timed track">timed tracks</a> for <a href=#media-element title="media element">media elements</a>. It does not <a href=#represents title=represents>represent</a> anything on its own.</p>
+
+ <p>The <dfn id=attr-track-kind title=attr-track-kind><code>kind</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The following
+ table lists the keywords defined for this attribute. The keyword
+ given in the first cell of each row maps to the state given in the
+ second cell.</p>
+
+ <table><thead><tr><th>Keywords
+ <th>State
+ <th>Brief description
+ <tbody><tr><td><dfn id=attr-track-kind-keyword-subtitles title=attr-track-kind-keyword-subtitles><code>subtitles</code></dfn>
+ <td><dfn id=attr-track-kind-subtitles title=attr-track-kind-subtitles>Subtitles</dfn>
+ <td>Translation of the dialogue, suitable for when the sound is available but not understood (e.g. because the user does not understand the language of the <a href=#media-resource>media resource</a>'s soundtrack).
+ <tr><td><dfn id=attr-track-kind-keyword-captions title=attr-track-kind-keyword-captions><code>captions</code></dfn>
+ <td><dfn id=attr-track-kind-captions title=attr-track-kind-captions>Captions</dfn>
+ <td>Transcription of the dialogue, suitable for when the soundtrack is unavailable (e.g. because it is muted or because the user is deaf).
+ <tr><td><dfn id=attr-track-kind-keyword-descriptions title=attr-track-kind-keyword-descriptions><code>descriptions</code></dfn>
+ <td><dfn id=attr-track-kind-descriptions title=attr-track-kind-descriptions>Descriptions</dfn>
+ <td>Textual descriptions of the video component of the <a href=#media-resource>media resource</a>, intended for audio synthesis when the visual component is unavailable (e.g. because the user is interacting with the application without a screen while driving, or because the user is blind).
+ <tr><td><dfn id=attr-track-kind-keyword-chapters title=attr-track-kind-keyword-chapters><code>chapters</code></dfn>
+ <td><dfn id=attr-track-kind-chapters title=attr-track-kind-chapters>Chapters</dfn>
+ <td>Chapter titles, intended to be used for navigating the <a href=#media-resource>media resource</a>.
+ <tr><td><dfn id=attr-track-kind-keyword-metadata title=attr-track-kind-keyword-metadata><code>metadata</code></dfn>
+ <td><dfn id=attr-track-kind-metadata title=attr-track-kind-metadata>Metadata</dfn>
+ <td>Tracks intended for use from script.
+ </table><p>The attribute may be omitted. The <i>missing value default</i> is
+ the <a href=#attr-track-kind-captions title=attr-track-kind-captions>captions</a> state.</p>
+
+ <p>The <dfn id=attr-track-src title=attr-track-src><code>src</code></dfn> attribute
+ gives the address of the time track data. The value must be a
+ <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</a>. This attribute must be present.</p>
+
+ <div class=impl>
+
+ <p>If the element has a <code title=attr-track-src><a href=#attr-track-src>src</a></code>
+ attribute whose value is not the empty string and whose value, when
+ the attribute was set, could be successfully <a href=#resolve-a-url title="resolve a
+ url">resolved</a> relative to the element, then the element's
+ <dfn id=track-url>track URL</dfn> is the resulting <a href=#absolute-url>absolute
+ URL</a>. Otherwise, the element's <a href=#track-url>track URL</a> is the
+ empty string.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-track-srclang title=attr-track-srclang><code>srclang</code></dfn>
+ attribute gives the language of the time track data. The value must
+ be a valid BCP 47 language tag. This attribute must be present if
+ the element's <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is
+ in the <a href=#attr-track-kind-subtitles title=attr-track-kind-subtitles>subtitles</a>
+ state. <a href=#refsBCP47>[BCP47]</a></p>
+
+ <div class=impl>
+
+ <p>If the element has a <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> attribute whose value is
+ not the empty string, then the element's <dfn id=track-language>track language</dfn>
+ is the value of the attribute. Otherwise, the element has no
+ <a href=#track-language>track language</a>.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-track-label title=attr-track-label><code>label</code></dfn>
+ attribute gives a user-readable title for the track.</p>
+
+ <p>The value of the <code title=attr-track-label><a href=#attr-track-label>label</a></code>
+ attribute, if the attribute is present, must not be the empty
+ string. Furthermore, there must not be two <code><a href=#the-track-element>track</a></code>
+ element children of the same <a href=#media-element>media element</a> whose <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attributes are in the same
+ state, whose <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code>
+ attributes are both missing or have values that represent the same
+ language, and whose <code title=attr-track-label><a href=#attr-track-label>label</a></code>
+ attributes are again both missing or both have the same value.</p>
+
+ <div class=impl>
+
+ <p>If the element has a <code title=attr-track-label><a href=#attr-track-label>label</a></code>
+ attribute whose value is not the empty string, then the element's
+ <dfn id=track-label>track label</dfn> is the value of the attribute. Otherwise, the
+ element's <a href=#track-label>track label</a> is a user-agent defined string
+ (e.g. the string "untitled" in the user's locale, or a value
+ automatically generated from the other attributes).</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">track</var> . <code title=dom-track-track><a href=#dom-track-track>track</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#timedtrack>TimedTrack</a></code> object corresponding to the <a href=#timed-track>timed track</a> of the <code><a href=#the-track-element>track</a></code> element.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-track-track title=dom-track-track><code>track</code></dfn> IDL
+ attribute must, on getting, return the <code><a href=#the-track-element>track</a></code> element's
+ <a href=#timed-track>timed track</a>'s corresponding <code><a href=#timedtrack>TimedTrack</a></code>
+ object.</p>
+
+ <p>The IDL attributes <dfn id=dom-track-kind title=dom-track-kind><code>kind</code></dfn>, <dfn id=dom-track-label title=dom-track-label><code>label</code></dfn>, <dfn id=dom-track-src title=dom-track-src><code>src</code></dfn>, and <dfn id=dom-track-srclang title=dom-track-srclang><code>srclang</code></dfn> must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+<!--TT-->
+
+
+ <h4 id=media-elements><span class=secno>4.8.10 </span>Media elements</h4>
+
+ <p><dfn id=media-element title="media element">Media elements</dfn> implement the
+ following interface:</p>
+
+ <pre class=idl>interface <dfn id=htmlmediaelement>HTMLMediaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+
+ // error state
+ readonly attribute <a href=#mediaerror>MediaError</a> <a href=#dom-media-error title=dom-media-error>error</a>;
+
+ // network state
+ attribute DOMString <a href=#dom-media-src title=dom-media-src>src</a>;
+ readonly attribute DOMString <a href=#dom-media-currentsrc title=dom-media-currentSrc>currentSrc</a>;
+ const unsigned short <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a> = 0;
+ const unsigned short <a href=#dom-media-network_idle title=dom-media-NETWORK_IDLE>NETWORK_IDLE</a> = 1;
+ const unsigned short <a href=#dom-media-network_loading title=dom-media-NETWORK_LOADING>NETWORK_LOADING</a> = 2;
+ const unsigned short <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a> = 3;
+ readonly attribute unsigned short <a href=#dom-media-networkstate title=dom-media-networkState>networkState</a>;
+ attribute DOMString <a href=#dom-media-preload title=dom-media-preload>preload</a>;
+<!--v3BUF readonly attribute float <span title="dom-media-bufferingRate">bufferingRate</span>;
+ readonly attribute boolean <span title="dom-media-bufferingThrottled">bufferingThrottled</span>;
+--> readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-media-buffered title=dom-media-buffered>buffered</a>;
+ void <a href=#dom-media-load title=dom-media-load>load</a>();
+ DOMString <a href=#dom-navigator-canplaytype title=dom-navigator-canPlayType>canPlayType</a>(in DOMString type);
+
+ // ready state
+ const unsigned short <a href=#dom-media-have_nothing title=dom-media-HAVE_NOTHING>HAVE_NOTHING</a> = 0;
+ const unsigned short <a href=#dom-media-have_metadata title=dom-media-HAVE_METADATA>HAVE_METADATA</a> = 1;
+ const unsigned short <a href=#dom-media-have_current_data title=dom-media-HAVE_CURRENT_DATA>HAVE_CURRENT_DATA</a> = 2;
+ const unsigned short <a href=#dom-media-have_future_data title=dom-media-HAVE_FUTURE_DATA>HAVE_FUTURE_DATA</a> = 3;
+ const unsigned short <a href=#dom-media-have_enough_data title=dom-media-HAVE_ENOUGH_DATA>HAVE_ENOUGH_DATA</a> = 4;
+ readonly attribute unsigned short <a href=#dom-media-readystate title=dom-media-readyState>readyState</a>;
+ readonly attribute boolean <a href=#dom-media-seeking title=dom-media-seeking>seeking</a>;
+
+ // playback state
+ attribute float <a href=#dom-media-currenttime title=dom-media-currentTime>currentTime</a>;
+ readonly attribute float <a href=#dom-media-starttime title=dom-media-startTime>startTime</a>;
+ readonly attribute float <a href=#dom-media-duration title=dom-media-duration>duration</a>;
+ readonly attribute boolean <a href=#dom-media-paused title=dom-media-paused>paused</a>;
+ attribute float <a href=#dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate>defaultPlaybackRate</a>;
+ attribute float <a href=#dom-media-playbackrate title=dom-media-playbackRate>playbackRate</a>;
+ readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-media-played title=dom-media-played>played</a>;
+ readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-media-seekable title=dom-media-seekable>seekable</a>;
+ readonly attribute boolean <a href=#dom-media-ended title=dom-media-ended>ended</a>;
+ attribute boolean <a href=#dom-media-autoplay title=dom-media-autoplay>autoplay</a>;
+ attribute boolean <a href=#dom-media-loop title=dom-media-loop>loop</a>;
+ void <a href=#dom-media-play title=dom-media-play>play</a>();
+ void <a href=#dom-media-pause title=dom-media-pause>pause</a>();
+
+ // controls
+ attribute boolean <a href=#dom-media-controls title=dom-media-controls>controls</a>;
+ attribute float <a href=#dom-media-volume title=dom-media-volume>volume</a>;
+ attribute boolean <a href=#dom-media-muted title=dom-media-muted>muted</a>;
+<!--TT-->
+ // timed tracks
+ readonly attribute <a href=#timedtrack>TimedTrack</a>[] <span title=dom-media-tracks>tracks</span>;
+ <a href=#mutabletimedtrack>MutableTimedTrack</a> <span title=dom-media-addTrack>addTrack</span>(in DOMString label, in DOMString kind, in DOMString language);
+<!--TT-->
+};</pre>
+
+ <p>The <dfn id=media-element-attributes>media element attributes</dfn>, <code title=attr-media-src><a href=#attr-media-src>src</a></code>, <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>, <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>, <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>, and <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code>, apply to all <a href=#media-element title="media element">media elements</a>. They are defined in
+ this section.</p>
+
+ <!-- proposed v2 (actually v3!) features:
+ * frame forward / backwards / step(n) while paused
+ * hasAudio, hasVideo, hasCaptions, etc
+ * per-frame control: get current frame; set current frame
+ * queue of content
+ - pause current stream and insert content at front of queue to play immediately
+ - pre-download another stream
+ - add stream(s) to play at end of current stream
+ - pause playback upon reaching a certain time
+ - playlists, with the ability to get metadata out of them (e.g. xspf)
+ * general meta data, implemented as getters (don't expose the whole thing)
+ - getMetadata(key: string, language: string) => HTMLImageElement or string
+ - onmetadatachanged (no context info)
+ - general custom metadata store (ratings, etc.)
+ * video: applying CSS filters
+ * an event to notify people of when the video size changes
+ (e.g. for chained Ogg streams of multiple independent videos)
+ * balance and 3D position audio
+ * audio filters
+ * audio synthesis (see <audio> section for use cases)
+ * feedback to the script on how well the video is playing
+ - frames per second?
+ - skipped frames per second?
+ - an event that reports playback difficulties?
+ - an arbitrary quality metric?
+ * bufferingRate/bufferingThrottled (see v3BUF)
+ * events for when the user agent's controls get shown or hidden
+ so that the author's controls can get away of the UA's
+ -->
+
+ <!-- v2 features that already have experimental implementations:
+ * webkitPreservesPitch (for when playbackRate != 1.0)
+ -->
+
+ <p><a href=#media-element title="media element">Media elements</a> are used to
+ present audio data, or video and audio data, to the user. This is
+ referred to as <dfn id=media-data>media data</dfn> in this section, since this
+ section applies equally to <a href=#media-element title="media element">media
+ elements</a> for audio or for video. The term <dfn id=media-resource>media
+ resource</dfn> is used to refer to the complete set of media data,
+ e.g. the complete video file, or complete audio file.</p>
+
+ <div class=impl>
+
+ <p>Except where otherwise specified, the <a href=#task-source>task source</a>
+ for all the tasks <a href=#queue-a-task title="queue a task">queued</a> in this
+ section and its subsections is the <dfn id=media-element-event-task-source>media element event task
+ source</dfn>.</p>
+
+ </div>
+
+
+
+ <h5 id=error-codes><span class=secno>4.8.10.1 </span>Error codes</h5>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-error><a href=#dom-media-error>error</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#mediaerror>MediaError</a></code> object representing the
+ current error state of the element.</p>
+
+ <p>Returns null if there is no error.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>All <a href=#media-element title="media element">media elements</a> have an
+ associated error status, which records the last error the element
+ encountered since its <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> was last invoked. The <dfn id=dom-media-error title=dom-media-error><code>error</code></dfn> attribute, on
+ getting, must return the <code><a href=#mediaerror>MediaError</a></code> object created for
+ this last error, or null if there has not been an error.</p>
+
+ </div>
+
+ <pre class=idl>interface <dfn id=mediaerror>MediaError</dfn> {
+ const unsigned short <a href=#dom-mediaerror-media_err_aborted title=dom-MediaError-MEDIA_ERR_ABORTED>MEDIA_ERR_ABORTED</a> = 1;
+ const unsigned short <a href=#dom-mediaerror-media_err_network title=dom-MediaError-MEDIA_ERR_NETWORK>MEDIA_ERR_NETWORK</a> = 2;
+ const unsigned short <a href=#dom-mediaerror-media_err_decode title=dom-MediaError-MEDIA_ERR_DECODE>MEDIA_ERR_DECODE</a> = 3;
+ const unsigned short <a href=#dom-mediaerror-media_err_src_not_supported title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED>MEDIA_ERR_SRC_NOT_SUPPORTED</a> = 4;
+ readonly attribute unsigned short <a href=#dom-mediaerror-code title=dom-MediaError-code>code</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-error><a href=#dom-media-error>error</a></code> . <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code></dt>
+
+ <dd>
+
+ <p>Returns the current error's error code, from the list below.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-mediaerror-code title=dom-MediaError-code><code>code</code></dfn>
+ attribute of a <code><a href=#mediaerror>MediaError</a></code> object must return the code
+ for the error, which must be one of the following:</p>
+
+ </div>
+
+ <dl><dt><dfn id=dom-mediaerror-media_err_aborted title=dom-MediaError-MEDIA_ERR_ABORTED><code>MEDIA_ERR_ABORTED</code></dfn> (numeric value 1)</dt>
+
+ <dd>The fetching process for the <a href=#media-resource>media resource</a> was
+ aborted by the user agent at the user's request.</dd>
+
+ <dt><dfn id=dom-mediaerror-media_err_network title=dom-MediaError-MEDIA_ERR_NETWORK><code>MEDIA_ERR_NETWORK</code></dfn> (numeric value 2)</dt>
+
+ <dd>A network error of some description caused the user agent to
+ stop fetching the <a href=#media-resource>media resource</a>, after the resource
+ was established to be usable.</dd>
+
+ <dt><dfn id=dom-mediaerror-media_err_decode title=dom-MediaError-MEDIA_ERR_DECODE><code>MEDIA_ERR_DECODE</code></dfn> (numeric value 3)</dt>
+
+ <dd>An error of some description occurred while decoding the
+ <a href=#media-resource>media resource</a>, after the resource was established to
+ be usable.</dd>
+
+ <dt><dfn id=dom-mediaerror-media_err_src_not_supported title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED><code>MEDIA_ERR_SRC_NOT_SUPPORTED</code></dfn> (numeric value 4)</dt>
+
+ <dd>The <a href=#media-resource>media resource</a> indicated by the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was not suitable.</dd>
+
+ </dl><h5 id=location-of-the-media-resource><span class=secno>4.8.10.2 </span>Location of the media resource</h5>
+
+ <p>The <dfn id=attr-media-src title=attr-media-src><code>src</code></dfn> content
+ attribute on <a href=#media-element title="media element">media elements</a> gives
+ the address of the media resource (video, audio) to show. The
+ attribute, if present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty
+ URL potentially surrounded by spaces</a>.</p>
+
+ <div class=impl>
+
+ <p>If a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute of a
+ <a href=#media-element>media element</a> is set or changed, the user agent must
+ invoke the <a href=#media-element>media element</a>'s <a href=#media-element-load-algorithm>media element load
+ algorithm</a>. (<em>Removing</em> the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute does not do this, even
+ if there are <code><a href=#the-source-element>source</a></code> elements present.)</p>
+
+ <p>The <dfn id=dom-media-src title=dom-media-src><code>src</code></dfn> IDL
+ attribute on <a href=#media-element title="media element">media elements</a> must
+ <a href=#reflect>reflect</a> the content attribute of the same name.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code></dt>
+
+ <dd>
+
+ <p>Returns the address of the current <a href=#media-resource>media resource</a>.</p>
+
+ <p>Returns the empty string when there is no <a href=#media-resource>media resource</a>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-media-currentsrc title=dom-media-currentSrc><code>currentSrc</code></dfn> IDL
+ attribute is initially the empty string. Its value is changed by the
+ <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> defined below.</p>
+
+ </div>
+
+ <p class=note>There are two ways to specify a <a href=#media-resource>media
+ resource</a>, the <code title=attr-media-src><a href=#attr-media-src>src</a></code>
+ attribute, or <code><a href=#the-source-element>source</a></code> elements. The attribute overrides
+ the elements.</p>
+
+
+
+ <h5 id=mime-types><span class=secno>4.8.10.3 </span>MIME types</h5>
+
+ <p>A <a href=#media-resource>media resource</a> can be described in terms of its
+ <em>type</em>, specifically a <a href=#mime-type>MIME type</a>, optionally
+ with a <code title="">codecs</code> parameter. <a href=#refsRFC4281>[RFC4281]</a></p>
+
+ <p>Types are usually somewhat incomplete descriptions; for example
+ "<code title="">video/mpeg</code>" doesn't say anything except what
+ the container type is, and even a type like "<code title="">video/mp4; codecs="avc1.42E01E,
+ mp4a.40.2"</code>" doesn't include information like the actual
+ bitrate (only the maximum bitrate). Thus, given a type, a user agent
+ can often only know whether it <em>might</em> be able to play
+ media of that type (with varying levels of confidence), or whether
+ it definitely <em>cannot</em> play media of that type.</p>
+
+ <p><dfn id=a-type-that-the-user-agent-knows-it-cannot-render>A type that the user agent knows it cannot render</dfn> is
+ one that describes a resource that the user agent definitely does
+ not support, for example because it doesn't recognize the container
+ type, or it doesn't support the listed codecs.</p>
+
+ <p>The <a href=#mime-type>MIME type</a> "<code title="">application/octet-stream</code>" with no parameters is
+ never <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot
+ render</a>. User agents must treat that type as equivalent to the
+ lack of any explicit <a href=#content-type title=Content-Type>Content-Type
+ metadata</a> when it is used to label a potential <a href=#media-resource>media
+ resource</a>.</p>
+
+ <p class=note>In the absence of a <!-- pretty crazy -->
+ specification to the contrary, the <a href=#mime-type>MIME type</a> "<code title="">application/octet-stream</code>" when used <em>with</em>
+ parameters, e.g. "<code title="">application/octet-stream;codecs=theora</code>", <em>is</em>
+ <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot render</a>.</p>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-navigator-canPlayType><a href=#dom-navigator-canplaytype>canPlayType</a></code>(<var title="">type</var>)</dt>
+
+ <dd>
+
+ <p>Returns the empty string (a negative response), "maybe", or
+ "probably" based on how confident the user agent is that it can
+ play media resources of the given type.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-navigator-canplaytype title=dom-navigator-canPlayType><code>canPlayType(<var title="">type</var>)</code></dfn> method must return the empty
+ string if <var title="">type</var> is <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type that the user
+ agent knows it cannot render</a>; it must return "<code title="">probably</code>" if the user agent is confident that the
+ type represents a <a href=#media-resource>media resource</a> that it can render if
+ used in with this <code><a href=#audio>audio</a></code> or <code><a href=#video>video</a></code> element;
+ and it must return "<code title="">maybe</code>"
+ otherwise. Implementors are encouraged to return "<code title="">maybe</code>" unless the type can be confidently
+ established as being supported or not. Generally, a user agent
+ should never return "<code title="">probably</code>" if the type
+ doesn't have a <code title="">codecs</code> parameter.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This script tests to see if the user agent supports a
+ (fictional) new format to dynamically decide whether to use a
+ <code><a href=#video>video</a></code> element or a plugin:</p>
+
+ <pre>&lt;section id="video"&gt;
+ &lt;p&gt;&lt;a href="playing-cats.nfv"&gt;Download video&lt;/a&gt;&lt;/p&gt;
+&lt;/section&gt;
+&lt;script&gt;
+ var videoSection = document.getElementById('video');
+ var videoElement = document.createElement('video');
+ var support = videoElement.canPlayType('video/x-new-fictional-format;codecs="kittens,bunnies"');
+ if (support != "probably" &amp;&amp; "New Fictional Video Plug-in" in navigator.plugins) {
+ // not confident of browser support
+ // but we have a plugin
+ // so use plugin instead
+ videoElement = document.createElement("embed");
+ } else if (support == "") {
+ // no support from browser and no plugin
+ // do nothing
+ videoElement = null;
+ }
+ if (videoElement) {
+ while (videoSection.hasChildNodes())
+ videoSection.removeChild(videoSection.firstChild);
+ videoElement.setAttribute("src", "playing-cats.nfv");
+ videoSection.appendChild(videoElement);
+ }
+&lt;/script&gt;</pre>
+
+ </div>
+
+ <p class=note>The <code title=attr-source-type><a href=#attr-source-type>type</a></code>
+ attribute of the <code><a href=#the-source-element>source</a></code> element allows the user agent
+ to avoid downloading resources that use formats it cannot
+ render.</p>
+
+
+ <h5 id=network-states><span class=secno>4.8.10.4 </span>Network states</h5>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code></dt>
+
+ <dd>
+
+ <p>Returns the current state of network activity for the element,
+ from the codes in the list below.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>As <a href=#media-element title="media element">media elements</a> interact
+ with the network, their current network activity is represented by
+ the <dfn id=dom-media-networkstate title=dom-media-networkState><code>networkState</code></dfn>
+ attribute. On getting, it must return the current network state of
+ the element, which must be one of the following values:</p>
+
+ </div>
+
+ <dl><dt><dfn id=dom-media-network_empty title=dom-media-NETWORK_EMPTY><code>NETWORK_EMPTY</code></dfn> (numeric value 0)</dt>
+
+ <dd>The element has not yet been initialized. All attributes are in
+ their initial states.</dd>
+
+ <dt><dfn id=dom-media-network_idle title=dom-media-NETWORK_IDLE><code>NETWORK_IDLE</code></dfn> (numeric value 1)</dt>
+
+ <dd>The element<span class=impl>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> is active and</span> has selected a <a href=#media-resource title="media resource">resource</a>, but it is not actually
+ using the network at this time.</dd>
+
+ <dt><dfn id=dom-media-network_loading title=dom-media-NETWORK_LOADING><code>NETWORK_LOADING</code></dfn> (numeric value 2)</dt>
+
+ <dd>The user agent is actively trying to download data.</dd>
+
+ <dt><dfn id=dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE><code>NETWORK_NO_SOURCE</code></dfn> (numeric value 3)</dt>
+
+ <dd>The element<span class=impl>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> is active, but it</span> has failed to find a
+ <a href=#media-resource title="media resource">resource</a> to use.</dd>
+
+ </dl><div class=impl>
+
+ <p>The <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> defined below describes exactly when the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute changes
+ value and what events fire to indicate changes in this state.</p>
+
+ </div>
+
+
+
+
+ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the media resource</h5>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-load><a href=#dom-media-load>load</a></code>()</dt>
+
+ <dd>
+
+ <p>Causes the element to reset and start selecting and loading a
+ new <a href=#media-resource>media resource</a> from scratch.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>All <a href=#media-element title="media element">media elements</a> have an
+ <dfn id=autoplaying-flag>autoplaying flag</dfn>, which must begin in the true state, and
+ a <dfn id=delaying-the-load-event-flag>delaying-the-load-event flag</dfn>, which must begin in the
+ false state. While the <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> is
+ true, the element must <a href=#delay-the-load-event>delay the load event</a> of its
+ document.</p>
+
+ <p>When the <dfn id=dom-media-load title=dom-media-load><code>load()</code></dfn>
+ method on a <a href=#media-element>media element</a> is invoked, the user agent
+ must run the <a href=#media-element-load-algorithm>media element load algorithm</a>.</p>
+
+ <p>The <dfn id=media-element-load-algorithm>media element load algorithm</dfn> consists of the
+ following steps.</p>
+
+ <ol><li><p>Abort any already-running instance of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> for this element.</li>
+
+ <li>
+
+ <p>If there are any <a href=#concept-task title=concept-task>tasks</a> from
+ the <a href=#media-element>media element</a>'s <a href=#media-element-event-task-source>media element event task
+ source</a> in one of the <a href=#task-queue title="task queue">task
+ queues</a>, then remove those tasks.</p>
+
+ <p class=note>Basically, pending events and callbacks for the
+ media element are discarded when the media element starts loading
+ a new resource.</p>
+
+ </li>
+
+ <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is set to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code> or <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-abort><a href=#event-media-abort>abort</a></code> at the <a href=#media-element>media
+ element</a>.</li>
+
+ <li>
+
+ <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is not set to
+ <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then
+ run these substeps:</p>
+
+ <ol><li><p>If a fetching process is in progress for the <a href=#media-element>media
+ element</a>, the user agent should stop it.</li>
+
+ <li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>.</li>
+
+<!--TT-->
+ <li><p><a href="#forget-the-media-element's-media-resource-specific-timed-tracks">Forget the media element's media-resource-specific
+ timed tracks</a>.</li>
+<!--TT-->
+
+ <li><p>If <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is
+ not set to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then set it
+ to that state.</li>
+
+ <li><p>If the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code>
+ attribute is false, then set to true.</li>
+
+ <li><p>If <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is true,
+ set it to false.</li>
+
+ <li><p>Set the <a href=#current-playback-position>current playback position</a> to
+ 0.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> at the <a href=#media-element>media
+ element</a>.</li>
+
+ </ol></li>
+
+ <li><p>Set the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute to the
+ value of the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
+ attribute.</li>
+
+ <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute
+ to null and the <a href=#autoplaying-flag>autoplaying flag</a> to true.</li>
+
+ <li><p>Invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</li>
+
+ <li>
+
+ <p class=note>Playback of any previously playing <a href=#media-resource>media
+ resource</a> for this element stops.</p>
+
+ </li>
+
+ </ol><p>The <dfn id=concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</dfn> for a <a href=#media-element>media element</a> is as follows. This
+ algorithm is always invoked synchronously, but one of the first
+ steps in the algorithm is to return and continue running the
+ remaining steps asynchronously, meaning that it runs in the
+ background with scripts and other <a href=#concept-task title=concept-task>tasks</a> running in parallel. In addition,
+ this algorithm interacts closely with the <a href=#event-loop>event loop</a>
+ mechanism; in particular, it has <a href=#synchronous-section title="synchronous
+ section">synchronous sections</a> (which are triggered as part of
+ the <a href=#event-loop>event loop</a> algorithm). Steps in such sections are
+ marked with &#8987;.</p>
+
+ <ol><!-- precondition: networkState == NETWORK_EMPTY at this point --><li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code>.</li>
+
+ <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>, allowing
+ the <a href=#concept-task title=concept-task>task</a> that invoked this
+ algorithm to continue. The <a href=#synchronous-section>synchronous section</a>
+ consists of all the remaining steps of this algorithm until the
+ algorithm says the <a href=#synchronous-section>synchronous section</a> has
+ ended. (Steps in <a href=#synchronous-section title="synchronous section">synchronous
+ sections</a> are marked with &#8987;.)</li>
+
+ <li>
+
+ <p>&#8987; If the <a href=#media-element>media element</a> has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute, then let <var title="">mode</var> be <i title="">attribute</i>.</p>
+
+ <p>&#8987; Otherwise, if the <a href=#media-element>media element</a> does not
+ have a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute but has a
+ <code><a href=#the-source-element>source</a></code> element child, then let <var title="">mode</var> be <i title="">children</i> and let <var title="">candidate</var> be the first such <code><a href=#the-source-element>source</a></code>
+ element child in <a href=#tree-order>tree order</a>.</p>
+
+ <p>&#8987; Otherwise the <a href=#media-element>media element</a> has neither a
+ <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute nor a
+ <code><a href=#the-source-element>source</a></code> element child: set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, and abort
+ these steps; the <a href=#synchronous-section>synchronous section</a> ends.</p>
+
+ </li>
+
+ <li><p>&#8987; Set the <a href=#media-element>media element</a>'s
+ <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to true (this <a href=#delay-the-load-event title="delay the load event">delays the load event</a>), and set
+ its <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to
+ <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
+
+ <li><p>&#8987; <a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code> at the <a href=#media-element>media
+ element</a>.</li>
+
+ <li>
+
+ <p>If <var title="">mode</var> is <i title="">attribute</i>, then
+ run these substeps:</p>
+
+ <ol><li><p>&#8987; <i>Process candidate</i>: If the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute's value is the empty
+ string, then end the <a href=#synchronous-section>synchronous section</a>, and jump
+ down to the <i title="">failed</i> step below.</li>
+
+ <li><p>&#8987; Let <var title="">absolute URL</var> be the
+ <a href=#absolute-url>absolute URL</a> that would have resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
+ specified by the <code title=attr-media-src><a href=#attr-media-src>src</a></code>
+ attribute's value relative to the <a href=#media-element>media element</a> when
+ the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was last
+ changed.</p> <!-- i.e. changing xml:base or <base> after src=""
+ has no effect -->
+
+ <li><p>&#8987; If <var title="">absolute URL</var> was obtained
+ successfully, set the <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to <var title="">absolute URL</var>.</li>
+
+ <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
+ remaining steps asynchronously.</li>
+
+ <li><p>If <var title="">absolute URL</var> was obtained
+ successfully, run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
+ algorithm</a> with <var title="">absolute URL</var>. If that
+ algorithm returns without aborting <em>this</em> one, then the
+ load failed.</li>
+
+ <li>
+
+ <p><i>Failed</i>: Reaching this step indicates that the media
+ resource failed to load or that the given <a href=#url>URL</a> could
+ not be <a href=#resolve-a-url title="resolve a url">resolved</a>. In one
+ atomic operation, run the following steps:</p>
+
+ <ol><li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
+ attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
+ <code title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED><a href=#dom-mediaerror-media_err_src_not_supported>MEDIA_ERR_SRC_NOT_SUPPORTED</a></code>.</li>
+
+<!--TT-->
+ <li><p><a href="#forget-the-media-element's-media-resource-specific-timed-tracks">Forget the media element's media-resource-specific
+ timed tracks</a>.</li>
+<!--TT-->
+
+ <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a>
+ value.</li>
+
+ </ol></li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-error><a href=#event-media-error>error</a></code>
+ at the <a href=#media-element>media element</a>.</li>
+
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a>
+ to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying
+ the load event</a>.</li>
+
+ <li><p>Abort these steps. Until the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method is invoked or the
+ <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute is changed, the
+ element won't attempt to load another resource.</li>
+ <!-- it took its ball and went home, sulking. -->
+
+ </ol><p>Otherwise, the <code><a href=#the-source-element>source</a></code> elements will be used; run
+ these substeps:</p>
+
+ <ol><li>
+
+ <p>&#8987; Let <var title="">pointer</var> be a position
+ defined by two adjacent nodes in the <a href=#media-element>media
+ element</a>'s child list, treating the start of the list
+ (before the first child in the list, if any) and end of the list
+ (after the last child in the list, if any) as nodes in their own
+ right. One node is the node before <var title="">pointer</var>,
+ and the other node is the node after <var title="">pointer</var>. Initially, let <var title="">pointer</var> be the position between the <var title="">candidate</var> node and the next node, if there are
+ any, or the end of the list, if it is the last node.</p>
+
+ <p>As nodes are inserted and removed into the <a href=#media-element>media
+ element</a>, <var title="">pointer</var> must be updated as
+ follows:</p>
+
+ <dl><dt>If a new node is inserted between the two nodes that
+ define <var title="">pointer</var></dt>
+
+ <dd>Let <var title="">pointer</var> be the point between the
+ node before <var title="">pointer</var> and the new node. In
+ other words, insertions at <var title="">pointer</var> go after
+ <var title="">pointer</var>.</dd>
+
+ <dt>If the node before <var title="">pointer</var> is removed</dt>
+
+ <dd>Let <var title="">pointer</var> be the point between the
+ node after <var title="">pointer</var> and the node before the
+ node after <var title="">pointer</var>. In other words, <var title="">pointer</var> doesn't move relative to the remaining
+ nodes.</dd>
+
+ <dt>If the node after <var title="">pointer</var> is removed</dt>
+
+ <dd>Let <var title="">pointer</var> be the point between the
+ node before <var title="">pointer</var> and the node after the
+ node before <var title="">pointer</var>. Just as with the
+ previous case, <var title="">pointer</var> doesn't move
+ relative to the remaining nodes.</dd>
+
+ </dl><p>Other changes don't affect <var title="">pointer</var>.</p>
+
+ </li>
+
+ <li><p>&#8987; <i>Process candidate</i>: If <var title="">candidate</var> does not have a <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute, or if its <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute's value is the empty
+ string, then end the <a href=#synchronous-section>synchronous section</a>, and jump
+ down to the <i title="">failed</i> step below.</li>
+
+ <li><p>&#8987; Let <var title="">absolute URL</var> be the
+ <a href=#absolute-url>absolute URL</a> that would have resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
+ specified by <var title="">candidate</var>'s <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute's value relative to
+ the <var title="">candidate</var> when the <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute was last
+ changed.</p> <!-- i.e. changing xml:base or <base> after src=""
+ has no effect -->
+
+ <li><p>&#8987; If <var title="">absolute URL</var> was not
+ obtained successfully, then end the <a href=#synchronous-section>synchronous
+ section</a>, and jump down to the <i title="">failed</i> step
+ below.</li>
+
+ <li><p>&#8987; If <var title="">candidate</var> has a <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute whose value, when
+ parsed as a <a href=#mime-type>MIME type</a> (including any codecs
+ described by the <code title="">codecs</code> parameter),
+ represents <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot
+ render</a>, then end the <a href=#synchronous-section>synchronous section</a>, and
+ jump down to the <i title="">failed</i> step below.</li>
+
+ <li><p>&#8987; If <var title="">candidate</var> has a <code title=attr-source-media><a href=#attr-source-media>media</a></code> attribute whose value does
+ not <a href=#matches-the-environment title="matches the environment">match the
+ environment</a>, then end the <a href=#synchronous-section>synchronous
+ section</a>, and jump down to the <i title="">failed</i> step
+ below.</li>
+
+ <li><p>&#8987; Set the <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to <var title="">absolute URL</var>.</li>
+
+ <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
+ remaining steps asynchronously.</li>
+
+ <li><p>Run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource
+ fetch algorithm</a> with <var title="">absolute URL</var>. If
+ that algorithm returns without aborting <em>this</em> one, then
+ the load failed.</li>
+
+ <li><p><i title="">Failed</i>: <a href=#queue-a-task>Queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <var title="">candidate</var> element, in the context of the <a href=#fetch title=fetch>fetching process</a> that was used to try to
+ obtain <var title="">candidate</var>'s corresponding <a href=#media-resource>media
+ resource</a> in the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
+ algorithm</a>.</li>
+
+ <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>. The
+ <a href=#synchronous-section>synchronous section</a> consists of all the remaining
+ steps of this algorithm until the algorithm says the
+ <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are
+ marked with &#8987;.)</li>
+
+<!--TT-->
+ <li><p>&#8987; <a href="#forget-the-media-element's-media-resource-specific-timed-tracks">Forget the media element's
+ media-resource-specific timed tracks</a>.</li>
+<!--TT-->
+
+ <li><p>&#8987; <i title="">Find next candidate</i>: Let <var title="">candidate</var> be null.</li>
+
+ <li><p>&#8987; <i title="">Search loop</i>: If the node after
+ <var title="">pointer</var> is the end of the list, then jump to
+ the <i title="">waiting</i> step below.</li>
+
+ <li><p>&#8987; If the node after <var title="">pointer</var> is
+ a <code><a href=#the-source-element>source</a></code> element, let <var title="">candidate</var>
+ be that element.</li>
+
+ <li><p>&#8987; Advance <var title="">pointer</var> so that the
+ node before <var title="">pointer</var> is now the node that was
+ after <var title="">pointer</var>, and the node after <var title="">pointer</var> is the node after the node that used to be
+ after <var title="">pointer</var>, if any.</li>
+
+ <li><p>&#8987; If <var title="">candidate</var> is null, jump
+ back to the <i title="">search loop</i> step. Otherwise, jump
+ back to the <i title="">process candidate</i> step.</li>
+
+ <li><p>&#8987; <i title="">Waiting</i>: Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a>
+ value.</li>
+
+ <li><p>&#8987; Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
+
+ <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
+ remaining steps asynchronously.</li>
+
+ <li><p>Wait until the node after <var title="">pointer</var> is a
+ node other than the end of the list. (This step might wait
+ forever.)</li>
+
+ <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>. The
+ <a href=#synchronous-section>synchronous section</a> consists of all the remaining
+ steps of this algorithm until the algorithm says the
+ <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are
+ marked with &#8987;.)</li>
+
+ <li><p>&#8987; Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> back to true (this <a href=#delay-the-load-event title="delay the load
+ event">delays the load event</a> again, in case it hasn't been
+ fired yet).</p>
+
+ <li><p>&#8987; Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> back to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
+
+ <li><p>&#8987; Jump back to the <i title="">find next
+ candidate</i> step above.</li>
+
+ </ol></li>
+
+ </ol><p>The <dfn id=concept-media-load-resource title=concept-media-load-resource>resource fetch
+ algorithm</dfn> for a <a href=#media-element>media element</a> and a given
+ <a href=#absolute-url>absolute URL</a> is as follows:</p>
+
+ <ol><li><p>Let the <var title="">current media resource</var> be the
+ resource given by the <a href=#absolute-url>absolute URL</a> passed to this
+ algorithm. This is now the element's <a href=#media-resource>media
+ resource</a>.</li>
+
+ <li>
+
+ <p>Begin to <a href=#fetch>fetch</a> the <var title="">current media
+ resource</var>, from the <a href=#media-element>media element</a>'s
+ <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>.</p> <!-- not
+ http-origin privacy sensitive (looking forward to CORS here) -->
+
+ <p>Every 350ms (&plusmn;200ms) or for every byte received, whichever
+ is <em>least</em> frequent, <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-progress><a href=#event-media-progress>progress</a></code> at the element.</p>
+
+ <p>If at any point the user agent has received no data for more
+ than about three seconds, then <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-stalled><a href=#event-media-stalled>stalled</a></code> at the element.</p>
+
+ <p>User agents may allow users to selectively block or slow
+ <a href=#media-data>media data</a> downloads. When a <a href=#media-element>media
+ element</a>'s download has been blocked altogether, the user
+ agent must act as if it was stalled (as opposed to acting as if
+ the connection was closed). The rate of the download may also be
+ throttled automatically by the user agent, e.g. to balance the
+ download with other connections sharing the same bandwidth.</p>
+
+ <p>User agents may decide to not download more content at any
+ time, e.g. after buffering five minutes of a one hour media
+ resource, while waiting for the user to decide whether to play the
+ resource or not, or while waiting for user input in an interactive
+ resource. When a <a href=#media-element>media element</a>'s download has been
+ suspended, the user agent must set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> and <a href=#queue-a-task>queue
+ a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code> at the element. If and
+ when downloading of the resource resumes, the user agent must set
+ the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to
+ <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</p>
+
+ <p class=note>The <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute provides a
+ hint regarding how much buffering the author thinks is advisable,
+ even in the absence of the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute.</p>
+
+ <p>When a user agent decides to completely stall a download,
+ e.g. if it is waiting until the user starts playback before
+ downloading any further content, the element's
+ <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> must be set to
+ false. This stops <a href=#delay-the-load-event title="delay the load event">delaying the
+ load event</a>.</p>
+
+ <p>The user agent may use whatever means necessary to fetch the
+ resource (within the constraints put forward by this and other
+ specifications); for example, reconnecting to the server in the
+ face of network errors, using HTTP range retrieval requests, or
+ switching to a streaming protocol. The user agent must consider a
+ resource erroneous only if it has given up trying to fetch it.</p>
+
+ <p>The <a href=#networking-task-source>networking task source</a> <a href=#concept-task title=concept-task>tasks</a> to process the data as it is
+ being fetched must, when appropriate, include the relevant
+ substeps from the following list:</p>
+
+ <dl class=switch><dt>If the <a href=#media-data>media data</a> cannot be fetched at all, due
+ to network errors, causing the user agent to give up trying to
+ fetch the resource</dt>
+
+ <dt>If the <a href=#media-resource>media resource</a> is found to have <a href=#content-type title=Content-Type>Content-Type metadata</a> that, when
+ parsed as a <a href=#mime-type>MIME type</a> (including any codecs
+ described by the <code title="">codecs</code> parameter),
+ represents <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot
+ render</a> (even if the actual <a href=#media-data>media data</a> is in a
+ supported format)</dt>
+
+ <dt>If the <a href=#media-data>media data</a> can be fetched but is found by
+ inspection to be in an unsupported format, or can otherwise not
+ be rendered at all</dt>
+
+ <dd>
+
+ <p>DNS errors, HTTP 4xx and 5xx errors (and equivalents in
+ other protocols), and other fatal network errors that occur
+ before the user agent has established whether the <var title="">current media resource</var> is usable, as well as
+ the file using an unsupported container format, or using
+ unsupported codecs for all the data, must cause the user agent
+ to execute the following steps:</p>
+
+ <ol><li><p>The user agent should cancel the fetching
+ process.</li>
+
+ <li><p>Abort this subalgorithm, returning to the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</p>
+
+ </ol></dd>
+
+
+ <!-- insert content sniffing here if we want to define that -->
+ <!-- (in practice I don't think that's necessary since it's not
+ like you can do anything with the resource if you sniff it as the
+ wrong type) -->
+
+
+ <dt id=getting-media-metadata>Once enough of the <a href=#media-data>media
+ data</a> has been fetched to determine the duration of the
+ <a href=#media-resource>media resource</a>, its dimensions, and other
+ metadata,
+<!--TT-->
+ and once <a href=#the-timed-tracks-are-ready>the timed tracks are ready</a>
+<!--TT-->
+ </dt>
+
+ <dd>
+
+ <p>This indicates that the resource is usable. The user agent
+ must follow these substeps:</p>
+
+ <ol><li><p>Set the <a href=#current-playback-position>current playback position</a> to the
+ <a href=#earliest-possible-position>earliest possible position</a>.</li>
+
+ <li><p>Set the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute to
+ <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>.</li>
+
+ <li><p>For <code><a href=#video>video</a></code> elements, set the <code title=dom-video-videoWidth><a href=#dom-video-videowidth>videoWidth</a></code> and <code title=dom-video-videoHeight><a href=#dom-video-videoheight>videoHeight</a></code>
+ attributes.</li>
+
+ <li>
+
+ <p>Set the <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code>
+ attribute to the duration of the resource.</p>
+
+ <p class=note>The user agent <a href=#durationChange>will</a> <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> at the
+ element at this point.</p>
+
+ </li>
+
+ <li id=fire-loadedmetadata>
+
+ <p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> at the
+ element.</p>
+
+ <p class=note>Before this task is run, as part of the event
+ loop mechanism, the rendering will have been updated to resize
+ the <code><a href=#video>video</a></code> element if appropriate.</p>
+
+ </li>
+
+ <li>
+
+ <p>If either the <a href=#media-resource>media resource</a> or the address
+ of the <var title="">current media resource</var> indicate a
+ particular start time, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time. Ignore any
+ resulting exceptions (if the position is out of range, it is
+ effectively ignored).</p>
+
+ <p class=example>For example, a fragment identifier could be
+ used to indicate a start position.</p>
+
+ </li>
+
+ <li>
+
+ <p>Once the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute
+ reaches <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
+ <a href=#fire-loadeddata>after the <code title=event-media-loadeddata>loadeddata</code> event has been
+ fired</a>, set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</p>
+
+ <p class=note>A user agent that is attempting to reduce
+ network usage while still fetching the metadata for each
+ <a href=#media-resource>media resource</a> would also stop buffering at this
+ point, causing the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
+ to switch to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value.</p>
+
+ </li>
+
+ </ol><p class=note>The user agent is <em>required</em> to
+ determine the duration of the <a href=#media-resource>media resource</a> and
+ go through this step before playing.</p> <!-- actually defined
+ in the 'duration' section -->
+
+ </dd>
+
+
+ <dt>Once the entire <a href=#media-resource>media resource</a> has been <a href=#fetch title=fetch>fetched</a> (but potentially before any of it
+ has been decoded)</dt>
+
+ <dd>
+
+ <p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-media-progress><a href=#event-media-progress>progress</a></code> at the
+ <a href=#media-element>media element</a>.</p>
+
+ </dd>
+
+
+ <dt>If the connection is interrupted, causing the user agent to
+ give up trying to fetch the resource</dt>
+
+ <dd>
+
+ <p>Fatal network errors that occur after the user agent has
+ established whether the <var title="">current media
+ resource</var> is usable must cause the user agent to execute
+ the following steps:</p>
+
+ <ol><li><p>The user agent should cancel the fetching
+ process.</li>
+
+ <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
+ attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
+ <code title=dom-MediaError-MEDIA_ERR_NETWORK><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code>.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-error><a href=#event-media-error>error</a></code>
+ at the <a href=#media-element>media element</a>.</li>
+
+ <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>
+ value and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> at the
+ element.</li> <!-- XXX shouldn't this be _IDLE? see
+ aborted-by-user state below -->
+
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
+
+ <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</li>
+
+ </ol></dd>
+
+
+ <dt id=fatal-decode-error>If the <a href=#media-data>media data</a> is
+ corrupted</dt>
+
+ <dd>
+
+ <p>Fatal errors in decoding the <a href=#media-data>media data</a> that
+ occur after the user agent has established whether the <var title="">current media resource</var> is usable must cause the
+ user agent to execute the following steps:</p>
+
+ <ol><li><p>The user agent should cancel the fetching
+ process.</li>
+
+ <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
+ attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
+ <code title=dom-MediaError-MEDIA_ERR_DECODE><a href=#dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE</a></code>.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-error><a href=#event-media-error>error</a></code>
+ at the <a href=#media-element>media element</a>.</li>
+
+ <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>
+ value and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> at the
+ element.</li> <!-- XXX shouldn't this be _IDLE? see
+ aborted-by-user case below -->
+
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
+
+ <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</li>
+
+ </ol></dd>
+
+
+ <dt>If the <a href=#media-data>media data</a> fetching process is aborted by
+ the user</dt>
+
+ <dd>
+
+ <p>The fetching process is aborted by the user, e.g. because the
+ user navigated the browsing context to another page, the user
+ agent must execute the following steps. These steps are not
+ followed if the <code title=dom-media-load><a href=#dom-media-load>load()</a></code>
+ method itself is invoked while these steps are running, as the
+ steps above handle that particular kind of abort.</p>
+
+ <ol><li><p>The user agent should cancel the fetching
+ process.</li>
+
+ <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
+ attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
+ <code title=dom-MediaError-MEDIA_ERR_ABORTED><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-abort><a href=#event-media-abort>abort</a></code>
+ at the <a href=#media-element>media element</a>.</li>
+
+ <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute has a
+ value equal to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, set the
+ element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>
+ value and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code>
+ at the element. Otherwise, set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>
+ value.</li>
+
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
+
+ <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</li>
+
+ </ol></dd>
+
+
+ <dt id=non-fatal-media-error>If the <a href=#media-data>media data</a> can
+ be fetched but has non-fatal errors or uses, in part, codecs that
+ are unsupported, preventing the user agent from rendering the
+ content completely correctly but not preventing playback
+ altogether</dt>
+
+ <dd>
+
+ <p>The server returning data that is partially usable but cannot
+ be optimally rendered must cause the user agent to render just
+ the bits it can handle, and ignore the rest.</p>
+
+ <!-- v2: fire a 'warning' event and set the 'error' flag to 'MEDIA_ERR_SUBOPTIMAL' or something -->
+
+ </dd>
+
+
+<!--TT-->
+ <dt id=found-a-media-resource-specific-timed-track>If the <a href=#media-resource>media resource</a> is found to declare a <a href=#media-resource-specific-timed-track>media-resource-specific timed track</a> that the user agent supports</dt>
+
+ <dd>
+
+ <p>Run the <a href=#steps-to-expose-a-media-resource-specific-timed-track>steps to expose a media-resource-specific timed
+ track</a> with the relevant data.</p>
+
+ </dd>
+<!--TT-->
+
+ </dl><p>When the <a href=#networking-task-source>networking task source</a> has <a href=#queue-a-task title="queue a task">queued</a> the last <a href=#concept-task title=concept-task>task</a> as part of <a href=#fetch title=fetch>fetching</a> the <a href=#media-resource>media resource</a>
+ (i.e. once the download has completed), if the fetching process
+ completes without errors, including decoding the media data, and
+ if all of the data is available to the user agent without network
+ access, then, the user agent must move on to the next step. This
+ might never happen, e.g. when streaming an infinite resource such
+ as Web radio, or if the resource is longer than the user agent's
+ ability to cache data.</p>
+
+ <p>While the user agent might still need network access to obtain
+ parts of the <a href=#media-resource>media resource</a>, the user agent must
+ remain on this step.</p>
+
+ <p class=example>For example, if the user agent has discarded
+ the first half of a video, the user agent will remain at this step
+ even once the <a href=#ended-playback title="ended playback">playback has
+ ended</a>, because there is always the chance the user will
+ seek back to the start. In fact, in this situation, once <a href=#ended-playback title="ended playback">playback has ended</a>, the user agent
+ will end up dispatching a <code title=event-media-stalled><a href=#event-media-stalled>stalled</a></code> event, as described
+ earlier.</p>
+
+ </li>
+
+ <li><p>If the user agent ever reaches this step (which can only
+ happen if the entire resource gets loaded and kept available):
+ abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</li>
+
+ </ol></div>
+
+ <hr><p>The <dfn id=attr-media-preload title=attr-media-preload><code>preload</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The following table
+ lists the keywords and states for the attribute &mdash; the keywords
+ in the left column map to the states in the cell in the second
+ column on the same row as the keyword.</p>
+
+ <table><thead><tr><th> Keyword
+ <th> State
+ <th> Brief description
+ <tbody><tr><td><dfn id=attr-media-preload-none title=attr-media-preload-none><code>none</code></dfn>
+ <td><dfn id=attr-media-preload-none-state title=attr-media-preload-none-state>None</dfn>
+ <td>Hints to the user agent that either the author does not expect the user to need the media resource, or that the server wants to minimise unnecessary traffic.
+ <tr><td><dfn id=attr-media-preload-metadata title=attr-media-preload-metadata><code>metadata</code></dfn>
+ <td><dfn id=attr-media-preload-metadata-state title=attr-media-preload-metadata-state>Metadata</dfn>
+ <td>Hints to the user agent that the author does not expect the user to need the media resource, but that fetching the resource metadata (dimensions, first frame, track list, duration, etc) is reasonable.
+ <tr><td><dfn id=attr-media-preload-auto title=attr-media-preload-auto><code>auto</code></dfn>
+ <td><dfn id=attr-media-preload-auto-state title=attr-media-preload-auto-state>Automatic</dfn>
+ <td>Hints to the user agent that the user agent can put the user's needs first without risk to the server, up to and including optimistically downloading the entire resource.
+ </table><p>The empty string is also a valid keyword, and maps to the <a href=#attr-media-preload-auto-state title=attr-media-preload-auto-state>Automatic</a> state. The
+ attribute's <i>missing value default</i> is user-agent defined,
+ though the <a href=#attr-media-preload-auto-state title=attr-media-preload-auto-state>Metadata</a> state is
+ suggested as a compromise between reducing server load and providing
+ an optimal user experience.</p>
+
+ <div class=impl>
+
+ <p>The <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute is
+ intended to provide a hint to the user agent about what the author
+ thinks will lead to the best user experience. The attribute may be
+ ignored altogether, for example based on explicit user preferences
+ or based on the available connectivity.</p>
+
+ <p>The <dfn id=dom-media-preload title=dom-media-preload><code>preload</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ </div>
+
+ <p class=note>The <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute can overrride
+ the <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute (since
+ if the media plays, it naturally has to buffer first, regardless of
+ the hint given by the <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute). Including
+ both is not an error, however.</p>
+
+ <hr><!--v3BUF (when readding this, also add a domintro block)
+ <p>The <dfn
+ title="dom-media-bufferingRate"><code>bufferingRate</code></dfn>
+ attribute must return the average number of bits received per second
+ for the current download over the past few seconds. If there is no
+ download in progress, the attribute must return 0.</p>
+
+ <p>The <dfn
+ title="dom-media-bufferingThrottled"><code>bufferingThrottled</code></dfn>
+ attribute must return true if the user agent is intentionally
+ throttling the bandwidth used by the download (including when
+ throttling to zero to pause the download altogether), and false
+ otherwise.</p>
+
+ <hr>
+--><dl class=domintro><dt><var title="">media</var> . <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the
+ ranges of the <a href=#media-resource>media resource</a> that the user agent has
+ buffered.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-media-buffered title=dom-media-buffered><code>buffered</code></dfn>
+ attribute must return a new static <a href=#normalized-timeranges-object>normalized
+ <code>TimeRanges</code> object</a> that represents the ranges of
+ the <a href=#media-resource>media resource</a>, if any, that the user agent has
+ buffered, at the time the attribute is evaluated. Users agents must
+ accurately determine the ranges available, even for media streams
+ where this can only be determined by tedious inspection.</p>
+
+ <p class=note>Typically this will be a single range anchored at
+ the zero point, but if, e.g. the user agent uses HTTP range requests
+ in response to seeking, then there could be multiple ranges.</p>
+
+ <p>User agents may discard previously buffered data.</p>
+
+ <p class=note>Thus, a time position included within a range of the
+ objects return by the <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code> attribute at one time can
+ end up being not included in the range(s) of objects returned by the
+ same attribute at later times.</p>
+
+ </div>
+
+
+
+ <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets into the media resource</h5>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code></dt>
+
+ <dd>
+
+ <p>Returns the length of the <a href=#media-resource>media resource</a>, in
+ seconds.</p>
+
+ <p>Returns NaN if the duration isn't available.<p>
+
+ <p>Returns Infinity for unbounded streams.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the <a href=#current-playback-position>current playback position</a>, in seconds.</p>
+
+ <p>Can be set, to seek to the given time.<p>
+
+ <p>Will throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if there
+ is no selected <a href=#media-resource>media resource</a>. Will throw an
+ <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the given time is not
+ within the ranges to which the user agent can seek.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-startTime><a href=#dom-media-starttime>startTime</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <a href=#earliest-possible-position>earliest possible position</a>, in
+ seconds. This is the time for the start of the current clip. It
+ might not be zero if the clip's timeline is not zero-based, or if
+ the resource is a streaming resource (in which case it gives the
+ earliest time that the user agent is able to seek back to).</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-media-duration title=dom-media-duration><code>duration</code></dfn>
+ attribute must return the length of the <a href=#media-resource>media resource</a>,
+ in seconds. If no <a href=#media-data>media data</a> is available, then the
+ attributes must return the Not-a-Number (NaN) value. If the
+ <a href=#media-resource>media resource</a> is known to be unbounded (e.g. a
+ streaming radio), then the attribute must return the positive
+ Infinity value.</p>
+
+ <p>The user agent must determine the duration of the <a href=#media-resource>media
+ resource</a> before playing any part of the <a href=#media-data>media
+ data</a> and before setting <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> to a value equal to
+ or greater than <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, even if doing
+ so requires seeking to multiple parts of the resource.</p>
+
+ <p id=durationChange>When the length of the <a href=#media-resource>media
+ resource</a> changes (e.g. from being unknown to known, or from a
+ previously established length to a new length) the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> at the
+ <a href=#media-element>media element</a>.</p>
+
+ <p class=example>If an "infinite" stream ends for some reason,
+ then the duration would change from positive Infinity to the time of
+ the last frame or sample in the stream, and the <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event would be
+ fired. Similarly, if the user agent initially estimated the
+ <a href=#media-resource>media resource</a>'s duration instead of determining it
+ precisely, and later revises the estimate based on new information,
+ then the duration would change and the <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event would be
+ fired.</p>
+
+ <p><a href=#media-element title="media element">Media elements</a> have a
+ <dfn id=current-playback-position>current playback position</dfn>, which must initially be
+ zero. The current position is a time.</p>
+
+ <p>The <dfn id=dom-media-currenttime title=dom-media-currentTime><code>currentTime</code></dfn>
+ attribute must, on getting, return the <a href=#current-playback-position>current playback
+ position</a>, expressed in seconds. On setting, the user agent
+ must <a href=#dom-media-seek title=dom-media-seek>seek</a> to the new value
+ (which might raise an exception).</p>
+
+ <p>If the <a href=#media-resource>media resource</a> is a streaming resource, then
+ the user agent might be unable to obtain certain parts of the
+ resource after it has expired from its buffer. Similarly, some <a href=#media-resource title="media resource">media resources</a> might have a timeline
+ that doesn't start at zero. The <dfn id=earliest-possible-position>earliest possible
+ position</dfn> is the earliest position in the stream or resource
+ that the user agent can ever obtain again.</p>
+
+ <p>The <dfn id=dom-media-starttime title=dom-media-startTime><code>startTime</code></dfn>
+ attribute must, on getting, return the <a href=#earliest-possible-position>earliest possible
+ position</a>, expressed in seconds.</p>
+
+ <p>When the <a href=#earliest-possible-position>earliest possible position</a> changes, then:
+ if the <a href=#current-playback-position>current playback position</a> is before the
+ <a href=#earliest-possible-position>earliest possible position</a>, the user agent must <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible
+ position</a>; otherwise, if the user agent has not fired a <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event at the
+ element in the past 15 to 250ms and is not still running event
+ handlers for such an event, then the user agent must <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>
+
+ <p class=note>Because of the above requirement and the requirement
+ in the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
+ algorithm</a> that kicks in <a href=#getting-media-metadata>when the metadata of the clip becomes
+ known</a>, the <a href=#current-playback-position>current playback position</a> can never be
+ less than the <a href=#earliest-possible-position>earliest possible position</a>.</p>
+
+ <p>User agents must act as if the timeline of the <a href=#media-resource>media
+ resource</a> increases linearly starting from the <a href=#earliest-possible-position>earliest
+ possible position</a>, even if the underlying <a href=#media-data>media
+ data</a> has out-of-order or even overlapping time codes.</p>
+
+ <p class=example>For example, if two clips have been concatenated
+ into one video file, but the video format exposes the original times
+ for the two clips, the video data might expose a timeline that goes,
+ say, 00:15..00:29 and then 00:05..00:38. However, the user agent
+ would not expose those times; it would instead expose the times as
+ 00:15..00:29 and 00:29..01:02, as a single video.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-media-loop title=attr-media-loop><code>loop</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a> that, if specified,
+ indicates that the <a href=#media-element>media element</a> is to seek back to the
+ start of the <a href=#media-resource>media resource</a> upon reaching the end.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-media-loop title=dom-media-loop><code>loop</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ </div>
+
+
+
+ <h5 id=the-ready-states><span class=secno>4.8.10.7 </span>The ready states</h5>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code></dt>
+
+ <dd>
+
+ <p>Returns a value that expresses the current state of the element
+ with respect to rendering the <a href=#current-playback-position>current playback
+ position</a>, from the codes in the list below.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p><a href=#media-element title="media element">Media elements</a> have a
+ <i>ready state</i>, which describes to what degree they are ready
+ to be rendered at the <a href=#current-playback-position>current playback position</a>. The
+ possible values are as follows; the ready state of a media element
+ at any particular time is the greatest value describing the state of
+ the element:</p>
+
+ </div>
+
+ <dl><dt><dfn id=dom-media-have_nothing title=dom-media-HAVE_NOTHING><code>HAVE_NOTHING</code></dfn> (numeric value 0)</dt>
+
+ <dd>No information regarding the <a href=#media-resource>media resource</a> is
+ available. No data for the <a href=#current-playback-position>current playback position</a>
+ is available. <a href=#media-element title="media element">Media elements</a>
+ whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code>
+ attribute are set to <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> are always in
+ the <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>
+ state.</dd>
+
+ <dt><dfn id=dom-media-have_metadata title=dom-media-HAVE_METADATA><code>HAVE_METADATA</code></dfn> (numeric value 1)</dt>
+
+ <dd>Enough of the resource has been obtained that the duration of
+ the resource is available. In the case of a <code><a href=#video>video</a></code>
+ element, the dimensions of the video are also available. The API
+ will no longer raise an exception when seeking. No <a href=#media-data>media
+ data</a> is available for the immediate <a href=#current-playback-position>current playback
+ position</a>.
+<!--TT-->
+ The <a href=#timed-track title="timed track">timed tracks</a>
+ are <a href=#the-timed-tracks-are-ready title="the timed tracks are ready">ready</a>.
+<!--TT-->
+ </dd>
+
+ <dt><dfn id=dom-media-have_current_data title=dom-media-HAVE_CURRENT_DATA><code>HAVE_CURRENT_DATA</code></dfn> (numeric value 2)</dt>
+
+ <dd>Data for the immediate <a href=#current-playback-position>current playback position</a>
+ is available, but either not enough data is available that the user
+ agent could successfully advance the <a href=#current-playback-position>current playback
+ position</a> in the <a href=#direction-of-playback>direction of playback</a> at all
+ without immediately reverting to the <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> state, or
+ there is no more data to obtain in the <a href=#direction-of-playback>direction of
+ playback</a>. For example, in video this corresponds to the user
+ agent having data from the current frame, but not the next frame;
+ and to when <a href=#ended-playback title="ended playback">playback has
+ ended</a>.</dd>
+
+ <dt><dfn id=dom-media-have_future_data title=dom-media-HAVE_FUTURE_DATA><code>HAVE_FUTURE_DATA</code></dfn> (numeric value 3)</dt>
+
+ <dd>Data for the immediate <a href=#current-playback-position>current playback position</a>
+ is available, as well as enough data for the user agent to advance
+ the <a href=#current-playback-position>current playback position</a> in the <a href=#direction-of-playback>direction
+ of playback</a> at least a little without immediately reverting
+ to the <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>
+ state. For example, in video this corresponds to the user agent
+ having data for at least the current frame and the next frame. The
+ user agent cannot be in this state if <a href=#ended-playback title="ended
+ playback">playback has ended</a>, as the <a href=#current-playback-position>current playback
+ position</a> can never advance in this case.</dd>
+
+ <dt><dfn id=dom-media-have_enough_data title=dom-media-HAVE_ENOUGH_DATA><code>HAVE_ENOUGH_DATA</code></dfn> (numeric value 4)</dt>
+
+ <dd>All the conditions described for the <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> state
+ are met, and, in addition, the user agent estimates that data is
+ being fetched at a rate where the <a href=#current-playback-position>current playback
+ position</a>, if it were to advance at the rate given by the
+ <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
+ attribute, would not overtake the available data before playback
+ reaches the end of the <a href=#media-resource>media resource</a>.</dd>
+
+ </dl><div class=impl>
+
+ <p>When the ready state of a <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is not <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> changes, the
+ user agent must follow the steps given below:</p>
+
+ <dl class=switch><!-- going up to metadata --><dt>If the previous ready state was <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, and the new
+ ready state is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code></dt>
+
+ <dd>
+
+ <p class=note>A <code title=event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> DOM event <a href=#fire-loadedmetadata>will be fired</a> as part of the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> algorithm.</p>
+
+ </dd>
+
+ <!-- going up to current for the first time -->
+
+ <dt id=handling-first-frame-available>If the previous ready state
+ was <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> and
+ the new ready state is <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or
+ greater</dt>
+
+ <dd>
+
+ <p id=fire-loadeddata>If this is the first time this occurs for
+ this <a href=#media-element>media element</a> since the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> algorithm was last invoked,
+ the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> at the element.</p>
+
+ <p>If the new ready state is <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or
+ <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>,
+ then the relevant steps below must then be run also.</p>
+
+ </dd>
+
+ <!-- going down -->
+ <dt>If the previous ready state was <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or more,
+ and the new ready state is <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or
+ less</dt>
+
+ <dd>
+
+ <p class=note>A <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> DOM
+ event <a href=#fire-waiting-when-waiting>can be fired</a>,
+ depending on the current state of playback.</p>
+
+ </dd>
+
+ <!-- going up to future -->
+ <dt>If the previous ready state was <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or
+ less, and the new ready state is <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code></dt>
+
+ <dd>
+
+ <p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code>.</p>
+
+ <p>If the element is <a href=#potentially-playing>potentially playing</a>, the user
+ agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-playing><a href=#event-media-playing>playing</a></code>.</p>
+
+ </dd>
+
+ <!-- going up to enough -->
+ <dt>If the new ready state is <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code></dt>
+
+ <dd>
+
+ <p>If the previous ready state was <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or
+ less, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
+ a simple event</a> named <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code>, and, if the element is also
+ <a href=#potentially-playing>potentially playing</a>, <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-playing><a href=#event-media-playing>playing</a></code>.</p>
+
+ <p>If the <a href=#autoplaying-flag>autoplaying flag</a> is true, and the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is true, and the
+ <a href=#media-element>media element</a> has an <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute specified,
+ and the <a href=#media-element>media element</a> is in a <code><a href=#document>Document</a></code>
+ whose <a href=#browsing-context>browsing context</a> did not have the
+ <a href=#sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</a>
+ set when the <code><a href=#document>Document</a></code> was created, then the user
+ agent may also set the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute to false,
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-media-play><a href=#event-media-play>play</a></code>, and <a href=#queue-a-task>queue
+ a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-playing><a href=#event-media-playing>playing</a></code>.</p>
+
+ <p class=note>User agents are not required to autoplay, and it
+ is suggested that user agents honor user preferences on the
+ matter. Authors are urged to use the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute rather than
+ using script to force the video to play, so as to allow the user
+ to override the behavior if so desired.</p>
+
+ <p>In any case, the user agent must finally <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code>.</p>
+
+ </dd>
+
+ </dl></div>
+
+ <p class=note>It is possible for the ready state of a media
+ element to jump between these states discontinuously. For example,
+ the state of a media element can jump straight from <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> to <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code> without
+ passing through the <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> and
+ <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>
+ states.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-media-readystate title=dom-media-readyState><code>readyState</code></dfn> IDL
+ attribute must, on getting, return the value described above that
+ describes the current ready state of the <a href=#media-element>media
+ element</a>.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-media-autoplay title=attr-media-autoplay><code>autoplay</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. When present, the
+ user agent <span class=impl>(as described in the algorithm
+ described herein)</span> will automatically begin playback of the
+ <a href=#media-resource>media resource</a> as soon as it can do so without
+ stopping.</p>
+
+ <p class=note>Authors are urged to use the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute rather than
+ using script to trigger automatic playback, as this allows the user
+ to override the automatic playback when it is not desired, e.g. when
+ using a screen reader. Authors are also encouraged to consider not
+ using the automatic playback behavior at all, and instead to let the
+ user agent wait for the user to start playback explicitly.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-media-autoplay title=dom-media-autoplay><code>autoplay</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ </div>
+
+
+
+ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the media resource</h5>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if playback is paused; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if playback has reached the end of the <a href=#media-resource>media resource</a>.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the default rate of playback, for when the user is not
+ fast-forwarding or reversing through the <a href=#media-resource>media
+ resource</a>.</p>
+
+ <p>Can be set, to change the default rate of playback.</p>
+
+ <p>The default rate has no direct effect on playback, but if the
+ user switches to a fast-forward mode, when they return to the
+ normal playback mode, it is expected that the rate of playback
+ will be returned to the default rate of playback.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current rate playback, where 1.0 is normal speed.</p>
+
+ <p>Can be set, to change the rate of playback.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-played><a href=#dom-media-played>played</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the
+ ranges of the <a href=#media-resource>media resource</a> that the user agent has
+ played.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-play><a href=#dom-media-play>play</a></code>()</dt>
+
+ <dd>
+
+ <p>Sets the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute
+ to false, loading the <a href=#media-resource>media resource</a> and beginning
+ playback if necessary. If the playback had ended, will restart it
+ from the start.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-pause><a href=#dom-media-pause>pause</a></code>()</dt>
+
+ <dd>
+
+ <p>Sets the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute
+ to true, loading the <a href=#media-resource>media resource</a> if necessary.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-media-paused title=dom-media-paused><code>paused</code></dfn>
+ attribute represents whether the <a href=#media-element>media element</a> is
+ paused or not. The attribute must initially be true.</p>
+
+ <p>A <a href=#media-element>media element</a> is said to be <dfn id=potentially-playing>potentially
+ playing</dfn> when its <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code>
+ attribute is false, the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either
+ <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or
+ <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>,
+ the element has not <a href=#ended-playback>ended playback</a>, playback has not
+ <a href=#stopped-due-to-errors>stopped due to errors</a>, and the element has not <a href=#paused-for-user-interaction>paused
+ for user interaction</a>.</p>
+
+ <p>A <a href=#media-element>media element</a> is said to have <dfn id=ended-playback>ended
+ playback</dfn> when the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater, and
+ either the <a href=#current-playback-position>current playback position</a> is the end of the
+ <a href=#media-resource>media resource</a> and the <a href=#direction-of-playback>direction of
+ playback</a> is forwards and the <a href=#media-element>media element</a> does
+ not have a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute
+ specified, or the <a href=#current-playback-position>current playback position</a> is the
+ <a href=#earliest-possible-position>earliest possible position</a> and the <a href=#direction-of-playback>direction of
+ playback</a> is backwards.</p>
+
+ <p>The <dfn id=dom-media-ended title=dom-media-ended><code>ended</code></dfn>
+ attribute must return true if the <a href=#media-element>media element</a> has
+ <a href=#ended-playback>ended playback</a> and the <a href=#direction-of-playback>direction of
+ playback</a> is forwards, and false otherwise.</p>
+
+ <p>A <a href=#media-element>media element</a> is said to have <dfn id=stopped-due-to-errors>stopped due to
+ errors</dfn> when the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater, and
+ the user agent <a href=#non-fatal-media-error>encounters a
+ non-fatal error</a> during the processing of the <a href=#media-data>media
+ data</a>, and due to that error, is not able to play the content
+ at the <a href=#current-playback-position>current playback position</a>.</p>
+
+ <p>A <a href=#media-element>media element</a> is said to have <dfn id=paused-for-user-interaction>paused for user
+ interaction</dfn> when its <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either
+ <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or
+ <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code> and
+ the user agent has reached a point in the <a href=#media-resource>media
+ resource</a> where the user has to make a selection for the
+ resource to continue.</p>
+
+ <p>It is possible for a <a href=#media-element>media element</a> to have both
+ <a href=#ended-playback>ended playback</a> and <a href=#paused-for-user-interaction>paused for user
+ interaction</a> at the same time.</p>
+
+ <p>When a <a href=#media-element>media element</a> that is <a href=#potentially-playing>potentially
+ playing</a> stops playing because it has <a href=#paused-for-user-interaction>paused for user
+ interaction</a>, the user agent must <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>
+
+ <p id=fire-waiting-when-waiting>When a <a href=#media-element>media element</a>
+ that is <a href=#potentially-playing>potentially playing</a> stops playing because its
+ <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute
+ changes to a value lower than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, without
+ the element having <a href=#ended-playback>ended playback</a>, or playback having
+ <a href=#stopped-due-to-errors>stopped due to errors</a>, or playback having <a href=#paused-for-user-interaction>paused
+ for user interaction</a>, or the <a href=#dom-media-seek title=dom-media-seek>seeking algorithm</a> being invoked, the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code>
+ at the element, and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> at
+ the element.</p>
+
+ <p>When the <a href=#current-playback-position>current playback position</a> reaches the end
+ of the <a href=#media-resource>media resource</a> when the <a href=#direction-of-playback>direction of
+ playback</a> is forwards, then the user agent must follow these
+ steps:</p>
+
+ <ol><li><p>If the <a href=#media-element>media element</a> has a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible
+ position</a> of the <a href=#media-resource>media resource</a> and abort these
+ steps.</li> <!-- v2/v3: We should fire a 'looping' event here
+ to explain why this immediately fires a 'playing' event, otherwise
+ the 'playing' event that fires from the readyState going from
+ HAVE_CURRENT_DATA back to HAVE_FUTURE_DATA will seem inexplicable
+ (since the normally matching 'ended' given below event doesn't fire
+ in the loop case). -->
+
+ <li><p>Stop playback.<p class=note>The <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> attribute becomes
+ true.</li>
+
+ <li><p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
+ a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</li>
+
+ <li><p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
+ a simple event</a> named <code title=event-media-ended><a href=#event-media-ended>ended</a></code>
+ at the element.</li>
+
+ </ol><p>When the <a href=#current-playback-position>current playback position</a> reaches the
+ <a href=#earliest-possible-position>earliest possible position</a> of the <a href=#media-resource>media
+ resource</a> when the <a href=#direction-of-playback>direction of playback</a> is
+ backwards, then the user agent must follow these steps:</p>
+
+ <ol><li><p>Stop playback.</li>
+
+ <li><p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
+ a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</li>
+
+ </ol><p>The <dfn id=dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
+ attribute gives the desired speed at which the <a href=#media-resource>media
+ resource</a> is to play, as a multiple of its intrinsic
+ speed. The attribute is mutable: on getting it must return the last
+ value it was set to, or 1.0 if it hasn't yet been set; on setting
+ the attribute must be set to the new value.</p>
+
+ <p>The <dfn id=dom-media-playbackrate title=dom-media-playbackRate><code>playbackRate</code></dfn>
+ attribute gives the speed at which the <a href=#media-resource>media resource</a>
+ plays, as a multiple of its intrinsic speed. If it is not equal to
+ the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>,
+ then the implication is that the user is using a feature such as
+ fast forward or slow motion playback. The attribute is mutable: on
+ getting it must return the last value it was set to, or 1.0 if it
+ hasn't yet been set; on setting the attribute must be set to the new
+ value, and the playback must change speed (if the element is
+ <a href=#potentially-playing>potentially playing</a>).</p>
+
+ <p>If the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>
+ is positive or zero, then the <dfn id=direction-of-playback>direction of playback</dfn> is
+ forwards. Otherwise, it is backwards.</p>
+
+ <p>The "play" function in a user agent's interface must set the
+ <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute
+ to the value of the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
+ attribute before invoking the <code title=dom-media-play><a href=#dom-media-play>play()</a></code> method's steps. Features such
+ as fast-forward or rewind must be implemented by only changing the
+ <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>
+ attribute.</p>
+
+ <p id=rateUpdate>When the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> or
+ <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attributes
+ change value (either by being set by script or by being changed
+ directly by the user agent, e.g. in response to user control) the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code>
+ at the <a href=#media-element>media element</a>.</p>
+
+ <p>The <dfn id=dom-media-played title=dom-media-played><code>played</code></dfn>
+ attribute must return a new static <a href=#normalized-timeranges-object>normalized
+ <code>TimeRanges</code> object</a> that represents the ranges of
+ the <a href=#media-resource>media resource</a>, if any, that the user agent has so
+ far rendered, at the time the attribute is evaluated.</p>
+
+ <hr><p>When the <dfn id=dom-media-play title=dom-media-play><code>play()</code></dfn>
+ method on a <a href=#media-element>media element</a> is invoked, the user agent
+ must run the following steps.</p>
+
+ <ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has
+ the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the
+ <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</li>
+
+ <li>
+
+ <p>If the <a href=#ended-playback title="ended playback">playback has ended</a>
+ and the <a href=#direction-of-playback>direction of playback</a> is forwards, <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible
+ position</a> of the <a href=#media-resource>media resource</a>.</p>
+
+ <p class=note>This <a href=#seekUpdate>will cause</a> the user
+ agent to <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element>media
+ element</a>.</p> <!-- if we're already playing at this point,
+ it might also fire 'waiting' -->
+
+ </li>
+
+ <li>
+
+ <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is true, run
+ the following substeps:</p>
+
+ <ol><li><p>Change the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> to false.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-media-play><a href=#event-media-play>play</a></code> at the element.</li>
+
+ <li>
+
+ <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute has the
+ value <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>,
+ <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, or
+ <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> at the
+ element.</p>
+
+ <p>Otherwise, the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute has the
+ value <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or
+ <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>;
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-media-playing><a href=#event-media-playing>playing</a></code> at the
+ element.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li><p>Set the <a href=#media-element>media element</a>'s <a href=#autoplaying-flag>autoplaying
+ flag</a> to false.</li>
+
+ </ol><hr><p>When the <dfn id=dom-media-pause title=dom-media-pause><code>pause()</code></dfn>
+ method is invoked, the user agent must run the following steps:</p>
+
+ <ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has
+ the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the
+ <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a>.</li>
+
+ <li><p>Set the <a href=#media-element>media element</a>'s <a href=#autoplaying-flag>autoplaying
+ flag</a> to false.</li>
+
+ <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, run the
+ following steps:</p>
+
+ <ol><li><p>Change the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> to true.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
+ element.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-pause><a href=#event-media-pause>pause</a></code>
+ at the element.</li>
+
+ </ol></li>
+
+ </ol><hr><p id=media-playback>When a <a href=#media-element>media element</a> is
+ <a href=#potentially-playing>potentially playing</a> and its <code><a href=#document>Document</a></code> is a
+ <a href=#fully-active>fully active</a> <code><a href=#document>Document</a></code>, its <a href=#current-playback-position>current
+ playback position</a> must increase monotonically at <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> units of media
+ time per unit time of wall clock time.</p>
+
+ <p class=note>This specification doesn't define how the user agent
+ achieves the appropriate playback rate &mdash; depending on the
+ protocol and media available, it is plausible that the user agent
+ could negotiate with the server to have the server provide the media
+ data at the appropriate rate, so that (except for the period between
+ when the rate is changed and when the server updates the stream's
+ playback rate) the client doesn't actually have to drop or
+ interpolate any frames.</p>
+
+ <p>When the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>
+ is negative (playback is backwards), any corresponding audio must be
+ muted. When the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> is so low or so
+ high that the user agent cannot play audio usefully, the
+ corresponding audio must also be muted. If the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> is not 1.0, the
+ user agent may apply pitch adjustments to the audio as necessary to
+ render it faithfully.</p>
+
+ <p>The <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> can
+ be 0.0, in which case the <a href=#current-playback-position>current playback position</a>
+ doesn't move, despite playback not being paused (<code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> doesn't become true, and the
+ <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event doesn't fire).</p>
+
+ <p><a href=#media-element title="media element">Media elements</a> that are
+ <a href=#potentially-playing>potentially playing</a> while not <a href=#in-a-document>in a
+ <code>Document</code></a> must not play any video, but should
+ play any audio component. Media elements must not stop playing just
+ because all references to them have been removed; only once a media
+ element to which no references exist has reached a point where no
+ further audio remains to be played for that element (e.g. because
+ the element is paused, or because the end of the clip has been
+ reached, or because its <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> is 0.0) may the
+ element be garbage collected.</p>
+
+ <hr><p>When the <a href=#current-playback-position>current playback position</a> of a <a href=#media-element>media
+ element</a> changes (e.g. due to playback or seeking), the user
+ agent must run the following steps. If the <a href=#current-playback-position>current playback
+ position</a> changes while the steps are running, then the user
+ agent must wait for the steps to complete, and then must immediately
+ rerun the steps. (These steps are thus run as often as possible or
+ needed &mdash; if one iteration takes a long time, this can cause
+ certain ranges to be skipped over as the user agent rushes ahead to
+ "catch up".)</p>
+
+ <ol><!--XXXTT - the text below is wrong, but we need to do something similar, updating the timed tracks, pausing if necessary (more below)
+ <li><p>Let <var title="">current ranges</var> be an ordered list of
+ <span title="cue range">cue ranges</span>, initialized to contain
+ all the <span title="cue range">cue ranges</span> of the
+ <span>media element</span> whose start times are less than or equal
+ to the <span>current playback position</span> and whose end times
+ are greater than the <span>current playback position</span>, in the
+ order they were added to the element.</p></li>
+
+ <li><p>Let <var title="">other ranges</var> be an ordered list of
+ <span title="cue range">cue ranges</span>, initialized to contain
+ all the <span title="cue range">cue ranges</span> of the
+ <span>media element</span> that are not present in <var
+ title="">current ranges</var>, in the order they were added to the
+ element.</p></li>
+--><li><p>If the time was reached through the usual monotonic increase
+ of the current playback position during normal playback, and if the
+ user agent has not fired a <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event at the
+ element in the past 15 to 250ms and is not still running event
+ handlers for such an event, then the user agent must <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
+ element. (In the other cases, such as explicit seeks, relevant
+ events get fired as part of the overall process of changing the
+ current playback position.)</p>
+
+ <p class=note>The event thus is not to be fired faster than about
+ 66Hz or slower than 4Hz (assuming the event handlers don't take
+ longer than 250ms to run). User agents are encouraged to vary the
+ frequency of the event based on the system load and the average
+ cost of processing the event each time, so that the UI updates are
+ not any more frequent than the user agent can comfortably handle
+ while decoding the video.</li>
+
+<!--XXXTT [beware - - nested comments]
+ <li><p>If none of the <span title="cue range">cue ranges</span> in
+ <var title="">current ranges</var> have their "active" boolean set
+ to "false" (inactive) and none of the <span title="cue range">cue
+ ranges</span> in <var title="">other ranges</var> have their
+ "active" boolean set to "true" (active), then abort these
+ steps.</p></li>
+
+ <li><p>If the time was reached through the usual monotonic increase
+ of the current playback position during normal playback, and there
+ are <span title="cue range">cue ranges</span> in <var
+ title="">other ranges</var> that have both their "active" boolean
+ and their "pause" boolean set to "true", then immediately act as if
+ the element's <code title="dom-media-pause">pause()</code> method
+ had been invoked. <!- - pause() can in theory call load(), but never
+ can it do so as part of this invokation, since we wouldn't be in
+ this algorithm if the media element was empty. So, no need to couch
+ all this in a task. - -> (In the other cases, such as explicit
+ seeks, playback is not paused by exiting a cue range, even if that
+ cue range has its "pause" boolean set to "true".)</p></li>
+
+ <li><p>For each non-null "exit" callback of the <span
+ title="cue range">cue ranges</span> in <var title="">other
+ ranges</var> that have their "active" boolean set to "true"
+ (active), in list order, <span>queue a task</span> that invokes the
+ callback, passing the cue range's identifier as the callback's only
+ argument.</p></li>
+
+ <li><p>For each non-null "enter" callback of the <span title="cue
+ range">cue ranges</span> in <var title="">current ranges</var> that
+ have their "active" boolean set to "false" (inactive), in list
+ order, <span>queue a task</span> that invokes the callback, passing
+ the cue range's identifier as the callback's only
+ argument.</p></li>
+
+ <li><p>Set the "active" boolean of all the <span title="cue
+ range">cue ranges</span> in the <var title="">current ranges</var>
+ list to "true" (active), and the "active" boolean of all the <span
+ title="cue range">cue ranges</span> in the <var title="">other
+ ranges</var> list to "false" (inactive).</p></li>
+-->
+ </ol><p>When a <a href=#media-element>media element</a> is <a href=#remove-an-element-from-a-document title="remove an
+ element from a document">removed from a
+ <code>Document</code></a>, if the <a href=#media-element>media element</a>'s
+ <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
+ has a value other than <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> then the user
+ agent must act as if the <code title=dom-media-pause><a href=#dom-media-pause>pause()</a></code> method had been invoked.</p>
+
+ <p class=note>If the <a href=#media-element>media element</a>'s
+ <code><a href=#document>Document</a></code> stops being a <a href=#fully-active>fully active</a>
+ document, then the playback will <a href=#media-playback>stop</a>
+ until the document is active again.</p>
+
+ </div>
+
+
+
+ <h5 id=seeking><span class=secno>4.8.10.9 </span>Seeking</h5>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the user agent is currently seeking.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the
+ ranges of the <a href=#media-resource>media resource</a> to which it is possible
+ for the user agent to seek.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-media-seeking title=dom-media-seeking><code>seeking</code></dfn>
+ attribute must initially have the value false.</p>
+
+ <p>When the user agent is required to <dfn id=dom-media-seek title=dom-media-seek>seek</dfn> to a particular <var title="">new
+ playback position</var> in the <a href=#media-resource>media resource</a>, it means
+ that the user agent must run the following steps. This algorithm
+ interacts closely with the <a href=#event-loop>event loop</a> mechanism; in
+ particular, it has a <a href=#synchronous-section>synchronous
+ section</a> (which is triggered as part of the <a href=#event-loop>event
+ loop</a> algorithm). Steps in that section are marked with
+ &#8987;.</p>
+
+ <ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then raise an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception (if the seek was in
+ response to a DOM method call or setting of an IDL attribute), and
+ abort these steps.</li>
+
+ <li><p>If the element's <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute is true,
+ then another instance of this algorithm is already running. Abort
+ that other instance of the algorithm without waiting for the step
+ that it is running to complete.</li>
+
+ <li><p>Set the <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL
+ attribute to true.</li>
+
+ <li id=seekUpdate><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
+ element.</li>
+
+ <li><p>If the seek was in response to a DOM method call or setting
+ of an IDL attribute, then continue the script. The remainder of
+ these steps must be run asynchronously. With the exception of the
+ steps marked with &#8987;, they could be aborted at any time by
+ another instance of this algorithm being invoked.</li>
+
+ <li><p>If the <var title="">new playback position</var> is later
+ than the end of the <a href=#media-resource>media resource</a>, then let it be the
+ end of the <a href=#media-resource>media resource</a> instead.</li>
+
+ <li><p>If the <var title="">new playback position</var> is less
+ than the <a href=#earliest-possible-position>earliest possible position</a>, let it be that
+ position instead.</li>
+
+ <li><p>If the (possibly now changed) <var title="">new playback
+ position</var> is not in one of the ranges given in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute, then let it
+ be the position in one of the ranges given in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute that is the
+ nearest to the <var title="">new playback position</var>. If two
+ positions both satisfy that constraint (i.e. the <var title="">new
+ playback position</var> is exactly in the middle between two ranges
+ in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute)
+ then use the position that is closest to the <a href=#current-playback-position>current playback
+ position</a>. If there are no ranges given in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute then set the
+ <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute to
+ false and abort these steps.</li>
+
+ <li><p>Set the <a href=#current-playback-position>current playback position</a> to the given
+ <var title="">new playback position</var>.</li>
+
+ <li><p>If the <a href=#media-element>media element</a> was <a href=#potentially-playing>potentially
+ playing</a> immediately before it started seeking, but seeking
+ caused its <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code>
+ attribute to change to a value lower than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, then
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> at the
+ element.</li>
+
+ <li><p>If, when it reaches this step, the user agent has still not
+ established whether or not the <a href=#media-data>media data</a> for the <var title="">new playback position</var> is available, and, if it is,
+ decoded enough data to play back that position, then <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-seeking><a href=#event-media-seeking>seeking</a></code> at the element.</li>
+
+ <li><p>Wait until it has established whether or not the <a href=#media-data>media
+ data</a> for the <var title="">new playback position</var> is
+ available, and, if it is, until it has decoded enough data to play
+ back that position.</li>
+
+ <li><p><a href=#await-a-stable-state>Await a stable state</a>. The <a href=#synchronous-section>synchronous
+ section</a> consists of all the remaining steps of this
+ algorithm. (Steps in the <a href=#synchronous-section>synchronous section</a> are
+ marked with &#8987;.)</li>
+
+ <li><p>&#8987; Set the <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute to
+ false.</li>
+
+ <li><p>&#8987; <a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-seeked><a href=#event-media-seeked>seeked</a></code>
+ at the element.</li>
+
+ </ol><p>The <dfn id=dom-media-seekable title=dom-media-seekable><code>seekable</code></dfn>
+ attribute must return a new static <a href=#normalized-timeranges-object>normalized
+ <code>TimeRanges</code> object</a> that represents the ranges of
+ the <a href=#media-resource>media resource</a>, if any, that the user agent is able
+ to seek to, at the time the attribute is evaluated.</p>
+
+ <p class=note>If the user agent can seek to anywhere in the
+ <a href=#media-resource>media resource</a>, e.g. because it a simple movie file and
+ the user agent and the server support HTTP Range requests, then the
+ attribute would return an object with one range, whose start is the
+ time of the first frame (typically zero), and whose end is the same
+ as the time of the first frame plus the <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute's value (which
+ would equal the time of the last frame).</p>
+
+ <p class=note>The range might be continuously changing, e.g. if
+ the user agent is buffering a sliding window on an infinite
+ stream. This is the behavior seen with DVRs viewing live TV, for
+ instance.</p>
+
+ <p><a href=#media-resource title="media resource">Media resources</a> might be
+ internally scripted or interactive. Thus, a <a href=#media-element>media
+ element</a> could play in a non-linear fashion. If this happens,
+ the user agent must act as if the algorithm for <a href=#dom-media-seek title=dom-media-seek>seeking</a> was used whenever the
+ <a href=#current-playback-position>current playback position</a> changes in a discontinuous
+ fashion (so that the relevant events fire).</p>
+
+ </div>
+
+
+<!--TT-->
+ <h5 id=timed-tracks><span class=secno>4.8.10.10 </span>Timed tracks</h5>
+
+ <h6 id=timed-track-model><span class=secno>4.8.10.10.1 </span>Timed track model</h6>
+
+ <p>A <a href=#media-element>media element</a> can have a group of associated <dfn id=timed-track title="timed track">timed tracks</dfn>, known as the <a href=#media-element>media
+ element</a>'s <dfn id=list-of-timed-tracks>list of timed tracks</dfn>. The <a href=#timed-track title="timed track">timed tracks</a> are sorted as follows:</p>
+
+ <ol class=brief><li>The <a href=#timed-track title="timed track">timed tracks</a> corresponding
+ to <code><a href=#the-track-element>track</a></code> element children of the <a href=#media-element>media
+ element</a>, in <a href=#tree-order>tree order</a>.</li>
+
+ <li>Any <a href=#timed-track title="timed track">timed tracks</a> added using
+ the <code title=dom-media-addTrack>addTrack()</code> method, in
+ the order they were added, oldest first.</li>
+
+ <li>Any <a href=#media-resource-specific-timed-track title="media-resource-specific timed
+ track">media-resource-specific timed tracks</a> (<a href=#timed-track title="timed track">timed tracks</a> corresponding to data in
+ the <a href=#media-resource>media resource</a>), in the order defined by the
+ <a href=#media-resource>media resource</a>'s format specification.</li>
+
+ </ol><p>A <a href=#timed-track>timed track</a> consists of:</p>
+
+ <dl><dt><dfn id=timed-track-kind title="timed track kind">The kind of timed track</dfn>
+
+ <dd>
+
+ <p>This decides how the track is handled by the user agent. The
+ kind is represented by a string. The possible strings are:</p>
+
+ <ul class=brief><li><dfn id=dom-timedtrack-kind-subtitles title=dom-TimedTrack-kind-subtitles><code>subtitles</code></dfn>
+ <li><dfn id=dom-timedtrack-kind-captions title=dom-TimedTrack-kind-captions><code>captions</code></dfn>
+ <li><dfn id=dom-timedtrack-kind-descriptions title=dom-TimedTrack-kind-descriptions><code>descriptions</code></dfn>
+ <li><dfn id=dom-timedtrack-kind-chapters title=dom-TimedTrack-kind-chapters><code>chapters</code></dfn>
+ <li><dfn id=dom-timedtrack-kind-metadata title=dom-TimedTrack-kind-metadata><code>metadata</code></dfn>
+ </ul><p>The <a href=#timed-track-kind title="timed track kind">kind of track</a> can
+ change dynamically, in the case of a <a href=#timed-track>timed track</a>
+ corresponding to a <code><a href=#the-track-element>track</a></code> element.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-label title="timed track label">A label</dfn>
+
+ <dd>
+
+ <p>This is a human-readable string intended to identify the track
+ for the user. In certain cases, the label might be generated
+ automatically.</p>
+
+ <p>The <a href=#timed-track-label title="timed track label">label of a track</a> can
+ change dynamically, in the case of a <a href=#timed-track>timed track</a>
+ corresponding to a <code><a href=#the-track-element>track</a></code> element or in the case of an
+ automatically-generated label whose value depends on variable
+ factors such as the user's preferred user interface language.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-language title="timed track language">A language</dfn>
+
+ <dd>
+
+ <p>This is a string (a BCP 47 language tag) representing the
+ language of the timed track's cues. <a href=#refsBCP47>[BCP47]</a></p>
+
+ <p>The <a href=#timed-track-language title="timed track language">language of a timed
+ track</a> can change dynamically, in the case of a <a href=#timed-track>timed
+ track</a> corresponding to a <code><a href=#the-track-element>track</a></code> element.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-readiness-state title="timed track readiness state">A readiness state</dfn>
+
+ <dd>
+
+ <p>One of the following:</p>
+
+ <dl><dt><dfn id=timed-track-not-loaded title="timed track not loaded">Not loaded</dfn>
+
+ <dd>
+
+ <p>Indicates that the timed track is known to exist (e.g. it has
+ been declared with a <code><a href=#the-track-element>track</a></code> element), but its cues
+ have not been obtained.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-loading title="timed track loading">Loading</dfn>
+
+ <dd>
+
+ <p>Indicates that the timed track is loading and there have been
+ no fatal errors encountered so far. Further cues might still be
+ added to the track.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-loaded title="timed track loaded">Loaded</dfn>
+
+ <dd>
+
+ <p>Indicates that the timed track has been loaded with no fatal
+ errors. No new cues will be added to the track except if the
+ <a href=#timed-track>timed track</a> corresponds to a
+ <code><a href=#mutabletimedtrack>MutableTimedTrack</a></code> object.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-failed-to-load title="timed track failed to load">Failed to load</dfn>
+
+ <dd>
+
+ <p>Indicates that the timed track was enabled, but when the user
+ agent attempted to obtain it, this failed in some way
+ (e.g. <a href=#url>URL</a> could not be <a href=#resolve-a-url title="resolve a
+ url">resolved</a>, network error, unknown timed track
+ format). Some or all of the cues are likely missing and will not
+ be obtained.</p>
+
+ </dd>
+
+ </dl><p>The <a href=#timed-track-readiness-state title="timed track readiness state">readiness
+ state</a> of a <a href=#timed-track>timed track</a> changes dynamically as
+ the track is obtained.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-mode title="timed track mode">A mode</dfn>
+
+ <dd>
+
+ <p>One of the following:</p>
+
+ <dl><dt><dfn id=timed-track-disabled title="timed track disabled">Disabled</dfn>
+
+ <dd>
+
+ <p>Indicates that the timed track is not active. Other than for
+ the purposes of exposing the track in the DOM, the user agent is
+ ignoring the timed track. No cues are active, no events are
+ fired, and the user agent will not attempt to obtain the track's
+ cues.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-hidden title="timed track hidden">Hidden</dfn>
+
+ <dd>
+
+ <p>Indicates that the timed track is active, but that the user
+ agent is not actively displaying the cues. If no attempt has yet
+ been made to obtain the track's cues, the user will perform such
+ an attempt momentarily. The user agent is maintaining a list of
+ which cues are active, and events are being fired
+ accordingly.</p>
+
+ </dd>
+
+ <dt><dfn id=timed-track-showing title="timed track showing">Showing</dfn>
+
+ <dd>
+
+ <p>Indicates that the timed track is active. If no attempt has
+ yet been made to obtain the track's cues, the user will perform
+ such an attempt momentarily. The user agent is maintaining a
+ list of which cues are active, and events are being fired
+ accordingly. In addition, for timed tracks whose <a href=#timed-track-kind title="timed track kind">kind</a> is <code title=dom-mediatrack-kind-subtitles>subtitles</code> or <code title=dom-mediatrack-kind-captions>captions</code>, the cues
+ are being displayed over the video as appropriate; for timed
+ tracks whose <a href=#timed-track-kind title="timed track kind">kind</a> is <code title=dom-mediatrack-kind-descriptions>descriptions</code>,
+ the user agent is making the cues available to the user in a
+ non-visual fashion; and for timed tracks whose <a href=#timed-track-kind title="timed track kind">kind</a> is <code title=dom-mediatrack-kind-chapters>chapters</code>, the user
+ agent is making available to the user a mechanism by which the
+ user can navigate to any point in the <a href=#media-resource>media
+ resource</a> by selecting a cue.</p>
+
+ </dd>
+
+ </dl></dd>
+
+ <dt><dfn id=timed-track-list-of-cues title="timed track list of cues">A list of zero or more cues</dfn>
+
+ <dd>
+
+ <p>A list of <a href=#timed-track-cue title="timed track cue">timed track cues</a>.</p>
+
+ <p>The <a href=#timed-track-list-of-cues title="timed track list of cues">list of cues of a
+ timed track</a> can change dynamically, either because the
+ <a href=#timed-track>timed track</a> has <a href=#timed-track-not-loaded title="timed track not
+ loaded">not yet been loaded</a> or is still <a href=#timed-track-loading title="timed
+ track loading">loading</a>, or in the case of a <a href=#timed-track>timed
+ track</a> corresponding to a <code><a href=#mutabletimedtrack>MutableTimedTrack</a></code>
+ object, where individual cues can be added or removed
+ dynamically using the API.</p>
+
+ </dd>
+
+ </dl><p>Each <a href=#timed-track>timed track</a> has a corresponding
+ <code><a href=#timedtrack>TimedTrack</a></code> object.</p>
+
+ <p>A <dfn id=timed-track-cue>timed track cue</dfn> is the unit of time-sensitive data
+ in a <a href=#timed-track>timed track</a>, corresponding for instance for
+ subtitles and captions to the text that appears at a particular time
+ and disappears at another time.</p>
+
+ <p>Each <a href=#timed-track-cue>timed track cue</a> consists of:</p>
+
+ <dl><dt><dfn id=timed-track-cue-identifier title="timed track cue identifier">An identifier</dfn>
+ <dd>
+ <p>An arbitrary string.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-start-time title="timed track cue start time">A start time</dfn>
+ <dd>
+ <p>A time, in seconds and fractions of a second, at which the cue
+ becomes relevant.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-end-time title="timed track cue end time">An end time</dfn>
+ <dd>
+ <p>A time, in seconds and fractions of a second, at which the cue
+ stops being relevant.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-pause-on-exit-flag title="timed track cue pause-on-exit flag">A pause-on-exit flag</dfn>
+ <dd>
+ <p>A boolean indicating whether playback of the <a href=#media-resource>media
+ resource</a> is to pause when the cue stops being relevant.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-writing-direction title="timed track cue writing direction">A writing direction</dfn>
+ <dd>
+ <p>A writing direction, either <dfn id=timed-track-cue-horizontal-writing-direction title="timed track cue
+ horizontal writing direction">horizontal</dfn> (a line extends
+ horizontally and is positioned vertically, with consecutive lines
+ displayed below each other), <dfn id=timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical
+ growing right writing direction">vertical growing right</dfn> (a
+ line extends vertically and is positioned horizontally, with
+ consecutive lines displayed to the right of each other<!-- used
+ for east asian-->), or <dfn id=timed-track-cue-vertical-growing-left-writing-direction title="timed track cue vertical
+ growing left writing direction">vertical growing left</dfn> (a
+ line extends vertically and is positioned horizontally, with
+ consecutive lines displayed to the left of each other<!-- used for
+ mongolian -->).</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-snap-to-lines-flag title="timed track cue snap-to-lines flag">A snap-to-lines flag</dfn>
+ <dd>
+ <p>A boolean indicating whether the <a href=#timed-track-cue-line-position title="timed track cue
+ line position">line's position</a> is a line position
+ (positioned to a multiple of the line dimensions of the first line
+ of the cue), or whether it is a percentage of the dimension of the
+ video.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-line-position title="timed track cue line position">A line position</dfn>
+ <dd>
+ <p>A number giving the position of the lines of the cue, to be
+ interpreted as defined by the <a href=#timed-track-cue-writing-direction title="timed track cue writing
+ direction">writing direction</a> and <a href=#timed-track-cue-snap-to-lines-flag title="timed track
+ cue snap-to-lines flag">snap-to-lines flag</a> of the cue.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-text-position title="timed track cue text position">A text position</dfn>
+ <dd>
+ <p>A number giving the position of the text of the cue within each
+ line, to be interpreted as a percentage of the video, as defined
+ by the <a href=#timed-track-cue-writing-direction title="timed track cue writing direction">writing
+ direction</a>.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-size title="timed track cue size">A size</dfn>
+ <dd>
+ <p>A number giving the size of the box within which the text of
+ each line of the cue is to be aligned, to be interpreted as a
+ percentage of the video, as defined by the <a href=#timed-track-cue-writing-direction title="timed
+ track cue writing direction">writing direction</a>.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-alignment title="timed track cue alignment">An alignment</dfn>
+ <dd>
+ <p>An alignment for the text of each line of the cue, either <dfn id=timed-track-cue-start-alignment title="timed track cue start alignment">start alignment</dfn> (the
+ text is aligned towards its start side), <dfn id=timed-track-cue-middle-alignment title="timed track
+ cue middle alignment">middle alignment</dfn> (the text is aligned
+ centered between its start and end sides), <dfn id=timed-track-cue-end-alignment title="timed track
+ cue end alignment">end alignment</dfn> (the text is aligned
+ towards its end side). Which sides are the start and end sides
+ depends on the Unicode bidirectional algorithm and the <a href=#timed-track-cue-writing-direction title="timed track cue writing direction">writing
+ direction</a>. <a href=#refsBIDI>[BIDI]</a></p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-voice-identifier title="timed track cue voice identifier">A voice identifier</dfn>
+ <dd>
+ <p>A string identifying the voice with which the cue is associated.</p>
+ </dd>
+
+ <dt><dfn id=timed-track-cue-text title="timed track cue text">The text of the cue</dfn>
+ <dd>
+ <p>The raw text of the cue, and rules for its interpretation,
+ allowing the text to be converted to an equivalent fragment of
+ HTML.</p>
+ </dd>
+
+ </dl><p>A <a href=#timed-track-cue>timed track cue</a> is immutable.</p>
+
+ <p>Each <a href=#timed-track-cue>timed track cue</a> has a corresponding
+ <code><a href=#timedtrackcue>TimedTrackCue</a></code> object, and can be associated with a
+ particular <a href=#timed-track>timed track</a>. Once a <a href=#timed-track-cue>timed track
+ cue</a> is associated with a particular <a href=#timed-track>timed track</a>,
+ the association is permanent.</p>
+
+ <p>The <a href=#timed-track title="timed track">timed tracks</a> of a
+ <a href=#media-element>media element</a> are <dfn id=the-timed-tracks-are-ready title="the timed tracks are
+ ready">ready</dfn> if all the <a href=#timed-track title="timed track">timed
+ tracks</a> whose <a href=#timed-track-mode title="timed track mode">mode</a> was
+ not in the <a href=#timed-track-disabled title="timed track disabled">disabled</a> state
+ when the element's <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> last started now have a <a href=#timed-track-readiness-state>timed track readiness
+ state</a> of <a href=#timed-track-loaded title="timed track loaded">loaded</a> or
+ <a href=#timed-track-failed-to-load title="timed track failed to load">failed to load</a>.</p>
+
+
+ <h6 id=sourcing-in-band-timed-tracks><span class=secno>4.8.10.10.2 </span>Sourcing in-band timed tracks</h6>
+
+ <p>A <dfn id=media-resource-specific-timed-track>media-resource-specific timed track</dfn> is a <a href=#timed-track>timed
+ track</a> that corresponds to data found in the <a href=#media-resource>media
+ resource</a>.</p>
+
+
+ <div class=impl>
+
+ <p>Rules for processing and rendering such data are defined by the
+ relevant specifications, e.g. the specification of the video format
+ if the <a href=#media-resource>media resource</a> is a video.</p>
+
+ <p>When a <a href=#media-resource>media resource</a> contains data that the user
+ agent recognises and supports as being equivalent to a <a href=#timed-track>timed
+ track</a>, the user agent <a href=#found-a-media-resource-specific-timed-track>runs</a> the
+ <dfn id=steps-to-expose-a-media-resource-specific-timed-track>steps to expose a media-resource-specific timed track</dfn>
+ with the relevant data, as follows:</p>
+
+ <ol><li><p>Associate the relevant data with a new <a href=#timed-track>timed
+ track</a> and its corresponding new <code><a href=#timedtrack>TimedTrack</a></code>
+ object. The <a href=#timed-track>timed track</a> is a
+ <a href=#media-resource-specific-timed-track>media-resource-specific timed track</a>.</li>
+
+ <li><p>Set the new <a href=#timed-track>timed track</a>'s <a href=#timed-track-kind title="timed track
+ kind">kind</a>, <a href=#timed-track-label title="timed track label">label</a>,
+ and <a href=#timed-track-language title="timed track language">language</a> based on the
+ semantics of the relevant data, as defined by the relevant
+ specification.</li>
+
+ <li><p>Populate the new <a href=#timed-track>timed track</a>'s <a href=#timed-track-list-of-cues title="timed track list of cues">list of cues</a> with the cues
+ parsed so far, folllowing the <a href=#guidelines-for-exposing-cues-in-various-formats-as-timed-track-cues>guidelines for exposing
+ cues</a>, and begin updating it dynamically as
+ necessary.</li>
+
+ <li>
+
+ <p>Set the new <a href=#timed-track>timed track</a>'s <a href=#timed-track-readiness-state title="timed track
+ readiness state">readiness state</a> to the value that most
+ correctly describes the current state, and begin updating it
+ dynamically as necessary.</p>
+
+ <p class=example>For example, if the relevant data in the
+ <a href=#media-resource>media resource</a> has been fully parsed and completely
+ describes the cues, then the <a href=#timed-track>timed track</a> would be
+ <a href=#timed-track-loaded title="timed track loaded">loaded</a>. On the other hand,
+ if the data for the cues is interleaved with the <a href=#media-data>media
+ data</a>, and the <a href=#media-resource>media resource</a> as a whole is
+ still being downloaded, then the <a href=#timed-track-loading title="timed track
+ loading">loading</a> state might be more accurate.</p>
+
+ </li>
+
+ <li><p>Set the new <a href=#timed-track>timed track</a>'s <a href=#timed-track-mode title="timed
+ track mode">mode</a> to the mode consistent with the user's
+ preferences and the requirements of the relevant specification for
+ the data.</li>
+
+ <li><p>Add the new <a href=#timed-track>timed track</a> to the <a href=#media-element>media
+ element</a>'s <a href=#list-of-timed-tracks>list of timed tracks</a>.</li>
+
+ </ol><p>When a <a href=#media-element>media element</a> is to <dfn id="forget-the-media-element's-media-resource-specific-timed-tracks">forget the media
+ element's media-resource-specific timed tracks</dfn>, the user
+ agent must remove from the <a href=#media-element>media element</a>'s <a href=#list-of-timed-tracks>list
+ of timed tracks</a> all the <a href=#media-resource-specific-timed-track title="media-resource-specific
+ timed track">media-resource-specific timed tracks</a>.</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h6 id=sourcing-out-of-band-timed-tracks><span class=secno>4.8.10.10.3 </span>Sourcing out-of-band timed tracks</h6>
+
+ <p>When a <code><a href=#the-track-element>track</a></code> element is created, it must be
+ associated with a new <a href=#timed-track>timed track</a> and its corresponding
+ new <code><a href=#timedtrack>TimedTrack</a></code> object.</p>
+
+ <p>The <a href=#timed-track-kind>timed track kind</a> is determined from the state of
+ the element's <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute
+ according to the following table; for a state given in a cell of the
+ first column, the <a href=#timed-track-kind title="timed track kind">kind</a> is the
+ string given in the second column:</p>
+
+ <table><thead><tr><th>State
+ <th>String
+ <tbody><tr><td><a href=#attr-track-kind-subtitles title=attr-track-kind-subtitles>Subtitles</a>
+ <td><code title=dom-track-kind-subtitles>subtitles</code>
+ <tr><td><a href=#attr-track-kind-captions title=attr-track-kind-captions>Captions</a>
+ <td><code title=dom-track-kind-captions>captions</code>
+ <tr><td><a href=#attr-track-kind-descriptions title=attr-track-kind-descriptions>Descriptions</a>
+ <td><code title=dom-track-kind-descriptions>descriptions</code>
+ <tr><td><a href=#attr-track-kind-chapters title=attr-track-kind-chapters>Chapters</a>
+ <td><code title=dom-track-kind-chapters>chapters</code>
+ <tr><td><a href=#attr-track-kind-metadata title=attr-track-kind-metadata>Metadata</a>
+ <td><code title=dom-track-kind-metadata>metadata</code>
+ </table><p>The <a href=#timed-track-label>timed track label</a> is the element's <a href=#track-label>track
+ label</a>.</p>
+
+ <p>The <a href=#timed-track-language>timed track language</a> is the element's
+ <a href=#track-language>track language</a>, if any, or the empty string
+ otherwise.</p>
+
+ <p>As the <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code>, <code title=attr-track-label><a href=#attr-track-label>label</a></code>, and <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> attributes are added,
+ removed, or changed, the <a href=#timed-track>timed track</a> must update
+ accordingly, as per the definitions above.</p>
+
+ <p class=note>Changes to the <a href=#track-url>track URL</a> are handled in
+ the algorithm below.</p>
+
+ <p class=XXX>...cues...</p>
+
+ <p>When a <code><a href=#the-track-element>track</a></code> element's parent element changes and
+ the new parent is a <a href=#media-element>media element</a>, then add the
+ <code><a href=#the-track-element>track</a></code> element's corresponding <a href=#timed-track>timed track</a>
+ to the <a href=#media-element>media element</a>'s <a href=#list-of-timed-tracks>list of timed
+ tracks</a>.</p>
+
+ <p>When a <code><a href=#the-track-element>track</a></code> element's parent element changes and
+ the old parent was a <a href=#media-element>media element</a>, then remove the
+ <code><a href=#the-track-element>track</a></code> element's corresponding <a href=#timed-track>timed track</a>
+ from the <a href=#media-element>media element</a>'s <a href=#list-of-timed-tracks>list of timed
+ tracks</a>.</p>
+
+ <p>When a <a href=#timed-track>timed track</a> corresponding to a
+ <code><a href=#the-track-element>track</a></code> element is added to a <a href=#media-element>media
+ element</a>'s <a href=#list-of-timed-tracks>list of timed tracks</a>, <span class=XXX>update the mode appropriately</span>.</p>
+
+ <p>When a <a href=#timed-track>timed track</a> corresponding to a
+ <code><a href=#the-track-element>track</a></code> element is created with <a href=#timed-track-mode>timed track
+ mode</a> set to <a href=#timed-track-hidden title="timed track hidden">hidden</a> or
+ <a href=#timed-track-showing title="timed track showing">showing</a>, and when a
+ <a href=#timed-track>timed track</a> corresponding to a <code><a href=#the-track-element>track</a></code>
+ element is created with <a href=#timed-track-mode>timed track mode</a> set to <a href=#timed-track-disabled title="timed track disabled">disabled</a> and subsequently
+ changes its <a href=#timed-track-mode>timed track mode</a> to <a href=#timed-track-hidden title="timed
+ track hidden">hidden</a> or <a href=#timed-track-showing title="timed track
+ showing">showing</a> for the first time, the user agent must
+ immediately and synchronously run the
+ following steps:</p>
+
+ <ol><li><p>Set the <a href=#timed-track-readiness-state>timed track readiness state</a> to <a href=#timed-track-loading title="timed track loading">loading</a>.</li>
+
+ <li><p>Let <var title="">URL</var> be the <a href=#track-url>track URL</a> of
+ the <code><a href=#the-track-element>track</a></code> element.</li>
+
+ <li><p>Asynchronously run the remaining steps, while continuing
+ with whatever task was responsible for creating the <a href=#timed-track>timed
+ track</a> or changing the <a href=#timed-track-mode>timed track
+ mode</a>.</li>
+
+ <li>
+
+ <p><i>Download</i>: <a href=#fetch>Fetch</a> <var title="">URL</var>, if
+ it isn't the empty string.</p><!-- http-origin privacy sensitive
+ -->
+
+ <p>The <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue
+ a task">queued</a> by the <a href=#fetch title=fetch>fetching
+ algorithm</a> on the <a href=#networking-task-source>networking task source</a> to
+ process the data as it is being fetched must <span class=XXX>...this is where cross-origin checks go</span>.</p>
+
+ <p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
+ any reason (network error, the server returns an error code, the
+ cross-origin checks mentioned above fail, etc), or if <var title="">URL</var> is the empty string, then <a href=#queue-a-task>queue a
+ task</a> to first change the <a href=#timed-track-readiness-state>timed track readiness state</a>
+ to <a href=#timed-track-failed-to-load title="timed track failed to load">failed to load</a>
+ and then <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code>
+ element; and then, once that <a href=#concept-task title=concept-task>task</a> is <a href=#queue-a-task title="queue a
+ task">queued</a>, move on to the step below labeled
+ <i>monitoring</i>.</p>
+
+ <p>If the <a href=#fetch title=fetch>fetching algorithm</a> does not
+ fail, then, when it completes, <a href=#queue-a-task>queue a task</a> to first
+ change the <a href=#timed-track-readiness-state>timed track readiness state</a> to <a href=#timed-track-loaded title="timed track loaded">loaded</a> and then <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-load>load</code> at
+ the <code><a href=#the-track-element>track</a></code> element; and then, once that <a href=#concept-task title=concept-task>task</a> is <a href=#queue-a-task title="queue a
+ task">queued</a>, move on to the step below labeled
+ <i>monitoring</i>.</p>
+
+ <p>If, while the <a href=#fetch title=fetch>fetching algorithm</a> is
+ active, either:</p>
+
+ <ul><li>the <a href=#track-url>track URL</a> changes so that it is no longer
+ equal to <var title="">URL</var>, while the <a href=#timed-track-mode>timed track
+ mode</a> is set to <a href=#timed-track-hidden title="timed track
+ hidden">hidden</a> or <a href=#timed-track-showing title="timed track
+ showing">showing</a>; or</li>
+
+ <li>the <a href=#timed-track-mode>timed track mode</a> changes to <a href=#timed-track-hidden title="timed track hidden">hidden</a> or <a href=#timed-track-showing title="timed
+ track showing">showing</a>, while the <a href=#track-url>track URL</a> is
+ not equal to <var title="">URL</var></li>
+
+ </ul><p>...then the user agent must run the following steps:</p>
+
+ <ol><li><p>Abort the <a href=#fetch title=fetch>fetching
+ algorithm</a>.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-abort>abort</code> at
+ the <code><a href=#the-track-element>track</a></code> element.</li>
+
+ <li><p>Let <var title="">URL</var> be the new <a href=#track-url>track
+ URL</a>.</li>
+
+ <li><p>Jump back to the top of the step labeled
+ <i>download</i>.</li>
+
+ </ol></li>
+
+ <li><p><i>Monitoring</i>: Wait until the <a href=#track-url>track URL</a> is
+ no longer equal to <var title="">URL</var>, at the same time as the
+ <a href=#timed-track-mode>timed track mode</a> is set to <a href=#timed-track-hidden title="timed track
+ hidden">hidden</a> or <a href=#timed-track-showing title="timed track
+ showing">showing</a>.</li>
+
+ <li><p>Jump to the step labeled <i>download</i>.</li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h6 id=guidelines-for-exposing-cues-in-various-formats-as-timed-track-cues><span class=secno>4.8.10.10.4 </span><dfn>Guidelines for exposing cues</dfn> in various formats as
+ <a href=#timed-track-cue title="timed track cue">timed track cues</a></h6>
+
+ <p class=XXX>...also, how to handle discarding cues that are
+ before startTime, for cues that are in-band</p>
+
+ </div>
+
+
+ <h6 id=timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</h6>
+
+<!--
+ // timed tracks
+ readonly attribute <span>TimedTrack</span>[] <span title="dom-media-tracks">tracks</span>;
+ <span>MutableTimedTrack</span> <span title="dom-media-addTrack">addTrack</span>(in DOMString label, in DOMString kind, in DOMString language);
+-->
+
+ <pre class=idl>interface <dfn id=timedtrack>TimedTrack</dfn> {
+ readonly attribute DOMString <span title=dom-TimedTrack-kind>kind</span>;
+ readonly attribute DOMString <span title=dom-TimedTrack-label>label</span>;
+ readonly attribute DOMString <span title=dom-TimedTrack-language>language</span>;
+
+ const unsigned short <span title=dom-TimedTrack-NONE>NONE</span> = 0;
+ const unsigned short <span title=dom-TimedTrack-LOADING>LOADING</span> = 1;
+ const unsigned short <span title=dom-TimedTrack-LOADED>LOADED</span> = 2;
+ const unsigned short <span title=dom-TimedTrack-ERROR>ERROR</span> = 3;
+ readonly attribute unsigned short <span title=dom-TimedTrack-readyState>readyState</span>;
+ readonly attribute <a href=#function>Function</a> <span title=dom-TimedTrack-onload>onload</span>;
+ readonly attribute <a href=#function>Function</a> <span title=dom-TimedTrack-onerror>onerror</span>;
+
+ const unsigned short <span title=dom-TimedTrack-OFF>OFF</span> = 0;
+ const unsigned short <span title=dom-TimedTrack-HIDDEN>HIDDEN</span> = 1;
+ const unsigned short <span title=dom-TimedTrack-SHOWING>SHOWING</span> = 2;
+ attribute unsigned short <span title=dom-TimedTrack-mode>mode</span>;
+
+ readonly attribute <a href=#timedtrackcuelist>TimedTrackCueList</a> <span title=dom-TimedTrack-cues>cues</span>;
+ readonly attribute <a href=#timedtrackcuelist>TimedTrackCueList</a> <span title=dom-TimedTrack-activeCues>activeCues</span>;
+ readonly attribute <a href=#function>Function</a> <span title=dom-TimedTrack-onentercue>onentercue</span>;
+ readonly attribute <a href=#function>Function</a> <span title=dom-TimedTrack-onexitcue>onexitcue</span>;
+};
+
+interface <dfn id=mutabletimedtrack>MutableTimedTrack</dfn> : <a href=#timedtrack>TimedTrack</a> {
+ void <span title=dom-MutableTimedTrack-addCue>addCue</span>(in <a href=#timedtrackcue>TimedTrackCue</a> cue);
+ void <span title=dom-MutableTimedTrack-removeCue>removeCue</span>(in <a href=#timedtrackcue>TimedTrackCue</a> cue);
+};
+
+interface <dfn id=timedtrackcuelist>TimedTrackCueList</dfn> {
+ readonly attribute unsigned long <span title=dom-TimedTrackCueList-length>length</span>;
+ getter <a href=#timedtrackcue>TimedTrackCue</a> (in unsigned long index);
+ <a href=#timedtrackcue>TimedTrackCue</a> getCueById(in DOMString id);
+};
+
+[Constructor(in DOMString id, in float startTime, in float endTime, in DOMString settings, in DOMString text, in optional boolean pauseOnExit)]
+interface <dfn id=timedtrackcue>TimedTrackCue</dfn> {
+ readonly attribute <a href=#timedtrack>TimedTrack</a> <span title=dom-TimedTrackCue-track>track</span>;
+ readonly attribute DOMString <span title=dom-TimedTrackCue-id>id</span>;
+
+ readonly attribute float <span title=dom-TimedTrackCue-startTime>startTime</span>;
+ readonly attribute float <span title=dom-TimedTrackCue-endTime>endTime</span>;
+ readonly attribute boolean <span title=dom-TimedTrackCue-pauseOnExit>pauseOnExit</span>;
+
+ readonly attribute DOMString <span title=dom-TimedTrackCue-direction>direction</span>;
+ readonly attribute boolean <span title=dom-TimedTrackCue-snapToLines>snapToLines</span>;
+ readonly attribute long <span title=dom-TimedTrackCue-linePosition>linePosition</span>;
+ readonly attribute long <span title=dom-TimedTrackCue-textPosition>textPosition</span>;
+ readonly attribute long <span title=dom-TimedTrackCue-size>size</span>;
+ readonly attribute DOMString <span title=dom-TimedTrackCue-alignment>alignment</span>;
+
+ readonly attribute DOMString <span title=dom-TimedTrackCue-voice>voice</span>;
+ DOMString <span title=dom-TimedTrackCue-getCueAsSource()>getCueAsSource</span>();
+ <a href=#documentfragment>DocumentFragment</a> <span title=dom-TimedTrackCue-getCueAsHTML()>getCueAsHTML</span>();
+};</pre>
+
+ <p class=XXX>domintro
+
+ <div class=impl>
+
+ <p class=XXX>...
+
+ <!-- XXX
+ Make sure that .cues and .activeCues doesn't change while script is
+ running, except for addCue/removeCue and the removal of all cues in
+ the face of a dynamic track.src change.
+ -->
+
+ </div>
+
+
+ <h6 id=cue-events><span class=secno>4.8.10.10.6 </span>Event definitions</h6>
+
+ <p class=XXX>...
+
+<!-- XXX
+CueEvent
+ readonly attribute TimedTrackCue cue;
+-->
+
+
+ <h5 id=websrt><span class=secno>4.8.10.11 </span>WebSRT</h5>
+
+ <p>The WebSRT format (Web Subtitle Resource Tracks) is a format
+ intended for marking up external timed track resources.</p>
+
+
+ <h6 id=syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</h6>
+
+ <p>A <dfn id=websrt-file>WebSRT file</dfn> must consist of a <a href=#websrt-file-body>WebSRT file
+ body</a> encoded as UTF-8.</p>
+
+ <p>A <dfn id=websrt-file-body>WebSRT file body</dfn> consists of zero or more <a href=#websrt-cue title="WebSRT cue">WebSRT cues</a> separated from each other by
+ two or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line
+ terminators</a>.</p>
+
+ <p>A <dfn id=websrt-cue>WebSRT cue</dfn> consists of the following components, in
+ the given order:</p>
+
+ <ol><li>Optionally, a <a href=#websrt-cue-identifier>WebSRT cue identifier</a>.</li>
+ <li><a href=#websrt-cue-timings>WebSRT cue timings</a>.</li>
+ <li>Optionally, <a href=#websrt-cue-settings>WebSRT cue settings</a>.</li>
+ <li>A <a href=#websrt-line-terminator>WebSRT line terminator</a>.</li>
+ <li>Optionally, a <a href=#websrt-voice-declaration>WebSRT voice declaration</a>.</li>
+ <li>One or more <a href=#websrt-cue-text-line title="WebSRT cue text line">WebSRT cue text lines</a>, each separated from the next by a <a href=#websrt-line-terminator>WebSRT line terminator</a>.</li>
+ <li>Zero or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line terminators</a>.</li>
+ </ol><p>A <dfn id=websrt-line-terminator>WebSRT line terminator</dfn> consists of one of the
+ following:</p>
+
+ <ul class=brief><li>A U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair.</li>
+ <li>A single U+000A LINE FEED (LF) character.</li>
+ <li>A single U+000D CARRIAGE RETURN (CR) character.</li>
+ </ul><p>A <dfn id=websrt-cue-identifier>WebSRT cue identifier</dfn> is any sequence of one or more
+ characters not containing the substring "<code title="">--&gt;</code>"
+ (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN
+ SIGN).</p>
+
+ <p>The <dfn id=websrt-cue-timings>WebSRT cue timings</dfn> part of a <a href=#websrt-cue>WebSRT
+ cue</a> consists of the following components, in the given
+ order:</p>
+
+ <ol><li>A <a href=#websrt-timestamp>WebSRT timestamp</a> representing the start time
+ offset of the cue.</li>
+
+ <li>Optionally, a U+0020 SPACE character.</li>
+
+ <li>The string "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS,
+ U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN).</li>
+
+ <li>Optionally, a U+0020 SPACE character.</li>
+
+ <li>A <a href=#websrt-timestamp>WebSRT timestamp</a> representing the end time
+ offset of the cue.</li>
+
+ </ol><p>The <dfn id=websrt-cue-settings>WebSRT cue settings</dfn> part of a <a href=#websrt-cue>WebSRT
+ cue</a> consists of the following components, in the given
+ order:</p>
+
+ <ol><li class=XXX>...
+
+ </ol><p class=XXX><dfn id=websrt-voice-declaration>WebSRT voice declaration</dfn>; <dfn id=websrt-cue-text-line>WebSRT cue text line</dfn>; <dfn id=websrt-timestamp>WebSRT timestamp</dfn></p>
+
+
+ <div class=impl>
+
+ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>
+
+ <p>A <dfn id=websrt-parser>WebSRT parser</dfn>, given an input byte stream and a
+ <a href=#timed-track-list-of-cues>timed track list of cues</a> <var title="">output</var>,
+ must convert the bytes into a string of Unicode characters by
+ interpreting them as UTF-8, and then must parse the resulting string
+ according to the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. A
+ <a href=#websrt-parser>WebSRT parser</a>, specifically its conversion and parsing
+ steps, is typically run asynchronously, with the input byte stream
+ being updated incrementally as the resource is downloaded; this is
+ called an <dfn id=incremental-websrt-parser>incremental WebSRT parser</dfn>.</p>
+
+ <p>When convering the bytes into Unicode characters, bytes or
+ sequences of bytes that are not valid UTF-8 sequences must be
+ interpreted as a U+FFFD REPLACEMENT CHARACTER, and all U+0000 NULL
+ characters must be replaced by U+FFFD REPLACEMENT CHARACTERs.</p>
+
+ <p>The <dfn id=websrt-parser-algorithm>WebSRT parser algorithm</dfn> is as follows:</p>
+
+ <ol><li><p>Let <var title="">input</var> be the string being
+ parsed.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string. In an <a href=#incremental-websrt-parser>incremental WebSRT parser</a>, when this
+ algorithm (or further algorithms that it uses) moves the <var title="">position</var> pointer, the user agent must wait until
+ appropriate further characters from the byte stream have been added
+ to <var title="">input</var> before moving the pointer, so that the
+ algorithm never reads past the end of the <var title="">input</var>
+ string. Once the byte stream has ended, and all characters have
+ been added to <var title="">input</var>, then the <var title="">position</var> pointer may, when so instructed by the
+ algorithms, be moved past the end of <var title="">input</var>.</li>
+
+ <li><p><i>Cue loop</i>: <a href=#collect-a-sequence-of-characters>Collect a sequence of
+ characters</a> that are either U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) characters.</li>
+
+ <li><p>Let <var title="">id</var> be the empty string.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
+ <em>not</em> U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF)
+ characters. Let <var title="">line</var> be those characters, if
+ any.</li>
+
+ <li><p>If <var title="">line</var> is the empty string, then jump
+ to the step labeled <i>end</i>.</li>
+
+ <li><p>If <var title="">line</var> contains the three-character
+ substring "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
+ HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then jump to the step
+ labeled <i>timing</i> below.</li>
+
+ <li><p>Let <var title="">id</var> be <var title="">line</var>.<p></li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump to the step labeled
+ <i>end</i>.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is a U+000D CARRIAGE RETURN (CR) character, advance <var title="">position</var> to the next character in <var title="">input</var>.</li>
+
+ <li><p>If the character indicated by <var title="">position</var>
+ is a U+000A LINE FEED (LF) character, advance <var title="">position</var> to the next character in <var title="">input</var>.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
+ <em>not</em> U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF)
+ characters. Let <var title="">line</var> be those characters, if
+ any.</li>
+
+ <li><p>If <var title="">line</var> is the empty string, then jump
+ to the step labeled <i>cue loop</i>.</li>
+
+ <li><p><i>Timings</i>: <span class=XXX>...</span></li>
+
+ <li><p><i>End</i>: The file has ended. Abort these steps. The
+ <a href=#websrt-parser>WebSRT parser</a> has finished.</li>
+
+ </ol></div>
+
+<!--TT-->
+
+
+ <h5 id=user-interface><span class=secno>4.8.10.12 </span>User interface</h5>
+
+ <p>The <dfn id=attr-media-controls title=attr-media-controls><code>controls</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. If present, it
+ indicates that the author has not provided a scripted controller and
+ would like the user agent to provide its own set of controls.</p>
+
+ <div class=impl>
+
+ <p>If the attribute is present, or if <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a> for the
+ <a href=#media-element>media element</a>, then the user agent should <dfn id=expose-a-user-interface-to-the-user>expose a
+ user interface to the user</dfn>. This user interface should include
+ features to begin playback, pause playback, seek to an arbitrary
+ position in the content (if the content supports arbitrary seeking),
+ change the volume, change the display of closed captions
+
+ <!-- XXX update this to mention timed tracks -->
+
+ or embedded
+ sign-language tracks, select different audio tracks or turn on audio
+ descriptions, and show the media content in manners more suitable to
+ the user (e.g. full-screen video or in an independent resizable
+ window). Other controls may also be made available.</p>
+
+ <p>Even when the attribute is absent, however, user agents may
+ provide controls to affect playback of the media resource
+ (e.g. play, pause, seeking, and volume controls), but such features
+ should not interfere with the page's normal rendering. For example,
+ such features could be exposed in the <a href=#media-element>media element</a>'s
+ context menu.</p>
+
+ <p>Where possible (specifically, for starting, stopping, pausing,
+ and unpausing playback, for muting or changing the volume of the
+ audio, and for seeking), user interface features exposed by the user
+ agent must be implemented in terms of the DOM API described above,
+ so that, e.g., all the same events fire.</p>
+
+ <p>The <dfn id=dom-media-controls title=dom-media-controls><code>controls</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current playback volume, as a number in the range
+ 0.0 to 1.0, where 0.0 is the quietest and 1.0 the loudest.</p>
+
+ <p>Can be set, to change the volume.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> if the new value is not
+ in the range 0.0 .. 1.0.</p>
+
+ </dd>
+
+ <dt><var title="">media</var> . <code title=dom-media-muted><a href=#dom-media-muted>muted</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns true if audio is muted, overriding the <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> attribute, and false if the
+ <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> attribute is being
+ honored.</p>
+
+ <p>Can be set, to change whether the audio is muted or not.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-media-volume title=dom-media-volume><code>volume</code></dfn>
+ attribute must return the playback volume of any audio portions of
+ the <a href=#media-element>media element</a>, in the range 0.0 (silent) to 1.0
+ (loudest). Initially, the volume must be 1.0, but user agents may
+ remember the last set value across sessions, on a per-site basis or
+ otherwise, so the volume may start at other values. On setting, if
+ the new value is in the range 0.0 to 1.0 inclusive, the attribute
+ must be set to the new value and the playback volume must be
+ correspondingly adjusted as soon as possible after setting the
+ attribute, with 0.0 being silent, and 1.0 being the loudest setting,
+ values in between increasing in loudness. The range need not be
+ linear. The loudest setting may be lower than the system's loudest
+ possible setting; for example the user could have set a maximum
+ volume. If the new value is outside the range 0.0 to 1.0 inclusive,
+ then, on setting, an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception must be
+ raised instead.</p>
+
+ <p>The <dfn id=dom-media-muted title=dom-media-muted><code>muted</code></dfn>
+ attribute must return true if the audio channels are muted and false
+ otherwise. Initially, the audio channels should not be muted
+ (false), but user agents may remember the last set value across
+ sessions, on a per-site basis or otherwise, so the muted state may
+ start as muted (true). On setting, the attribute must be set to the
+ new value; if the new value is true, audio playback for this
+ <a href=#media-resource>media resource</a> must then be muted, and if false, audio
+ playback must then be enabled.</p>
+
+ <p>Whenever either the <code title=dom-media-muted><a href=#dom-media-muted>muted</a></code> or
+ <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> attributes are changed,
+ the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> at the <a href=#media-element>media
+ element</a>.</p>
+
+ </div>
+
+
+
+
+ <h5 id=time-ranges><span class=secno>4.8.10.13 </span>Time ranges</h5>
+
+ <p>Objects implementing the <code><a href=#timeranges>TimeRanges</a></code> interface
+ represent a list of ranges (periods) of time.</p>
+
+ <pre class=idl>interface <dfn id=timeranges>TimeRanges</dfn> {
+ readonly attribute unsigned long <a href=#dom-timeranges-length title=dom-TimeRanges-length>length</a>;
+ float <a href=#dom-timeranges-start title=dom-TimeRanges-start>start</a>(in unsigned long index);
+ float <a href=#dom-timeranges-end title=dom-TimeRanges-end>end</a>(in unsigned long index);
+};</pre>
+
+ <dl class=domintro><dt><var title="">media</var> . <code title=dom-TimeRanges-length><a href=#dom-timeranges-length>length</a></code></dt>
+
+ <dd>
+
+ <p>Returns the number of ranges in the object.</p>
+
+ </dd>
+
+ <dt><var title="">time</var> = <var title="">media</var> . <code title=dom-TimeRanges-start><a href=#dom-timeranges-start>start</a></code>(<var title="">index</var>)</dt>
+
+ <dd>
+
+ <p>Returns the time for the start of the range with the given index.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> if the index is out of range.</p>
+
+ </dd>
+
+ <dt><var title="">time</var> = <var title="">media</var> . <code title=dom-TimeRanges-end><a href=#dom-timeranges-end>end</a></code>(<var title="">index</var>)</dt>
+
+ <dd>
+
+ <p>Returns the time for the end of the range with the given index.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> if the index is out of range.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-timeranges-length title=dom-TimeRanges-length><code>length</code></dfn>
+ IDL attribute must return the number of ranges represented by the object.</p>
+
+ <p>The <dfn id=dom-timeranges-start title=dom-TimeRanges-start><code>start(<var title="">index</var>)</code></dfn> method must return the position
+ of the start of the <var title="">index</var>th range represented by
+ the object, in seconds measured from the start of the timeline that
+ the object covers.</p>
+
+ <p>The <dfn id=dom-timeranges-end title=dom-TimeRanges-end><code>end(<var title="">index</var>)</code></dfn> method must return the position
+ of the end of the <var title="">index</var>th range represented by
+ the object, in seconds measured from the start of the timeline that
+ the object covers.</p>
+
+ <p>These methods must raise <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exceptions
+ if called with an <var title="">index</var> argument greater than or
+ equal to the number of ranges represented by the object.</p>
+
+ <p>When a <code><a href=#timeranges>TimeRanges</a></code> object is said to be a
+ <dfn id=normalized-timeranges-object>normalized <code>TimeRanges</code> object</dfn>, the ranges it
+ represents must obey the following criteria:</p>
+
+ <ul><li>The start of a range must be greater than the end of all
+ earlier ranges.</li>
+
+ <li>The start of a range must be less than the end of that same
+ range.</li>
+
+ </ul><p>In other words, the ranges in such an object are ordered, don't
+ overlap, aren't empty, and don't touch (adjacent ranges are folded
+ into one bigger range).</p>
+
+ <p>The timelines used by the objects returned by the <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>, <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> and <code title=dom-media-played><a href=#dom-media-played>played</a></code> IDL attributes of <a href=#media-element title="media element">media elements</a> must be the same as that
+ element's <a href=#media-resource>media resource</a>'s timeline.</p>
+
+ </div>
+
+
+ <h5 id=mediaevents><span class=secno>4.8.10.14 </span>Event summary</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The following events fire on <a href=#media-element title="media element">media
+ elements</a> as part of the processing model described above:</p>
+
+ <table><thead><tr><th>Event name
+ <th>Interface
+ <th>Dispatched when...
+ <th>Preconditions
+
+ <tbody><tr><td><dfn id=event-media-loadstart title=event-media-loadstart><code>loadstart</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent begins looking for <a href=#media-data>media data</a>, as part of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a>.
+ <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>
+ <tr><td><dfn id=event-media-progress title=event-media-progress><code>progress</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent is fetching <a href=#media-data>media data</a>.
+ <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>
+ <tr><td><dfn id=event-media-suspend title=event-media-suspend><code>suspend</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent is intentionally not currently fetching <a href=#media-data>media data</a>, but does not have the entire <a href=#media-resource>media resource</a> downloaded.
+ <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>
+ <tr><td><dfn id=event-media-abort title=event-media-abort><code>abort</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent stops fetching the <a href=#media-data>media data</a> before it is completely downloaded, but not due to an error.
+ <td><code title=dom-media-error><a href=#dom-media-error>error</a></code> is an object with the code <code title=dom-MediaError-MEDIA_ERR_ABORTED><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>.
+ <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals either <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, depending on when the download was aborted.
+ <tr><td><dfn id=event-media-error title=event-media-error><code>error</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>An error occurs while fetching the <a href=#media-data>media data</a>.
+ <td><code title=dom-media-error><a href=#dom-media-error>error</a></code> is an object with the code <code title=dom-MediaError-MEDIA_ERR_NETWORK><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code> or higher.
+ <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals either <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, depending on when the download was aborted.
+ <tr><td><dfn id=event-media-emptied title=event-media-emptied><code>emptied</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>A <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> was previously not in the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> state has just switched to that state (either because of a fatal error during load that's about to be reported, or because the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method was invoked while the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a> was already running).
+ <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>; all the IDL attributes are in their initial states.
+ <tr><td><dfn id=event-media-stalled title=event-media-stalled><code>stalled</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent is trying to fetch <a href=#media-data>media data</a>, but data is unexpectedly not forthcoming.
+ <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.
+
+ <tbody><tr><td><dfn id=event-media-play title=event-media-play><code>play</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>Playback has begun. Fired after the <code title=dom-media-play><a href=#dom-media-play>play()</a></code> method has returned, or when the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute has caused playback to begin.
+ <td><code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is newly false.
+ <tr><td><dfn id=event-media-pause title=event-media-pause><code>pause</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>Playback has been paused. Fired after the <code title=dom-media-pause><a href=#dom-media-pause>pause()</a></code> method has returned.
+ <td><code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is newly true.
+
+ <tbody><tr><td><dfn id=event-media-loadedmetadata title=event-media-loadedmetadata><code>loadedmetadata</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent has just determined the duration and dimensions of the <a href=#media-resource>media resource</a>
+<!--TT-->
+ and <a href=#the-timed-tracks-are-ready>the timed tracks are ready</a>.
+<!--TT-->
+ <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater for the first time.
+ <tr><td><dfn id=event-media-loadeddata title=event-media-loadeddata><code>loadeddata</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent can render the <a href=#media-data>media data</a> at the <a href=#current-playback-position>current playback position</a> for the first time.
+ <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> newly increased to <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater for the first time.
+ <tr><td><dfn id=event-media-waiting title=event-media-waiting><code>waiting</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>Playback has stopped because the next frame is not available, but the user agent expects that frame to become available in due course.
+ <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to or less than <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, and <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is false. Either <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is true, or the <a href=#current-playback-position>current playback position</a> is not contained in any of the ranges in <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>. It is possible for playback to stop for two other reasons without <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> being false, but those two reasons do not fire this event: maybe <a href=#ended-playback title="ended playback">playback ended</a>, or playback <a href=#stopped-due-to-errors>stopped due to errors</a>.
+ <tr><td><dfn id=event-media-playing title=event-media-playing><code>playing</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>Playback has started.
+ <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to or greater than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is false, <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is false, or the <a href=#current-playback-position>current playback position</a> is contained in one of the ranges in <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>.
+ <tr><td><dfn id=event-media-canplay title=event-media-canplay><code>canplay</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent can resume playback of the <a href=#media-data>media data</a>, but estimates that if playback were to be started now, the <a href=#media-resource>media resource</a> could not be rendered at the current playback rate up to its end without having to stop for further buffering of content.
+ <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> newly increased to <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or greater.
+ <tr><td><dfn id=event-media-canplaythrough title=event-media-canplaythrough><code>canplaythrough</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The user agent estimates that if playback were to be started now, the <a href=#media-resource>media resource</a> could be rendered at the current playback rate all the way to its end without having to stop for further buffering.
+ <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>.
+
+ <tbody><tr><td><dfn id=event-media-seeking title=event-media-seeking><code>seeking</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to true and the seek operation is taking long enough that the user agent has time to fire the event.
+ <td>
+ <tr><td><dfn id=event-media-seeked title=event-media-seeked><code>seeked</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to false.
+ <td>
+ <tr><td><dfn id=event-media-timeupdate title=event-media-timeupdate><code>timeupdate</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The <a href=#current-playback-position>current playback position</a> changed as part of normal playback or in an especially interesting way, for example discontinuously.
+ <td>
+ <tr><td><dfn id=event-media-ended title=event-media-ended><code>ended</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>Playback has stopped because the end of the <a href=#media-resource>media resource</a> was reached.
+ <td><code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> equals the end of the <a href=#media-resource>media resource</a>; <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> is true.
+
+ <tbody><tr><td><dfn id=event-media-ratechange title=event-media-ratechange><code>ratechange</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>Either the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> or the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute has just been updated.
+ <td>
+ <tr><td><dfn id=event-media-durationchange title=event-media-durationchange><code>durationchange</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute has just been updated.
+ <td>
+ <tr><td><dfn id=event-media-volumechange title=event-media-volumechange><code>volumechange</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>Either the <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> attribute or the <code title=dom-media-muted><a href=#dom-media-muted>muted</a></code> attribute has changed. Fired after the relevant attribute's setter has returned.
+ <td>
+ </table><div class=impl>
+
+ <h5 id=security-and-privacy-considerations><span class=secno>4.8.10.15 </span>Security and privacy considerations</h5>
+
+ <p>The main security and privacy implications of the
+ <code><a href=#video>video</a></code> and <code><a href=#audio>audio</a></code> elements come from the
+ ability to embed media cross-origin. There are two directions that
+ threats can flow: from hostile content to a victim page, and from a
+ hostile page to victim content.</p>
+
+ <hr><p>If a victim page embeds hostile content, the threat is that the
+ content might contain scripted code that attempts to interact with
+ the <code><a href=#document>Document</a></code> that embeds the content. To avoid this,
+ user agents must ensure that there is no access from the content to
+ the embedding page. In the case of media content that uses DOM
+ concepts, the embedded content must be treated as if it was in its
+ own unrelated <a href=#top-level-browsing-context>top-level browsing context</a>.</p>
+
+ <p class=example>For instance, if an SVG animation was embedded in
+ a <code><a href=#video>video</a></code> element, the user agent would not give it
+ access to the DOM of the outer page. From the perspective of scripts
+ in the SVG resource, the SVG file would appear to be in a lone
+ top-level browsing context with no parent.</p>
+
+ <hr><p>If a hostile page embeds victim content, the threat is that the
+ embedding page could obtain information from the content that it
+ would not otherwise have access to. The API does expose some
+ information: the existence of the media, its type, its duration, its
+ size, and the performance characteristics of its host. Such
+ information is already potentially problematic, but in practice the
+ same information can more or less be obtained using the
+ <code><a href=#the-img-element>img</a></code> element, and so it has been deemed acceptable.</p>
+
+ <p>However, significantly more sensitive information could be
+ obtained if the user agent further exposes metadata within the
+ content such as subtitles or chapter titles. This version of the API
+ does not expose such information. Future extensions to this API will
+ likely reuse a mechanism such as CORS to check that the embedded
+ content's site has opted in to exposing such information. <a href=#refsCORS>[CORS]</a></p> <!-- v2 -->
+
+ <p class=example>An attacker could trick a user running within a
+ corporate network into visiting a site that attempts to load a video
+ from a previously leaked location on the corporation's intranet. If
+ such a video included confidential plans for a new product, then
+ being able to read the subtitles would present a confidentiality
+ breach.</p>
+
+ </div>
+
+
+ <h4 id=the-canvas-element><span class=secno>4.8.11 </span>The <dfn id=canvas><code>canvas</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#embedded-content>Embedded content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#transparent>Transparent</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code></dd>
+ <dd><code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmlcanvaselement>HTMLCanvasElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute unsigned long <a href=#dom-canvas-width title=dom-canvas-width>width</a>;
+ attribute unsigned long <a href=#dom-canvas-height title=dom-canvas-height>height</a>;
+
+ DOMString <a href=#dom-canvas-todataurl title=dom-canvas-toDataURL>toDataURL</a>(in optional DOMString type, in any... args);
+
+ object <a href=#dom-canvas-getcontext title=dom-canvas-getContext>getContext</a>(in DOMString contextId);
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-canvas-element>canvas</a></code> element provides scripts with a
+ resolution-dependent bitmap canvas, which can be used for rendering
+ graphs, game graphics, or other visual images on the fly.</p>
+
+ <p>Authors should not use the <code><a href=#the-canvas-element>canvas</a></code> element in a
+ document when a more suitable element is available. For example, it
+ is inappropriate to use a <code><a href=#the-canvas-element>canvas</a></code> element to render a
+ page heading: if the desired presentation of the heading is
+ graphically intense, it should be marked up using appropriate
+ elements (typically <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) and then styled using CSS and
+ supporting technologies such as XBL.</p>
+
+ <p>When authors use the <code><a href=#the-canvas-element>canvas</a></code> element, they must also
+ provide content that, when presented to the user, conveys
+ essentially the same function or purpose as the bitmap canvas. This
+ content may be placed as content of the <code><a href=#the-canvas-element>canvas</a></code>
+ element. The contents of the <code><a href=#the-canvas-element>canvas</a></code> element, if any,
+ are the element's <a href=#fallback-content>fallback content</a>.</p>
+
+ <p>In interactive visual media, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the
+ <code><a href=#the-canvas-element>canvas</a></code> element, and if support for <code><a href=#the-canvas-element>canvas</a></code>
+ elements has been enabled, the <code><a href=#the-canvas-element>canvas</a></code> element
+ <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> consisting of
+ a dynamically created image.</p>
+
+ <p>In non-interactive, static, visual media, if the
+ <code><a href=#the-canvas-element>canvas</a></code> element has been previously painted on (e.g. if
+ the page was viewed in an interactive visual medium and is now being
+ printed, or if some script that ran during the page layout process
+ painted on the element), then the <code><a href=#the-canvas-element>canvas</a></code> element
+ <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> with the
+ current image and size. Otherwise, the element represents its
+ <a href=#fallback-content>fallback content</a> instead.</p>
+
+ <p>In non-visual media, and in visual media if <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a> for the
+ <code><a href=#the-canvas-element>canvas</a></code> element or if support for <code><a href=#the-canvas-element>canvas</a></code>
+ elements has been disabled, the <code><a href=#the-canvas-element>canvas</a></code> element
+ <a href=#represents>represents</a> its <a href=#fallback-content>fallback content</a>
+ instead.</p>
+
+ <!-- CANVAS-FOCUS-FALLBACK -->
+ <p>When a <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a>
+ <a href=#embedded-content>embedded content</a>, the user can still focus descendants
+ of the <code><a href=#the-canvas-element>canvas</a></code> element (in the <a href=#fallback-content>fallback
+ content</a>). This allows authors to make an interactive canvas
+ keyboard-focusable: authors should have a one-to-one mapping of
+ interactive regions to focusable elements in the <a href=#fallback-content>fallback
+ content</a>.</p>
+
+ <p>The <code><a href=#the-canvas-element>canvas</a></code> element has two attributes to control the
+ size of the coordinate space: <dfn id=attr-canvas-width title=attr-canvas-width><code>width</code></dfn> and <dfn id=attr-canvas-height title=attr-canvas-height><code>height</code></dfn>. These
+ attributes, when specified, must have values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid non-negative
+ integers</a>. <span class=impl>The <a href=#rules-for-parsing-non-negative-integers>rules for parsing
+ non-negative integers</a> must be used to obtain their numeric
+ values. If an attribute is missing, or if parsing its value returns
+ an error, then the default value must be used instead.</span> The
+ <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> attribute defaults to
+ 300, and the <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code>
+ attribute defaults to 150.</p>
+
+ <p>The intrinsic dimensions of the <code><a href=#the-canvas-element>canvas</a></code> element equal
+ the size of the coordinate space, with the numbers interpreted in
+ CSS pixels. However, the element can be sized arbitrarily by a
+ style sheet. During rendering, the image is scaled to fit this layout
+ size.</p>
+
+ <div class=impl>
+
+ <p>The size of the coordinate space does not necessarily represent
+ the size of the actual bitmap that the user agent will use
+ internally or during rendering. On high-definition displays, for
+ instance, the user agent may internally use a bitmap with two device
+ pixels per unit in the coordinate space, so that the rendering
+ remains at high quality throughout.</p>
+
+ <p>When the <code><a href=#the-canvas-element>canvas</a></code> element is created, and subsequently
+ whenever the <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> attributes are set (whether
+ to a new value or to the previous value), the bitmap and any
+ associated contexts must be cleared back to their initial state and
+ reinitialized with the newly specified coordinate space
+ dimensions.</p>
+
+ <p>When the canvas is initialized, its bitmap must be cleared to
+ transparent black.</p>
+
+ <p>The <dfn id=dom-canvas-width title=dom-canvas-width><code>width</code></dfn> and
+ <dfn id=dom-canvas-height title=dom-canvas-height><code>height</code></dfn> IDL
+ attributes must <a href=#reflect>reflect</a> the respective content
+ attributes of the same name.</p>
+
+ </div>
+
+ <div class=example>
+ <p>Only one square appears to be drawn in the following example:</p>
+ <pre> // canvas is a reference to a &lt;canvas&gt; element
+ var context = canvas.getContext('2d');
+ context.fillRect(0,0,50,50);
+ canvas.setAttribute('width', '300'); // clears the canvas
+ context.fillRect(0,100,50,50);
+ canvas.width = canvas.width; // clears the canvas
+ context.fillRect(100,0,50,50); // only this square remains</pre>
+ </div>
+
+ <p>To draw on the canvas, authors must first obtain a reference to a
+ <dfn id=context>context</dfn> using the <dfn id=dom-canvas-getcontext title=dom-canvas-getContext><code>getContext(<var title="">contextId</var>)</code></dfn> method of the
+ <code><a href=#the-canvas-element>canvas</a></code> element.</p>
+
+ <dl class=domintro><dt><var title="">context</var> = <var title="">canvas</var> . <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext</a></code>(<var title="">contextId</var>)</dt>
+
+ <dd>
+
+ <p>Returns an object that exposes an API for drawing on the canvas.</p>
+
+ <p>Returns null if the given context ID is not supported.</p>
+
+ </dd>
+
+ </dl><p>This specification only defines one context, with the name "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>". <span class=impl>If <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> is called with
+ that exact string for its <var title="">contextId</var> argument,
+ then the UA must return a reference to an object implementing
+ <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>. Other specifications may
+ define their own contexts, which would return different
+ objects.</span></p>
+
+
+
+ <div class=impl>
+
+ <p>Vendors may also define experimental contexts using the syntax
+ <code><var title="">vendorname</var>-<var title="">context</var></code>, for example, <code>moz-3d</code>.</p>
+
+ <p>When the UA is passed an empty string or a string specifying a
+ context that it does not support, then it must return null. String
+ comparisons must be <a href=#case-sensitive>case-sensitive</a>.</p>
+
+ </div>
+
+ <hr><dl class=domintro><dt><var title="">url</var> = <var title="">canvas</var> . <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL</a></code>( [ <var title="">type</var>, ... ])</dt>
+
+ <dd>
+
+ <p>Returns a <code title="">data:</code> URL for the image in the
+ canvas.</p>
+
+ <p>The first argument, if provided, controls the type of the image
+ to be returned (e.g. PNG or JPEG). The default is <code title="">image/png</code>; that type is also used if the given
+ type isn't supported. The other arguments are specific to the
+ type, and control the way that the image is generated, as given in
+ the table below.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-canvas-todataurl title=dom-canvas-toDataURL><code>toDataURL()</code></dfn> method
+ must, when called with no arguments, return a <code title="">data:</code> URL containing a representation of the image
+ as a PNG file. <a href=#refsPNG>[PNG]</a></p>
+
+ <p>If the canvas has no pixels (i.e. either its horizontal dimension
+ or its vertical dimension is zero) then the method must return the
+ string "<code title="">data:,</code>". (This is the shortest <code title="">data:</code> URL; it represents the empty string in a <code title="">text/plain</code> resource.)</p>
+
+ <p>When the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL(<var title="">type</var>)</a></code> method is called with one <em>or
+ more</em> arguments, it must return a <code title="">data:</code>
+ URL containing a representation of the image in the format given by
+ <var title="">type</var>. The possible values are <a href=#mime-type title="MIME
+ type">MIME types</a> with no parameters, for example
+ <code>image/png</code>, <code>image/jpeg</code>, or even maybe
+ <code>image/svg+xml</code> if the implementation actually keeps
+ enough information to reliably render an SVG image from the
+ canvas.</p>
+
+ <p>For image types that do not support an alpha channel, the image
+ must be composited onto a solid black background using the
+ source-over operator, and the resulting image must be the one used
+ to create the <code title="">data:</code> URL.</p>
+
+ <p>Only support for <code>image/png</code> is required. User agents
+ may support other types. If the user agent does not support the
+ requested type, it must return the image using the PNG format.</p>
+
+ <p>User agents must <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">convert the
+ provided type to ASCII lowercase</a> before establishing if they
+ support that type and before creating the <code title="">data:</code> URL.</p>
+
+ </div>
+
+ <p class=note>When trying to use types other than
+ <code>image/png</code>, authors can check if the image was really
+ returned in the requested format by checking to see if the returned
+ string starts with one the exact strings "<code title="">data:image/png,</code>" or "<code title="">data:image/png;</code>". If it does, the image is PNG, and
+ thus the requested type was not supported. (The one exception to
+ this is if the canvas has either no height or no width, in which
+ case the result might simply be "<code title="">data:,</code>".)</p>
+
+ <div class=impl>
+
+ <p>If the method is invoked with the first argument giving a type
+ corresponding to one of the types given in the first column of the
+ following table, and the user agent supports that type, then the
+ subsequent arguments, if any, must be treated as described in the
+ second cell of that row.</p>
+
+ </div>
+
+ <table><thead><tr><th> Type <th> Other arguments
+ <tbody><tr><td> image/jpeg
+ <td> The second argument<span class=impl>, if it</span> is a
+ number in the range 0.0 to 1.0 inclusive<span class=impl>, must
+ be</span> treated as the desired quality level. <span class=impl>If it is not a number or is outside that range, the
+ user agent must use its default value, as if the argument had
+ been omitted.</span>
+ </table><div class=impl>
+
+ <p>For the purposes of these rules, an argument is considered to be
+ a number if it is converted to an IDL double value by the rules for
+ handling arguments of type <code title="">any</code> in the Web IDL
+ specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
+
+ <p>Other arguments must be ignored and must not cause the user agent
+ to raise an exception. A future version of this specification will
+ probably define other parameters to be passed to <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> to allow authors to
+ more carefully control compression settings, image metadata,
+ etc.</p>
+
+ </div>
+
+
+
+ <div data-component="HTML Canvas 2D Context (editor: Ian Hickson)">
+
+ <h5 id=2dcontext><span class=secno>4.8.11.1 </span>The 2D context</h5>
+
+ <!-- v2: we're on v4. suggestions for next version are marked v5. -->
+
+ <p>When the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code>
+ method of a <code><a href=#the-canvas-element>canvas</a></code> element is invoked with <dfn id=canvas-context-2d title=canvas-context-2d><code>2d</code></dfn> as the argument, a
+ <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is returned.</p>
+
+
+
+ <div class=impl>
+
+
+ <p>There is only one <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
+ per canvas, so calling the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method with the
+ <code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code> argument a second time
+ must return the same object.</p>
+
+ </div>
+
+ <p>The 2D context represents a flat Cartesian surface whose origin
+ (0,0) is at the top left corner, with the coordinate space having
+ <var title="">x</var> values increasing when going right, and <var title="">y</var> values increasing when going down.</p>
+
+ <pre class=idl>interface <dfn id=canvasrenderingcontext2d>CanvasRenderingContext2D</dfn> {
+
+ // back-reference to the canvas
+ readonly attribute <a href=#htmlcanvaselement>HTMLCanvasElement</a> <a href=#dom-context-2d-canvas title=dom-context-2d-canvas>canvas</a>;
+
+ // state
+ void <a href=#dom-context-2d-save title=dom-context-2d-save>save</a>(); // push state on state stack
+ void <a href=#dom-context-2d-restore title=dom-context-2d-restore>restore</a>(); // pop state stack and restore state
+<!--
+ // v5 we've also received requests for:
+ attribute boolean <span title="dom-context-2d-forceHighQuality">forceHighQuality</span> // (default false)
+ // when enabled, it would prevent the UA from falling back on lower-quality but faster rendering routines
+ // useful e.g. for when an image manipulation app uses <canvas> both for UI previews and the actual work
+-->
+ // transformations (default transform is the identity matrix)
+ void <a href=#dom-context-2d-scale title=dom-context-2d-scale>scale</a>(in float x, in float y);
+ void <a href=#dom-context-2d-rotate title=dom-context-2d-rotate>rotate</a>(in float angle);
+ void <a href=#dom-context-2d-translate title=dom-context-2d-translate>translate</a>(in float x, in float y);
+ void <a href=#dom-context-2d-transform title=dom-context-2d-transform>transform</a>(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy);
+ void <a href=#dom-context-2d-settransform title=dom-context-2d-setTransform>setTransform</a>(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy);
+<!--
+ // v5 we've also received requests for:
+ void skew(...);
+ void reflect(...); // or mirror(...)
+-->
+ // compositing
+ attribute float <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>globalAlpha</a>; // (default 1.0)
+ attribute DOMString <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>globalCompositeOperation</a>; // (default source-over)
+<!--
+ // v5 we've also received requests for:
+ - turning off antialiasing to avoid seams when patterns are painted next to each other
+ - might be better to overdraw?
+ - might be better to just draw at a higher res then downsample, like for 3d?
+ - nested layers
+ - the ability to composite an entire set of drawing operations with one shadow all at once
+ http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/015567.html
+-->
+ // colors and styles
+ attribute any <a href=#dom-context-2d-strokestyle title=dom-context-2d-strokeStyle>strokeStyle</a>; // (default black)
+ attribute any <a href=#dom-context-2d-fillstyle title=dom-context-2d-fillStyle>fillStyle</a>; // (default black)
+ <a href=#canvasgradient>CanvasGradient</a> <a href=#dom-context-2d-createlineargradient title=dom-context-2d-createLinearGradient>createLinearGradient</a>(in float x0, in float y0, in float x1, in float y1);
+ <a href=#canvasgradient>CanvasGradient</a> <a href=#dom-context-2d-createradialgradient title=dom-context-2d-createRadialGradient>createRadialGradient</a>(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1);
+ <a href=#canvaspattern>CanvasPattern</a> <a href=#dom-context-2d-createpattern title=dom-context-2d-createPattern>createPattern</a>(in <a href=#htmlimageelement>HTMLImageElement</a> image, in DOMString repetition);
+ <a href=#canvaspattern>CanvasPattern</a> <a href=#dom-context-2d-createpattern title=dom-context-2d-createPattern>createPattern</a>(in <a href=#htmlcanvaselement>HTMLCanvasElement</a> image, in DOMString repetition);
+ <a href=#canvaspattern>CanvasPattern</a> <a href=#dom-context-2d-createpattern title=dom-context-2d-createPattern>createPattern</a>(in <a href=#htmlvideoelement>HTMLVideoElement</a> image, in DOMString repetition);
+
+ // line caps/joins
+ attribute float <a href=#dom-context-2d-linewidth title=dom-context-2d-lineWidth>lineWidth</a>; // (default 1)
+ attribute DOMString <a href=#dom-context-2d-linecap title=dom-context-2d-lineCap>lineCap</a>; // "butt", "round", "square" (default "butt")
+ attribute DOMString <a href=#dom-context-2d-linejoin title=dom-context-2d-lineJoin>lineJoin</a>; // "round", "bevel", "miter" (default "miter")
+ attribute float <a href=#dom-context-2d-miterlimit title=dom-context-2d-miterLimit>miterLimit</a>; // (default 10)
+
+ // shadows
+ attribute float <a href=#dom-context-2d-shadowoffsetx title=dom-context-2d-shadowOffsetX>shadowOffsetX</a>; // (default 0)
+ attribute float <a href=#dom-context-2d-shadowoffsety title=dom-context-2d-shadowOffsetY>shadowOffsetY</a>; // (default 0)
+ attribute float <a href=#dom-context-2d-shadowblur title=dom-context-2d-shadowBlur>shadowBlur</a>; // (default 0)
+ attribute DOMString <a href=#dom-context-2d-shadowcolor title=dom-context-2d-shadowColor>shadowColor</a>; // (default transparent black)
+
+ // rects
+ void <a href=#dom-context-2d-clearrect title=dom-context-2d-clearRect>clearRect</a>(in float x, in float y, in float w, in float h);
+ void <a href=#dom-context-2d-fillrect title=dom-context-2d-fillRect>fillRect</a>(in float x, in float y, in float w, in float h);
+ void <a href=#dom-context-2d-strokerect title=dom-context-2d-strokeRect>strokeRect</a>(in float x, in float y, in float w, in float h);
+
+ // path API
+ void <a href=#dom-context-2d-beginpath title=dom-context-2d-beginPath>beginPath</a>();
+ void <a href=#dom-context-2d-closepath title=dom-context-2d-closePath>closePath</a>();
+ void <a href=#dom-context-2d-moveto title=dom-context-2d-moveTo>moveTo</a>(in float x, in float y);
+ void <a href=#dom-context-2d-lineto title=dom-context-2d-lineTo>lineTo</a>(in float x, in float y);
+ void <a href=#dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo>quadraticCurveTo</a>(in float cpx, in float cpy, in float x, in float y);
+ void <a href=#dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo>bezierCurveTo</a>(in float cp1x, in float cp1y, in float cp2x, in float cp2y, in float x, in float y);
+ void <a href=#dom-context-2d-arcto title=dom-context-2d-arcTo>arcTo</a>(in float x1, in float y1, in float x2, in float y2, in float radius);
+ void <a href=#dom-context-2d-rect title=dom-context-2d-rect>rect</a>(in float x, in float y, in float w, in float h);
+ void <a href=#dom-context-2d-arc title=dom-context-2d-arc>arc</a>(in float x, in float y, in float radius, in float startAngle, in float endAngle, in boolean anticlockwise);
+ void <a href=#dom-context-2d-fill title=dom-context-2d-fill>fill</a>();
+ void <a href=#dom-context-2d-stroke title=dom-context-2d-stroke>stroke</a>();
+ void <a href=#dom-context-2d-clip title=dom-context-2d-clip>clip</a>();
+ boolean <a href=#dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath>isPointInPath</a>(in float x, in float y);
+
+ // focus management
+ boolean <a href=#dom-context-2d-drawfocusring title=dom-context-2d-drawFocusRing>drawFocusRing</a>(in <a href=#element>Element</a> element, in float xCaret, in float yCaret, in optional boolean canDrawCustom);
+
+ // text
+ attribute DOMString <a href=#dom-context-2d-font title=dom-context-2d-font>font</a>; // (default 10px sans-serif)
+ attribute DOMString <a href=#dom-context-2d-textalign title=dom-context-2d-textAlign>textAlign</a>; // "start", "end", "left", "right", "center" (default: "start")
+ attribute DOMString <a href=#dom-context-2d-textbaseline title=dom-context-2d-textBaseline>textBaseline</a>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
+ void <a href=#dom-context-2d-filltext title=dom-context-2d-fillText>fillText</a>(in DOMString text, in float x, in float y, in optional float maxWidth);
+ void <a href=#dom-context-2d-stroketext title=dom-context-2d-strokeText>strokeText</a>(in DOMString text, in float x, in float y, in optional float maxWidth);<!-- v5DVT
+ void <span title="dom-context-2d-fillVerticalText">fillVerticalText</span>(in DOMString text, in float x, in float y, in optional float maxHeight);
+ void <span title="dom-context-2d-strokeVerticalText">strokeVerticalText</span>(in DOMString text, in float x, in float y, in optional float maxHeight); -->
+ <a href=#textmetrics>TextMetrics</a> <a href=#dom-context-2d-measuretext title=dom-context-2d-measureText>measureText</a>(in DOMString text);
+
+ // drawing images
+ void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(in <a href=#htmlimageelement>HTMLImageElement</a> image, in float dx, in float dy, in optional float dw, in float dh);
+ void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(in <a href=#htmlimageelement>HTMLImageElement</a> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
+ void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(in <a href=#htmlcanvaselement>HTMLCanvasElement</a> image, in float dx, in float dy, in optional float dw, in float dh);
+ void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(in <a href=#htmlcanvaselement>HTMLCanvasElement</a> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
+ void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(in <a href=#htmlvideoelement>HTMLVideoElement</a> image, in float dx, in float dy, in optional float dw, in float dh);
+ void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(in <a href=#htmlvideoelement>HTMLVideoElement</a> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
+
+ // pixel manipulation
+ <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-createimagedata title=dom-context-2d-createImageData>createImageData</a>(in float sw, in float sh);
+ <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-createimagedata title=dom-context-2d-createImageData>createImageData</a>(in <a href=#imagedata>ImageData</a> imagedata);
+ <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-getimagedata title=dom-context-2d-getImageData>getImageData</a>(in float sx, in float sy, in float sw, in float sh);
+ void <a href=#dom-context-2d-putimagedata title=dom-context-2d-putImageData>putImageData</a>(in <a href=#imagedata>ImageData</a> imagedata, in float dx, in float dy, in optional float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight);
+};
+
+interface <dfn id=canvasgradient>CanvasGradient</dfn> {
+ // opaque object
+ void <a href=#dom-canvasgradient-addcolorstop title=dom-canvasgradient-addColorStop>addColorStop</a>(in float offset, in DOMString color);
+};
+
+interface <dfn id=canvaspattern>CanvasPattern</dfn> {
+ // opaque object
+};
+
+interface <dfn id=textmetrics>TextMetrics</dfn> {
+ readonly attribute float <a href=#dom-textmetrics-width title=dom-textmetrics-width>width</a>;
+};
+
+interface <dfn id=imagedata>ImageData</dfn> {
+ readonly attribute unsigned long <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
+ readonly attribute unsigned long <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
+ readonly attribute <a href=#canvaspixelarray>CanvasPixelArray</a> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
+};
+
+interface <dfn id=canvaspixelarray>CanvasPixelArray</dfn> {
+ readonly attribute unsigned long <a href=#dom-canvaspixelarray-length title=dom-canvaspixelarray-length>length</a>;
+ <a href=#dom-canvaspixelarray-get title=dom-CanvasPixelArray-get>getter</a> octet (in unsigned long index);
+ <a href=#dom-canvaspixelarray-set title=dom-CanvasPixelArray-set>setter</a> void (in unsigned long index, in octet value);
+};</pre>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-canvas><a href=#dom-context-2d-canvas>canvas</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#the-canvas-element>canvas</a></code> element.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-canvas title=dom-context-2d-canvas><code>canvas</code></dfn>
+ attribute must return the <code><a href=#the-canvas-element>canvas</a></code> element that the
+ context paints on.</p>
+
+ <p>Except where otherwise specified, for the 2D context interface,
+ any method call with a numeric argument whose value is infinite or a
+ NaN value must be ignored.</p>
+
+ <!--
+ Philip Taylor wrote:
+ > My experience with some 3d canvas code is that infinities come up in
+ > naturally harmless places, e.g. having a function that scales by x then
+ > translates by 1/x and wanting it to work when x=0 (which ought to draw
+ > nothing, since anything it draws is zero pixels wide), and it's a bit
+ > annoying to track down and fix those issues, so I'd probably like it if
+ > they were harmless in canvas methods. Opera appears to silently not draw
+ > anything if the transformation matrix is not finite, but Firefox throws
+ > exceptions when passing in non-finite arguments.
+ -->
+
+ <p>Whenever the CSS value <code title="">currentColor</code> is used
+ as a color in this API, the "computed value of the 'color' property"
+ for the purposes of determining the computed value of the <code title="">currentColor</code> keyword is the computed value of the
+ 'color' property on the element in question at the time that the
+ color is specified (e.g. when the appropriate attribute is set, or
+ when the method is called; not when the color is rendered or
+ otherwise used). If the computed value of the 'color' property is
+ undefined for a particular case (e.g. because the element is not
+ <a href=#in-a-document>in a <code>Document</code></a>), then the "computed value
+ of the 'color' property" for the purposes of determining the
+ computed value of the <code title="">currentColor</code> keyword is
+ fully opaque black. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
+
+ </div>
+
+
+
+ <h6 id=the-canvas-state><span class=secno>4.8.11.1.1 </span>The canvas state</h6>
+
+ <p>Each context maintains a stack of drawing states. <dfn id=drawing-state title="drawing state">Drawing states</dfn> consist of:</p>
+
+ <ul class=brief><li>The current <a href=#transformations title=dom-context-2d-transformation>transformation matrix</a>.</li>
+ <li>The current <a href=#clipping-region>clipping region</a>.</li>
+ <li>The current values of the following attributes: <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>, <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>, <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code>, <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code>, <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code>, <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>, <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>, <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>, <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code>, <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>.</li>
+ </ul><p class=note>The current path and the current bitmap are not part
+ of the drawing state. The current path is persistent, and can only
+ be reset using the <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath()</a></code> method. The
+ current bitmap is a property of the canvas, not the context.</p>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-save><a href=#dom-context-2d-save>save</a></code>()</dt>
+
+ <dd>
+
+ <p>Pushes the current state onto the stack.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-restore><a href=#dom-context-2d-restore>restore</a></code>()</dt>
+
+ <dd>
+
+ <p>Pops the top state on the stack, restoring the context to that state.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-save title=dom-context-2d-save><code>save()</code></dfn>
+ method must push a copy of the current drawing state onto the
+ drawing state stack.</p>
+
+ <p>The <dfn id=dom-context-2d-restore title=dom-context-2d-restore><code>restore()</code></dfn> method
+ must pop the top entry in the drawing state stack, and reset the
+ drawing state it describes. If there is no saved state, the method
+ must do nothing.</p>
+
+ <!-- v5
+idea from Mihai:
+> 5. Drawing states should be saveable with IDs, and for easier restoring.
+>
+> save(id)
+> restore(id)
+>
+> If id is not provided, then save() works as defined now. The same for
+> restore().
+>
+> Currently, it's not trivial to save and restore a specific state.
+...and from Philip:
+> I think a more convenient syntax would be:
+> var state = ctx.save();
+> ctx.restore(state);
+> But how would it interact with normal calls to ctx.restore()?
+ -->
+
+ </div>
+
+
+ <h6 id=transformations><span class=secno>4.8.11.1.2 </span><dfn title=dom-context-2d-transformation>Transformations</dfn></h6>
+
+ <p>The transformation matrix is applied to coordinates when creating
+ shapes and paths.</p> <!-- conformance criteria for actual drawing
+ are described in the various sections below -->
+
+ <div class=impl>
+
+ <p>When the context is created, the transformation matrix must
+ initially be the identity transform. It may then be adjusted using
+ the transformation methods.</p>
+
+ <p>The transformations must be performed in reverse order. For
+ instance, if a scale transformation that doubles the width is
+ applied, followed by a rotation transformation that rotates drawing
+ operations by a quarter turn, and a rectangle twice as wide as it is
+ tall is then drawn on the canvas, the actual result will be a
+ square.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-scale><a href=#dom-context-2d-scale>scale</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Changes the transformation matrix to apply a scaling transformation with the given characteristics.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-rotate><a href=#dom-context-2d-rotate>rotate</a></code>(<var title="">angle</var>)</dt>
+
+ <dd>
+
+ <p>Changes the transformation matrix to apply a rotation transformation with the given characteristics. The angle is in radians.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-translate><a href=#dom-context-2d-translate>translate</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Changes the transformation matrix to apply a translation transformation with the given characteristics.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-transform><a href=#dom-context-2d-transform>transform</a></code>(<var title="">m11</var>, <var title="">m12</var>, <var title="">m21</var>, <var title="">m22</var>, <var title="">dx</var>, <var title="">dy</var>)</dt>
+
+ <dd>
+
+ <p>Changes the transformation matrix to apply the matrix given by the arguments as described below.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-setTransform><a href=#dom-context-2d-settransform>setTransform</a></code>(<var title="">m11</var>, <var title="">m12</var>, <var title="">m21</var>, <var title="">m22</var>, <var title="">dx</var>, <var title="">dy</var>)</dt>
+
+ <dd>
+
+ <p>Changes the transformation matrix <em>to</em> the matrix given by the arguments as described below.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-scale title=dom-context-2d-scale><code>scale(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
+ add the scaling transformation described by the arguments to the
+ transformation matrix. The <var title="">x</var> argument represents
+ the scale factor in the horizontal direction and the <var title="">y</var> argument represents the scale factor in the
+ vertical direction. The factors are multiples.</p>
+
+ <p>The <dfn id=dom-context-2d-rotate title=dom-context-2d-rotate><code>rotate(<var title="">angle</var>)</code></dfn> method must add the rotation
+ transformation described by the argument to the transformation
+ matrix. The <var title="">angle</var> argument represents a
+ clockwise rotation angle expressed in radians.</p>
+
+ <p>The <dfn id=dom-context-2d-translate title=dom-context-2d-translate><code>translate(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
+ add the translation transformation described by the arguments to the
+ transformation matrix. The <var title="">x</var> argument represents
+ the translation distance in the horizontal direction and the <var title="">y</var> argument represents the translation distance in the
+ vertical direction. The arguments are in coordinate space units.</p>
+
+ <p>The <dfn id=dom-context-2d-transform title=dom-context-2d-transform><code>transform(<var title="">m11</var>, <var title="">m12</var>, <var title="">m21</var>, <var title="">m22</var>, <var title="">dx</var>,
+ <var title="">dy</var>)</code></dfn> method must multiply the
+ current transformation matrix with the matrix described by:</p>
+
+ </div>
+
+ <table class=matrix><tr><td><var title="">m11</var></td>
+ <td><var title="">m21</var></td>
+ <td><var title="">dx</var></td>
+ <tr><td><var title="">m12</var></td>
+ <td><var title="">m22</var></td>
+ <td><var title="">dy</var></td>
+ <tr><td>0</td>
+ <td>0</td>
+ <td>1</td>
+ </table><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-settransform title=dom-context-2d-setTransform><code>setTransform(<var title="">m11</var>, <var title="">m12</var>, <var title="">m21</var>, <var title="">m22</var>, <var title="">dx</var>,
+ <var title="">dy</var>)</code></dfn> method must reset the current
+ transform to the identity matrix, and then invoke the <code><a href=#dom-context-2d-transform title=dom-context-2d-transform>transform</a>(<var title="">m11</var>, <var title="">m12</var>, <var title="">m21</var>, <var title="">m22</var>, <var title="">dx</var>,
+ <var title="">dy</var>)</code> method with the same arguments.</p>
+
+ </div>
+
+
+ <h6 id=compositing><span class=secno>4.8.11.1.3 </span>Compositing</h6>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current alpha value applied to rendering operations.</p>
+
+ <p>Can be set, to change the alpha value. Values outside of the
+ range 0.0 .. 1.0 are ignored.</p>
+
+ </dd>
+
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current composition operation, from the list below.</p>
+
+ <p>Can be set, to change the composition operation. Unknown values
+ are ignored.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>All drawing operations are affected by the global compositing
+ attributes, <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> and <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>.</p>
+
+ <!-- conformance criteria for painting are described in the "drawing
+ model" section below -->
+
+ <p>The <dfn id=dom-context-2d-globalalpha title=dom-context-2d-globalAlpha><code>globalAlpha</code></dfn>
+ attribute gives an alpha value that is applied to shapes and images
+ before they are composited onto the canvas. The value must be in the
+ range from 0.0 (fully transparent) to 1.0 (no additional
+ transparency). If an attempt is made to set the attribute to a value
+ outside this range, including Infinity and Not-a-Number (NaN)
+ values, the attribute must retain its previous value. When the
+ context is created, the <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> attribute must
+ initially have the value 1.0.</p>
+
+ <p>The <dfn id=dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation><code>globalCompositeOperation</code></dfn>
+ attribute sets how shapes and images are drawn onto the existing
+ bitmap, once they have had <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> and the
+ current transformation matrix applied. It must be set to a value
+ from the following list. In the descriptions below, the source
+ image, <var title="">A</var>, is the shape or image being rendered,
+ and the destination image, <var title="">B</var>, is the current
+ state of the bitmap.</p>
+
+ </div>
+
+ <dl><dt><dfn id=gcop-source-atop title=gcop-source-atop><code>source-atop</code></dfn></dt>
+
+ <dd><var title="">A</var> atop <var title="">B</var>. Display the
+ source image wherever both images are opaque. Display the
+ destination image wherever the destination image is opaque but the
+ source image is transparent. Display transparency elsewhere.</dd>
+
+ <dt><dfn id=gcop-source-in title=gcop-source-in><code>source-in</code></dfn></dt>
+
+ <dd><var title="">A</var> in <var title="">B</var>. Display the
+ source image wherever both the source image and destination image
+ are opaque. Display transparency elsewhere.</dd>
+
+ <dt><dfn id=gcop-source-out title=gcop-source-out><code>source-out</code></dfn></dt>
+
+ <dd><var title="">A</var> out <var title="">B</var>. Display the
+ source image wherever the source image is opaque and the
+ destination image is transparent. Display transparency
+ elsewhere.</dd>
+
+ <dt><dfn id=gcop-source-over title=gcop-source-over><code>source-over</code></dfn> (default)</dt>
+
+ <dd><var title="">A</var> over <var title="">B</var>. Display the
+ source image wherever the source image is opaque. Display the
+ destination image elsewhere.</dd>
+
+
+ <dt><dfn id=gcop-destination-atop title=gcop-destination-atop><code>destination-atop</code></dfn></dt>
+
+ <dd><var title="">B</var> atop <var title="">A</var>. Same as <code title=gcop-source-atop><a href=#gcop-source-atop>source-atop</a></code> but using the
+ destination image instead of the source image and vice versa.</dd>
+
+ <dt><dfn id=gcop-destination-in title=gcop-destination-in><code>destination-in</code></dfn></dt>
+
+ <dd><var title="">B</var> in <var title="">A</var>. Same as <code title=gcop-source-in><a href=#gcop-source-in>source-in</a></code> but using the destination
+ image instead of the source image and vice versa.</dd>
+
+ <dt><dfn id=gcop-destination-out title=gcop-destination-out><code>destination-out</code></dfn></dt>
+
+ <dd><var title="">B</var> out <var title="">A</var>. Same as <code title=gcop-source-out><a href=#gcop-source-out>source-out</a></code> but using the destination
+ image instead of the source image and vice versa.</dd>
+
+ <dt><dfn id=gcop-destination-over title=gcop-destination-over><code>destination-over</code></dfn></dt>
+
+ <dd><var title="">B</var> over <var title="">A</var>. Same as <code title=gcop-source-over><a href=#gcop-source-over>source-over</a></code> but using the
+ destination image instead of the source image and vice versa.</dd>
+
+
+<!-- no clear definition of this operator (doesn't correspond to a PorterDuff operator)
+ <dt><dfn title="gcop-darker"><code>darker</code></dfn></dt>
+
+ <dd>Display the sum of the source image and destination image,
+ with color values approaching 0 as a limit.</dd>
+-->
+
+ <dt><dfn id=gcop-lighter title=gcop-lighter><code>lighter</code></dfn></dt>
+
+ <dd><var title="">A</var> plus <var title="">B</var>. Display the
+ sum of the source image and destination image, with color values
+ approaching 1 as a limit.</dd>
+
+
+ <dt><dfn id=gcop-copy title=gcop-copy><code>copy</code></dfn></dt>
+
+ <dd><var title="">A</var> (<var title="">B</var> is
+ ignored). Display the source image instead of the destination
+ image.</dd>
+
+
+ <dt><dfn id=gcop-xor title=gcop-xor><code>xor</code></dfn></dt>
+
+ <dd><var title="">A</var> xor <var title="">B</var>. Exclusive OR
+ of the source image and destination image.</dd>
+
+
+ <dt class=impl><code><var title="">vendorName</var>-<var title="">operationName</var></code></dt>
+
+ <dd class=impl>Vendor-specific extensions to the list of
+ composition operators should use this syntax.</dd>
+
+ </dl><div class=impl>
+
+ <p>These values are all case-sensitive &mdash; they must be used
+ exactly as shown. User agents must not recognize values that are not
+ a <a href=#case-sensitive>case-sensitive</a> match for one of the values given
+ above.</p>
+
+ <p>The operators in the above list must be treated as described by
+ the Porter-Duff operator given at the start of their description
+ (e.g. <var title="">A</var> over <var title="">B</var>). <a href=#refsPORTERDUFF>[PORTERDUFF]</a></p>
+
+ <p>On setting, if the user agent does not recognize the specified
+ value, it must be ignored, leaving the value of <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
+ unaffected.</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
+ attribute must initially have the value
+ <code>source-over</code>.</p>
+
+ </div>
+
+
+ <h6 id=colors-and-styles><span class=secno>4.8.11.1.4 </span>Colors and styles</h6>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current style used for stroking shapes.</p>
+
+ <p>Can be set, to change the stroke style.</p>
+
+ <p>The style can be either a string containing a CSS color, or a
+ <code><a href=#canvasgradient>CanvasGradient</a></code> or <code><a href=#canvaspattern>CanvasPattern</a></code>
+ object. Invalid values are ignored.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current style used for filling shapes.</p>
+
+ <p>Can be set, to change the fill style.</p>
+
+ <p>The style can be either a string containing a CSS color, or a
+ <code><a href=#canvasgradient>CanvasGradient</a></code> or <code><a href=#canvaspattern>CanvasPattern</a></code>
+ object. Invalid values are ignored.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <!-- v5 feature requests:
+
+ * Getting and setting colours by component to bypass the CSS value parsing.
+
+ Either:
+ context.fillStyle.red += 1;
+
+ Or:
+ var array = context.fillStyle;
+ array[1] += 1;
+ context.fillStyle = array;
+
+ * A more performant way of setting colours in general, e.g.:
+
+ context.setFillColor(r,g,b,a) // already supported by webkit
+
+ Or:
+
+ context.fillStyle = 0xRRGGBBAA; // set a 32bit int directly
+
+ * fill rule for deciding between winding and even-odd algorithms.
+ SVG has fill-rule: nonzero | evenodd
+ http://www.w3.org/TR/SVG/painting.html#FillProperties
+
+ -->
+
+ <p>The <dfn id=dom-context-2d-strokestyle title=dom-context-2d-strokeStyle><code>strokeStyle</code></dfn>
+ attribute represents the color or style to use for the lines around
+ shapes, and the <dfn id=dom-context-2d-fillstyle title=dom-context-2d-fillStyle><code>fillStyle</code></dfn>
+ attribute represents the color or style to use inside the
+ shapes.</p>
+
+ <p>Both attributes can be either strings,
+ <code><a href=#canvasgradient>CanvasGradient</a></code>s, or <code><a href=#canvaspattern>CanvasPattern</a></code>s. On
+ setting, strings must be parsed as CSS &lt;color&gt; values and the
+ color assigned, and <code><a href=#canvasgradient>CanvasGradient</a></code> and
+ <code><a href=#canvaspattern>CanvasPattern</a></code> objects must be assigned themselves. <a href=#refsCSSCOLOR>[CSSCOLOR]</a> If the value is a string but
+ is not a valid color, or is neither a string, a
+ <code><a href=#canvasgradient>CanvasGradient</a></code>, nor a <code><a href=#canvaspattern>CanvasPattern</a></code>, then
+ it must be ignored, and the attribute must retain its previous
+ value.</p>
+
+ <p>When set to a <code><a href=#canvaspattern>CanvasPattern</a></code> or
+ <code><a href=#canvasgradient>CanvasGradient</a></code> object, the assignment is
+ <a href=#live>live</a>, meaning that changes made to the object after the
+ assignment do affect subsequent stroking or filling of shapes.</p>
+
+ <p>On getting, if the value is a color, then the <a href=#serialization-of-a-color title="serialization of a color">serialization of the color</a>
+ must be returned. Otherwise, if it is not a color but a
+ <code><a href=#canvasgradient>CanvasGradient</a></code> or <code><a href=#canvaspattern>CanvasPattern</a></code>, then the
+ respective object must be returned. (Such objects are opaque and
+ therefore only useful for assigning to other attributes or for
+ comparison to other gradients or patterns.)</p>
+
+ <p>The <dfn id=serialization-of-a-color>serialization of a color</dfn> for a color value is a
+ string, computed as follows: if it has alpha equal to 1.0, then the
+ string is a lowercase six-digit hex value, prefixed with a "#"
+ character (U+0023 NUMBER SIGN), with the first two digits
+ representing the red component, the next two digits representing the
+ green component, and the last two digits representing the blue
+ component, the digits being in the range 0-9 a-f (U+0030 to U+0039
+ and U+0061 to U+0066). Otherwise, the color value has alpha less
+ than 1.0, and the string is the color value in the CSS <code title="">rgba()</code> functional-notation format: the literal
+ string <code title="">rgba</code> (U+0072 U+0067 U+0062 U+0061)
+ followed by a U+0028 LEFT PARENTHESIS, a base-ten integer in the
+ range 0-255 representing the red component (using digits 0-9, U+0030
+ to U+0039, in the shortest form possible), a literal U+002C COMMA
+ and U+0020 SPACE, an integer for the green component, a comma and a
+ space, an integer for the blue component, another comma and space, a
+ U+0030 DIGIT ZERO, a U+002E FULL STOP (representing the decimal
+ point), one or more digits in the range 0-9 (U+0030 to U+0039)
+ representing the fractional part of the alpha value, and finally a
+ U+0029 RIGHT PARENTHESIS.</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> and <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> attributes must
+ initially have the string value <code title="">#000000</code>.</p>
+
+ </div>
+
+ <hr><p>There are two types of gradients, linear gradients and radial
+ gradients, both represented by objects implementing the opaque
+ <code><a href=#canvasgradient>CanvasGradient</a></code> interface.</p>
+
+ <p id=interpolation>Once a gradient has been created (see below),
+ stops are placed along it to define how the colors are distributed
+ along the gradient. <span class=impl>The color of the gradient at
+ each stop is the color specified for that stop. Between each such
+ stop, the colors and the alpha component must be linearly
+ interpolated over the RGBA space without premultiplying the alpha
+ value to find the color to use at that offset. Before the first
+ stop, the color must be the color of the first stop. After the last
+ stop, the color must be the color of the last stop. When there are
+ no stops, the gradient is transparent black.</span></p>
+
+ <dl class=domintro><dt><var title="">gradient</var> . <code title=dom-canvasgradient-addColorStop><a href=#dom-canvasgradient-addcolorstop>addColorStop</a></code>(<var title="">offset</var>, <var title="">color</var>)</dt>
+
+ <dd>
+
+ <p>Adds a color stop with the given color to the gradient at the
+ given offset. 0.0 is the offset at one end of the gradient, 1.0 is
+ the offset at the other end.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the offset
+ is out of range. Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if the
+ color cannot be parsed.</p>
+
+ </dd>
+
+ <dt><var title="">gradient</var> = <var title="">context</var> . <code title=dom-context-2d-createLinearGradient><a href=#dom-context-2d-createlineargradient>createLinearGradient</a></code>(<var title="">x0</var>, <var title="">y0</var>, <var title="">x1</var>, <var title="">y1</var>)</dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#canvasgradient>CanvasGradient</a></code> object that represents a
+ linear gradient that paints along the line given by the
+ coordinates represented by the arguments.</p>
+
+ <p>If any of the arguments are not finite numbers, throws a
+ <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception.</p>
+
+ </dd>
+
+ <dt><var title="">gradient</var> = <var title="">context</var> . <code title=dom-context-2d-createRadialGradient><a href=#dom-context-2d-createradialgradient>createRadialGradient</a></code>(<var title="">x0</var>, <var title="">y0</var>, <var title="">r0</var>, <var title="">x1</var>, <var title="">y1</var>, <var title="">r1</var>)</dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#canvasgradient>CanvasGradient</a></code> object that represents a
+ radial gradient that paints along the cone given by the circles
+ represented by the arguments.</p>
+
+ <p>If any of the arguments are not finite numbers, throws a
+ <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception. If either of the radii
+ are negative, throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-canvasgradient-addcolorstop title=dom-canvasgradient-addColorStop><code>addColorStop(<var title="">offset</var>, <var title="">color</var>)</code></dfn>
+ method on the <code><a href=#canvasgradient>CanvasGradient</a></code> interface adds a new stop
+ to a gradient. If the <var title="">offset</var> is less than 0,
+ greater than 1, infinite, or NaN, then an
+ <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception must be raised. If the <var title="">color</var> cannot be parsed as a CSS color, then a
+ <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception must be raised. Otherwise, the
+ gradient must have a new stop placed, at offset <var title="">offset</var> relative to the whole gradient, and with the
+ color obtained by parsing <var title="">color</var> as a CSS
+ &lt;color&gt; value. If multiple stops are added at the same offset
+ on a gradient, they must be placed in the order added, with the
+ first one closest to the start of the gradient, and each subsequent
+ one infinitesimally further along towards the end point (in effect
+ causing all but the first and last stop added at each point to be
+ ignored).</p>
+
+ <p>The <dfn id=dom-context-2d-createlineargradient title=dom-context-2d-createLinearGradient><code>createLinearGradient(<var title="">x0</var>, <var title="">y0</var>, <var title="">x1</var>,
+ <var title="">y1</var>)</code></dfn> method takes four arguments
+ that represent the start point (<var title="">x0</var>, <var title="">y0</var>) and end point (<var title="">x1</var>, <var title="">y1</var>) of the gradient. If any of the arguments to <code title=dom-context-2d-createLinearGradient><a href=#dom-context-2d-createlineargradient>createLinearGradient()</a></code>
+ are infinite or NaN, the method must raise a
+ <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception. Otherwise, the method must
+ return a linear <code><a href=#canvasgradient>CanvasGradient</a></code> initialized with the
+ specified line.</p>
+
+ <p>Linear gradients must be rendered such that all points on a line
+ perpendicular to the line that crosses the start and end points have
+ the color at the point where those two lines cross (with the colors
+ coming from the <a href=#interpolation>interpolation and
+ extrapolation</a> described above). The points in the linear
+ gradient must be transformed as described by the <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a> when rendering.</p>
+
+ <p>If <span title=""><var title="">x0</var>&nbsp;=&nbsp;<var title="">x1</var></span> and <span title=""><var title="">y0</var>&nbsp;=&nbsp;<var title="">y1</var></span>, then
+ the linear gradient must paint nothing.</p>
+
+ <p>The <dfn id=dom-context-2d-createradialgradient title=dom-context-2d-createRadialGradient><code>createRadialGradient(<var title="">x0</var>, <var title="">y0</var>, <var title="">r0</var>,
+ <var title="">x1</var>, <var title="">y1</var>, <var title="">r1</var>)</code></dfn> method takes six arguments, the
+ first three representing the start circle with origin (<var title="">x0</var>, <var title="">y0</var>) and radius <var title="">r0</var>, and the last three representing the end circle
+ with origin (<var title="">x1</var>, <var title="">y1</var>) and
+ radius <var title="">r1</var>. The values are in coordinate space
+ units. If any of the arguments are infinite or NaN, a
+ <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception must be raised. If either
+ of <var title="">r0</var> or <var title="">r1</var> are negative, an
+ <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception must be raised. Otherwise,
+ the method must return a radial <code><a href=#canvasgradient>CanvasGradient</a></code>
+ initialized with the two specified circles.</p>
+
+ <p>Radial gradients must be rendered by following these steps:</p>
+
+ <ol><li><p>If <span title=""><var title="">x<sub>0</sub></var>&nbsp;=&nbsp;<var title="">x<sub>1</sub></var></span> and <span title=""><var title="">y<sub>0</sub></var>&nbsp;=&nbsp;<var title="">y<sub>1</sub></var></span> and <span title=""><var title="">r<sub>0</sub></var>&nbsp;=&nbsp;<var title="">r<sub>1</sub></var></span>, then the radial gradient must
+ paint nothing. Abort these steps.</li>
+
+ <li>
+
+ <p>Let <span title="">x(<var title="">&omega;</var>)&nbsp;=&nbsp;(<var title="">x<sub>1</sub></var>-<var title="">x<sub>0</sub></var>)<var title="">&omega;</var>&nbsp;+&nbsp;<var title="">x<sub>0</sub></var></span></p>
+
+ <p>Let <span title="">y(<var title="">&omega;</var>)&nbsp;=&nbsp;(<var title="">y<sub>1</sub></var>-<var title="">y<sub>0</sub></var>)<var title="">&omega;</var>&nbsp;+&nbsp;<var title="">y<sub>0</sub></var></span></p>
+
+ <p>Let <span title="">r(<var title="">&omega;</var>)&nbsp;=&nbsp;(<var title="">r<sub>1</sub></var>-<var title="">r<sub>0</sub></var>)<var title="">&omega;</var>&nbsp;+&nbsp;<var title="">r<sub>0</sub></var></span></p>
+
+ <p>Let the color at <var title="">&omega;</var> be the color at
+ that position on the gradient (with the colors coming from the <a href=#interpolation>interpolation and extrapolation</a>
+ described above).</p>
+
+ </li>
+
+ <li><p>For all values of <var title="">&omega;</var> where <span title="">r(<var title="">&omega;</var>)&nbsp;&gt;&nbsp;0</span>,
+ starting with the value of <var title="">&omega;</var> nearest to
+ positive infinity and ending with the value of <var title="">&omega;</var> nearest to negative infinity, draw the
+ circumference of the circle with radius <span title="">r(<var title="">&omega;</var>)</span> at position (<span title="">x(<var title="">&omega;</var>)</span>, <span title="">y(<var title="">&omega;</var>)</span>), with the color at <var title="">&omega;</var>, but only painting on the parts of the
+ canvas that have not yet been painted on by earlier circles in this
+ step for this rendering of the gradient.</li>
+
+ </ol><p class=note>This effectively creates a cone, touched by the two
+ circles defined in the creation of the gradient, with the part of
+ the cone before the start circle (0.0) using the color of the first
+ offset, the part of the cone after the end circle (1.0) using the
+ color of the last offset, and areas outside the cone untouched by
+ the gradient (transparent black).</p>
+
+ <p>The points in the radial gradient must be transformed as
+ described by the <a href=#transformations title=dom-context-2d-transformation>current
+ transformation matrix</a> when rendering.</p>
+
+ <p>Gradients must be painted only where the relevant stroking or
+ filling effects requires that they be drawn.</p>
+
+<!--
+ <p>Support for actually painting gradients is optional. Instead of
+ painting the gradients, user agents may instead just paint the first
+ stop's color. However, <code
+ title="dom-context-2d-createLinearGradient">createLinearGradient()</code>
+ and <code
+ title="dom-context-2d-createRadialGradient">createRadialGradient()</code>
+ must always return objects when passed valid arguments.</p>
+-->
+
+ </div>
+
+ <hr><p>Patterns are represented by objects implementing the opaque
+ <code><a href=#canvaspattern>CanvasPattern</a></code> interface.</p>
+
+ <dl class=domintro><dt><var title="">pattern</var> = <var title="">context</var> . <code title=dom-context-2d-createPattern><a href=#dom-context-2d-createpattern>createPattern</a></code>(<var title="">image</var>, <var title="">repetition</var>)</dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#canvaspattern>CanvasPattern</a></code> object that uses the given image
+ and repeats in the direction(s) given by the <var title="">repetition</var> argument.</p>
+
+ <p>The allowed values for <var title="">repetition</var> are <code title="">repeat</code> (both directions), <code title="">repeat-x</code> (horizontal only), <code title="">repeat-y</code> (vertical only), and <code title="">no-repeat</code> (neither). If the <var title="">repetition</var> argument is empty or null, the value
+ <code title="">repeat</code> is used.</p>
+
+ <p>If the first argument isn't an <code><a href=#the-img-element>img</a></code>,
+ <code><a href=#the-canvas-element>canvas</a></code>, or <code><a href=#video>video</a></code> element, throws a
+ <code><a href=#type_mismatch_err>TYPE_MISMATCH_ERR</a></code> exception. If the image has no
+ image data, throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception. If
+ the second argument isn't one of the allowed values, throws a
+ <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception. If the image isn't yet fully
+ decoded, then the method returns null.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>To create objects of this type, the <dfn id=dom-context-2d-createpattern title=dom-context-2d-createPattern><code>createPattern(<var title="">image</var>, <var title="">repetition</var>)</code></dfn>
+ method is used. The first argument gives the image to use as the
+ pattern (either an <code><a href=#htmlimageelement>HTMLImageElement</a></code>,
+ <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>, or <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>
+ object). Modifying this image after calling the <code title=dom-context-2d-createPattern><a href=#dom-context-2d-createpattern>createPattern()</a></code> method
+ must not affect the pattern. The second argument must be a string
+ with one of the following values: <code title="">repeat</code>,
+ <code title="">repeat-x</code>, <code title="">repeat-y</code>,
+ <code title="">no-repeat</code>. If the empty string or null is
+ specified, <code title="">repeat</code> must be assumed. If an
+ unrecognized value is given, then the user agent must raise a
+ <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception. User agents must recognize the
+ four values described above exactly (e.g. they must not do case
+ folding). The method must return a <code><a href=#canvaspattern>CanvasPattern</a></code> object
+ suitably initialized.</p>
+
+ <p>The <var title="">image</var> argument is an instance of either
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code>, <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>, or
+ <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>. If the <var title="">image</var> is
+ null, the implementation must raise a <code><a href=#type_mismatch_err>TYPE_MISMATCH_ERR</a></code>
+ exception.</p> <!-- drawImage() has an equivalent paragraph -->
+
+ <p>If the <var title="">image</var> argument is an
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code> object whose <code title=dom-img-complete><a href=#dom-img-complete>complete</a></code> attribute is false, or
+ if the <var title="">image</var> argument is an
+ <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> object whose <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either
+ <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, then the
+ implementation must return null.</p>
+ <!-- drawImage() has an equivalent paragraph -->
+
+ <p>If the <var title="">image</var> argument is an
+ <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> object with either a horizontal
+ dimension or a vertical dimension equal to zero, then the
+ implementation must raise an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code>
+ exception.</p>
+ <!-- drawImage() has an equivalent paragraph -->
+
+ <p>Patterns must be painted so that the top left of the first image
+ is anchored at the origin of the coordinate space, and images are
+ then repeated horizontally to the left and right (if the
+ <code>repeat-x</code> string was specified) or vertically up and
+ down (if the <code>repeat-y</code> string was specified) or in all
+ four directions all over the canvas (if the <code>repeat</code>
+ string was specified). The images are not scaled by this process;
+ one CSS pixel of the image must be painted on one coordinate space
+ unit. Of course, patterns must actually be painted only where the
+ stroking or filling effect requires that they be drawn, and are
+ affected by the current transformation matrix.</p>
+
+ <p>When the <code title=dom-context-2d-createPattern><a href=#dom-context-2d-createpattern>createPattern()</a></code> method
+ is passed an animated image as its <var title="">image</var>
+ argument, the user agent must use the poster frame of the animation,
+ or, if there is no poster frame, the first frame of the
+ animation.</p>
+ <!-- drawImage() has an equivalent paragraph -->
+
+ <p>When the <var title="">image</var> argument is an
+ <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>, then the frame at the <a href=#current-playback-position>current
+ playback position</a> must be used as the source image, and the
+ source image's dimensions must be the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> and
+ <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a>
+ of the <a href=#media-resource>media resource</a> (i.e. after any aspect-ratio
+ correction has been applied).</p>
+ <!-- drawImage() has an equivalent paragraph -->
+
+ <!--
+ Requests for v5 features:
+ * apply transforms to patterns, so you don't have to create
+ transformed patterns manually by rendering them to an off-screen
+ canvas then using that canvas as the pattern.
+ -->
+
+ </div>
+
+
+
+ <h6 id=line-styles><span class=secno>4.8.11.1.5 </span>Line styles</h6>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current line width.</p>
+
+ <p>Can be set, to change the line width. Values that are not
+ finite values greater than zero are ignored.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current line cap style.</p>
+
+ <p>Can be set, to change the line cap style.</p>
+
+ <p>The possible line cap styles are <code>butt</code>,
+ <code>round</code>, and <code>square</code>. Other values are
+ ignored.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current line join style.</p>
+
+ <p>Can be set, to change the line join style.</p>
+
+ <p>The possible line join styles are <code>bevel</code>,
+ <code>round</code>, and <code>miter</code>. Other values are
+ ignored.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current miter limit ratio.</p>
+
+ <p>Can be set, to change the miter limit ratio. Values that are
+ not finite values greater than zero are ignored.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-linewidth title=dom-context-2d-lineWidth><code>lineWidth</code></dfn>
+ attribute gives the width of lines, in coordinate space units. On
+ getting, it must return the current value. On setting, zero,
+ negative, infinite, and NaN values must be ignored, leaving the
+ value unchanged; other values must change the current value to the
+ new value.</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> attribute must
+ initially have the value <code>1.0</code>.</p>
+
+ <hr><p>The <dfn id=dom-context-2d-linecap title=dom-context-2d-lineCap><code>lineCap</code></dfn> attribute
+ defines the type of endings that UAs will place on the end of
+ lines. The three valid values are <code>butt</code>,
+ <code>round</code>, and <code>square</code>. The <code>butt</code>
+ value means that the end of each line has a flat edge perpendicular
+ to the direction of the line (and that no additional line cap is
+ added). The <code>round</code> value means that a semi-circle with
+ the diameter equal to the width of the line must then be added on to
+ the end of the line. The <code>square</code> value means that a
+ rectangle with the length of the line width and the width of half
+ the line width, placed flat against the edge perpendicular to the
+ direction of the line, must be added at the end of each line.</p>
+
+ <p>On getting, it must return the current value. On setting, if the
+ new value is one of the literal strings <code>butt</code>,
+ <code>round</code>, and <code>square</code>, then the current value
+ must be changed to the new value; other values must ignored, leaving
+ the value unchanged.</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code> attribute must
+ initially have the value <code>butt</code>.</p>
+
+ <hr><p>The <dfn id=dom-context-2d-linejoin title=dom-context-2d-lineJoin><code>lineJoin</code></dfn>
+ attribute defines the type of corners that UAs will place where two
+ lines meet. The three valid values are <code>bevel</code>,
+ <code>round</code>, and <code>miter</code>.</p>
+
+ <p>On getting, it must return the current value. On setting, if the
+ new value is one of the literal strings <code>bevel</code>,
+ <code>round</code>, and <code>miter</code>, then the current value
+ must be changed to the new value; other values must be ignored,
+ leaving the value unchanged.</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> attribute must
+ initially have the value <code>miter</code>.</p>
+
+ <hr><p>A join exists at any point in a subpath shared by two consecutive
+ lines. When a subpath is closed, then a join also exists at its
+ first point (equivalent to its last point) connecting the first and
+ last lines in the subpath.</p>
+
+ <p>In addition to the point where the join occurs, two additional
+ points are relevant to each join, one for each line: the two corners
+ found half the line width away from the join point, one
+ perpendicular to each line, each on the side furthest from the other
+ line.</p>
+
+ <p>A filled triangle connecting these two opposite corners with a
+ straight line, with the third point of the triangle being the join
+ point, must be rendered at all joins. The <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> attribute controls
+ whether anything else is rendered. The three aforementioned values
+ have the following meanings:</p>
+
+ <p>The <code>bevel</code> value means that this is all that is
+ rendered at joins.</p>
+
+ <p>The <code>round</code> value means that a filled arc connecting
+ the two aforementioned corners of the join, abutting (and not
+ overlapping) the aforementioned triangle, with the diameter equal to
+ the line width and the origin at the point of the join, must be
+ rendered at joins.</p>
+
+ <p>The <code>miter</code> value means that a second filled triangle
+ must (if it can given the miter length) be rendered at the join,
+ with one line being the line between the two aforementioned corners,
+ abutting the first triangle, and the other two being continuations of
+ the outside edges of the two joining lines, as long as required to
+ intersect without going over the miter length.</p>
+
+ <p>The miter length is the distance from the point where the join
+ occurs to the intersection of the line edges on the outside of the
+ join. The miter limit ratio is the maximum allowed ratio of the
+ miter length to half the line width. If the miter length would cause
+ the miter limit ratio to be exceeded, this second triangle must not
+ be rendered.</p>
+
+ <p>The miter limit ratio can be explicitly set using the <dfn id=dom-context-2d-miterlimit title=dom-context-2d-miterLimit><code>miterLimit</code></dfn>
+ attribute. On getting, it must return the current value. On setting,
+ zero, negative, infinite, and NaN values must be ignored, leaving
+ the value unchanged; other values must change the current value to
+ the new value.</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attribute must
+ initially have the value <code>10.0</code>.</p>
+
+ <!--
+v5: dashed lines have been requested. Philip Taylor provides these
+notes on what would need to be defined for dashed lines:
+> I don't think it's entirely trivial to add, to the detail that's
+> necessary in a specification. The common graphics APIs (at least
+> Cairo, Quartz and java.awt.Graphics, and any SVG implementation) all
+> have dashes specified by passing an array of dash lengths (alternating
+> on/off), so that should be alright as long as you define what units
+> it's measured in and what happens when you specify an odd number of
+> values and how errors are handled and what happens if you update the
+> array later. But after that, what does it do when stroking multiple
+> subpaths, in terms of offsetting the dashes? When you use strokeRect,
+> where is offset 0? Does moveTo reset the offset? How does it interact
+> with lineCap/lineJoin? All the potential issues need test cases too,
+> and the implementations need to make sure they handle any edge cases
+> that the underlying graphics library does differently. (SVG Tiny 1.2
+> appears to skip some of the problems by leaving things undefined and
+> allowing whatever behavior the graphics library has.)
+
+Another request has been for hairline width lines, that remain
+hairline width with transform. ack Shaun Morris.
+ -->
+
+ </div>
+
+
+ <h6 id=shadows><span class=secno>4.8.11.1.6 </span><dfn>Shadows</dfn></h6>
+
+ <p>All drawing operations are affected by the four global shadow
+ attributes.</p>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current shadow color.</p>
+
+ <p>Can be set, to change the shadow color. Values that cannot be parsed as CSS colors are ignored.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code> [ = <var title="">value</var> ]</dt>
+ <dt><var title="">context</var> . <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current shadow offset.</p>
+
+ <p>Can be set, to change the shadow offset. Values that are not finite numbers are ignored.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current level of blur applied to shadows.</p>
+
+ <p>Can be set, to change the blur level. Values that are not finite numbers greater than or equal to zero are ignored.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-shadowcolor title=dom-context-2d-shadowColor><code>shadowColor</code></dfn>
+ attribute sets the color of the shadow.</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> attribute
+ initially must be fully-transparent black.</p>
+
+ <p>On getting, the <a href=#serialization-of-a-color title="serialization of a
+ color">serialization of the color</a> must be returned.</p>
+
+ <p>On setting, the new value must be parsed as a CSS &lt;color&gt;
+ value and the color assigned. If the value is not a valid color,
+ then it must be ignored, and the attribute must retain its previous
+ value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
+
+ <p>The <dfn id=dom-context-2d-shadowoffsetx title=dom-context-2d-shadowOffsetX><code>shadowOffsetX</code></dfn>
+ and <dfn id=dom-context-2d-shadowoffsety title=dom-context-2d-shadowOffsetY><code>shadowOffsetY</code></dfn>
+ attributes specify the distance that the shadow will be offset in
+ the positive horizontal and positive vertical distance
+ respectively. Their values are in coordinate space units. They are
+ not affected by the current transformation matrix.</p>
+
+ <p>When the context is created, the shadow offset attributes must
+ initially have the value <code>0</code>.</p>
+
+ <p>On getting, they must return their current value. On setting, the
+ attribute being set must be set to the new value, except if the
+ value is infinite or NaN, in which case the new value must be
+ ignored.</p>
+
+ <p>The <dfn id=dom-context-2d-shadowblur title=dom-context-2d-shadowBlur><code>shadowBlur</code></dfn>
+ attribute specifies the size of the blurring effect. (The units do
+ not map to coordinate space units, and are not affected by the
+ current transformation matrix.)</p>
+
+ <p>When the context is created, the <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> attribute must
+ initially have the value <code>0</code>.</p>
+
+ <p>On getting, the attribute must return its current value. On
+ setting the attribute must be set to the new value, except if the
+ value is negative, infinite or NaN, in which case the new value must
+ be ignored.</p>
+
+ <p><dfn id=when-shadows-are-drawn title="when shadows are drawn">Shadows are only drawn
+ if</dfn> the opacity component of the alpha component of the color
+ of <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> is
+ non-zero and either the <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is non-zero, or
+ the <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code>
+ is non-zero, or the <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> is
+ non-zero.</p>
+
+ <p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, they must be rendered as follows:</p>
+
+ <ol><li> <p>Let <var title="">A</var> be an infinite transparent black
+ bitmap on which the source image for which a shadow is being
+ created has been rendered.</p> </li>
+
+ <li> <p>Let <var title="">B</var> be an infinite transparent black
+ bitmap, with a coordinate space and an origin identical to <var title="">A</var>.</p> </li>
+
+ <li> <p>Copy the alpha channel of <var title="">A</var> to <var title="">B</var>, offset by <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code> in the
+ positive <var title="">x</var> direction, and <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> in the
+ positive <var title="">y</var> direction.</p> </li>
+
+ <li> <p>If <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is greater than
+ 0:</p>
+
+ <ol><li> <p>If <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is less than
+ 8, let <var title="">&sigma;</var> be half the value of <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>; otherwise,
+ let <var title="">&sigma;</var> be the square root of multiplying
+ the value of <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> by
+ 2.</li>
+
+ <li> <p>Perform a 2D Gaussian Blur on <var title="">B</var>,
+ using <var title="">&sigma;</var> as the standard deviation.</p>
+ <!-- wish i could find a reference for this --> </li>
+
+ </ol><p>User agents may limit values of <var title="">&sigma;</var> to
+ an implementation-specific maximum value to avoid exceeding
+ hardware limitations during the Gaussian blur operation.</p>
+
+ </li>
+
+ <li> <p>Set the red, green, and blue components of every pixel in
+ <var title="">B</var> to the red, green, and blue components
+ (respectively) of the color of <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>.</p> </li>
+
+ <li> <p>Multiply the alpha component of every pixel in <var title="">B</var> by the alpha component of the color of <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>.</p> </li>
+
+ <li> <p>The shadow is in the bitmap <var title="">B</var>, and is
+ rendered as part of the drawing model described below.</p> </li>
+
+ </ol></div>
+
+ <p>If the current composition operation is <code title=gcop-copy><a href=#gcop-copy>copy</a></code>, shadows effectively won't render
+ (since the shape will overwrite the shadow).</p>
+
+
+ <h6 id=simple-shapes-(rectangles)><span class=secno>4.8.11.1.7 </span>Simple shapes (rectangles)</h6>
+
+ <p>There are three methods that immediately draw rectangles to the
+ bitmap. They each take four arguments; the first two give the <var title="">x</var> and <var title="">y</var> coordinates of the top
+ left of the rectangle, and the second two give the width <var title="">w</var> and height <var title="">h</var> of the rectangle,
+ respectively.</p>
+
+ <div class=impl>
+
+ <p>The <a href=#transformations title=dom-context-2d-transformation>current
+ transformation matrix</a> must be applied to the following four
+ coordinates, which form the path that must then be closed to get the
+ specified rectangle: <span title="">(<var title="">x</var>, <var title="">y</var>)</span>, <span title="">(<span title=""><var title="">x</var>+<var title="">w</var></span>, <var title="">y</var>)</span>,
+ <span title="">(<span title=""><var title="">x</var>+<var title="">w</var></span>,
+ <span title=""><var title="">y</var>+<var title="">h</var></span>)</span>,
+ <span title="">(<var title="">x</var>, <span title=""><var title="">y</var>+<var title="">h</var></span>)</span>.</p>
+
+ <p>Shapes are painted without affecting the current path, and are
+ subject to the <a href=#clipping-region title="clipping region">clipping region</a>,
+ and, with the exception of <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect()</a></code>, also <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ operators</a>.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>
+
+ <dd>
+
+ <p>Clears all pixels on the canvas in the given rectangle to transparent black.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-fillRect><a href=#dom-context-2d-fillrect>fillRect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>
+
+ <dd>
+
+ <p>Paints the given rectangle onto the canvas, using the current fill style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-strokeRect><a href=#dom-context-2d-strokerect>strokeRect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>
+
+ <dd>
+
+ <p>Paints the box that outlines the given rectangle onto the canvas, using the current stroke style.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-clearrect title=dom-context-2d-clearRect><code>clearRect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must clear the pixels in the
+ specified rectangle that also intersect the current clipping region
+ to a fully transparent black, erasing any previous image. If either
+ height or width are zero, this method has no effect.</p>
+
+ <p>The <dfn id=dom-context-2d-fillrect title=dom-context-2d-fillRect><code>fillRect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must paint the specified
+ rectangular area using the <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>. If either height
+ or width are zero, this method has no effect.</p>
+
+ <p>The <dfn id=dom-context-2d-strokerect title=dom-context-2d-strokeRect><code>strokeRect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must stroke the specified
+ rectangle's path using the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>, <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, and (if
+ appropriate) <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attributes. If
+ both height and width are zero, this method has no effect, since
+ there is no path to stroke (it's a point). If only one of the two is
+ zero, then the method will draw a line instead (the path for the
+ outline is just a straight line along the non-zero dimension).</p>
+
+ </div>
+
+
+ <h6 id=complex-shapes-(paths)><span class=secno>4.8.11.1.8 </span>Complex shapes (paths)</h6>
+
+ <p>The context always has a current path. There is only one current
+ path, it is not part of the <a href=#drawing-state>drawing state</a>.</p>
+
+ <p>A <dfn id=path>path</dfn> has a list of zero or more subpaths. Each
+ subpath consists of a list of one or more points, connected by
+ straight or curved lines, and a flag indicating whether the subpath
+ is closed or not. A closed subpath is one where the last point of
+ the subpath is connected to the first point of the subpath by a
+ straight line. Subpaths with fewer than two points are ignored when
+ painting the path.</p>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath</a></code>()</dt>
+
+ <dd>
+
+ <p>Resets the current path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Creates a new subpath with the given point.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-closePath><a href=#dom-context-2d-closepath>closePath</a></code>()</dt>
+
+ <dd>
+
+ <p>Marks the current subpath as closed, and starts a new subpath with a point the same as the start and end of the newly closed subpath.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-lineTo><a href=#dom-context-2d-lineto>lineTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Adds the given point to the current subpath, connected to the previous one by a straight line.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-quadraticCurveTo><a href=#dom-context-2d-quadraticcurveto>quadraticCurveTo</a></code>(<var title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Adds the given point to the current path, connected to the previous one by a quadratic B&eacute;zier curve with the given control point.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-bezierCurveTo><a href=#dom-context-2d-beziercurveto>bezierCurveTo</a></code>(<var title="">cp1x</var>, <var title="">cp1y</var>, <var title="">cp2x</var>, <var title="">cp2y</var>, <var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Adds the given point to the current path, connected to the previous one by a cubic B&eacute;zier curve with the given control points.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-arcTo><a href=#dom-context-2d-arcto>arcTo</a></code>(<var title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>, <var title="">y2</var>, <var title="">radius</var>)</dt>
+
+ <dd>
+
+ <p>Adds a point to the current path, connected to the previous one
+ by a straight line, then adds a second point to the current path,
+ connected to the previous one by an arc whose properties are
+ described by the arguments.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the given
+ radius is negative.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-arc><a href=#dom-context-2d-arc>arc</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">radius</var>, <var title="">startAngle</var>, <var title="">endAngle</var>, <var title="">anticlockwise</var>)</dt>
+
+ <dd>
+
+ <p>Adds points to the subpath such that the arc described by the
+ circumference of the circle described by the arguments, starting
+ at the given start angle and ending at the given end angle, going
+ in the given direction, is added to the path, connected to the
+ previous point by a straight line.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the given
+ radius is negative.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-rect><a href=#dom-context-2d-rect>rect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>
+
+ <dd>
+
+ <p>Adds a new closed subpath to the path, representing the given rectangle.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>()</dt>
+
+ <dd>
+
+ <p>Fills the subpaths with the current fill style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>()</dt>
+
+ <dd>
+
+ <p>Strokes the subpaths with the current stroke style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>()</dt>
+
+ <dd>
+
+ <p>Further constrains the clipping region to the given path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-isPointInPath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Returns true if the given point is in the current path.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Initially, the context's path must have zero subpaths.</p>
+
+ <p>The points and lines added to the path by these methods must be
+ transformed according to the <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a> as they are added.</p>
+
+
+ <p>The <dfn id=dom-context-2d-beginpath title=dom-context-2d-beginPath><code>beginPath()</code></dfn>
+ method must empty the list of subpaths so that the context once
+ again has zero subpaths.</p>
+
+
+ <p>The <dfn id=dom-context-2d-moveto title=dom-context-2d-moveTo><code>moveTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
+ create a new subpath with the specified point as its first (and
+ only) point.</p>
+
+ <p>When the user agent is to <dfn id=ensure-there-is-a-subpath>ensure there is a subpath</dfn>
+ for a coordinate (<var title="">x</var>, <var title="">y</var>), the
+ user agent must check to see if the context has any subpaths, and if
+ it does not, then the user agent must create a new subpath with the
+ point (<var title="">x</var>, <var title="">y</var>) as its first
+ (and only) point, as if the <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo()</a></code> method had been
+ called.</p>
+
+
+ <p>The <dfn id=dom-context-2d-closepath title=dom-context-2d-closePath><code>closePath()</code></dfn>
+ method must do nothing if the context has no subpaths. Otherwise, it
+ must mark the last subpath as closed, create a new subpath whose
+ first point is the same as the previous subpath's first point, and
+ finally add this new subpath to the path.</p>
+
+ <p class=note>If the last subpath had more than one point in its
+ list of points, then this is equivalent to adding a straight line
+ connecting the last point back to the first point, thus "closing"
+ the shape, and then repeating the last (possibly implied) <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo()</a></code> call.</p>
+
+
+ <p>New points and the lines connecting them are added to subpaths
+ using the methods described below. In all cases, the methods only
+ modify the last subpath in the context's paths.</p>
+
+
+ <p>The <dfn id=dom-context-2d-lineto title=dom-context-2d-lineTo><code>lineTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
+ <a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">x</var>, <var title="">y</var>)</span> if the context has
+ no subpaths. Otherwise, it must connect the last point in the
+ subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a straight line, and must then add the given
+ point (<var title="">x</var>, <var title="">y</var>) to the
+ subpath.</p>
+
+
+ <p>The <dfn id=dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo><code>quadraticCurveTo(<var title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>,
+ <var title="">y</var>)</code></dfn> method must <a href=#ensure-there-is-a-subpath>ensure there
+ is a subpath</a> for <span title="">(<var title="">cpx</var>,
+ <var title="">cpy</var>)</span>, and then must connect the last
+ point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a quadratic B&eacute;zier curve with control
+ point (<var title="">cpx</var>, <var title="">cpy</var>), and must
+ then add the given point (<var title="">x</var>, <var title="">y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>
+
+
+ <p>The <dfn id=dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo><code>bezierCurveTo(<var title="">cp1x</var>, <var title="">cp1y</var>, <var title="">cp2x</var>, <var title="">cp2y</var>, <var title="">x</var>, <var title="">y</var>)</code></dfn> method must
+ <a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">cp1x</var>, <var title="">cp1y</var>)</span>, and then must
+ connect the last point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a cubic B&eacute;zier
+ curve with control points (<var title="">cp1x</var>, <var title="">cp1y</var>) and (<var title="">cp2x</var>, <var title="">cp2y</var>). Then, it must add the point (<var title="">x</var>, <var title="">y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>
+
+ <hr><p>The <dfn id=dom-context-2d-arcto title=dom-context-2d-arcTo><code>arcTo(<var title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>,
+ <var title="">y2</var>, <var title="">radius</var>)</code></dfn>
+ method must first <a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">x1</var>, <var title="">y1</var>)</span>. Then, the behavior depends on the
+ arguments and the last point in the subpath, as described below.</p>
+
+ <p>Negative values for <var title="">radius</var> must cause the
+ implementation to raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception.</p>
+
+ <p>Let the point (<var title="">x0</var>, <var title="">y0</var>) be
+ the last point in the subpath.</p>
+
+ <p>If the point (<var title="">x0</var>, <var title="">y0</var>) is
+ equal to the point (<var title="">x1</var>, <var title="">y1</var>),
+ or if the point (<var title="">x1</var>, <var title="">y1</var>) is
+ equal to the point (<var title="">x2</var>, <var title="">y2</var>),
+ or if the radius <var title="">radius</var> is zero, then the method
+ must add the point (<var title="">x1</var>, <var title="">y1</var>)
+ to the subpath, and connect that point to the previous point (<var title="">x0</var>, <var title="">y0</var>) by a straight line.</p>
+
+ <p>Otherwise, if the points (<var title="">x0</var>, <var title="">y0</var>), (<var title="">x1</var>, <var title="">y1</var>), and (<var title="">x2</var>, <var title="">y2</var>) all lie on a single straight line, then the
+ method must add the point (<var title="">x1</var>, <var title="">y1</var>) to the subpath, and connect that point to the
+ previous point (<var title="">x0</var>, <var title="">y0</var>) by a
+ straight line.</p>
+
+ <p>Otherwise, let <var title="">The Arc</var> be the shortest arc
+ given by circumference of the circle that has radius <var title="">radius</var>, and that has one point tangent to the
+ half-infinite line that crosses the point (<var title="">x0</var>,
+ <var title="">y0</var>) and ends at the point (<var title="">x1</var>, <var title="">y1</var>), and that has a different
+ point tangent to the half-infinite line that ends at the point (<var title="">x1</var>, <var title="">y1</var>) and crosses the point
+ (<var title="">x2</var>, <var title="">y2</var>). The points at
+ which this circle touches these two lines are called the start and
+ end tangent points respectively. The method must connect the point
+ (<var title="">x0</var>, <var title="">y0</var>) to the start
+ tangent point by a straight line, adding the start tangent point to
+ the subpath, and then must connect the start tangent point to the
+ end tangent point by <var title="">The Arc</var>, adding the end
+ tangent point to the subpath.</p>
+
+ <hr><p>The <dfn id=dom-context-2d-arc title=dom-context-2d-arc><code>arc(<var title="">x</var>, <var title="">y</var>, <var title="">radius</var>,
+ <var title="">startAngle</var>, <var title="">endAngle</var>, <var title="">anticlockwise</var>)</code></dfn> method draws an arc. If
+ the context has any subpaths, then the method must add a straight
+ line from the last point in the subpath to the start point of the
+ arc. In any case, it must draw the arc between the start point of
+ the arc and the end point of the arc, and add the start and end
+ points of the arc to the subpath. The arc and its start and end
+ points are defined as follows:</p>
+
+ <p>Consider a circle that has its origin at (<var title="">x</var>,
+ <var title="">y</var>) and that has radius <var title="">radius</var>. The points at <var title="">startAngle</var>
+ and <var title="">endAngle</var> along this circle's circumference,
+ measured in radians clockwise from the positive x-axis, are the
+ start and end points respectively.</p>
+
+ <p>If the <var title="">anticlockwise</var> argument is false and
+ <span title=""><var title="">endAngle</var>-<var title="">startAngle</var></span> is equal to or greater than
+ <span title="">2&pi;</span>, or, if the <var title="">anticlockwise</var>
+ argument is <em>true</em> and <span title=""><var title="">startAngle</var>-<var title="">endAngle</var></span> is
+ equal to or greater than <span title="">2&pi;</span>, then the arc is the
+ whole circumference of this circle.</p>
+
+ <!--alternatively (this is not equivalent, but might make more
+ sense, if browsers are willing to change to it: <p>If the absolute
+ magnitude of the difference between the <var
+ title="">startAngle</var> and <var title="">endAngle</var> angles is
+ equal to or greater than <span title="">2&pi;</span>, then the arc is the
+ whole circumference of this circle.</p>-->
+
+ <p>Otherwise, the arc is the path along the circumference of this
+ circle from the start point to the end point, going anti-clockwise
+ if the <var title="">anticlockwise</var> argument is true, and
+ clockwise otherwise. Since the points are on the circle, as opposed
+ to being simply angles from zero, the arc can never cover an angle
+ greater than <span title="">2&pi;</span> radians. If the two points are the
+ same, or if the radius is zero, then the arc is defined as being of
+ zero length in both directions.</p>
+
+ <p>Negative values for <var title="">radius</var> must cause the
+ implementation to raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception.</p>
+
+ <hr><p>The <dfn id=dom-context-2d-rect title=dom-context-2d-rect><code>rect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must create a new subpath
+ containing just the four points (<var title="">x</var>, <var title="">y</var>), (<var title="">x</var>+<var title="">w</var>,
+ <var title="">y</var>), (<var title="">x</var>+<var title="">w</var>, <var title="">y</var>+<var title="">h</var>),
+ (<var title="">x</var>, <var title="">y</var>+<var title="">h</var>), with those four points connected by straight
+ lines, and must then mark the subpath as closed. It must then create
+ a new subpath with the point (<var title="">x</var>, <var title="">y</var>) as the only point in the subpath.</p>
+
+
+ <!-- v5 feature request:
+ * points as a primitive shape
+ http://home.comcast.net/~urbanjost/canvas/vogle4.html
+ -->
+
+
+ <p>The <dfn id=dom-context-2d-fill title=dom-context-2d-fill><code>fill()</code></dfn>
+ method must fill all the subpaths of the current path, using
+ <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, and using
+ the non-zero winding number rule. Open subpaths must be implicitly
+ closed when being filled (without affecting the actual
+ subpaths).</p>
+
+ <p class=note>Thus, if two overlapping but otherwise independent
+ subpaths have opposite windings, they cancel out and result in no
+ fill. If they have the same winding, that area just gets painted
+ once.</p>
+
+ <p>The <dfn id=dom-context-2d-stroke title=dom-context-2d-stroke><code>stroke()</code></dfn> method
+ must calculate the strokes of all the subpaths of the current path,
+ using the <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>,
+ <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, and (if
+ appropriate) <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attributes, and
+ then fill the combined stroke area using the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>
+ attribute.</p>
+
+ <p class=note>Since the subpaths are all stroked as one,
+ overlapping parts of the paths in one stroke operation are treated
+ as if their union was what was painted.</p>
+
+ <p>Paths, when filled or stroked, must be painted without affecting
+ the current path, and must be subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ operators</a>. (Transformations affect the path when the path is
+ created, not when it is painted, though the stroke <em>style</em> is
+ still affected by the transformation during painting.)</p>
+
+ <p>Zero-length line segments must be pruned before stroking a
+ path. Empty subpaths must be ignored.</p>
+
+
+ <p>The <dfn id=dom-context-2d-clip title=dom-context-2d-clip><code>clip()</code></dfn>
+ method must create a new <dfn id=clipping-region>clipping region</dfn> by calculating
+ the intersection of the current clipping region and the area
+ described by the current path, using the non-zero winding number
+ rule. Open subpaths must be implicitly closed when computing the
+ clipping region, without affecting the actual subpaths. The new
+ clipping region replaces the current clipping region.</p>
+
+ <p>When the context is initialized, the clipping region must be set
+ to the rectangle with the top left corner at (0,0) and the width and
+ height of the coordinate space.</p>
+
+ <!-- v5
+ Jordan OSETE suggests:
+ * support ways of extending the clipping region (union instead of intersection)
+ - also "add", "subtract", "replace", "intersect" and "xor"
+ * support ways of resetting the clipping region without save/restore
+ -->
+
+
+ <p>The <dfn id=dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath><code>isPointInPath(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
+ return true if the point given by the <var title="">x</var> and <var title="">y</var> coordinates passed to the method, when treated as
+ coordinates in the canvas coordinate space unaffected by the current
+ transformation, is inside the current path as determined by the
+ non-zero winding number rule; and must return false
+ otherwise. Points on the path itself are considered to be inside the
+ path. If either of the arguments is infinite or NaN, then the method
+ must return false.</p>
+
+ </div>
+
+
+ <h6 id=focus-management-0><span class=secno>4.8.11.1.9 </span>Focus management</h6> <!-- a v4 feature -->
+
+ <p>When a canvas is interactive, authors should include focusable
+ elements in the element's fallback content corresponding to each
+ focusable part of the canvas.</p>
+
+ <p>To indicate which focusable part of the canvas is currently
+ focused, authors should use the <code title=dom-context-2d-drawFocusRing><a href=#dom-context-2d-drawfocusring>drawFocusRing()</a></code> method,
+ passing it the element for which a ring is being drawn. This method
+ only draws the focus ring if the element is focused, so that it can
+ simply be called whenever drawing the element, without checking
+ whether the element is focused or not first. The position of the
+ center of the control, or of the editing caret if the control has
+ one, should be given in the <var title="">x</var> and <var title="">y</var> arguments.</p>
+
+ <dl class=domintro><dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title=dom-context-2d-drawFocusRing><a href=#dom-context-2d-drawfocusring>drawFocusRing</a></code>(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>, [ <var title="">canDrawCustom</var> ])</dt>
+
+ <dd>
+
+ <p>If the given element is focused, draws a focus ring around the
+ current path, following the platform conventions for focus
+ rings. The given coordinate is used if the user's attention needs
+ to be brought to a particular position (e.g. if a magnifier is
+ following the editing caret in a text field).</p>
+
+ <p>If the <var title="">canDrawCustom</var> argument is true, then
+ the focus ring is only drawn if the user has configured his system
+ to draw focus rings in a particular manner. (For example, high
+ contrast focus rings.)</p>
+
+ <p>Returns true if the given element is focused, the <var title="">canDrawCustom</var> argument is true, and the user has
+ not configured his system to draw focus rings in a particular
+ manner. Otherwise, returns false.</p>
+
+ <p>When the method returns true, the author is expected to
+ manually draw a focus ring.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-drawfocusring title=dom-context-2d-drawFocusRing><code>drawFocusRing(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>, [<var title="">canDrawCustom</var>])</code></dfn>
+ method, when invoked, must run the following steps:</p>
+
+ <ol><li><p>If <var title="">element</var> is not focused or is not a
+ descendant of the element with whose context the method is
+ associated, then return false and abort these steps.</li>
+
+ <li><p>Transform the given point (<var title="">x</var>, <var title="">y</var>) according to the <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a>.</li>
+
+ <li><p>Optionally, inform the user that the focus is at the given
+ (transformed) coordinate on the canvas. (For example, this could
+ involve moving the user's magnification tool.)</li>
+
+ <li>
+
+ <p>If the user has requested the use of particular focus rings
+ (e.g. high-contrast focus rings), or if the <var title="">canDrawCustom</var> argument is absent or false, then
+ draw a focus ring of the appropriate style along the path,
+ following platform conventions, return false, and abort these
+ steps.</p>
+
+ <p>The focus ring should not be subject to the <a href=#shadows title=shadows>shadow effects</a>, the <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, or the <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ operators</a>, but <em>should</em> be subject to the <a href=#clipping-region title="clipping region">clipping region</a>.</p>
+
+ </li>
+
+ <li><p>Return true.</li>
+
+ </ol></div>
+
+ <div class=example>
+
+ <p>This <code><a href=#the-canvas-element>canvas</a></code> element has a couple of checkboxes:</p>
+
+ <pre>&lt;canvas height=400 width=750&gt;
+ &lt;label&gt;&lt;input type=checkbox id=showA&gt; Show As&lt;/label&gt;
+ &lt;label&gt;&lt;input type=checkbox id=showB&gt; Show Bs&lt;/label&gt;
+ &lt;!-- ... --&gt;
+&lt;/canvas&gt;
+&lt;script&gt;
+ function drawCheckbox(context, element, x, y) {
+ context.save();
+ context.font = '10px sans-serif';
+ context.textAlign = 'left';
+ context.textBaseline = 'middle';
+ var metrics = context.measureText(element.labels[0].textContent);
+ context.beginPath();
+ context.strokeStyle = 'black';
+ context.rect(x-5, y-5, 10, 10);
+ context.stroke();
+ if (element.checked) {
+ context.fillStyle = 'black';
+ context.fill();
+ }
+ context.fillText(element.labels[0].textContent, x+5, y);
+ context.beginPath();
+ context.rect(x-7, y-7, 12 + metrics.width+2, 14);
+ if (context.drawFocusRing(element, x, y, true)) {
+ context.strokeStyle = 'silver';
+ context.stroke();
+ }
+ context.restore();
+ }
+ function drawBase() { /* ... */ }
+ function drawAs() { /* ... */ }
+ function drawBs() { /* ... */ }
+ function redraw() {
+ var canvas = document.getElementsByTagName('canvas')[0];
+ var context = canvas.getContext('2d');
+ context.clearRect(0, 0, canvas.width, canvas.height);
+ drawCheckbox(context, document.getElementById('showA'), 20, 40);
+ drawCheckbox(context, document.getElementById('showB'), 20, 60);
+ drawBase();
+ if (document.getElementById('showA').checked)
+ drawAs();
+ if (document.getElementById('showB').checked)
+ drawBs();
+ }
+ function processClick(event) {
+ var canvas = document.getElementsByTagName('canvas')[0];
+ var context = canvas.getContext('2d');
+ var x = event.clientX - canvas.offsetLeft;
+ var y = event.clientY - canvas.offsetTop;
+ drawCheckbox(context, document.getElementById('showA'), 20, 40);
+ if (context.isPointInPath(x, y))
+ document.getElementById('showA').checked = !(document.getElementById('showA').checked);
+ drawCheckbox(context, document.getElementById('showB'), 20, 60);
+ if (context.isPointInPath(x, y))
+ document.getElementById('showB').checked = !(document.getElementById('showB').checked);
+ redraw();
+ }
+ document.getElementsByTagName('canvas')[0].addEventListener('focus', redraw, true);
+ document.getElementsByTagName('canvas')[0].addEventListener('blur', redraw, true);
+ document.getElementsByTagName('canvas')[0].addEventListener('change', redraw, true);
+ document.getElementsByTagName('canvas')[0].addEventListener('click', processClick, false);
+ redraw();
+&lt;/script&gt;</pre>
+<!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/340 -->
+
+ </div>
+
+
+ <h6 id=text-0><span class=secno>4.8.11.1.10 </span>Text</h6> <!-- a v3 feature -->
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current font settings.</p>
+
+ <p>Can be set, to change the font. The syntax is the same as for
+ the CSS 'font' property; values that cannot be parsed as CSS font
+ values are ignored.</p>
+
+ <p>Relative keywords and lengths are computed relative to the font
+ of the <code><a href=#the-canvas-element>canvas</a></code> element.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current text alignment settings.</p>
+
+ <p>Can be set, to change the alignment. The possible values are
+ <code title="">start</code>, <code title="">end</code>, <code title="">left</code>, <code title="">right</code>, and <code title="">center</code>. Other values are ignored. The default is
+ <code title="">start</code>.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current baseline alignment settings.</p>
+
+ <p>Can be set, to change the baseline alignment. The possible
+ values and their meanings are given below. Other values are
+ ignored. The default is <code title="">alphabetic</code>.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-fillText><a href=#dom-context-2d-filltext>fillText</a></code>(<var title="">text</var>, <var title="">x</var>, <var title="">y</var> [, <var title="">maxWidth</var> ] )</dt>
+ <dt><var title="">context</var> . <code title=dom-context-2d-strokeText><a href=#dom-context-2d-stroketext>strokeText</a></code>(<var title="">text</var>, <var title="">x</var>, <var title="">y</var> [, <var title="">maxWidth</var> ] )</dt>
+
+ <dd>
+
+ <p>Fills or strokes (respectively) the given text at the given
+ position. If a maximum width is provided, the text will be scaled
+ to fit that width if necessary.</p>
+
+ </dd>
+
+ <dt><var title="">metrics</var> = <var title="">context</var> . <code title=dom-context-2d-measureText><a href=#dom-context-2d-measuretext>measureText</a></code>(<var title="">text</var>)</dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#textmetrics>TextMetrics</a></code> object with the metrics of the given text in the current font.</p>
+
+ </dd>
+
+ <dt><var title="">metrics</var> . <code title=dom-textmetrics-width><a href=#dom-textmetrics-width>width</a></code></dt>
+
+ <dd>
+
+ <p>Returns the advance width of the text that was passed to the
+ <code title=dom-context-2d-measureText><a href=#dom-context-2d-measuretext>measureText()</a></code>
+ method.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-font title=dom-context-2d-font><code>font</code></dfn> IDL
+ attribute, on setting, must be parsed the same way as the 'font'
+ property of CSS (but without supporting property-independent style
+ sheet syntax like 'inherit'), and the resulting font must be
+ assigned to the context, with the 'line-height' component forced to
+ 'normal', with the 'font-size' component converted to CSS pixels,
+ and with system fonts being computed to explicit values. If the new
+ value is syntactically incorrect (including using
+ property-independent style sheet syntax like 'inherit' or
+ 'initial'), then it must be ignored, without assigning a new font
+ value. <a href=#refsCSS>[CSS]</a></p>
+
+ <p>Font names must be interpreted in the context of the
+ <code><a href=#the-canvas-element>canvas</a></code> element's stylesheets; any fonts embedded using
+ <code title="">@font-face</code> must therefore be available once
+ they are loaded. (If a font is referenced before it is fully loaded,
+ then it must be treated as if it was an unknown font, falling back
+ to another as described by the relevant CSS specifications.) <a href=#refsCSSFONTS>[CSSFONTS]</a></p>
+
+ <p>Only vector fonts should be used by the user agent; if a user
+ agent were to use bitmap fonts then transformations would likely
+ make the font look very ugly.</p>
+
+ <p>On getting, the <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>
+ attribute must return the <span title="serializing a CSS
+ value">serialized form</span> of the current font of the context
+ (with no 'line-height' component). <a href=#refsCSSOM>[CSSOM]</a></p>
+
+ <div class=example>
+
+ <p>For example, after the following statement:</p>
+
+ <pre>context.font = 'italic 400 12px/2 Unknown Font, sans-serif';</pre>
+
+ <p>...the expression <code title="">context.font</code> would
+ evaluate to the string "<code title="">italic&nbsp;12px&nbsp;"Unknown&nbsp;Font",&nbsp;sans-serif</code>". The
+ "400" font-weight doesn't appear because that is the default
+ value. The line-height doesn't appear because it is forced to
+ "normal", the default value.</p>
+
+ </div>
+
+ <p>When the context is created, the font of the context must be set
+ to 10px sans-serif. When the 'font-size' component is set to lengths
+ using percentages, 'em' or 'ex' units, or the 'larger' or 'smaller'
+ keywords, these must be interpreted relative to the computed value
+ of the 'font-size' property of the corresponding <code><a href=#the-canvas-element>canvas</a></code>
+ element at the time that the attribute is set. When the
+ 'font-weight' component is set to the relative values 'bolder' and
+ 'lighter', these must be interpreted relative to the computed value
+ of the 'font-weight' property of the corresponding
+ <code><a href=#the-canvas-element>canvas</a></code> element at the time that the attribute is
+ set. If the computed values are undefined for a particular case
+ (e.g. because the <code><a href=#the-canvas-element>canvas</a></code> element is not <a href=#in-a-document>in a
+ <code>Document</code></a>), then the relative keywords must be
+ interpreted relative to the normal-weight 10px sans-serif
+ default.</p>
+
+ <p>The <dfn id=dom-context-2d-textalign title=dom-context-2d-textAlign><code>textAlign</code></dfn> IDL
+ attribute, on getting, must return the current value. On setting, if
+ the value is one of <code title="">start</code>, <code title="">end</code>, <code title="">left</code>, <code title="">right</code>, or <code title="">center</code>, then the
+ value must be changed to the new value. Otherwise, the new value
+ must be ignored. When the context is created, the <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> attribute must
+ initially have the value <code title="">start</code>.</p>
+
+ <p>The <dfn id=dom-context-2d-textbaseline title=dom-context-2d-textBaseline><code>textBaseline</code></dfn>
+ IDL attribute, on getting, must return the current value. On
+ setting, if the value is one of <code title=dom-context-2d-textBaseline-top><a href=#dom-context-2d-textbaseline-top>top</a></code>, <code title=dom-context-2d-textBaseline-hanging><a href=#dom-context-2d-textbaseline-hanging>hanging</a></code>, <code title=dom-context-2d-textBaseline-middle><a href=#dom-context-2d-textbaseline-middle>middle</a></code>, <code title=dom-context-2d-textBaseline-alphabetic><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code>,
+ <code title=dom-context-2d-textBaseline-ideographic><a href=#dom-context-2d-textbaseline-ideographic>ideographic</a></code>,
+ or <code title=dom-context-2d-textBaseline-bottom><a href=#dom-context-2d-textbaseline-bottom>bottom</a></code>,
+ then the value must be changed to the new value. Otherwise, the new
+ value must be ignored. When the context is created, the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute
+ must initially have the value <code title="">alphabetic</code>.</p>
+
+ </div>
+
+ <p>The <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>
+ attribute's allowed keywords correspond to alignment points in the
+ font:</p>
+
+ <p><img alt="The top of the em square is
+ roughly at the top of the glyphs in a font, the hanging baseline is
+ where some glyphs like &#2310; are anchored, the middle is half-way
+ between the top of the em square and the bottom of the em square,
+ the alphabetic baseline is where characters like &Aacute;, &yuml;,
+ f, and &Omega; are anchored, the ideographic baseline is
+ where glyphs like &#31169; and &#36948; are anchored, and the bottom
+ of the em square is roughly at the bottom of the glyphs in a
+ font. The top and bottom of the bounding box can be far from these
+ baselines, due to glyphs extending far outside the em square." src=images/baselines.png></p>
+
+ <p>The keywords map to these alignment points as follows:</p>
+
+ <dl><dt><dfn id=dom-context-2d-textbaseline-top title=dom-context-2d-textBaseline-top><code>top</code></dfn>
+ <dd>The top of the em square</dd>
+
+ <dt><dfn id=dom-context-2d-textbaseline-hanging title=dom-context-2d-textBaseline-hanging><code>hanging</code></dfn>
+ <dd>The hanging baseline</dd>
+
+ <dt><dfn id=dom-context-2d-textbaseline-middle title=dom-context-2d-textBaseline-middle><code>middle</code></dfn>
+ <dd>The middle of the em square</dd>
+
+ <dt><dfn id=dom-context-2d-textbaseline-alphabetic title=dom-context-2d-textBaseline-alphabetic><code>alphabetic</code></dfn>
+ <dd>The alphabetic baseline</dd>
+
+ <dt><dfn id=dom-context-2d-textbaseline-ideographic title=dom-context-2d-textBaseline-ideographic><code>ideographic</code></dfn>
+ <dd>The ideographic baseline</dd>
+
+ <dt><dfn id=dom-context-2d-textbaseline-bottom title=dom-context-2d-textBaseline-bottom><code>bottom</code></dfn>
+ <dd>The bottom of the em square</dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-filltext title=dom-context-2d-fillText><code>fillText()</code></dfn> and
+ <dfn id=dom-context-2d-stroketext title=dom-context-2d-strokeText><code>strokeText()</code></dfn>
+ methods take three or four arguments, <var title="">text</var>, <var title="">x</var>, <var title="">y</var>, and optionally <var title="">maxWidth</var>, and render the given <var title="">text</var> at the given (<var title="">x</var>, <var title="">y</var>) coordinates ensuring that the text isn't wider
+ than <var title="">maxWidth</var> if specified, using the current
+ <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code>, and <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>
+ values. Specifically, when the methods are called, the user agent
+ must run the following steps:</p>
+
+ <ol><li><p>Let <var title="">font</var> be the current font of the
+ context, as given by the <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code> attribute.</li>
+
+ <li><p>Replace all the <a href=#space-character title="space character">space
+ characters</a> in <var title="">text</var> with U+0020 SPACE
+ characters.</li>
+
+ <li><p>Form a hypothetical infinitely wide CSS line box containing
+ a single inline box containing the text <var title="">text</var>,
+ with all the properties at their initial values except the 'font'
+ property of the inline box set to <var title="">font</var> and the
+ 'direction' property of the inline box set to <a href=#the-directionality>the
+ directionality</a> of the <code><a href=#the-canvas-element>canvas</a></code> element. <a href=#refsCSS>[CSS]</a></li>
+
+ <!-- if you insert a step here, make sure to adjust the next step's
+ final words -->
+
+ <li><p>If the <var title="">maxWidth</var> argument was specified
+ and the hypothetical width of the inline box in the hypothetical
+ line box is greater than <var title="">maxWidth</var> CSS pixels,
+ then change <var title="">font</var> to have a more condensed font
+ (if one is available or if a reasonably readable one can be
+ synthesized by applying a horizontal scale factor to the font) or a
+ smaller font, and return to the previous step.</li>
+
+ <li>
+
+ <p>Let the <var title="">anchor point</var> be a point on the
+ inline box, determined by the <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> and <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> values, as
+ follows:</p>
+
+ <p>Horizontal position:</p>
+
+ <dl><dt> If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is <code title="">left</code></dt>
+ <dt> If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is <code title="">start</code> and <a href=#the-directionality>the directionality</a> of the
+ <code><a href=#the-canvas-element>canvas</a></code> element is 'ltr'</dt>
+ <dt> If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is <code title="">end</code> and <a href=#the-directionality>the directionality</a> of the
+ <code><a href=#the-canvas-element>canvas</a></code> element is 'rtl'</dt>
+
+ <dd>Let the <var title="">anchor point</var>'s horizontal
+ position be the left edge of the inline box.</dd>
+
+
+ <dt> If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is <code title="">right</code></dt>
+ <dt> If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is <code title="">end</code> and <a href=#the-directionality>the directionality</a> of the
+ <code><a href=#the-canvas-element>canvas</a></code> element is 'ltr'</dt>
+ <dt> If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is <code title="">start</code> and <a href=#the-directionality>the directionality</a> of the
+ <code><a href=#the-canvas-element>canvas</a></code> element is 'rtl'</dt>
+
+ <dd>Let the <var title="">anchor point</var>'s horizontal
+ position be the right edge of the inline box.</dd>
+
+
+ <dt> If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is <code title="">center</code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s horizontal
+ position be half way between the left and right edges of the
+ inline box.</dd>
+
+ </dl><p>Vertical position:</p>
+
+ <dl><dt> If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-top><a href=#dom-context-2d-textbaseline-top>top</a></code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical position
+ be the top of the em box of the first available font of the
+ inline box.</dd>
+
+
+ <dt> If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-hanging><a href=#dom-context-2d-textbaseline-hanging>hanging</a></code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical position
+ be the hanging baseline of the first available font of the inline
+ box.</dd>
+
+
+ <dt> If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-middle><a href=#dom-context-2d-textbaseline-middle>middle</a></code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical position
+ be half way between the bottom and the top of the em box of the
+ first available font of the inline box.</dd>
+
+
+ <dt> If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-alphabetic><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical position
+ be the alphabetic baseline of the first available font of the inline
+ box.</dd>
+
+
+ <dt> If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-ideographic><a href=#dom-context-2d-textbaseline-ideographic>ideographic</a></code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical position
+ be the ideographic baseline of the first available font of the inline
+ box.</dd>
+
+
+ <dt> If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-bottom><a href=#dom-context-2d-textbaseline-bottom>bottom</a></code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical position
+ be the bottom of the em box of the first available font of the
+ inline box.</dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>Paint the hypothetical inline box as the shape given by the
+ text's glyphs, as transformed by the <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a>, and anchored and sized so that before applying the
+ <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a>, the <var title="">anchor point</var> is at (<var title="">x</var>, <var title="">y</var>) and each CSS pixel is
+ mapped to one coordinate space unit.</p>
+
+ <p>For <code title=dom-context-2d-fillText><a href=#dom-context-2d-filltext>fillText()</a></code>
+ <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> must be
+ applied to the glyphs and <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> must be
+ ignored. For <code title=dom-context-2d-strokeText><a href=#dom-context-2d-stroketext>strokeText()</a></code> the reverse
+ holds and <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> must be
+ applied to the glyph outlines and <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> must be
+ ignored.</p>
+
+ <p>Text is painted without affecting the current path, and is
+ subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ operators</a>.</p>
+
+ </li>
+
+ </ol><!--v5DVT - this is commented out until CSS can get its act together
+enough to actual specify vertical text rendering (how long have we
+been waiting now?)
+
+WHEN EDITING THIS, FIX THE PARTS MARKED "&#x0058;&#x0058;&#x0058;" BELOW
+
+ <p>The <dfn
+ title="dom-context-2d-fillVerticalText"><code>fillVerticalText()</code></dfn>
+ and <dfn
+ title="dom-context-2d-strokeVerticalText"><code>strokeVerticalText()</code></dfn>
+ methods take three or four arguments, <var title="">text</var>, <var
+ title="">x</var>, <var title="">y</var>, and optionally <var
+ title="">maxHeight</var>, and render the given <var
+ title="">text</var> as vertical text at the given (<var
+ title="">x</var>, <var title="">y</var>) coordinates ensuring that
+ the text isn't taller than <var title="">maxHeight</var> if
+ specified, using the current <code
+ title="dom-context-2d-font">font</code> and <code
+ title="dom-context-2d-textAlign">textAlign</code>
+ values. Specifically, when the methods are called, the user agent
+ must run the following steps:</p>
+
+ <ol>
+
+ <li><p>Let <var title="">font</var> be the current font of the
+ context, as given by the <code
+ title="dom-context-2d-font">font</code> attribute.</p></li>
+
+ <li><p>Replace all the <span title="space character">space
+ characters</span> in <var title="">text</var> with U+0020 SPACE
+ characters.</p></li>
+
+ <li><p>Form a <em class="&#x0058;&#x0058;&#x0058;">whatever CSS ends up calling
+ vertical line boxes and inline boxes</em> containing the text <var
+ title="">text</var>, with all the properties at their initial
+ values except the 'font' property of the inline box set to <var
+ title="">font</var> and the 'direction' property of the inline
+ box set to <span>the directionality</span> of the <code>canvas</code>
+ element.</p></li>
+
+ <!- - if you insert a step here, make sure to adjust the next step's
+ final words - ->
+
+ <li><p>If the <var title="">maxHeight</var> argument was specified
+ and the hypothetical height of the <em class="&#x0058;&#x0058;&#x0058;">box</em>
+ in the hypothetical line box is greater than <var
+ title="">maxHeight</var> CSS pixels, then change <var
+ title="">font</var> to have a more condensed font (if one is
+ available or if a reasonably readable one can be synthesized by
+ applying an appropriate scale factor to the font) or a smaller
+ font, and return to the previous step.</p></li>
+
+ <li>
+
+ <p>Let the <var title="">anchor point</var> be a point on the <em
+ class="&#x0058;&#x0058;&#x0058;">inline box</var>, determined by the <code
+ title="dom-context-2d-textAlign">textAlign</code>, as follows:</p>
+
+ <p>Vertical position:</p>
+
+ <dl>
+
+ <dt> If <code
+ title="dom-context-2d-textAlign">textAlign</code> is <code
+ title="">start</code></dt>
+ <dt> If <code
+ title="dom-context-2d-textAlign">textAlign</code> is <code
+ title="">left</code> and <span>the directionality</span> of the
+ <code>canvas</code> element is 'ltr'</dt>
+ <dt> If <code
+ title="dom-context-2d-textAlign">textAlign</code> is <code
+ title="">right</code> and <span>the directionality</span> of the
+ <code>canvas</code> element is 'rtl'</dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical
+ position be the top edge of the <em class="&#x0058;&#x0058;&#x0058;">inline
+ box</em>.</dd>
+
+ <dt> If <code
+ title="dom-context-2d-textAlign">textAlign</code> is <code
+ title="">end</code></dt>
+ <dt> If <code
+ title="dom-context-2d-textAlign">textAlign</code> is <code
+ title="">right</code> and <span>the directionality</span> of the
+ <code>canvas</code> element is 'ltr'</dt>
+ <dt> If <code
+ title="dom-context-2d-textAlign">textAlign</code> is <code
+ title="">left</code> and <span>the directionality</span> of the
+ <code>canvas</code> element is 'rtl'</dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical
+ position be the bottom edge of the <em class="&#x0058;&#x0058;&#x0058;">inline
+ box</em>.</dd>
+
+
+ <dt> If <code
+ title="dom-context-2d-textAlign">textAlign</code> is <code
+ title="">center</code></dt>
+
+ <dd>Let the <var title="">anchor point</var>'s vertical position
+ be half way between the top and bottom edges of the <em
+ class="&#x0058;&#x0058;&#x0058;">inline box</em>.</dd>
+
+ </dl>
+
+ <p>Let the horizontal position be half way between the left and
+ right edges of the em box of the first available font of the <em
+ class="&#x0058;&#x0058;&#x0058;">inline box</em>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Paint the hypothetical inline box as the shape given by the
+ text's glyphs, as transformed by the <span
+ title="dom-context-2d-transformation">current transformation
+ matrix</span>, and anchored and sized so that before applying the
+ <span title="dom-context-2d-transformation">current transformation
+ matrix</span>, the <var title="">anchor point</var> is at (<var
+ title="">x</var>, <var title="">y</var>) and each CSS pixel is
+ mapped to one coordinate space unit.</p>
+
+ <p>For <code
+ title="dom-context-2d-fillVerticalText">fillVerticalText()</code>
+ <code title="dom-context-2d-fillStyle">fillStyle</code> must be
+ applied and <code
+ title="dom-context-2d-strokeStyle">strokeStyle</code> must be
+ ignored. For <code
+ title="dom-context-2d-strokeVerticalText">strokeVerticalText()</code>
+ the reverse holds and <code
+ title="dom-context-2d-strokeStyle">strokeStyle</code> must be
+ applied and <code
+ title="dom-context-2d-fillStyle">fillStyle</code> must be
+ ignored.</p>
+
+ <p>Text is painted without affecting the current path, and is
+ subject to <span title="shadows">shadow effects</span>, <span
+ title="dom-context-2d-globalAlpha">global alpha</span>, the <span
+ title="clipping region">clipping region</span>, and <span
+ title="dom-context-2d-globalCompositeOperation">global composition
+ operators</span>.</p>
+
+ </li>
+
+ </ol>
+
+v5DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-context-2d-measuretext title=dom-context-2d-measureText><code>measureText()</code></dfn>
+ method takes one argument, <var title="">text</var>. When the method
+ is invoked, the user agent must replace all the <a href=#space-character title="space
+ character">space characters</a> in <var title="">text</var> with
+ U+0020 SPACE characters, and then must form a hypothetical
+ infinitely wide CSS line box containing a single inline box
+ containing the text <var title="">text</var>, with all the
+ properties at their initial values except the 'font' property of the
+ inline element set to the current font of the context, as given by
+ the <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code> attribute, and
+ must then return a new <code><a href=#textmetrics>TextMetrics</a></code> object with its
+ <code title=dom-textmetrics-width><a href=#dom-textmetrics-width>width</a></code> attribute set to
+ the width of that inline box, in CSS pixels. <a href=#refsCSS>[CSS]</a></p>
+
+ <p>The <code><a href=#textmetrics>TextMetrics</a></code> interface is used for the objects
+ returned from <code title=dom-context-2d-measureText><a href=#dom-context-2d-measuretext>measureText()</a></code>. It has one
+ attribute, <dfn id=dom-textmetrics-width title=dom-textmetrics-width><code>width</code></dfn>, which is set
+ by the <code title=dom-context-2d-measureText><a href=#dom-context-2d-measuretext>measureText()</a></code>
+ method.</p>
+
+ <p class=note>Glyphs rendered using <code title=dom-context-2d-fillText><a href=#dom-context-2d-filltext>fillText()</a></code> and <code title=dom-context-2d-strokeText><a href=#dom-context-2d-stroketext>strokeText()</a></code> can spill out
+ of the box given by the font size (the em square size) and the width
+ returned by <code title=dom-context-2d-measureText><a href=#dom-context-2d-measuretext>measureText()</a></code> (the text
+ width). This version of the specification does not provide a way to
+ obtain the bounding box dimensions of the text. If the text is to be
+ rendered and removed, care needs to be taken to replace the entire
+ area of the canvas that the clipping region covers, not just the box
+ given by the em square height and measured text width.</p>
+
+ <!-- v5: Drawing text along a given path -->
+ <!-- v5: Adding text to a path -->
+ <!-- see also: http://www.w3.org/TR/SVG11/text.html#TextpathLayoutRules -->
+ <!-- see also: http://developer.mozilla.org/en/docs/Drawing_text_using_a_canvas -->
+
+ </div>
+
+ <p class=note>A future version of the 2D context API may provide a
+ way to render fragments of documents, rendered using CSS, straight
+ to the canvas. This would be provided in preference to a dedicated
+ way of doing multiline layout.</p>
+
+
+
+ <h6 id=images><span class=secno>4.8.11.1.11 </span>Images</h6>
+
+ <p>To draw images onto the canvas, the <dfn id=dom-context-2d-drawimage title=dom-context-2d-drawImage><code>drawImage</code></dfn> method
+ can be used.</p>
+
+ <p>This method can be invoked with three different sets of arguments:</p>
+
+ <ul class=brief><li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>)</code>
+ <li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
+ <li><code title="">drawImage(<var title="">image</var>, <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
+ </ul><!-- v3: drawImage() of an ImageData object might make sense (when resizing as well as filtering) - ack Charles Pritchard --><p>Each of those three can take either an
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code>, an <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>, or
+ an <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> for the <var title="">image</var>
+ argument.</p>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>)</dt>
+ <dt><var title="">context</var> . <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</dt>
+ <dt><var title="">context</var> . <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var title="">image</var>, <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</dt>
+
+ <dd>
+
+ <p>Draws the given image onto the canvas. The arguments are
+ interpreted as follows:</p>
+
+ <p><img alt="The sx and sy parameters give the x and y coordinates of the source rectangle; the sw and sh arguments give the width and height of the source rectangle; the dx and dy give the x and y coordinates of the destination rectangle; and the dw and dh arguments give the width and height of the destination rectangle." src=images/drawImage.png></p>
+
+ <p>If the first argument isn't an <code><a href=#the-img-element>img</a></code>,
+ <code><a href=#the-canvas-element>canvas</a></code>, or <code><a href=#video>video</a></code> element, throws a
+ <code><a href=#type_mismatch_err>TYPE_MISMATCH_ERR</a></code> exception. If the image has no
+ image data, throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception. If
+ the numeric arguments don't make sense (e.g. the destination is a
+ 0&times;0 rectangle), throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception. If the image isn't yet fully decoded, then nothing is
+ drawn.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>If not specified, the <var title="">dw</var> and <var title="">dh</var> arguments must default to the values of <var title="">sw</var> and <var title="">sh</var>, interpreted such that
+ one CSS pixel in the image is treated as one unit in the canvas
+ coordinate space. If the <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, and <var title="">sh</var> arguments are omitted, they must default to 0, 0,
+ the image's intrinsic width in image pixels, and the image's
+ intrinsic height in image pixels, respectively.</p>
+
+ <p>The <var title="">image</var> argument is an instance of either
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code>, <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>, or
+ <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>. If the <var title="">image</var> is
+ null, the implementation must raise a <code><a href=#type_mismatch_err>TYPE_MISMATCH_ERR</a></code>
+ exception.</p> <!-- createPattern() has an equivalent paragraph -->
+
+ <p>If the <var title="">image</var> argument is an
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code> object whose <code title=dom-img-complete><a href=#dom-img-complete>complete</a></code> attribute is false, or
+ if the <var title="">image</var> argument is an
+ <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> object whose <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either
+ <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, then the
+ implementation must return without drawing anything.</p>
+ <!-- createPattern() has an equivalent paragraph -->
+
+ <p>If the <var title="">image</var> argument is an
+ <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> object with either a horizontal
+ dimension or a vertical dimension equal to zero, then the
+ implementation must raise an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code>
+ exception.</p>
+ <!-- createPattern() has an equivalent paragraph -->
+
+ <p>The source rectangle is the rectangle whose corners are the four
+ points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>).</p>
+
+ <p>If the source rectangle is not entirely within the source image,
+ or if one of the <var title="">sw</var> or <var title="">sh</var>
+ arguments is zero, the implementation must raise an
+ <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+
+ <p>The destination rectangle is the rectangle whose corners are the
+ four points (<var title="">dx</var>, <var title="">dy</var>),
+ (<span title=""><var title="">dx</var>+<var title="">dw</var></span>, <var title="">dy</var>), (<span title=""><var title="">dx</var>+<var title="">dw</var></span>, <span title=""><var title="">dy</var>+<var title="">dh</var></span>), (<var title="">dx</var>, <span title=""><var title="">dy</var>+<var title="">dh</var></span>).</p>
+
+ <p>When <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> is
+ invoked, the region of the image specified by the source rectangle
+ must be painted on the region of the canvas specified by the
+ destination rectangle, after applying the <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a> to the points of the destination rectangle.</p>
+
+ <p>The original image data of the source image must be used, not the
+ image as it is rendered (e.g. <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes on the source
+ element have no effect). The image data must be processed in the
+ original direction, even if the dimensions given are negative. <!--
+ remove that last sentence if it causes confusion. Someone once
+ suggested that 5,5,-2,-2 was different than 3,3,2,2; this is trying
+ to clarify that this is no the case. --></p>
+
+ <p class=note>This specification does not define the algorithm to
+ use when scaling the image, if necessary.</p>
+
+ <p class=note>When a canvas is drawn onto itself, the drawing
+ model requires the source to be copied before the image is drawn
+ back onto the canvas, so it is possible to copy parts of a canvas
+ onto overlapping parts of itself.</p>
+
+ <p>When the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method
+ is passed an animated image as its <var title="">image</var>
+ argument, the user agent must use the poster frame of the animation,
+ or, if there is no poster frame, the first frame of the
+ animation.</p>
+ <!-- createPattern() has an equivalent paragraph -->
+
+ <p>When the <var title="">image</var> argument is an
+ <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>, then the frame at the <a href=#current-playback-position>current
+ playback position</a> must be used as the source image, and the
+ source image's dimensions must be the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> and
+ <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a>
+ of the <a href=#media-resource>media resource</a> (i.e. after any aspect-ratio
+ correction has been applied).</p>
+ <!-- createPattern() has an equivalent paragraph -->
+
+ <p>Images are painted without affecting the current path, and are
+ subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ operators</a>.</p>
+
+ </div>
+
+
+
+ <h6 id=pixel-manipulation><span class=secno>4.8.11.1.12 </span><dfn>Pixel manipulation</dfn></h6>
+
+ <dl class=domintro><dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var title="">sw</var>, <var title="">sh</var>)</dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#imagedata>ImageData</a></code> object with the given
+ dimensions in CSS pixels (which might map to a different number of
+ actual device pixels exposed by the object itself). All the pixels
+ in the returned object are transparent black.</p>
+
+ </dd>
+
+ <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var title="">imagedata</var>)</dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#imagedata>ImageData</a></code> object with the same
+ dimensions as the argument. All the pixels in the returned object
+ are transparent black.</p>
+
+ <p>Throws a <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception if the
+ argument is null.</p>
+
+ </dd>
+
+ <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData</a></code>(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#imagedata>ImageData</a></code> object containing the image
+ data for the given rectangle of the canvas.</p>
+
+ <p>Throws a <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception if any of the
+ arguments are not finite. Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception if the either of the width or height arguments are
+ zero.</p>
+
+ </dd>
+
+ <dt><var title="">imagedata</var> . <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code></dt>
+ <dt><var title="">imagedata</var> . <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code></dt>
+
+ <dd>
+
+ <p>Returns the actual dimensions of the data in the <code><a href=#imagedata>ImageData</a></code> object, in device pixels.</p>
+
+ </dd>
+
+ <dt><var title="">imagedata</var> . <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code></dt>
+
+ <dd>
+
+ <p>Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData</a></code>(<var title="">imagedata</var>, <var title="">dx</var>, <var title="">dy</var> [, <var title="">dirtyX</var>, <var title="">dirtyY</var>, <var title="">dirtyWidth</var>, <var title="">dirtyHeight</var> ])</dt>
+
+ <dd>
+
+ <p>Paints the data from the given <code><a href=#imagedata>ImageData</a></code> object
+ onto the canvas. If a dirty rectangle is provided, only the pixels
+ from that rectangle are painted.</p>
+
+ <p>The <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>
+ and <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
+ attributes, as well as the shadow attributes, are ignored for the
+ purposes of this method call; pixels in the canvas are replaced
+ wholesale, with no composition, alpha blending, no shadows,
+ etc.</p>
+
+ <p>If the first argument isn't an <code><a href=#imagedata>ImageData</a></code> object,
+ throws a <code><a href=#type_mismatch_err>TYPE_MISMATCH_ERR</a></code> exception. Throws a
+ <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception if any of the other
+ arguments are not finite.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-createimagedata title=dom-context-2d-createImageData><code>createImageData()</code></dfn>
+ method is used to instantiate new blank <code><a href=#imagedata>ImageData</a></code>
+ objects. When the method is invoked with two arguments <var title="">sw</var> and <var title="">sh</var>, it must return an
+ <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with a width
+ in CSS pixels equal to the absolute magnitude of <var title="">sw</var> and a height in CSS pixels equal to the absolute
+ magnitude of <var title="">sh</var>. When invoked with a single <var title="">imagedata</var> argument, it must return an
+ <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with the same
+ dimensions as the <code><a href=#imagedata>ImageData</a></code> object passed as the
+ argument. The <code><a href=#imagedata>ImageData</a></code> object return must be filled
+ with transparent black.</p>
+
+ <p>The <dfn id=dom-context-2d-getimagedata title=dom-context-2d-getImageData><code>getImageData(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>,
+ <var title="">sh</var>)</code></dfn> method must return an
+ <code><a href=#imagedata>ImageData</a></code> object representing the underlying pixel data
+ for the area of the canvas denoted by the rectangle whose corners are
+ the four points (<var title="">sx</var>, <var title="">sy</var>),
+ (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in canvas
+ coordinate space units. Pixels outside the canvas must be returned
+ as transparent black. Pixels must be returned as non-premultiplied
+ alpha values.</p>
+
+ <p>If any of the arguments to <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData()</a></code> or
+ <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> are
+ infinite or NaN, or if the <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData()</a></code>
+ method is invoked with only one argument but that argument is null,
+ the method must instead raise a <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code>
+ exception. If either the <var title="">sw</var> or <var title="">sh</var> arguments are zero, the method must instead raise
+ an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+
+ <p><code><a href=#imagedata>ImageData</a></code> objects must be initialized so that their
+ <dfn id=dom-imagedata-width title=dom-imagedata-width><code>width</code></dfn> attribute
+ is set to <var title="">w</var>, the number of physical device
+ pixels per row in the image data, their <dfn id=dom-imagedata-height title=dom-imagedata-height><code>height</code></dfn> attribute is
+ set to <var title="">h</var>, the number of rows in the image data,
+ and their <dfn id=dom-imagedata-data title=dom-imagedata-data><code>data</code></dfn>
+ attribute is initialized to a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object
+ holding the image data. At least one pixel's worth of image data
+ must be returned.</p>
+
+ <p>The <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object provides ordered,
+ indexed access to the color components of each pixel of the image
+ data. The data must be represented in left-to-right order, row by
+ row top to bottom, starting with the top left, with each pixel's
+ red, green, blue, and alpha components being given in that order for
+ each pixel. Each component of each device pixel represented in this
+ array must be in the range 0..255, representing the 8 bit value for
+ that component. The components must be assigned consecutive indices
+ starting with 0 for the top left pixel's red component.</p>
+
+ <p>The <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object thus represents <var title="">h</var>&times;<var title="">w</var>&times;4 integers. The
+ <dfn id=dom-canvaspixelarray-length title=dom-canvaspixelarray-length><code>length</code></dfn>
+ attribute of a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object must return this
+ number.</p>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are the numbers in the range 0 .. <span title=""><var title="">h</var>&times;<var title="">w</var>&times;4-1</span>.</p>
+
+ <p>When a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object is <dfn id=dom-canvaspixelarray-get title=dom-CanvasPixelArray-get>indexed to retrieve an indexed
+ property</dfn> <var title="">index</var>, the value returned must be
+ the value of the <var title="">index</var>th component in the
+ array.</p>
+
+ <p>When a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object is <dfn id=dom-canvaspixelarray-set title=dom-CanvasPixelArray-set>indexed to modify an indexed
+ property</dfn> <var title="">index</var> with value <var title="">value</var>, the value of the <var title="">index</var>th
+ component in the array must be set to <var title="">value</var>.</p>
+
+ <p class=note>The width and height (<var title="">w</var> and <var title="">h</var>) might be different from the <var title="">sw</var>
+ and <var title="">sh</var> arguments to the above methods, e.g. if
+ the canvas is backed by a high-resolution bitmap, or if the <var title="">sw</var> and <var title="">sh</var> arguments are
+ negative.</p>
+
+ <p>The <dfn id=dom-context-2d-putimagedata title=dom-context-2d-putImageData><code>putImageData(<var title="">imagedata</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dirtyX</var>, <var title="">dirtyY</var>, <var title="">dirtyWidth</var>, <var title="">dirtyHeight</var>)</code></dfn> method writes data from
+ <code><a href=#imagedata>ImageData</a></code> structures back to the canvas.</p>
+
+ <p>If any of the arguments to the method are infinite or NaN, the
+ method must raise a <code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception.</p>
+
+ <p>If the first argument to the method is null or not an
+ <code><a href=#imagedata>ImageData</a></code> object then the <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code> method
+ must raise a <code><a href=#type_mismatch_err>TYPE_MISMATCH_ERR</a></code> exception.</p>
+
+ <p>When the last four arguments are omitted, they must be assumed to
+ have the values 0, 0, the <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> member of the <var title="">imagedata</var> structure, and the <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> member of the <var title="">imagedata</var> structure, respectively.</p>
+
+ <p>When invoked with arguments that do not, per the last few
+ paragraphs, cause an exception to be raised, the <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code> method
+ must act as follows:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">dx<sub>device</sub></var> be the x-coordinate
+ of the device pixel in the underlying pixel data of the canvas
+ corresponding to the <var title="">dx</var> coordinate in the
+ canvas coordinate space.</p>
+
+ <p>Let <var title="">dy<sub>device</sub></var> be the y-coordinate
+ of the device pixel in the underlying pixel data of the canvas
+ corresponding to the <var title="">dy</var> coordinate in the
+ canvas coordinate space.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">dirtyWidth</var> is negative, let <var title="">dirtyX</var> be <span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span>, and let <var title="">dirtyWidth</var> be equal to the absolute magnitude of
+ <var title="">dirtyWidth</var>.</p>
+
+ <p>If <var title="">dirtyHeight</var> is negative, let <var title="">dirtyY</var> be <span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span>, and let <var title="">dirtyHeight</var> be equal to the absolute magnitude of
+ <var title="">dirtyHeight</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">dirtyX</var> is negative, let <var title="">dirtyWidth</var> be <span title=""><var title="">dirtyWidth</var>+<var title="">dirtyX</var></span>, and
+ let <var title="">dirtyX</var> be zero.</p>
+
+ <p>If <var title="">dirtyY</var> is negative, let <var title="">dirtyHeight</var> be <span title=""><var title="">dirtyHeight</var>+<var title="">dirtyY</var></span>, and
+ let <var title="">dirtyY</var> be zero.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span> is greater than the <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> attribute of the <var title="">imagedata</var> argument, let <var title="">dirtyWidth</var> be the value of that <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> attribute, minus the
+ value of <var title="">dirtyX</var>.</p>
+
+ <p>If <span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span> is greater than the <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> attribute of the <var title="">imagedata</var> argument, let <var title="">dirtyHeight</var> be the value of that <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> attribute, minus the
+ value of <var title="">dirtyY</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If, after those changes, either <var title="">dirtyWidth</var>
+ or <var title="">dirtyHeight</var> is negative or zero, stop these
+ steps without affecting the canvas.</p>
+
+ </li>
+
+ <li><p>Otherwise, for all integer values of <var title="">x</var>
+ and <var title="">y</var> where <span title=""><var title="">dirtyX</var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span></span>
+ and <span title=""><var title="">dirtyY</var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span></span>, copy the four channels of
+ the pixel with coordinate (<var title="">x</var>, <var title="">y</var>) in the <var title="">imagedata</var> data
+ structure to the pixel with coordinate (<span title=""><var title="">dx<sub>device</sub></var>+<var title="">x</var></span>,
+ <span title=""><var title="">dy<sub>device</sub></var>+<var title="">y</var></span>) in the underlying pixel data of the
+ canvas.</li>
+
+ </ol><p>The handling of pixel rounding when the specified coordinates do
+ not exactly map to the device coordinate space is not defined by
+ this specification, except that the following must result in no
+ visible changes to the rendering:</p>
+
+ <pre>context.putImageData(context.getImageData(x, y, w, h), p, q);</pre>
+
+ <p>...for any value of <var title="">x</var>, <var title="">y</var>,
+ <var title="">w</var>, and <var title="">h</var> and where <var title="">p</var> is the smaller of <var title="">x</var> and the sum
+ of <var title="">x</var> and <var title="">w</var>, and <var title="">q</var> is the smaller of <var title="">y</var> and the sum
+ of <var title="">y</var> and <var title="">h</var>; and except that
+ the following two calls:</p>
+
+ <pre>context.createImageData(w, h);
+context.getImageData(0, 0, w, h);</pre>
+
+ <p>...must return <code><a href=#imagedata>ImageData</a></code> objects with the same
+ dimensions, for any value of <var title="">w</var> and <var title="">h</var>. In other words, while user agents may round the
+ arguments of these methods so that they map to device pixel
+ boundaries, any rounding performed must be performed consistently
+ for all of the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>createImageData()</a></code>, <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> and <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code>
+ operations.</p>
+
+ <p class=note>Due to the lossy nature of converting to and from
+ premultiplied alpha color values, pixels that have just been set
+ using <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code> might be
+ returned to an equivalent <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> as
+ different values.</p>
+
+ <p>The current path, <a href=#transformations title=dom-context-2d-transformation>transformation matrix</a>,
+ <a href=#shadows title=shadows>shadow attributes</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ operator</a> must not affect the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> and <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code>
+ methods.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The data returned by <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> is at the
+ resolution of the canvas backing store, which is likely to not be
+ one device pixel to each CSS pixel if the display used is a high
+ resolution display.</p>
+
+ <p>In the following example, the script generates an
+ <code><a href=#imagedata>ImageData</a></code> object so that it can draw onto it.</p>
+
+ <pre>// canvas is a reference to a &lt;canvas&gt; element
+var context = canvas.getContext('2d');
+
+// create a blank slate
+var data = context.createImageData(canvas.width, canvas.height);
+
+// create some plasma
+FillPlasma(data, 'green'); // green plasma
+
+// add a cloud to the plasma
+AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle
+
+// paint the plasma+cloud on the canvas
+context.putImageData(data, 0, 0);
+
+// support methods
+function FillPlasma(data, color) { ... }
+function AddCloud(data, x, y) { ... }</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example of using <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> and <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code> to
+ implement an edge detection filter.</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Edge detection demo&lt;/title&gt;
+ &lt;script&gt;
+ var image = new Image();
+ function init() {
+ image.onload = demo;
+ image.src = "image.jpeg";
+ }
+ function demo() {
+ var canvas = document.getElementsByTagName('canvas')[0];
+ var context = canvas.getContext('2d');
+
+ // draw the image onto the canvas
+ context.drawImage(image, 0, 0);
+
+ // get the image data to manipulate
+ var input = context.getImageData(0, 0, canvas.width, canvas.height);
+
+ // get an empty slate to put the data into
+ var output = context.createImageData(canvas.width, canvas.height);
+
+ // alias some variables for convenience
+ // notice that we are using input.width and input.height here
+ // as they might not be the same as canvas.width and canvas.height
+ // (in particular, they might be different on high-res displays)
+ var w = input.width, h = input.height;
+ var inputData = input.data;
+ var outputData = output.data;
+
+ // edge detection
+ for (var y = 1; y &lt; h-1; y += 1) {
+ for (var x = 1; x &lt; w-1; x += 1) {
+ for (var c = 0; c &lt; 3; c += 1) {
+ var i = (y*w + x)*4 + c;
+ outputData[i] = 127 + -inputData[i - w*4 - 4] - inputData[i - w*4] - inputData[i - w*4 + 4] +
+ -inputData[i - 4] + 8*inputData[i] - inputData[i + 4] +
+ -inputData[i + w*4 - 4] - inputData[i + w*4] - inputData[i + w*4 + 4];
+ }
+ outputData[(y*w + x)*4 + 3] = 255; // alpha
+ }
+ }
+
+ // put the image data back after manipulation
+ context.putImageData(output, 0, 0);
+ }
+ &lt;/script&gt;
+ &lt;/head&gt;
+ &lt;body onload="init()"&gt;
+ &lt;canvas&gt;&lt;/canvas&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h6 id=drawing-model><span class=secno>4.8.11.1.13 </span>Drawing model</h6>
+
+ <p>When a shape or image is painted, user agents must follow these
+ steps, in the order given (or act as if they do):</p>
+
+ <ol><li><p>Render the shape or image onto an infinite transparent black
+ bitmap, creating image <var title="">A</var>, as described in the
+ previous sections. For shapes, the current fill, stroke, and line
+ styles must be honored, and the stroke must itself also be
+ subjected to the current transformation matrix.</li>
+
+ <li><p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, render the shadow from
+ image <var title="">A</var>, using the current shadow styles,
+ creating image <var title="">B</var>.</li>
+
+ <li><p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, multiply the alpha
+ component of every pixel in <var title="">B</var> by <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>.</li>
+
+ <li><p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, composite <var title="">B</var> within the clipping region over the current canvas
+ bitmap using the current composition operator.</li>
+
+ <li><p>Multiply the alpha component of every pixel in <var title="">A</var> by <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>.</li>
+
+ <li><p>Composite <var title="">A</var> within the clipping region
+ over the current canvas bitmap using the current composition
+ operator.</li>
+
+ </ol></div>
+
+
+ <h6 id=examples><span class=secno>4.8.11.1.14 </span>Examples</h6>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Here is an example of a script that uses canvas to draw pretty
+ glowing lines.</p>
+
+ <pre>&lt;canvas width="800" height="450"&gt;&lt;/canvas&gt;
+&lt;script&gt;
+
+ var context = document.getElementsByTagName('canvas')[0].getContext('2d');
+
+ var lastX = context.canvas.width * Math.random();
+ var lastY = context.canvas.height * Math.random();
+ var hue = 0;
+ function line() {
+ context.save();
+ context.translate(context.canvas.width/2, context.canvas.height/2);
+ context.scale(0.9, 0.9);
+ context.translate(-context.canvas.width/2, -context.canvas.height/2);
+ context.beginPath();
+ context.lineWidth = 5 + Math.random() * 10;
+ context.moveTo(lastX, lastY);
+ lastX = context.canvas.width * Math.random();
+ lastY = context.canvas.height * Math.random();
+ context.bezierCurveTo(context.canvas.width * Math.random(),
+ context.canvas.height * Math.random(),
+ context.canvas.width * Math.random(),
+ context.canvas.height * Math.random(),
+ lastX, lastY);
+
+ hue = hue + 10 * Math.random();
+ context.strokeStyle = 'hsl(' + hue + ', 50%, 50%)';
+ context.shadowColor = 'white';
+ context.shadowBlur = 10;
+ context.stroke();
+ context.restore();
+ }
+ setInterval(line, 50);
+
+ function blank() {
+ context.fillStyle = 'rgba(0,0,0,0.1)';
+ context.fillRect(0, 0, context.canvas.width, context.canvas.height);
+ }
+ setInterval(blank, 40);
+
+&lt;/script&gt;</pre>
+
+
+
+ </div><!--data-component-->
+
+
+
+ <div class=impl>
+
+ <h5 id=color-spaces-and-color-correction><span class=secno>4.8.11.2 </span>Color spaces and color correction</h5>
+
+ <p>The <code><a href=#the-canvas-element>canvas</a></code> APIs must perform color correction at
+ only two points: when rendering images with their own gamma
+ correction and color space information onto the canvas, to convert
+ the image to the color space used by the canvas (e.g. using the 2D
+ Context's <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code>
+ method with an <code><a href=#htmlimageelement>HTMLImageElement</a></code> object), and when
+ rendering the actual canvas bitmap to the output device.</p>
+
+ <p class=note>Thus, in the 2D context, colors used to draw shapes
+ onto the canvas will exactly match colors obtained through the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code>
+ method.</p>
+
+ <p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method
+ must not include color space information in the resource
+ returned. Where the output format allows it, the color of pixels in
+ resources created by <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> must match those
+ returned by the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code>
+ method.</p>
+
+ <p>In user agents that support CSS, the color space used by a
+ <code><a href=#the-canvas-element>canvas</a></code> element must match the color space used for
+ processing any colors for that element in CSS.</p>
+
+ <p>The gamma correction and color space information of images must
+ be handled in such a way that an image rendered directly using an
+ <code><a href=#the-img-element>img</a></code> element would use the same colors as one painted on
+ a <code><a href=#the-canvas-element>canvas</a></code> element that is then itself
+ rendered. Furthermore, the rendering of images that have no color
+ correction information (such as those returned by the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method) must be
+ rendered with no color correction.</p>
+
+ <p class=note>Thus, in the 2D context, calling the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method to render
+ the output of the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method to the
+ canvas, given the appropriate dimensions, has no visible effect.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=security-with-canvas-elements><span class=secno>4.8.11.3 </span>Security with <code><a href=#the-canvas-element>canvas</a></code> elements</h5>
+
+ <p><strong>Information leakage</strong> can occur if scripts from
+ one <a href=#origin>origin</a> can access information (e.g. read pixels)
+ from images from another origin (one that isn't the <a href=#same-origin title="same origin">same</a>).</p>
+
+ <p>To mitigate this, <code><a href=#the-canvas-element>canvas</a></code> elements are defined to
+ have a flag indicating whether they are <i>origin-clean</i>. All
+ <code><a href=#the-canvas-element>canvas</a></code> elements must start with their
+ <i>origin-clean</i> set to true. The flag must be set to false if
+ any of the following actions occur:</p>
+
+ <ul><li><p>The element's 2D context's <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method is
+ called with an <code><a href=#htmlimageelement>HTMLImageElement</a></code> or an
+ <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> whose <a href=#origin>origin</a> is not the
+ <a href=#same-origin title="same origin">same</a> as that of the
+ <code><a href=#document>Document</a></code> object that owns the <code><a href=#the-canvas-element>canvas</a></code>
+ element.</li>
+
+ <li><p>The element's 2D context's <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method is
+ called with an <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> whose
+ <i>origin-clean</i> flag is false.</li>
+
+ <li><p>The element's 2D context's <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> attribute is set
+ to a <code><a href=#canvaspattern>CanvasPattern</a></code> object that was created from an
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code> or an <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>
+ whose <a href=#origin>origin</a> was not the <a href=#same-origin title="same
+ origin">same</a> as that of the <code><a href=#document>Document</a></code> object
+ that owns the <code><a href=#the-canvas-element>canvas</a></code> element when the pattern was
+ created.</li>
+
+ <li><p>The element's 2D context's <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> attribute is set
+ to a <code><a href=#canvaspattern>CanvasPattern</a></code> object that was created from an
+ <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> whose <i>origin-clean</i> flag was
+ false when the pattern was created.</li>
+
+ <li><p>The element's 2D context's <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute is
+ set to a <code><a href=#canvaspattern>CanvasPattern</a></code> object that was created from an
+ <code><a href=#htmlimageelement>HTMLImageElement</a></code> or an <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>
+ whose <a href=#origin>origin</a> was not the <a href=#same-origin title="same
+ origin">same</a> as that of the <code><a href=#document>Document</a></code> object
+ that owns the <code><a href=#the-canvas-element>canvas</a></code> element when the pattern was
+ created.</li>
+
+ <li><p>The element's 2D context's <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute is
+ set to a <code><a href=#canvaspattern>CanvasPattern</a></code> object that was created from an
+ <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> whose <i>origin-clean</i> flag was
+ false when the pattern was created.</li>
+
+ </ul><p>Whenever the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method of a
+ <code><a href=#the-canvas-element>canvas</a></code> element whose <i>origin-clean</i> flag is set to
+ false is called, the method must raise a <code><a href=#security_err>SECURITY_ERR</a></code>
+ exception.</p>
+
+ <p>Whenever the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> method of
+ the 2D context of a <code><a href=#the-canvas-element>canvas</a></code> element whose
+ <i>origin-clean</i> flag is set to false is called with otherwise
+ correct arguments, the method must raise a <code><a href=#security_err>SECURITY_ERR</a></code>
+ exception.</p>
+
+ <p class=note>Even resetting the canvas state by changing its
+ <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> or <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> attributes doesn't reset
+ the <i>origin-clean</i> flag.</p>
+
+ </div>
+
+
+
+ <h4 id=the-map-element><span class=secno>4.8.12 </span>The <dfn><code>map</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd>When the element only contains <a href=#phrasing-content>phrasing content</a>: <a href=#phrasing-content>phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#transparent>Transparent</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-map-name><a href=#attr-map-name>name</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlmapelement>HTMLMapElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-map-name title=dom-map-name>name</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-map-areas title=dom-map-areas>areas</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-map-images title=dom-map-images>images</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-map-element>map</a></code> element, in conjunction with any
+ <code><a href=#the-area-element>area</a></code> element descendants, defines an <a href=#image-map>image
+ map</a>. The element <a href=#represents>represents</a> its children.</p>
+
+ <p>The <dfn id=attr-map-name title=attr-map-name><code>name</code></dfn> attribute
+ gives the map a name so that it can be referenced. The attribute
+ must be present and must have a non-empty value with no <a href=#space-character title="space character">space characters</a>. The value of the
+ <code title=attr-map-name><a href=#attr-map-name>name</a></code> attribute must not be a
+ <a href=#compatibility-caseless title="compatibility caseless">compatibility-caseless</a>
+ match for the value of the <code title=attr-map-name><a href=#attr-map-name>name</a></code>
+ attribute of another <code><a href=#the-map-element>map</a></code> element in the same
+ document. If the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute is also
+ specified, both attributes must have the same value.</p>
+
+ <dl class=domintro><dt><var title="">map</var> . <code title=dom-map-areas><a href=#dom-map-areas>areas</a></code></dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-area-element>area</a></code> elements in the <code><a href=#the-map-element>map</a></code>.</p>
+
+ </dd>
+
+ <dt><var title="">map</var> . <code title=dom-map-images><a href=#dom-map-images>images</a></code></dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-img-element>img</a></code> and <code><a href=#the-object-element>object</a></code> elements that use the <code><a href=#the-map-element>map</a></code>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-map-areas title=dom-map-areas><code>areas</code></dfn> attribute
+ must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#the-map-element>map</a></code> element, whose filter matches only
+ <code><a href=#the-area-element>area</a></code> elements.</p>
+
+ <p>The <dfn id=dom-map-images title=dom-map-images><code>images</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only
+ <code><a href=#the-img-element>img</a></code> and <code><a href=#the-object-element>object</a></code> elements that are
+ associated with this <code><a href=#the-map-element>map</a></code> element according to the
+ <a href=#image-map>image map</a> processing model.</p>
+
+ <p>The IDL attribute <dfn id=dom-map-name title=dom-map-name><code>name</code></dfn> must
+ <a href=#reflect>reflect</a> the content attribute of the same name.</p>
+
+ </div>
+
+
+
+ <h4 id=the-area-element><span class=secno>4.8.13 </span>The <dfn><code>area</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected, but only if there is a <code><a href=#the-map-element>map</a></code> element ancestor.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-area-alt><a href=#attr-area-alt>alt</a></code></dd>
+ <dd><code title=attr-area-coords><a href=#attr-area-coords>coords</a></code></dd>
+ <dd><code title=attr-area-shape><a href=#attr-area-shape>shape</a></code></dd>
+ <dd><code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code></dd>
+ <dd><code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code></dd>
+<!--PING-->
+ <dd><code title=attr-hyperlink-ping><a href=#ping>ping</a></code></dd>
+<!--PING-->
+ <dd><code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code></dd>
+ <dd><code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code></dd>
+ <dd><code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code></dd>
+ <dd><code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlareaelement>HTMLAreaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-area-alt title=dom-area-alt>alt</a>;
+ attribute DOMString <a href=#dom-area-coords title=dom-area-coords>coords</a>;
+ attribute DOMString <a href=#dom-area-shape title=dom-area-shape>shape</a>;
+ stringifier attribute DOMString <a href=#dom-area-href title=dom-area-href>href</a>;
+ attribute DOMString <a href=#dom-area-target title=dom-area-target>target</a>;
+<!--PING-->
+ attribute DOMString <a href=#dom-area-ping title=dom-area-ping>ping</a>;
+<!--PING-->
+ attribute DOMString <a href=#dom-area-rel title=dom-area-rel>rel</a>;
+ readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-area-rellist title=dom-area-relList>relList</a>;
+ attribute DOMString <a href=#dom-area-media title=dom-area-media>media</a>;
+ attribute DOMString <a href=#dom-area-hreflang title=dom-area-hreflang>hreflang</a>;
+ attribute DOMString <a href=#dom-area-type title=dom-area-type>type</a>;
+
+ // <a href=#url-decomposition-idl-attributes>URL decomposition IDL attributes</a>
+ attribute DOMString <a href=#dom-area-protocol title=dom-area-protocol>protocol</a>;
+ attribute DOMString <a href=#dom-area-host title=dom-area-host>host</a>;
+ attribute DOMString <a href=#dom-area-hostname title=dom-area-hostname>hostname</a>;
+ attribute DOMString <a href=#dom-area-port title=dom-area-port>port</a>;
+ attribute DOMString <a href=#dom-area-pathname title=dom-area-pathname>pathname</a>;
+ attribute DOMString <a href=#dom-area-search title=dom-area-search>search</a>;
+ attribute DOMString <a href=#dom-area-hash title=dom-area-hash>hash</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-area-element>area</a></code> element <a href=#represents>represents</a> either a
+ hyperlink with some text and a corresponding area on an <a href=#image-map>image
+ map</a>, or a dead area on an image map.</p>
+
+ <p>If the <code><a href=#the-area-element>area</a></code> element has an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, then the
+ <code><a href=#the-area-element>area</a></code> element represents a <a href=#hyperlink>hyperlink</a>. In
+ this case, the <dfn id=attr-area-alt title=attr-area-alt><code>alt</code></dfn>
+ attribute must be present. It specifies the text of the
+ hyperlink. Its value must be text that, when presented with the
+ texts specified for the other hyperlinks of the <a href=#image-map>image
+ map</a>, and with the alternative text of the image, but without
+ the image itself, provides the user with the same kind of choice as
+ the hyperlink would when used without its text but with its shape
+ applied to the image. The <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code>
+ attribute may be left blank if there is another <code><a href=#the-area-element>area</a></code>
+ element in the same <a href=#image-map>image map</a> that points to the same
+ resource and has a non-blank <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code>
+ attribute.</p>
+
+ <p>If the <code><a href=#the-area-element>area</a></code> element has no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, then the area
+ represented by the element cannot be selected, and the <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute must be omitted.</p>
+
+ <p>In both cases, the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> and
+ <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attributes specify the
+ area.</p>
+
+ <p>The <dfn id=attr-area-shape title=attr-area-shape><code>shape</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The following
+ table lists the keywords defined for this attribute. The states
+ given in the first cell of the rows with keywords give the states to
+ which those keywords map. <span class=impl>Some of the keywords
+ are non-conforming, as noted in the last column.</span></p>
+
+ <table><thead><tr><th>State
+ <th>Keywords
+ <th class=impl>Notes
+ <tbody><tr><td rowspan=2><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a>
+ <td><dfn id=attr-area-shape-keyword-circle title=attr-area-shape-keyword-circle><code>circle</code></dfn>
+ <td class=impl>
+ <tr><td class=impl><dfn id=attr-area-shape-keyword-circ title=attr-area-shape-keyword-circ><code>circ</code></dfn>
+ <td class=impl>Non-conforming
+ <tr><td><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a>
+ <td><dfn id=attr-area-shape-keyword-default title=attr-area-shape-keyword-default><code>default</code></dfn>
+ <td class=impl>
+ <tr><td rowspan=2><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a>
+ <td><dfn id=attr-area-shape-keyword-poly title=attr-area-shape-keyword-poly><code>poly</code></dfn>
+ <td class=impl>
+ <tr><td class=impl><dfn id=attr-area-shape-keyword-polygon title=attr-area-shape-keyword-polygon><code>polygon</code></dfn>
+ <td class=impl>Non-conforming
+ <tr><td rowspan=2><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a>
+ <td><dfn id=attr-area-shape-keyword-rect title=attr-area-shape-keyword-rect><code>rect</code></dfn>
+ <td class=impl>
+ <tr><td class=impl><dfn id=attr-area-shape-keyword-rectangle title=attr-area-shape-keyword-rectangle><code>rectangle</code></dfn>
+ <td class=impl>Non-conforming
+ </table><p>The attribute may be omitted. The <i>missing value default</i> is
+ the <a href=#attr-area-shape-rect title=attr-area-shape-rect>rectangle</a> state.</p>
+
+ <p>The <dfn id=attr-area-coords title=attr-area-coords><code>coords</code></dfn>
+ attribute must, if specified, contain a <a href=#valid-list-of-integers>valid list of
+ integers</a>. This attribute gives the coordinates for the shape
+ described by the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code>
+ attribute. <span class=impl>The processing for this attribute is
+ described as part of the <a href=#image-map>image map</a> processing
+ model.</span></p>
+
+ <!-- v2: It was suggested by John S. Urban that coords should
+ support percentages as well as pixels, so that one could use the
+ same image map for images of various sizes. -->
+
+ <p>In the <dfn id=attr-area-shape-circle title=attr-area-shape-circle>circle state</dfn>,
+ <code><a href=#the-area-element>area</a></code> elements must have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute present, with three
+ integers, the last of which must be non-negative. The first integer
+ must be the distance in CSS pixels from the left edge of the image
+ to the center of the circle, the second integer must be the distance
+ in CSS pixels from the top edge of the image to the center of the
+ circle, and the third integer must be the radius of the circle,
+ again in CSS pixels.</p>
+
+ <p>In the <dfn id=attr-area-shape-default title=attr-area-shape-default>default state</dfn>
+ state, <code><a href=#the-area-element>area</a></code> elements must not have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute. (The area is the
+ whole image.)</p>
+
+ <p>In the <dfn id=attr-area-shape-poly title=attr-area-shape-poly>polygon state</dfn>,
+ <code><a href=#the-area-element>area</a></code> elements must have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute with at least six
+ integers, and the number of integers must be even. Each pair of
+ integers must represent a coordinate given as the distances from the
+ left and the top of the image in CSS pixels respectively, and all
+ the coordinates together must represent the points of the polygon,
+ in order.</p>
+
+ <p>In the <dfn id=attr-area-shape-rect title=attr-area-shape-rect>rectangle state</dfn>,
+ <code><a href=#the-area-element>area</a></code> elements must have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute with exactly four
+ integers, the first of which must be less than the third, and the
+ second of which must be less than the fourth. The four points must
+ represent, respectively, the distance from the left edge of the
+ image to the left side of the rectangle, the distance from the
+ top edge to the top side, the distance from the left edge to the
+ right side, and the distance from the top edge to the bottom side,
+ all in CSS pixels.</p>
+
+ <div class=impl>
+
+ <p>When user agents allow users to <a href=#following-hyperlinks title="following
+ hyperlinks">follow hyperlinks</a> created using the
+ <code><a href=#the-area-element>area</a></code> element, as described in the next section, the
+ <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>,
+ <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>
+<!--PING-->
+ and <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>
+<!--PING-->
+ attributes decide how the
+ link is followed. The <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>,
+ <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes may be used to
+ indicate to the user the likely nature of the target resource before
+ the user follows the link.</p>
+
+ </div>
+
+ <p>The <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>,
+<!--PING-->
+ <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>,
+<!--PING-->
+ <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes must be omitted
+ if the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute is
+ not present.</p>
+
+ <div class=impl>
+
+ <p>The <a href=#activation-behavior>activation behavior</a> of <code><a href=#the-area-element>area</a></code>
+ elements is to run the following steps:</p>
+
+ <ol><li><p>If the <code title=event-DOMActivate><a href=#event-domactivate>DOMActivate</a></code>
+ event in question is not <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> (i.e. a <code title=dom-click><a href=#dom-click>click()</a></code> method call was the reason for the
+ event being dispatched), and the <code><a href=#the-area-element>area</a></code> element's <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute is such that
+ applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
+ browsing context name</a>, using the value of the <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute as the
+ browsing context name, would result in there not being a chosen
+ browsing context, then raise an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code>
+ exception and abort these steps.</li>
+
+ <li>Otherwise, the user agent must <a href=#following-hyperlinks title="following
+ hyperlinks">follow the hyperlink</a> defined by the
+ <code><a href=#the-area-element>area</a></code> element, if any.</li>
+
+ </ol><p>The IDL attributes <dfn id=dom-area-alt title=dom-area-alt><code>alt</code></dfn>, <dfn id=dom-area-coords title=dom-area-coords><code>coords</code></dfn>, <dfn id=dom-area-href title=dom-area-href><code>href</code></dfn>, <dfn id=dom-area-target title=dom-area-target><code>target</code></dfn>,
+<!--PING-->
+ <dfn id=dom-area-ping title=dom-area-ping><code>ping</code></dfn>,
+<!--PING-->
+ <dfn id=dom-area-rel title=dom-area-rel><code>rel</code></dfn>, <dfn id=dom-area-media title=dom-area-media><code>media</code></dfn>, <dfn id=dom-area-hreflang title=dom-area-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-area-type title=dom-area-type><code>type</code></dfn>, each must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The IDL attribute <dfn id=dom-area-shape title=dom-area-shape><code>shape</code></dfn> must
+ <a href=#reflect>reflect</a> the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code>
+ content attribute, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>
+
+ <p>The IDL attribute <dfn id=dom-area-rellist title=dom-area-rellist><code>relList</code></dfn> must
+ <a href=#reflect>reflect</a> the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>
+ content attribute.</p>
+
+ <p>The <code><a href=#the-area-element>area</a></code> element also supports the complement of
+ <a href=#url-decomposition-idl-attributes>URL decomposition IDL attributes</a>, <dfn id=dom-area-protocol title=dom-area-protocol><code>protocol</code></dfn>, <dfn id=dom-area-host title=dom-area-host><code>host</code></dfn>, <dfn id=dom-area-port title=dom-area-port><code>port</code></dfn>, <dfn id=dom-area-hostname title=dom-area-hostname><code>hostname</code></dfn>, <dfn id=dom-area-pathname title=dom-area-pathname><code>pathname</code></dfn>, <dfn id=dom-area-search title=dom-area-search><code>search</code></dfn>, and <dfn id=dom-area-hash title=dom-area-hash><code>hash</code></dfn>. These must follow the
+ rules given for URL decomposition IDL attributes, with the <a href=#concept-uda-input title=concept-uda-input>input</a> being the result of <a href=#resolve-a-url title="resolve a url">resolving</a> the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute relative to the
+ element, if there is such an attribute and resolving it is
+ successful, or the empty string otherwise; and the <a href=#concept-uda-setter title=concept-uda-setter>common setter action</a> being the
+ same as setting the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute to the new output
+ value.</p>
+
+ </div>
+
+
+ <h4 id=image-maps><span class=secno>4.8.14 </span>Image maps</h4>
+
+ <!-- TESTS
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/smallcats%22%20usemap%3D%23a%20onclick%3Dw%28%27img%27%29%3E%0A%3Cmap%20name%3Da%3E%0A%20%3Carea%20onclick%3Dw%28%271%27%29%20coords%3D%270%25%200%25%20100%25%20100%25%27%20href%3Djavascript%3A%3E%0A%3C/map%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cbody%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/smallcats%22%20usemap%3D%23a%20onclick%3Dw%28%27img%27%29%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/sample%22%20usemap%3D%23a%20onclick%3Dw%28%27img%27%29%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3Cmap%20name%3Da%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%20%3Carea%20onclick%3Dw%28%271%27%29%20coords%3D%270%200%2050%2050%27%20href%3Djavascript%3A%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3C/map%3E%0A%3Cscript%3E%0A%20var%20x%20%3D%20document.getElementsByTagName%28%27img%27%29%5B0%5D%3B%0A%20x.parentNode.appendChild%28x%29%3B%0A%20document.getElementsByTagName%28%27area%27%29%5B0%5D.focus%28%29%3B%0A%3C/script%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3Ex%3Cmap%3E%3Carea%20shape%3Dpolyg%20coords%3D%221%2C2%203%22%3E%3C/map%3E%0A%3Cscript%3Ex%20%3D%20document.getElementsByTagName%28%27area%27%29%5B0%5D%3B%20w%28x.shape%20+%20%27%20%27%20+%20x.coords%29%3C/script%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0D%0A%3Cp%3E%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/astrophy/128%22%20usemap%3D%23a%3E%0D%0A%3Cmap%20name%3Da%3E%3Carea%20shape%3Dcirc%20coords%3D%2220%2C20%2C10%25%22%20href%3D%23%3E%3Carea%20shape%3Dcirc%20coords%3D%2220%2C20%2C10%22%20href%3D%23%3E%3C/map%3E%0D%0A%3Cscript%3Edocument.write%28document.getElementsByTagName%28%27area%27%29%5B0%5D.coords%29%3C/script%3E
+ -->
+
+ <div class=impl>
+
+ <h5 id=authoring><span class=secno>4.8.14.1 </span>Authoring</h5>
+
+ </div>
+
+ <p>An <dfn id=image-map>image map</dfn> allows geometric areas on an image to be
+ associated with <a href=#hyperlink title=hyperlink>hyperlinks</a>.</p>
+
+ <p>An image, in the form of an <code><a href=#the-img-element>img</a></code> element or an
+ <code><a href=#the-object-element>object</a></code> element representing an image, may be associated
+ with an image map (in the form of a <code><a href=#the-map-element>map</a></code> element) by
+ specifying a <dfn id=attr-hyperlink-usemap title=attr-hyperlink-usemap><code>usemap</code></dfn> attribute on
+ the <code><a href=#the-img-element>img</a></code> or <code><a href=#the-object-element>object</a></code> element. The <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute, if specified,
+ must be a <a href=#valid-hash-name-reference>valid hash-name reference</a> to a
+ <code><a href=#the-map-element>map</a></code> element.</p>
+
+ <div class=example>
+
+ <p>Consider an image that looks as follows:</p>
+
+ <p><img alt="A line with four shapes in it, equally spaced: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star." src=images/sample-usemap.png></p>
+
+ <p>If we wanted just the colored areas to be clickable, we could
+ do it as follows:</p>
+
+ <pre>&lt;p&gt;
+ Please select a shape:
+ &lt;img src="shapes.png" usemap="#shapes"
+ alt="Four shapes are available: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star."&gt;
+ &lt;map name="shapes"&gt;
+ &lt;area shape=rect coords="50,50,100,100"&gt; &lt;!-- the hole in the red box --&gt;
+ &lt;area shape=rect coords="25,25,125,125" href="red.html" alt="Red box."&gt;
+ &lt;area shape=circle coords="200,75,50" href="green.html" alt="Green circle."&gt;
+ &lt;area shape=poly coords="325,25,262,125,388,125" href="blue.html" alt="Blue triangle."&gt;
+ &lt;area shape=poly coords="450,25,435,60,400,75,435,90,450,125,465,90,500,75,465,60"
+ href="yellow.html" alt="Yellow star."&gt;
+ &lt;/map&gt;
+&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=impl>
+
+ <h5 id=processing-model><span class=secno>4.8.14.2 </span>Processing model</h5>
+
+ <p>If an <code><a href=#the-img-element>img</a></code> element or an <code><a href=#the-object-element>object</a></code> element
+ representing an image has a <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute specified,
+ user agents must process it as follows:</p>
+
+ <ol><li><p>First, <a href=#rules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference</a>
+ to a <code><a href=#the-map-element>map</a></code> element must be followed. This will return
+ either an element (the <var title="">map</var>) or null.</li>
+
+ <li><p>If that returned null, then abort these steps. The image is
+ not associated with an image map after all.</li>
+
+ <li><p>Otherwise, the user agent must collect all the
+ <code><a href=#the-area-element>area</a></code> elements that are descendants of the <var title="">map</var>. Let those be the <var title="">areas</var>.</li>
+
+ </ol><p>Having obtained the list of <code><a href=#the-area-element>area</a></code> elements that form
+ the image map (the <var title="">areas</var>), interactive user
+ agents must process the list in one of two ways.</p>
+
+ <p>If the user agent intends to show the text that the
+ <code><a href=#the-img-element>img</a></code> element represents, then it must use the following
+ steps.</p>
+
+ <p class=note>In user agents that do not support images, or that
+ have images disabled, <code><a href=#the-object-element>object</a></code> elements cannot represent
+ images, and thus this section never applies (the <a href=#fallback-content>fallback
+ content</a> is shown instead). The following steps therefore only
+ apply to <code><a href=#the-img-element>img</a></code> elements.</p>
+
+ <ol><li><p>Remove all the <code><a href=#the-area-element>area</a></code> elements in <var title="">areas</var> that have no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute.</li>
+
+ <li><p>Remove all the <code><a href=#the-area-element>area</a></code> elements in <var title="">areas</var> that have no <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute, or whose <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute's value is the empty
+ string, <em>if</em> there is another <code><a href=#the-area-element>area</a></code> element in
+ <var title="">areas</var> with the same value in the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute and with a
+ non-empty <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute.</li>
+
+ <li><p>Each remaining <code><a href=#the-area-element>area</a></code> element in <var title="">areas</var> represents a <a href=#hyperlink>hyperlink</a>. Those
+ hyperlinks should all be made available to the user in a manner
+ associated with the text of the <code><a href=#the-img-element>img</a></code>.</p>
+
+ <p>In this context, user agents may represent <code><a href=#the-area-element>area</a></code> and
+ <code><a href=#the-img-element>img</a></code> elements with no specified <code title="">alt</code> attributes, or whose <code title="">alt</code>
+ attributes are the empty string or some other non-visible text, in
+ a user-agent-defined fashion intended to indicate the lack of
+ suitable author-provided text.</li>
+
+ </ol><p>If the user agent intends to show the image and allow interaction
+ with the image to select hyperlinks, then the image must be
+ associated with a set of layered shapes, taken from the
+ <code><a href=#the-area-element>area</a></code> elements in <var title="">areas</var>, in reverse
+ tree order (so the last specified <code><a href=#the-area-element>area</a></code> element in the
+ <var title="">map</var> is the bottom-most shape, and the first
+ element in the <var title="">map</var>, in tree order, is the
+ top-most shape).</p>
+
+ <p>Each <code><a href=#the-area-element>area</a></code> element in <var title="">areas</var> must
+ be processed as follows to obtain a shape to layer onto the
+ image:</p>
+
+ <ol><li><p>Find the state that the element's <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute represents.</li>
+
+ <li><p>Use the <a href=#rules-for-parsing-a-list-of-integers>rules for parsing a list of integers</a> to
+ parse the element's <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code>
+ attribute, if it is present, and let the result be the <var title="">coords</var> list. If the attribute is absent, let the
+ <var title="">coords</var> list be the empty list.</li>
+
+ <li><p>If the number of items in the <var title="">coords</var>
+ list is less than the minimum number given for the
+ <code><a href=#the-area-element>area</a></code> element's current state, as per the following
+ table, then the shape is empty; abort these steps.</p>
+ <table><thead><tr><th>State
+ <th>Minimum number of items
+ <tbody><tr><td><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a>
+ <td>3
+ <tr><td><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a>
+ <td>0
+ <tr><td><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a>
+ <td>6
+ <tr><td><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a>
+ <td>4
+ </table></li>
+
+ <li><p>Check for excess items in the <var title="">coords</var>
+ list as per the entry in the following list corresponding to the
+ <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute's state:</p>
+ <dl class=switch><dt><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a></dt>
+ <dd>Drop any items in the list beyond the third.</dd>
+ <dt><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a></dt>
+ <dd>Drop all items in the list.</dd>
+ <dt><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a></dt>
+ <dd>Drop the last item if there's an odd number of items.</dd>
+ <dt><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a></dt>
+ <dd>Drop any items in the list beyond the fourth.</dd>
+ </dl></li>
+
+ <li><p>If the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute
+ represents the <a href=#attr-area-shape-rect title=attr-area-shape-rect>rectangle
+ state</a>, and the first number in the list is numerically less
+ than the third number in the list, then swap those two numbers
+ around.</li>
+
+ <li><p>If the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute
+ represents the <a href=#attr-area-shape-rect title=attr-area-shape-rect>rectangle
+ state</a>, and the second number in the list is numerically less
+ than the fourth number in the list, then swap those two numbers
+ around.</li>
+
+ <li><p>If the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute
+ represents the <a href=#attr-area-shape-circle title=attr-area-shape-circle>circle
+ state</a>, and the third number in the list is less than or
+ equal to zero, then the shape is empty; abort these steps.</li>
+
+ <li><p>Now, the shape represented by the element is the one
+ described for the entry in the list below corresponding to the
+ state of the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code>
+ attribute:</p>
+
+ <dl class=switch><dt><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a></dt>
+ <dd>
+ <p>Let <var title="">x</var> be the first number in <var title="">coords</var>, <var title="">y</var> be the second
+ number, and <var title="">r</var> be the third number.</p>
+ <p>The shape is a circle whose center is <var title="">x</var>
+ CSS pixels from the left edge of the image and <var title="">x</var> CSS pixels from the top edge of the image, and
+ whose radius is <var title="">r</var> pixels.</p>
+ </dd>
+
+ <dt><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a></dt>
+ <dd>
+ <p>The shape is a rectangle that exactly covers the entire
+ image.</p>
+ </dd>
+
+ <dt><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a></dt>
+ <dd>
+
+ <p>Let <var title="">x<sub title=""><var title="">i</var></sub></var> be the <span title="">(2<var title="">i</var>)</span>th entry in <var title="">coords</var>,
+ and <var title="">y<sub title=""><var title="">i</var></sub></var> be the <span title="">(2<var title="">i</var>+1)</span>th entry in <var title="">coords</var>
+ (the first entry in <var title="">coords</var> being the one
+ with index 0).</p>
+
+ <p>Let <var title="">the coordinates</var> be (<var title="">x<sub title=""><var title="">i</var></sub></var>, <var title="">y<sub title=""><var title="">i</var></sub></var>),
+ interpreted in CSS pixels measured from the top left of the
+ image, for all integer values of <var title="">i</var> from 0 to
+ <span title="">(<var title="">N</var>/2)-1</span>, where <var title="">N</var> is the number of items in <var title="">coords</var>.</p>
+
+ <p>The shape is a polygon whose vertices are given by <var title="">the coordinates</var>, and whose interior is
+ established using the even-odd rule. <a href=#refsGRAPHICS>[GRAPHICS]</a></p>
+
+ <!--
+ browsers implement the even-odd rule / even winding rule:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cimg%20usemap%3D%22%23x%22%20src%3D%22/resources/images/sample%22%3E%0A%3Cmap%20name%3D%22x%22%3E%0A%20%20%3Carea%20shape%3Dpolygon%20coords%3D%220%2C0%200%2C100%20100%2C100%20100%2C2%201%2C2%202%2C1%202%2C99%2099%2C99%2099%2C0%22%20href%3Da%3E%0A%3C/map%3E%0A
+ -->
+
+ </dd>
+
+ <dt><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a></dt>
+
+ <dd>
+
+ <p>Let <var title="">x<sub title="">1</sub></var> be the first
+ number in <var title="">coords</var>, <var title="">y<sub title="">1</sub></var> be the second number, <var title="">x<sub title="">2</sub></var> be the third number, and <var title="">y<sub title="">2</sub></var> be the fourth number.</p>
+
+ <p>The shape is a rectangle whose top-left corner is given by
+ the coordinate (<var title="">x<sub title="">1</sub></var>, <var title="">y<sub title="">1</sub></var>) and whose bottom right
+ corner is given by the coordinate (<var title="">x<sub title="">2</sub></var>, <var title="">y<sub title="">2</sub></var>), those coordinates being interpreted as
+ CSS pixels from the top left corner of the image.</p>
+
+ </dd>
+
+ </dl><p>For historical reasons, the coordinates must be interpreted
+ relative to the <em>displayed</em> image, even if it stretched
+ using CSS or the image element's <code title="">width</code> and
+ <code title="">height</code> attributes.</p>
+
+ </li>
+
+ </ol><p>Mouse clicks on an image associated with a set of layered shapes
+ per the above algorithm must be dispatched to the top-most shape
+ covering the point that the pointing device indicated (if any), and
+ then, must be dispatched again (with a new <code><a href=#event>Event</a></code>
+ object) to the image element itself. User agents may also allow
+ individual <code><a href=#the-area-element>area</a></code> elements representing <a href=#hyperlink title=hyperlink>hyperlinks</a> to be selected and activated
+ (e.g. using a keyboard); events from this are not also propagated to
+ the image.</p>
+
+ <p class=note>Because a <code><a href=#the-map-element>map</a></code> element (and its
+ <code><a href=#the-area-element>area</a></code> elements) can be associated with multiple
+ <code><a href=#the-img-element>img</a></code> and <code><a href=#the-object-element>object</a></code> elements, it is possible
+ for an <code><a href=#the-area-element>area</a></code> element to correspond to multiple focusable
+ areas of the document.</p>
+
+ <p>Image maps are <a href=#live>live</a>; if the DOM is mutated, then the
+ user agent must act as if it had rerun the algorithms for image
+ maps.</p>
+
+ </div>
+
+
+
+ <h4 id=mathml><span class=secno>4.8.15 </span>MathML</h4>
+
+ <p>The <dfn id=math><code>math</code></dfn> element from the <a href=#mathml-namespace>MathML
+ namespace</a> falls into the <a href=#embedded-content>embedded content</a>,
+ <a href=#phrasing-content>phrasing content</a>, and <a href=#flow-content>flow content</a>
+ categories for the purposes of the content models in this
+ specification.</p>
+
+ <div class=impl>
+
+ <!-- apparently we get to define error handling, so: -->
+
+ <p>User agents must handle text other than <a href=#inter-element-whitespace>inter-element
+ whitespace</a> found in MathML elements whose content models do
+ not allow straight text by pretending for the purposes of MathML
+ content models, layout, and rendering that that text is actually
+ wrapped in an <code title="">mtext</code> element in the
+ <a href=#mathml-namespace>MathML namespace</a>. (Such text is not, however,
+ conforming.)</p>
+
+ <p>User agents must act as if any MathML element whose contents does
+ not match the element's content model was replaced, for the purposes
+ of MathML layout and rendering, by an <code title="">merror</code>
+ element in the <a href=#mathml-namespace>MathML namespace</a> containing some
+ appropriate error message.</p>
+
+ <p>To enable authors to use MathML tools that only accept MathML in
+ its XML form, interactive HTML user agents are encouraged to provide
+ a way to export any MathML fragment as an XML namespace-well-formed
+ XML fragment.</p>
+
+ </div>
+
+ <p>The semantics of MathML elements are defined by the MathML
+ specification and other relevant specifications. <a href=#refsMATHML>[MATHML]</a></p>
+
+ <div class=example>
+
+ <p>Here is an example of the use of MathML in an HTML document:</p>
+
+ <pre>&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;The quadratic formula&lt;/title&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;h1&gt;The quadratic formula&lt;/h1&gt;
+ &lt;p&gt;
+ &lt;math&gt;
+ &lt;mi&gt;x&lt;/mi&gt;
+ &lt;mo&gt;=&lt;/mo&gt;
+ &lt;mfrac&gt;
+ &lt;mrow&gt;
+ &lt;mo form="prefix"&gt;&minus;&lt;/mo&gt; &lt;mi&gt;b&lt;/mi&gt;
+ &lt;mo&gt;&plusmn;&lt;/mo&gt;
+ &lt;msqrt&gt;
+ &lt;msup&gt; &lt;mi&gt;b&lt;/mi&gt; &lt;mn&gt;2&lt;/mn&gt; &lt;/msup&gt;
+ &lt;mo&gt;&minus;&lt;/mo&gt;
+ &lt;mn&gt;4&lt;/mn&gt; &lt;mo&gt;&#8290;&lt;/mo&gt; &lt;mi&gt;a&lt;/mi&gt; &lt;mo&gt;&#8290;&lt;/mo&gt; &lt;mi&gt;c&lt;/mi&gt;
+ &lt;/msqrt&gt;
+ &lt;/mrow&gt;
+ &lt;mrow&gt;
+ &lt;mn&gt;2&lt;/mn&gt; &lt;mo&gt;&#8290;&lt;/mo&gt; &lt;mi&gt;a&lt;/mi&gt;
+ &lt;/mrow&gt;
+ &lt;/mfrac&gt;
+ &lt;/math&gt;
+ &lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=svg-0><span class=secno>4.8.16 </span>SVG</h4>
+
+ <p>The <dfn id=svg><code>svg</code></dfn> element from the <a href=#svg-namespace>SVG
+ namespace</a> falls into the <a href=#embedded-content>embedded content</a>,
+ <a href=#phrasing-content>phrasing content</a>, and <a href=#flow-content>flow content</a>
+ categories for the purposes of the content models in this
+ specification.</p>
+
+ <div class=impl>
+
+ <p>To enable authors to use SVG tools that only accept SVG in its
+ XML form, interactive HTML user agents are encouraged to provide a
+ way to export any SVG fragment as an XML namespace-well-formed XML
+ fragment.</p>
+
+ </div>
+
+ <p>When the SVG <code>foreignObject</code> element contains elements
+ from the <a href=#html-namespace-0>HTML namespace</a>, such elements must all be
+ <a href=#flow-content>flow content</a>. <a href=#refsSVG>[SVG]</a></p>
+
+ <p>The content model for <code title="">title</code> elements in the
+ <a href=#svg-namespace>SVG namespace</a> inside <a href=#html-documents>HTML documents</a> is
+ <a href=#phrasing-content>phrasing content</a>. (This further constrains the
+ requirements given in the SVG specification.)</p>
+
+ <p>The semantics of SVG elements are defined by the SVG
+ specification and other relevant specifications. <a href=#refsSVG>[SVG]</a></p>
+
+ <!-- The following paragraph is for bug 7510 -->
+ <p>The SVG specification includes requirements regarding the
+ handling of elements in the DOM that are not in the SVG namespace,
+ that are in SVG fragments, and that are not included in a
+ <code>foreignObject</code> element. <em>This</em> specification does
+ not define any processing for elements in SVG fragments that are not
+ in the HTML namespace; they are considered neither conforming nor
+ non-conforming from the perspective of this specification.</p>
+
+
+
+ <h4 id=dimension-attributes><span class=secno>4.8.17 </span><dfn>Dimension attributes</dfn></h4>
+
+ <p><span class=impl><strong>Author requirements</strong>:</span>
+ The <dfn id=attr-dim-width title=attr-dim-width><code>width</code></dfn> and <dfn id=attr-dim-height title=attr-dim-height><code>height</code></dfn> attributes on
+ <code><a href=#the-img-element>img</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-object-element>object</a></code>, <code><a href=#video>video</a></code>, and, when their <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state,
+ <code><a href=#the-input-element>input</a></code> elements may be specified to give the dimensions
+ of the visual content of the element (the width and height
+ respectively, relative to the nominal direction of the output
+ medium), in CSS pixels. The attributes, if specified, must have
+ values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid
+ non-negative integers</a>.</p>
+
+ <p>The specified dimensions given may differ from the dimensions
+ specified in the resource itself, since the resource may have a
+ resolution that differs from the CSS pixel resolution. (On screens,
+ CSS pixels have a resolution of 96ppi, but in general the CSS pixel
+ resolution depends on the reading distance.) If both attributes are
+ specified, then one of the following statements must be true:</p>
+
+ <ul><li><span title=""><var title="">specified width</var> - 0.5 &le;
+ <var title="">specified height</var> * <var title="">target ratio</var> &le;
+ <var title="">specified width</var> + 0.5</span></li>
+
+ <li><span title=""><var title="">specified height</var> - 0.5 &le;
+ <var title="">specified width</var> / <var title="">target ratio</var> &le;
+ <var title="">specified height</var> + 0.5</span></li>
+
+ <li><span title=""><var title="">specified height</var> = <var title="">specified width</var> = 0</span></li>
+
+ </ul><p>The <var title="">target ratio</var> is the ratio of the
+ intrinsic width to the intrinsic height in the resource. The <var title="">specified width</var> and <var title="">specified
+ height</var> are the values of the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes respectively.</p>
+
+ <p>The two attributes must be omitted if the resource in question
+ does not have both an intrinsic width and an intrinsic height.</p>
+
+ <p>If the two attributes are both zero, it indicates that the
+ element is not intended for the user (e.g. it might be a part of a
+ service to count page views).</p>
+
+ <p class=note>The dimension attributes are not intended to be used
+ to stretch the image.</p>
+
+ <div class=impl>
+
+ <p><strong>User agent requirements</strong>: User agents are
+ expected to use these attributes <a href=#dimRendering>as hints
+ for the rendering</a>.</p>
+
+ <p>The <dfn id=dom-dim-width title=dom-dim-width><code>width</code></dfn> and <dfn id=dom-dim-height title=dom-dim-height><code>height</code></dfn> IDL attributes on
+ the <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-object-element>object</a></code>,
+ and <code><a href=#video>video</a></code> elements must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ </div>
+
+
+
+ <h3 id=tabular-data><span class=secno>4.9 </span>Tabular data</h3>
+
+
+ <h4 id=the-table-element><span class=secno>4.9.1 </span>The <dfn><code>table</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>In this order: optionally a <code><a href=#the-caption-element>caption</a></code> element,
+ followed by either zero or more <code><a href=#the-colgroup-element>colgroup</a></code> elements,
+ followed optionally by a <code><a href=#the-thead-element>thead</a></code> element, followed
+ optionally by a <code><a href=#the-tfoot-element>tfoot</a></code> element, followed by either zero
+ or more <code><a href=#the-tbody-element>tbody</a></code> elements or one or more <code><a href=#the-tr-element>tr</a></code>
+ elements, followed optionally by a <code><a href=#the-tfoot-element>tfoot</a></code> element (but
+ there can only be one <code><a href=#the-tfoot-element>tfoot</a></code> element child in
+ total).</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-table-summary><a href=#attr-table-summary>summary</a></code> (but see prose)</dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmltableelement>HTMLTableElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute <a href=#htmltablecaptionelement>HTMLTableCaptionElement</a> <a href=#dom-table-caption title=dom-table-caption>caption</a>;
+ <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createcaption title=dom-table-createCaption>createCaption</a>();
+ void <a href=#dom-table-deletecaption title=dom-table-deleteCaption>deleteCaption</a>();
+ attribute <a href=#htmltablesectionelement>HTMLTableSectionElement</a> <a href=#dom-table-thead title=dom-table-tHead>tHead</a>;
+ <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createthead title=dom-table-createTHead>createTHead</a>();
+ void <a href=#dom-table-deletethead title=dom-table-deleteTHead>deleteTHead</a>();
+ attribute <a href=#htmltablesectionelement>HTMLTableSectionElement</a> <a href=#dom-table-tfoot title=dom-table-tFoot>tFoot</a>;
+ <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createtfoot title=dom-table-createTFoot>createTFoot</a>();
+ void <a href=#dom-table-deletetfoot title=dom-table-deleteTFoot>deleteTFoot</a>();
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-table-tbodies title=dom-table-tBodies>tBodies</a>;
+ <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createtbody title=dom-table-createTBody>createTBody</a>();
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-table-rows title=dom-table-rows>rows</a>;
+ <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-insertrow title=dom-table-insertRow>insertRow</a>(in optional long index);
+ void <a href=#dom-table-deleterow title=dom-table-deleteRow>deleteRow</a>(in long index);
+ attribute DOMString <a href=#dom-table-summary title=dom-table-summary>summary</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-table-element>table</a></code> element <a href=#represents>represents</a> data with
+ more than one dimension, in the form of a <a href=#concept-table title=concept-table>table</a>.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-table-element>table</a></code> element takes part in the <a href=#table-model>table
+ model</a>.</p>
+
+ </div>
+
+ <p>Tables must not be used as layout aids. Historically, some Web
+ authors have misused tables in HTML as a way to control their page
+ layout. This usage is non-conforming, because tools attempting to
+ extract tabular data from such documents would obtain very confusing
+ results. In particular, users of accessibility tools like screen
+ readers are likely to find it very difficult to navigate pages with
+ tables used for layout.</p>
+
+ <p class=note>There are a variety of alternatives to using HTML
+ tables for layout, primarily using CSS positioning and the CSS table
+ model.</p>
+
+ <div class=impl>
+
+ <p>User agents that do table analysis on arbitrary content are
+ encouraged to find heuristics to determine which tables actually
+ contain data and which are merely being used for layout. This
+ specification does not define a precise heuristic.</p>
+
+ </div>
+
+ <p>Tables have rows and columns given by their descendants. A table
+ must not have an empty row or column<span class=impl>, as
+ described in the description of the <a href=#table-model>table
+ model</a></span>. <!-- conformance criteria for detecting this
+ are in the table model section --></p>
+
+ <p id=table-descriptions>For tables that consist of more than just
+ a grid of cells with headers in the first row and headers in the
+ first column, and for any table in general where the reader might
+ have difficulty understanding the content, authors should include
+ explanatory information introducing the table. This information is
+ useful for all users, but is especially useful for users who cannot
+ see the table, e.g. users of screen readers.</p>
+
+ <p>Such explanatory information should introduce the purpose of the
+ table, outline its basic cell structure, highlight any trends or
+ patterns, and generally teach the user how to use the table.</p>
+
+ <div class=example>
+
+ <p>For instance, the following table:</p>
+
+ <table><caption>Characteristics with positive and negative sides</caption>
+ <thead><tr><th id=n> Negative
+ <th> Characteristic
+ <th> Positive
+ <tbody><tr><td headers="n r1"> Sad
+ <th id=r1> Mood
+ <td> Happy
+ <tr><td headers="n r2"> Failing
+ <th id=r2> Grade
+ <td> Passing
+ </table><p>...might benefit from a description explaining the way the table
+ is laid out, something like "Characteristics are given in the
+ second column, with the negative side in the left column and the
+ positive side in the right column".</p>
+
+ </div>
+
+ <p>There are a variety of ways to include this information, such as:</p>
+
+ <dl><dt>In prose, surrounding the table</dt>
+
+ <dd>
+ <div class=example><pre>&lt;p&gt;In the following table, characteristics are given in the second
+column, with the negative side in the left column and the positive
+side in the right column.&lt;/p&gt;
+&lt;table&gt;
+ &lt;caption&gt;Characteristics with positive and negative sides&lt;/caption&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th id="n"&gt; Negative
+ &lt;th&gt; Characteristic
+ &lt;th&gt; Positive
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;td headers="n r1"&gt; Sad
+ &lt;th id="r1"&gt; Mood
+ &lt;td&gt; Happy
+ &lt;tr&gt;
+ &lt;td headers="n r2"&gt; Failing
+ &lt;th id="r2"&gt; Grade
+ &lt;td&gt; Passing
+&lt;/table&gt;</pre></div>
+ </dd>
+
+ <dt>In the table's <code><a href=#the-caption-element>caption</a></code></dt>
+
+ <dd>
+ <div class=example><pre>&lt;table&gt;
+ &lt;caption&gt;
+ &lt;strong&gt;Characteristics with positive and negative sides.&lt;/strong&gt;
+ &lt;p&gt;Characteristics are given in the second column, with the
+ negative side in the left column and the positive side in the right
+ column.&lt;/p&gt;
+ &lt;/caption&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th id="n"&gt; Negative
+ &lt;th&gt; Characteristic
+ &lt;th&gt; Positive
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;td headers="n r1"&gt; Sad
+ &lt;th id="r1"&gt; Mood
+ &lt;td&gt; Happy
+ &lt;tr&gt;
+ &lt;td headers="n r2"&gt; Failing
+ &lt;th id="r2"&gt; Grade
+ &lt;td&gt; Passing
+&lt;/table&gt;</pre></div>
+ </dd>
+
+ <dt>In the table's <code><a href=#the-caption-element>caption</a></code>, in a <code><a href=#the-details-element>details</a></code> element</dt>
+
+ <dd>
+ <div class=example><pre>&lt;table&gt;
+ &lt;caption&gt;
+ &lt;strong&gt;Characteristics with positive and negative sides.&lt;/strong&gt;
+ &lt;details&gt;
+ &lt;summary&gt;Help&lt;/summary&gt;
+ &lt;p&gt;Characteristics are given in the second column, with the
+ negative side in the left column and the positive side in the right
+ column.&lt;/p&gt;
+ &lt;/details&gt;
+ &lt;/caption&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th id="n"&gt; Negative
+ &lt;th&gt; Characteristic
+ &lt;th&gt; Positive
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;td headers="n r1"&gt; Sad
+ &lt;th id="r1"&gt; Mood
+ &lt;td&gt; Happy
+ &lt;tr&gt;
+ &lt;td headers="n r2"&gt; Failing
+ &lt;th id="r2"&gt; Grade
+ &lt;td&gt; Passing
+&lt;/table&gt;</pre></div>
+ </dd>
+
+ <dt>Next to the table, in the same <code><a href=#the-figure-element>figure</a></code></dt>
+
+ <dd>
+ <div class=example><pre>&lt;figure&gt;
+ &lt;figcaption&gt;Characteristics with positive and negative sides&lt;/figcaption&gt;
+ &lt;p&gt;Characteristics are given in the second column, with the
+ negative side in the left column and the positive side in the right
+ column.&lt;/p&gt;
+ &lt;table&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th id="n"&gt; Negative
+ &lt;th&gt; Characteristic
+ &lt;th&gt; Positive
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;td headers="n r1"&gt; Sad
+ &lt;th id="r1"&gt; Mood
+ &lt;td&gt; Happy
+ &lt;tr&gt;
+ &lt;td headers="n r2"&gt; Failing
+ &lt;th id="r2"&gt; Grade
+ &lt;td&gt; Passing
+ &lt;/table&gt;
+&lt;/figure&gt;</pre></div>
+ </dd>
+
+ <dt>Next to the table, in a <code><a href=#the-figure-element>figure</a></code>'s <code><a href=#the-figcaption-element>figcaption</a></code></dt>
+
+ <dd>
+ <div class=example><pre>&lt;figure&gt;
+ &lt;figcaption&gt;
+ &lt;strong&gt;Characteristics with positive and negative sides&lt;/strong&gt;
+ &lt;p&gt;Characteristics are given in the second column, with the
+ negative side in the left column and the positive side in the right
+ column.&lt;/p&gt;
+ &lt;/figcaption&gt;
+ &lt;table&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th id="n"&gt; Negative
+ &lt;th&gt; Characteristic
+ &lt;th&gt; Positive
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;td headers="n r1"&gt; Sad
+ &lt;th id="r1"&gt; Mood
+ &lt;td&gt; Happy
+ &lt;tr&gt;
+ &lt;td headers="n r2"&gt; Failing
+ &lt;th id="r2"&gt; Grade
+ &lt;td&gt; Passing
+ &lt;/table&gt;
+&lt;/figure&gt;</pre></div>
+ </dd>
+
+ </dl><p>Authors may also use other techniques, or combinations of the
+ above techniques, as appropriate.</p>
+
+ <p>The best option, of course, rather than writing a description
+ explaining the way the table is laid out, is to adjust the table
+ such that no explanation is needed.</p>
+
+ <div class=example>
+
+ <p>In the case of the table used in the examples above, a simple
+ rearrangement of the table so that the headers are on the top and
+ left sides removes the need for an explanation as well as removing
+ the need for the use of <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes:</p>
+
+ <pre>&lt;table&gt;
+ &lt;caption&gt;Characteristics with positive and negative sides&lt;/caption&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th&gt; Characteristic
+ &lt;th&gt; Negative
+ &lt;th&gt; Positive
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;th&gt; Mood
+ &lt;td&gt; Sad
+ &lt;td&gt; Happy
+ &lt;tr&gt;
+ &lt;th&gt; Grade
+ &lt;td&gt; Failing
+ &lt;td&gt; Passing
+&lt;/table&gt;</pre>
+
+ </div>
+
+ <p>The <dfn id=attr-table-summary title=attr-table-summary><code>summary</code></dfn>
+ attribute on <code><a href=#the-table-element>table</a></code> elements was suggested in earlier
+ versions of the language as a technique for providing explanatory
+ text for complex tables for users of screen readers. One of the <a href=#table-descriptions>techniques</a> described <!--in the
+ <code>table</code> section--> above should be used
+ instead. <!--Authors should not specify the <code
+ title="attr-table-summary">summary</code> attribute on
+ <code>table</code> elements. --> <!-- 2.65% pages --></p>
+
+ <p class=note>In particular, authors are encouraged to consider
+ whether their explanatory text for tables is likely to be useful to
+ the visually impaired: if their text would not be useful, then it is
+ best to not include a <code title=attr-table-summary><a href=#attr-table-summary>summary</a></code> attribute. Similarly, if
+ their explanatory text could help someone who is not visually
+ impaired, e.g. someone who is seeing the table for the first time,
+ then the text would be more useful before the table or in the
+ <code><a href=#the-caption-element>caption</a></code>. For example, describing the conclusions of the
+ data in a table is useful to everyone; explaining how to read the
+ table, if not obvious from the headers alone, is useful to everyone;
+ describing the structure of the table, if it is easy to grasp
+ visually, may not be useful to everyone, but it might also not be
+ useful to users who can quickly navigate the table with an
+ accessibility tool.</p>
+
+ <!--
+ <p class="note">Use of the <code
+ title="attr-table-summary">summary</code> attribute is discouraged
+ because in practice it is poorly understood. Because the attribute
+ is not exposed in visual user agents, authors who have included it
+ have typically not been able to test it, and have therefore set the
+ attribute to values that are of no use to users of accessibility
+ tools. This has lead to accessibility tools introducing heuristics
+ to try to avoid exposing such usage of the attribute to users. Even
+ the few authors who have made the best use of the attribute have
+ often misused it, for example by including text that would in fact
+ be useful for all users, or that is redundant with other information
+ on the page separate from the table.</p>
+ -->
+
+ <div class=impl>
+
+ <p>If a <code><a href=#the-table-element>table</a></code> element has a <code title=attr-table-summary><a href=#attr-table-summary>summary</a></code> attribute, the user agent
+ may report the contents of that attribute to the user.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">table</var> . <code title=dom-table-caption><a href=#dom-table-caption>caption</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the table's <code><a href=#the-caption-element>caption</a></code> element.</p>
+ <p>Can be set, to replace the <code><a href=#the-caption-element>caption</a></code> element. If the
+ new value is not a <code><a href=#the-caption-element>caption</a></code> element, throws a
+ <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> exception.</p>
+ </dd>
+
+ <dt><var title="">caption</var> = <var title="">table</var> . <code title=dom-table-createCaption><a href=#dom-table-createcaption>createCaption</a></code>()</dt>
+ <dd>
+ <p>Ensures the table has a <code><a href=#the-caption-element>caption</a></code> element, and returns it.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-deleteCaption><a href=#dom-table-deletecaption>deleteCaption</a></code>()</dt>
+ <dd>
+ <p>Ensures the table does not have a <code><a href=#the-caption-element>caption</a></code> element.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-tHead><a href=#dom-table-thead>tHead</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the table's <code><a href=#the-thead-element>thead</a></code> element.</p>
+ <p>Can be set, to replace the <code><a href=#the-thead-element>thead</a></code> element. If the
+ new value is not a <code><a href=#the-thead-element>thead</a></code> element, throws a
+ <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> exception.</p>
+ </dd>
+
+ <dt><var title="">thead</var> = <var title="">table</var> . <code title=dom-table-createTHead><a href=#dom-table-createthead>createTHead</a></code>()</dt>
+ <dd>
+ <p>Ensures the table has a <code><a href=#the-thead-element>thead</a></code> element, and returns it.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-deleteTHead><a href=#dom-table-deletethead>deleteTHead</a></code>()</dt>
+ <dd>
+ <p>Ensures the table does not have a <code><a href=#the-thead-element>thead</a></code> element.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-tFoot><a href=#dom-table-tfoot>tFoot</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the table's <code><a href=#the-tfoot-element>tfoot</a></code> element.</p>
+ <p>Can be set, to replace the <code><a href=#the-tfoot-element>tfoot</a></code> element. If the
+ new value is not a <code><a href=#the-tfoot-element>tfoot</a></code> element, throws a
+ <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> exception.</p>
+ </dd>
+
+ <dt><var title="">tfoot</var> = <var title="">table</var> . <code title=dom-table-createTFoot><a href=#dom-table-createtfoot>createTFoot</a></code>()</dt>
+ <dd>
+ <p>Ensures the table has a <code><a href=#the-tfoot-element>tfoot</a></code> element, and returns it.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-deleteTFoot><a href=#dom-table-deletetfoot>deleteTFoot</a></code>()</dt>
+ <dd>
+ <p>Ensures the table does not have a <code><a href=#the-tfoot-element>tfoot</a></code> element.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-tBodies><a href=#dom-table-tbodies>tBodies</a></code></dt>
+ <dd>
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-tbody-element>tbody</a></code> elements of the table.</p>
+ </dd>
+
+ <dt><var title="">tbody</var> = <var title="">table</var> . <code title=dom-table-createTBody><a href=#dom-table-createtbody>createTBody</a></code>()</dt>
+ <dd>
+ <p>Creates a <code><a href=#the-tbody-element>tbody</a></code> element, inserts it into the table, and returns it.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code></dt>
+ <dd>
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-tr-element>tr</a></code> elements of the table.</p>
+ </dd>
+
+ <dt><var title="">tr</var> = <var title="">table</var> . <code title=dom-table-insertRow><a href=#dom-table-insertrow>insertRow</a></code>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Creates a <code><a href=#the-tr-element>tr</a></code> element, along with a <code><a href=#the-tbody-element>tbody</a></code> if required, inserts them into the table at the position given by the argument, and returns the <code><a href=#the-tr-element>tr</a></code>.</p>
+ <p>The position is relative to the rows in the table. The index &minus;1 is equivalent to inserting at the end of the table.</p>
+ <p>If the given position is less than &minus;1 or greater than the number of rows, throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ </dd>
+
+ <dt><var title="">table</var> . <code title=dom-table-deleteRow><a href=#dom-table-deleterow>deleteRow</a></code>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Removes the <code><a href=#the-tr-element>tr</a></code> element with the given position in the table.</p>
+ <p>The position is relative to the rows in the table. The index &minus;1 is equivalent to deleting the last row of the table.</p>
+ <p>If the given position is less than &minus;1 or greater than the index of the last row, or if there are no rows, throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-table-caption title=dom-table-caption><code>caption</code></dfn> IDL
+ attribute must return, on getting, the first <code><a href=#the-caption-element>caption</a></code>
+ element child of the <code><a href=#the-table-element>table</a></code> element, if any, or null
+ otherwise. On setting, if the new value is a <code><a href=#the-caption-element>caption</a></code>
+ element, the first <code><a href=#the-caption-element>caption</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element, if any, must be removed, and the new
+ value must be inserted as the first node of the <code><a href=#the-table-element>table</a></code>
+ element. If the new value is not a <code><a href=#the-caption-element>caption</a></code> element,
+ then a <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> DOM exception must be
+ raised instead.</p>
+
+ <p>The <dfn id=dom-table-createcaption title=dom-table-createCaption><code>createCaption()</code></dfn>
+ method must return the first <code><a href=#the-caption-element>caption</a></code> element child of
+ the <code><a href=#the-table-element>table</a></code> element, if any; otherwise a new
+ <code><a href=#the-caption-element>caption</a></code> element must be created, inserted as the first
+ node of the <code><a href=#the-table-element>table</a></code> element, and then returned.</p>
+
+ <p>The <dfn id=dom-table-deletecaption title=dom-table-deleteCaption><code>deleteCaption()</code></dfn>
+ method must remove the first <code><a href=#the-caption-element>caption</a></code> element child of
+ the <code><a href=#the-table-element>table</a></code> element, if any.</p>
+
+ <p>The <dfn id=dom-table-thead title=dom-table-tHead><code>tHead</code></dfn> IDL
+ attribute must return, on getting, the first <code><a href=#the-thead-element>thead</a></code>
+ element child of the <code><a href=#the-table-element>table</a></code> element, if any, or null
+ otherwise. On setting, if the new value is a <code><a href=#the-thead-element>thead</a></code>
+ element, the first <code><a href=#the-thead-element>thead</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element, if any, must be removed, and the new
+ value must be inserted immediately before the first element in the
+ <code><a href=#the-table-element>table</a></code> element that is neither a <code><a href=#the-caption-element>caption</a></code>
+ element nor a <code><a href=#the-colgroup-element>colgroup</a></code> element, if any, or at the end
+ of the table if there are no such elements. If the new value is not
+ a <code><a href=#the-thead-element>thead</a></code> element, then a
+ <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> DOM exception must be raised
+ instead.</p>
+
+ <p>The <dfn id=dom-table-createthead title=dom-table-createTHead><code>createTHead()</code></dfn>
+ method must return the first <code><a href=#the-thead-element>thead</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element, if any; otherwise a new
+ <code><a href=#the-thead-element>thead</a></code> element must be created and inserted immediately
+ before the first element in the <code><a href=#the-table-element>table</a></code> element that is
+ neither a <code><a href=#the-caption-element>caption</a></code> element nor a <code><a href=#the-colgroup-element>colgroup</a></code>
+ element, if any, or at the end of the table if there are no such
+ elements, and then that new element must be returned.</p>
+
+ <p>The <dfn id=dom-table-deletethead title=dom-table-deleteTHead><code>deleteTHead()</code></dfn>
+ method must remove the first <code><a href=#the-thead-element>thead</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element, if any.</p>
+
+ <p>The <dfn id=dom-table-tfoot title=dom-table-tFoot><code>tFoot</code></dfn> IDL
+ attribute must return, on getting, the first <code><a href=#the-tfoot-element>tfoot</a></code>
+ element child of the <code><a href=#the-table-element>table</a></code> element, if any, or null
+ otherwise. On setting, if the new value is a <code><a href=#the-tfoot-element>tfoot</a></code>
+ element, the first <code><a href=#the-tfoot-element>tfoot</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element, if any, must be removed, and the new
+ value must be inserted immediately before the first element in the
+ <code><a href=#the-table-element>table</a></code> element that is neither a <code><a href=#the-caption-element>caption</a></code>
+ element, a <code><a href=#the-colgroup-element>colgroup</a></code> element, nor a <code><a href=#the-thead-element>thead</a></code>
+ element, if any, or at the end of the table if there are no such
+ elements. If the new value is not a <code><a href=#the-tfoot-element>tfoot</a></code> element, then
+ a <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> DOM exception must be raised
+ instead.</p>
+
+ <p>The <dfn id=dom-table-createtfoot title=dom-table-createTFoot><code>createTFoot()</code></dfn>
+ method must return the first <code><a href=#the-tfoot-element>tfoot</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element, if any; otherwise a new
+ <code><a href=#the-tfoot-element>tfoot</a></code> element must be created and inserted immediately
+ before the first element in the <code><a href=#the-table-element>table</a></code> element that is
+ neither a <code><a href=#the-caption-element>caption</a></code> element, a <code><a href=#the-colgroup-element>colgroup</a></code>
+ element, nor a <code><a href=#the-thead-element>thead</a></code> element, if any, or at the end of
+ the table if there are no such elements, and then that new element
+ must be returned.</p>
+
+ <p>The <dfn id=dom-table-deletetfoot title=dom-table-deleteTFoot><code>deleteTFoot()</code></dfn>
+ method must remove the first <code><a href=#the-tfoot-element>tfoot</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element, if any.</p>
+
+ <p>The <dfn id=dom-table-tbodies title=dom-table-tBodies><code>tBodies</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#the-table-element>table</a></code> node, whose filter matches only
+ <code><a href=#the-tbody-element>tbody</a></code> elements that are children of the
+ <code><a href=#the-table-element>table</a></code> element.</p>
+
+ <p>The <dfn id=dom-table-createtbody title=dom-table-createTBody><code>createTBody()</code></dfn>
+ method must create a new <code><a href=#the-tbody-element>tbody</a></code> element, insert it
+ immediately after the last <code><a href=#the-tbody-element>tbody</a></code> element in the
+ <code><a href=#the-table-element>table</a></code> element, if any, or at the end of the
+ <code><a href=#the-table-element>table</a></code> element if the <code><a href=#the-table-element>table</a></code> element has no
+ <code><a href=#the-tbody-element>tbody</a></code> element children, and then must return the new
+ <code><a href=#the-tbody-element>tbody</a></code> element.</p>
+
+ <p>The <dfn id=dom-table-rows title=dom-table-rows><code>rows</code></dfn> attribute
+ must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#the-table-element>table</a></code> node, whose filter matches only <code><a href=#the-tr-element>tr</a></code>
+ elements that are either children of the <code><a href=#the-table-element>table</a></code> element,
+ or children of <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, or
+ <code><a href=#the-tfoot-element>tfoot</a></code> elements that are themselves children of the
+ <code><a href=#the-table-element>table</a></code> element. The elements in the collection must be
+ ordered such that those elements whose parent is a
+ <code><a href=#the-thead-element>thead</a></code> are included first, in tree order, followed by
+ those elements whose parent is either a <code><a href=#the-table-element>table</a></code> or
+ <code><a href=#the-tbody-element>tbody</a></code> element, again in tree order, followed finally by
+ those elements whose parent is a <code><a href=#the-tfoot-element>tfoot</a></code> element, still
+ in tree order.</p>
+
+ <p>The behavior of the <dfn id=dom-table-insertrow title=dom-table-insertRow><code>insertRow(<var title="">index</var>)</code></dfn> method depends on the state of
+ the table. When it is called, the method must act as required by the
+ first item in the following list of conditions that describes the
+ state of the table and the <var title="">index</var> argument:</p>
+
+ <dl class=switch><dt>If <var title="">index</var> is less than &minus;1 or greater than
+ the number of elements in <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code>
+ collection:</dt>
+
+ <dd>The method must raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception.</dd>
+
+ <dt>If the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection has
+ zero elements in it, and the <code><a href=#the-table-element>table</a></code> has no
+ <code><a href=#the-tbody-element>tbody</a></code> elements in it:</dt>
+
+ <dd>The method must create a <code><a href=#the-tbody-element>tbody</a></code> element, then
+ create a <code><a href=#the-tr-element>tr</a></code> element, then append the <code><a href=#the-tr-element>tr</a></code>
+ element to the <code><a href=#the-tbody-element>tbody</a></code> element, then append the
+ <code><a href=#the-tbody-element>tbody</a></code> element to the <code><a href=#the-table-element>table</a></code> element, and
+ finally return the <code><a href=#the-tr-element>tr</a></code> element.</dd>
+
+ <dt>If the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection has
+ zero elements in it:</dt>
+
+ <dd>The method must create a <code><a href=#the-tr-element>tr</a></code> element, append it to
+ the last <code><a href=#the-tbody-element>tbody</a></code> element in the table, and return the
+ <code><a href=#the-tr-element>tr</a></code> element.</dd>
+
+ <dt>If <var title="">index</var> is missing, equal to &minus;1, or
+ equal to the number of items in <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection:</dt>
+
+ <dd>The method must create a <code><a href=#the-tr-element>tr</a></code> element, and append it
+ to the parent of the last <code><a href=#the-tr-element>tr</a></code> element in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection. Then, the newly
+ created <code><a href=#the-tr-element>tr</a></code> element must be returned.</dd>
+
+ <dt>Otherwise:</dt>
+
+ <dd>The method must create a <code><a href=#the-tr-element>tr</a></code> element, insert it
+ immediately before the <var title="">index</var>th <code><a href=#the-tr-element>tr</a></code>
+ element in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection,
+ in the same parent, and finally must return the newly created
+ <code><a href=#the-tr-element>tr</a></code> element.</dd>
+
+ </dl><p>When the <dfn id=dom-table-deleterow title=dom-table-deleteRow><code>deleteRow(<var title="">index</var>)</code></dfn> method is called, the user agent
+ must run the following steps:</p>
+
+ <ol><li><p>If <var title="">index</var> is equal to &minus;1, then
+ <var title="">index</var> must be set to the number if items in the
+ <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection, minus
+ one.</li>
+
+ <li><p>Now, if <var title="">index</var> is less than zero, or
+ greater than or equal to the number of elements in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection, the method must
+ instead raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception, and these
+ steps must be aborted.</li>
+
+ <li><p>Otherwise, the method must remove the <var title="">index</var>th element in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection from its parent.</p>
+
+ </ol><p>The <dfn id=dom-table-summary title=dom-table-summary><code>summary</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ </div>
+
+
+ <h4 id=the-caption-element><span class=secno>4.9.2 </span>The <dfn><code>caption</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As the first element child of a <code><a href=#the-table-element>table</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>, but with no descendant <code><a href=#the-table-element>table</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmltablecaptionelement>HTMLTableCaptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-caption-element>caption</a></code> element <a href=#represents>represents</a> the title of the
+ <code><a href=#the-table-element>table</a></code> that is its parent, if it has a parent and that
+ is a <code><a href=#the-table-element>table</a></code> element.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-caption-element>caption</a></code> element takes part in the <a href=#table-model>table
+ model</a>.</p>
+
+ </div>
+
+ <p>When a <code><a href=#the-table-element>table</a></code> element is the only content in a
+ <code><a href=#the-figure-element>figure</a></code> element other than the <code><a href=#the-figcaption-element>figcaption</a></code>,
+ the <code><a href=#the-caption-element>caption</a></code> element should be omitted in favor of the
+ <code><a href=#the-figcaption-element>figcaption</a></code>.</p>
+
+ <p>A caption can introduce context for a table, making it
+ significantly easier to understand.</p>
+
+ <div class=example>
+
+ <p>Consider, for instance, the following table:</p>
+
+ <table class=dice-example><tr><th> <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
+ <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
+ <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
+ <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
+ <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
+ <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
+ <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
+ </table><p>In the abstract, this table is not clear. However, with a
+ caption giving the table's number (for reference in the main prose)
+ and explaining its use, it makes more sense:</p>
+
+ <pre>&lt;caption&gt;
+&lt;p&gt;Table 1.
+&lt;p&gt;This table shows the total score obtained from rolling two
+six-sided dice. The first row represents the value of the first die,
+the first column the value of the second die. The total is given in
+the cell that corresponds to the values of the two dice.
+&lt;/caption&gt;</pre>
+
+ <!-- HTML4POLICE (hidden in w3c version because w3c version has to be valid HTML4) -->
+ <p>This provides the user with more context:</p>
+
+ <table class=dice-example><caption>
+ <p>Table 1.
+ <p>This table shows the total score obtained from rolling two
+ six-sided dice. The first row represents the value of the first
+ die, the first column the value of the second die. The total is
+ given in the cell that corresponds to the values of the two dice.
+ </caption>
+ <tr><th> <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
+ <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
+ <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
+ <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
+ <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
+ <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
+ <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
+ </table></div>
+
+
+
+
+ <h4 id=the-colgroup-element><span class=secno>4.9.3 </span>The <dfn><code>colgroup</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
+ <code><a href=#the-caption-element>caption</a></code> elements and before any <code><a href=#the-thead-element>thead</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, and <code><a href=#the-tr-element>tr</a></code>
+ elements.</dd>
+ <dt>Content model:</dt>
+ <dd>If the <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute is present: Empty.</dd>
+ <dd>If the <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute is absent: Zero or more <code><a href=#the-col-element>col</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmltablecolelement>HTMLTableColElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute unsigned long <a href=#dom-colgroup-span title=dom-colgroup-span>span</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-colgroup-element>colgroup</a></code> element <a href=#represents>represents</a> a <a href=#concept-column-group title=concept-column-group>group</a> of one or more <a href=#concept-column title=concept-column>columns</a> in the <code><a href=#the-table-element>table</a></code> that
+ is its parent, if it has a parent and that is a <code><a href=#the-table-element>table</a></code>
+ element.</p>
+
+ <p>If the <code><a href=#the-colgroup-element>colgroup</a></code> element contains no <code><a href=#the-col-element>col</a></code>
+ elements, then the element may have a <dfn id=attr-colgroup-span title=attr-colgroup-span><code>span</code></dfn> content attribute
+ specified, whose value must be a <a href=#valid-non-negative-integer>valid non-negative
+ integer</a> greater than zero.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-colgroup-element>colgroup</a></code> element and its <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute take part in the
+ <a href=#table-model>table model</a>.</p>
+
+ <p>The <dfn id=dom-colgroup-span title=dom-colgroup-span><code>span</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name. The value must be <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative
+ numbers greater than zero</a>.</p>
+
+ </div>
+
+
+ <h4 id=the-col-element><span class=secno>4.9.4 </span>The <dfn><code>col</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-colgroup-element>colgroup</a></code> element that doesn't have
+ a <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-col-span><a href=#attr-col-span>span</a></code></dd>
+ <!-- v2: char, to specify the decimal character used in numeric data cells in the column (not header cells) -->
+ <dt>DOM interface:</dt>
+ <dd>
+ <p><code><a href=#htmltablecolelement>HTMLTableColElement</a></code>, same as for
+ <code><a href=#the-colgroup-element>colgroup</a></code> elements. This interface defines one member,
+ <code title=dom-col-span><a href=#dom-col-span>span</a></code>.</p>
+ </dd>
+ </dl><p>If a <code><a href=#the-col-element>col</a></code> element has a parent and that is a
+ <code><a href=#the-colgroup-element>colgroup</a></code> element that itself has a parent that is a
+ <code><a href=#the-table-element>table</a></code> element, then the <code><a href=#the-col-element>col</a></code> element
+ <a href=#represents>represents</a> one or more <a href=#concept-column title=concept-column>columns</a> in the <a href=#concept-column-group title=concept-column-group>column group</a> represented by that
+ <code><a href=#the-colgroup-element>colgroup</a></code>.</p>
+
+ <p>The element may have a <dfn id=attr-col-span title=attr-col-span><code>span</code></dfn> content attribute
+ specified, whose value must be a <a href=#valid-non-negative-integer>valid non-negative
+ integer</a> greater than zero.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-col-element>col</a></code> element and its <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute take part in the
+ <a href=#table-model>table model</a>.</p>
+
+ <p>The <dfn id=dom-col-span title=dom-col-span><code>span</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name. The value must be <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative
+ numbers greater than zero</a>.</p>
+
+ </div>
+
+
+ <h4 id=the-tbody-element><span class=secno>4.9.5 </span>The <dfn><code>tbody</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
+ <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, and
+ <code><a href=#the-thead-element>thead</a></code> elements, but only if there are no
+ <code><a href=#the-tr-element>tr</a></code> elements that are children of the
+ <code><a href=#the-table-element>table</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-tr-element>tr</a></code> elements</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmltablesectionelement>HTMLTableSectionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-tbody-rows title=dom-tbody-rows>rows</a>;
+ <a href=#htmlelement>HTMLElement</a> <a href=#dom-tbody-insertrow title=dom-tbody-insertRow>insertRow</a>(in optional long index);
+ void <a href=#dom-tbody-deleterow title=dom-tbody-deleteRow>deleteRow</a>(in long index);
+};</pre>
+ <p>The <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> interface is also
+ used for <code><a href=#the-thead-element>thead</a></code> and <code><a href=#the-tfoot-element>tfoot</a></code> elements.</p>
+ </dd>
+ </dl><p>The <code><a href=#the-tbody-element>tbody</a></code> element <a href=#represents>represents</a> a <a href=#concept-row-group title=concept-row-group>block</a> of <a href=#concept-row title=concept-row>rows</a> that consist of a body of data for
+ the parent <code><a href=#the-table-element>table</a></code> element, if the <code><a href=#the-tbody-element>tbody</a></code>
+ element has a parent and it is a <code><a href=#the-table-element>table</a></code>.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-tbody-element>tbody</a></code> element takes part in the <a href=#table-model>table
+ model</a>.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">tbody</var> . <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code></dt>
+ <dd>
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-tr-element>tr</a></code> elements of the table section.</p>
+ </dd>
+
+ <dt><var title="">tr</var> = <var title="">tbody</var> . <code title=dom-tbody-insertRow><a href=#dom-tbody-insertrow>insertRow</a></code>( [ <var title="">index</var> ] )</dt>
+ <dd>
+ <p>Creates a <code><a href=#the-tr-element>tr</a></code> element, inserts it into the table section at the position given by the argument, and returns the <code><a href=#the-tr-element>tr</a></code>.</p>
+ <p>The position is relative to the rows in the table section. The index &minus;1, which is the default if the argument is omitted, is equivalent to inserting at the end of the table section.</p>
+ <p>If the given position is less than &minus;1 or greater than the number of rows, throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ </dd>
+
+ <dt><var title="">tbody</var> . <code title=dom-tbody-deleteRow><a href=#dom-tbody-deleterow>deleteRow</a></code>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Removes the <code><a href=#the-tr-element>tr</a></code> element with the given position in the table section.</p>
+ <p>The position is relative to the rows in the table section. The index &minus;1 is equivalent to deleting the last row of the table section.</p>
+ <p>If the given position is less than &minus;1 or greater than the index of the last row, or if there are no rows, throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-tbody-rows title=dom-tbody-rows><code>rows</code></dfn> attribute
+ must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the element,
+ whose filter matches only <code><a href=#the-tr-element>tr</a></code> elements that are children
+ of the element.</p>
+
+ <p>The <dfn id=dom-tbody-insertrow title=dom-tbody-insertRow><code>insertRow(<var title="">index</var>)</code></dfn> method must, when invoked on an
+ element <var title="">table section</var>, act as follows:</p>
+
+ <p>If <var title="">index</var> is less than &minus;1 or greater than the
+ number of elements in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code>
+ collection, the method must raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception.</p>
+
+ <p>If <var title="">index</var> is missing, equal to &minus;1, or
+ equal to the number of items in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection, the method must
+ create a <code><a href=#the-tr-element>tr</a></code> element, append it to the element <var title="">table section</var>, and return the newly created
+ <code><a href=#the-tr-element>tr</a></code> element.</p>
+
+ <p>Otherwise, the method must create a <code><a href=#the-tr-element>tr</a></code> element,
+ insert it as a child of the <var title="">table section</var>
+ element, immediately before the <var title="">index</var>th
+ <code><a href=#the-tr-element>tr</a></code> element in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection, and finally must
+ return the newly created <code><a href=#the-tr-element>tr</a></code> element.</p>
+
+ <p>The <dfn id=dom-tbody-deleterow title=dom-tbody-deleteRow><code>deleteRow(<var title="">index</var>)</code></dfn> method must remove the <var title="">index</var>th element in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection from its parent. If
+ <var title="">index</var> is less than zero or greater than or equal
+ to the number of elements in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection, the method must
+ instead raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+
+ </div>
+
+
+ <h4 id=the-thead-element><span class=secno>4.9.6 </span>The <dfn><code>thead</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
+ <code><a href=#the-caption-element>caption</a></code>, and <code><a href=#the-colgroup-element>colgroup</a></code>
+ elements and before any <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, and
+ <code><a href=#the-tr-element>tr</a></code> elements, but only if there are no other
+ <code><a href=#the-thead-element>thead</a></code> elements that are children of the
+ <code><a href=#the-table-element>table</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-tr-element>tr</a></code> elements</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, as defined for
+ <code><a href=#the-tbody-element>tbody</a></code> elements.</dd>
+ </dl><p>The <code><a href=#the-thead-element>thead</a></code> element <a href=#represents>represents</a> the <a href=#concept-row-group title=concept-row-group>block</a> of <a href=#concept-row title=concept-row>rows</a> that consist of the column labels
+ (headers) for the parent <code><a href=#the-table-element>table</a></code> element, if the
+ <code><a href=#the-thead-element>thead</a></code> element has a parent and it is a
+ <code><a href=#the-table-element>table</a></code>.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-thead-element>thead</a></code> element takes part in the <a href=#table-model>table
+ model</a>.</p>
+
+ </div>
+
+
+ <h4 id=the-tfoot-element><span class=secno>4.9.7 </span>The <dfn><code>tfoot</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
+ <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, and <code><a href=#the-thead-element>thead</a></code>
+ elements and before any <code><a href=#the-tbody-element>tbody</a></code> and <code><a href=#the-tr-element>tr</a></code>
+ elements, but only if there are no other <code><a href=#the-tfoot-element>tfoot</a></code>
+ elements that are children of the <code><a href=#the-table-element>table</a></code> element.</dd>
+ <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
+ <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, <code><a href=#the-thead-element>thead</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, and <code><a href=#the-tr-element>tr</a></code> elements, but only if there
+ are no other <code><a href=#the-tfoot-element>tfoot</a></code> elements that are children of the
+ <code><a href=#the-table-element>table</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-tr-element>tr</a></code> elements</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, as defined for
+ <code><a href=#the-tbody-element>tbody</a></code> elements.</dd>
+ </dl><p>The <code><a href=#the-tfoot-element>tfoot</a></code> element <a href=#represents>represents</a> the <a href=#concept-row-group title=concept-row-group>block</a> of <a href=#concept-row title=concept-row>rows</a> that consist of the column summaries
+ (footers) for the parent <code><a href=#the-table-element>table</a></code> element, if the
+ <code><a href=#the-tfoot-element>tfoot</a></code> element has a parent and it is a
+ <code><a href=#the-table-element>table</a></code>.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-tfoot-element>tfoot</a></code> element takes part in the <a href=#table-model>table
+ model</a>.</p>
+
+ </div>
+
+
+ <h4 id=the-tr-element><span class=secno>4.9.8 </span>The <dfn><code>tr</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-thead-element>thead</a></code> element.</dd>
+ <dd>As a child of a <code><a href=#the-tbody-element>tbody</a></code> element.</dd>
+ <dd>As a child of a <code><a href=#the-tfoot-element>tfoot</a></code> element.</dd>
+ <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
+ <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, and <code><a href=#the-thead-element>thead</a></code>
+ elements, but only if there are no <code><a href=#the-tbody-element>tbody</a></code> elements that
+ are children of the <code><a href=#the-table-element>table</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd>When the parent node is a <code><a href=#the-thead-element>thead</a></code> element: Zero or more <code><a href=#the-th-element>th</a></code> elements</dd>
+ <dd>Otherwise: Zero or more <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> elements</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmltablerowelement>HTMLTableRowElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ readonly attribute long <a href=#dom-tr-rowindex title=dom-tr-rowIndex>rowIndex</a>;
+ readonly attribute long <a href=#dom-tr-sectionrowindex title=dom-tr-sectionRowIndex>sectionRowIndex</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-tr-cells title=dom-tr-cells>cells</a>;
+ <a href=#htmlelement>HTMLElement</a> <a href=#dom-tr-insertcell title=dom-tr-insertCell>insertCell</a>(in optional long index);
+ void <a href=#dom-tr-deletecell title=dom-tr-deleteCell>deleteCell</a>(in long index);
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-tr-element>tr</a></code> element <a href=#represents>represents</a> a <a href=#concept-row title=concept-row>row</a> of <a href=#concept-cell title=concept-cell>cells</a> in a <a href=#concept-table title=concept-table>table</a>.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-tr-element>tr</a></code> element takes part in the <a href=#table-model>table
+ model</a>.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">tr</var> . <code title=dom-tr-rowIndex><a href=#dom-tr-rowindex>rowIndex</a></code></dt>
+
+ <dd>
+
+ <p>Returns the position of the row in the table's <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> list.</p>
+
+ <p>Returns &minus;1 if the element isn't in a table.</p>
+
+ </dd>
+
+ <dt><var title="">tr</var> . <code title=dom-tr-sectionRowIndex><a href=#dom-tr-sectionrowindex>sectionRowIndex</a></code></dt>
+
+ <dd>
+
+ <p>Returns the position of the row in the table section's <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> list.</p>
+
+ <p>Returns &minus;1 if the element isn't in a table section.</p>
+
+ </dd>
+
+ <dt><var title="">tr</var> . <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code></dt>
+ <dd>
+
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements of the row.</p>
+
+ </dd>
+
+ <dt><var title="">cell</var> = <var title="">tr</var> . <code title=dom-tr-insertCell><a href=#dom-tr-insertcell>insertCell</a></code>( [ <var title="">index</var> ] )</dt>
+
+ <dd>
+
+ <p>Creates a <code><a href=#the-td-element>td</a></code> element, inserts it into the table
+ row at the position given by the argument, and returns the
+ <code><a href=#the-td-element>td</a></code>.</p>
+
+ <p>The position is relative to the cells in the row. The
+ index &minus;1, which is the default if the argument is omitted,
+ is equivalent to inserting at the end of the row.</p>
+
+ <p>If the given position is less than &minus;1 or greater than
+ the number of cells, throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception.</p>
+
+ </dd>
+
+ <dt><var title="">tr</var> . <code title=dom-tr-deleteCell><a href=#dom-tr-deletecell>deleteCell</a></code>(<var title="">index</var>)</dt>
+ <dd>
+
+ <p>Removes the <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element with the
+ given position in the row.</p>
+
+ <p>The position is relative to the cells in the row. The index
+ &minus;1 is equivalent to deleting the last cell of the row.</p>
+
+ <p>If the given position is less than &minus;1 or greater than
+ the index of the last cell, or if there are no cells, throws an
+ <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-tr-rowindex title=dom-tr-rowIndex><code>rowIndex</code></dfn>
+ attribute must, if the element has a parent <code><a href=#the-table-element>table</a></code>
+ element, or a parent <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, or
+ <code><a href=#the-tfoot-element>tfoot</a></code> element and a <em>grandparent</em>
+ <code><a href=#the-table-element>table</a></code> element, return the index of the <code><a href=#the-tr-element>tr</a></code>
+ element in that <code><a href=#the-table-element>table</a></code> element's <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection. If there is no such
+ <code><a href=#the-table-element>table</a></code> element, then the attribute must return
+ &minus;1.</p>
+
+ <p>The <dfn id=dom-tr-sectionrowindex title=dom-tr-sectionRowIndex><code>sectionRowIndex</code></dfn>
+ attribute must, if the element has a parent <code><a href=#the-table-element>table</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-tfoot-element>tfoot</a></code>
+ element, return the index of the <code><a href=#the-tr-element>tr</a></code> element in the
+ parent element's <code title="">rows</code> collection (for tables,
+ that's the <code title=dom-table-rows><a href=#dom-table-rows>HTMLTableElement.rows</a></code>
+ collection; for table sections, that's the <code title=dom-tbody-rows><a href=#dom-tbody-rows>HTMLTableRowElement.rows</a></code>
+ collection). If there is no such parent element, then the attribute
+ must return &minus;1.</p>
+
+ <p>The <dfn id=dom-tr-cells title=dom-tr-cells><code>cells</code></dfn> attribute
+ must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#the-tr-element>tr</a></code> element, whose filter matches only <code><a href=#the-td-element>td</a></code>
+ and <code><a href=#the-th-element>th</a></code> elements that are children of the
+ <code><a href=#the-tr-element>tr</a></code> element.</p>
+
+ <p>The <dfn id=dom-tr-insertcell title=dom-tr-insertCell><code>insertCell(<var title="">index</var>)</code></dfn> method must act as follows:</p>
+
+ <p>If <var title="">index</var> is less than &minus;1 or greater than the
+ number of elements in the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code>
+ collection, the method must raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
+ exception.</p>
+
+ <p>If <var title="">index</var> is missing, equal to &minus;1, or
+ equal to the number of items in <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection, the method must create
+ a <code><a href=#the-td-element>td</a></code> element, append it to the <code><a href=#the-tr-element>tr</a></code> element,
+ and return the newly created <code><a href=#the-td-element>td</a></code> element.</p>
+
+ <p>Otherwise, the method must create a <code><a href=#the-td-element>td</a></code> element,
+ insert it as a child of the <code><a href=#the-tr-element>tr</a></code> element, immediately
+ before the <var title="">index</var>th <code><a href=#the-td-element>td</a></code> or
+ <code><a href=#the-th-element>th</a></code> element in the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection, and finally must
+ return the newly created <code><a href=#the-td-element>td</a></code> element.</p>
+
+ <p>The <dfn id=dom-tr-deletecell title=dom-tr-deleteCell><code>deleteCell(<var title="">index</var>)</code></dfn> method must remove the <var title="">index</var>th element in the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection from its parent. If
+ <var title="">index</var> is less than zero or greater than or equal
+ to the number of elements in the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection, the method must
+ instead raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+
+ </div>
+
+
+ <h4 id=the-td-element><span class=secno>4.9.9 </span>The <dfn><code>td</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-tr-element>tr</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code></dd>
+ <dd><code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code></dd>
+ <dd><code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code></dd>
+ <!-- v2 char, to specify the decimal character used in numeric cells -->
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmltabledatacellelement>HTMLTableDataCellElement</dfn> : <a href=#htmltablecellelement>HTMLTableCellElement</a> {};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-td-element>td</a></code> element <a href=#represents>represents</a> a data <a href=#concept-cell title=concept-cell>cell</a> in a table.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-td-element>td</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes take part in the
+ <a href=#table-model>table model</a>.</p>
+
+ </div>
+
+
+ <h4 id=the-th-element><span class=secno>4.9.10 </span>The <dfn><code>th</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-tr-element>tr</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code></dd>
+ <dd><code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code></dd>
+ <dd><code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code></dd>
+ <dd><code title=attr-th-scope><a href=#attr-th-scope>scope</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmltableheadercellelement>HTMLTableHeaderCellElement</dfn> : <a href=#htmltablecellelement>HTMLTableCellElement</a> {
+ attribute DOMString <a href=#dom-th-scope title=dom-th-scope>scope</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-th-element>th</a></code> element <a href=#represents>represents</a> a header <a href=#concept-cell title=concept-cell>cell</a> in a table.</p>
+
+ <p>The <code><a href=#the-th-element>th</a></code> element may have a <dfn id=attr-th-scope title=attr-th-scope><code>scope</code></dfn> content attribute
+ specified. The <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is
+ an <a href=#enumerated-attribute>enumerated attribute</a> with five states, four of which
+ have explicit keywords:</p>
+
+ <dl><dt>The <dfn id=attr-th-scope-row title=attr-th-scope-row><code>row</code></dfn>
+ keyword, which maps to the <i>row</i> state</dt>
+
+ <dd>The <i>row</i> state means the header cell applies to some of
+ the subsequent cells in the same row(s).</dd>
+
+ <dt>The <dfn id=attr-th-scope-col title=attr-th-scope-col><code>col</code></dfn>
+ keyword, which maps to the <i>column</i> state</dt>
+
+ <dd>The <i>column</i> state means the header cell applies to some
+ of the subsequent cells in the same column(s).</dd>
+
+ <dt>The <dfn id=attr-th-scope-rowgroup title=attr-th-scope-rowgroup><code>rowgroup</code></dfn> keyword,
+ which maps to the <i>row group</i> state</dt>
+
+ <dd>The <i>row group</i> state means the header cell applies to all
+ the remaining cells in the row group. A <code><a href=#the-th-element>th</a></code> element's
+ <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute must not be in
+ the <a href=#attr-th-scope-rowgroup title=attr-th-scope-rowgroup>row group</a> state if
+ the element is not anchored in a <a href=#concept-row-group title=concept-row-group>row group</a>.</dd>
+
+ <dt>The <dfn id=attr-th-scope-colgroup title=attr-th-scope-colgroup><code>colgroup</code></dfn> keyword,
+ which maps to the <i>column group</i> state</dt>
+
+ <dd>The <i>column group</i> state means the header cell applies to
+ all the remaining cells in the column group. A <code><a href=#the-th-element>th</a></code>
+ element's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute must
+ not be in the <a href=#attr-th-scope-colgroup title=attr-th-scope-colgroup>column
+ group</a> state if the element is not anchored in a <a href=#concept-column-group title=concept-column-group>column group</a>.</dd>
+
+ <dt>The <dfn id=attr-th-scope-auto title=attr-th-scope-auto>auto</dfn> state</dt>
+
+ <dd>The <i>auto</i> state makes the header cell apply to a set of
+ cells selected based on context.</dd>
+
+ </dl><p>The <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute's
+ <i>missing value default</i> is the <i>auto</i> state.</p>
+
+ <div class=impl>
+
+ <p>The <code><a href=#the-th-element>th</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code>, and <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attributes take part in the
+ <a href=#table-model>table model</a>.</p>
+
+ <p>The <dfn id=dom-th-scope title=dom-th-scope><code>scope</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how the <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute's <code title=attr-th-scope-rowgroup><a href=#attr-th-scope-rowgroup>rowgroup</a></code> value affects which
+ data cells a header cell applies to.</p>
+
+ <p>Here is a markup fragment showing a table:</p>
+
+ <pre>&lt;table&gt;
+ &lt;thead&gt;
+ &lt;tr&gt; &lt;th&gt; ID &lt;th&gt; Measurement &lt;th&gt; Average &lt;th&gt; Maximum
+ &lt;tbody&gt;
+ &lt;tr&gt; &lt;td&gt; &lt;th scope=rowgroup&gt; Cats &lt;td&gt; &lt;td&gt;
+ &lt;tr&gt; &lt;td&gt; 93 &lt;th&gt; Legs &lt;td&gt; 3.5 &lt;td&gt; 4
+ &lt;tr&gt; &lt;td&gt; 10 &lt;th&gt; Tails &lt;td&gt; 1 &lt;td&gt; 1
+ &lt;tbody&gt;
+ &lt;tr&gt; &lt;td&gt; &lt;th scope=rowgroup&gt; English speakers &lt;td&gt; &lt;td&gt;
+ &lt;tr&gt; &lt;td&gt; 32 &lt;th&gt; Legs &lt;td&gt; 2.67 &lt;td&gt; 4
+ &lt;tr&gt; &lt;td&gt; 35 &lt;th&gt; Tails &lt;td&gt; 0.33 &lt;td&gt; 1
+&lt;/table&gt;</pre>
+
+ <p>This would result in the following table:</p>
+
+ <table><thead><tr><th> ID <th> Measurement <th> Average <th> Maximum
+ <tbody><tr><td> <th scope=rowgroup> Cats <td> <td>
+ <tr><td> 93 <th> Legs <td> 3.5 <td> 4
+ <tr><td> 10 <th> Tails <td> 1 <td> 1
+ <tbody><tr><td> <th scope=rowgroup> English speakers <td> <td>
+ <tr><td> 32 <th> Legs <td> 2.67 <td> 4
+ <tr><td> 35 <th> Tails <td> 0.33 <td> 1
+ </table><p>The headers in the first row all apply directly down to the rows
+ in their column.</p>
+
+ <p>The headers with the explicit <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attributes apply to all the
+ cells in their row group other than the cells in the first column.</p>
+
+ <p>The remaining headers apply just to the cells to the right of
+ them.</p>
+
+ <!-- image source: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/151 -->
+ <img alt="" src=images/table-scope-diagram.png><!-- (alt is empty because the diagram is completely described by the previous paragraphs) --></div>
+
+
+
+ <h4 id=attributes-common-to-td-and-th-elements><span class=secno>4.9.11 </span>Attributes common to <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</h4>
+
+ <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements may have a <dfn id=attr-tdth-colspan title=attr-tdth-colspan><code>colspan</code></dfn> content
+ attribute specified, whose value must be a <a href=#valid-non-negative-integer>valid non-negative
+ integer</a> greater than zero.</p>
+
+ <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements may also have a
+ <dfn id=attr-tdth-rowspan title=attr-tdth-rowspan><code>rowspan</code></dfn> content
+ attribute specified, whose value must be a <a href=#valid-non-negative-integer>valid non-negative
+ integer</a>.</p>
+
+ <p>These attributes give the number of columns and rows respectively
+ that the cell is to span. These attributes must not be used to
+ overlap cells<span class=impl>, as described in the description of
+ the <a href=#table-model>table model</a></span>.</p> <!-- conformance criteria
+ for determining when this is violated are given in the processing
+ model -->
+
+ <hr><p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> element may have a <dfn id=attr-tdth-headers title=attr-tdth-headers><code>headers</code></dfn> content
+ attribute specified. The <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute, if specified,
+ must contain a string consisting of an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique
+ space-separated tokens</a>, each of which must have the value of
+ an ID of a <code><a href=#the-th-element>th</a></code> element taking part in the same <a href=#concept-table title=concept-table>table</a> as the <code><a href=#the-td-element>td</a></code> or
+ <code><a href=#the-th-element>th</a></code> element<span class=impl> (as defined by the
+ <a href=#table-model>table model</a>)</span>.</p>
+
+ <p>A <code><a href=#the-th-element>th</a></code> element with ID <var title="">id</var> is said
+ to be <i>directly targeted</i> by all <code><a href=#the-td-element>td</a></code> and
+ <code><a href=#the-th-element>th</a></code> elements in the same <a href=#concept-table title=concept-table>table</a> that have <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes whose values
+ include as one of their tokens the ID <var title="">id</var>. A
+ <code><a href=#the-th-element>th</a></code> element <var title="">A</var> is said to be
+ <i>targeted</i> by a <code><a href=#the-th-element>th</a></code> or <code><a href=#the-td-element>td</a></code> element
+ <var title="">B</var> if either <var title="">A</var> is <i>directly
+ targeted</i> by <var title="">B</var> or if there exists an element
+ <var title="">C</var> that is itself <i>targeted</i> by the element
+ <var title="">B</var> and <var title="">A</var> is <i>directly
+ targeted</i> by <var title="">C</var>.</p>
+
+ <p>A <code><a href=#the-th-element>th</a></code> element must not be <i>targeted</i> by
+ itself.</p>
+
+ <div class=impl>
+
+ <p>The <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes take part in the
+ <a href=#table-model>table model</a>.</p>
+
+ </div>
+
+ <hr><p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements implement
+ interfaces that inherit from the <code><a href=#htmltablecellelement>HTMLTableCellElement</a></code>
+ interface:</p>
+
+ <pre class=idl>interface <dfn id=htmltablecellelement>HTMLTableCellElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute unsigned long <a href=#dom-tdth-colspan title=dom-tdth-colSpan>colSpan</a>;
+ attribute unsigned long <a href=#dom-tdth-rowspan title=dom-tdth-rowSpan>rowSpan</a>;
+ [PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-tdth-headers title=dom-tdth-headers>headers</a>;
+ readonly attribute long <a href=#dom-tdth-cellindex title=dom-tdth-cellIndex>cellIndex</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">cell</var> . <code title=dom-tdth-cellIndex><a href=#dom-tdth-cellindex>cellIndex</a></code></dt>
+
+ <dd>
+
+ <p>Returns the position of the cell in the row's <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> list. This does not necessarily
+ correspond to the <var title="">x</var>-position of the cell in
+ the table, since earlier cells might cover multiple rows or
+ columns.</p>
+
+ <p>Returns 0 if the element isn't in a row.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-tdth-colspan title=dom-tdth-colSpan><code>colSpan</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name. The value must be <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative
+ numbers greater than zero</a>.</p>
+
+ <p>The <dfn id=dom-tdth-rowspan title=dom-tdth-rowSpan><code>rowSpan</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name. Its default value, which must be used if <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">parsing the
+ attribute as a non-negative integer</a> returns an error, is 1.</p>
+
+ <p>The <dfn id=dom-tdth-headers title=dom-tdth-headers><code>headers</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ <p>The <dfn id=dom-tdth-cellindex title=dom-tdth-cellIndex><code>cellIndex</code></dfn>
+ IDL attribute must, if the element has a parent <code><a href=#the-tr-element>tr</a></code>
+ element, return the index of the cell's element in the parent
+ element's <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection. If
+ there is no such parent element, then the attribute must return
+ 0.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=processing-model-0><span class=secno>4.9.12 </span>Processing model</h4>
+
+ <p>The various table elements and their content attributes together
+ define the <dfn id=table-model>table model</dfn>.</p>
+
+ <p>A <dfn id=concept-table title=concept-table>table</dfn> consists of cells
+ aligned on a two-dimensional grid of <dfn id=concept-slots title=concept-slots>slots</dfn> with coordinates (<var title="">x</var>, <var title="">y</var>). The grid is finite, and is
+ either empty or has one or more slots. If the grid has one or more
+ slots, then the <var title="">x</var> coordinates are always in the
+ range <span title="">0&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">width</sub></var></span>, and the <var title="">y</var>
+ coordinates are always in the range <span title="">0&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">height</sub></var></span>. If one or both of <var title="">x<sub title="">width</sub></var> and <var title="">y<sub title="">height</sub></var> are zero, then the table is empty (has
+ no slots). Tables correspond to <code><a href=#the-table-element>table</a></code> elements.</p>
+
+ <p>A <dfn id=concept-cell title=concept-cell>cell</dfn> is a set of slots anchored
+ at a slot (<var title="">cell<sub title="">x</sub></var>, <var title="">cell<sub title="">y</sub></var>), and with a particular
+ <var title="">width</var> and <var title="">height</var> such that
+ the cell covers all the slots with coordinates (<var title="">x</var>, <var title="">y</var>) where <span title=""><var title="">cell<sub title="">x</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">cell<sub title="">x</sub></var>+<var title="">width</var></span> and
+ <span title=""><var title="">cell<sub title="">y</sub></var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">cell<sub title="">y</sub></var>+<var title="">height</var></span>. Cells can
+ either be <em>data cells</em> or <em>header cells</em>. Data cells
+ correspond to <code><a href=#the-td-element>td</a></code> elements, and header cells correspond
+ to <code><a href=#the-th-element>th</a></code> elements. Cells of both types can have zero or
+ more associated header cells.</p>
+
+ <p>It is possible, in certain error cases, for two cells to occupy
+ the same slot.</p>
+
+ <p>A <dfn id=concept-row title=concept-row>row</dfn> is a complete set of slots
+ from <span title=""><var title="">x</var>=0</span> to <span title=""><var title="">x</var>=<var title="">x<sub title="">width</sub></var>-1</span>, for a particular value of <var title="">y</var>. Rows correspond to <code><a href=#the-tr-element>tr</a></code> elements.</p>
+
+ <p>A <dfn id=concept-column title=concept-column>column</dfn> is a complete set of
+ slots from <span title=""><var title="">y</var>=0</span> to <span title=""><var title="">y</var>=<var title="">y<sub title="">height</sub></var>-1</span>, for a particular value of <var title="">x</var>. Columns can correspond to <code><a href=#the-col-element>col</a></code>
+ elements. In the absence of <code><a href=#the-col-element>col</a></code> elements, columns are
+ implied.</p>
+
+ <p>A <dfn id=concept-row-group title=concept-row-group>row group</dfn> is a set of
+ <a href=#concept-row title=concept-row>rows</a> anchored at a slot (0, <var title="">group<sub title="">y</sub></var>) with a particular <var title="">height</var> such that the row group covers all the slots
+ with coordinates (<var title="">x</var>, <var title="">y</var>)
+ where <span title="">0&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">width</sub></var></span> and <span title=""><var title="">group<sub title="">y</sub></var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">group<sub title="">y</sub></var>+<var title="">height</var></span>. Row groups
+ correspond to <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
+ <code><a href=#the-tfoot-element>tfoot</a></code> elements. Not every row is necessarily in a row
+ group.</p>
+
+ <p>A <dfn id=concept-column-group title=concept-column-group>column group</dfn> is a set
+ of <a href=#concept-column title=concept-column>columns</a> anchored at a slot
+ (<var title="">group<sub title="">x</sub></var>, 0) with a
+ particular <var title="">width</var> such that the column group
+ covers all the slots with coordinates (<var title="">x</var>, <var title="">y</var>) where <span title=""><var title="">group<sub title="">x</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">group<sub title="">x</sub></var>+<var title="">width</var></span> and
+ <span title="">0&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">height</sub></var></span>. Column groups
+ correspond to <code><a href=#the-colgroup-element>colgroup</a></code> elements. Not every column is
+ necessarily in a column group.</p>
+
+ <p><a href=#concept-row-group title=concept-row-group>Row groups</a> cannot overlap
+ each other. Similarly, <a href=#concept-column-group title=concept-column-group>column
+ groups</a> cannot overlap each other.</p>
+
+ <p>A <a href=#concept-cell title=concept-cell>cell</a> cannot cover slots that
+ are from two or more <a href=#concept-row-group title=concept-row-group>row
+ groups</a>. It is, however, possible for a cell to be in multiple
+ <a href=#concept-column-group title=concept-column-group>column groups</a>. All the
+ slots that form part of one cell are part of zero or one <a href=#concept-row-group title=concept-row-group>row groups</a> and zero or more <a href=#concept-column-group title=concept-column-group>column groups</a>.</p>
+
+ <p>In addition to <a href=#concept-cell title=concept-cell>cells</a>, <a href=#concept-column title=concept-column>columns</a>, <a href=#concept-row title=concept-row>rows</a>, <a href=#concept-row-group title=concept-row-group>row
+ groups</a>, and <a href=#concept-column-group title=concept-column-group>column
+ groups</a>, <a href=#concept-table title=concept-table>tables</a> can have a
+ <code><a href=#the-caption-element>caption</a></code> element associated with them. This gives the
+ table a heading, or legend.</p>
+
+ <p>A <dfn id=table-model-error>table model error</dfn> is an error with the data
+ represented by <code><a href=#the-table-element>table</a></code> elements and their
+ descendants. Documents must not have table model errors.</p>
+
+
+ <h5 id=forming-a-table><span class=secno>4.9.12.1 </span>Forming a table</h5>
+
+ <p>To determine which elements correspond to which slots in a <a href=#concept-table title=concept-table>table</a> associated with a
+ <code><a href=#the-table-element>table</a></code> element, to determine the dimensions of the table
+ (<var title="">x<sub title="">width</sub></var> and <var title="">y<sub title="">height</sub></var>), and to determine if
+ there are any <a href=#table-model-error title="table model error">table model
+ errors</a>, user agents must use the following algorithm:</p>
+
+ <ol><li>
+ <p>Let <var title="">x<sub title="">width</sub></var> be zero.</p>
+ </li>
+
+ <li>
+ <p>Let <var title="">y<sub title="">height</sub></var> be zero.</p>
+ </li>
+
+ <li>
+
+ <p>Let <var title="">pending <code><a href=#the-tfoot-element>tfoot</a></code> elements</var> be
+ a list of <code><a href=#the-tfoot-element>tfoot</a></code> elements, initially empty.</p>
+
+ </li>
+
+ <li>
+ <p>Let <var title="">the table</var> be the <a href=#concept-table title=concept-table>table</a> represented by the
+ <code><a href=#the-table-element>table</a></code> element. The <var title="">x<sub title="">width</sub></var> and <var title="">y<sub title="">height</sub></var> variables give <var title="">the
+ table</var>'s dimensions. <var title="">The table</var> is
+ initially empty.</p>
+ </li>
+
+ <li>
+
+ <!-- this step is here just so that we can be sure to have a first
+ element in the next step, so that we can set up the "advance"
+ exception-handling thingy below; otherwise it'd be more
+ complicated. it's not a perf optimization per se. -->
+
+ <p>If the <code><a href=#the-table-element>table</a></code> element has no children elements,
+ then return <var title="">the table</var> (which will be empty),
+ and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Associate the first <code><a href=#the-caption-element>caption</a></code> element child of the
+ <code><a href=#the-table-element>table</a></code> element with <var title="">the table</var>. If
+ there are no such children, then it has no associated
+ <code><a href=#the-caption-element>caption</a></code> element.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the <var title="">current element</var> be the first
+ element child of the <code><a href=#the-table-element>table</a></code> element.</p>
+
+ <p>If a step in this algorithm ever requires the <var title="">current element</var> to be <dfn id=concept-table-advance title=concept-table-advance>advanced to the next child of the
+ <code>table</code></dfn> when there is no such next child, then
+ the user agent must jump to the step labeled <i>end</i>, near the
+ end of this algorithm.</p>
+
+ </li>
+
+ <li>
+
+ <p>While the <var title="">current element</var> is not one of the
+ following elements, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the next child of the
+ <code><a href=#the-table-element>table</a></code>:</p>
+
+ <ul class=brief><li><code><a href=#the-colgroup-element>colgroup</a></code></li>
+ <li><code><a href=#the-thead-element>thead</a></code></li>
+ <li><code><a href=#the-tbody-element>tbody</a></code></li>
+ <li><code><a href=#the-tfoot-element>tfoot</a></code></li>
+ <li><code><a href=#the-tr-element>tr</a></code></li>
+ </ul></li>
+
+ <li>
+
+ <p>If the <var title="">current element</var> is a
+ <code><a href=#the-colgroup-element>colgroup</a></code>, follow these substeps:</p>
+
+ <ol><li>
+
+ <p><i>Column groups</i>: Process the <var title="">current
+ element</var> according to the appropriate case below:</p>
+
+ <dl class=switch><dt>If the <var title="">current element</var> has any
+ <code><a href=#the-col-element>col</a></code> element children</dt>
+
+ <dd>
+
+ <p>Follow these steps:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">x<sub title="">start</sub></var> have
+ the value of <span title=""><var title="">x<sub title="">width</sub></var></span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the <var title="">current column</var> be the first
+ <code><a href=#the-col-element>col</a></code> element child of the <code><a href=#the-colgroup-element>colgroup</a></code>
+ element.</p>
+
+ </li>
+
+ <li>
+
+ <p><i>Columns</i>: If the <var title="">current column</var>
+ <code><a href=#the-col-element>col</a></code> element has a <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute, then parse its
+ value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a>.</p>
+
+ <p>If the result of parsing the value is not an error or
+ zero, then let <var title="">span</var> be that value.</p>
+
+ <p>Otherwise, if the <code><a href=#the-col-element>col</a></code> element has no <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute, or if trying to
+ parse the attribute's value resulted in an error or zero,
+ then let <var title="">span</var> be 1.</p>
+
+ </li>
+
+ <li>
+
+ <p>Increase <var title="">x<sub title="">width</sub></var> by
+ <var title="">span</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the last <var title="">span</var> <a href=#concept-column title=concept-column>columns</a> in <var title="">the
+ table</var> correspond to the <var title="">current
+ column</var> <code><a href=#the-col-element>col</a></code> element.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">current column</var> is not the last
+ <code><a href=#the-col-element>col</a></code> element child of the <code><a href=#the-colgroup-element>colgroup</a></code>
+ element, then let the <var title="">current column</var> be
+ the next <code><a href=#the-col-element>col</a></code> element child of the
+ <code><a href=#the-colgroup-element>colgroup</a></code> element, and return to the step
+ labeled <i>columns</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let all the last <a href=#concept-column title=concept-column>columns</a> in <var title="">the
+ table</var> from <span title="">x=<var title="">x<sub title="">start</sub></var></span> to <span title="">x=<var title="">x<sub title="">width</sub></var>-1</span> form a
+ new <a href=#concept-column-group title=concept-column-group>column group</a>,
+ anchored at the slot (<var title="">x<sub title="">start</sub></var>, 0), with width <span title=""><var title="">x<sub title="">width</sub></var>-<var title="">x<sub title="">start</sub></var></span>,
+ corresponding to the <code><a href=#the-colgroup-element>colgroup</a></code> element.</p>
+
+ </li>
+
+ </ol></dd>
+
+
+ <dt>If the <var title="">current element</var> has no
+ <code><a href=#the-col-element>col</a></code> element children</dt>
+
+ <dd>
+
+ <ol><li>
+
+ <p>If the <code><a href=#the-colgroup-element>colgroup</a></code> element has a <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute, then parse
+ its value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a>.</p>
+
+ <p>If the result of parsing the value is not an error or
+ zero, then let <var title="">span</var> be that value.</p>
+
+ <p>Otherwise, if the <code><a href=#the-colgroup-element>colgroup</a></code> element has no
+ <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute, or
+ if trying to parse the attribute's value resulted in an
+ error or zero, then let <var title="">span</var> be 1.</p>
+
+ </li>
+
+ <li>
+
+ <p>Increase <var title="">x<sub title="">width</sub></var> by
+ <var title="">span</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the last <var title="">span</var> <a href=#concept-column title=concept-column>columns</a> in <var title="">the
+ table</var> form a new <a href=#concept-column-group title=concept-column-group>column group</a>, anchored
+ at the slot (<span title=""><var title="">x<sub title="">width</sub></var>-<var title="">span</var></span>,
+ 0), with width <var title="">span</var>, corresponding to
+ the <code><a href=#the-colgroup-element>colgroup</a></code> element.</p>
+
+ </li>
+
+ </ol></dd>
+
+ </dl></li>
+
+ <li>
+
+ <p><a href=#concept-table-advance title=concept-table-advance>Advance</a> the <var title="">current element</var> to the next child of the
+ <code><a href=#the-table-element>table</a></code>.</p>
+
+ </li>
+
+ <li>
+
+ <p>While the <var title="">current element</var> is not one of
+ the following elements, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the next child of the
+ <code><a href=#the-table-element>table</a></code>:</p>
+
+ <ul class=brief><li><code><a href=#the-colgroup-element>colgroup</a></code></li>
+ <li><code><a href=#the-thead-element>thead</a></code></li>
+ <li><code><a href=#the-tbody-element>tbody</a></code></li>
+ <li><code><a href=#the-tfoot-element>tfoot</a></code></li>
+ <li><code><a href=#the-tr-element>tr</a></code></li>
+ </ul></li>
+
+ <li>
+
+ <p>If the <var title="">current element</var> is a
+ <code><a href=#the-colgroup-element>colgroup</a></code> element, jump to the step labeled
+ <i>column groups</i> above.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li>
+
+ <p>Let <var title="">y<sub title="">current</sub></var> be
+ zero.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the <var title="">list of downward-growing cells</var> be
+ an empty list.</p>
+
+ </li>
+
+ <li>
+
+ <p><i>Rows</i>: While the <var title="">current element</var> is
+ not one of the following elements, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the next child of the
+ <code><a href=#the-table-element>table</a></code>:</p>
+
+ <ul class=brief><li><code><a href=#the-thead-element>thead</a></code></li>
+ <li><code><a href=#the-tbody-element>tbody</a></code></li>
+ <li><code><a href=#the-tfoot-element>tfoot</a></code></li>
+ <li><code><a href=#the-tr-element>tr</a></code></li>
+ </ul></li>
+
+ <li>
+
+ <p>If the <var title="">current element</var> is a
+ <code><a href=#the-tr-element>tr</a></code>, then run the <a href=#algorithm-for-processing-rows>algorithm for processing
+ rows</a>, <a href=#concept-table-advance title=concept-table-advance>advance</a>
+ the <var title="">current element</var> to the next child of the
+ <code><a href=#the-table-element>table</a></code>, and return to the step labeled
+ <i>rows</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Run the <a href=#algorithm-for-ending-a-row-group>algorithm for ending a row group</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <var title="">current element</var> is a
+ <code><a href=#the-tfoot-element>tfoot</a></code>, then add that element to the list of <var title="">pending <code><a href=#the-tfoot-element>tfoot</a></code> elements</var>, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the next child of the
+ <code><a href=#the-table-element>table</a></code>, and return to the step labeled
+ <i>rows</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>The <var title="">current element</var> is either a
+ <code><a href=#the-thead-element>thead</a></code> or a <code><a href=#the-tbody-element>tbody</a></code>.</p>
+
+ <p>Run the <a href=#algorithm-for-processing-row-groups>algorithm for processing row groups</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p><a href=#concept-table-advance title=concept-table-advance>Advance</a> the <var title="">current element</var> to the next child of the
+ <code><a href=#the-table-element>table</a></code>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Return to the step labeled <i>rows</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p><i>End</i>: For each <code><a href=#the-tfoot-element>tfoot</a></code> element in the list of
+ <var title="">pending <code><a href=#the-tfoot-element>tfoot</a></code> elements</var>, in tree
+ order, run the <a href=#algorithm-for-processing-row-groups>algorithm for processing row
+ groups</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there exists a <a href=#concept-row title=concept-row>row</a> or <a href=#concept-column title=concept-column>column</a> in <var title="">the
+ table</var> containing only <a href=#concept-slots title=concept-slots>slots</a> that do not have a <a href=#concept-cell title=concept-cell>cell</a> anchored to them, then this is a
+ <a href=#table-model-error>table model error</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Return <var title="">the table</var>.</p>
+
+ </li>
+
+ </ol><p>The <dfn id=algorithm-for-processing-row-groups>algorithm for processing row groups</dfn>, which is
+ invoked by the set of steps above for processing
+ <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code>
+ elements, is:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">y<sub title="">start</sub></var> have the
+ value of <var title="">y<sub title="">height</sub></var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each <code><a href=#the-tr-element>tr</a></code> element that is a child of the element
+ being processed, in tree order, run the <a href=#algorithm-for-processing-rows>algorithm for
+ processing rows</a>.</p>
+
+ </li>
+
+ <li>
+
+ <!-- if we added any rows, make them part of a row group -->
+ <p>If <span title=""><var title="">y<sub title="">height</sub></var>&nbsp;&gt;&nbsp;<var title="">y<sub title="">start</sub></var></span>, then let all the last <a href=#concept-row title=concept-row>rows</a> in <var title="">the table</var>
+ from <span title="">y=<var title="">y<sub title="">start</sub></var></span>
+ to <span title="">y=<var title="">y<sub title="">height</sub></var>-1</span> form a new <a href=#concept-row-group title=concept-row-group>row group</a>, anchored at the slot
+ with coordinate (0, <var title="">y<sub title="">start</sub></var>), with height <span title=""><var title="">y<sub title="">height</sub></var>-<var title="">y<sub title="">start</sub></var></span>, corresponding to the element
+ being processed.</p>
+
+ </li>
+
+ <li>
+
+ <p>Run the <a href=#algorithm-for-ending-a-row-group>algorithm for ending a row group</a>.</p>
+
+ </li>
+
+ </ol><p>The <dfn id=algorithm-for-ending-a-row-group>algorithm for ending a row group</dfn>, which is invoked
+ by the set of steps above when starting and ending a block of rows,
+ is:</p>
+
+ <ol><li>
+
+ <p>While <var title="">y<sub title="">current</sub></var> is less
+ than <var title="">y<sub title="">height</sub></var>, follow these
+ steps:</p>
+
+ <ol><li>
+
+ <p>Run the <a href=#algorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing
+ cells</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Increase <var title="">y<sub title="">current</sub></var> by
+ 1.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li>
+
+ <p>Empty the <var title="">list of downward-growing
+ cells</var>.</p>
+
+ </li>
+
+ </ol><p>The <dfn id=algorithm-for-processing-rows>algorithm for processing rows</dfn>, which is invoked by
+ the set of steps above for processing <code><a href=#the-tr-element>tr</a></code> elements,
+ is:</p>
+
+ <ol><li>
+
+ <p>If <var title="">y<sub title="">height</sub></var> is equal to
+ <var title="">y<sub title="">current</sub></var>, then increase
+ <var title="">y<sub title="">height</sub></var> by 1. (<var title="">y<sub title="">current</sub></var> is never
+ <em>greater</em> than <var title="">y<sub title="">height</sub></var>.)</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">x<sub title="">current</sub></var> be 0.</p>
+
+ </li>
+
+ <li>
+
+ <p>Run the <a href=#algorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing
+ cells</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <code><a href=#the-tr-element>tr</a></code> element being processed has no
+ <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element children, then increase
+ <var title="">y<sub title="">current</sub></var> by 1, abort this
+ set of steps, and return to the algorithm above.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">current cell</var> be the first
+ <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element in the <code><a href=#the-tr-element>tr</a></code>
+ element being processed.</p>
+
+ </li>
+
+ <li>
+
+ <p><i>Cells</i>: While <var title="">x<sub title="">current</sub></var> is less than <var title="">x<sub title="">width</sub></var> and the slot with coordinate (<var title="">x<sub title="">current</sub></var>, <var title="">y<sub title="">current</sub></var>) already has a cell assigned to it,
+ increase <var title="">x<sub title="">current</sub></var> by
+ 1.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">x<sub title="">current</sub></var> is equal to
+ <var title="">x<sub title="">width</sub></var>, increase <var title="">x<sub title="">width</sub></var> by 1. (<var title="">x<sub title="">current</sub></var> is never
+ <em>greater</em> than <var title="">x<sub title="">width</sub></var>.)</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <var title="">current cell</var> has a <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> attribute, then <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">parse that
+ attribute's value</a>, and let <var title="">colspan</var> be
+ the result.</p>
+
+ <p>If parsing that value failed, or returned zero, or if the
+ attribute is absent, then let <var title="">colspan</var> be 1,
+ instead.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <var title="">current cell</var> has a <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> attribute, then <a href=#rules-for-parsing-non-negative-integers title="rules for
+ parsing non-negative integers">parse that attribute's
+ value</a>, and let <var title="">rowspan</var> be the
+ result.</p>
+
+ <p>If parsing that value failed or if the attribute is absent,
+ then let <var title="">rowspan</var> be 1, instead.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">rowspan</var> is zero, then let <var title="">cell grows downward</var> be true, and set <var title="">rowspan</var> to 1. Otherwise, let <var title="">cell
+ grows downward</var> be false.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <span title=""><var title="">x<sub title="">width</sub></var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">current</sub></var>+<var title="">colspan</var></span>,
+ then let <var title="">x<sub title="">width</sub></var> be
+ <span title=""><var title="">x<sub title="">current</sub></var>+<var title="">colspan</var></span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <span title=""><var title="">y<sub title="">height</sub></var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">current</sub></var>+<var title="">rowspan</var></span>,
+ then let <var title="">y<sub title="">height</sub></var> be
+ <span title=""><var title="">y<sub title="">current</sub></var>+<var title="">rowspan</var></span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the slots with coordinates (<var title="">x</var>, <var title="">y</var>) such that <span title=""><var title="">x<sub title="">current</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">current</sub></var>+<var title="">colspan</var></span>
+ and <span title=""><var title="">y<sub title="">current</sub></var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">current</sub></var>+<var title="">rowspan</var></span> be
+ covered by a new <a href=#concept-cell title=concept-cell>cell</a> <var title="">c</var>, anchored at (<var title="">x<sub title="">current</sub></var>, <var title="">y<sub title="">current</sub></var>), which has width <var title="">colspan</var> and height <var title="">rowspan</var>,
+ corresponding to the <var title="">current cell</var> element.</p>
+
+ <p>If the <var title="">current cell</var> element is a
+ <code><a href=#the-th-element>th</a></code> element, let this new cell <var title="">c</var>
+ be a header cell; otherwise, let it be a data cell.</p>
+
+ <p>To establish which header cells apply to the <var title="">current cell</var> element, use the <a href=#algorithm-for-assigning-header-cells>algorithm for
+ assigning header cells</a> described in the next section.</p>
+
+ <p>If any of the slots involved already had a <a href=#concept-cell title=concept-cell>cell</a> covering them, then this is a
+ <a href=#table-model-error>table model error</a>. Those slots now have two cells
+ overlapping.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">cell grows downward</var> is true, then add
+ the tuple {<var title="">c</var>, <var title="">x<sub title="">current</sub></var>, <var title="">colspan</var>} to the
+ <var title="">list of downward-growing cells</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Increase <var title="">x<sub title="">current</sub></var> by
+ <var title="">colspan</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">current cell</var> is the last <code><a href=#the-td-element>td</a></code>
+ or <code><a href=#the-th-element>th</a></code> element in the <code><a href=#the-tr-element>tr</a></code> element being
+ processed, then increase <var title="">y<sub title="">current</sub></var> by 1, abort this set of steps, and
+ return to the algorithm above.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">current cell</var> be the next
+ <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element in the <code><a href=#the-tr-element>tr</a></code>
+ element being processed.</p>
+
+ </li>
+
+ <li>
+
+ <p>Return to the step labelled <i>cells</i>.</p>
+
+ </li>
+
+ </ol><p>When the algorithms above require the user agent to run the
+ <dfn id=algorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing cells</dfn>, the user
+ agent must, for each {<var title="">cell</var>, <var title="">cell<sub title="">x</sub></var>, <var title="">width</var>}
+ tuple in the <var title="">list of downward-growing cells</var>, if
+ any, extend the <a href=#concept-cell title=concept-cell>cell</a> <var title="">cell</var> so that it also covers the slots with
+ coordinates (<var title="">x</var>, <var title="">y<sub title="">current</sub></var>), where <span title=""><var title="">cell<sub title="">x</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">cell<sub title="">x</sub></var>+<var title="">width</var></span>.</p>
+
+
+
+
+ <h5 id=header-and-data-cell-semantics><span class=secno>4.9.12.2 </span>Forming relationships between data cells and header cells</h5>
+
+ <p>Each cell can be assigned zero or more header cells. The
+ <dfn id=algorithm-for-assigning-header-cells>algorithm for assigning header cells</dfn> to a cell <var title="">principal cell</var> is as follows.</p>
+
+ <ol><!-- INITIALIZATION --><li>
+
+ <p>Let <var title="">header list</var> be an empty list of
+ cells.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let (<var title="">principal<sub title="">x</sub></var>, <var title="">principal<sub title="">y</sub></var>) be the coordinate
+ of the slot to which the <var title="">principal cell</var> is
+ anchored.</p>
+
+ </li>
+
+ <li>
+
+ <dl class=switch><dt>If the <var title="">principal cell</var> has a <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute specified</dt>
+
+ <dd>
+
+ <!-- HEADERS="" -->
+
+ <ol><li>
+
+ <p>Take the value of the <var title="">principal cell</var>'s
+ <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute and
+ <a href=#split-a-string-on-spaces title="split a string on spaces">split it on
+ spaces</a>, letting <var title="">id list</var> be the list
+ of tokens obtained.</p>
+
+ </li>
+
+ <li>
+
+ <!-- support headers="" to <td> for legacy compat -->
+ <!-- note that it's not conforming though -->
+ <p>For each token in the <var title="">id list</var>, if the
+ first element in the <code><a href=#document>Document</a></code> with an ID equal to
+ the token is a cell in the same <a href=#concept-table title=concept-table>table</a>, and that cell is not the
+ <var title="">principal cell</var>, then add that cell to <var title="">header list</var>.</p>
+
+ </li>
+
+ </ol></dd>
+
+
+ <dt>If <var title="">principal cell</var> does not have a <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute specified</dt>
+
+ <dd>
+
+ <ol><li>
+
+ <p>Let <var title="">principal<sub title="">width</sub></var>
+ be the width of the <var title="">principal cell</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">principal<sub title="">height</sub></var>
+ be the height of the <var title="">principal cell</var>.</p>
+
+ </li>
+
+
+ <!-- HORIZONTAL -->
+
+ <li>
+
+ <p>For each value of <var title="">y</var> from <var title="">principal<sub title="">y</sub></var> to <span title=""><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span>,
+ run the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning
+ header cells</a>, with the <var title="">principal
+ cell</var>, the <var title="">header list</var>, the initial
+ coordinate (<var title="">principal<sub title="">x</sub></var>,<var title="">y</var>), and the
+ increments <span title="">&Delta;<var title="">x</var>=&minus;1</span>
+ and <span title="">&Delta;<var title="">y</var>=0</span>.</p>
+
+ </li>
+
+
+ <!-- VERTICAL -->
+
+ <li>
+
+ <p>For each value of <var title="">x</var> from <var title="">principal<sub title="">x</sub></var> to <span title=""><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span>,
+ run the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning
+ header cells</a>, with the <var title="">principal
+ cell</var>, the <var title="">header list</var>, the initial
+ coordinate (<var title="">x</var>,<var title="">principal<sub title="">y</sub></var>), and the increments <span title="">&Delta;<var title="">x</var>=0</span> and <span title="">&Delta;<var title="">y</var>=&minus;1</span>.</p>
+
+ </li>
+
+
+ <!-- ROW GROUP HEADERS -->
+
+ <li>
+
+ <p>If the <var title="">principal cell</var> is anchored in a
+ <a href=#concept-row-group title=concept-row-group>row group</a>, then add all
+ header cells that are <a href=#row-group-header title="row group header">row group
+ headers</a> and are anchored in the same row group with an
+ <var title="">x</var>-coordinate less than or equal to
+ <span title=""><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span> and
+ a <var title="">y</var>-coordinate less than or equal to
+ <span title=""><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span> to
+ <var title="">header list</var>.</p>
+
+ <!-- this might introduce principal accidentally; fixed below -->
+
+ </li>
+
+
+ <!-- COLUMN GROUP HEADERS -->
+
+ <li>
+
+ <p>If the <var title="">principal cell</var> is anchored in a
+ <a href=#concept-column-group title=concept-column-group>column group</a>, then
+ add all header cells that are <a href=#column-group-header title="column group
+ header">column group headers</a> and are anchored in the
+ same column group with an <var title="">x</var>-coordinate
+ less than or equal to <span title=""><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span> and a <var title="">y</var>-coordinate less than or equal to <span title=""><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span> to
+ <var title="">header list</var>.</p>
+
+ <!-- this might introduce principal accidentally; fixed below -->
+
+ </li>
+
+ </ol></dd>
+
+ </dl></li>
+
+
+ <!-- CLEANUP -->
+
+ <li>
+
+ <p>Remove all the <a href=#empty-cell title="empty cell">empty cells</a> from
+ the <var title="">header list</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Remove any duplicates from the <var title="">header
+ list</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Remove <var title="">principal cell</var> from the <var title="">header list</var> if it is there.</p> <!-- see "might
+ introduce principal accidentally" above -->
+
+ </li>
+
+ <li>
+
+ <p>Assign the headers in the <var title="">header list</var> to
+ the <var title="">principal cell</var>.</p>
+
+ </li>
+
+ </ol><p>The <dfn id=internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header
+ cells</dfn>, given a <var title="">principal cell</var>, a <var title="">header list</var>, an initial coordinate (<var title="">initial<sub title="">x</sub></var>, <var title="">initial<sub title="">y</sub></var>), and &Delta;<var title="">x</var> and &Delta;<var title="">y</var> increments, is as
+ follows:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">x</var> equal <var title="">initial<sub title="">x</sub></var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">y</var> equal <var title="">initial<sub title="">y</sub></var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">opaque headers</var> be an empty list of
+ cells.</p>
+
+ </li>
+
+ <li>
+
+ <dl class=switch><dt>If <var title="">principal cell</var> is a header cell</dt>
+
+ <dd><p>Let <var title="">in header block</var> be true, and let
+ <var title="">headers from current header block</var> be a list
+ of cells containing just the <var title="">principal
+ cell</var>.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>Let <var title="">in header block</var> be false and let
+ <var title="">headers from current header block</var> be an
+ empty list of cells.</p>
+
+ </dl></li>
+
+ <li>
+
+ <p><i>Loop</i>: Increment <var title="">x</var> by &Delta;<var title="">x</var>; increment <var title="">y</var> by &Delta;<var title="">y</var>.</p>
+
+ <p class=note>For each invocation of this algorithm, one of
+ &Delta;<var title="">x</var> and &Delta;<var title="">y</var> will
+ be &minus;1, and the other will be 0.</p>
+
+ </li>
+
+ <li>
+
+ <p>If either <var title="">x</var> or <var title="">y</var> is
+ less than 0, then abort this internal algorithm.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is no cell covering slot (<var title="">x</var>,
+ <var title="">y</var>), or if there is more than one cell
+ covering slot (<var title="">x</var>, <var title="">y</var>),
+ return to the substep labeled <i>loop</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">current cell</var> be the cell covering
+ slot (<var title="">x</var>, <var title="">y</var>).</p>
+
+ </li>
+
+ <li>
+
+ <dl class=switch><dt>If <var title="">current cell</var> is a header cell</dt>
+
+ <dd>
+
+ <ol><li><p>Set <var title="">in header block</var> to
+ true.</li>
+
+ <li><p>Add <var title="">current cell</var> to <var title="">headers from current header block</var>.</li>
+
+ <li><p>Let <var title="">blocked</var> be false.</li>
+
+ <li>
+
+ <dl class=switch><dt>If &Delta;<var title="">x</var> is 0</dt>
+
+ <dd>
+
+ <p>If there are any cells in the <var title="">opaque
+ headers</var> list anchored with the same <var title="">x</var>-coordinate as the <var title="">current
+ cell</var>, and with the same width as <var title="">current
+ cell</var>, then let <var title="">blocked</var> be
+ true.</p>
+
+ <p>If the <var title="">current cell</var> is not a
+ <a href=#column-header>column header</a>, then let <var title="">blocked</var> be true.</p>
+
+ </dd>
+
+ <dt>If &Delta;<var title="">y</var> is 0</dt>
+
+ <dd>
+
+ <p>If there are any cells in the <var title="">opaque
+ headers</var> list anchored with the same <var title="">y</var>-coordinate as the <var title="">current
+ cell</var>, and with the same height as <var title="">current cell</var>, then let <var title="">blocked</var> be true.</p>
+
+ <p>If the <var title="">current cell</var> is not a
+ <a href=#row-header>row header</a>, then let <var title="">blocked</var> be true.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li><p>If <var title="">blocked</var> is false, then add the
+ <var title="">current cell</var> to the <var title="">headers
+ list</var>.</li>
+
+ </ol></dd>
+
+ <dt>If <var title="">current cell</var> is a data cell and <var title="">in header block</var> is true</dt>
+
+ <dd><p>Set <var title="">in header block</var> to false. Add
+ all the cells in <var title="">headers from current header
+ block</var> to the <var title="">opaque headers</var> list, and
+ empty the <var title="">headers from current header block</var>
+ list.</p>
+
+ </dl></li>
+
+ <li>
+
+ <p>Return to the step labeled <i>loop</i>.</p>
+
+ </li>
+
+ </ol><p>A header cell anchored at the slot with coordinate (<var title="">x</var>, <var title="">y</var>) with width <var title="">width</var> and height <var title="">height</var> is said
+ to be a <dfn id=column-header>column header</dfn> if any of the following conditions
+ are true:</p>
+
+ <ul><li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-col title=attr-th-scope-col>column</a> state, or</li>
+
+ <li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-auto title=attr-th-scope-auto>auto</a> state, and
+ there are no data cells in any of the cells covering slots with
+ <var title="">y</var>-coordinates <var title="">y</var>
+ .. <span title=""><var title="">y</var>+<var title="">height</var>-1</span>.</li>
+
+ </ul><p>A header cell anchored at the slot with coordinate (<var title="">x</var>, <var title="">y</var>) with width <var title="">width</var> and height <var title="">height</var> is said
+ to be a <dfn id=row-header>row header</dfn> if any of the following conditions
+ are true:</p>
+
+ <ul><li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-row title=attr-th-scope-row>row</a> state, or</li>
+
+ <li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-auto title=attr-th-scope-auto>auto</a> state, the
+ cell is not a <a href=#column-header>column header</a>, and there are no data
+ cells in any of the cells covering slots with <var title="">x</var>-coordinates <var title="">x</var> .. <span title=""><var title="">x</var>+<var title="">width</var>-1</span>.</li>
+
+ </ul><p>A header cell is said to be a <dfn id=column-group-header>column group header</dfn> if
+ its <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the
+ <a href=#attr-th-scope-colgroup title=attr-th-scope-colgroup>column group</a> state.</p>
+
+ <p>A header cell is said to be a <dfn id=row-group-header>row group header</dfn> if
+ its <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the
+ <a href=#attr-th-scope-rowgroup title=attr-th-scope-rowgroup>row group</a> state.</p>
+
+ <p>A cell is said to be an <dfn id=empty-cell>empty cell</dfn> if it contains no
+ elements and its text content, if any, consists only of
+ <a href=#white_space>White_Space</a> characters.</p>
+
+ </div>
+
+
+ <h4 id=examples-0><span class=secno>4.9.13 </span>Examples</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The following shows how might one mark up the bottom part of
+ table 45 of the <cite>Smithsonian physical tables, Volume
+ 71</cite>:</p>
+
+ <!-- Smithsonian physical tables, Volume 71: By Smithsonian Institution, Frederick Eugene Fowle; page 76 -->
+ <!-- from the reprint of the seventh revised edition; publication 2539, published 1921 -->
+ <pre>&lt;table&gt;
+ &lt;caption&gt;Specification values: &lt;b&gt;Steel&lt;/b&gt;, &lt;b&gt;Castings&lt;/b&gt;,
+ Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.&lt;/caption&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th rowspan=2&gt;Grade.&lt;/th&gt;
+ &lt;th rowspan=2&gt;Yield Point.&lt;/th&gt;
+ &lt;th colspan=2&gt;Ultimate tensile strength&lt;/th&gt;
+ &lt;th rowspan=2&gt;Per cent elong. 50.8mm or 2 in.&lt;/th&gt;
+ &lt;th rowspan=2&gt;Per cent reduct. area.&lt;/th&gt;
+ &lt;/tr&gt;
+ &lt;tr&gt;
+ &lt;th&gt;kg/mm&lt;sup&gt;2&lt;/sup&gt;&lt;/th&gt;
+ &lt;th&gt;lb/in&lt;sup&gt;2&lt;/sup&gt;&lt;/th&gt;
+ &lt;/tr&gt;
+ &lt;/thead&gt;
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;td&gt;Hard&lt;/td&gt;
+ &lt;td&gt;0.45 ultimate&lt;/td&gt;
+ &lt;td&gt;56.2&lt;/td&gt;
+ &lt;td&gt;80,000&lt;/td&gt;
+ &lt;td&gt;15&lt;/td&gt;
+ &lt;td&gt;20&lt;/td&gt;
+ &lt;/tr&gt;
+ &lt;tr&gt;
+ &lt;td&gt;Medium&lt;/td&gt;
+ &lt;td&gt;0.45 ultimate&lt;/td&gt;
+ &lt;td&gt;49.2&lt;/td&gt;
+ &lt;td&gt;70,000&lt;/td&gt;
+ &lt;td&gt;18&lt;/td&gt;
+ &lt;td&gt;25&lt;/td&gt;
+ &lt;/tr&gt;
+ &lt;tr&gt;
+ &lt;td&gt;Soft&lt;/td&gt;
+ &lt;td&gt;0.45 ultimate&lt;/td&gt;
+ &lt;td&gt;42.2&lt;/td&gt;
+ &lt;td&gt;60,000&lt;/td&gt;
+ &lt;td&gt;22&lt;/td&gt;
+ &lt;td&gt;30&lt;/td&gt;
+ &lt;/tr&gt;
+ &lt;/tbody&gt;
+&lt;/table&gt;</pre>
+
+ <p>This table could look like this:</p>
+
+ <table id=table-example-1><caption>Specification values: <b>Steel</b>, <b>Castings</b>,
+ Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.</caption>
+ <thead><tr><th rowspan=2>Grade.</th>
+ <th rowspan=2>Yield Point.</th>
+ <th colspan=2>Ultimate tensile strength</th>
+ <th rowspan=2>Per cent elong. 50.8&nbsp;mm or&nbsp;2&nbsp;in.</th>
+ <th rowspan=2>Per cent reduct. area.</th>
+ <tr><th>kg/mm<sup>2</sup></th>
+ <th>lb/in<sup>2</sup></th>
+ <tbody><tr><td>Hard</td>
+ <td>0.45 ultimate</td>
+ <td>56.2</td>
+ <td>80,000</td>
+ <td>15</td>
+ <td>20</td>
+ <tr><td>Medium</td>
+ <td>0.45 ultimate</td>
+ <td>49.2</td>
+ <td>70,000</td>
+ <td>18</td>
+ <td>25</td>
+ <tr><td>Soft</td>
+ <td>0.45 ultimate</td>
+ <td>42.2</td>
+ <td>60,000</td>
+ <td>22</td>
+ <td>30</td>
+ </table><hr><p>The following shows how one might mark up the gross margin table
+ on page 46 of Apple, Inc's 10-K filing for fiscal year 2008:</p>
+
+ <pre>&lt;table&gt;
+ &lt;thead&gt;
+ &lt;tr&gt;
+ &lt;th&gt;
+ &lt;th&gt;2008
+ &lt;th&gt;2007
+ &lt;th&gt;2006
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;th&gt;Net sales
+ &lt;td&gt;$ 32,479
+ &lt;td&gt;$ 24,006
+ &lt;td&gt;$ 19,315
+ &lt;tr&gt;
+ &lt;th&gt;Cost of sales
+ &lt;td&gt; 21,334
+ &lt;td&gt; 15,852
+ &lt;td&gt; 13,717
+ &lt;tbody&gt;
+ &lt;tr&gt;
+ &lt;th&gt;Gross margin
+ &lt;td&gt;$ 11,145
+ &lt;td&gt;$ 8,154
+ &lt;td&gt;$ 5,598
+ &lt;tfoot&gt;
+ &lt;tr&gt;
+ &lt;th&gt;Gross margin percentage
+ &lt;td&gt;34.3%
+ &lt;td&gt;34.0%
+ &lt;td&gt;29.0%
+&lt;/table&gt;</pre>
+
+<!--HTML4POLICE-->
+ <p>This table could look like this:</p>
+
+ <table class="apple-table-examples e1"><thead><tr><th>
+ <th>2008
+ <th>2007
+ <th>2006
+ <tbody><tr><th>Net sales
+ <td>$ 32,479
+ <td>$ 24,006
+ <td>$ 19,315
+ <tr><th>Cost of sales
+ <td> 21,334
+ <td> 15,852
+ <td> 13,717
+ <tbody><tr><th>Gross margin
+ <td>$ 11,145
+ <td>$ 8,154
+ <td>$ 5,598
+ <tfoot><tr><th>Gross margin percentage
+ <td>34.3%
+ <td>34.0%
+ <td>29.0%
+ </table><hr><p>The following shows how one might mark up the operating expenses
+ table from lower on the same page of that document:</p>
+
+ <pre>&lt;table&gt;
+ &lt;colgroup&gt; &lt;col&gt;
+ &lt;colgroup&gt; &lt;col&gt; &lt;col&gt; &lt;col&gt;
+ &lt;thead&gt;
+ &lt;tr&gt; &lt;th&gt; &lt;th&gt;2008 &lt;th&gt;2007 &lt;th&gt;2006
+ &lt;tbody&gt;
+ &lt;tr&gt; &lt;th scope=rowgroup&gt; Research and development
+ &lt;td&gt; $ 1,109 &lt;td&gt; $ 782 &lt;td&gt; $ 712
+ &lt;tr&gt; &lt;th scope=row&gt; Percentage of net sales
+ &lt;td&gt; 3.4% &lt;td&gt; 3.3% &lt;td&gt; 3.7%
+ &lt;tbody&gt;
+ &lt;tr&gt; &lt;th scope=rowgroup&gt; Selling, general, and administrative
+ &lt;td&gt; $ 3,761 &lt;td&gt; $ 2,963 &lt;td&gt; $ 2,433
+ &lt;tr&gt; &lt;th scope=row&gt; Percentage of net sales
+ &lt;td&gt; 11.6% &lt;td&gt; 12.3% &lt;td&gt; 12.6%
+&lt;/table&gt;</pre>
+
+ <p>This table could look like this:</p>
+
+ <table class="apple-table-examples e2"><thead><tr><th> <th>2008 <th>2007 <th>2006
+ <tbody><tr><th scope=rowgroup> Research and development
+ <td> $ 1,109 <td> $ 782 <td> $ 712
+ <tr><th scope=row> Percentage of net sales
+ <td> 3.4% <td> 3.3% <td> 3.7%
+ <tbody><tr><th scope=rowgroup> Selling, general, and administrative
+ <td> $ 3,761 <td> $ 2,963 <td> $ 2,433
+ <tr><th scope=row> Percentage of net sales
+ <td> 11.6% <td> 12.3% <td> 12.6%
+ </table><h3 id=forms><span class=secno>4.10 </span>Forms</h3>
+
+ <h4 id=introduction-0><span class=secno>4.10.1 </span>Introduction</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Forms allow unscripted client-server interaction: given a form, a
+ user can provide data, submit it to the server, and have the server
+ act on it accordingly (e.g. returning the results of a search or
+ calculation). The elements used in forms can also be used for user
+ interaction with no associated submission mechanism, in conjunction
+ with scripts.</p>
+
+ <p>Writing a form consists of several steps, which can be performed
+ in any order: writing the user interface, implementing the
+ server-side processing, and configuring the user interface to
+ communicate with the server.</p>
+
+
+ <h5 id="writing-a-form's-user-interface"><span class=secno>4.10.1.1 </span>Writing a form's user interface</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>For the purposes of this brief introduction, we will create a
+ pizza ordering form.</p>
+
+ <p>Any form starts with a <code><a href=#the-form-element>form</a></code> element, inside which
+ are placed the controls. Most controls are represented by the
+ <code><a href=#the-input-element>input</a></code> element, which by default provides a one-line
+ text field. To label a control, the <code><a href=#the-label-element>label</a></code> element is
+ used; the label text and the control itself go inside the
+ <code><a href=#the-label-element>label</a></code> element. Each part of a form is considered a
+ <a href=#paragraph>paragraph</a>, and is typically separated from other parts
+ using <code><a href=#the-p-element>p</a></code> elements. Putting this together, here is how
+ one might ask for the customer's name:</p>
+
+ <pre><strong>&lt;form&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;/form&gt;</strong></pre>
+
+ <p>To let the user select the size of the pizza, we can use a set of
+ radio buttons. Radio buttons also use the <code><a href=#the-input-element>input</a></code>
+ element, this time with a <code title=attr-input-type><a href=#attr-input-type>type</a></code>
+ attribute with the value <code title=attr-input-type-radio><a href=#radio-button-state>radio</a></code>. To make the radio
+ buttons work as a group, they are given a common name using the
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute. To group a batch
+ of controls together, such as, in this case, the radio buttons, one
+ can use the <code><a href=#the-fieldset-element>fieldset</a></code> element. The title of such a group
+ of controls is given by the first element in the
+ <code><a href=#the-fieldset-element>fieldset</a></code>, which has to be a <code><a href=#the-legend-element>legend</a></code>
+ element.</p>
+
+ <pre>&lt;form&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
+<strong> &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;</strong>
+&lt;/form&gt;</pre>
+
+ <p class=note>Changes from the previous step are highlighted.</p>
+
+ <p>To pick toppings, we can use checkboxes. These use the
+ <code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute with the value <code title=attr-input-type-checkbox><a href=#checkbox-state>checkbox</a></code>:</p>
+
+ <pre>&lt;form&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+<strong> &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;</strong>
+&lt;/form&gt;</pre>
+
+ <p>The pizzeria for which this form is being written is always
+ making mistakes, so it needs a way to contact the customer. For this
+ purpose, we can use form controls specifically for telephone numbers
+ (<code><a href=#the-input-element>input</a></code> elements with their <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute set to <code title=attr-input-type-tel><a href=#telephone-state>tel</a></code>) and e-mail addresses
+ (<code><a href=#the-input-element>input</a></code> elements with their <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute set to <code title=attr-input-type-email><a href=#e-mail-state>email</a></code>):</p>
+
+ <pre>&lt;form&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
+<strong> &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;</strong>
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+&lt;/form&gt;</pre>
+
+ <p>We can use an <code><a href=#the-input-element>input</a></code> element with its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute set to <code title=attr-input-type-time><a href=#time-state>time</a></code> to ask for a delivery
+ time. Many of these form controls have attributes to control exactly
+ what values can be specified; in this case, three attributes of
+ particular interest are <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>, and <code title=attr-input-step><a href=#attr-input-step>step</a></code>. These set the minimum time, the
+ maximum time, and the interval between allowed values (in
+ seconds). This pizzeria only delivers between 11am and 9pm, and
+ doesn't promise anything better than 15 minute increments, which we
+ can mark up as follows:</p>
+
+ <pre>&lt;form&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+<strong> &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"&gt;&lt;/label&gt;&lt;/p&gt;</strong>
+&lt;/form&gt;</pre>
+
+ <p>The <code><a href=#the-textarea-element>textarea</a></code> element can be used to provide a
+ free-form text field. In this instance, we are going to use it to
+ provide a space for the customer to give delivery instructions:</p>
+
+ <pre>&lt;form&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"&gt;&lt;/label&gt;&lt;/p&gt;
+<strong> &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;</strong>
+&lt;/form&gt;</pre>
+
+ <p>Finally, to make the form submittable we use the
+ <code><a href=#the-button-element>button</a></code> element:</p>
+
+ <pre>&lt;form&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
+<strong> &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;p&gt;</strong>
+&lt;/form&gt;</pre>
+
+
+ <h5 id=implementing-the-server-side-processing-for-a-form><span class=secno>4.10.1.2 </span>Implementing the server-side processing for a form</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The exact details for writing a server-side processor are out of
+ scope for this specification. For the purposes of this introduction,
+ we will assume that the script at <code title="">https://pizza.example.com/order.cgi</code> is configured to
+ accept submissions using the <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>
+ format, expecting the following parameters sent in an HTTP POST
+ body:</p>
+
+ <dl><dt><code title="">custname</code></dt>
+ <dd>Customer's name</dd>
+
+ <dt><code title="">custtel</code></dt>
+ <dd>Customer's telephone number</dd>
+
+ <dt><code title="">custemail</code></dt>
+ <dd>Customer's e-mail address</dd>
+
+ <dt><code title="">size</code></dt>
+ <dd>The pizza size, either <code title="">small</code>, <code title="">medium</code>, or <code title="">large</code></dd>
+
+ <dt><code title="">toppings</code></dt>
+ <dd>The topping, specified once for each selected topping, with the allowed values being <code title="">bacon</code>, <code title="">cheese</code>, <code title="">onion</code>, and <code title="">mushroom</code></dd>
+
+ <dt><code title="">delivery</code></dt>
+ <dd>The requested delivery time</dd>
+
+ <dt><code title="">comments</code></dt>
+ <dd>The delivery instructions</dd>
+
+ </dl><h5 id=configuring-a-form-to-communicate-with-a-server><span class=secno>4.10.1.3 </span>Configuring a form to communicate with a server</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Form submissions are exposed to servers in a variety of ways,
+ most commonly as HTTP GET or POST requests. To specify the exact
+ method used, the <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>
+ attribute is specified on the <code><a href=#the-form-element>form</a></code> element. This
+ doesn't specify how the form data is encoded, though; to specify
+ that, you use the <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>
+ attribute. You also have to specify the <a href=#url>URL</a> of the
+ service that will handle the submitted data, using the <code title=attr-fs-action><a href=#attr-fs-action>action</a></code> attribute.</p>
+
+ <p>For each form control you want submitted, you then have to give a
+ name that will be used to refer to the data in the submission. We
+ already specified the name for the group of radio buttons; the same
+ attribute (<code title=attr-fe-name><a href=#attr-fe-name>name</a></code>) also specifies
+ the submission name. Radio buttons can be distinguished from each
+ other in the submission by giving them different values, using the
+ <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute.</p>
+
+ <p>Multiple controls can have the same name; for example, here we
+ give all the checkboxes the same name, and the server distinguishes
+ which checkbox was checked by seeing which values are submitted with
+ that name &mdash; like the radio buttons, they are also given unique
+ values with the <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+ attribute.</p>
+
+ <p>Given the settings in the previous section, this all becomes:</p>
+
+ <pre>&lt;form<strong> method="post"
+ enctype="application/x-www-form-urlencoded"
+ action="https://pizza.example.com/order.cgi"</strong>&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input<strong> name="custname"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel<strong> name="custtel"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email<strong> name="custemail"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> value="small"</strong>&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> value="medium"</strong>&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> value="large"</strong>&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="bacon"</strong>&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="cheese"</strong>&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="onion"</strong>&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="mushroom"</strong>&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"<strong> name="delivery"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea<strong> name="comments"</strong>&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;p&gt;
+&lt;/form&gt;</pre>
+
+ <p>For example, if the customer entered "Denise Lawrence" as their
+ name, "555-321-8642" as their telephone number, did not specify an
+ e-mail address, asked for a medium-sized pizza, selected the Extra
+ Cheese and Mushroom toppings, entered a delivery time of 7pm, and
+ left the delivery instructions text field blank, the user agent
+ would submit the following to the online Web service:</p>
+
+ <pre>custname=Denise+Lawrence&amp;custtel=555-321-8624&amp;custemail=&amp;size=medium&amp;topping=cheese&amp;topping=mushroom&amp;delivery=19%3A00&amp;comments=</pre>
+
+
+
+ <h5 id=client-side-form-validation><span class=secno>4.10.1.4 </span>Client-side form validation</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Forms can be annotated in such a way that the user agent will
+ check the user's input before the form is submitted. The server
+ still has to verify the input is valid (since hostile users can
+ easily bypass the form validation), but it allows the user to avoid
+ the wait incurred by having the server be the sole checker of the
+ user's input.</p>
+
+ <p>The simplest annotation is the <code title=attr-input-required><a href=#attr-input-required>required</a></code> attribute, which can be
+ specified on <code><a href=#the-input-element>input</a></code> elements to indicate that the form
+ is not to be submitted until a value is given. By adding this
+ attribute to the customer name and delivery time fields, we allow
+ the user agent to notify the user when the user submits the form
+ without filling in those fields:</p>
+
+ <pre>&lt;form method="post"
+ enctype="application/x-www-form-urlencoded"
+ action="https://pizza.example.com/order.cgi"&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input name="custname"<strong> required</strong>&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel name="custtel"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email name="custemail"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size value="small"&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size value="medium"&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size value="large"&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="bacon"&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="cheese"&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="onion"&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="mushroom"&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery"<strong> required</strong>&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea name="comments"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;p&gt;
+&lt;/form&gt;</pre>
+
+ <p>It is also possible to limit the length of the input, using the
+ <code title=attr-fe-maxlength><a href=#attr-fe-maxlength>maxlength</a></code> attribute. By
+ adding this to the <code><a href=#the-textarea-element>textarea</a></code> element, we can limit users
+ to 1000 characters, preventing them from writing huge essays to the
+ busy delivery drivers instead of staying focused and to the
+ point:</p>
+
+ <pre>&lt;form method="post"
+ enctype="application/x-www-form-urlencoded"
+ action="https://pizza.example.com/order.cgi"&gt;
+ &lt;p&gt;&lt;label&gt;Customer name: &lt;input name="custname" required&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel name="custtel"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email name="custemail"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Size &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size value="small"&gt; Small &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size value="medium"&gt; Medium &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size value="large"&gt; Large &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;fieldset&gt;
+ &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="bacon"&gt; Bacon &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="cheese"&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="onion"&gt; Onion &lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="mushroom"&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
+ &lt;/fieldset&gt;
+ &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery" required&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea name="comments"<strong> maxlength=1000</strong>&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;p&gt;
+&lt;/form&gt;</pre>
+
+
+
+
+ <h4 id=categories><span class=secno>4.10.2 </span>Categories</h4>
+
+ <p>Mostly for historical reasons, elements in this section fall into
+ several overlapping (but subtly different) categories in addition to
+ the usual ones like <a href=#flow-content>flow content</a>, <a href=#phrasing-content>phrasing
+ content</a>, and <a href=#interactive-content>interactive content</a>.</p>
+
+ <p>A number of the elements are <dfn id=form-associated-element title="form-associated
+ element">form-associated elements</dfn>, which means they can have a
+ <a href=#form-owner>form owner</a> and, to expose this, have a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> content attribute with a matching
+ <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
+ <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
+ <li><code><a href=#the-input-element>input</a></code></li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-label-element>label</a></code></li>
+ <li><code><a href=#the-meter-element>meter</a></code></li>
+ <li><code><a href=#the-object-element>object</a></code></li>
+ <li><code><a href=#the-output-element>output</a></code></li>
+ <li><code><a href=#the-progress-element>progress</a></code></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ </ul><p>The <a href=#form-associated-element title="form-associated element">form-associated
+ elements</a> fall into several subcategories:</p>
+
+ <dl><dt><dfn id=category-listed title=category-listed>Listed elements</dfn></dt>
+
+ <dd>
+
+ <p>Denotes elements that are listed in the <code title=dom-form-elements><a href=#dom-form-elements><var title="">form</var>.elements</a></code>
+ and <code title=dom-fieldset-elements><a href=#dom-fieldset-elements><var title="">fieldset</var>.elements</a></code> APIs.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
+ <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
+ <li><code><a href=#the-input-element>input</a></code></li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-object-element>object</a></code></li>
+ <li><code><a href=#the-output-element>output</a></code></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ </ul></dd>
+
+ <dt><dfn id=category-label title=category-label>Labelable elements</dfn></dt>
+
+ <dd>
+
+ <p>Denotes elements that can be associated with <code><a href=#the-label-element>label</a></code>
+ elements.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
+ <li><code><a href=#the-input-element>input</a></code></li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-meter-element>meter</a></code></li>
+ <li><code><a href=#the-output-element>output</a></code></li>
+ <li><code><a href=#the-progress-element>progress</a></code></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ </ul></dd>
+
+ <dt><dfn id=category-submit title=category-submit>Submittable elements</dfn></dt>
+
+ <dd>
+
+ <p>Denotes elements that can be used for <a href=#constructing-form-data-set>constructing the form data
+ set</a> when a <code><a href=#the-form-element>form</a></code> element is <a href=#concept-form-submit title=concept-form-submit>submitted</a>.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
+ <li><code><a href=#the-input-element>input</a></code></li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-object-element>object</a></code></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ </ul></dd>
+
+ <dt><dfn id=category-reset title=category-reset>Resettable elements</dfn></dt>
+
+ <dd>
+
+ <p>Denotes elements that can be affected when a <code><a href=#the-form-element>form</a></code>
+ element is <a href=#concept-form-reset title=concept-form-reset>reset</a>.</p>
+
+ <!-- when updating this also update the category index -->
+ <ul class="brief category-list"><li><code><a href=#the-input-element>input</a></code></li>
+ <li><code><a href=#the-keygen-element>keygen</a></code></li>
+ <li><code><a href=#the-output-element>output</a></code></li>
+ <li><code><a href=#the-select-element>select</a></code></li>
+ <li><code><a href=#the-textarea-element>textarea</a></code></li>
+ </ul></dd>
+
+ </dl><p>In addition, some <a href=#category-submit title=category-submit>submittable
+ elements</a> can be, depending on their attributes, <dfn id=concept-button title=concept-button>buttons</dfn>. The prose below defines when
+ an element is a button. Some buttons are specifically <dfn id=concept-submit-button title=concept-submit-button>submit buttons</dfn>.</p>
+
+ <p class=note>The <code><a href=#the-object-element>object</a></code> element is also a
+ <a href=#form-associated-element>form-associated element</a> and can, with the use of a
+ suitable <a href=#plugin>plugin</a>, partake in <a href=#form-submission>form
+ submission</a>.</p>
+
+
+ <h4 id=the-form-element><span class=secno>4.10.3 </span>The <dfn><code>form</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-form-element>form</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code></dd>
+ <dd><code title=attr-fs-action><a href=#attr-fs-action>action</a></code></dd>
+ <dd><code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code></dd>
+ <dd><code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code></dd>
+ <dd><code title=attr-fs-method><a href=#attr-fs-method>method</a></code></dd>
+ <dd><code title=attr-form-name><a href=#attr-form-name>name</a></code></dd>
+ <dd><code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code></dd>
+ <dd><code title=attr-fs-target><a href=#attr-fs-target>target</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>[OverrideBuiltins]
+interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-form-acceptcharset title=dom-form-acceptCharset>acceptCharset</a>;
+ attribute DOMString <a href=#dom-fs-action title=dom-fs-action>action</a>;
+ attribute DOMString <a href=#dom-form-autocomplete title=dom-form-autocomplete>autocomplete</a>;
+ attribute DOMString <a href=#dom-fs-enctype title=dom-fs-enctype>enctype</a>;
+ attribute DOMString <a href=#dom-fs-method title=dom-fs-method>method</a>;
+ attribute DOMString <a href=#dom-form-name title=dom-form-name>name</a>;
+ attribute boolean <a href=#dom-fs-novalidate title=dom-fs-noValidate>noValidate</a>;
+ attribute DOMString <a href=#dom-fs-target title=dom-fs-target>target</a>;
+
+ readonly attribute <a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a> <a href=#dom-form-elements title=dom-form-elements>elements</a>;
+ readonly attribute long <a href=#dom-form-length title=dom-form-length>length</a>;
+ caller getter any <a href=#dom-form-item title=dom-form-item>item</a>(in unsigned long index);
+ caller getter any <a href=#dom-form-nameditem title=dom-form-namedItem>namedItem</a>(in DOMString name);
+
+ void <a href=#dom-form-submit title=dom-form-submit>submit</a>();
+ void <a href=#dom-form-reset title=dom-form-reset>reset</a>();
+ boolean <a href=#dom-form-checkvalidity title=dom-form-checkValidity>checkValidity</a>();
+
+ void <a href=#dom-form-dispatchforminput title=dom-form-dispatchFormInput>dispatchFormInput</a>();
+ void <a href=#dom-form-dispatchformchange title=dom-form-dispatchFormChange>dispatchFormChange</a>();
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-form-element>form</a></code> element <a href=#represents>represents</a> a
+ collection of <a href=#form-associated-element title="form-associated element">form-associated
+ elements</a>, some of which can represent editable values that
+ can be submitted to a server for processing.</p>
+
+ <p>The <dfn id=attr-form-accept-charset title=attr-form-accept-charset><code>accept-charset</code></dfn>
+ attribute gives the character encodings that are to be used for the
+ submission. If specified, the value must be an <a href=#ordered-set-of-unique-space-separated-tokens>ordered set of
+ unique space-separated tokens</a>, and each token must be an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the <a href=#preferred-mime-name>preferred
+ MIME name</a> of an <a href=#ascii-compatible-character-encoding>ASCII-compatible character
+ encoding</a>. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>
+
+ <p>The <dfn id=attr-form-name title=attr-form-name><code>name</code></dfn> attribute
+ represents the <code><a href=#the-form-element>form</a></code>'s name within the <code title=dom-document-forms><a href=#dom-document-forms>forms</a></code> collection. The value must
+ not be the empty string, and the value must be unique amongst the
+ <code><a href=#the-form-element>form</a></code> elements in the <code title=dom-document-forms><a href=#dom-document-forms>forms</a></code> collection that it is in, if
+ any.</p>
+
+ <p>The <dfn id=attr-form-autocomplete title=attr-form-autocomplete><code>autocomplete</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The attribute has
+ two states. The <code title=attr-form-autocomplete-on>on</code>
+ keyword maps to the <dfn id=attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</dfn> state, and the
+ <code title=attr-form-autocomplete-off>off</code> keyword maps to
+ the <dfn id=attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</dfn>
+ state. The attribute may also be omitted. The <i>missing value
+ default</i> is the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state. The <a href=#attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</a> state indicates
+ that by default, <code><a href=#the-input-element>input</a></code> elements in the form will have
+ their <a href=#resulting-autocompletion-state>resulting autocompletion state</a> set to <i title="">off</i>; the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state indicates
+ that by default, <code><a href=#the-input-element>input</a></code> elements in the form will have
+ their <a href=#resulting-autocompletion-state>resulting autocompletion state</a> set to <i title="">on</i>.</p>
+
+ <p>The <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>, <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>, <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>, <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>, and <code title=attr-fs-target><a href=#attr-fs-target>target</a></code> attributes are <a href=#attributes-for-form-submission>attributes
+ for form submission</a>.</p>
+
+ <dl class=domintro><dt><var title="">form</var> . <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code></dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the form controls in
+ the form (excluding image buttons for historical reasons).</p>
+
+ </dd>
+
+ <dt><var title="">form</var> . <code title=dom-form-length><a href=#dom-form-length>length</a></code></dt>
+
+ <dd>
+
+ <p>Returns the number of form controls in the form (excluding
+ image buttons for historical reasons).</p>
+
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">form</var> . <code title=dom-form-item><a href=#dom-form-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">form</var>[<var title="">index</var>]</dt>
+ <dt><var title="">form</var>(<var title="">index</var>)</dt>
+
+ <dd>
+
+ <p>Returns the <var title="">index</var>th element in the form
+ (excluding image buttons for historical reasons).</p>
+
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">form</var> . <code title=dom-form-namedItem><a href=#dom-form-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">form</var>[<var title="">name</var>]</dt>
+ <dt><var title="">form</var>(<var title="">name</var>)</dt>
+
+ <dd>
+
+ <p>Returns the form control in the form with the given ID or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> (excluding image buttons for
+ historical reasons).</p>
+
+ <p>Once an element has been referenced using a particular name,
+ that name will continue being available as a way to reference that
+ element in this method, even if the element's actual ID or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> changes, for as long as the
+ element remains in the <code><a href=#document>Document</a></code>.</p>
+
+ <p>If there are multiple matching items, then a
+ <code><a href=#nodelist>NodeList</a></code> object containing all those elements is
+ returned.</p>
+
+ <p>Returns null if no element with that <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> could be found.</p>
+
+ </dd>
+
+ <dt><var title="">form</var> . <code title=dom-form-submit><a href=#dom-form-submit>submit</a></code>()</dt>
+
+ <dd>
+
+ <p>Submits the form.</p>
+
+ </dd>
+
+ <dt><var title="">form</var> . <code title=dom-form-reset><a href=#dom-form-reset>reset</a></code>()</dt>
+
+ <dd>
+
+ <p>Resets the form.</p>
+
+ </dd>
+
+ <dt><var title="">form</var> . <code title=dom-form-checkValidity><a href=#dom-form-checkvalidity>checkValidity</a></code>()</dt>
+
+ <dd>
+
+ <p>Returns true if the form's controls are all valid; otherwise,
+ returns false.</p>
+
+ </dd>
+
+ <dt><var title="">form</var> . <code title=dom-form-dispatchFormInput><a href=#dom-form-dispatchforminput>dispatchFormInput</a></code>()</dt>
+
+ <dd>
+
+ <p>Dispatches a <code title=event-forminput>forminput</code> event at all the form controls.</p>
+
+ </dd>
+
+ <dt><var title="">form</var> . <code title=dom-form-dispatchFormChange><a href=#dom-form-dispatchformchange>dispatchFormChange</a></code>()</dt>
+
+ <dd>
+
+ <p>Dispatches a <code title=event-formchange>formchange</code> event at all the form controls.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-form-autocomplete title=dom-form-autocomplete><code>autocomplete</code></dfn> and
+ <dfn id=dom-form-name title=dom-form-name><code>name</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name.</p>
+
+ <p>The <dfn id=dom-form-acceptcharset title=dom-form-acceptCharset><code>acceptCharset</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> content
+ attribute.</p>
+
+ <hr><p>The <dfn id=dom-form-elements title=dom-form-elements><code>elements</code></dfn>
+ IDL attribute must return an <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code>
+ rooted at the <code><a href=#document>Document</a></code> node, whose filter matches <a href=#category-listed title=category-listed>listed elements</a> whose <a href=#form-owner>form
+ owner</a> is the <code><a href=#the-form-element>form</a></code> element, with the exception of
+ <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, which must,
+ for historical reasons, be excluded from this particular
+ collection.</p>
+
+ <p>The <dfn id=dom-form-length title=dom-form-length><code>length</code></dfn> IDL
+ attribute must return the number of nodes <a href=#represented-by-the-collection title="represented
+ by the collection">represented</a> by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> collection.</p>
+
+ <p>The
+ <span>indices of the supported indexed properties</span> at any
+ instant are the indices supported by the object returned by the
+ <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute at that
+ instant.</p>
+
+ <p>The <dfn id=dom-form-item title=dom-form-item><code>item(<var title="">index</var>)</code></dfn> method must return the value
+ returned by the method of the same name on the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> collection, when invoked
+ with the same argument.</p>
+
+ <p>Each <code><a href=#the-form-element>form</a></code> element has a mapping of names to elements
+ called the <dfn id=past-names-map>past names map</dfn>. It is used to persist names of
+ controls even when they change names.</p>
+
+ <p>The <span>names of the supported named properties</span> are the
+ union of the names currently supported by the object returned by the
+ <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute, and the
+ names currently in the <a href=#past-names-map>past names map</a>.</p>
+
+ <p>The <dfn id=dom-form-nameditem title=dom-form-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method, when called, must run the
+ following steps:</p>
+
+ <ol><li>
+
+ <p>If <var title="">name</var> is one of the <span>names of the
+ supported named properties</span> of the object returned by the
+ <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute, then
+ run these substeps:</p>
+
+ <ol><li><p>Let <var title="">candidate</var> be the object returned
+ by the <code title=dom-HTMLFormControlsCollection-namedItem><a href=#dom-htmlformcontrolscollection-nameditem>namedItem()</a></code>
+ method on the object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute when passed
+ the <var title="">name</var> argument.</li>
+
+ <li><p>If <var title="">candidate</var> is an element, then add a
+ mapping from <var title="">name</var> to <var title="">candidate</var> in the <code><a href=#the-form-element>form</a></code> element's
+ <a href=#past-names-map>past names map</a>, replacing the previous entry with
+ the same name, if any.</li>
+
+ <li><p>Return <var title="">candidate</var> and abort these
+ steps.</li>
+
+ </ol></li>
+
+ <li><p>Otherwise, <var title="">name</var> is the name of one of
+ the entries in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past names
+ map</a>: return the object associated with <var title="">name</var> in that map.</li>
+
+ </ol><p>If an element listed in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past
+ names map</a> is removed from the <code><a href=#document>Document</a></code>, then its
+ entries must be removed from the map.</p>
+
+ <!--
+ This ridiculous setup is intended to do as much of the right thing
+ while still supporting code written to work in IE7. IE versions
+ prior to IE8 do not update the names on the <form> element
+ collection to match new names when elements are renamed, and there
+ are enough pages that rename elements and then access them by
+ their old name that we have to support this.
+
+ But we still want to expose them using the new names, so as far as
+ possible we pretend the legacy names aren't there except if
+ there's no other element actually named that way.
+
+ Removing the element did remove the legacy name in IE7:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Cform%20action%3D%22%2F%22%3E%3Cinput%20name%3Dsubmit%3E%3C%2Fform%3E%0A%3Cscript%3E%0A%20w(document.forms%5B0%5D.submit)%3B%0A%20w(document.forms%5B0%5D.removeChild(document.getElementsByTagName('input')%5B0%5D))%3B%0A%20w(document.forms%5B0%5D.length)%3B%0A%20try%20%7B%20document.forms%5B0%5D.submit()%3B%20%7D%20catch%20(e)%20%20%7B%20w(e.message)%20%7D%0A%3C%2Fscript%3E
+
+ There's no interop on what happens when the name was originally a
+ duplicate name, so we don't persist such accesses - at the time
+ of writing, Safari returned the first element, Firefox returned
+ null (as we do), and IE7 returned the original collection:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Cform%20action%3D%22%2F%22%3E%3Cinput%20name%3Da%20id%3Dfirst%3E%3Cinput%20name%3Da%20id%3Dsecond%3E%3C%2Fform%3E%0A%3Cscript%3E%0A%20w%28document.forms[0].a%29%3B%0A%20document.getElementsByTagName%28%27input%27%29[0].name%20%3D%20%27b%27%3B%0A%20document.getElementsByTagName%28%27input%27%29[1].name%20%3D%20%27b%27%3B%0A%20w%28document.forms[0].length%29%3B%0A%20w%28document.forms[0].a.id%29%3B%0A%3C%2Fscript%3E
+ -->
+
+ <hr><p>The <dfn id=dom-form-submit title=dom-form-submit><code>submit()</code></dfn>
+ method, when invoked, must <a href=#concept-form-submit title=concept-form-submit>submit</a> the <code><a href=#the-form-element>form</a></code>
+ element from the <code><a href=#the-form-element>form</a></code> element itself, with the <var title="">scripted-submit</var> flag set.</p>
+
+ <p>The <dfn id=dom-form-reset title=dom-form-reset><code>reset()</code></dfn>
+ method, when invoked, must run the following steps:</p>
+
+ <ol><li><p>If the <code><a href=#the-form-element>form</a></code> element is marked as <i><a href=#locked-for-reset>locked for
+ reset</a></i>, then abort these steps.</li>
+
+ <li><p>Mark the <code><a href=#the-form-element>form</a></code> element as <dfn id=locked-for-reset>locked for
+ reset</dfn>.</li>
+
+ <li><p><a href=#concept-form-reset title=concept-form-reset>Reset</a> the
+ <code><a href=#the-form-element>form</a></code> element.</li>
+
+ <li><p>Unmark the <code><a href=#the-form-element>form</a></code> element as <i><a href=#locked-for-reset>locked for
+ reset</a></i>.</li>
+
+ </ol><p>If the <dfn id=dom-form-checkvalidity title=dom-form-checkValidity><code>checkValidity()</code></dfn>
+ method is invoked, the user agent must <a href=#statically-validate-the-constraints>statically validate the
+ constraints</a> of the <code><a href=#the-form-element>form</a></code> element, and return true
+ if the constraint validation return a <i>positive</i> result, and
+ false if it returned a <i>negative</i> result.</p>
+
+ <p>If the <dfn id=dom-form-dispatchforminput title=dom-form-dispatchFormInput><code>dispatchFormInput()</code></dfn>
+ method is invoked, the user agent must <a href=#broadcast-forminput-events>broadcast <code title=event-forminput>forminput</code> events</a> from the
+ <code><a href=#the-form-element>form</a></code> element.</p>
+
+ <p>If the <dfn id=dom-form-dispatchformchange title=dom-form-dispatchFormChange><code>dispatchFormChange()</code></dfn>
+ method is invoked, the user agent must <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> from the
+ <code><a href=#the-form-element>form</a></code> element.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This example shows two search forms:</p>
+
+ <pre>&lt;form action="http://www.google.com/search" method="get"&gt;
+ &lt;label&gt;Google: &lt;input type="search" name="q"&gt;&lt;/label&gt; &lt;input type="submit" value="Search..."&gt;
+&lt;/form&gt;
+&lt;form action="http://www.bing.com/search" method="get"&gt;
+ &lt;label&gt;Bing: &lt;input type="search" name="q"&gt;&lt;/label&gt; &lt;input type="submit" value="Search..."&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+
+
+
+ <h4 id=the-fieldset-element><span class=secno>4.10.4 </span>The <dfn><code>fieldset</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
+ <dd><a href=#category-listed title=category-listed>Listed</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Optionally a <code><a href=#the-legend-element>legend</a></code> element, followed by <a href=#flow-content>flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlfieldsetelement>HTMLFieldSetElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-fieldset-disabled title=dom-fieldset-disabled>disabled</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
+
+ readonly attribute DOMString <a href=#dom-fieldset-type title=dom-fieldset-type>type</a>;
+
+ readonly attribute <a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a> <a href=#dom-fieldset-elements title=dom-fieldset-elements>elements</a>;
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-fieldset-element>fieldset</a></code> element <a href=#represents>represents</a> a set
+ of form controls optionally grouped under a common name.</p>
+
+ <p>The name of the group is given by the first <code><a href=#the-legend-element>legend</a></code>
+ element that is a child of the <code><a href=#the-fieldset-element>fieldset</a></code> element, if
+ any. The remainder of the descendants form the group.</p>
+
+ <p>The <dfn id=attr-fieldset-disabled title=attr-fieldset-disabled><code>disabled</code></dfn>
+ attribute, when specified, causes all the form control descendants
+ of the <code><a href=#the-fieldset-element>fieldset</a></code> element, excluding those that are
+ descendants of the <code><a href=#the-fieldset-element>fieldset</a></code> element's first
+ <code><a href=#the-legend-element>legend</a></code> element child, if any, to be <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</p>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-fieldset-element>fieldset</a></code> element with its
+ <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute represents the element's name.</p>
+
+ <dl class=domintro><dt><var title="">fieldset</var> . <code title=dom-fieldset-type><a href=#dom-fieldset-type>type</a></code></dt>
+
+ <dd>
+
+ <p>Returns the string "fieldset".</p>
+
+ </dd>
+
+ <dt><var title="">fieldset</var> . <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code></dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the form controls in
+ the element.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-fieldset-disabled title=dom-fieldset-disabled><code>disabled</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ <p>The <dfn id=dom-fieldset-type title=dom-fieldset-type><code>type</code></dfn> IDL
+ attribute must return the string "<code title="">fieldset</code>".</p>
+
+ <p>The <dfn id=dom-fieldset-elements title=dom-fieldset-elements><code>elements</code></dfn> IDL
+ attribute must return an <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code>
+ rooted at the <code><a href=#the-fieldset-element>fieldset</a></code> element, whose filter matches
+ <a href=#category-listed title=category-listed>listed elements</a>.</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
+ element's forms API.</p>
+
+ <p><strong>Constraint validation</strong>: <code><a href=#the-fieldset-element>fieldset</a></code>
+ elements are always <a href=#barred-from-constraint-validation>barred from constraint
+ validation</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following snippet shows a fieldset with a checkbox in the
+ legend that controls whether or not the fieldset is enabled. The
+ contents of the fieldset consist of two required text fields and an
+ optional year/month control.</p>
+
+ <pre>&lt;fieldset name="clubfields" disabled&gt;
+ &lt;legend&gt; &lt;label&gt;
+ &lt;input type=checkbox name=club onchange="form.clubfields.disabled = !checked"&gt;
+ Use Club Card
+ &lt;/label&gt; &lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt;Name on card: &lt;input name=clubname required&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Card number: &lt;input name=clubnum required pattern="[-0-9]+"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Expiry date: &lt;input name=clubexp type=month&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;/fieldset&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-legend-element><span class=secno>4.10.5 </span>The <dfn><code>legend</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As the first child of a <code><a href=#the-fieldset-element>fieldset</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+ <pre class=idl>interface <dfn id=htmllegendelement>HTMLLegendElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-legend-form title=dom-legend-form>form</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-legend-element>legend</a></code> element <a href=#represents>represents</a> a caption
+ for the rest of the contents of the <code><a href=#the-legend-element>legend</a></code> element's
+ parent <code><a href=#the-fieldset-element>fieldset</a></code> element<span class=impl>, if
+ any</span>.</p>
+
+ <dl class=domintro><dt><var title="">legend</var> . <code title=dom-legend-form><a href=#dom-legend-form>form</a></code></dt>
+
+ <dd>
+
+ <p>Returns the element's <code><a href=#the-form-element>form</a></code> element, if any, or
+ null otherwise.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-legend-form title=dom-legend-form><code>form</code></dfn> IDL
+ attribute's behavior depends on whether the <code><a href=#the-legend-element>legend</a></code>
+ element is in a <code><a href=#the-fieldset-element>fieldset</a></code> element or not. If the
+ <code><a href=#the-legend-element>legend</a></code> has a <code><a href=#the-fieldset-element>fieldset</a></code> element as its
+ parent, then the <code title=dom-legend-form><a href=#dom-legend-form>form</a></code> IDL
+ attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute on that
+ <code><a href=#the-fieldset-element>fieldset</a></code> element. Otherwise, it must return null.</p>
+
+ </div>
+
+
+
+ <h4 id=the-label-element><span class=secno>4.10.6 </span>The <dfn><code>label</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dd><a href=#form-associated-element>Form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>, but with no descendant <a href=#category-label title=category-label>labelable form-associated elements</a> unless it is the element's <a href=#labeled-control>labeled control</a>, and no descendant <code><a href=#the-label-element>label</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-label-for><a href=#attr-label-for>for</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmllabelelement>HTMLLabelElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute DOMString <a href=#dom-label-htmlfor title=dom-label-htmlFor>htmlFor</a>;
+ readonly attribute <a href=#htmlelement>HTMLElement</a> <a href=#dom-label-control title=dom-label-control>control</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-label-element>label</a></code> <a href=#represents>represents</a> a caption in a
+ user interface. The caption can be associated with a specific form
+ control<span class=impl>, known as the <code><a href=#the-label-element>label</a></code>
+ element's <dfn id=labeled-control>labeled control</dfn></span>, either using <code title=attr-label-for><a href=#attr-label-for>for</a></code> attribute, or by putting the form
+ control inside the <code><a href=#the-label-element>label</a></code> element itself.</p>
+
+ <div class=impl>
+
+ <p>Except where otherwise specified by the following rules, a
+ <code><a href=#the-label-element>label</a></code> element has no <a href=#labeled-control>labeled control</a>.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-label-for title=attr-label-for><code>for</code></dfn> attribute
+ may be specified to indicate a form control with which the caption
+ is to be associated. If the attribute is specified, the attribute's
+ value must be the ID of a <a href=#category-label title=category-label>labelable
+ form-associated element</a> in the same <code><a href=#document>Document</a></code> as
+ the <code><a href=#the-label-element>label</a></code> element. <span class=impl>If the attribute
+ is specified and there is an element in the <code><a href=#document>Document</a></code>
+ whose ID is equal to the value of the <code title=attr-label-for><a href=#attr-label-for>for</a></code> attribute, and the first such
+ element is a <a href=#category-label title=category-label>labelable form-associated
+ element</a>, then that element is the <code><a href=#the-label-element>label</a></code>
+ element's <a href=#labeled-control>labeled control</a>.</span></p>
+
+ <div class=impl>
+
+ <p>If the <code title=attr-label-for><a href=#attr-label-for>for</a></code> attribute is not
+ specified, but the <code><a href=#the-label-element>label</a></code> element has a <a href=#category-label title=category-label>labelable form-associated element</a>
+ descendant, then the first such descendant in <a href=#tree-order>tree
+ order</a> is the <code><a href=#the-label-element>label</a></code> element's <a href=#labeled-control>labeled
+ control</a>.</p>
+
+ <p>The <code><a href=#the-label-element>label</a></code> element's exact default presentation and
+ behavior, in particular what its <a href=#activation-behavior>activation behavior</a>
+ might be, if anything, should match the platform's label
+ behavior.</p>
+
+ <!-- activation behaviour need not be dependent on whether the
+ labeled control is being rendered:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/saved/371
+ -->
+
+ <div class=example>
+
+ <p>For example, on platforms where clicking a checkbox label checks
+ the checkbox, clicking the <code><a href=#the-label-element>label</a></code> in the following
+ snippet could trigger the user agent to <a href=#run-synthetic-click-activation-steps>run synthetic click
+ activation steps</a> on the <code><a href=#the-input-element>input</a></code> element, as if
+ the element itself had been triggered by the user:</p>
+
+ <pre>&lt;label&gt;&lt;input type=checkbox name=lost&gt; Lost&lt;/label&gt;</pre>
+
+ <p>On other platforms, the behavior might be just to focus the
+ control, or do nothing.</p>
+
+ </div>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">label</var> . <code title=dom-label-control><a href=#dom-label-control>control</a></code></dt>
+
+ <dd>
+
+ <p>Returns the form control that is associated with this element.</p>
+
+ </dd>
+
+ </dl><p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-label-element>label</a></code> element with its
+ <a href=#form-owner>form owner</a>.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-label-htmlfor title=dom-label-htmlFor><code>htmlFor</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-label-for><a href=#attr-label-for>for</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-label-control title=dom-label-control><code>control</code></dfn> IDL
+ attribute must return the <code><a href=#the-label-element>label</a></code> element's <a href=#labeled-control>labeled
+ control</a>, if any, or null if there isn't one.</p>
+
+ </div>
+
+ <hr><dl class=domintro><dt><var title="">control</var> . <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#nodelist>NodeList</a></code> of all the <code><a href=#the-label-element>label</a></code>
+ elements that the form control is associated with.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p><a href=#category-label title=category-label>Labelable form-associated
+ elements</a> have a <code><a href=#nodelist>NodeList</a></code> object associated with
+ them that represents the list of <code><a href=#the-label-element>label</a></code> elements, in
+ <a href=#tree-order>tree order</a>, whose <a href=#labeled-control>labeled control</a> is the
+ element in question. The <dfn id=dom-lfe-labels title=dom-lfe-labels><code>labels</code></dfn> IDL attribute of
+ <a href=#category-label title=category-label>labelable form-associated
+ elements</a>, on getting, must return that <code><a href=#nodelist>NodeList</a></code>
+ object.</p>
+
+ <p>The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute is part
+ of the element's forms API.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows three form controls each with a
+ label, two of which have small text showing the right format for
+ users to use.</p>
+
+ <pre>&lt;p&gt;&lt;label&gt;Full name: &lt;input name=fn&gt; &lt;small&gt;Format: First Last&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;p&gt;&lt;label&gt;Age: &lt;input name=age type=number min=0&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;p&gt;&lt;label&gt;Post code: &lt;input name=pc&gt; &lt;small&gt;Format: AB12 3CD&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+
+ <h4 id=the-input-element><span class=secno>4.10.7 </span>The <dfn><code>input</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd>If the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state: <a href=#interactive-content>Interactive content</a>.</dd>
+ <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, and <a href=#category-reset title=category-reset>resettable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-input-accept><a href=#attr-input-accept>accept</a></code></dd>
+ <dd><code title=attr-input-alt><a href=#attr-input-alt>alt</a></code></dd>
+ <dd><code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code></dd>
+ <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code></dd>
+ <dd><code title=attr-input-checked><a href=#attr-input-checked>checked</a></code></dd>
+ <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code></dd>
+ <dd><code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code></dd>
+ <dd><code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code></dd>
+ <dd><code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code></dd>
+ <dd><code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code></dd>
+ <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code></dd>
+ <dd><code title=attr-input-list><a href=#attr-input-list>list</a></code></dd>
+ <dd><code title=attr-input-max><a href=#attr-input-max>max</a></code></dd>
+ <dd><code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code></dd>
+ <dd><code title=attr-input-min><a href=#attr-input-min>min</a></code></dd>
+ <dd><code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code></dd>
+ <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code></dd>
+ <dd><code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code></dd>
+ <dd><code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code></dd>
+ <dd><code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code></dd>
+ <dd><code title=attr-input-required><a href=#attr-input-required>required</a></code></dd>
+ <dd><code title=attr-input-size><a href=#attr-input-size>size</a></code></dd>
+ <dd><code title=attr-input-src><a href=#attr-input-src>src</a></code></dd>
+ <dd><code title=attr-input-step><a href=#attr-input-step>step</a></code></dd>
+ <dd><code title=attr-input-type><a href=#attr-input-type>type</a></code></dd>
+ <dd><code title=attr-input-value><a href=#attr-input-value>value</a></code></dd>
+ <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlinputelement>HTMLInputElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-input-accept title=dom-input-accept>accept</a>;
+ attribute DOMString <a href=#dom-input-alt title=dom-input-alt>alt</a>;
+ attribute DOMString <a href=#dom-input-autocomplete title=dom-input-autocomplete>autocomplete</a>;
+ attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
+ attribute boolean <a href=#dom-input-defaultchecked title=dom-input-defaultChecked>defaultChecked</a>;
+ attribute boolean <a href=#dom-input-checked title=dom-input-checked>checked</a>;
+ attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ readonly attribute <span>FileList</span> <a href=#dom-input-files title=dom-input-files>files</a>;
+ attribute DOMString <a href=#dom-fs-formaction title=dom-fs-formAction>formAction</a>;
+ attribute DOMString <a href=#dom-fs-formenctype title=dom-fs-formEnctype>formEnctype</a>;
+ attribute DOMString <a href=#dom-fs-formmethod title=dom-fs-formMethod>formMethod</a>;
+ attribute boolean <a href=#dom-fs-formnovalidate title=dom-fs-formNoValidate>formNoValidate</a>;
+ attribute DOMString <a href=#dom-fs-formtarget title=dom-fs-formTarget>formTarget</a>;
+ attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
+ attribute boolean <a href=#dom-input-indeterminate title=dom-input-indeterminate>indeterminate</a>;
+ readonly attribute <a href=#htmlelement>HTMLElement</a> <a href=#dom-input-list title=dom-input-list>list</a>;
+ attribute DOMString <a href=#dom-input-max title=dom-input-max>max</a>;
+ attribute long <a href=#dom-input-maxlength title=dom-input-maxLength>maxLength</a>;
+ attribute DOMString <a href=#dom-input-min title=dom-input-min>min</a>;
+ attribute boolean <a href=#dom-input-multiple title=dom-input-multiple>multiple</a>;
+ attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
+ attribute DOMString <a href=#dom-input-pattern title=dom-input-pattern>pattern</a>;
+ attribute DOMString <a href=#dom-input-placeholder title=dom-input-placeholder>placeholder</a>;
+ attribute boolean <a href=#dom-input-readonly title=dom-input-readOnly>readOnly</a>;
+ attribute boolean <a href=#dom-input-required title=dom-input-required>required</a>;
+ attribute unsigned long <a href=#dom-input-size title=dom-input-size>size</a>;
+ attribute DOMString <a href=#dom-input-src title=dom-input-src>src</a>;
+ attribute DOMString <a href=#dom-input-step title=dom-input-step>step</a>;
+ attribute DOMString <a href=#dom-input-type title=dom-input-type>type</a>;
+ attribute DOMString <a href=#dom-input-defaultvalue title=dom-input-defaultValue>defaultValue</a>;
+ attribute DOMString <a href=#dom-input-value title=dom-input-value>value</a>;
+ attribute <span>Date</span> <a href=#dom-input-valueasdate title=dom-input-valueAsDate>valueAsDate</a>;
+ attribute double <a href=#dom-input-valueasnumber title=dom-input-valueAsNumber>valueAsNumber</a>;
+ readonly attribute <a href=#htmloptionelement>HTMLOptionElement</a> <a href=#dom-input-selectedoption title=dom-input-selectedOption>selectedOption</a>;
+ attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
+
+ void <a href=#dom-input-stepup title=dom-input-stepUp>stepUp</a>(in optional long n);
+ void <a href=#dom-input-stepdown title=dom-input-stepDown>stepDown</a>(in optional long n);
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+
+ void <a href=#dom-textarea/input-select title=dom-textarea/input-select>select</a>();
+ attribute unsigned long <a href=#dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart>selectionStart</a>;
+ attribute unsigned long <a href=#dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd>selectionEnd</a>;
+ void <a href=#dom-textarea/input-setselectionrange title=dom-textarea/input-setSelectionRange>setSelectionRange</a>(in unsigned long start, in unsigned long end);
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a typed data field,
+ usually with a form control to allow the user to edit the data.</p>
+
+ <p>The <dfn id=attr-input-type title=attr-input-type><code>type</code></dfn>
+ attribute controls the data type (and associated control) of the
+ element. It is an <a href=#enumerated-attribute>enumerated attribute</a>. The following
+ table lists the keywords and states for the attribute &mdash; the
+ keywords in the left column map to the states in the cell in the
+ second column on the same row as the keyword.</p>
+
+ <table id=attr-input-type-keywords><thead><tr><th> Keyword
+ <th> State
+ <th> Data type
+ <th> Control type
+ <tbody><tr><td> <dfn id=attr-input-type-hidden-keyword title=attr-input-type-hidden-keyword><code>hidden</code></dfn>
+ <td> <a href=#hidden-state title=attr-input-type-hidden>Hidden</a>
+ <td> An arbitrary string
+ <td> n/a
+ <tr><td> <dfn id=attr-input-type-text-keyword title=attr-input-type-text-keyword><code>text</code></dfn>
+ <td> <a href=#text-state-and-search-state title=attr-input-type-text>Text</a>
+ <td> Text with no line breaks
+ <td> Text field
+ <tr><td> <dfn id=attr-input-type-search-keyword title=attr-input-type-search-keyword><code>search</code></dfn>
+ <td> <a href=#text-state-and-search-state title=attr-input-type-search>Search</a>
+ <td> Text with no line breaks
+ <td> Search field
+ <tr><td> <dfn id=attr-input-type-tel-keyword title=attr-input-type-tel-keyword><code>tel</code></dfn>
+ <td> <a href=#telephone-state title=attr-input-type-tel>Telephone</a>
+ <td> Text with no line breaks
+ <td> A text field
+ <tr><td> <dfn id=attr-input-type-url-keyword title=attr-input-type-url-keyword><code>url</code></dfn>
+ <td> <a href=#url-state title=attr-input-type-url>URL</a>
+ <td> An absolute IRI
+ <td> A text field
+ <tr><td> <dfn id=attr-input-type-email-keyword title=attr-input-type-email-keyword><code>email</code></dfn>
+ <td> <a href=#e-mail-state title=attr-input-type-email>E-mail</a>
+ <td> An e-mail address or list of e-mail addresses
+ <td> A text field
+ <tr><td> <dfn id=attr-input-type-password-keyword title=attr-input-type-password-keyword><code>password</code></dfn>
+ <td> <a href=#password-state title=attr-input-type-password>Password</a>
+ <td> Text with no line breaks (sensitive information)
+ <td> Text field that obscures data entry
+ <tr><td> <dfn id=attr-input-type-datetime-keyword title=attr-input-type-datetime-keyword><code>datetime</code></dfn>
+ <td> <a href=#date-and-time-state title=attr-input-type-datetime>Date and Time</a>
+ <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with the time zone set to UTC
+ <td> A date and time control
+ <tr><td> <dfn id=attr-input-type-date-keyword title=attr-input-type-date-keyword><code>date</code></dfn>
+ <td> <a href=#date-state title=attr-input-type-date>Date</a>
+ <td> A date (year, month, day) with no time zone
+ <td> A date control
+ <tr><td> <dfn id=attr-input-type-month-keyword title=attr-input-type-month-keyword><code>month</code></dfn>
+ <td> <a href=#month-state title=attr-input-type-month>Month</a>
+ <td> A date consisting of a year and a month with no time zone
+ <td> A month control
+ <tr><td> <dfn id=attr-input-type-week-keyword title=attr-input-type-week-keyword><code>week</code></dfn>
+ <td> <a href=#week-state title=attr-input-type-week>Week</a>
+ <td> A date consisting of a week-year number and a week number with no time zone
+ <td> A week control
+ <tr><td> <dfn id=attr-input-type-time-keyword title=attr-input-type-time-keyword><code>time</code></dfn>
+ <td> <a href=#time-state title=attr-input-type-time>Time</a>
+ <td> A time (hour, minute, seconds, fractional seconds) with no time zone
+ <td> A time control
+ <tr><td> <dfn id=attr-input-type-datetime-local-keyword title=attr-input-type-datetime-local-keyword><code>datetime-local</code></dfn>
+ <td> <a href=#local-date-and-time-state title=attr-input-type-datetime-local>Local Date and Time</a>
+ <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone
+ <td> A date and time control
+ <tr><td> <dfn id=attr-input-type-number-keyword title=attr-input-type-number-keyword><code>number</code></dfn>
+ <td> <a href=#number-state title=attr-input-type-number>Number</a>
+ <td> A numerical value
+ <td> A text field or spinner control
+ <tr><td> <dfn id=attr-input-type-range-keyword title=attr-input-type-range-keyword><code>range</code></dfn>
+ <td> <a href=#range-state title=attr-input-type-range>Range</a>
+ <td> A numerical value, with the extra semantic that the exact value is not important
+ <td> A slider control or similar
+ <tr><td> <dfn id=attr-input-type-color-keyword title=attr-input-type-color-keyword><code>color</code></dfn>
+ <td> <a href=#color-state title=attr-input-type-color>Color</a>
+ <td> An sRGB color with 8-bit red, green, and blue components
+ <td> A color well
+ <tr><td> <dfn id=attr-input-type-checkbox-keyword title=attr-input-type-checkbox-keyword><code>checkbox</code></dfn>
+ <td> <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a>
+ <td> A set of zero or more values from a predefined list
+ <td> A checkbox
+ <tr><td> <dfn id=attr-input-type-radio-keyword title=attr-input-type-radio-keyword><code>radio</code></dfn>
+ <td> <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a>
+ <td> An enumerated value
+ <td> A radio button
+ <tr><td> <dfn id=attr-input-type-file-keyword title=attr-input-type-file-keyword><code>file</code></dfn>
+ <td> <a href=#file-upload-state title=attr-input-type-file>File Upload</a>
+ <td> Zero or more files each with a <a href=#mime-type>MIME type</a> and optionally a file name
+ <td> A label and a button
+ <tr><td> <dfn id=attr-input-type-submit-keyword title=attr-input-type-submit-keyword><code>submit</code></dfn>
+ <td> <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a>
+ <td> An enumerated value, with the extra semantic that it must be the last value selected and initiates form submission
+ <td> A button
+ <tr><td> <dfn id=attr-input-type-image-keyword title=attr-input-type-image-keyword><code>image</code></dfn>
+ <td> <a href=#image-button-state title=attr-input-type-image>Image Button</a>
+ <td> A coordinate, relative to a particular image's size, with the extra semantic that it must be the last value selected and initiates form submission
+ <td> Either a clickable image, or a button
+ <tr><td> <dfn id=attr-input-type-reset-keyword title=attr-input-type-reset-keyword><code>reset</code></dfn>
+ <td> <a href=#reset-button-state title=attr-input-type-reset>Reset Button</a>
+ <td> n/a
+ <td> A button
+ <tr><td> <dfn id=attr-input-type-button-keyword title=attr-input-type-button-keyword><code>button</code></dfn>
+ <td> <a href=#button-state title=attr-input-type-button>Button</a>
+ <td> n/a
+ <td> A button
+ </table><p>The <i>missing value default</i> is the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state.</p>
+
+ <p>Which of the <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>, <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>, <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>, <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>, <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>, <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>, <code title=attr-input-list><a href=#attr-input-list>list</a></code>, <code title=attr-input-max><a href=#attr-input-max>max</a></code>, <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>, <code title=attr-input-min><a href=#attr-input-min>min</a></code>, <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>, <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>, <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>, <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>, <code title=attr-input-required><a href=#attr-input-required>required</a></code>, <code title=attr-input-size><a href=#attr-input-size>size</a></code>, <code title=attr-input-src><a href=#attr-input-src>src</a></code>, <code title=attr-input-step><a href=#attr-input-step>step</a></code>, and <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> content attributes, the <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code>, <code title=dom-input-files><a href=#dom-input-files>files</a></code>, <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, <code title=dom-input-list><a href=#dom-input-list>list</a></code>, and <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL
+ attributes, the <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> method, the <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> and
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
+ IDL attributes, the <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
+ method, the <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> and
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> methods, and the
+ <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply to an
+ <code><a href=#the-input-element>input</a></code> element depends on the state of its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute. The following table
+ <span class=impl>is non-normative and</span> summarizes which of
+ those content attributes, IDL attributes, methods, and events apply
+ to each state:</p>
+
+ <table class=applies id=input-type-attr-summary><thead><tr><th>
+ <th> <span title=""><a href=#hidden-state title=attr-input-type-hidden>Hidden</a></span>
+ <th> <span title=""><a href=#text-state-and-search-state title=attr-input-type-text>Text</a>,</span>
+ <span title=""><a href=#text-state-and-search-state title=attr-input-type-search>Search</a>,</span>
+ <span title=""><a href=#url-state title=attr-input-type-url>URL</a>,</span>
+ <span title=""><a href=#telephone-state title=attr-input-type-tel>Telephone</a></span>
+ <th> <span title=""><a href=#e-mail-state title=attr-input-type-email>E-mail</a></span>
+ <th> <span title=""><a href=#password-state title=attr-input-type-password>Password</a></span>
+ <th> <span title=""><a href=#date-and-time-state title=attr-input-type-datetime>Date and Time</a>,</span>
+ <span title=""><a href=#date-state title=attr-input-type-date>Date</a>,</span>
+ <span title=""><a href=#month-state title=attr-input-type-month>Month</a>,</span>
+ <span title=""><a href=#week-state title=attr-input-type-week>Week</a>,</span>
+ <span title=""><a href=#time-state title=attr-input-type-time>Time</a></span>
+ <th> <span title=""><a href=#local-date-and-time-state title=attr-input-type-datetime-local>Local Date and Time</a>,</span>
+ <span title=""><a href=#number-state title=attr-input-type-number>Number</a></span>
+ <th> <span title=""><a href=#range-state title=attr-input-type-range>Range</a></span>
+ <th> <span title=""><a href=#color-state title=attr-input-type-color>Color</a></span>
+ <th> <span title=""><a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a>,</span>
+ <span title=""><a href=#radio-button-state title=attr-input-type-radio>Radio Button</a></span>
+ <th> <span title=""><a href=#file-upload-state title=attr-input-type-file>File Upload</a></span>
+ <th> <span title=""><a href=#submit-button-state title=attr-input-type-submit>Submit Button</a></span>
+ <th> <span title=""><a href=#image-button-state title=attr-input-type-image>Image Button</a></span>
+ <th> <span title=""><a href=#reset-button-state title=attr-input-type-reset>Reset Button</a>,</span>
+ <span title=""><a href=#button-state title=attr-input-type-button>Button</a></span>
+
+ <tbody><tr><th colspan=14 scope=rowgroup>Content attributes
+
+ <tr><th> <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=yes> Yes <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=yes> Yes <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=yes> Yes <!-- Checkbox -->
+<!-- <td class="yes"> Yes Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=yes> Yes <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=yes> Yes <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=yes> Yes <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=yes> Yes <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=yes> Yes <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-list><a href=#attr-input-list>list</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=yes> Yes <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-min><a href=#attr-input-min>min</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=yes> Yes <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-required><a href=#attr-input-required>required</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=yes> Yes <!-- Checkbox -->
+<!-- <td class="yes"> Yes Radio Button -->
+ <td class=yes> Yes <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-size><a href=#attr-input-size>size</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-src><a href=#attr-input-src>src</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-input-step><a href=#attr-input-step>step</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=yes> Yes <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tbody><tr><th colspan=14 scope=rowgroup>IDL attributes and methods
+
+ <tr><th> <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=yes> Yes <!-- Checkbox -->
+<!-- <td class="yes"> Yes Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-input-files><a href=#dom-input-files>files</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=yes> Yes <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr class=impl><th> <code title=dom-input-value><a href=#dom-input-value>value</a></code>
+ <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Hidden -->
+ <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Text -->
+<!-- <td class="yes"> <span title="dom-input-value-value">value</span> Search -->
+<!-- <td class="yes"> <span title="dom-input-value-value">value</span> URL -->
+ <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- E-mail -->
+ <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Password -->
+ <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Date and Time -->
+<!-- <td class="yes"> <span title="dom-input-value-value">value</span> Date -->
+<!-- <td class="yes"> <span title="dom-input-value-value">value</span> Month -->
+<!-- <td class="yes"> <span title="dom-input-value-value">value</span> Week -->
+<!-- <td class="yes"> <span title="dom-input-value-value">value</span> Time -->
+ <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Local Date and Time -->
+<!-- <td class="yes"> <span title="dom-input-value-value">value</span> Number -->
+ <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Range -->
+ <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Color -->
+ <td class=yes> <a href=#dom-input-value-default-on title=dom-input-value-default-on>default/on</a> <!-- Checkbox -->
+<!-- <td class="yes"> <span title="dom-input-value-default-on">default/on</span> Radio Button -->
+ <td class=yes> <a href=#dom-input-value-filename title=dom-input-value-filename>filename</a> <!-- File Upload -->
+ <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Submit Button -->
+ <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Image Button -->
+ <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Reset Button -->
+<!-- <td class="yes"> <span title="dom-input-value-default">default</span> Button -->
+
+ <tr><th> <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-input-list><a href=#dom-input-list>list</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=yes> Yes <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=yes> Yes <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=no> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot; Date -->
+<!-- <td class="no"> &middot; Month -->
+<!-- <td class="no"> &middot; Week -->
+<!-- <td class="no"> &middot; Time -->
+ <td class=no> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot; Number -->
+ <td class=no> &middot; <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=no> &middot; <!-- Text -->
+<!-- <td class="no"> &middot; Search -->
+<!-- <td class="no"> &middot; URL -->
+ <td class=no> &middot; <!-- E-mail -->
+ <td class=no> &middot; <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=no> &middot; <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tbody><tr><th colspan=14 scope=rowgroup>Events
+
+ <tr><th> <span title=""><code title=event-input-input><a href=#event-input-input>input</a></code> event</span>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=yes> Yes <!-- Color -->
+ <td class=no> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot; Radio Button -->
+ <td class=no> &middot; <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ <tr><th> <span title=""><code title=event-input-change><a href=#event-input-change>change</a></code> event</span>
+ <td class=no> &middot; <!-- Hidden -->
+ <td class=yes> Yes <!-- Text -->
+<!-- <td class="yes"> Yes Search -->
+<!-- <td class="yes"> Yes URL -->
+ <td class=yes> Yes <!-- E-mail -->
+ <td class=yes> Yes <!-- Password -->
+ <td class=yes> Yes <!-- Date and Time -->
+<!-- <td class="yes"> Yes Date -->
+<!-- <td class="yes"> Yes Month -->
+<!-- <td class="yes"> Yes Week -->
+<!-- <td class="yes"> Yes Time -->
+ <td class=yes> Yes <!-- Local Date and Time -->
+<!-- <td class="yes"> Yes Number -->
+ <td class=yes> Yes <!-- Range -->
+ <td class=yes> Yes <!-- Color -->
+ <td class=yes> Yes <!-- Checkbox -->
+<!-- <td class="yes"> Yes Radio Button -->
+ <td class=yes> Yes <!-- File Upload -->
+ <td class=no> &middot; <!-- Submit Button -->
+ <td class=no> &middot; <!-- Image Button -->
+ <td class=no> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot; Button -->
+
+ </table><div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute changes state, and
+ when the element is first created, the element's rendering and
+ behavior must change to the new state's accordingly and the
+ <dfn id=value-sanitization-algorithm>value sanitization algorithm</dfn>, if one is defined for the
+ <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's new state,
+ must be invoked.</p>
+
+ <p>Each <code><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-value title=concept-fe-value>value</a>, which is exposed by the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute. Some states
+ define an <dfn id=concept-input-value-string-number title=concept-input-value-string-number>algorithm
+ to convert a string to a number</dfn>, an <dfn id=concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</dfn>, an <dfn id=concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</dfn>, and an <dfn id=concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</dfn>, which are used by
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code>,
+ <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code>.</p>
+
+ <p>Each <code><a href=#the-input-element>input</a></code> element has a boolean <dfn id=concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</dfn>. When
+ it is true, the element is said to have a <dfn id=concept-input-value-dirty title=concept-input-value-dirty><i>dirty value</i></dfn>. The
+ <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a>
+ must be initially set to false when the element is created, and must
+ be set to true whenever the user interacts with the control in a way
+ that changes the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-input-value title=attr-input-value><code>value</code></dfn>
+ content attribute gives the default <a href=#concept-fe-value title=concept-fe-value>value</a> of the <code><a href=#the-input-element>input</a></code>
+ element. <span class=impl>When the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute is added,
+ set, or removed, if the control does not have a <i title=concept-input-value-dirty><a href=#concept-input-value-dirty>dirty value</a></i>, the user agent
+ must set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the
+ element to the value of the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute, if there is
+ one, or the empty string otherwise, and then run the current
+ <a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if one is
+ defined.</span></p>
+
+ <div class=impl>
+
+ <p>Each <code><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>, which is exposed by
+ the <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> IDL
+ attribute.</p>
+
+ <p>Each <code><a href=#the-input-element>input</a></code> element has a boolean <dfn id=concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness
+ flag</dfn>. When it is true, the element is said to have a <dfn id=concept-input-checked-dirty title=concept-input-checked-dirty><i>dirty
+ checkedness</i></dfn>. The <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness
+ flag</a> must be initially set to false when the element is
+ created, and must be set to true whenever the user interacts with
+ the control in a way that changes the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-input-checked title=attr-input-checked><code>checked</code></dfn>
+ content attribute is a <a href=#boolean-attribute>boolean attribute</a> that gives the
+ default <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the
+ <code><a href=#the-input-element>input</a></code> element. <span class=impl>When the <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> content attribute is
+ added, if the control does not have <i title=concept-input-checked-dirty><a href=#concept-input-checked-dirty>dirty checkedness</a></i>, the user
+ agent must set the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the element to
+ true; when the <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>
+ content attribute is removed, if the control does not have <i title=concept-input-checked-dirty><a href=#concept-input-checked-dirty>dirty checkedness</a></i>, the user
+ agent must set the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the element to
+ false.</span></p>
+
+ <div class=impl>
+
+ <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
+ algorithm</a> for <code><a href=#the-input-element>input</a></code> elements is to set the <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a> and
+ <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness
+ flag</a> back to false, set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to the value of
+ the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute,
+ if there is one, or the empty string otherwise, set the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the element to true
+ if the element has a <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>
+ content attribute and false if it does not, and then invoke the
+ <a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state
+ defines one.</p>
+
+ <p>Each <code><a href=#the-input-element>input</a></code> element is either <dfn id=concept-input-mutable title=concept-input-mutable><i>mutable</i></dfn> or <dfn id=concept-input-immutable title=concept-input-immutable><i>immutable</i></dfn>. Except where
+ otherwise specified, an <code><a href=#the-input-element>input</a></code> element is always <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>. Similarly, except where
+ otherwise specified, the user agent should not allow the user to
+ modify the element's <a href=#concept-fe-value title=concept-fe-value>value</a> or
+ <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>.</p>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, it is <i title=concept-input-immutable><a href=#concept-input-immutable>immutable</a></i>.</p>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element does not have a
+ <code><a href=#document>Document</a></code> node as one of its ancestors (i.e. when it is
+ not in the document), it is <i title=concept-input-immutable><a href=#concept-input-immutable>immutable</a></i>.</p> <!-- XBL2 spec
+ point -->
+
+ <p class=note>The <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute can also in
+ some cases (e.g. for the <a href=#date-state title=attr-input-type-date>Date</a> state, but not the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state) make an
+ <code><a href=#the-input-element>input</a></code> element <i title=concept-input-immutable><a href=#concept-input-immutable>immutable</a></i>.</p>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element is cloned, the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a>,
+ <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>, and <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness
+ flag</a> must be propagated to the clone when it is created.</p>
+
+ </div>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-input-element>input</a></code> element with its
+ <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute represents the element's name. The <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make
+ the control non-interactive and to prevent its value from being
+ submitted. The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
+ attribute controls focus.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-input-indeterminate title=dom-input-indeterminate><code>indeterminate</code></dfn> IDL
+ attribute must initially be set to false. On getting, it must return
+ the last value it was set to. On setting, it must be set to the new
+ value. It has no effect except for changing the appearance of <a href=#checkbox-state title=attr-input-type-checkbox>checkbox</a> controls.</p>
+
+ <p>The <dfn id=dom-input-accept title=dom-input-accept><code>accept</code></dfn>, <dfn id=dom-input-alt title=dom-input-alt><code>alt</code></dfn>, <dfn id=dom-input-autocomplete title=dom-input-autocomplete><code>autocomplete</code></dfn>, <dfn id=dom-input-max title=dom-input-max><code>max</code></dfn>, <dfn id=dom-input-min title=dom-input-min><code>min</code></dfn>, <dfn id=dom-input-multiple title=dom-input-multiple><code>multiple</code></dfn>, <dfn id=dom-input-pattern title=dom-input-pattern><code>pattern</code></dfn>, <dfn id=dom-input-placeholder title=dom-input-placeholder><code>placeholder</code></dfn>, <dfn id=dom-input-required title=dom-input-required><code>required</code></dfn>, <dfn id=dom-input-size title=dom-input-size><code>size</code></dfn>, <dfn id=dom-input-src title=dom-input-src><code>src</code></dfn>, <dfn id=dom-input-step title=dom-input-step><code>step</code></dfn>, and <dfn id=dom-input-type title=dom-input-type><code>type</code></dfn> IDL attributes must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name. The <dfn id=dom-input-maxlength title=dom-input-maxLength><code>maxLength</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> content attribute,
+ <a href=#limited-to-only-non-negative-numbers>limited to only non-negative numbers</a>. The <dfn id=dom-input-readonly title=dom-input-readOnly><code>readOnly</code></dfn> IDL attribute
+ must <a href=#reflect>reflect</a> the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> content attribute. The
+ <dfn id=dom-input-defaultchecked title=dom-input-defaultChecked><code>defaultChecked</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> content attribute. The
+ <dfn id=dom-input-defaultvalue title=dom-input-defaultValue><code>defaultValue</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute.</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides a list
+ of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>, <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ and <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
+ methods and attributes expose the element's text selection. The
+ <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
+ element's forms API.</p>
+
+ </div>
+
+
+
+ <h5 id=states-of-the-type-attribute><span class=secno>4.10.7.1 </span>States of the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute</h5>
+
+
+ <h6 id=hidden-state><span class=secno>4.10.7.1.1 </span><dfn title=attr-input-type-hidden>Hidden</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state, the rules in
+ this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a value
+ that is not intended to be examined or manipulated by the user.</p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If an <code><a href=#the-input-element>input</a></code>
+ element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
+ the <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state, it is
+ <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>
+
+ </div>
+
+ <p>If the <code title=attr-input-value><a href=#attr-input-value>name</a></code> attribute is
+ present and has a value that is a <a href=#case-sensitive>case-sensitive</a> match
+ for the string "<code title="">_charset_</code>", then the element's
+ <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute must be
+ omitted.</p>
+
+ <div class=bookkeeping>
+
+ <p>The
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>
+ IDL attribute applies to this element and is
+ in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events do not apply.</p>
+
+ </div>
+
+
+ <h6 id=text-state-and-search-state><span class=secno>4.10.7.1.2 </span><dfn title=attr-input-type-text>Text</dfn> state and <dfn title=attr-input-type-search>Search</dfn> state</h6>
+
+ <!-- v2 idea: applying input masks to <input>, e.g. for entering
+ data with slashes and dashes (ack Greg Kilwein)
+ -->
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state or the <a href=#text-state-and-search-state title=attr-input-type-search>Search</a> state, the rules in
+ this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a one line
+ plain text edit control for the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <p class=note>The difference between the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state and the <a href=#text-state-and-search-state title=attr-input-type-search>Search</a> state is primarily
+ stylistic: on platforms where search fields are distinguished from
+ regular text fields, the <a href=#text-state-and-search-state title=attr-input-type-search>Search</a> state might result in
+ an appearance consistent with the platform's search fields rather
+ than appearing like a regular text field.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ its <a href=#concept-fe-value title=concept-fe-value>value</a> should be editable
+ by the user. User agents must not allow users to insert U+000A LINE
+ FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the
+ element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that contains no U+000A LINE FEED (LF)
+ or U+000D CARRIAGE RETURN (CR) characters.</p>
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
+ <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=telephone-state><span class=secno>4.10.7.1.3 </span><dfn title=attr-input-type-tel>Telephone</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#telephone-state title=attr-input-type-tel>Telephone</a> state, the rules in
+ this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for editing a telephone number given in the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ its <a href=#concept-fe-value title=concept-fe-value>value</a> should be editable
+ by the user. User agents may change the punctuation of <a href=#concept-fe-value title=concept-fe-value>values</a> that the user enters. User
+ agents must not allow users to insert U+000A LINE FEED (LF) or
+ U+000D CARRIAGE RETURN (CR) characters into the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that contains no U+000A LINE FEED (LF)
+ or U+000D CARRIAGE RETURN (CR) characters.</p>
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </div>
+
+ <p class=note>Unlike the <a href=#url-state title=attr-input-type-url>URL</a> and <a href=#e-mail-state title=attr-input-type-email>E-mail</a> types, the <a href=#telephone-state title=attr-input-type-tel>Telephone</a> type does not enforce a
+ particular syntax. This is intentional; in practice, telephone
+ number fields tend to be free-form fields, because there are a wide
+ variety of valid phone numbers. Systems that need to enforce a
+ particular format are encouraged to use the <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute or the <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method
+ to hook into the client-side validation mechanism.</p>
+
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
+ <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=url-state><span class=secno>4.10.7.1.4 </span><dfn title=attr-input-type-url>URL</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#url-state title=attr-input-type-url>URL</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for editing a single <a href=#absolute-url>absolute URL</a> given in the
+ element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the URL represented
+ by its <a href=#concept-fe-value title=concept-fe-value>value</a>. User agents may
+ allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a
+ <a href=#valid-url title="valid URL">valid</a> <a href=#absolute-url>absolute URL</a>, but
+ may also or instead automatically escape characters entered by the
+ user so that the <a href=#concept-fe-value title=concept-fe-value>value</a> is
+ always a <a href=#valid-url title="valid URL">valid</a> <a href=#absolute-url>absolute
+ URL</a> (even if that isn't the actual value seen and edited by
+ the user in the interface). User agents should allow the user to set
+ the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty
+ string. User agents must not allow users to insert U+000A LINE FEED
+ (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially
+ surrounded by spaces</a> that is also an <a href=#absolute-url>absolute
+ URL</a>.</p>
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>, then <a href=#strip-leading-and-trailing-whitespace>strip leading and
+ trailing whitespace</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a <a href=#valid-url title="valid URL">valid</a> <a href=#absolute-url>absolute URL</a>, the
+ element is <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
+ <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>If a document contained the following markup:</p>
+
+ <pre>&lt;input type="url" name="location" list="urls"&gt;
+&lt;datalist id="urls"&gt;
+ &lt;option label="MIME: Format of Internet Message Bodies" value="http://www.ietf.org/rfc/rfc2045"&gt;
+ &lt;option label="HTML 4.01 Specification" value="http://www.w3.org/TR/html4/"&gt;
+ &lt;option label="Form Controls" value="http://www.w3.org/TR/xforms/slice8.html#ui-commonelems-hint"&gt;
+ &lt;option label="Scalable Vector Graphics (SVG) 1.1 Specification" value="http://www.w3.org/TR/SVG/"&gt;
+ &lt;option label="Feature Sets - SVG 1.1 - 20030114" value="http://www.w3.org/TR/SVG/feature.html"&gt;
+ &lt;option label="The Single UNIX Specification, Version 3" value="http://www.unix-systems.org/version3/"&gt;
+&lt;/datalist&gt;
+</pre>
+
+ <p>...and the user had typed "<kbd>www.w3</kbd>", and the user
+ agent had also found that the user had visited
+ <code>http://www.w3.org/Consortium/#membership</code> and
+ <code>http://www.w3.org/TR/XForms/</code> in the recent past, then
+ the rendering might look like this:</p>
+
+ <p><img alt='A text box with an icon on the left followed by the text "www.w3" and a cursor, with a drop down button on the right hand side; with, below, a drop down box containing a list of six URIs on the left, with the first four having grayed out labels on the right; and a scroll bar to the right of the drow down box, indicating further values are available.' src=images/sample-url.png></p>
+
+ <p>The first four URIs in this sample consist of the four URIs in
+ the author-specified list that match the text the user has entered,
+ sorted lexically. Note how the UA is using the knowledge that the
+ values are URIs to allow the user to omit the scheme part and
+ perform intelligent matching on the domain name.</p>
+
+ <p>The last two URIs (and probably many more, given the scrollbar's
+ indications of more values being available) are the matches from
+ the user agent's session history data. This data is not made
+ available to the page DOM. In this particular case, the UA has no
+ titles to provide for those values.</p>
+
+ </div>
+
+
+ <h6 id=e-mail-state><span class=secno>4.10.7.1.5 </span><dfn title=attr-input-type-email>E-mail</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#e-mail-state title=attr-input-type-email>E-mail</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for editing a list of e-mail addresses given in the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the e-mail addresses
+ represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>. If
+ the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is
+ specified, then the user agent should allow the user to select or
+ provide multiple addresses; otherwise, the user agent should act in
+ a manner consistent with expecting the user to provide a single
+ e-mail address. User agents may allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a
+ <a href=#valid-e-mail-address-list>valid e-mail address list</a>. User agents should allow the
+ user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the
+ empty string. User agents must not allow users to insert U+000A LINE
+ FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value title=concept-fe-value>value</a>. User agents may transform the
+ <a href=#concept-fe-value title=concept-fe-value>value</a> for display and editing
+ (e.g. converting punycode in the <a href=#concept-fe-value title=concept-fe-value>value</a> to IDN in the display and vice
+ versa).</p>
+
+ </div>
+
+ <p>If the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>
+ attribute is specified on the element, then the <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if specified, must
+ have a value that is a <a href=#valid-e-mail-address-list>valid e-mail address list</a>;
+ otherwise, the <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+ attribute, if specified, must have a value that is a single
+ <a href=#valid-e-mail-address>valid e-mail address</a>.</p>
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <p><strong>Constraint validation</strong>: If the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is specified
+ on the element, then, while the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a
+ <a href=#valid-e-mail-address-list>valid e-mail address list</a>, the element is
+ <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>; otherwise, while the
+ <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a
+ single <a href=#valid-e-mail-address>valid e-mail address</a>, the element is
+ <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p>
+
+ </div>
+
+ <p>A <dfn id=valid-e-mail-address-list>valid e-mail address list</dfn> is a <a href=#set-of-comma-separated-tokens>set of
+ comma-separated tokens</a>, where each token is itself a
+ <a href=#valid-e-mail-address>valid e-mail address</a>. <span class=impl>To obtain the
+ list of tokens from a <a href=#valid-e-mail-address-list>valid e-mail address list</a>, the
+ user agent must <a href=#split-a-string-on-commas title="split a string on commas">split the
+ string on commas</a>.</span></p>
+
+ <p>A <dfn id=valid-e-mail-address>valid e-mail address</dfn> is a string that matches the
+ ABNF production <code title="">1*(&nbsp;atext&nbsp;/&nbsp;"."&nbsp;)&nbsp;"@"&nbsp;ldh-str&nbsp;1*(&nbsp;"."&nbsp;ldh-str&nbsp;)</code>
+ where <code title="">atext</code> is defined in RFC 5322 section
+ 3.2.3, and <code title="">ldh-str</code> is defined in RFC 1034
+ section 3.5. <a href=#refsABNF>[ABNF]</a> <a href=#refsRFC5322>[RFC5322]</a> <a href=#refsRFC1034>[RFC1034]</a></p> <!-- Domain syntax based on
+ section 3.5 of [RFC1034] and section 2.1 of [RFC1123] -->
+
+ <p class=note>This requirement is a <a href=#willful-violation>willful violation</a>
+ of RFC 5322, which defines a syntax for e-mail addresses that is
+ simultaneously too strict (before the "@" character), too vague
+ (after the "@" character), and too lax (allowing comments, white
+ space characters, and quoted strings in manners unfamiliar to most
+ users) to be of practical use here.</p>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
+ <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=password-state><span class=secno>4.10.7.1.6 </span><dfn title=attr-input-type-password>Password</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#password-state title=attr-input-type-password>Password</a> state, the rules in
+ this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a one line
+ plain text edit control for the element's <a href=#concept-fe-value title=concept-fe-value>value</a>. The user agent should obscure
+ the value so that people other than the user cannot see it.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ its <a href=#concept-fe-value title=concept-fe-value>value</a> should be editable
+ by the user. User agents must not allow users to insert U+000A LINE
+ FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that contains no U+000A LINE FEED (LF)
+ or U+000D CARRIAGE RETURN (CR) characters.</p>
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
+ <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
+ <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>, and
+ <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=date-and-time-state><span class=secno>4.10.7.1.7 </span><dfn title=attr-input-type-datetime>Date and Time</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#date-and-time-state title=attr-input-type-datetime>Date and Time</a> state, the
+ rules in this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ specific <a href=#concept-datetime title=concept-datetime>global date and
+ time</a>. <span class=impl>User agents may display the date and
+ time in whatever time zone is appropriate for the user.</span></p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the <a href=#concept-datetime title=concept-datetime>global date and time</a> represented by
+ its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by
+ <a href=#parse-a-global-date-and-time-string title="parse a global date and time string">parsing a global
+ date and time</a> from it. User agents must not allow the user to
+ set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that
+ is not a <a href=#valid-global-date-and-time-string>valid global date and time string</a> expressed in
+ UTC, though user agents may allow the user to set and view the time
+ in another time zone and silently translate the time to and from the
+ UTC time zone in the <a href=#concept-fe-value title=concept-fe-value>value</a>. If
+ the user agent provides a user interface for selecting a <a href=#concept-datetime title=concept-datetime>global date and time</a>, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a <a href=#valid-global-date-and-time-string>valid
+ global date and time string</a> expressed in UTC representing the
+ user's selection. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-global-date-and-time-string>valid global date and
+ time string</a>.</p> <!-- ok to set out-of-range value, we never
+ know when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>,
+ then adjust the time so that the <a href=#concept-fe-value title=concept-fe-value>value</a> represents the same point in
+ time but expressed in the UTC time zone, otherwise, set it to the
+ empty string instead.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-global-date-and-time-string>valid global date and
+ time string</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-global-date-and-time-string>valid
+ global date and time string</a>.</p>
+
+ <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is
+ expressed in seconds. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1000
+ (which converts the seconds to milliseconds, as used in the other
+ algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 60
+ seconds.</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent may round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-datetime title=concept-datetime>global date and time</a> for which the
+ element would not <a href=#suffering-from-a-step-mismatch title="suffering from a step
+ mismatch">suffer from a step mismatch</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If <a href=#parse-a-global-date-and-time-string title="parse a global date and time
+ string">parsing a global date and time</a> from <var title="">input</var> results in an error, then return an error;
+ otherwise, return the number of milliseconds elapsed from midnight
+ UTC on the morning of 1970-01-01 (the time represented by the value
+ "<code title="">1970-01-01T00:00:00.0Z</code>") to the parsed <a href=#concept-datetime title=concept-datetime>global date and time</a>, ignoring leap
+ seconds.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-global-date-and-time-string>valid global date and time
+ string</a> expressed in UTC that represents the <a href=#concept-datetime title=concept-datetime>global date and time</a> that is <var title="">input</var> milliseconds after midnight UTC on the morning
+ of 1970-01-01 (the time represented by the value "<code title="">1970-01-01T00:00:00.0Z</code>").</p>
+
+ <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-global-date-and-time-string title="parse
+ a global date and time string">parsing a global date and time</a>
+ from <var title="">input</var> results in an error, then return an
+ error; otherwise, return a <code>Date</code> object representing the
+ parsed <a href=#concept-datetime title=concept-datetime>global date and time</a>,
+ expressed in UTC.</p>
+
+ <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows</strong>: Return a <a href=#valid-global-date-and-time-string>valid global date and time
+ string</a> expressed in UTC that represents the <a href=#concept-datetime title=concept-datetime>global date and time</a> that is
+ represented by <var title="">input</var>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, and
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following fragment shows part of a calendar application. A
+ user can specify a date and time for a meeting (in his local time
+ zone, probably, though the user agent can allow the user to change
+ that), and since the submitted data includes the time-zone offset,
+ the application can ensure that the meeting is shown at the correct
+ time regardless of the time zones used by all the participants.</p>
+
+ <pre>&lt;fieldset&gt;
+ &lt;legend&gt;Add Meeting&lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt;Meeting name: &lt;input type=text name="meeting.label"&gt;&lt;/label&gt;
+ &lt;p&gt;&lt;label&gt;Meeting time: &lt;input type=datetime name="meeting.start"&gt;&lt;/label&gt;
+&lt;/fieldset&gt;</pre>
+
+ <p>Had the application used the <code title=attr-input-type-datetime-local><a href=#local-date-and-time-state>datetime-local</a></code> type
+ instead, the calendar application would have also had to explicitly
+ determine which time zone the user intended.</p>
+
+ </div>
+
+
+ <h6 id=date-state><span class=secno>4.10.7.1.8 </span><dfn title=attr-input-type-date>Date</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#date-state title=attr-input-type-date>Date</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ specific <a href=#concept-date title=concept-date>date</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the <a href=#concept-date title=concept-date>date</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-date-string title="parse a date string">parsing a date</a> from it. User
+ agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a
+ <a href=#valid-date-string>valid date string</a>. If the user agent provides a user
+ interface for selecting a <a href=#concept-date title=concept-date>date</a>,
+ then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to
+ a <a href=#valid-date-string>valid date string</a> representing the user's
+ selection. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-date-string>valid date
+ string</a>.</p> <!-- ok to set out-of-range value, we never know
+ when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is not a <a href=#valid-date-string>valid date string</a>, then set it
+ to the empty string instead.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-date-string>valid date
+ string</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-date-string>valid
+ date string</a>.</p>
+
+ <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is
+ expressed in days. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is
+ 86,400,000 (which converts the days to milliseconds, as used in the
+ other algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 1 day.</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent may round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-date title=concept-date>date</a> for which the element would not
+ <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">suffer from a step
+ mismatch</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If <a href=#parse-a-date-string title="parse a date string">parsing
+ a date</a> from <var title="">input</var> results in an error,
+ then return an error; otherwise, return the number of milliseconds
+ elapsed from midnight UTC on the morning of 1970-01-01 (the time
+ represented by the value "<code title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on the
+ morning of the parsed <a href=#concept-date title=concept-date>date</a>,
+ ignoring leap seconds.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-date-string>valid date string</a> that
+ represents the <a href=#concept-date title=concept-date>date</a> that, in UTC,
+ is current <var title="">input</var> milliseconds after midnight UTC
+ on the morning of 1970-01-01 (the time represented by the value
+ "<code title="">1970-01-01T00:00:00.0Z</code>").</p>
+
+ <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-date-string title="parse
+ a date string">parsing a date</a> from <var title="">input</var>
+ results in an error, then return an error; otherwise, return a
+ <code>Date</code> object representing midnight UTC on the morning of
+ the parsed <a href=#concept-date title=concept-date>date</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows</strong>: Return a <a href=#valid-date-string>valid date string</a> that
+ represents the <a href=#concept-date title=concept-date>date</a> current at the
+ time represented by <var title="">input</var> in the UTC
+ time zone.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, and
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=month-state><span class=secno>4.10.7.1.9 </span><dfn title=attr-input-type-month>Month</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#month-state title=attr-input-type-month>Month</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ specific <a href=#concept-month title=concept-month>month</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the <a href=#concept-month title=concept-month>month</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-month-string title="parse a month string">parsing a month</a> from it. User
+ agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a
+ <a href=#valid-month-string>valid month string</a>. If the user agent provides a user
+ interface for selecting a <a href=#concept-month title=concept-month>month</a>,
+ then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to
+ a <a href=#valid-month-string>valid month string</a> representing the user's
+ selection. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-month-string>valid month
+ string</a>.</p> <!-- ok to set out-of-range value, we never know
+ when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is not a <a href=#valid-month-string>valid month string</a>, then set it
+ to the empty string instead.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-month-string>valid month
+ string</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-month-string>valid
+ month string</a>.</p>
+
+ <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is
+ expressed in months. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1
+ (there is no conversion needed as the algorithms use months).</span>
+ The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is
+ 1 month.</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent may round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-month title=concept-month>month</a> for which the element would not
+ <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">suffer from a step
+ mismatch</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If <a href=#parse-a-month-string title="parse a month
+ string">parsing a month</a> from <var title="">input</var>
+ results in an error, then return an error; otherwise, return the
+ number of months between January 1970 and the parsed <a href=#concept-month title=concept-month>month</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-month-string>valid month string</a>
+ that represents the <a href=#concept-month title=concept-month>month</a> that
+ has <var title="">input</var> months between it and January
+ 1970.</p>
+
+ <!-- note - it doesn't matter exactly how many months are "between"
+ two months, so long as the UA implements this consistently. The
+ number is never actually exposed. -->
+
+ <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-month-string title="parse
+ a month string">parsing a month</a> from <var title="">input</var> results in an error, then return an error;
+ otherwise, return a <code>Date</code> object representing midnight
+ UTC on the morning of the first day of the parsed <a href=#concept-month title=concept-month>month</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows</strong>: Return a <a href=#valid-month-string>valid month string</a> that
+ represents the <a href=#concept-month title=concept-month>month</a> current at
+ the time represented by <var title="">input</var> in the UTC
+ time zone.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, and
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=week-state><span class=secno>4.10.7.1.10 </span><dfn title=attr-input-type-week>Week</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#week-state title=attr-input-type-week>Week</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ specific <a href=#concept-week title=concept-week>week</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the <a href=#concept-week title=concept-week>week</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-week-string title="parse a week string">parsing a week</a> from it. User
+ agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a
+ <a href=#valid-week-string>valid week string</a>. If the user agent provides a user
+ interface for selecting a <a href=#concept-week title=concept-week>week</a>,
+ then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to
+ a <a href=#valid-week-string>valid week string</a> representing the user's
+ selection. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-week-string>valid week
+ string</a>.</p> <!-- ok to set out-of-range value, we never know
+ when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is not a <a href=#valid-week-string>valid week string</a>, then set it
+ to the empty string instead.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-week-string>valid week
+ string</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-week-string>valid
+ week string</a>.</p>
+
+ <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is
+ expressed in weeks. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is
+ 604,800,000 (which converts the weeks to milliseconds, as used in
+ the other algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 1
+ week. <span class=impl>The <a href=#concept-input-step-default-base title=concept-input-step-default-base>default step base</a> is
+ &minus;259,200,000 (the start of week 1970-W01).</span></p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent may round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-week title=concept-week>week</a> for which the element would not
+ <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">suffer from a step
+ mismatch</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If <a href=#parse-a-week-string title="parse a week string">parsing
+ a week string</a> from <var title="">input</var> results in an
+ error, then return an error; otherwise, return the number of
+ milliseconds elapsed from midnight UTC on the morning of 1970-01-01
+ (the time represented by the value "<code title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on the
+ morning of the Monday of the parsed <a href=#concept-week title=concept-week>week</a>, ignoring leap seconds.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-week-string>valid week string</a> that
+ represents the <a href=#concept-week title=concept-week>week</a> that, in UTC,
+ is current <var title="">input</var> milliseconds after midnight UTC
+ on the morning of 1970-01-01 (the time represented by the value
+ "<code title="">1970-01-01T00:00:00.0Z</code>").</p>
+
+ <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-week-string title="parse
+ a week string">parsing a week</a> from <var title="">input</var>
+ results in an error, then return an error; otherwise, return a
+ <code>Date</code> object representing midnight UTC on the morning of
+ the Monday of the parsed <a href=#concept-week title=concept-week>week</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows</strong>: Return a <a href=#valid-week-string>valid week string</a> that
+ represents the <a href=#concept-week title=concept-week>week</a> current at the
+ time represented by <var title="">input</var> in the UTC
+ time zone.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, and
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=time-state><span class=secno>4.10.7.1.11 </span><dfn title=attr-input-type-time>Time</dfn> state</h6>
+
+ <!-- v2: allow min="" and max="" to be set such that the range
+ crosses midnight, as in <input type=time min="23:00" max="02:00">
+ (from http://www.w3.org/Bugs/Public/show_bug.cgi?id=7688) -->
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#time-state title=attr-input-type-time>Time</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ specific <a href=#concept-time title=concept-time>time</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the <a href=#concept-time title=concept-time>time</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-time-string title="parse a time string">parsing a time</a> from it. User
+ agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a
+ <a href=#valid-time-string>valid time string</a>. If the user agent provides a user
+ interface for selecting a <a href=#concept-time title=concept-time>time</a>,
+ then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to
+ a <a href=#valid-time-string>valid time string</a> representing the user's
+ selection. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-time-string>valid time
+ string</a>.</p> <!-- ok to set out-of-range value, we never know
+ when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is not a <a href=#valid-time-string>valid time string</a>, then set it
+ to the empty string instead.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-time-string>valid time
+ string</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-time-string>valid
+ time string</a>.</p>
+
+ <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is
+ expressed in seconds. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1000
+ (which converts the seconds to milliseconds, as used in the other
+ algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 60
+ seconds.</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent may round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-time title=concept-time>time</a> for which the element would not
+ <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">suffer from a step
+ mismatch</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If <a href=#parse-a-time-string title="parse a time string">parsing
+ a time</a> from <var title="">input</var> results in an error,
+ then return an error; otherwise, return the number of milliseconds
+ elapsed from midnight to the parsed <a href=#concept-time title=concept-time>time</a> on a day with no time changes.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-time-string>valid time string</a> that
+ represents the <a href=#concept-time title=concept-time>time</a> that is <var title="">input</var> milliseconds after midnight on a day with no
+ time changes.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-time-string title="parse
+ a time string">parsing a time</a> from <var title="">input</var>
+ results in an error, then return an error; otherwise, return a
+ <code>Date</code> object representing the parsed <a href=#concept-time title=concept-time>time</a> in UTC on 1970-01-01.</p>
+
+ <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows</strong>: Return a <a href=#valid-time-string>valid time string</a> that
+ represents the UTC <a href=#concept-time title=concept-time>time</a> component
+ that is represented by <var title="">input</var>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, and
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=local-date-and-time-state><span class=secno>4.10.7.1.12 </span><dfn title=attr-input-type-datetime-local>Local Date and Time</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#local-date-and-time-state title=attr-input-type-datetime-local>Local Date and Time</a>
+ state, the rules in this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>,
+ with no time-zone offset information.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the <a href=#concept-datetime-local title=concept-datetime-local>date and time</a> represented by
+ its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by
+ <a href=#parse-a-local-date-and-time-string title="parse a local date and time string">parsing a date and
+ time</a> from it. User agents must not allow the user to set the
+ <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not
+ a <a href=#valid-local-date-and-time-string>valid local date and time string</a>. If the user agent
+ provides a user interface for selecting a <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>, then the
+ <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a
+ <a href=#valid-local-date-and-time-string>valid local date and time string</a> representing the
+ user's selection. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-local-date-and-time-string>valid local date and
+ time string</a>.</p> <!-- ok to set out-of-range value, we never
+ know when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is not a <a href=#valid-local-date-and-time-string>valid local date and time
+ string</a>, then set it to the empty string instead.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-local-date-and-time-string>valid local date and
+ time string</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-local-date-and-time-string>valid
+ local date and time string</a>.</p>
+
+ <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is
+ expressed in seconds. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1000
+ (which converts the seconds to milliseconds, as used in the other
+ algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 60
+ seconds.</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent may round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a> for which
+ the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a step
+ mismatch">suffer from a step mismatch</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If <a href=#parse-a-local-date-and-time-string title="parse a local date and time
+ string">parsing a date and time</a> from <var title="">input</var> results in an error, then return an error;
+ otherwise, return the number of milliseconds elapsed from midnight
+ on the morning of 1970-01-01 (the time represented by the value
+ "<code title="">1970-01-01T00:00:00.0</code>") to the parsed <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>, ignoring
+ leap seconds.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-local-date-and-time-string>valid local date and time
+ string</a> that represents the date and time that is <var title="">input</var> milliseconds after midnight on the morning of
+ 1970-01-01 (the time represented by the value "<code title="">1970-01-01T00:00:00.0</code>").</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows part of a flight booking
+ application. The application uses an <code><a href=#the-input-element>input</a></code> element
+ with its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute set to
+ <code title=attr-input-type-datetime-local><a href=#local-date-and-time-state>datetime-local</a></code>,
+ and it then interprets the given date and time in the time zone of
+ the selected airport.</p>
+
+ <pre>&lt;fieldset&gt;
+ &lt;legend&gt;Destination&lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt;Airport: &lt;input type=text name=to list=airports&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Departure time: &lt;input type=datetime-local name=totime step=3600&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;/fieldset&gt;
+&lt;datalist id=airports&gt;
+ &lt;option value=ATL label="Atlanta"&gt;
+ &lt;option value=MEM label="Memphis"&gt;
+ &lt;option value=LHR label="London Heathrow"&gt;
+ &lt;option value=LAX label="Los Angeles"&gt;
+ &lt;option value=FRA label="Frankfurt"&gt;
+&lt;/datalist&gt;</pre>
+
+ <p>If the application instead used the <code title=attr-input-type-datetime><a href=#date-and-time-state>datetime</a></code> type, then the
+ user would have to work out the time-zone conversions himself,
+ which is clearly not a good user experience!</p>
+
+ </div>
+
+
+ <h6 id=number-state><span class=secno>4.10.7.1.13 </span><dfn title=attr-input-type-number>Number</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#number-state title=attr-input-type-number>Number</a> state, the rules in
+ this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ number.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the number
+ represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as
+ obtained from applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point
+ number values</a> to it. User agents must not allow the user to
+ set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that
+ is not a <a href=#valid-floating-point-number>valid floating point number</a>. If the user agent
+ provides a user interface for selecting a number, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to the <a href=#best-representation-of-the-number-as-a-floating-point-number title="best representation of the number as a floating point
+ number">best representation of the number representing the user's
+ selection as a floating point number</a>. User agents should
+ allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-floating-point-number>valid floating point
+ number</a>.</p> <!-- ok to set out-of-range value, we never know
+ when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is not a <a href=#valid-floating-point-number>valid floating point number</a>,
+ then set it to the empty string instead.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-floating-point-number>valid floating point
+ number</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-floating-point-number>valid
+ floating point number</a>.</p>
+
+ <p><span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is
+ 1.</span> The <a href=#concept-input-step-default title=concept-input-step-default>default
+ step</a> is 1 (allowing only integers, unless the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute has a non-integer
+ value).</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent may round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest number for
+ which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a step
+ mismatch">suffer from a step mismatch</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing
+ floating point number values</a> to <var title="">input</var>
+ results in an error, then return an error; otherwise, return the
+ resulting number.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-floating-point-number>valid floating point
+ number</a> that represents <var title="">input</var>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=range-state><span class=secno>4.10.7.1.14 </span><dfn title=attr-input-type-range>Range</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#range-state title=attr-input-type-range>Range</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ number, but with the caveat that the exact value is not important,
+ letting UAs provide a simpler interface than they do for the <a href=#number-state title=attr-input-type-number>Number</a> state.</p>
+
+ <div class=impl>
+
+ <p class=note>In this state, the range and step constraints are
+ enforced even during user input, and there is no way to set the
+ value to the empty string.</p>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the number
+ represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as
+ obtained from applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point
+ number values</a> to it. User agents must not allow the user to
+ set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that
+ is not a <a href=#valid-floating-point-number>valid floating point number</a>. If the user agent
+ provides a user interface for selecting a number, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a <a href=#best-representation-of-the-number-as-a-floating-point-number title="best representation of the number as a floating point
+ number">best representation of the number representing the user's
+ selection as a floating point number</a>. User agents must not
+ allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-floating-point-number>valid floating point
+ number</a>.</p> <!-- ok to set out-of-range value, we never know
+ when we might have to represent bogus input -->
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is not a <a href=#valid-floating-point-number>valid floating point number</a>,
+ then set it to a <a href=#valid-floating-point-number>valid floating point number</a> that
+ represents the <a href=#concept-input-value-default-range title=concept-input-value-default-range>default value</a>.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-floating-point-number>valid floating point
+ number</a>. The <a href=#concept-input-min-default title=concept-input-min-default>default
+ minimum</a> is 0. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, if specified, must have a value that is a <a href=#valid-floating-point-number>valid
+ floating point number</a>. The <a href=#concept-input-max-default title=concept-input-max-default>default maximum</a> is 100.</p>
+
+ <p>The <dfn id=concept-input-value-default-range title=concept-input-value-default-range>default
+ value</dfn> is the <a href=#concept-input-min title=concept-input-min>minimum</a>
+ plus half the difference between the <a href=#concept-input-min title=concept-input-min>minimum</a> and the <a href=#concept-input-max title=concept-input-max>maximum</a>, unless the <a href=#concept-input-max title=concept-input-max>maximum</a> is less than the <a href=#concept-input-min title=concept-input-min>minimum</a>, in which case the <a href=#concept-input-value-default-range title=concept-input-value-default-range>default value</a> is
+ the <a href=#concept-input-min title=concept-input-min>minimum</a>.</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-an-underflow>suffering from an
+ underflow</a>, the user agent must set the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a <a href=#valid-floating-point-number>valid floating point
+ number</a> that represents the <a href=#concept-input-min title=concept-input-min>minimum</a>.</p>
+
+ <p>When the element is <a href=#suffering-from-an-overflow>suffering from an overflow</a>,
+ if the <a href=#concept-input-max title=concept-input-max>maximum</a> is not less
+ than the <a href=#concept-input-min title=concept-input-min>minimum</a>, the user
+ agent must set the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a <a href=#valid-floating-point-number>valid floating point
+ number</a> that represents the <a href=#concept-input-max title=concept-input-max>maximum</a>.</p>
+
+ </div>
+
+ <p><span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is
+ 1.</span> The <a href=#concept-input-step-default title=concept-input-step-default>default
+ step</a> is 1 (allowing only integers, unless the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute has a non-integer
+ value).</p>
+
+ <div class=impl>
+
+ <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>,
+ the user agent must round the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest number for
+ which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a step
+ mismatch">suffer from a step mismatch</a>, and which is greater
+ than or equal to the <a href=#concept-input-min title=concept-input-min>minimum</a>,
+ and, if the <a href=#concept-input-max title=concept-input-max>maximum</a> is not
+ less than the <a href=#concept-input-min title=concept-input-min>minimum</a>, which
+ is less than or equal to the <a href=#concept-input-max title=concept-input-max>maximum</a>.</p>
+
+ <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a>, given a string <var title="">input</var>,
+ is as follows</strong>: If applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing
+ floating point number values</a> to <var title="">input</var>
+ results in an error, then return an error; otherwise, return the
+ resulting number.</p>
+
+ <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, given a number <var title="">input</var>,
+ is as follows</strong>: Return a <a href=#valid-floating-point-number>valid floating point
+ number</a> that represents <var title="">input</var>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>, and
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
+ <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes;
+ <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> and
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example of a range control using an autocomplete list
+ with the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute. This
+ could be useful if there are values along the full range of the
+ control that are especially important, such as preconfigured light
+ levels or typical speed limits in a range control used as a speed
+ control. The following markup fragment:</p>
+
+ <pre>&lt;input type="range" min="-100" max="100" value="0" step="10" name="power" list="powers"&gt;
+&lt;datalist id="powers"&gt;
+ &lt;option value="0"&gt;
+ &lt;option value="-30"&gt;
+ &lt;option value="30"&gt;
+ &lt;option value="+50"&gt;
+&lt;/datalist&gt;
+</pre>
+
+ <p>...with the following style sheet applied:</p>
+
+ <pre>input { height: 75px; width: 49px; background: #D5CCBB; color: black; }</pre>
+
+ <p>...might render as:</p>
+
+ <p><img alt="A vertical slider control whose primary color is black and whose background color is beige, with the slider having five tick marks, one long one at each extremity, and three short ones clustered around the midpoint." src=images/sample-range.png><p>Note how the UA determined the orientation of the control from
+ the ratio of the style-sheet-specified height and width properties.
+ The colors were similiarly derived from the style sheet. The tick
+ marks, however, were derived from the markup. In particular, the
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute has not
+ affected the placement of tick marks, the UA deciding to only use
+ the author-specified completion values and then adding longer tick
+ marks at the extremes.</p>
+
+ <p>Note also how the invalid value <code title="">+50</code> was
+ completely ignored.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>For another example, consider the following markup fragment:</p>
+
+ <pre>&lt;input name=x type=range min=100 max=700 step=9.09090909 value=509.090909&gt;</pre>
+
+ <p>A user agent could display in a variety of ways, for instance:</p>
+
+ <p><img alt="As a dial." src=images/sample-range-2a.png></p>
+
+ <p>Or, alternatively, for instance:</p>
+
+ <p><img alt="As a long horizontal slider with tick marks." src=images/sample-range-2b.png></p>
+
+ <p>The user agent could pick which one to display based on the
+ dimensions given in the style sheet. This would allow it to
+ maintain the same resolution for the tick marks, despite the
+ differences in width.</p>
+
+ </div>
+
+
+
+ <h6 id=color-state><span class=secno>4.10.7.1.15 </span><dfn title=attr-input-type-color>Color</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#color-state title=attr-input-type-color>Color</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a color
+ well control, for setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a
+ <a href=#simple-color>simple color</a>.</p>
+
+ <div class=impl>
+
+ <p class=note>In this state, there is always a color picked, and
+ there is no way to set the value to the empty string.</p>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the color represented
+ by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained from
+ applying the <a href=#rules-for-parsing-simple-color-values>rules for parsing simple color values</a> to
+ it. User agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a
+ <a href=#valid-lowercase-simple-color>valid lowercase simple color</a>. If the user agent
+ provides a user interface for selecting a color, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to the result of
+ using the <a href=#rules-for-serializing-simple-color-values>rules for serializing simple color values</a> to
+ the user's selection. User agents must not allow the user to set the
+ <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-simple-color>valid simple
+ color</a>.</p>
+
+ <div class=impl>
+
+ <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
+ follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element is a <a href=#valid-simple-color>valid simple color</a>, then set it to
+ the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element
+ <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>; otherwise, set it to the string
+ "<code title="">#000000</code>".</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes, IDL attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code> and
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code> content attributes;
+ <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code>, and
+ <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> IDL attributes.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>
+
+ <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events apply.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ </div>
+
+
+ <h6 id=checkbox-state><span class=secno>4.10.7.1.16 </span><dfn title=attr-input-type-checkbox>Checkbox</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state, the rules in
+ this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a
+ two-state control that represents the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state. If the
+ element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state
+ is true, the control represents a positive selection, and if it is
+ false, a negative selection. If the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute
+ is set to true, then the control's selection should be obscured as
+ if the control was in a third, indeterminate, state.</p>
+
+ <p class=note>The control is never a true tri-state control, even
+ if the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute
+ is set to true. The <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute
+ only gives the appearance of a third state.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ then: The <a href=#pre-click-activation-steps>pre-click activation steps</a> consist of setting
+ the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to
+ its opposite value (i.e. true if it is false, false if it is true),
+ and of setting the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute
+ to false. The <a href=#canceled-activation-steps>canceled activation steps</a> consist of
+ setting the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> and
+ the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute
+ back to the values they had before the <a href=#pre-click-activation-steps>pre-click activation
+ steps</a> were run. The <a href=#activation-behavior>activation behavior</a> is to
+ <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at the element<!-- It's not
+ cancelable. Once this fires, the control is checked, end of
+ story. -->, then <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> at the
+ element's <a href=#form-owner>form owner</a>.</p>
+
+ <p><strong>Constraint validation</strong>: If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i> and its <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is false, then the
+ element is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">input</var> . <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>When set, overrides the rendering of <a href=#checkbox-state title=attr-input-type-checkbox>checkbox</a> controls so that
+ the current value is not visible.</p>
+
+ </dd>
+
+ </dl><div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes and IDL attributes apply to the element:
+ <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>, and
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code> content attributes;
+ <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-default-on title=dom-input-value-default-on>default/on</a>.</p>
+
+ <p>The <code title=event-input-change><a href=#event-input-change>change</a></code> event applies.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> event does not apply.</p>
+
+ </div>
+
+
+
+ <h6 id=radio-button-state><span class=secno>4.10.7.1.17 </span><dfn title=attr-input-type-radio>Radio Button</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a> state, the rules
+ in this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control
+ that, when used in conjunction with other <code><a href=#the-input-element>input</a></code>
+ elements, forms a <i><a href=#radio-button-group>radio button group</a></i> in which only one
+ control can have its <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state set to true. If
+ the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>
+ state is true, the control represents the selected control in the
+ group, and if it is false, it indicates a control in the group that
+ is not selected.</p>
+
+ <p>The <dfn id=radio-button-group><i>radio button group</i></dfn> that contains an
+ <code><a href=#the-input-element>input</a></code> element <var title="">a</var> also contains all
+ the other <code><a href=#the-input-element>input</a></code> elements <var title="">b</var> that
+ fulfill all of the following conditions:</p>
+
+ <ul><li>The <code><a href=#the-input-element>input</a></code> element <var title="">b</var>'s <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a> state.</li>
+
+ <li>Either <var title="">a</var> and <var title="">b</var> have the
+ same <a href=#form-owner>form owner</a>, or they both have no <a href=#form-owner>form
+ owner</a>.</li>
+
+ <li>They both have a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute, and the value of <var title="">a</var>'s <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is a
+ <a href=#compatibility-caseless>compatibility caseless</a> match for the value of <var title="">b</var>'s <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute.</li>
+
+ </ul><p>A document must not contain an <code><a href=#the-input-element>input</a></code> element whose
+ <i><a href=#radio-button-group>radio button group</a></i> contains only that element.</p>
+
+ <div class=impl>
+
+ <p>When any of the following events occur, if the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is true after
+ the event, the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state of all the
+ other elements in the same <i><a href=#radio-button-group>radio button group</a></i> must be set to
+ false:</p>
+
+ <ul><li>The element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is set to
+ true (for whatever reason).</li>
+
+ <li>The element's <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute is added, removed, or changes value.</li>
+
+ <li>The element's <a href=#form-owner>form owner</a> changes.</li>
+
+ </ul><p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ then: The <a href=#pre-click-activation-steps>pre-click activation steps</a> consist of setting
+ the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to
+ true. The <a href=#canceled-activation-steps>canceled activation steps</a> consist of setting
+ the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to
+ false. The <a href=#activation-behavior>activation behavior</a> is to <a href=#fire-a-simple-event>fire a
+ simple event</a> that bubbles named <code title=event-change>change</code> at the element<!-- It's not
+ cancelable. Once this fires, the control is checked, end of
+ story. -->, then <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> at the
+ element's <a href=#form-owner>form owner</a>.</p>
+
+ <p><strong>Constraint validation</strong>: If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i> and all of the
+ <code><a href=#the-input-element>input</a></code> elements in the <i><a href=#radio-button-group>radio button group</a></i> have a
+ <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> that is
+ false, then the element is <a href=#suffering-from-being-missing>suffering from being
+ missing</a>.</p>
+
+ </div>
+
+ <p class=note>If none of the radio buttons in a <a href=#radio-button-group>radio button
+ group</a> are checked when they are inserted into the document,
+ then they will all be initially unchecked in the interface, until
+ such time as one of them is checked (either by the user or by
+ script).</p>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes and IDL attributes apply to the element:
+ <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> and
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code> content attributes;
+ <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-default-on title=dom-input-value-default-on>default/on</a>.</p>
+
+ <p>The <code title=event-input-change><a href=#event-input-change>change</a></code> event applies.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> event does not apply.</p>
+
+ </div>
+
+
+
+ <h6 id=file-upload-state><span class=secno>4.10.7.1.18 </span><dfn title=attr-input-type-file>File Upload</dfn> state</h6>
+
+ <!-- v2 ideas:
+ * maximum height/width or required ratio for image uploads? - Leons Petrazickis
+ * maximum per-file upload size - Alfonso Mart&iacute;nez de Lizarrondo
+ -->
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state, the rules in this
+ section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a list of
+ <dfn id=concept-input-type-file-selected title=concept-input-type-file-selected>selected files</dfn>,
+ each file consisting of a file name, a file type, and a file body
+ (the contents of the file).</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to change the files on the
+ list, e.g. adding or removing files. Files can be from the
+ filesystem or created on the fly, e.g. a picture taken from a camera
+ connected to the user's device.</p>
+
+ <p><strong>Constraint validation</strong>: If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i> and the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a> is
+ empty, then the element is <a href=#suffering-from-being-missing>suffering from being
+ missing</a>.</p>
+
+ <p>Unless the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>
+ attribute is set, there must be no more than one file in the list of
+ <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected
+ files</a>.</p>
+
+ </div>
+
+ <hr><p>The <dfn id=attr-input-accept title=attr-input-accept><code>accept</code></dfn>
+ attribute may be specified to provide user agents with a hint of
+ what file types the server will be able to accept.</p>
+
+ <p>If specified, the attribute must consist of a <a href=#set-of-comma-separated-tokens>set of
+ comma-separated tokens</a>, each of which must be an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for one of the following:</p>
+
+ <dl><dt>The string <code title="">audio/*</code></dt>
+
+ <dd>Indicates that sound files are accepted.</dd>
+
+ <dt>The string <code title="">video/*</code></dt>
+
+ <dd>Indicates that video files are accepted.</dd>
+
+ <dt>The string <code title="">image/*</code></dt>
+
+ <dd>Indicates that image files are accepted.</dd>
+
+ <dt>A <a href=#valid-mime-type-with-no-parameters>valid MIME type with no parameters</a></dt>
+
+ <dd>Indicates that files of the specified type are accepted.</dd>
+
+ </dl><p>The tokens must not be <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
+ matches for any of the other tokens (i.e. duplicates are not
+ allowed). <span class=impl>To obtain the list of tokens from the
+ attribute, the user agent must <a href=#split-a-string-on-commas title="split a string on
+ commas">split the attribute value on commas</a>.</span></p>
+
+ <div class=impl>
+
+ <p>User agents should prevent the user from selecting files that are
+ not accepted by one (or more) of these tokens.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>For historical reasons, the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute prefixes the
+ filename with the string "<code title="">C:\fakepath\</code>". Some
+ legacy user agents actually included the full path (which was a
+ security vulnerability). As a result of this, obtaining the
+ filename from the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL
+ attribute in a backwards-compatible way is non-trivial. The
+ following function extracts the filename in a suitably compatible
+ manner:</p>
+
+ <pre>function extractFilename(path) {<!--
+ if (path.substr(0, 12) == "C:\\fakepath\\")
+ return path.substr(12);-->
+ var x;
+ x = path.lastIndexOf('\\');
+ if (x &gt;= 0) // Windows-based path
+ return path.substr(x+1);
+ x = path.lastIndexOf('/');
+ if (x &gt;= 0) // Unix-based path
+ return path.substr(x+1);
+ return path; // just the filename
+}</pre>
+
+ <p>This can be used as follows:</p>
+
+ <pre>&lt;p&gt;&lt;input type=file name=image onchange="updateFilename(this.value)"&gt;&lt;/p&gt;
+&lt;p&gt;The name of the file you picked is: &lt;span id="filename"&gt;(none)&lt;/span&gt;&lt;/p&gt;
+&lt;script&gt;
+ function updateFilename(path) {
+ var name = extractFilename(path);
+ document.getElementById('filename').textContent = name;
+ }
+&lt;/script&gt;</pre>
+
+ <!-- How useful this actually is... is unclear. -->
+
+ </div>
+
+ <hr><div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes apply to the element:
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes and IDL attributes apply to the element:
+ <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>, and
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>;
+ <code title=dom-input-files><a href=#dom-input-files>files</a></code> and
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-filename title=dom-input-value-filename>filename</a>.</p>
+
+ <p>The <code title=event-input-change><a href=#event-input-change>change</a></code> event applies.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The element's <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+ attribute must be omitted.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> event does not apply.</p>
+
+ </div>
+
+
+
+ <h6 id=submit-button-state><span class=secno>4.10.7.1.19 </span><dfn title=attr-input-type-submit>Submit Button</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a> state, the rules
+ in this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a button
+ that, when activated, submits the form. <span class=impl>If the
+ element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute,
+ the button's label must be the value of that attribute; otherwise,
+ it must be an implementation-defined string that means "Submit" or
+ some such.</span> The element is a <a href=#concept-button title=concept-button>button</a>, specifically a <a href=#concept-submit-button title=concept-submit-button>submit button</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to activate the element.</p>
+
+ <p>The element's <a href=#activation-behavior>activation behavior</a>, if the element
+ has a <a href=#form-owner>form owner</a>, is to <a href=#concept-form-submit title=concept-form-submit>submit</a> the <a href=#form-owner>form
+ owner</a> from the <code><a href=#the-input-element>input</a></code> element; otherwise, it is
+ to do nothing.</p>
+
+ </div>
+
+ <p>The <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attributes are <a href=#attributes-for-form-submission>attributes
+ for form submission</a>.</p>
+
+ <p class=note>The <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute can
+ be used to make submit buttons that do not trigger the constraint
+ validation.</p>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes and IDL attributes apply to the element:
+ <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and
+ <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> content attributes;
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events do not apply.</p>
+
+ </div>
+
+
+ <h6 id=image-button-state><span class=secno>4.10.7.1.20 </span><dfn title=attr-input-type-image>Image Button</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, the rules
+ in this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> either an
+ image from which a user can select a coordinate and submit the form,
+ or alternatively a button from which the user can submit the
+ form. The element is a <a href=#concept-button title=concept-button>button</a>,
+ specifically a <a href=#concept-submit-button title=concept-submit-button>submit
+ button</a>.</p>
+
+ <hr><p>The image is given by the <dfn id=attr-input-src title=attr-input-src><code>src</code></dfn> attribute. The <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute must be present, and
+ must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</a> referencing a non-interactive, optionally animated,
+ image resource that is neither paged nor scripted.</p>
+
+ <div class=impl>
+
+ <p>When any of the following events occur, unless the user agent
+ cannot support images, or its support for images has been disabled,
+ or the user agent only fetches elements on demand, or the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute's value is the empty
+ string, the user agent must <a href=#resolve-a-url title="resolve a
+ url">resolve</a> the value of the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute, relative to the
+ element, and if that is successful, must <a href=#fetch>fetch</a> the
+ resulting <a href=#absolute-url>absolute URL</a>:</p> <!-- Note how this does NOT
+ happen when the base URL changes. --> <!-- http-origin privacy
+ sensitive -->
+
+ <ul><li>The <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is first set to the
+ <a href=#image-button-state title=attr-input-type-image>Image Button</a> state
+ (possibly when the element is first created), and the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is present.</li>
+
+ <li>The <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is changed back to
+ the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state,
+ and the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is
+ present, and its value has changed since the last time the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute was in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state.</li>
+
+ <li>The <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, and the
+ <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is set or
+ changed.</li>
+
+ </ul><!-- same text in <img> section and similar text elsewhere --><p>Fetching the image must <a href=#delay-the-load-event>delay the load event</a> of the
+ element's document until the <a href=#concept-task title=concept-task>task</a>
+ that is <a href=#queue-a-task title="queue a task">queued</a> by the
+ <a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> (defined below) has been run.</p>
+
+ <p>If the image was successfully obtained, with no network errors,
+ and the image's type is a supported image type, and the image is a
+ valid image of that type, then the image is said to be <dfn id=input-img-available title=input-img-available><i>available</i></dfn>. If this is true
+ before the image is completely downloaded, each <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
+ task">queued</a> by the <a href=#networking-task-source>networking task source</a> while
+ the image is being <a href=#fetch title=fetch>fetched</a> must update
+ the presentation of the image appropriately.</p>
+
+ <p>The user agents should apply the <a href=#content-type-sniffing:-image title="Content-Type
+ sniffing: image">image sniffing rules</a> to determine the type
+ of the image, with the image's <a href=#content-type title=Content-Type>associated
+ Content-Type headers</a> giving the <var title="">official
+ type</var>. If these rules are not applied, then the type of the
+ image must be the type given by the image's <a href=#content-type title=Content-Type>associated Content-Type headers</a>.</p>
+
+ <p>User agents must not support non-image resources with the
+ <code><a href=#the-input-element>input</a></code> element. User agents must not run executable code
+ embedded in the image resource. User agents must only display the
+ first page of a multipage resource. User agents must not allow the
+ resource to act in an interactive fashion, but should honor any
+ animation in the resource.</p>
+
+ <p>The <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>networking task
+ source</a> once the resource has been <a href=#fetch title=fetch>fetched</a>, must, if the download was successful
+ and the image is <i title=input-img-available><a href=#input-img-available>available</a></i>,
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-load>load</code> at the <code><a href=#the-input-element>input</a></code>
+ element; and otherwise, if the fetching process fails without a
+ response from the remote server, or completes but the image is not a
+ valid or supported image, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-error>error</code> on
+ the <code><a href=#the-input-element>input</a></code> element.</p>
+
+ <hr></div>
+
+ <p>The <dfn id=attr-input-alt title=attr-input-alt><code>alt</code></dfn> attribute
+ provides the textual label for the alternative button for users and
+ user agents who cannot use the image. The <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code> attribute must also be present,
+ and must contain a non-empty string.</p>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element supports <a href=#dimension-attributes>dimension
+ attributes</a>.</p>
+
+ <div class=impl>
+
+ <hr><p>If the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is set,
+ and the image is <i title=input-img-available><a href=#input-img-available>available</a></i> and
+ the user agent is configured to display that image, then: The
+ element <a href=#represents>represents</a> a control for selecting a <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>coordinate</a> from
+ the image specified by the <code title=attr-input-src><a href=#attr-input-src>src</a></code>
+ attribute; if the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>, the user agent should
+ allow the user to select this <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>coordinate</a>. The
+ <a href=#activation-behavior>activation behavior</a> in this case consists of taking the
+ user's selected <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>coordinate</a>, and
+ then, if the element has a <a href=#form-owner>form owner</a>, <a href=#concept-form-submit title=concept-form-submit>submitting</a> the <code><a href=#the-input-element>input</a></code>
+ element's <a href=#form-owner>form owner</a> from the <code><a href=#the-input-element>input</a></code>
+ element. If the user activates the control without explicitly
+ selecting a coordinate, then the coordinate (0,0) must be
+ assumed.</p>
+
+ <p>Otherwise, the element <a href=#represents>represents</a> a submit button
+ whose label is given by the value of the <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code> attribute; if the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>, the user agent should
+ allow the user to activate the button. The <a href=#activation-behavior>activation
+ behavior</a> in this case consists of setting the <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>selected
+ coordinate</a> to (0,0), and then, if the element has a
+ <a href=#form-owner>form owner</a>, <a href=#concept-form-submit title=concept-form-submit>submitting</a> the <code><a href=#the-input-element>input</a></code>
+ element's <a href=#form-owner>form owner</a> from the <code><a href=#the-input-element>input</a></code>
+ element.</p>
+
+ <p>The <dfn id=concept-input-type-image-coordinate title=concept-input-type-image-coordinate>selected
+ coordinate</dfn> must consist of an <var title="">x</var>-component
+ and a <var title="">y</var>-component. The coordinates represent the
+ position relative to the edge of the image, with the coordinate
+ space having the positive <var title="">x</var> direction to the
+ right, and the positive <var title="">y</var> direction
+ downwards.</p>
+
+ <p>The <var title="">x</var>-component must be a <a href=#valid-integer>valid
+ integer</a> representing a number <var title="">x</var> in the
+ range <span title="">&minus;(<var title="">border<sub title="">left</sub></var>+<var title="">padding<sub title="">left</sub></var>) &le; <var title="">x</var> &le; <var title="">width</var>+<var title="">border<sub title="">right</sub></var>+<var title="">padding<sub title="">right</sub></var></span>, where <var title="">width</var>
+ is the rendered width of the image, <var title="">border<sub title="">left</sub></var> is the width of the border on the left of
+ the image, <var title="">padding<sub title="">left</sub></var> is
+ the width of the padding on the left of the image, <var title="">border<sub title="">right</sub></var> is the width of the
+ border on the right of the image, and <var title="">padding<sub title="">right</sub></var> is the width of the padding on the right
+ of the image, with all dimensions given in CSS pixels.</p>
+
+ <p>The <var title="">y</var>-component must be a <a href=#valid-integer>valid
+ integer</a> representing a number <var title="">y</var> in the
+ range <span title="">&minus;(<var title="">border<sub title="">top</sub></var>+<var title="">padding<sub title="">top</sub></var>) &le; <var title="">y</var> &le; <var title="">height</var>+<var title="">border<sub title="">bottom</sub></var>+<var title="">padding<sub title="">bottom</sub></var></span>, where <var title="">height</var>
+ is the rendered height of the image, <var title="">border<sub title="">top</sub></var> is the width of the border above the image,
+ <var title="">padding<sub title="">top</sub></var> is the width of
+ the padding above the image, <var title="">border<sub title="">bottom</sub></var> is the width of the border below the
+ image, and <var title="">padding<sub title="">bottom</sub></var> is
+ the width of the padding below the image, with all dimensions given
+ in CSS pixels.</p>
+
+ <p>Where a border or padding is missing, its width is zero CSS
+ pixels.</p>
+
+ <hr></div>
+
+ <p>The <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attributes are <a href=#attributes-for-form-submission>attributes
+ for form submission</a>.</p>
+
+ <div class=bookkeeping>
+
+ <p>The following common <code><a href=#the-input-element>input</a></code> element content
+ attributes and IDL attributes apply to the element:
+ <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code title=attr-input-src><a href=#attr-input-src>src</a></code>, and
+ <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> content attributes;
+ <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute.</p>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
+ in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>, and
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>.</p>
+
+ <p>The element's <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+ attribute must be omitted.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events do not apply.</p>
+
+ </div>
+
+ <p class=note>Many aspects of this state's behavior are similar to
+ the behavior of the <code><a href=#the-img-element>img</a></code> element. Readers are encouraged
+ to read that section, where many of the same requirements are
+ described in more detail.</p>
+
+
+
+ <h6 id=reset-button-state><span class=secno>4.10.7.1.21 </span><dfn title=attr-input-type-reset>Reset Button</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#reset-button-state title=attr-input-type-reset>Reset Button</a> state, the rules
+ in this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a button
+ that, when activated, resets the form. <span class=impl>If the
+ element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute,
+ the button's label must be the value of that attribute; otherwise,
+ it must be an implementation-defined string that means "Reset" or
+ some such.</span> The element is a <a href=#concept-button title=concept-button>button</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to activate the element.</p>
+
+ <p>The element's <a href=#activation-behavior>activation behavior</a>, if the element
+ has a <a href=#form-owner>form owner</a>, is to <a href=#concept-form-reset title=concept-form-reset>reset</a> the <a href=#form-owner>form owner</a>;
+ otherwise, it is to do nothing.</p>
+
+ <p><strong>Constraint validation</strong>: The element is
+ <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute
+ applies to this element and is in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events do not apply.</p>
+
+ </div>
+
+
+ <h6 id=button-state><span class=secno>4.10.7.1.22 </span><dfn title=attr-input-type-button>Button</dfn> state</h6>
+
+ <div class=impl>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#button-state title=attr-input-type-button>Button</a> state, the rules in
+ this section apply.</p>
+
+ </div>
+
+ <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a button
+ with no default behavior. <span class=impl>If the element has a
+ <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, the button's
+ label must be the value of that attribute; otherwise, it must be the
+ empty string.</span> The element is a <a href=#concept-button title=concept-button>button</a>.</p>
+
+ <div class=impl>
+
+ <p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
+ the user agent should allow the user to activate the element. The
+ element's <a href=#activation-behavior>activation behavior</a> is to do nothing.</p>
+
+ <p><strong>Constraint validation</strong>: The element is
+ <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>
+
+ </div>
+
+ <div class=bookkeeping>
+
+ <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute
+ applies to this element and is in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
+ <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
+ <code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
+ <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
+ <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
+ <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
+ <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
+ <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
+ <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
+ <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
+ <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
+ <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
+ <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
+ <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
+ <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
+ <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
+ <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
+ <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
+ <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
+ <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
+ <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
+ <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>
+
+ <p>The following IDL attributes and methods do not apply to the
+ element:
+ <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
+ <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
+ <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
+ <code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
+ <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
+ <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
+ <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
+ <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
+ <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
+
+ <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events do not apply.</p>
+
+ </div>
+
+
+
+ <h5 id=common-input-element-attributes><span class=secno>4.10.7.2 </span>Common <code><a href=#the-input-element>input</a></code> element attributes</h5>
+
+ <div class=impl>
+
+ <p>These attributes only apply to an <code><a href=#the-input-element>input</a></code> element if
+ its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in a
+ state whose definition declares that the attribute applies. When an
+ attribute doesn't apply to an <code><a href=#the-input-element>input</a></code> element, user
+ agents must <a href=#ignore>ignore</a> the attribute, regardless of the
+ requirements and definitions below.</p>
+
+ </div>
+
+
+ <h6 id=the-autocomplete-attribute><span class=secno>4.10.7.2.1 </span>The <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code> attribute</h6>
+
+ <p>User agents sometimes have features for helping users fill forms
+ in, for example prefilling the user's address based on earlier user
+ input.</p>
+
+ <p>The <dfn id=attr-input-autocomplete title=attr-input-autocomplete><code>autocomplete</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The attribute has
+ three states. The <code title=attr-input-autocomplete-on>on</code>
+ keyword maps to the <dfn id=attr-input-autocomplete-on-state title=attr-input-autocomplete-on-state>on</dfn> state, and the
+ <code title=attr-input-autocomplete-off>off</code> keyword maps to
+ the <dfn id=attr-input-autocomplete-off-state title=attr-input-autocomplete-off-state>off</dfn>
+ state. The attribute may also be omitted. The <i>missing value
+ default</i> is the <dfn id=attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</dfn>
+ state.</p>
+
+ <p>The <a href=#attr-input-autocomplete-off-state title=attr-input-autocomplete-off-state>off</a>
+ state indicates either that the control's input data is particularly
+ sensitive (for example the activation code for a nuclear weapon); or
+ that it is a value that will never be reused (for example a
+ one-time-key for a bank login) and the user will therefore have to
+ explicitly enter the data each time, instead of being able to rely
+ on the UA to prefill the value for him; or that the document
+ provides its own autocomplete mechanism and does not want the user
+ agent to provide autocompletion values.</p>
+
+ <p>Conversely, the <a href=#attr-input-autocomplete-on-state title=attr-input-autocomplete-on-state>on</a> state indicates
+ that the value is not particularly sensitive and the user can expect
+ to be able to rely on his user agent to remember values he has
+ entered for that control.</p>
+
+ <p>The <a href=#attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</a> state
+ indicates that the user agent is to use the <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute on the
+ element's <a href=#form-owner>form owner</a> instead. (By default, the <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute of
+ <code><a href=#the-form-element>form</a></code> elements is in the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state.)</p>
+
+ <div class=impl>
+
+ <p>Each <code><a href=#the-input-element>input</a></code> element has a <dfn id=resulting-autocompletion-state>resulting
+ autocompletion state</dfn>, which is either <i title="">on</i> or <i title="">off</i>.</p>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element is in one of the following
+ conditions, the <code><a href=#the-input-element>input</a></code> element's <a href=#resulting-autocompletion-state>resulting
+ autocompletion state</a> is <i title="">on</i>; otherwise, the
+ <code><a href=#the-input-element>input</a></code> element's <a href=#resulting-autocompletion-state>resulting autocompletion
+ state</a> is <i title="">off</i>:</p>
+
+ <ul class=brief><li>Its <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>
+ attribute is in the <a href=#attr-input-autocomplete-on-state title=attr-input-autocomplete-on-state>on</a> state.</li>
+
+ <li>Its <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>
+ attribute is in the <a href=#attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</a> state,
+ and the element has no <a href=#form-owner>form owner</a>.</li>
+
+ <li>Its <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>
+ attribute is in the <a href=#attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</a> state,
+ and the element's <a href=#form-owner>form owner</a>'s <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute is in
+ the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a>
+ state.</li>
+
+ </ul><p>When an <code><a href=#the-input-element>input</a></code> element's <a href=#resulting-autocompletion-state>resulting
+ autocompletion state</a> is <i title="">on</i>, the user agent
+ may store the value entered by the user so that if the user returns
+ to the page, the UA can prefill the form. Otherwise, the user agent
+ should not remember the control's <a href=#concept-fe-value title=concept-fe-value>value</a>, and should not offer past
+ values to the user.</p>
+
+ <p>In addition, if the <a href=#resulting-autocompletion-state>resulting autocompletion state</a>
+ is <i title="">off</i>, <a href=#history-autocomplete>values are
+ reset</a> when <a href=#traverse-the-history title="traverse the history">traversing the
+ history</a>.</p>
+
+ <p>The autocompletion mechanism must be implemented by the user
+ agent acting as if the user had modified the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, and must be done at a time
+ where the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>
+ (e.g. just after the element has been inserted into the document, or
+ when the user agent <a href=#stop-parsing title="stop parsing">stops
+ parsing</a>).</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Banks frequently do not want UAs to prefill login
+ information:</p>
+
+ <pre>&lt;p&gt;&lt;label&gt;Account: &lt;input type="text" name="ac" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;p&gt;&lt;label&gt;PIN: &lt;input type="password" name="pin" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=impl>
+
+ <p>A user agent may allow the user to override the <a href=#resulting-autocompletion-state>resulting
+ autocompletion state</a> and set it to always <i title="">on</i>,
+ always allowing values to be remembered and prefilled), or always <i title="">off</i>, never remembering values. However, the ability to
+ override the <a href=#resulting-autocompletion-state>resulting autocompletion state</a> to <i title="">on</i> should not be trivially accessible, as there are
+ significant security implications for the user if all values are
+ always remembered, regardless of the site's preferences.</p>
+
+ </div>
+
+
+
+ <h6 id=the-list-attribute><span class=secno>4.10.7.2.2 </span>The <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-list title=attr-input-list><code>list</code></dfn>
+ attribute is used to identify an element that lists predefined
+ options suggested to the user.</p>
+
+ <p>If present, its value must be the ID of a <code><a href=#the-datalist-element>datalist</a></code>
+ element in the same document.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=concept-input-list title=concept-input-list>suggestions source
+ element</dfn> is the first element in the document in <a href=#tree-order>tree
+ order</a> to have an ID equal to the value of the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute, if that element is a
+ <code><a href=#the-datalist-element>datalist</a></code> element. If there is no <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute, or if there is no
+ element with that ID, or if the first element with that ID is not a
+ <code><a href=#the-datalist-element>datalist</a></code> element, then there is no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>.</p>
+
+ <p>If there is a <a href=#concept-input-list title=concept-input-list>suggestions source
+ element</a>, then, when the user agent is allowing the user to
+ edit the <code><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value title=concept-fe-value>value</a>, the user agent should offer
+ the suggestions represented by the <a href=#concept-input-list title=concept-input-list>suggestions source element</a> to the
+ user in a manner suitable for the type of control used. The user
+ agent may use the suggestion's <a href=#concept-option-label title=concept-option-label>label</a> to identify the suggestion
+ if appropriate. If the user selects a suggestion, then the
+ <code><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to the selected
+ suggestion's <a href=#concept-option-value title=concept-option-value>value</a>, as if
+ the user had written that value himself.</p>
+
+ <p>User agents must filter the suggestions to hide suggestions that
+ the user would not be allowed to enter as the <code><a href=#the-input-element>input</a></code>
+ element's <a href=#concept-fe-value title=concept-fe-value>value</a>, and should
+ filter the suggestions to hide suggestions that would cause the
+ element to not <a href=#concept-fv-valid title=concept-fv-valid>satisfy its
+ constraints</a>.</p>
+
+ <hr><p>If the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute does
+ not apply, there is no <a href=#concept-input-list title=concept-input-list>suggestions
+ source element</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This URL field offers some suggestions.</p>
+
+ <pre>&lt;label&gt;Homepage: &lt;input name=hp type=url list=hpurls&gt;&lt;/label&gt;
+&lt;datalist id=hpurls&gt;
+ &lt;option value="http://www.google.com/" label="Google"&gt;
+ &lt;option value="http://www.reddit.com/" label="Reddit"&gt;
+&lt;/datalist&gt;</pre>
+
+ <p>Other URLs from the user's history might show also; this is up
+ to the user agent.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This example demonstrates how to design a form that uses the
+ autocompletion list feature while still degrading usefully in
+ legacy user agents.</p>
+
+ <p>If the autocompletion list is merely an aid, and is not
+ important to the content, then simply using a <code><a href=#the-datalist-element>datalist</a></code>
+ element with children <code><a href=#the-option-element>option</a></code> elements is enough. To
+ prevent the values from being rendered in legacy user agents, they
+ should be placed inside the <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute instead of
+ inline.</p>
+
+ <pre>&lt;p&gt;
+ &lt;label&gt;
+ Enter a breed:
+ &lt;input type="text" name="breed" list="breeds"&gt;
+ &lt;datalist id="breeds"&gt;
+ &lt;option value="Abyssinian"&gt;
+ &lt;option value="Alpaca"&gt;
+ &lt;!-- ... --&gt;
+ &lt;/datalist&gt;
+ &lt;/label&gt;
+&lt;/p&gt;</pre>
+
+ <p>However, if the values need to be shown in legacy UAs, then
+ fallback content can be placed inside the <code><a href=#the-datalist-element>datalist</a></code>
+ element, as follows:</p>
+
+ <pre>&lt;p&gt;
+ &lt;label&gt;
+ Enter a breed:
+ &lt;input type="text" name="breed" list="breeds"&gt;
+ &lt;/label&gt;
+ &lt;datalist id="breeds"&gt;
+ &lt;label&gt;
+ or select one from the list:
+ &lt;select name="breed"&gt;
+ &lt;option value=""&gt; (none selected)
+ &lt;option&gt;Abyssinian
+ &lt;option&gt;Alpaca
+ &lt;!-- ... --&gt;
+ &lt;/select&gt;
+ &lt;/label&gt;
+ &lt;/datalist&gt;
+&lt;/p&gt;
+</pre>
+
+ <p>The fallback content will only be shown in UAs that don't
+ support <code><a href=#the-datalist-element>datalist</a></code>. The options, on the other hand, will
+ be detected by all UAs, even though they are not direct children of
+ the <code><a href=#the-datalist-element>datalist</a></code> element.</p>
+
+ <p>Note that if an <code><a href=#the-option-element>option</a></code> element used in a
+ <code><a href=#the-datalist-element>datalist</a></code> is <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code>, it will be selected
+ by default by legacy UAs (because it affects the
+ <code><a href=#the-select-element>select</a></code>), but it will not have any effect on the
+ <code><a href=#the-input-element>input</a></code> element in UAs that support
+ <code><a href=#the-datalist-element>datalist</a></code>.</p>
+
+ </div>
+
+
+
+ <h6 id=the-readonly-attribute><span class=secno>4.10.7.2.3 </span>The <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-readonly title=attr-input-readonly><code>readonly</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a> that controls whether
+ or not the use can edit the form control. <span class=impl>When
+ specified, the element is <i title=concept-input-immutable><a href=#concept-input-immutable>immutable</a></i>.</span></p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute is specified
+ on an <code><a href=#the-input-element>input</a></code> element, the element is <a href=#barred-from-constraint-validation>barred from
+ constraint validation</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, the existing product identifiers
+ cannot be modified, but they are still displayed as part of the
+ form, for consistency with the row representing a new product
+ (where the identifier is not yet filled in).</p>
+
+ <pre>&lt;form action="products.cgi" method=post enctype="multipart/form-data"&gt;
+ &lt;table&gt;
+ &lt;tr&gt; &lt;th&gt; Product ID &lt;th&gt; Product name &lt;th&gt; Price &lt;th&gt; Action
+ &lt;tr&gt;
+ &lt;td&gt; &lt;input readonly name="1.pid" value="H412"&gt;
+ &lt;td&gt; &lt;input required name="1.pname" value="Floor lamp Ulke"&gt;
+ &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="1.pprice" value="49.99"&gt;
+ &lt;td&gt; &lt;button formnovalidate name="action" value="delete:1"&gt;Delete&lt;/button&gt;
+ &lt;tr&gt;
+ &lt;td&gt; &lt;input readonly name="2.pid" value="FG28"&gt;
+ &lt;td&gt; &lt;input required name="2.pname" value="Table lamp Ulke"&gt;
+ &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="2.pprice" value="24.99"&gt;
+ &lt;td&gt; &lt;button formnovalidate name="action" value="delete:2"&gt;Delete&lt;/button&gt;
+ &lt;tr&gt;
+ &lt;td&gt; &lt;input required name="3.pid" value="" pattern="[A-Z0-9]+"&gt;
+ &lt;td&gt; &lt;input required name="3.pname" value=""&gt;
+ &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="3.pprice" value=""&gt;
+ &lt;td&gt; &lt;button formnovalidate name="action" value="delete:3"&gt;Delete&lt;/button&gt;
+ &lt;/table&gt;
+ &lt;p&gt; &lt;button formnovalidate name="action" value="add"&gt;Add&lt;/button&gt; &lt;/p&gt;
+ &lt;p&gt; &lt;button name="action" value="update"&gt;Save&lt;/button&gt; &lt;/p&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+
+
+ <h6 id=the-size-attribute><span class=secno>4.10.7.2.4 </span>The <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-size title=attr-input-size><code>size</code></dfn>
+ attribute gives the number of characters that, in a visual
+ rendering, the user agent is to allow the user to see while editing
+ the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <p>The <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-non-negative-integer>valid non-negative
+ integer</a> greater than zero.</p>
+
+ <div class=impl>
+
+ <p>If the attribute is present, then its value must be parsed using
+ the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>, and if the
+ result is a number greater than zero, then the user agent should
+ ensure that at least that many characters are visible.</p>
+
+ <p>The <code title=dom-input-size><a href=#dom-input-size>size</a></code> IDL attribute is
+ <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative numbers greater than
+ zero</a>.</p>
+
+ </div>
+
+
+
+ <h6 id=the-required-attribute><span class=secno>4.10.7.2.5 </span>The <code title=attr-input-required><a href=#attr-input-required>required</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-required title=attr-input-required><code>required</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. When specified, the
+ element is <dfn id=concept-input-required title=concept-input-required><i>required</i></dfn>.</p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i>, and its <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute applies and is in
+ the mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>, and the
+ element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>, and the
+ element's <a href=#concept-fe-value title=concept-fe-value>value</a> is the empty
+ string, then the element is <a href=#suffering-from-being-missing>suffering from being
+ missing</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following form has two required fields, one for an e-mail
+ address and one for a password. It also has a third field that is
+ only considerd valid if the user types the same password in the
+ password field and this third field.</p>
+
+ <pre>&lt;h1&gt;Create new account&lt;/h1&gt;
+&lt;form action="/newaccount" method=post&gt;
+ &lt;p&gt;
+ &lt;label for="username"&gt;E-mail address:&lt;/label&gt;
+ &lt;input id="username" type=email required name=un&gt;
+ &lt;p&gt;
+ &lt;label for="password1"&gt;Password:&lt;/label&gt;
+ &lt;input id="password1" type=password required name=up&gt;
+ &lt;p&gt;
+ &lt;label for="password2"&gt;Confirm password:&lt;/label&gt;
+ &lt;input id="password2" type=password onforminput="setCustomValidity(value != password1.value ? 'Passwords do not match.' : '')"&gt;
+ &lt;p&gt;
+ &lt;input type=submit value="Create account"&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+
+ <h6 id=the-multiple-attribute><span class=secno>4.10.7.2.6 </span>The <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-multiple title=attr-input-multiple><code>multiple</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a> that indicates whether
+ the user is to be allowed to specify more than one value.</p>
+
+ <div class=example>
+
+ <p>The following extract shows how an e-mail client's "Cc" field
+ could accept multiple e-mail addresses.</p>
+
+ <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc&gt;&lt;/label&gt;</pre>
+
+ <p>If the user had, amongst many friends in his user contacts
+ database, two friends "Arthur Dent" (with address
+ "art@example.net") and "Adam Josh" (with address
+ "adamjosh@example.net"), then, after the user has typed "a", the
+ user agent might suggest these two e-mail addresses to the
+ user.</p>
+
+ <p><img alt="" src=images/sample-email-1.png></p>
+
+ <p>The page could also link in the user's contacts database from the site:</p>
+
+ <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc list=contacts&gt;&lt;/label&gt;
+...
+&lt;datalist id="contacts"&gt;
+ &lt;option value="hedral@damowmow.com"&gt;
+ &lt;option value="pillar@example.com"&gt;
+ &lt;option value="astrophy@cute.example"&gt;
+ &lt;option value="astronomy@science.example.org"&gt;
+&lt;/datalist&gt;</pre>
+
+ <p>Suppose the user had entered "bob@example.net" into this text
+ field, and then started typing a second e-mail address starting
+ with "a". The user agent might show both the two friends mentioned
+ earlier, as well as the "astrophy" and "astronomy" values given in
+ the <code><a href=#the-datalist-element>datalist</a></code> element.</p>
+
+ <p><img alt="" src=images/sample-email-2.png></p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following extract shows how an e-mail client's "Attachments"
+ field could accept multiple files for upload.</p>
+
+ <pre>&lt;label&gt;Attachments: &lt;input type=file multiple name=att&gt;&lt;/label&gt;</pre>
+
+ </div>
+
+
+ <h6 id=the-maxlength-attribute><span class=secno>4.10.7.2.7 </span>The <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-maxlength title=attr-input-maxlength><code>maxlength</code></dfn>
+ attribute<span class=impl>, when it applies,</span> is a <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</a><span class=impl>
+ controlled by the <code><a href=#the-input-element>input</a></code> element's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value
+ flag</a></span>.</p>
+
+ <p>If the <code><a href=#the-input-element>input</a></code> element has a <a href=#maximum-allowed-value-length>maximum allowed
+ value length</a>, then the <a href=#code-point-length>code-point length</a> of the
+ value of the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+ attribute must be equal to or less than the element's <a href=#maximum-allowed-value-length>maximum
+ allowed value length</a>.</p>
+
+ <div class=example>
+
+ <p>The following extract shows how a messaging client's text entry
+ could be arbitrarily restricted to a fixed number of characters,
+ thus forcing any conversion through this medium to be terse and
+ discouraging intelligent discourse.</p>
+
+ <pre>What are you doing? &lt;input name=status maxlength=140&gt;</pre>
+
+ </div>
+
+
+
+ <h6 id=the-pattern-attribute><span class=secno>4.10.7.2.8 </span>The <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-pattern title=attr-input-pattern><code>pattern</code></dfn>
+ attribute specifies a regular expression against which the control's
+ <a href=#concept-fe-value title=concept-fe-value>value</a> is to be checked.</p>
+
+ <p>If specified, the attribute's value must match the JavaScript <i title="">Pattern</i> production. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is not the empty string, and
+ the element's <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>
+ attribute is specified and the attribute's value, when compiled as a
+ JavaScript regular expression with the <code title="">global</code>,
+ <code title="">ignoreCase</code>, and <code title="">multiline</code> flags <em>disabled</em> (see ECMA262
+ Edition 5, sections 15.10.7.2 through 15.10.7.4), compiles
+ successfully but the resulting regular expression does not match the
+ entirety of the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, then the element is
+ <a href=#suffering-from-a-pattern-mismatch>suffering from a pattern mismatch</a>. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ <p class=note>This implies that the regular expression language
+ used for this attribute is the same as that used in JavaScript,
+ except that the <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>
+ attribute must match the entire value, not just any subset (somewhat
+ as if it implied a <code title="">^(?:</code> at the start of the
+ pattern and a <code title="">)$</code> at the end).</p>
+
+ </div>
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element has a <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute specified,
+ authors should include a <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute to give a description of the pattern. User agents may use
+ the contents of this attribute, if it is present, when informing the
+ user that the pattern is not matched, or at any other suitable time,
+ such as in a tooltip or read out by assistive technology when the
+ control gains focus.</p>
+
+ <div class=example>
+ <p>For example, the following snippet:</p>
+ <pre>&lt;label&gt; Part number:
+ &lt;input pattern="[0-9][A-Z]{3}" name="part"
+ title="A part number is a digit followed by three uppercase letters."/&gt;
+&lt;/label&gt;</pre>
+ <p>...could cause the UA to display an alert such as:</p>
+ <pre><samp>A part number is a digit followed by three uppercase letters.
+You cannot complete this form until the field is correct.</samp></pre>
+ </div>
+
+ <p>When a control has a <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute, the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute, if used, must describe
+ the pattern. Additional information could also be included, so long
+ as it assists the user in filling in the control. Otherwise,
+ assistive technology would be impaired.</p>
+
+ <p class=example>For instance, if the title attribute contained
+ the caption of the control, assistive technology could end up saying
+ something like <samp>The text you have entered does not match the
+ required pattern. Birthday</samp>, which is not useful.</p>
+
+ <p>UAs may still show the <code><a href=#the-title-element-0>title</a></code> in non-error situations
+ (for example, as a tooltip when hovering over the control), so
+ authors should be careful not to word <code><a href=#the-title-element-0>title</a></code>s as if an
+ error has necessarily occurred.</p>
+
+
+
+ <h6 id=the-min-and-max-attributes><span class=secno>4.10.7.2.9 </span>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> and <code title=attr-input-max><a href=#attr-input-max>max</a></code> attributes</h6>
+
+ <p>The <dfn id=attr-input-min title=attr-input-min><code>min</code></dfn> and <dfn id=attr-input-max title=attr-input-max><code>max</code></dfn> attributes indicate
+ the allowed range of values for the element.</p>
+
+ <div class=impl>
+
+ <p>Their syntax is defined by the section that defines the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state.</p>
+
+ <p>If the element has a <code title=attr-input-min><a href=#attr-input-min>min</a></code>
+ attribute, and the result of applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> to the value of the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute is a number, then that
+ number is the element's <dfn id=concept-input-min title=concept-input-min>minimum</dfn>; otherwise, if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state
+ defines a <dfn id=concept-input-min-default title=concept-input-min-default>default
+ minimum</dfn>, then that is the <a href=#concept-input-min title=concept-input-min>minimum</a>; otherwise, the element has
+ no <a href=#concept-input-min title=concept-input-min>minimum</a>.</p>
+
+ <p><strong>Constraint validation</strong>: When the element has a
+ <a href=#attr-input-min title=attr-input-min>minimum</a>, and the result of
+ applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> to the string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, and the number
+ obtained from that algorithm is less than the <a href=#attr-input-min title=attr-input-min>minimum</a>, the element is
+ <a href=#suffering-from-an-underflow>suffering from an underflow</a>.</p>
+
+ <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute also
+ defines the <a href=#concept-input-min-zero title=concept-input-min-zero>step
+ base</a>.</p>
+
+ <p>If the element has a <code title=attr-input-max><a href=#attr-input-max>max</a></code>
+ attribute, and the result of applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> to the value of the <code title=attr-input-max><a href=#attr-input-max>max</a></code> attribute is a number, then that
+ number is the element's <dfn id=concept-input-max title=concept-input-max>maximum</dfn>; otherwise, if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state
+ defines a <dfn id=concept-input-max-default title=concept-input-max-default>default
+ maximum</dfn>, then that is the <a href=#concept-input-max title=concept-input-max>maximum</a>; otherwise, the element has
+ no <a href=#concept-input-max title=concept-input-max>maximum</a>.</p>
+
+ <p><strong>Constraint validation</strong>: When the element has a
+ <a href=#attr-input-max title=attr-input-max>maximum</a>, and the result of
+ applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> to the string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, and the number
+ obtained from that algorithm is more than the <a href=#attr-input-max title=attr-input-max>maximum</a>, the element is
+ <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p>
+
+ </div>
+
+ <p>The <code title=attr-input-max><a href=#attr-input-max>max</a></code> attribute's value
+ (the <a href=#concept-input-max title=concept-input-max>maximum</a>) must not be
+ less than the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute's
+ value (its <a href=#concept-input-min title=concept-input-min>minimum</a>).</p>
+
+ <div class=impl>
+
+ <p class=note>If an element has a <a href=#attr-input-max title=attr-input-max>maximum</a> that is less than its <a href=#attr-input-min title=attr-input-min>minimum</a>, then so long as the element
+ has a <a href=#concept-fe-value title=concept-fe-value>value</a>, it will either be
+ <a href=#suffering-from-an-underflow>suffering from an underflow</a> or <a href=#suffering-from-an-overflow>suffering from an
+ overflow</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following date control limits input to dates that are before
+ the 1980s:</p>
+
+ <pre>&lt;input name=bday type=date max="1979-12-31"&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following number control limits input to whole numbers
+ greater than zero:</p>
+
+ <pre>&lt;input name=quantity required type=number min=1 value=1&gt;</pre>
+
+ </div>
+
+
+ <h6 id=the-step-attribute><span class=secno>4.10.7.2.10 </span>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute</h6>
+
+ <p>The <dfn id=attr-input-step title=attr-input-step><code>step</code></dfn>
+ attribute indicates the granularity that is expected (and required)
+ of the <a href=#concept-fe-value title=concept-fe-value>value</a>, by limiting the
+ allowed values. <span class=impl>The section that defines the
+ <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state
+ also defines the <dfn id=concept-input-step-default title=concept-input-step-default>default
+ step</dfn>, the <dfn id=concept-input-step-scale title=concept-input-step-scale>step scale
+ factor</dfn>, and in some cases the <dfn id=concept-input-step-default-base title=concept-input-step-default-base>default step base</dfn>,
+ which are used in processing the attribute as described
+ below.</span></p>
+
+ <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute, if
+ specified, must either have a value that is a <a href=#valid-floating-point-number>valid floating
+ point number</a> that <a href=#rules-for-parsing-floating-point-number-values title="rules for parsing floating
+ point number values">parses</a> to a number that is greater than
+ zero, or must have a value that is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">any</code>".</p>
+
+ <div class=impl>
+
+ <p>The attribute provides the <dfn id=concept-input-step title=concept-input-step>allowed value step</dfn> for the element,
+ as follows:</p>
+
+ <ol><li>If the attribute is absent, then the <a href=#concept-input-step title=concept-input-step>allowed value step</a> is the <a href=#concept-input-step-default title=concept-input-step-default>default step</a> multiplied
+ by the <a href=#concept-input-step-scale title=concept-input-step-scale>step scale
+ factor</a>.</li>
+
+ <li>Otherwise, if the attribute's value is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">any</code>", then there is no <a href=#concept-input-step title=concept-input-step>allowed value step</a>.</li>
+
+ <li>Otherwise, if the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point number
+ values</a>, when they are applied to the attribute's value,
+ return an error, zero, or a number less than zero, then the <a href=#concept-input-step title=concept-input-step>allowed value step</a> is the <a href=#concept-input-step-default title=concept-input-step-default>default step</a> multiplied
+ by the <a href=#concept-input-step-scale title=concept-input-step-scale>step scale
+ factor</a>.</li>
+
+ <li>Otherwise, the <a href=#concept-input-step title=concept-input-step>allowed value
+ step</a> is the number returned by the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing
+ floating point number values</a> when they are applied to the
+ attribute's value, multiplied by the <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a>.</li>
+
+ </ol><p>The <dfn id=concept-input-min-zero title=concept-input-min-zero>step base</dfn> is the
+ result of applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> to the value of the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, unless the element does
+ not have a <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute
+ specified or the result of applying that algorithm is an error, in
+ which case the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>
+ is the <a href=#concept-input-step-default-base title=concept-input-step-default-base>default step
+ base</a>, if one is defined, or zero, if not.</p>
+
+ <p><strong>Constraint validation</strong>: When the element has an
+ <a href=#concept-input-step title=concept-input-step>allowed value step</a>, and the
+ result of applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> to the string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, and that
+ number subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step
+ base</a> is not an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, the element is
+ <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following range control only accepts values in the range
+ 0..1, and allows 256 steps in that range:</p>
+
+ <pre>&lt;input name=opacity type=range min=0 max=1 step=0.00392156863&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following control allows any time in the day to be selected,
+ with any accuracy (e.g. thousandth-of-a-second accuracy or
+ more):</p>
+
+ <pre>&lt;input name=favtime type=time step=any&gt;</pre>
+
+ <p>Normally, time controls are limited to an accuracy of one
+ minute.</p>
+
+ </div>
+
+
+
+
+ <h6 id=the-placeholder-attribute><span class=secno>4.10.7.2.11 </span>The <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> attribute</h6>
+
+ <!-- similar text in the <textarea> section -->
+
+ <p>The <dfn id=attr-input-placeholder title=attr-input-placeholder><code>placeholder</code></dfn>
+ attribute represents a <em>short</em> hint (a word or short phrase)
+ intended to aid the user with data entry. A hint could be a sample
+ value or a brief description of the expected format. The attribute,
+ if specified, must have a value that contains no U+000A LINE FEED
+ (LF) or U+000D CARRIAGE RETURN (CR) characters.</p>
+
+ <p class=note>For a longer hint or other advisory text, the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute is more appropriate.</p>
+
+ <p>The <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>
+ attribute should not be used as an alternative to a
+ <code><a href=#the-label-element>label</a></code>.</p>
+
+ <div class=impl>
+
+ <p>User agents should present this hint to the user, after having
+ <a href=#strip-line-breaks title="strip line breaks">stripped line breaks</a> from it,
+ when the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is
+ the empty string and the control is not focused (e.g. by displaying
+ it inside a blank unfocused control).</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example of a mail configuration user interface that
+ uses the <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>
+ attribute:</p>
+
+ <pre>&lt;fieldset&gt;
+ &lt;legend&gt;Mail Account&lt;/legend&gt;
+ &lt;p&gt;&lt;label&gt;Name: &lt;input type="text" name="fullname" placeholder="John Ratzenberger"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Address: &lt;input type="email" name="address" placeholder="john@example.net"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Password: &lt;input type="password" name="password"&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Description: &lt;input type="text" name="desc" placeholder="My Email Account"&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;/fieldset&gt;</pre>
+
+ </div>
+
+
+
+ <h5 id=common-input-element-apis><span class=secno>4.10.7.3 </span>Common <code><a href=#the-input-element>input</a></code> element APIs</h5>
+
+ <dl class=domintro><dt><var title="">input</var> . <code title=dom-input-value><a href=#dom-input-value>value</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the form control.</p>
+
+ <p>Can be set, to change the value.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if it is
+ set to any value other than the empty string when the control is a
+ file upload control.</p>
+
+ </dd>
+
+ <dt><var title="">input</var> . <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the form
+ control.</p>
+
+ <p>Can be set, to change the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>.</p>
+
+ </dd>
+
+ <dt><var title="">input</var> . <code title=dom-input-files><a href=#dom-input-files>files</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code>FileList</code> object listing the <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a> of
+ the form control.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if the
+ control isn't a file control.</p>
+
+ </dd>
+
+ <dt><var title="">input</var> . <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns a <code>Date</code> object representing the form
+ control's <a href=#concept-fe-value title=concept-fe-value>value</a>, if
+ applicable; otherwise, returns null.</p>
+
+ <p>Can be set, to change the value.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if the
+ control isn't date- or time-based.</p>
+
+ </dd>
+
+ <dt><var title="">input</var> . <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns a number representing the form control's <a href=#concept-fe-value title=concept-fe-value>value</a>, if applicable; otherwise,
+ returns null.</p>
+
+ <p>Can be set, to change the value.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if the
+ control is neither date- or time-based nor numeric.</p>
+
+ </dd>
+
+ <dt><var title="">input</var> . <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp</a></code>( [ <var title="">n</var> ] )</dt>
+ <dt><var title="">input</var> . <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown</a></code>( [ <var title="">n</var> ] )</dt>
+
+ <dd>
+
+ <p>Changes the form control's <a href=#concept-fe-value title=concept-fe-value>value</a> by the value given in the
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute, multiplied by
+ <var title="">n</var>. The default is 1.</p>
+
+ <p>Throws <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if the control
+ is neither date- or time-based nor numeric, if the <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute's value is "<code title="">any</code>", if the current <a href=#concept-fe-value title=concept-fe-value>value</a> could not be parsed, or if
+ stepping in the given direction by the given amount would take the
+ value out of range.</p>
+
+ </dd>
+
+ <dt><var title="">input</var> . <code title=dom-input-list><a href=#dom-input-list>list</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#the-datalist-element>datalist</a></code> element indicated by the
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute.</p>
+
+ </dd>
+
+ <dt><var title="">input</var> . <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#the-option-element>option</a></code> element from the
+ <code><a href=#the-datalist-element>datalist</a></code> element indicated by the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute that matches the
+ form control's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-input-value title=dom-input-value><code>value</code></dfn> IDL
+ attribute allows scripts to manipulate the <a href=#concept-fe-value title=concept-fe-value>value</a> of an <code><a href=#the-input-element>input</a></code>
+ element. The attribute is in one of the following modes, which
+ define its behavior:</p>
+
+ <dl><dt><dfn id=dom-input-value-value title=dom-input-value-value>value</dfn>
+
+ <dd>On getting, it must return the current <a href=#concept-fe-value title=concept-fe-value>value</a> of the element. On setting,
+ it must set the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the new value, set the
+ element's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value
+ flag</a> to true, and then invoke the <a href=#value-sanitization-algorithm>value sanitization
+ algorithm</a>, if the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state
+ defines one.</dd>
+
+ <dt><dfn id=dom-input-value-default title=dom-input-value-default>default</dfn>
+
+ <dd>On getting, if the element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, it must return
+ that attribute's value; otherwise, it must return the empty
+ string. On setting, it must set the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute to the new
+ value.</dd>
+
+ <dt><dfn id=dom-input-value-default-on title=dom-input-value-default-on>default/on</dfn>
+
+ <dd>On getting, if the element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, it must return
+ that attribute's value; otherwise, it must return the string "<code title="">on</code>". On setting, it must set the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute to the new
+ value.</dd>
+
+ <dt><dfn id=dom-input-value-filename title=dom-input-value-filename>filename</dfn>
+
+ <dd>On getting, it must return the string "<code title="">C:\fakepath\</code>" followed by the filename of the first
+ file in the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>, if
+ any, or the empty string if the list is empty. On setting, if the
+ new value is the empty string, it must empty the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>;
+ otherwise, it must throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code>
+ exception.</dd>
+
+ </dl><hr><p>The <dfn id=dom-input-checked title=dom-input-checked><code>checked</code></dfn> IDL
+ attribute allows scripts to manipulate the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of an
+ <code><a href=#the-input-element>input</a></code> element. On getting, it must return the current
+ <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the element;
+ and on setting, it must set the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to the new value and
+ set the element's <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness
+ flag</a> to true.</p>
+
+ <hr><p>The <dfn id=dom-input-files title=dom-input-files><code>files</code></dfn> IDL
+ attribute allows scripts to access the element's <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>. On
+ getting, if the IDL attribute applies, it must return a
+ <code>FileList</code> object that represents the current <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>. The
+ same object must be returned until the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>
+ changes. If the IDL attribute does not apply, then it must instead
+ throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception. <a href=#refsFILEAPI>[FILEAPI]</a></p>
+
+ <hr><p>The <dfn id=dom-input-valueasdate title=dom-input-valueAsDate><code>valueAsDate</code></dfn> IDL
+ attribute represents the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element, interpreted
+ as a date.</p>
+
+ <p>On getting, if the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> attribute does not
+ apply, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state, then
+ return null. Otherwise, run the <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</a> defined for that state;
+ if the algorithm returned a <code>Date</code> object, then return
+ it, otherwise, return null.</p>
+
+ <p>On setting, if the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> attribute does not
+ apply, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state, then
+ throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception; otherwise, if
+ the new value is null, then set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to the empty
+ string; otherwise, run the <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, as defined for that
+ state, on the new value, and set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to resulting
+ string.</p>
+
+ <hr><p>The <dfn id=dom-input-valueasnumber title=dom-input-valueAsNumber><code>valueAsNumber</code></dfn> IDL
+ attribute represents the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element, interpreted as a number.</p>
+
+ <p>On getting, if the <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> attribute does
+ not apply, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state, then
+ return a Not-a-Number (NaN) value. Otherwise, if the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAs<em>Date</em></a></code>
+ attribute applies, run the <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a
+ string to a <code>Date</code> object</a> defined for that state;
+ if the algorithm returned a <code>Date</code> object, then return
+ the <i>time value</i> of the object (the number of milliseconds from
+ midnight UTC the morning of 1970-01-01 to the time represented by
+ the <code>Date</code> object), otherwise, return a Not-a-Number
+ (NaN) value. Otherwise, run the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> defined for that state; if the algorithm
+ returned a number, then return it, otherwise, return a Not-a-Number
+ (NaN) value.</p>
+
+ <p>On setting, if the <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> attribute does
+ not apply, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state, then
+ throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception. Otherwise, if
+ the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAs<em>Date</em></a></code>
+ attribute applies, run the <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a> defined for that state,
+ passing it a <code>Date</code> object whose <i>time value</i> is the
+ new value, and set the <a href=#concept-fe-value title=concept-fe-value>value</a>
+ of the element to resulting string. Otherwise, run the <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, as defined for that state, on the new
+ value, and set the <a href=#concept-fe-value title=concept-fe-value>value</a> of
+ the element to resulting string.</p>
+
+ <hr><p>The <dfn id=dom-input-stepdown title=dom-input-stepDown><code>stepDown(<var title="">n</var>)</code></dfn> and <dfn id=dom-input-stepup title=dom-input-stepUp><code>stepUp(<var title="">n</var>)</code></dfn> methods, when invoked, must run the
+ following algorithm:</p>
+
+ <ol><li><p>If the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
+ <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods do not
+ apply, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state, then
+ throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception, and abort these
+ steps.</li>
+
+ <li><p>If the element has no <a href=#concept-input-step title=concept-input-step>allowed value step</a>, then throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception, and abort these
+ steps.</li>
+
+ <li><p>If applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
+ string to a number</a> to the string given by the element's
+ <a href=#concept-fe-value title=concept-fe-value>value</a> results in an error,
+ then throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception, and abort
+ these steps; otherwise, let <var title="">value</var> be the result
+ of that algorithm.</li>
+
+ <li><p>Let <var title="">n</var> be the argument, or 1 if the
+ argument was omitted.</li>
+
+ <li><p>Let <var title="">delta</var> be the <a href=#concept-input-step title=concept-input-step>allowed value step</a> multiplied by
+ <var title="">n</var>.</li>
+
+ <li><p>If the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> method, negate <var title="">delta</var>.</li>
+
+ <li><p>Let <var title="">value</var> be the result of adding <var title="">delta</var> to <var title="">value</var>.</li>
+ <li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a>, and the <var title="">value</var> is less than that <a href=#concept-input-min title=concept-input-min>minimum</a>, then throw a
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
+ <li><p>If the element has a <a href=#concept-input-max title=concept-input-max>maximum</a>, and the <var title="">value</var> is greater than that <a href=#concept-input-max title=concept-input-max>maximum</a>, then throw a
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
+ <li><p>Let <var title="">value as string</var> be the result of
+ running the <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
+ number to a string</a>, as defined for the <code><a href=#the-input-element>input</a></code>
+ element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's
+ current state, on <var title="">value</var>.</li>
+
+ <li><p>Set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the
+ element to <var title="">value as string</var>.</li>
+
+ </ol><hr><p>The <dfn id=dom-input-list title=dom-input-list><code>list</code></dfn> IDL
+ attribute must return the current <a href=#concept-input-list title=concept-input-list>suggestions source element</a>, if
+ any, or null otherwise.</p>
+
+ <p>The <dfn id=dom-input-selectedoption title=dom-input-selectedOption><code>selectedOption</code></dfn>
+ IDL attribute must return the first <code><a href=#the-option-element>option</a></code> element, in
+ <a href=#tree-order>tree order</a>, to be a child of the <a href=#concept-input-list title=concept-input-list>suggestions source element</a> and
+ whose <a href=#concept-option-value title=concept-option-value>value</a> matches the
+ <code><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value title=concept-fe-value>value</a>, if any. If there is no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>, or if
+ it contains no matching <code><a href=#the-option-element>option</a></code> element, then the <code title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code> attribute
+ must return null.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=common-event-behaviors><span class=secno>4.10.7.4 </span>Common event behaviors</h5>
+
+ <p>When the <dfn id=event-input-input title=event-input-input><code>input</code></dfn>
+ event applies, any time the user causes the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to change, the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that
+ bubbles named <code title=event-input>input</code> at the
+ <code><a href=#the-input-element>input</a></code> element, then <a href=#broadcast-forminput-events>broadcast <code title=event-forminput>forminput</code> events</a> at the
+ <code><a href=#the-input-element>input</a></code> element's <a href=#form-owner>form owner</a>. User agents
+ may wait for a suitable break in the user's interaction before
+ queuing the task; for example, a user agent could wait for the user
+ to have not hit a key for 100ms, so as to only fire the event when
+ the user pauses, instead of continuously for each keystroke.</p>
+ <!-- same text is present in the <textarea> section -->
+
+ <p class=example>Examples of a user changing the element's <a href=#concept-fe-value title=concept-fe-value>value</a> would include the user typing
+ into a text field, pasting a new value into the field, or undoing an
+ edit in that field. Some user interactions do not cause changes to
+ the value, e.g. hitting the "delete" key in an empty text field, or
+ replacing some text in the field with text from the clipboard that
+ happens to be exactly the same text.</p>
+
+ <p>When the <dfn id=event-input-change title=event-input-change><code>change</code></dfn> event applies,
+ if the element does not have an <a href=#activation-behavior>activation behavior</a>
+ defined but uses a user interface that involves an explicit commit
+ action, then any time the user commits a change to the element's
+ <a href=#concept-fe-value title=concept-fe-value>value</a> or list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>, the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that bubbles named <code title=event-change>change</code> at the <code><a href=#the-input-element>input</a></code>
+ element, then <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> at the
+ <code><a href=#the-input-element>input</a></code> element's <a href=#form-owner>form owner</a>.</p>
+
+ <p class=example>An example of a user interface with a commit
+ action would be a <a href=#file-upload-state title=attr-input-type-file>File
+ Upload</a> control that consists of a single button that brings
+ up a file selection dialog: when the dialog is closed, if that the
+ <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>file selection</a>
+ changed as a result, then the user has committed a new <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>file selection</a>.</p>
+
+ <p class=example>Another example of a user interface with a commit
+ action would be a <a href=#date-state title=attr-input-type-date>Date</a>
+ control that allows both text-based user input and user selection
+ from a drop-down calendar: while text input might not have an
+ explicit commit step, selecting a date from the drop down calendar
+ and then dismissing the drop down would be a commit action.</p>
+
+ <p>When the user agent changes the element's <a href=#concept-fe-value title=concept-fe-value>value</a> on behalf of the user (e.g. as
+ part of a form prefilling feature), the user agent must follow these
+ steps:</p>
+
+ <ol><li>If the <code title=event-input-input><a href=#event-input-input>input</a></code> event
+ applies, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that bubbles named <code title=event-input>input</code> at the <code><a href=#the-input-element>input</a></code>
+ element.</li>
+
+ <li>If the <code title=event-input-input><a href=#event-input-input>input</a></code> event
+ applies, <a href=#broadcast-forminput-events>broadcast <code title=event-forminput>forminput</code> events</a> at the
+ <code><a href=#the-input-element>input</a></code> element's <a href=#form-owner>form owner</a>.</li>
+
+ <li>If the <code title=event-input-change><a href=#event-input-change>change</a></code> event
+ applies, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that bubbles named <code title=event-change>change</code> at the <code><a href=#the-input-element>input</a></code>
+ element.</li>
+
+ <li>If the <code title=event-input-change><a href=#event-input-change>change</a></code> event
+ applies, <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> at the
+ <code><a href=#the-input-element>input</a></code> element's <a href=#form-owner>form owner</a>.</li>
+
+ </ol><p class=note>In addition, when the <code title=event-input-change><a href=#event-input-change>change</a></code> event applies, <code title=event-change>change</code> events can also be fired as part
+ of the element's <a href=#activation-behavior>activation behavior</a> and as part of the
+ <a href=#unfocusing-steps>unfocusing steps</a>.</p>
+
+ <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#user-interaction-task-source>user interaction task
+ source</a>.</p>
+
+ </div>
+
+
+
+ <h4 id=the-button-element><span class=secno>4.10.8 </span>The <dfn><code>button</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, and <a href=#category-submit title=category-submit>submittable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <a href=#interactive-content>interactive content</a> descendant.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code></dd>
+ <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code></dd>
+ <dd><code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code></dd>
+ <dd><code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code></dd>
+ <dd><code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code></dd>
+ <dd><code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code></dd>
+ <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code></dd>
+ <dd><code title=attr-button-type><a href=#attr-button-type>type</a></code></dd>
+ <dd><code title=attr-button-value><a href=#attr-button-value>value</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlbuttonelement>HTMLButtonElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
+ attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute DOMString <a href=#dom-fs-formaction title=dom-fs-formAction>formAction</a>;
+ attribute DOMString <a href=#dom-fs-formenctype title=dom-fs-formEnctype>formEnctype</a>;
+ attribute DOMString <a href=#dom-fs-formmethod title=dom-fs-formMethod>formMethod</a>;
+ attribute DOMString <a href=#dom-fs-formnovalidate title=dom-fs-formNoValidate>formNoValidate</a>;
+ attribute DOMString <a href=#dom-fs-formtarget title=dom-fs-formTarget>formTarget</a>;
+ attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
+ attribute DOMString <a href=#dom-button-type title=dom-button-type>type</a>;
+ attribute DOMString <a href=#dom-button-value title=dom-button-value>value</a>;
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-button-element>button</a></code> element <a href=#represents>represents</a> a
+ button. <span class=impl>If the element is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent
+ should allow the user to activate the button.</span></p>
+
+ <p>The element is a <a href=#concept-button title=concept-button>button</a>.</p>
+
+ <p>The <dfn id=attr-button-type title=attr-button-type><code>type</code></dfn>
+ attribute controls the behavior of the button when it is activated.
+ It is an <a href=#enumerated-attribute>enumerated attribute</a>. The following table
+ lists the keywords and states for the attribute &mdash; the keywords
+ in the left column map to the states in the cell in the second
+ column on the same row as the keyword.</p>
+
+ <table><thead><tr><th> Keyword
+ <th> State
+ <th> Brief description
+ <tbody><tr><td><dfn id=attr-button-type-submit title=attr-button-type-submit><code>submit</code></dfn>
+ <td><a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
+ <td>Submits the form.
+ <tr><td><dfn id=attr-button-type-reset title=attr-button-type-reset><code>reset</code></dfn>
+ <td><a href=#attr-button-type-reset-state title=attr-button-type-reset-state>Reset Button</a>
+ <td>Resets the form.
+ <tr><td><dfn id=attr-button-type-button title=attr-button-type-button><code>button</code></dfn>
+ <td><a href=#attr-button-type-button-state title=attr-button-type-button-state>Button</a>
+ <td>Does nothing.
+ </table><p>The <i>missing value default</i> is the <a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
+ state.</p>
+
+ <p>If the <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute is in
+ the <a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
+ state, the element is specifically a <a href=#concept-submit-button title=concept-submit-button>submit button</a>.</p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If the <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute is in the <a href=#attr-button-type-reset-state title=attr-button-type-reset-state>Reset Button</a> state or
+ the <a href=#attr-button-type-button-state title=attr-button-type-button-state>Button</a> state,
+ the element is <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>
+
+ <p>If the element is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, the <a href=#activation-behavior>activation
+ behavior</a> of the <code><a href=#the-button-element>button</a></code> element is to run the
+ steps defined in the following list for the current state of the
+ element's <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute.</p>
+
+ <dl><dt> <dfn id=attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</dfn> </dt>
+
+ <dd><p>If the element has a <a href=#form-owner>form owner</a>, the element
+ must <a href=#concept-form-submit title=concept-form-submit>submit</a> the <a href=#form-owner>form
+ owner</a> from the <code><a href=#the-button-element>button</a></code> element.</dd>
+
+ <dt> <dfn id=attr-button-type-reset-state title=attr-button-type-reset-state>Reset Button</dfn> </dt>
+
+ <dd><p>If the element has a <a href=#form-owner>form owner</a>, the element
+ must <a href=#concept-form-reset title=concept-form-reset>reset</a> the <a href=#form-owner>form
+ owner</a>.</dd>
+
+ <dt> <dfn id=attr-button-type-button-state title=attr-button-type-button-state>Button</dfn>
+
+ <dd><p>Do nothing.</dd>
+
+ </dl></div>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-button-element>button</a></code> element with its
+ <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute represents the element's name. The <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make
+ the control non-interactive and to prevent its value from being
+ submitted. The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
+ attribute controls focus. The <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attributes are
+ <a href=#attributes-for-form-submission>attributes for form submission</a>.</p>
+
+ <p class=note>The <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute can
+ be used to make submit buttons that do not trigger the constraint
+ validation.</p>
+
+ <p>The <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> must not be specified
+ if the element's <code title=attr-button-type><a href=#attr-button-type>type</a></code>
+ attribute is not in the <a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
+ state.</p>
+
+ <p>The <dfn id=attr-button-value title=attr-button-value><code>value</code></dfn>
+ attribute gives the element's value for the purposes of form
+ submission. The element's <a href=#concept-fe-value title=concept-fe-value>value</a> is the value of the element's
+ <code title=attr-button-value><a href=#attr-button-value>value</a></code> attribute, if there is
+ one, or the empty string otherwise.</p>
+
+ <p class=note>A button (and its value) is only included in the
+ form submission if the button itself was used to initiate the form
+ submission.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-button-value title=dom-button-value><code>value</code></dfn> and
+ <dfn id=dom-button-type title=dom-button-type><code>type</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name.</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides a list
+ of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
+ element's forms API.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following button is labeled "Show hint" and pops up a dialog
+ box when activated:</p>
+
+ <pre>&lt;button type=button
+ onclick="alert('This 15-20 minute piece was composed by George Gershwin.')"&gt;
+ Show hint
+&lt;/button&gt;</pre>
+
+ </div>
+
+
+
+
+ <h4 id=the-select-element><span class=secno>4.10.9 </span>The <dfn><code>select</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, and <a href=#category-reset title=category-reset>resettable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-option-element>option</a></code> or <code><a href=#the-optgroup-element>optgroup</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code></dd>
+ <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code></dd>
+ <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code></dd>
+ <dd><code title=attr-select-size><a href=#attr-select-size>size</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlselectelement>HTMLSelectElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
+ attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute boolean <a href=#dom-select-multiple title=dom-select-multiple>multiple</a>;
+ attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
+ attribute unsigned long <a href=#dom-select-size title=dom-select-size>size</a>;
+
+ readonly attribute DOMString <a href=#dom-select-type title=dom-select-type>type</a>;
+
+ readonly attribute <a href=#htmloptionscollection>HTMLOptionsCollection</a> <a href=#dom-select-options title=dom-select-options>options</a>;
+ attribute unsigned long <a href=#dom-select-length title=dom-select-length>length</a>;
+ caller getter any <a href=#dom-select-item title=dom-select-item>item</a>(in unsigned long index);
+ caller getter any <a href=#dom-select-nameditem title=dom-select-namedItem>namedItem</a>(in DOMString name);
+ void <a href=#dom-select-add title=dom-select-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in optional <a href=#htmlelement>HTMLElement</a> before);
+ void <a href=#dom-select-add title=dom-select-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in long before);
+ void <a href=#dom-select-remove title=dom-select-remove>remove</a>(in long index);
+
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-select-selectedoptions title=dom-select-selectedOptions>selectedOptions</a>;
+ attribute long <a href=#dom-select-selectedindex title=dom-select-selectedIndex>selectedIndex</a>;
+ attribute DOMString <a href=#dom-select-value title=dom-select-value>value</a>;
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+};</pre>
+ </dd>
+ </dl><!-- Proposals for v2:
+ * <select value=""> as an alternative to <option selected>
+ http://developers.slashdot.org/comments.pl?sid=426306&cid=22142072
+ <Philip`> http://www.ipiao.com.cn/ does <select size="1" name="to"><script>City_Default="PEK"</script><SCRIPT language=javascript
+ src="/js/flightcity.js"></SCRIPT></select> which is the kind of thing that could be much simpler with <select value="PEK">
+ * a way to make the <select> not have a default value at all (ack
+ or to have a "placeholer" like value that doesn't count as a value being selected but shows a prompt until a value is selected
+ * once we can have no default, a way to require="" a value.
+ ack Weston Ruter: http://weston.ruter.net/projects/test-cases/html-select-element/
+ q.v. http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-November/017583.html
+ --><p>The <code><a href=#the-select-element>select</a></code> element represents a control for
+ selecting amongst a set of options.</p>
+
+ <p>The <dfn id=attr-select-multiple title=attr-select-multiple><code>multiple</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. If the attribute is
+ present, then the <code><a href=#the-select-element>select</a></code> element
+ <a href=#represents>represents</a> a control for selecting zero or more options
+ from the <a href=#concept-select-option-list title=concept-select-option-list>list of
+ options</a>. If the attribute is absent, then the
+ <code><a href=#the-select-element>select</a></code> element <a href=#represents>represents</a> a control for
+ selecting a single option from the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>
+
+ <p>The <dfn id=concept-select-option-list title=concept-select-option-list>list of options</dfn>
+ for a <code><a href=#the-select-element>select</a></code> element consists of all the
+ <code><a href=#the-option-element>option</a></code> element children of the <code><a href=#the-select-element>select</a></code>
+ element, and all the <code><a href=#the-option-element>option</a></code> element children of all the
+ <code><a href=#the-optgroup-element>optgroup</a></code> element children of the <code><a href=#the-select-element>select</a></code>
+ element, in <a href=#tree-order>tree order</a>.</p>
+
+ <p>The <dfn id=attr-select-size title=attr-select-size><code>size</code></dfn>
+ attribute gives the number of options to show to the user. The <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute, if specified, must
+ have a value that is a <a href=#valid-non-negative-integer>valid non-negative integer</a>
+ greater than zero. If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is present,
+ then the <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute's
+ default value is 4. If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent,
+ then the <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute's
+ default value is 1.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=concept-select-size title=concept-select-size>display size</dfn> of a
+ <code><a href=#the-select-element>select</a></code> element is the result of applying the
+ <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to the value of
+ element's <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute, if it
+ has one and parsing it is successful. If applying those rules to the
+ attribute's value is not successful, or if the <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute is absent, the
+ element's <a href=#concept-select-size title=concept-select-size>display size</a> is
+ the default value of the attribute.</p>
+
+ <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
+ attribute is absent, and the element is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent
+ should allow the user to pick an <code><a href=#the-option-element>option</a></code> element in its
+ <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that
+ is itself not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>. Upon this
+ <code><a href=#the-option-element>option</a></code> element being <dfn id=concept-select-pick title=concept-select-pick>picked</dfn> (either through a click, or
+ through unfocusing the element after changing its value, or through
+ a <a href=#using-the-option-element-to-define-a-command title=option-command>menu command</a>, or through any
+ other mechanism), and before the relevant user interaction event
+ <!-- interaction event spec point --> is queued (e.g. before the
+ <code title=event-click><a href=#event-click>click</a></code> event), the user agent must
+ set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the
+ picked <code><a href=#the-option-element>option</a></code> element to true and then <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named
+ <code title=event-change>change</code> at the <code><a href=#the-select-element>select</a></code>
+ element, using the <a href=#user-interaction-task-source>user interaction task source</a> as the
+ task source, then <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> at the
+ element's <a href=#form-owner>form owner</a>.</p>
+
+ <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
+ attribute is absent, whenever an <code><a href=#the-option-element>option</a></code> element in the
+ <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> has its
+ <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
+ true, and whenever an <code><a href=#the-option-element>option</a></code> element with its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true
+ is added to the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, the user
+ agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the
+ other <code><a href=#the-option-element>option</a></code> element in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to
+ false.</p>
+
+ <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
+ attribute is absent and the element's <a href=#concept-select-size title=concept-select-size>display size</a> is greater than 1,
+ then the user agent should also allow the user to request that the
+ <code><a href=#the-option-element>option</a></code> whose <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, if
+ any, be unselected. Upon this request being conveyed to the user
+ agent, and before the relevant user interaction event <!--
+ interaction event spec point --> is queued (e.g. before the <code title=event-click><a href=#event-click>click</a></code> event), the user agent must set the
+ <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of
+ that <code><a href=#the-option-element>option</a></code> element to false and then <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named
+ <code title=event-change>change</code> at the <code><a href=#the-select-element>select</a></code>
+ element, using the <a href=#user-interaction-task-source>user interaction task source</a> as the
+ task source, then <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> at the
+ element's <a href=#form-owner>form owner</a>.</p>
+
+ <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
+ attribute is absent and the element's <a href=#concept-select-size title=concept-select-size>display size</a> is 1, then whenever
+ there are no <code><a href=#the-option-element>option</a></code> elements in the <code><a href=#the-select-element>select</a></code>
+ element's <a href=#concept-select-option-list title=concept-select-option-list>list of
+ options</a> that have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true,
+ the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the first
+ <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in
+ <a href=#tree-order>tree order</a> that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, if any, to
+ true.</p>
+
+ <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
+ attribute is present, and the element is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent
+ should allow the user to <dfn id=concept-select-toggle title=concept-select-toggle>toggle</dfn> the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the
+ <code><a href=#the-option-element>option</a></code> elements in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that are
+ themselves not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>
+ (either through a click, or through a <a href=#using-the-option-element-to-define-a-command title=option-command>menu command</a>, or any other
+ mechanism). Upon the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of one or
+ more <code><a href=#the-option-element>option</a></code> elements being changed by the user, and
+ before the relevant user interaction event <!-- interaction event
+ spec point --> is queued (e.g. before a related <code title=event-click><a href=#event-click>click</a></code> event), the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that
+ bubbles named <code title=event-change>change</code> at the
+ <code><a href=#the-select-element>select</a></code> element, using the <a href=#user-interaction-task-source>user interaction task
+ source</a> as the task source, then <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> at the
+ element's <a href=#form-owner>form owner</a>.</p>
+
+ <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
+ algorithm</a> for <code><a href=#the-select-element>select</a></code> elements is to go through
+ all the <code><a href=#the-option-element>option</a></code> elements in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, and set
+ their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
+ to true if the <code><a href=#the-option-element>option</a></code> element has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false
+ otherwise.</p>
+
+ </div>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-select-element>select</a></code> element with its
+ <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute represents the element's name. The <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make
+ the control non-interactive and to prevent its value from being
+ submitted. The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
+ attribute controls focus.</p>
+
+ <dl class=domintro><dt><var title="">select</var> . <code title=dom-select-type><a href=#dom-select-type>type</a></code></dt>
+
+ <dd>
+
+ <p>Returns "<code title="">select-multiple</code>" if the element
+ has a <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
+ attribute, and "<code title="">select-one</code>"
+ otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">select</var> . <code title=dom-select-options><a href=#dom-select-options>options</a></code></dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> of the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>
+
+ </dd>
+
+ <dt><var title="">select</var> . <code title=dom-select-length><a href=#dom-select-length>length</a></code> [ = <var title="">value</var> ]</dt>
+ <dd>
+ <p>Returns the number of elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>
+ <p>When set to a smaller number, truncates the number of <code><a href=#the-option-element>option</a></code> elements in the <code><a href=#the-select-element>select</a></code>.</p>
+ <p>When set to a greater number, adds new blank <code><a href=#the-option-element>option</a></code> elements to the <code><a href=#the-select-element>select</a></code>.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">select</var> . <code title=dom-select-item><a href=#dom-select-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">select</var>[<var title="">index</var>]</dt>
+ <dt><var title="">select</var>(<var title="">index</var>)</dt>
+ <dd>
+ <p>Returns the item with index <var title="">index</var> from the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>. The items are sorted in <a href=#tree-order>tree order</a>.</p>
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+ </dd>
+
+ <dt><var title="">element</var> = <var title="">select</var> . <code title=dom-select-item><a href=#dom-select-item>namedItem</a></code>(<var title="">name</var>)</dt>
+ <dt><var title="">select</var>[<var title="">name</var>]</dt>
+ <dt><var title="">select</var>(<var title="">name</var>)</dt>
+ <dd>
+ <p>Returns the item with ID or <code title=attr-option-name><a href=#attr-option-name>name</a></code> <var title="">name</var> from the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>
+ <p>If there are multiple matching items, then a <code><a href=#nodelist>NodeList</a></code> object containing all those elements is returned.</p>
+ <p>Returns null if no element with that ID could be found.</p>
+ </dd>
+
+ <dt><var title="">select</var> . <code title=dom-select-add><a href=#dom-select-add>add</a></code>(<var title="">element</var> [, <var title="">before</var> ])</dt>
+ <dd>
+ <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>
+ <p>The <var title="">before</var> argument can be a number, in
+ which case <var title="">element</var> is inserted before the item
+ with that number, or an element from the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, in
+ which case <var title="">element</var> is inserted before that
+ element.</p>
+ <p>If <var title="">before</var> is omitted, null, or a number out
+ of range, then <var title="">element</var> will be added at the
+ end of the list.</p>
+ <p>This method will throw a <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code>
+ exception if <var title="">element</var> is an ancestor of the
+ element into which it is to be inserted. If <var title="">element</var> is not an <code><a href=#the-option-element>option</a></code> or
+ <code><a href=#the-optgroup-element>optgroup</a></code> element, then the method does nothing.</p>
+ </dd>
+
+ <dt><var title="">select</var> . <code title=dom-select-selectedOptions><a href=#dom-select-selectedoptions>selectedOptions</a></code></dt>
+
+ <dd>
+
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that are
+ selected.</p>
+
+ </dd>
+
+ <dt><var title="">select</var> . <code title=dom-select-selectedIndex><a href=#dom-select-selectedindex>selectedIndex</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the index of the first selected item, if any, or
+ &minus;1 if there is no selected item.</p>
+
+ <p>Can be set, to change the selection.</p>
+
+ </dd>
+
+ <dt><var title="">select</var> . <code title=dom-select-value><a href=#dom-select-value>value</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the <a href=#concept-fe-value title=concept-fe-value>value</a> of the
+ first selected item, if any, or the empty string if there is no
+ selected item.</p>
+
+ <p>Can be set, to change the selection.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-select-type title=dom-select-type><code>type</code></dfn> IDL
+ attribute, on getting, must return the string "<code title="">select-one</code>" if the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent,
+ and the string "<code title="">select-multiple</code>" if the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is
+ present.</p>
+
+ <p>The <dfn id=dom-select-options title=dom-select-options><code>options</code></dfn>
+ IDL attribute must return an <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code>
+ rooted at the <code><a href=#the-select-element>select</a></code> node, whose filter matches the
+ elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of
+ options</a>.</p>
+
+ <p>The <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection is
+ also mirrored on the <code><a href=#htmlselectelement>HTMLSelectElement</a></code> object. The
+ <span>indices of the supported indexed properties</span> at any
+ instant are the indices supported by the object returned by the
+ <code title=dom-select-options><a href=#dom-select-options>options</a></code> attribute at that
+ instant. The <span>names of the supported named properties</span> at
+ any instant are the names supported by the object returned by the
+ <code title=dom-select-options><a href=#dom-select-options>options</a></code> attribute at that
+ instant.</p>
+
+ <p>The <dfn id=dom-select-length title=dom-select-length><code>length</code></dfn> IDL
+ attribute must return the number of nodes <a href=#represented-by-the-collection title="represented
+ by the collection">represented</a> by the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection. On setting, it
+ must act like the attribute of the same name on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>
+
+ <p>The <dfn id=dom-select-item title=dom-select-item><code>item(<var title="">index</var>)</code></dfn> method must return the value
+ returned by the method of the same name on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection, when invoked
+ with the same argument.</p>
+
+ <p>The <dfn id=dom-select-nameditem title=dom-select-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must return the value
+ returned by the method of the same name on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection, when invoked
+ with the same argument.</p>
+
+ <p>Similarly, the <dfn id=dom-select-add title=dom-select-add><code>add()</code></dfn> and <dfn id=dom-select-remove title=dom-select-remove><code>remove()</code></dfn> methods must
+ act like their namesake methods on that same <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>
+
+ <p>The <dfn id=dom-select-selectedoptions title=dom-select-selectedOptions><code>selectedOptions</code></dfn>
+ IDL attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at
+ the <code><a href=#the-select-element>select</a></code> node, whose filter matches the elements in
+ the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>
+ that have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
+ true.</p>
+
+ <p>The <dfn id=dom-select-selectedindex title=dom-select-selectedIndex><code>selectedIndex</code></dfn>
+ IDL attribute, on getting, must return the <a href=#concept-option-index title=concept-option-index>index</a> of the first
+ <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in
+ <a href=#tree-order>tree order</a> that has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true,
+ if any. If there isn't one, then it must return &minus;1.</p>
+
+ <p>On setting, the <code title=dom-select-selectedIndex><a href=#dom-select-selectedindex>selectedIndex</a></code> attribute must
+ set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the
+ <code><a href=#the-option-element>option</a></code> elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false,
+ and then the <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> whose
+ <a href=#concept-option-index title=concept-option-index>index</a> is the given new
+ value, if any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
+ true.</p>
+
+ <p>The <dfn id=dom-select-value title=dom-select-value><code>value</code></dfn> IDL
+ attribute, on getting, must return the <a href=#concept-option-value title=concept-option-value>value</a> of the first
+ <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in
+ <a href=#tree-order>tree order</a> that has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true,
+ if any. If there isn't one, then it must return the empty
+ string.</p>
+
+ <p>On setting, the <code title=dom-select-value><a href=#dom-select-value>value</a></code>
+ attribute must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the
+ <code><a href=#the-option-element>option</a></code> elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false,
+ and then first the <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, in
+ <a href=#tree-order>tree order</a>, whose <a href=#concept-option-value title=concept-option-value>value</a> is equal to the given new
+ value, if any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
+ true.</p>
+
+ <p>The <dfn id=dom-select-multiple title=dom-select-multiple><code>multiple</code></dfn>
+ and <dfn id=dom-select-size title=dom-select-size><code>size</code></dfn> IDL
+ attributes must <a href=#reflect>reflect</a> the respective content
+ attributes of the same name. The <code title=dom-select-size><a href=#dom-select-size>size</a></code> IDL attribute <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited to
+ only non-negative numbers greater than zero</a>.</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides a list
+ of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
+ element's forms API.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how a <code><a href=#the-select-element>select</a></code> element
+ can be used to offer the user with a set of options from which the
+ user can select a single option. The default option is
+ preselected.</p>
+
+ <pre>&lt;p&gt;
+ &lt;label for="unittype"&gt;Select unit type:&lt;/label&gt;
+ &lt;select id="unittype" name="unittype"&gt;
+ &lt;option value="1"&gt; Miner &lt;/option&gt;
+ &lt;option value="2"&gt; Puffer &lt;/option&gt;
+ &lt;option value="3" selected&gt; Snipey &lt;/option&gt;
+ &lt;option value="4"&gt; Max &lt;/option&gt;
+ &lt;option value="5"&gt; Firebot &lt;/option&gt;
+ &lt;/select&gt;
+&lt;/p&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here, the user is offered a set of options from which he can
+ select any number. By default, all five options are selected.</p>
+
+ <pre>&lt;p&gt;
+ &lt;label for="allowedunits"&gt;Select unit types to enable on this map:&lt;/label&gt;
+ &lt;select id="allowedunits" name="allowedunits" multiple&gt;
+ &lt;option value="1" selected&gt; Miner &lt;/option&gt;
+ &lt;option value="2" selected&gt; Puffer &lt;/option&gt;
+ &lt;option value="3" selected&gt; Snipey &lt;/option&gt;
+ &lt;option value="4" selected&gt; Max &lt;/option&gt;
+ &lt;option value="5" selected&gt; Firebot &lt;/option&gt;
+ &lt;/select&gt;
+&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-datalist-element><span class=secno>4.10.10 </span>The <dfn><code>datalist</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Either: <a href=#phrasing-content>phrasing content</a>.</dd>
+ <dd>Or: Zero or more <code><a href=#the-option-element>option</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmldatalistelement>HTMLDataListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-datalist-options title=dom-datalist-options>options</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-datalist-element>datalist</a></code> element represents a set of
+ <code><a href=#the-option-element>option</a></code> elements that represent predefined options for
+ other controls. The contents of the element represents fallback
+ content for legacy user agents, intermixed with <code><a href=#the-option-element>option</a></code>
+ elements that represent the predefined options. In the rendering,
+ the <code><a href=#the-datalist-element>datalist</a></code> element <a href=#represents>represents</a>
+ nothing<span class=impl> and it, along with its children, should
+ be hidden</span>.</p>
+
+ <p>The <code><a href=#the-datalist-element>datalist</a></code> element is hooked up to an
+ <code><a href=#the-input-element>input</a></code> element using the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute on the
+ <code><a href=#the-input-element>input</a></code> element. <!-- v2DATAGRID The
+ <code>datalist</code> element can also be used with a
+ <code>datagrid</code> element, as the source of autocompletion hints
+ for <code title="datagrid-type-editable">editable</code>
+ cells. --></p>
+
+ <p>Each <code><a href=#the-option-element>option</a></code> element that is a descendant of the
+ <code><a href=#the-datalist-element>datalist</a></code> element, that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, and whose <a href=#concept-option-value title=concept-option-value>value</a> is a string that isn't the
+ empty string, represents a suggestion. Each suggestion has a <a href=#concept-option-value title=concept-option-value>value</a> and a <a href=#concept-option-label title=concept-option-label>label</a>.
+
+ <dl class=domintro><dt><var title="">datalist</var> . <code title=dom-datalist-options><a href=#dom-datalist-options>options</a></code></dt>
+
+ <dd>
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code>options</code> elements of the table.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-datalist-options title=dom-datalist-options><code>options</code></dfn>
+ IDL attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at
+ the <code><a href=#the-datalist-element>datalist</a></code> node, whose filter matches
+ <code><a href=#the-option-element>option</a></code> elements.</p>
+
+ <p><strong>Constraint validation</strong>: If an element has a
+ <code><a href=#the-datalist-element>datalist</a></code> element ancestor, it is <a href=#barred-from-constraint-validation>barred from
+ constraint validation</a>.</p>
+
+ </div>
+
+
+ <h4 id=the-optgroup-element><span class=secno>4.10.11 </span>The <dfn><code>optgroup</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-select-element>select</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd>Zero or more <code><a href=#the-option-element>option</a></code> elements.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code></dd>
+ <dd><code title=attr-optgroup-label><a href=#attr-optgroup-label>label</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmloptgroupelement>HTMLOptGroupElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-optgroup-disabled title=dom-optgroup-disabled>disabled</a>;
+ attribute DOMString <a href=#dom-optgroup-label title=dom-optgroup-label>label</a>;
+};</pre>
+ </dd>
+ </dl><!-- v2: make optgroups selectable if they have a value. --><p>The <code><a href=#the-optgroup-element>optgroup</a></code> element <a href=#represents>represents</a> a group of
+ <code><a href=#the-option-element>option</a></code> elements with a common label.</p>
+
+ <p>The element's group of <code><a href=#the-option-element>option</a></code> elements consists of
+ the <code><a href=#the-option-element>option</a></code> elements that are children of the
+ <code><a href=#the-optgroup-element>optgroup</a></code> element.</p>
+
+ <div class=impl>
+
+ <p>When showing <code><a href=#the-option-element>option</a></code> elements in <code><a href=#the-select-element>select</a></code>
+ elements, user agents should show the <code><a href=#the-option-element>option</a></code> elements
+ of such groups as being related to each other and separate from
+ other <code><a href=#the-option-element>option</a></code> elements.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-optgroup-disabled title=attr-optgroup-disabled><code>disabled</code></dfn> attribute
+ is a <a href=#boolean-attribute>boolean attribute</a> and can be used to <a href=#concept-option-disabled title=concept-option-disabled>disable</a> a group of
+ <code><a href=#the-option-element>option</a></code> elements together.</p>
+
+ <p>The <dfn id=attr-optgroup-label title=attr-optgroup-label><code>label</code></dfn>
+ attribute must be specified. Its value gives the name of the group,
+ for the purposes of the user interface. <span class=impl>User
+ agents should use this attribute's value when labelling the group of
+ <code><a href=#the-option-element>option</a></code> elements in a <code><a href=#the-select-element>select</a></code>
+ element.</span></p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-optgroup-disabled title=dom-optgroup-disabled><code>disabled</code></dfn> and <dfn id=dom-optgroup-label title=dom-optgroup-label><code>label</code></dfn> attributes must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following snippet shows how a set of lessons from three
+ courses could be offered in a <code><a href=#the-select-element>select</a></code> drop-down
+ widget:</p>
+
+ <pre>&lt;form action="courseselector.dll" method="get"&gt;
+ &lt;p&gt;Which course would you like to watch today?
+ &lt;p&gt;&lt;label&gt;Course:
+ &lt;select name="c"&gt;
+ &lt;optgroup label="8.01 Physics I: Classical Mechanics"&gt;
+ &lt;option value="8.01.1"&gt;Lecture 01: Powers of Ten
+ &lt;option value="8.01.2"&gt;Lecture 02: 1D Kinematics
+ &lt;option value="8.01.3"&gt;Lecture 03: Vectors
+ &lt;optgroup label="8.02 Electricity and Magnestism"&gt;
+ &lt;option value="8.02.1"&gt;Lecture 01: What holds our world together?
+ &lt;option value="8.02.2"&gt;Lecture 02: Electric Field
+ &lt;option value="8.02.3"&gt;Lecture 03: Electric Flux
+ &lt;optgroup label="8.03 Physics III: Vibrations and Waves"&gt;
+ &lt;option value="8.03.1"&gt;Lecture 01: Periodic Phenomenon
+ &lt;option value="8.03.2"&gt;Lecture 02: Beats
+ &lt;option value="8.03.3"&gt;Lecture 03: Forced Oscillations with Damping
+ &lt;/select&gt;
+ &lt;/label&gt;
+ &lt;p&gt;&lt;input type=submit value="&#9654; Play"&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-option-element><span class=secno>4.10.12 </span>The <dfn><code>option</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As a child of a <code><a href=#the-select-element>select</a></code> element.</dd>
+ <dd>As a child of a <code><a href=#the-datalist-element>datalist</a></code> element.</dd>
+ <dd>As a child of an <code><a href=#the-optgroup-element>optgroup</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#text-content title="text content">Text</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code></dd>
+ <dd><code title=attr-option-label><a href=#attr-option-label>label</a></code></dd>
+ <dd><code title=attr-option-selected><a href=#attr-option-selected>selected</a></code></dd>
+ <dd><code title=attr-option-value><a href=#attr-option-value>value</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(),
+ NamedConstructor=<a href=#dom-option-t title=dom-option-t>Option</a>(in DOMString text),
+ NamedConstructor=<a href=#dom-option-tv title=dom-option-tv>Option</a>(in DOMString text, in DOMString value),
+ NamedConstructor=<a href=#dom-option-tvd title=dom-option-tvd>Option</a>(in DOMString text, in DOMString value, in boolean defaultSelected),
+ NamedConstructor=<a href=#dom-option-tvds title=dom-option-tvds>Option</a>(in DOMString text, in DOMString value, in boolean defaultSelected, in boolean selected)]
+interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-option-disabled title=dom-option-disabled>disabled</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-option-form title=dom-option-form>form</a>;
+ attribute DOMString <a href=#dom-option-label title=dom-option-label>label</a>;
+ attribute boolean <a href=#dom-option-defaultselected title=dom-option-defaultSelected>defaultSelected</a>;
+ attribute boolean <a href=#dom-option-selected title=dom-option-selected>selected</a>;
+ attribute DOMString <a href=#dom-option-value title=dom-option-value>value</a>;
+
+ attribute DOMString <a href=#dom-option-text title=dom-option-text>text</a>;
+ readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-option-element>option</a></code> element <a href=#represents>represents</a> an option
+ in a <code><a href=#the-select-element>select</a></code> element or as part of a list of suggestions
+ in a <code><a href=#the-datalist-element>datalist</a></code> element.</p>
+
+ <p>The <dfn id=attr-option-disabled title=attr-option-disabled><code>disabled</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>. An
+ <code><a href=#the-option-element>option</a></code> element is <dfn id=concept-option-disabled title=concept-option-disabled>disabled</dfn> if its <code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code> attribute is present or
+ if it is a child of an <code><a href=#the-optgroup-element>optgroup</a></code> element whose <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> attribute is
+ present.</p>
+
+ <div class=impl>
+
+ <p>An <code><a href=#the-option-element>option</a></code> element that is <a href=#attr-option-disabled title=attr-option-disabled>disabled</a> must prevent any <code title=event-click><a href=#event-click>click</a></code> events that are <a href=#queue-a-task title="queue
+ a task">queued</a> on the <a href=#user-interaction-task-source>user interaction task
+ source</a> from being dispatched on the element.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-option-label title=attr-option-label><code>label</code></dfn>
+ attribute provides a label for element. The <dfn id=concept-option-label title=concept-option-label>label</dfn> of an <code><a href=#the-option-element>option</a></code>
+ element is the value of the <code title=attr-option-label><a href=#attr-option-label>label</a></code> attribute, if there is one,
+ or the <code><a href=#textcontent>textContent</a></code> of the element, if there isn't.</p>
+
+ <p>The <dfn id=attr-option-value title=attr-option-value><code>value</code></dfn>
+ attribute provides a value for element. The <dfn id=concept-option-value title=concept-option-value>value</dfn> of an <code><a href=#the-option-element>option</a></code>
+ element is the value of the <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute, if there is one,
+ or the <code><a href=#textcontent>textContent</a></code> of the element, if there isn't.</p>
+
+ <p>The <dfn id=attr-option-selected title=attr-option-selected><code>selected</code></dfn>
+ attribute represents the default <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the
+ element.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=concept-option-selectedness title=concept-option-selectedness>selectedness</dfn>
+ of an <code><a href=#the-option-element>option</a></code> element is a boolean state, initially
+ false. If the element is <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, then the element's
+ <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is
+ always false and cannot be set to true. Except where otherwise
+ specified, when the element is created, its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set
+ to true if the element has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute. Whenever an
+ <code><a href=#the-option-element>option</a></code> element's <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is added, its
+ <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must
+ be set to true.</p>
+
+ <p class=note>The <code title=dom-option-tvd><a href=#dom-option-tvd>Option()</a></code>
+ constructor with three or fewer arguments overrides the initial
+ state of the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> state to
+ always be false even if the third argument is true (implying that a
+ <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is to
+ be set). The fourth argument can be used to explicitly set the
+ initial <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> state when
+ using the constructor.</p>
+
+ </div>
+
+ <p>A <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is not
+ specified must not have more than one descendant <code><a href=#the-option-element>option</a></code>
+ element with its <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code>
+ attribute set.</p>
+
+ <div class=impl>
+
+ <p>An <code><a href=#the-option-element>option</a></code> element's <dfn id=concept-option-index title=concept-option-index>index</dfn> is the number of
+ <code><a href=#the-option-element>option</a></code> element that are in the same <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> but that
+ come before it in <a href=#tree-order>tree order</a>. If the
+ <code><a href=#the-option-element>option</a></code> element is not in a <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, then the
+ <code><a href=#the-option-element>option</a></code> element's <a href=#concept-option-index title=concept-option-index>index</a> is zero.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">option</var> . <code title=dom-option-selected><a href=#dom-option-selected>selected</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element is selected, and false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">option</var> . <code title=dom-option-index><a href=#dom-option-index>index</a></code></dt>
+
+ <dd>
+
+ <p>Returns the index of the element in its <code><a href=#the-select-element>select</a></code>
+ element's <code title=dom-select-options><a href=#dom-select-options>options</a></code>
+ list.</p>
+
+ </dd>
+
+ <dt><var title="">option</var> . <code title=dom-option-form><a href=#dom-option-form>form</a></code></dt>
+
+ <dd>
+
+ <p>Returns the element's <code><a href=#the-form-element>form</a></code> element, if any, or
+ null otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">option</var> . <code title=dom-option-text><a href=#dom-option-text>text</a></code></dt>
+
+ <dd>
+
+ <p>Same as <code><a href=#textcontent>textContent</a></code>.</p>
+
+ </dd>
+
+ <dt><var title="">option</var> = new <code title=dom-option><a href=#dom-option>Option</a></code>( [ <var title="">text</var> [, <var title="">value</var> [, <var title="">defaultSelected</var> [, <var title="">selected</var> ] ] ] ] )</dt>
+
+ <dd>
+
+ <p>Returns a new <code><a href=#the-option-element>option</a></code> element.</p>
+
+ <p>The <var title="">text</var> argument sets the contents of the element.</p>
+ <p>The <var title="">value</var> argument sets the <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute.</p>
+ <p>The <var title="">defaultSelected</var> argument sets the <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute.</p>
+ <p>The <var title="">selected</var> argument sets whether or not the element is selected. If it is omitted, even if the <var title="">defaultSelected</var> argument is true, the element is not selected.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-option-disabled title=dom-option-disabled><code>disabled</code></dfn>
+ and <dfn id=dom-option-label title=dom-option-label><code>label</code></dfn> IDL
+ attributes must <a href=#reflect>reflect</a> the respective content
+ attributes of the same name. The <dfn id=dom-option-defaultselected title=dom-option-defaultSelected><code>defaultSelected</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-option-value title=dom-option-value><code>value</code></dfn> IDL
+ attribute, on getting, must return the value of the element's <code title=attr-option-value><a href=#attr-option-value>value</a></code> content attribute, if it has
+ one, or else the value of the element's <code><a href=#textcontent>textContent</a></code> IDL
+ attribute. On setting, the element's <code title=attr-option-value><a href=#attr-option-value>value</a></code> content attribute must be set
+ to the new value.</p>
+
+ <p>The <dfn id=dom-option-selected title=dom-option-selected><code>selected</code></dfn>
+ IDL attribute must return true if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, and
+ false otherwise.</p>
+
+ <p>The <dfn id=dom-option-index title=dom-option-index><code>index</code></dfn> IDL
+ attribute must return the element's <a href=#concept-option-index title=concept-option-index>index</a>.</p>
+
+ <p>The <dfn id=dom-option-text title=dom-option-text><code>text</code></dfn> IDL
+ attribute, on getting, must return the same value as the
+ <code><a href=#textcontent>textContent</a></code> IDL attribute on the element, and on
+ setting, must act as if the <code><a href=#textcontent>textContent</a></code> IDL attribute
+ on the element had been set to the new value.</p>
+
+ <p>The <dfn id=dom-option-form title=dom-option-form><code>form</code></dfn> IDL
+ attribute's behavior depends on whether the <code><a href=#the-option-element>option</a></code>
+ element is in a <code><a href=#the-select-element>select</a></code> element or not. If the
+ <code><a href=#the-option-element>option</a></code> has a <code><a href=#the-select-element>select</a></code> element as its parent,
+ or has a <code><a href=#the-colgroup-element>colgroup</a></code> element as its parent and that
+ <code><a href=#the-colgroup-element>colgroup</a></code> element has a <code><a href=#the-select-element>select</a></code> element as
+ its parent, then the <code title=dom-option-form><a href=#dom-option-form>form</a></code> IDL
+ attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute on that
+ <code><a href=#the-select-element>select</a></code> element. Otherwise, it must return null.</p>
+
+ <p>Several constructors are provided for creating
+ <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in addition to the factory
+ methods from DOM Core such as <code title="">createElement()</code>): <dfn id=dom-option title=dom-option><code>Option()</code></dfn>, <dfn id=dom-option-t title=dom-option-t><code>Option(<var title="">text</var>)</code></dfn>, <dfn id=dom-option-tv title=dom-option-tv><code>Option(<var title="">text</var>, <var title="">value</var>)</code></dfn>, <dfn id=dom-option-tvd title=dom-option-tvd><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>)</code></dfn>, and <dfn id=dom-option-tvds title=dom-option-tvds><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var title="">selected</var>)</code></dfn>. When invoked as constructors,
+ these must return a new <code><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new
+ <code><a href=#the-option-element>option</a></code> element). If the <var title="">text</var>
+ argument is present, the new object must have as its only child a
+ <code><a href=#node>Node</a></code> with node type <code title="">TEXT_NODE</code> (3)
+ whose data is the value of that argument<!-- we mention TEXT_NODE
+ and all that explicitly here because we redefine "text node" in this
+ spec to also include CDATA sections -->. If the <var title="">value</var> argument is present, the new object must have a
+ <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute set with the
+ value of the argument as its value. If the <var title="">defaultSelected</var> argument is present and true, the new
+ object must have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no
+ value. If the <var title="">selected</var> argument is present and
+ true, the new object must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true;
+ otherwise the fourth argument is absent or false, and the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set
+ to false, even if the <var title="">defaultSelected</var> argument
+ is present and true. The element's document must be the <a href=#active-document>active
+ document</a> of the <a href=#browsing-context>browsing context</a> of the
+ <code><a href=#window>Window</a></code> object on which the interface object of the
+ invoked constructor is found.</p>
+
+ </div>
+
+
+
+ <h4 id=the-textarea-element><span class=secno>4.10.13 </span>The <dfn><code>textarea</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, and <a href=#category-reset title=category-reset>resettable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#text-content title="text content">Text</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code></dd>
+ <dd><code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code></dd>
+ <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code></dd>
+ <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code></dd>
+ <dd><code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code></dd>
+ <dd><code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code></dd>
+ <dd><code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code></dd>
+ <dd><code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code></dd>
+ <dd><code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmltextareaelement>HTMLTextAreaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
+ attribute unsigned long <a href=#dom-textarea-cols title=dom-textarea-cols>cols</a>;
+ attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute long <a href=#dom-textarea-maxlength title=dom-textarea-maxLength>maxLength</a>;
+ attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
+ attribute DOMString <a href=#dom-textarea-placeholder title=dom-textarea-placeholder>placeholder</a>;
+ attribute boolean <a href=#dom-textarea-readonly title=dom-textarea-readOnly>readOnly</a>;
+ attribute boolean <a href=#dom-textarea-required title=dom-textarea-required>required</a>;
+ attribute unsigned long <a href=#dom-textarea-rows title=dom-textarea-rows>rows</a>;
+ attribute DOMString <a href=#dom-textarea-wrap title=dom-textarea-wrap>wrap</a>;
+
+ readonly attribute DOMString <a href=#dom-textarea-type title=dom-textarea-type>type</a>;
+ attribute DOMString <a href=#dom-textarea-defaultvalue title=dom-textarea-defaultValue>defaultValue</a>;
+ attribute DOMString <a href=#dom-textarea-value title=dom-textarea-value>value</a>;
+ readonly attribute unsigned long <a href=#dom-textarea-textlength title=dom-textarea-textLength>textLength</a>;
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+
+ void <a href=#dom-textarea/input-select title=dom-textarea/input-select>select</a>();
+ attribute unsigned long <a href=#dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart>selectionStart</a>;
+ attribute unsigned long <a href=#dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd>selectionEnd</a>;
+ void <a href=#dom-textarea/input-setselectionrange title=dom-textarea/input-setSelectionRange>setSelectionRange</a>(in unsigned long start, in unsigned long end);
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-textarea-element>textarea</a></code> element <a href=#represents>represents</a> a
+ multiline plain text edit control<span class=impl> for the
+ element's <dfn id=concept-textarea-raw-value title=concept-textarea-raw-value>raw
+ value</dfn></span>. The contents of the control represent the
+ control's default value.</p>
+
+ <div class=impl>
+
+ <p>The <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> of
+ a <code><a href=#the-textarea-element>textarea</a></code> control must be initially the empty
+ string.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-textarea-readonly title=attr-textarea-readonly><code>readonly</code></dfn> attribute
+ is a <a href=#boolean-attribute>boolean attribute</a> used to control whether the text
+ can be edited by the user or not.</p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If the <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute is
+ specified on a <code><a href=#the-textarea-element>textarea</a></code> element, the element is
+ <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>
+
+ <p>A <code><a href=#the-textarea-element>textarea</a></code> element is <dfn id=concept-textarea-mutable title=concept-textarea-mutable>mutable</dfn> if it is neither
+ <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> nor has a <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute
+ specified.</p>
+
+ <p>When a <code><a href=#the-textarea-element>textarea</a></code> is <a href=#concept-textarea-mutable title=concept-textarea-mutable>mutable</a>, its <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> should be
+ editable by the user. Any time the user causes the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> to change, the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that bubbles named <code title=event-input>input</code> at the <code><a href=#the-textarea-element>textarea</a></code>
+ element, then <a href=#broadcast-forminput-events>broadcast <code title=event-forminput>forminput</code> events</a> at the
+ <code><a href=#the-textarea-element>textarea</a></code> element's <a href=#form-owner>form owner</a>. User agents
+ may wait for a suitable break in the user's interaction before
+ queuing the task; for example, a user agent could wait for the user
+ to have not hit a key for 100ms, so as to only fire the event when
+ the user pauses, instead of continuously for each keystroke.</p>
+ <!-- same text is present in the <input> section -->
+
+ <p>A <code><a href=#the-textarea-element>textarea</a></code> element has a <dfn id=concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</dfn>, which must be
+ initially set to false, and must be set to true whenever the user
+ interacts with the control in a way that changes the <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a>.</p>
+
+ <p>When the <code><a href=#the-textarea-element>textarea</a></code> element's <code><a href=#textcontent>textContent</a></code>
+ IDL attribute changes value, if the element's <a href=#concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</a> is false,
+ then the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw
+ value</a> must be set to the value of the element's
+ <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>
+
+ <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
+ algorithm</a> for <code><a href=#the-textarea-element>textarea</a></code> elements is to set the
+ element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>value</a> to
+ the value of the element's <code><a href=#textcontent>textContent</a></code> IDL
+ attribute.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-textarea-cols title=attr-textarea-cols><code>cols</code></dfn>
+ attribute specifies the expected maximum number of characters per
+ line. If the <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> attribute
+ is specified, its value must be a <a href=#valid-non-negative-integer>valid non-negative
+ integer</a> greater than zero. <span class=impl>If applying the
+ <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to the
+ attribute's value results in a number greater than zero, then the
+ element's <dfn id=attr-textarea-cols-value title=attr-textarea-cols-value>character
+ width</dfn> is that value; otherwise, it is 20.</span></p>
+
+ <div class=impl>
+
+ <p>The user agent may use the <code><a href=#the-textarea-element>textarea</a></code> element's <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character width</a> as a hint to
+ the user as to how many characters the server prefers per line
+ (e.g. for visual user agents by making the width of the control be
+ that many characters). In visual renderings, the user agent should
+ wrap the user's input in the rendering so that each line is no wider
+ than this number of characters.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-textarea-rows title=attr-textarea-rows><code>rows</code></dfn>
+ attribute specifies the number of lines to show. If the <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code> attribute is specified, its
+ value must be a <a href=#valid-non-negative-integer>valid non-negative integer</a> greater than
+ zero. <span class=impl>If applying the <a href=#rules-for-parsing-non-negative-integers>rules for parsing
+ non-negative integers</a> to the attribute's value results in a
+ number greater than zero, then the element's <dfn id=attr-textarea-rows-value title=attr-textarea-rows-value>character height</dfn> is that
+ value; otherwise, it is 2.</span></p>
+
+ <div class=impl>
+
+ <p>Visual user agents should set the height of the control to the
+ number of lines given by <a href=#attr-textarea-rows-value title=attr-textarea-rows-value>character height</a>.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-textarea-wrap title=attr-textarea-wrap><code>wrap</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a> with two keywords
+ and states: the <dfn id=attr-textarea-wrap-soft title=attr-textarea-wrap-soft><code>soft</code></dfn> keyword
+ which maps to the <dfn id=attr-textarea-wrap-soft-state title=attr-textarea-wrap-soft-state>Soft</dfn> state, and the
+ <dfn id=attr-textarea-wrap-hard title=attr-textarea-wrap-hard><code>hard</code></dfn> keyword
+ which maps to the <dfn id=attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</dfn> state. The
+ <i>missing value default</i> is the <a href=#attr-textarea-wrap-soft-state title=attr-textarea-wrap-soft-state>Soft</a> state.</p>
+
+ <p>If the element's <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code>
+ attribute is in the <a href=#attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</a> state, the <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> attribute must be
+ specified.</p>
+
+ <!-- attr-textarea-wrap-off (attr-textarea-wrap-off-state): not
+ conforming; turns off the rendering of wrapping but otherwise acts
+ like 'soft' -->
+
+ <div class=impl>
+
+ <p>The element's <a href=#concept-fe-value title=concept-fe-value>value</a> is
+ defined to be the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> with the
+ following transformation applied:</p>
+
+ <ol><li><p>Replace every occurrence of a U+000D CARRIAGE RETURN (CR)
+ character not followed by a U+000A LINE FEED (LF) character, and
+ every occurrence of a U+000A LINE FEED (LF) character not preceded
+ by a U+000D CARRIAGE RETURN (CR) character, by a two-character
+ string consisting of a U+000D CARRIAGE RETURN U+000A LINE FEED
+ (CRLF) character pair.</li>
+
+ <li><p>If the element's <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute is in the <a href=#attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</a> state, insert
+ U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pairs
+ into the string using a UA-defined algorithm so that each line has
+ no more than <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character
+ width</a> characters. For the purposes of this requirement,
+ lines are delimited by the start of the string, the end of the
+ string, and U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF)
+ character pairs.</li>
+
+ </ol></div>
+
+ <p>The <dfn id=attr-textarea-maxlength title=attr-textarea-maxlength><code>maxlength</code></dfn>
+ attribute is a <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</a> controlled by the
+ <code><a href=#the-textarea-element>textarea</a></code> element's <a href=#concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</a>.</p>
+
+ <p>If the <code><a href=#the-textarea-element>textarea</a></code> element has a <a href=#maximum-allowed-value-length>maximum allowed
+ value length</a>, then the element's children must be such that
+ the <a href=#code-point-length>code-point length</a> of the value of the element's
+ <code><a href=#textcontent>textContent</a></code> IDL attribute is equal to or less than the
+ element's <a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>
+
+ <p>The <dfn id=attr-textarea-required title=attr-textarea-required><code>required</code></dfn> attribute
+ is a <a href=#boolean-attribute>boolean attribute</a>. When specified, the user will
+ be required to enter a value before submitting the form.</p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If the element has its
+ <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code> attribute
+ specified, and the element is <a href=#concept-textarea-mutable title=concept-textarea-mutable>mutable</a>, and the element's
+ <a href=#concept-fe-value title=concept-fe-value>value</a> is the empty string,
+ then the element is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p>
+
+ </div>
+
+
+ <!-- similar text in the <input> section -->
+
+ <p>The <dfn id=attr-textarea-placeholder title=attr-textarea-placeholder><code>placeholder</code></dfn>
+ attribute represents a hint (a word or short phrase) intended to aid
+ the user with data entry. A hint could be a sample value or a brief
+ description of the expected format. The attribute, if specified,
+ must have a value that contains no U+000A LINE FEED (LF) or U+000D
+ CARRIAGE RETURN (CR) characters.</p>
+
+ <p class=note>For a longer hint or other advisory text, the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute is more appropriate.</p>
+
+ <p>The <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code>
+ attribute should not be used as an alternative to a
+ <code><a href=#the-label-element>label</a></code>.</p>
+
+ <div class=impl>
+
+ <p>User agents should present this hint to the user, after having
+ <a href=#strip-line-breaks title="strip line breaks">stripped line breaks</a> from it,
+ when the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is
+ the empty string and the control is not focused (e.g. by displaying
+ it inside a blank unfocused control).</p>
+
+ </div>
+
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-textarea-element>textarea</a></code> element with its
+ <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute represents the element's name. The <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make
+ the control non-interactive and to prevent its value from being
+ submitted. The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
+ attribute controls focus.</p>
+
+ <dl class=domintro><dt><var title="">textarea</var> . <code title=attr-textarea-type>type</code></dt>
+
+ <dd>
+
+ <p>Returns the string "<code title="">textarea</code>".</p>
+
+ </dd>
+
+ <dt><var title="">textarea</var> . <code title=attr-textarea-value>value</code></dt>
+
+ <dd>
+
+ <p>Returns the current value of the element.</p>
+
+ <p>Can be set, to change the value.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-textarea-cols title=dom-textarea-cols><code>cols</code></dfn>, <dfn id=dom-textarea-placeholder title=dom-textarea-placeholder><code>placeholder</code></dfn>,
+ <dfn id=dom-textarea-required title=dom-textarea-required><code>required</code></dfn>, <dfn id=dom-textarea-rows title=dom-textarea-rows><code>rows</code></dfn>, and <dfn id=dom-textarea-wrap title=dom-textarea-wrap><code>wrap</code></dfn> attributes must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name. The <code title=dom-textarea-cols><a href=#dom-textarea-cols>cols</a></code> and <code title=dom-textarea-rows><a href=#dom-textarea-rows>rows</a></code> attributes are <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited
+ to only non-negative numbers greater than zero</a>. The <dfn id=dom-textarea-maxlength title=dom-textarea-maxLength><code>maxLength</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code> content attribute,
+ <a href=#limited-to-only-non-negative-numbers>limited to only non-negative numbers</a>. The <dfn id=dom-textarea-readonly title=dom-textarea-readOnly><code>readOnly</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-textarea-type title=dom-textarea-type><code>type</code></dfn> IDL
+ attribute must return the value "<code title="">textarea</code>".</p>
+
+ <p>The <dfn id=dom-textarea-defaultvalue title=dom-textarea-defaultValue><code>defaultValue</code></dfn>
+ IDL attribute must act like the element's <code><a href=#textcontent>textContent</a></code>
+ IDL attribute.</p>
+
+ <p>The <dfn id=dom-textarea-value title=dom-textarea-value><code>value</code></dfn>
+ attribute must, on getting, return the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a>; on setting, it
+ must set the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw
+ value</a> to the new value.</p>
+
+ <p>The <dfn id=dom-textarea-textlength title=dom-textarea-textLength><code>textLength</code></dfn> IDL
+ attribute must return the <a href=#code-point-length>code-point length</a> of the
+ element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides a list
+ of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>, <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
+ and <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
+ methods and attributes expose the element's text selection. The
+ <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
+ element's forms API.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example of a <code><a href=#the-textarea-element>textarea</a></code> being used for
+ unrestricted free-form text input in a form:</p>
+
+ <pre>&lt;p&gt;If you have any comments, please let us know: &lt;textarea cols=80 name=comments&gt;&lt;/textarea&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-keygen-element><span class=secno>4.10.14 </span>The <dfn><code>keygen</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, and <a href=#category-reset title=category-reset>resettable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code></dd>
+ <dd><code title=attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code></dd>
+ <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code></dd>
+ <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlkeygenelement>HTMLKeygenElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
+ attribute DOMString <a href=#dom-keygen-challenge title=dom-keygen-challenge>challenge</a>;
+ attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute DOMString <a href=#dom-keygen-keytype title=dom-keygen-keytype>keytype</a>;
+ attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
+
+ readonly attribute DOMString <a href=#dom-keygen-type title=dom-keygen-type>type</a>;
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-keygen-element>keygen</a></code> element <a href=#represents>represents</a> a key
+ pair generator control. When the control's form is submitted, the
+ private key is stored in the local keystore, and the public key is
+ packaged and sent to the server.</p>
+
+ <p>The <dfn id=attr-keygen-challenge title=attr-keygen-challenge><code>challenge</code></dfn> attribute
+ may be specified. Its value will be packaged with the submitted
+ key.</p>
+
+ <p>The <dfn id=attr-keygen-keytype title=attr-keygen-keytype><code>keytype</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The following
+ table lists the keywords and states for the attribute &mdash; the
+ keywords in the left column map to the states listed in the cell in
+ the second column on the same row as the keyword. User agents are
+ not required to support these values, and must only recognize values
+ whose corresponding algorithms they support.</p>
+
+ <table><thead><tr><th> Keyword <th> State
+ <tbody><tr><td> <code title="">rsa</code>
+ <td> <i title="">RSA</i>
+<!-- v2 (see below)
+ <tr>
+ <td> <code title="">ec</code>
+ <td> <i title="">EC</i>
+-->
+ </table><p>The <i>invalid value default</i> state is the <i title="">unknown</i> state. The <i>missing value default</i> state
+ is the <i title="">RSA</i> state, if it is supported, or the <i title="">unknown</i> state otherwise.</p>
+
+ <p class=note>This specification does not specify what key types
+ user agents are to support &mdash; it is possible for a user agent
+ to not support any key types at all.</p>
+
+ <div class=impl>
+
+ <p>The user agent may expose a user interface for each
+ <code><a href=#the-keygen-element>keygen</a></code> element to allow the user to configure settings
+ of the element's key pair generator, e.g. the key length.</p>
+
+ <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
+ algorithm</a> for <code><a href=#the-keygen-element>keygen</a></code> elements is to set these
+ various configuration settings back to their defaults.</p>
+
+ <p>The element's <a href=#concept-fe-value title=concept-fe-value>value</a> is the
+ string returned from the following algorithm:</p>
+
+ <ol><li>
+
+ <p>Use the appropriate step from the following list:</p>
+
+ <dl class=switch><!-- v2 (see above)
+
+ <dt>If the <code title="attr-keygen-keytype">keytype</code>
+ attribute is in the <i title="">EC</i> state</dt>
+
+ <dd>
+
+ <p>...
+
+ http://www.mail-archive.com/dev-tech-crypto@lists.mozilla.org/msg05902.html
+
+ </dd>
+
+ --><dt>If the <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code>
+ attribute is in the <i title="">RSA</i> state</dt>
+
+ <dd>
+
+ <p>Generate an RSA key pair using the settings given by the
+ user, if appropriate, using the <code title="">md5WithRSAEncryption</code> RSA signature algorithm
+ (the signature algorithm with MD5 and the RSA encryption
+ algorithm) referenced in section 2.2.1 ("RSA Signature
+ Algorithm") of RFC 3279, and defined in RFC 2313. <a href=#refsRFC3279>[RFC3279]</a> <a href=#refsRFC2313>[RFC2313]</a></p>
+
+ </dd>
+
+ <dt>Otherwise, the <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code> attribute is in the <i title="">unknown</i> state</dt>
+
+ <dd>
+
+ <p>The given key type is not supported. Return the empty string
+ and abort this algorithm.</p>
+
+ </dd>
+
+ </dl><p>Let <var title="">private key</var> be the generated private key.</p>
+
+ <p>Let <var title="">public key</var> be the generated public key.</p>
+
+ <p>Let <var title="">signature algorithm</var> be the selected
+ signature algorithm.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the element has a <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code> attribute, then let
+ <var title="">challenge</var> be that attribute's value.
+ Otherwise, let <var title="">challenge</var> be the empty
+ string.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">algorithm</var> be an ASN.1 <code title="">AlgorithmIdentifier</code> structure as defined by
+ RFC 5280, with the <code title="">algorithm</code> field giving the
+ ASN.1 OID used to identify <var title="">signature
+ algorithm</var>, using the OIDs defined in section 2.2 ("Signature
+ Algorithms") of RFC 3279, and the <code title="">parameters</code>
+ field set up as required by RFC 3279 for <code title="">AlgorithmIdentifier</code> structures for that
+ algorithm. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a> <a href=#refsRFC3279>[RFC3279]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">spki</var> be an ASN.1 <code title="">SubjectPublicKeyInfo</code> structure as defined by
+ RFC 5280, with the <code title="">algorithm</code> field set to the
+ <var title="">algorithm</var> structure from the previous step,
+ and the <code title="">subjectPublicKey</code> field set to the
+ BIT STRING value resulting from ASN.1 DER encoding the <var title="">public key</var>. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">publicKeyAndChallenge</var> be an ASN.1
+ <code><a href=#publickeyandchallenge>PublicKeyAndChallenge</a></code> structure as defined below,
+ with the <code title="">spki</code> field set to the <var title="">spki</var> structure from the previous step, and the
+ <code title="">challenge</code> field set to the string <var title="">challenge</var> obtained earlier. <a href=#refsX690>[X690]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">signature</var> be the BIT STRING value
+ resulting from ASN.1 DER encoding the signature generated by
+ applying the <var title="">signature algorithm</var> to the byte
+ string obtained by ASN.1 DER encoding the <var title="">publicKeyAndChallenge</var> structure, using <var title="">private key</var> as the signing key. <a href=#refsX690>[X690]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">signedPublicKeyAndChallenge</var> be an ASN.1
+ <code><a href=#signedpublickeyandchallenge>SignedPublicKeyAndChallenge</a></code> structure as defined
+ below, with the <code title="">publicKeyAndChallenge</code> field
+ set to the <var title="">publicKeyAndChallenge</var> structure,
+ the <code title="">signatureAlgorithm</code> field set to the <var title="">algorithm</var> structure, and the <code title="">signature</code> field set to the BIT STRING <var title="">signature</var> from the previous step. <a href=#refsX690>[X690]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>Return the result of base64 encoding the result of ASN.1 DER
+ encoding the <var title="">signedPublicKeyAndChallenge</var>
+ structure. <a href=#refsRFC3548>[RFC3548]</a><!--base64--> <a href=#refsX690>[X690]</a></p>
+
+ </li>
+
+ </ol><p>The data objects used by the above algorithm are defined as
+ follows. These definitions use the same "ASN.1-like" syntax defined
+ by RFC 5280. <a href=#refsRFC5280>[RFC5280]</a></p>
+
+ <pre class=asn><dfn id=publickeyandchallenge>PublicKeyAndChallenge</dfn> ::= SEQUENCE {
+ spki <span>SubjectPublicKeyInfo</span>,
+ challenge IA5STRING
+}
+
+<dfn id=signedpublickeyandchallenge>SignedPublicKeyAndChallenge</dfn> ::= SEQUENCE {
+ publicKeyAndChallenge <a href=#publickeyandchallenge>PublicKeyAndChallenge</a>,
+ signatureAlgorithm <span>AlgorithmIdentifier</span>,
+ signature BIT STRING
+}</pre>
+
+ <hr><p><strong>Constraint validation</strong>: The <code><a href=#the-keygen-element>keygen</a></code>
+ element is <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>
+
+ </div>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-keygen-element>keygen</a></code> element with its
+ <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute represents the element's name. The <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make
+ the control non-interactive and to prevent its value from being
+ submitted. The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
+ attribute controls focus.</p>
+
+ <dl class=domintro><dt><var title="">keygen</var> . <code title=attr-keygen-type>type</code></dt>
+
+ <dd>
+
+ <p>Returns the string "<code title="">keygen</code>".</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-keygen-challenge title=dom-keygen-challenge><code>challenge</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attributes of the
+ same name.</p>
+
+ <p>The <dfn id=dom-keygen-keytype title=dom-keygen-keytype><code>keytype</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the content attributes of
+ the same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>
+
+ <p>The <dfn id=dom-keygen-type title=dom-keygen-type><code>type</code></dfn> IDL
+ attribute must return the value "<code title="">keygen</code>".</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides a list
+ of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
+ element's forms API.</p>
+
+ </div>
+
+ <p class=note>This specification does not specify how the private
+ key generated is to be used. It is expected that after receiving the
+ <code><a href=#signedpublickeyandchallenge>SignedPublicKeyAndChallenge</a></code> (SPKAC) structure, the
+ server will generate a client certificate and offer it back to the
+ user for download; this certificate, once downloaded and stored in
+ the key store along with the private key, can then be used to
+ authenticate to services that use SSL and certificate
+ authentication.</p>
+
+ <!-- how does the UA know which private key is associated with a
+ certificate it gets back after the server has taken the public key
+ created by <keygen> and turned it into a client cert? -->
+
+ <div class=example>
+
+ <p>To generate a key pair, add the private key to the user's key
+ store, and submit the public key to the server, markup such as the
+ following can be used:</p>
+
+ <pre>&lt;form action="processkey.cgi" method="post" enctype="multipart/form-data"&gt;
+ &lt;p&gt;&lt;keygen name="key"&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;input type=submit value="Submit key..."&gt;&lt;/p&gt;
+&lt;/form&gt;</pre>
+
+ <p>The server will then receive a form submission with a packaged
+ RSA public key as the value of "<code title="">key</code>". This
+ can then be used for various purposes, such as generating a client
+ certificate, as mentioned above.</p>
+
+ </div>
+
+
+
+ <h4 id=the-output-element><span class=secno>4.10.15 </span>The <dfn><code>output</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, and <a href=#category-reset title=category-reset>resettable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-output-for><a href=#attr-output-for>for</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmloutputelement>HTMLOutputElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ [PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <span title=dom-output-wrap>htmlFor</span>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
+
+ readonly attribute DOMString <a href=#dom-output-type title=dom-output-type>type</a>;
+ attribute DOMString <a href=#dom-output-defaultvalue title=dom-output-defaultValue>defaultValue</a>;
+ attribute DOMString <a href=#dom-output-value title=dom-output-value>value</a>;
+
+ readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
+ readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
+ readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
+ boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>();
+ void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error);
+
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-output-element>output</a></code> element <a href=#represents>represents</a> the result of a
+ calculation.</p>
+
+ <p>The <dfn id=attr-output-for title=attr-output-for><code>for</code></dfn> content
+ attribute allows an explicit relationship to be made between the
+ result of a calculation and the elements that represent the values
+ that went into the calculation or that otherwise influenced the
+ calculation. The <code title=attr-output-for><a href=#attr-output-for>for</a></code> attribute,
+ if specified, must contain a string consisting of an <a href=#unordered-set-of-unique-space-separated-tokens>unordered
+ set of unique space-separated tokens</a>, each of which must have
+ the value of an ID of an element in the same
+ <code><a href=#document>Document</a></code>.</p>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-output-element>output</a></code> element with its
+ <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
+ attribute represents the element's name.</p>
+
+ <div class=impl>
+
+ <p>The element has a <dfn id=concept-output-mode title=concept-output-mode>value mode
+ flag</dfn> which is either <i title=concept-output-mode-value>value</i> or <i title=concept-output-mode-default>default</i>. Initially, the
+ <a href=#concept-output-mode title=concept-output-mode>value mode flag</a> must be set
+ to <i title=concept-output-mode-default>default</i>.</p>
+
+ <p>The element also has a <dfn id=concept-output-defaultvalue title=concept-output-defaultValue>default value</dfn>. Initially,
+ the <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a>
+ must be the empty string.</p>
+
+ <p>When the <a href=#concept-output-mode title=concept-output-mode>value mode flag</a>
+ is in mode <i title=concept-output-mode-default>default</i>, the
+ contents of the element represent both the value of the element and
+ its <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default
+ value</a>. When the <a href=#concept-output-mode title=concept-output-mode>value mode
+ flag</a> is in mode <i title=concept-output-mode-value>value</i>, the contents of the
+ element represent the value of the element only, and the <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a> is only
+ accessible using the <code title=dom-output-defaultValue><a href=#dom-output-defaultvalue>defaultValue</a></code> IDL
+ attribute.</p>
+
+ <p>Whenever the element's descendants are changed in any way, if the
+ <a href=#concept-output-mode title=concept-output-mode>value mode flag</a> is in mode
+ <i title=concept-output-mode-default>default</i>, the element's
+ <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a> must
+ be set to the value of the element's <code><a href=#textcontent>textContent</a></code> IDL
+ attribute.</p>
+
+ <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
+ algorithm</a> for <code><a href=#the-output-element>output</a></code> elements is to set the
+ element's <a href=#concept-output-mode title=concept-output-mode>value mode flag</a>
+ to <i title=concept-output-mode-default>default</i> and then to
+ set the element's <code><a href=#textcontent>textContent</a></code> IDL attribute to the
+ value of the element's <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a> (thus
+ replacing the element's child nodes).</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">output</var> . <code title=dom-output-value><a href=#dom-output-value>value</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the element's current value.</p>
+
+ <p>Can be set, to change the value.</p>
+
+ </dd>
+
+ <dt><var title="">output</var> . <code title=dom-output-defaultValue><a href=#dom-output-defaultvalue>defaultValue</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the element's current default value.</p>
+
+ <p>Can be set, to change the default value.</p>
+
+ </dd>
+
+ <dt><var title="">output</var> . <code title=dom-output-type><a href=#dom-output-type>type</a></code></dt>
+
+ <dd>
+
+ <p>Returns the string "<code title="">output</code>".</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-output-value title=dom-output-value><code>value</code></dfn> IDL
+ attribute must act like the element's <code><a href=#textcontent>textContent</a></code> IDL
+ attribute, except that on setting, in addition, before the child
+ nodes are changed, the element's <a href=#concept-output-mode title=concept-output-mode>value mode flag</a> must be set to <i title=concept-output-mode-value>value</i>.</p>
+
+ <p>The <dfn id=dom-output-defaultvalue title=dom-output-defaultValue><code>defaultValue</code></dfn> IDL
+ attribute, on getting, must return the element's <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a>. On
+ setting, the attribute must set the element's <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a>, and, if
+ the element's <a href=#concept-output-mode title=concept-output-mode>value mode
+ flag</a> is in the mode <i title=concept-output-mode-default>default</i>, set the element's
+ <code><a href=#textcontent>textContent</a></code> IDL attribute as well.</p>
+
+ <p>The <dfn id=dom-output-type title=dom-output-type><code>type</code></dfn>
+ attribute must return the string "<code title="">output</code>".</p>
+
+ <p>The <dfn id=dom-output-htmlfor title=dom-output-htmlFor><code>htmlFor</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-output-for><a href=#attr-output-for>for</a></code> content attribute.</p>
+
+ <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code>
+ attributes, and the <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
+ <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides a list
+ of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
+ element's forms API.</p>
+
+ <p><strong>Constraint validation</strong>: <code><a href=#the-output-element>output</a></code>
+ elements are always <a href=#barred-from-constraint-validation>barred from constraint
+ validation</a>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>A simple calculator could use <code><a href=#the-output-element>output</a></code> for its
+ display of calculated results:</p>
+
+ <pre>&lt;form onsubmit="return false"&gt;
+ &lt;input name=a type=number step=any&gt; +
+ &lt;input name=b type=number step=any&gt; =
+ &lt;output onforminput="value = a.valueAsNumber + b.valueAsNumber"&gt;&lt;/output&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-progress-element><span class=secno>4.10.16 </span>The <dfn><code>progress</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#category-label title=category-label>Labelable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <code><a href=#the-progress-element>progress</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-progress-value><a href=#attr-progress-value>value</a></code></dd>
+ <dd><code title=attr-progress-max><a href=#attr-progress-max>max</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlprogresselement>HTMLProgressElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute float <a href=#dom-progress-value title=dom-progress-value>value</a>;
+ attribute float <a href=#dom-progress-max title=dom-progress-max>max</a>;
+ readonly attribute float <a href=#dom-progress-position title=dom-progress-position>position</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-progress-element>progress</a></code> element <a href=#represents>represents</a> the
+ completion progress of a task. The progress is either indeterminate,
+ indicating that progress is being made but that it is not clear how
+ much more work remains to be done before the task is complete
+ (e.g. because the task is waiting for a remote host to respond), or
+ the progress is a number in the range zero to a maximum, giving the
+ fraction of work that has so far been completed.</p>
+
+ <p>There are two attributes that determine the current task
+ completion represented by the element.</p>
+
+ <p>The <dfn id=attr-progress-value title=attr-progress-value><code>value</code></dfn>
+ attribute specifies how much of the task has been completed, and the
+ <dfn id=attr-progress-max title=attr-progress-max><code>max</code></dfn> attribute
+ specifies how much work the task requires in total. The units are
+ arbitrary and not specified.</p>
+
+ <p>Authors are encouraged to also include the current value and the
+ maximum value inline as text inside the element, so that the
+ progress is made available to users of legacy user agents.</p>
+
+ <div class=example>
+ <p>Here is a snippet of a Web application that shows the progress
+ of some automated task:</p>
+ <pre>&lt;section&gt;
+ &lt;h2&gt;Task Progress&lt;/h2&gt;
+ &lt;p&gt;Progress: &lt;progress id="p" max=100&gt;&lt;span&gt;0&lt;/span&gt;%&lt;/progress&gt;&lt;/p&gt;
+ &lt;script&gt;
+ var progressBar = document.getElementById('p');
+ function updateProgress(newValue) {
+ progressBar.value = newValue;
+ progressBar.getElementsByTagName('span')[0].textContent = newValue;
+ }
+ &lt;/script&gt;
+&lt;/section&gt;</pre>
+ <p>(The <code>updateProgress()</code> method in this example would
+ be called by some other code on the page to update the actual
+ progress bar as the task progressed.)</p>
+ </div>
+
+ <p>The <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> and <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attributes, when present, must
+ have values that are <a href=#valid-floating-point-number title="valid floating point number">valid
+ floating point numbers</a>. The <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute, if present, must
+ have a value equal to or greater than zero, and less than or equal
+ to the value of the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
+ attribute, if present, or 1.0, otherwise. The <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, if present, must
+ have a value greater than zero.</p>
+
+ <p class=note>The <code><a href=#the-progress-element>progress</a></code> element is the wrong
+ element to use for something that is just a gauge, as opposed to
+ task progress. For instance, indicating disk space usage using
+ <code><a href=#the-progress-element>progress</a></code> would be inappropriate. Instead, the
+ <code><a href=#the-meter-element>meter</a></code> element is available for such use cases.</p>
+
+ <div class=impl>
+
+ <p><strong>User agent requirements</strong>: If the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute is omitted, then
+ the progress bar is an indeterminate progress bar. Otherwise, it is
+ a determinate progress bar.</p>
+
+ <p>If the progress bar is a determinate progress bar and the element
+ has a <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, the user
+ agent must parse the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
+ attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating
+ point number values</a>. If this does not result in an error, and
+ if the parsed value is greater than zero, then the maximum value of
+ the progress bar is that value. Otherwise, if the element has no
+ <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, or if it has
+ one but parsing it resulted in an error, or if the parsed value was
+ less than or equal to zero, then the maximum value of the progress
+ bar is 1.0.</p>
+
+ <p>If the progress bar is a determinate progress bar, user agents
+ must parse the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>
+ attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating
+ point number values</a>. If this does not result in an error, and
+ if the parsed value is less than the maximum value and greater than
+ zero, then the current value of the progress bar is that parsed
+ value. Otherwise, if the parsed value was greater than or equal to
+ the maximum value, then the current value of the progress bar is the
+ maximum value of the progress bar. Otherwise, if parsing the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute's value resulted
+ in an error, or a number less than or equal to zero, then the
+ current value of the progress bar is zero.</p>
+
+ <p><strong>UA requirements for showing the progress bar</strong>:
+ When representing a <code><a href=#the-progress-element>progress</a></code> element to the user, the
+ UA should indicate whether it is a determinate or indeterminate
+ progress bar, and in the former case, should indicate the relative
+ position of the current value relative to the maximum value.</p>
+
+ <p>The <dfn id=dom-progress-max title=dom-progress-max><code>max</code></dfn> and <dfn id=dom-progress-value title=dom-progress-value><code>value</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name. When the relevant content attributes are absent, the IDL
+ attributes must return zero.</p>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-progress-element>progress</a></code> element with its
+ <a href=#form-owner>form owner</a>.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">progress</var> . <code title=dom-progress-position><a href=#dom-progress-position>position</a></code></dt>
+
+ <dd>
+
+ <p>For a determinate progress bar (one with known current and
+ maximum values), returns the result of dividing the current value
+ by the maximum value.</p>
+
+ <p>For an indeterminate progress bar, returns &minus;1.</p>
+
+ </dl><div class=impl>
+
+ <p>If the progress bar is an indeterminate progress bar, then the
+ <dfn id=dom-progress-position title=dom-progress-position><code>position</code></dfn> IDL
+ attribute must return &minus;1. Otherwise, it must return the result of
+ dividing the current value by the maximum value.</p>
+
+ <p>The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides
+ a list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute is part of the
+ element's forms API.</p>
+
+ </div>
+
+
+
+ <h4 id=the-meter-element><span class=secno>4.10.17 </span>The <dfn><code>meter</code></dfn> element</h4>
+ <!-- Keep this after <progress> and NOT close to <time> -->
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#category-label title=category-label>Labelable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <code><a href=#the-meter-element>meter</a></code> element descendants.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-meter-value><a href=#attr-meter-value>value</a></code></dd>
+ <dd><code title=attr-meter-min><a href=#attr-meter-min>min</a></code></dd>
+ <dd><code title=attr-meter-max><a href=#attr-meter-max>max</a></code></dd>
+ <dd><code title=attr-meter-low><a href=#attr-meter-low>low</a></code></dd>
+ <dd><code title=attr-meter-high><a href=#attr-meter-high>high</a></code></dd>
+ <dd><code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code></dd>
+ <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlmeterelement>HTMLMeterElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute float <a href=#dom-meter-value title=dom-meter-value>value</a>;
+ attribute float <a href=#dom-meter-min title=dom-meter-min>min</a>;
+ attribute float <a href=#dom-meter-max title=dom-meter-max>max</a>;
+ attribute float <a href=#dom-meter-low title=dom-meter-low>low</a>;
+ attribute float <a href=#dom-meter-high title=dom-meter-high>high</a>;
+ attribute float <a href=#dom-meter-optimum title=dom-meter-optimum>optimum</a>;
+ readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-fae-form title=dom-fae-form>form</a>;
+ readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-meter-element>meter</a></code> element <a href=#represents>represents</a> a scalar
+ measurement within a known range, or a fractional value; for example
+ disk usage, the relevance of a query result, or the fraction of a
+ voting population to have selected a particular candidate.</p>
+
+ <p>This is also known as a gauge.</p>
+
+ <p class=note>The <code><a href=#the-meter-element>meter</a></code> element should not be used to
+ indicate progress (as in a progress bar). For that role, HTML
+ provides a separate <code><a href=#the-progress-element>progress</a></code> element.</p>
+
+ <p class=note>The <code><a href=#the-meter-element>meter</a></code> element also does not
+ represent a scalar value of arbitrary range &mdash; for example, it
+ would be wrong to use this to report a weight, or height, unless
+ there is a known maximum value.</p>
+
+ <p>There are six attributes that determine the semantics of the
+ gauge represented by the element.</p>
+
+ <p>The <dfn id=attr-meter-min title=attr-meter-min><code>min</code></dfn> attribute
+ specifies the lower bound of the range, and the <dfn id=attr-meter-max title=attr-meter-max><code>max</code></dfn> attribute specifies
+ the upper bound. The <dfn id=attr-meter-value title=attr-meter-value><code>value</code></dfn> attribute
+ specifies the value to have the gauge indicate as the "measured"
+ value.</p>
+
+ <p>The other three attributes can be used to segment the gauge's
+ range into "low", "medium", and "high" parts, and to indicate which
+ part of the gauge is the "optimum" part. The <dfn id=attr-meter-low title=attr-meter-low><code>low</code></dfn> attribute specifies
+ the range that is considered to be the "low" part, and the <dfn id=attr-meter-high title=attr-meter-high><code>high</code></dfn> attribute specifies
+ the range that is considered to be the "high" part. The <dfn id=attr-meter-optimum title=attr-meter-optimum><code>optimum</code></dfn> attribute
+ gives the position that is "optimum"; if that is higher than the
+ "high" value then this indicates that the higher the value, the
+ better; if it's lower than the "low" mark then it indicates that
+ lower values are better, and naturally if it is in between then it
+ indicates that neither high nor low values are good.</p>
+
+ <p><span class=impl><strong>Authoring
+ requirements</strong>:</span> The <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute must be
+ specified. The <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>, <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>, <code title=attr-meter-low><a href=#attr-meter-low>low</a></code>, <code title=attr-meter-high><a href=#attr-meter-high>high</a></code>, <code title=attr-meter-max><a href=#attr-meter-max>max</a></code>, and <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> attributes, when present,
+ must have values that are <a href=#valid-floating-point-number title="valid floating point
+ number">valid floating point numbers</a>.</p>
+
+ <p>In addition, the attributes' values are further constrained:</p>
+
+ <p>Let <var title="">value</var> be the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute's number.</p>
+
+ <p>If the <code title=attr-meter-min><a href=#attr-meter-min>min</a></code> attribute
+ attribute is specified, then let <var title="">minimum</var> be that
+ attribute's value; otherwise, let it be zero.</p>
+
+ <p>If the <code title=attr-meter-max><a href=#attr-meter-max>max</a></code> attribute
+ attribute is specified, then let <var title="">maximum</var> be that
+ attribute's value; otherwise, let it be 1.0.</p>
+
+ <p>The following inequalities must hold, as applicable:</p>
+
+ <ul class=brief><li><var title="">minimum</var> &le; <var title="">value</var> &le; <var title="">maximum</var></li>
+ <li><var title="">minimum</var> &le; <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> &le; <var title="">maximum</var> (if <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> is specified)</li>
+ <li><var title="">minimum</var> &le; <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> &le; <var title="">maximum</var> (if <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> is specified)</li>
+ <li><var title="">minimum</var> &le; <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> &le; <var title="">maximum</var> (if <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> is specified)</li>
+ <li><code title=attr-meter-low><a href=#attr-meter-low>low</a></code> &le; <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> (if both <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> and <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> are specified)</li>
+ </ul><p class=note>If no minimum or maximum is specified, then the
+ range is assumed to be 0..1, and the value thus has to be within
+ that range.</p>
+
+ <p>Authors are encouraged to include a textual representation of the
+ gauge's state in the element's contents, for users of user agents
+ that do not support the <code><a href=#the-meter-element>meter</a></code> element.</p>
+
+ <div class=example>
+
+ <p>The following examples show three gauges that would all be
+ three-quarters full:</p>
+
+ <pre>Storage space usage: &lt;meter value=6 max=8&gt;6 blocks used (out of 8 total)&lt;/meter&gt;
+Voter turnout: &lt;meter value=0.75&gt;&lt;img alt="75%" src="graph75.png"&gt;&lt;/meter&gt;
+Tickets sold: &lt;meter min="0" max="100" value="75"&gt;&lt;/meter&gt;</pre>
+
+ <p>The following example is incorrect use of the element, because
+ it doesn't give a range (and since the default maximum is 1, both
+ of the gauges would end up looking maxed out):</p>
+
+ <pre class=bad>&lt;p&gt;The grapefruit pie had a radius of &lt;meter value=12&gt;12cm&lt;/meter&gt;
+and a height of &lt;meter value=2&gt;2cm&lt;/meter&gt;.&lt;/p&gt; &lt;!-- <strong>BAD!</strong> --&gt;</pre>
+
+ <p>Instead, one would either not include the meter element, or use
+ the meter element with a defined range to give the dimensions in
+ context compared to other pies:</p>
+
+ <pre>&lt;p&gt;The grapefruit pie had a radius of 12cm and a height of
+2cm.&lt;/p&gt;
+&lt;dl&gt;
+ &lt;dt&gt;Radius: &lt;dd&gt; &lt;meter min=0 max=20 value=12&gt;12cm&lt;/meter&gt;
+ &lt;dt&gt;Height: &lt;dd&gt; &lt;meter min=0 max=10 value=2&gt;2cm&lt;/meter&gt;
+&lt;/dl&gt;</pre>
+
+ </div>
+
+ <p>There is no explicit way to specify units in the
+ <code><a href=#the-meter-element>meter</a></code> element, but the units may be specified in the
+ <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute in free-form text.</p>
+
+ <div class=example>
+
+ <p>The example above could be extended to mention the units:</p>
+
+ <pre>&lt;dl&gt;
+ &lt;dt&gt;Radius: &lt;dd&gt; &lt;meter min=0 max=20 value=12 title="centimeters"&gt;12cm&lt;/meter&gt;
+ &lt;dt&gt;Height: &lt;dd&gt; &lt;meter min=0 max=10 value=2 title="centimeters"&gt;2cm&lt;/meter&gt;
+&lt;/dl&gt;</pre>
+
+ </div>
+
+ <div class=impl>
+
+ <p><strong>User agent requirements</strong>: User agents must parse
+ the <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>, <code title=attr-meter-max><a href=#attr-meter-max>max</a></code>, <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>, <code title=attr-meter-low><a href=#attr-meter-low>low</a></code>, <code title=attr-meter-high><a href=#attr-meter-high>high</a></code>, and <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> attributes using the
+ <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point number values</a>.</p>
+
+ <p>User agents must then use all these numbers to obtain values for
+ six points on the gauge, as follows. (The order in which these are
+ evaluated is important, as some of the values refer to earlier
+ ones.)</p>
+
+ <dl><dt>The minimum value</dt>
+
+ <dd>
+ <p>If the <code title=attr-meter-min><a href=#attr-meter-min>min</a></code> attribute is
+ specified and a value could be parsed out of it, then the minimum
+ value is that value. Otherwise, the minimum value is zero.</p>
+ </dd>
+
+ <dt>The maximum value</dt>
+
+ <dd>
+
+ <p>If the <code title=attr-meter-max><a href=#attr-meter-max>max</a></code> attribute is
+ specified and a value could be parsed out of it, the maximum value
+ is that value. Otherwise, the maximum value is 1.0.</p>
+
+ <p>If the maximum value would be less than the minimum value, then
+ the maximum value is actually the same as the minimum value.</p>
+
+ </dd>
+
+ <dt>The actual value</dt>
+
+ <dd>
+
+ <p>If the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute is
+ specified and a value could be parsed out of it, then that value
+ is the actual value. Otherwise, the actual value is zero.</p>
+
+ <p>If the actual value would be less than the minimum value, then
+ the actual value is actually the same as the minimum value.</p>
+
+ <p>If, on the other hand, the actual value would be greater than
+ the maximum value, then the actual value is the maximum value.</p>
+
+ </dd>
+
+ <dt>The low boundary</dt>
+
+ <dd>
+
+ <p>If the <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> attribute is
+ specified and a value could be parsed out of it, then the low
+ boundary is that value. Otherwise, the low boundary is the same as
+ the minimum value.</p>
+
+ <p>If the low boundary is then less than the minimum value, then
+ the low boundary is actually the same as the minimum
+ value. Similarly, if the low boundary is greater than the maximum
+ value, then it is actually the maximum value instead.</p>
+
+ </dd>
+
+ <dt>The high boundary</dt>
+
+ <dd>
+
+ <p>If the <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> attribute is
+ specified and a value could be parsed out of it, then the high
+ boundary is that value. Otherwise, the high boundary is the same
+ as the maximum value.</p>
+
+ <p>If the high boundary is then less than the low boundary, then
+ the high boundary is actually the same as the low
+ boundary. Similarly, if the high boundary is greater than the
+ maximum value, then it is actually the maximum value instead.</p>
+
+ </dd>
+
+ <dt>The optimum point</dt>
+
+ <dd>
+
+ <p>If the <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code>
+ attribute is specified and a value could be parsed out of it, then
+ the optimum point is that value. Otherwise, the optimum point is
+ the midpoint between the minimum value and the maximum value.</p>
+
+ <p>If the optimum point is then less than the minimum value, then
+ the optimum point is actually the same as the minimum
+ value. Similarly, if the optimum point is greater than the maximum
+ value, then it is actually the maximum value instead.</p>
+
+ </dd>
+
+ </dl><p>All of which will result in the following inequalities all being
+ true:</p>
+
+ <ul class=brief><li>minimum value &le; actual value &le; maximum value</li>
+ <li>minimum value &le; low boundary &le; high boundary &le; maximum value</li>
+ <li>minimum value &le; optimum point &le; maximum value</li>
+ </ul><!-- next two paragraphs are duplicated in the <datagrid> section [v2DATAGRID] --><p><strong>UA requirements for regions of the gauge</strong>: If the
+ optimum point is equal to the low boundary or the high boundary, or
+ anywhere in between them, then the region between the low and high
+ boundaries of the gauge must be treated as the optimum region, and
+ the low and high parts, if any, must be treated as
+ suboptimal. Otherwise, if the optimum point is less than the low
+ boundary, then the region between the minimum value and the low
+ boundary must be treated as the optimum region, the region between
+ the low boundary and the high boundary must be treated as a
+ suboptimal region, and the region between the high boundary and the
+ maximum value must be treated as an even less good region. Finally,
+ if the optimum point is higher than the high boundary, then the
+ situation is reversed; the region between the high boundary and the
+ maximum value must be treated as the optimum region, the region
+ between the high boundary and the low boundary must be treated as a
+ suboptimal region, and the remaining region between the low boundary
+ and the minimum value must be treated as an even less good
+ region.</p>
+
+ <p><strong>UA requirements for showing the gauge</strong>: When
+ representing a <code><a href=#the-meter-element>meter</a></code> element to the user, the UA should
+ indicate the relative position of the actual value to the minimum
+ and maximum values, and the relationship between the actual value
+ and the three regions of the gauge.</p>
+
+ </div>
+
+ <div class=example>
+ <p>The following markup:</p>
+ <pre>&lt;h3&gt;Suggested groups&lt;/h3&gt;
+&lt;menu type="toolbar"&gt;
+ &lt;a href="?cmd=hsg" onclick="hideSuggestedGroups()"&gt;Hide suggested groups&lt;/a&gt;
+&lt;/menu&gt;
+&lt;ul&gt;
+ &lt;li&gt;
+ &lt;p&gt;&lt;a href="/group/comp.infosystems.www.authoring.stylesheets/view"&gt;comp.infosystems.www.authoring.stylesheets&lt;/a&gt; -
+ &lt;a href="/group/comp.infosystems.www.authoring.stylesheets/subscribe"&gt;join&lt;/a&gt;&lt;/p&gt;
+ &lt;p&gt;Group description: &lt;strong&gt;Layout/presentation on the WWW.&lt;/strong&gt;&lt;/p&gt;
+ &lt;p&gt;<strong>&lt;meter value="0.5"&gt;Moderate activity,&lt;/meter&gt;</strong> Usenet, 618 subscribers&lt;/p&gt;
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;p&gt;&lt;a href="/group/netscape.public.mozilla.xpinstall/view"&gt;netscape.public.mozilla.xpinstall&lt;/a&gt; -
+ &lt;a href="/group/netscape.public.mozilla.xpinstall/subscribe"&gt;join&lt;/a&gt;&lt;/p&gt;
+ &lt;p&gt;Group description: &lt;strong&gt;Mozilla XPInstall discussion.&lt;/strong&gt;&lt;/p&gt;
+ &lt;p&gt;<strong>&lt;meter value="0.25"&gt;Low activity,&lt;/meter&gt;</strong> Usenet, 22 subscribers&lt;/p&gt;
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;p&gt;&lt;a href="/group/mozilla.dev.general/view"&gt;mozilla.dev.general&lt;/a&gt; -
+ &lt;a href="/group/mozilla.dev.general/subscribe"&gt;join&lt;/a&gt;&lt;/p&gt;
+ &lt;p&gt;<strong>&lt;meter value="0.25"&gt;Low activity,&lt;/meter&gt;</strong> Usenet, 66 subscribers&lt;/p&gt;
+ &lt;/li&gt;
+&lt;/ul&gt;</pre>
+ <p>Might be rendered as follows:</p>
+ <p><img alt="With the <meter> elements rendered as inline green bars of varying lengths." src=images/sample-meter.png></p>
+ </div>
+
+ <p>User agents <span class=impl>may</span> combine the value of
+ the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute and the other
+ attributes to provide context-sensitive help or inline text
+ detailing the actual values.</p>
+
+ <div class=example>
+ <p>For example, the following snippet:</p>
+ <pre>&lt;meter min=0 max=60 value=23.2 title=seconds&gt;&lt;/meter&gt;</pre>
+ <p>...might cause the user agent to display a gauge with a tooltip
+ saying "Value: 23.2 out of 60." on one line and "seconds" on a
+ second line.</p>
+ </div>
+
+ <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
+ explicitly associate the <code><a href=#the-meter-element>meter</a></code> element with its
+ <a href=#form-owner>form owner</a>.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-meter-min title=dom-meter-min><code>min</code></dfn>, <dfn id=dom-meter-max title=dom-meter-max><code>max</code></dfn>, <dfn id=dom-meter-value title=dom-meter-value><code>value</code></dfn>, <dfn id=dom-meter-low title=dom-meter-low><code>low</code></dfn>, <dfn id=dom-meter-high title=dom-meter-high><code>high</code></dfn>, and <dfn id=dom-meter-optimum title=dom-meter-optimum><code>optimum</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name. When the relevant content attributes are absent, the IDL
+ attributes must return zero.</p>
+
+ <p>The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> attribute provides
+ a list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute is part of the
+ element's forms API.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows how a gauge could fall back to
+ localized or pretty-printed text.</p>
+
+ <pre>&lt;p&gt;Disk usage: &lt;meter min=0 value=170261928 max=233257824&gt;170&thinsp;261&thinsp;928 bytes used
+out of 233&thinsp;257&thinsp;824 bytes available&lt;/meter&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+
+
+
+ <h4 id=association-of-controls-and-forms><span class=secno>4.10.18 </span>Association of controls and forms</h4>
+
+ <p>A <a href=#form-associated-element>form-associated element</a> can have a relationship
+ with a <code><a href=#the-form-element>form</a></code> element, which is called the element's
+ <dfn id=form-owner>form owner</dfn>. If a <a href=#form-associated-element>form-associated element</a> is
+ not associated with a <code><a href=#the-form-element>form</a></code> element, its <a href=#form-owner>form
+ owner</a> is said to be null.</p>
+
+ <p>A <a href=#form-associated-element>form-associated element</a> is, by default, associated
+ with its nearest ancestor <code><a href=#the-form-element>form</a></code> element<span class=impl> (as described below)</span>, but may have a <dfn id=attr-fae-form title=attr-fae-form><code>form</code></dfn> attribute specified to
+ override this.</p>
+
+ <p>If a <a href=#form-associated-element>form-associated element</a> has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute specified, then its
+ value must be the ID of a <code><a href=#the-form-element>form</a></code> element in the element's
+ owner <code><a href=#document>Document</a></code>.</p>
+
+ <div class=impl>
+
+ <p>When a <a href=#form-associated-element>form-associated element</a> is created, its
+ <a href=#form-owner>form owner</a> must be initialized to null (no owner).</p>
+
+ <p>When a <a href=#form-associated-element>form-associated element</a> is to be <dfn id=concept-form-association title=concept-form-association>associated</dfn> with a form, its
+ <a href=#form-owner>form owner</a> must be set to that form.</p>
+
+ <p>When a <a href=#form-associated-element>form-associated element</a>'s ancestor chain
+ changes, e.g. because it or one of its ancestors was <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted</a> or <a href=#remove-an-element-from-a-document title="remove an element from a document">removed</a> from a
+ <code><a href=#document>Document</a></code>, then the user agent must <a href=#reset-the-form-owner>reset the form
+ owner</a> of that element.</p>
+
+ <p>When a <a href=#form-associated-element>form-associated element</a>'s <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is added, removed, or
+ has its value changed, then the user agent must <a href=#reset-the-form-owner>reset the form
+ owner</a> of that element.</p>
+
+ <p>When a <a href=#form-associated-element>form-associated element</a> has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute and the ID of any of the
+ elements in the <code><a href=#document>Document</a></code> changes, then the user agent
+ must <a href=#reset-the-form-owner>reset the form owner</a> of that <a href=#form-associated-element>form-associated
+ element</a>.</p>
+
+ <p>When a <a href=#form-associated-element>form-associated element</a> has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute and an element with an
+ ID is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted
+ into</a> or <a href=#remove-an-element-from-a-document title="remove an element from a
+ document">removed from</a> the <code><a href=#document>Document</a></code>, then the
+ user agent must <a href=#reset-the-form-owner>reset the form owner</a> of that
+ <a href=#form-associated-element>form-associated element</a>.</p>
+
+ <p>When the user agent is to <dfn id=reset-the-form-owner>reset the form owner</dfn> of a
+ <a href=#form-associated-element>form-associated element</a>, it must run the following
+ steps:</p>
+
+ <ol><li><p>If the element's <a href=#form-owner>form owner</a> is not null, and
+ the element's <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> content
+ attribute is not present, and the element's <a href=#form-owner>form owner</a>
+ is its nearest <code><a href=#the-form-element>form</a></code> element ancestor after the change
+ to the ancestor chain, then do nothing, and abort these
+ steps.</li>
+
+ <li><p>Let the element's <a href=#form-owner>form owner</a> be null.</li>
+
+ <li>
+
+ <p>If the element has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>
+ content attribute, then run these substeps:</p>
+
+ <ol><!-- note that this ignores the name="" attribute and is
+ unaffected by quirks mode (it's always case sensitive) --><li><p>If the first element <a href=#in-a-document title="in a Document">in the
+ <code>Document</code></a> to have an ID that is <a href=#case-sensitive title=case-sensitive>case-sensitively</a> equal to the
+ element's <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> content
+ attribute's value is a <code><a href=#the-form-element>form</a></code> element, then <a href=#concept-form-association title=concept-form-association>associate</a> the
+ <a href=#form-associated-element>form-associated element</a> with that <code><a href=#the-form-element>form</a></code>
+ element.</li>
+
+ <li><p>Abort the "reset the form owner" steps.</li>
+
+ </ol></li>
+
+ <li><p>Otherwise, if the <a href=#form-associated-element>form-associated element</a> in
+ question has an ancestor <code><a href=#the-form-element>form</a></code> element, then <a href=#concept-form-association title=concept-form-association>associate</a> the
+ <a href=#form-associated-element>form-associated element</a> with the nearest such ancestor
+ <code><a href=#the-form-element>form</a></code> element.</li>
+
+ <li><p>Otherwise, the element is left unassociated.</li>
+
+ </ol><div class=example>
+
+ <p>In the following non-conforming snippet:</p>
+
+ <pre class=bad>...
+ &lt;form id="a"&gt;
+ &lt;div id="b"&gt;&lt;/div&gt;
+ &lt;/form&gt;
+ &lt;script&gt;
+ document.getElementById('b').innerHTML =
+ '&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;form id="c"&gt;&lt;input id="d"&gt;&lt;/table&gt;' +
+ '&lt;input id="e"&gt;';
+ &lt;/script&gt;
+...</pre>
+
+ <p>The <a href=#form-owner>form owner</a> of "d" would be the inner nested
+ form "c", while the <a href=#form-owner>form owner</a> of "e" would be the
+ outer form "a".</p>
+
+ <p>This is because despite the association of "e" with "c" in the
+ <a href=#html-parser>HTML parser</a>, when the <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> algorithm moves the nodes
+ from the temporary document to the "b" element, the nodes see their
+ ancestor chain change, and thus all the "magic" associations done
+ by the parser are reset to normal ancestor associations.</p>
+
+ <p>This example is a non-conforming document, though, as it is a
+ violation of the content models to nest <code><a href=#the-form-element>form</a></code>
+ elements.</p>
+
+ </div>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-fae-form><a href=#dom-fae-form>form</a></code></dt>
+
+ <dd>
+
+ <p>Returns the element's <a href=#form-owner>form owner</a>.</p>
+
+ <p>Returns null if there isn't one.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p><a href=#form-associated-element title="form-associated element">Form-associated
+ elements</a> have a <dfn id=dom-fae-form title=dom-fae-form><code>form</code></dfn> IDL attribute, which,
+ on getting, must return the element's <a href=#form-owner>form owner</a>, or
+ null if there isn't one.</p>
+
+ </div>
+
+
+
+ <h4 id=attributes-common-to-form-controls><span class=secno>4.10.19 </span><dfn>Attributes common to form controls</dfn></h4>
+
+ <h5 id=naming-form-controls><span class=secno>4.10.19.1 </span>Naming form controls</h5>
+
+ <p>The <dfn id=attr-fe-name title=attr-fe-name><code>name</code></dfn> content
+ attribute gives the name of the form control, as used in <a href=#form-submission>form
+ submission</a> and in the <code><a href=#the-form-element>form</a></code> element's <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> object. If the attribute
+ is specified, its value must not be the empty string.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-fe-name title=dom-fe-name><code>name</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> content attribute.</p>
+
+ </div>
+
+
+ <h5 id=enabling-and-disabling-form-controls><span class=secno>4.10.19.2 </span>Enabling and disabling form controls</h5>
+
+ <p>The <dfn id=attr-fe-disabled title=attr-fe-disabled><code>disabled</code></dfn>
+ content attribute is a <a href=#boolean-attribute>boolean attribute</a>.</p>
+
+ <p>A form control is <dfn id=concept-fe-disabled title=concept-fe-disabled>disabled</dfn>
+ if its <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is
+ set, or if it is a descendant of a <code><a href=#the-fieldset-element>fieldset</a></code> element
+ whose <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code> attribute
+ is set and is <em>not</em> a descendant of that
+ <code><a href=#the-fieldset-element>fieldset</a></code> element's first <code><a href=#the-legend-element>legend</a></code> element
+ child, if any.</p>
+
+ <div class=impl>
+
+ <p>A form control that is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> must prevent any <code title=event-click><a href=#event-click>click</a></code> events that are <a href=#queue-a-task title="queue
+ a task">queued</a> on the <a href=#user-interaction-task-source>user interaction task
+ source</a> from being dispatched on the element.</p>
+
+ <p><strong>Constraint validation</strong>: If an element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, it is <a href=#barred-from-constraint-validation>barred from
+ constraint validation</a>.</p>
+
+ <p>The <dfn id=dom-fe-disabled title=dom-fe-disabled><code>disabled</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> content attribute.</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h5 id="a-form-control's-value"><span class=secno>4.10.19.3 </span>A form control's value</h5>
+
+ <p>Form controls have a <dfn id=concept-fe-value title=concept-fe-value>value</dfn>
+ and a <dfn id=concept-fe-checked title=concept-fe-checked>checkedness</dfn>. (The latter
+ is only used by <code><a href=#the-input-element>input</a></code> elements.) These are used to
+ describe how the user interacts with the control.</p>
+
+ </div>
+
+
+
+ <h5 id=autofocusing-a-form-control><span class=secno>4.10.19.4 </span>Autofocusing a form control</h5>
+
+ <!-- v2: Apply this to contentEditable elements -->
+
+ <p>The <dfn id=attr-fe-autofocus title=attr-fe-autofocus><code>autofocus</code></dfn>
+ content attribute allows the user to indicate that a control is to
+ be focused as soon as the page is loaded, allowing the user to just
+ start typing without having to manually focus the main control.</p>
+
+ <p>The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute is
+ a <a href=#boolean-attribute>boolean attribute</a>.</p>
+
+ <p>There must not be more than one element in the document with the
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute
+ specified.</p>
+
+ <div class=impl>
+
+ <p>Whenever an element with the <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute specified is
+ <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into a
+ document</a> whose <a href=#browsing-context>browsing context</a> did not have the
+ <a href=#sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</a> set
+ when the <code><a href=#document>Document</a></code> was created, the user agent should
+ <a href=#queue-a-task>queue a task</a> that checks to see if the element is
+ <a href=#focusable>focusable</a>, and if so, runs the <a href=#focusing-steps>focusing
+ steps</a> for that element. User agents may also change the
+ scrolling position of the document, or perform some other action
+ that brings the element to the user's attention. The <a href=#task-source>task
+ source</a> for this task is the <a href=#dom-manipulation-task-source>DOM manipulation task
+ source</a>.</p>
+
+ <p>User agents may ignore this attribute if the user has indicated
+ (for example, by starting to type in a form control) that he does
+ not wish focus to be changed.</p>
+
+ <p class=note>Focusing the control does not imply that the user
+ agent must focus the browser window if it has lost focus.</p>
+
+ <p>The <dfn id=dom-fe-autofocus title=dom-fe-autofocus><code>autofocus</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ </div>
+
+ <div class=example>
+ <p>In the following snippet, the text control would be focused when
+ the document was loaded.</p>
+ <pre>&lt;input maxlength="256" name="q" value="" autofocus&gt;
+&lt;input type="submit" value="Search"&gt;</pre>
+ </div>
+
+
+ <h5 id=limiting-user-input-length><span class=secno>4.10.19.5 </span>Limiting user input length</h5>
+
+ <p>A <dfn id=attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</dfn>, controlled by a <var title="">dirty value flag</var> declares a limit on the number of
+ characters a user can input.</p>
+
+ <p>If an element has its <a href=#attr-fe-maxlength title=attr-fe-maxlength>form
+ control <code title="">maxlength</code> attribute</a> specified,
+ the attribute's value must be a <a href=#valid-non-negative-integer>valid non-negative
+ integer</a>. If the attribute is specified and applying the
+ <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to its value
+ results in a number, then that number is the element's <dfn id=maximum-allowed-value-length>maximum
+ allowed value length</dfn>. If the attribute is omitted or parsing
+ its value results in an error, then there is no <a href=#maximum-allowed-value-length>maximum
+ allowed value length</a>.</p>
+
+ <div class=impl>
+
+ <p><strong>Constraint validation</strong>: If an element has a
+ <a href=#maximum-allowed-value-length>maximum allowed value length</a>, and its <var title="">dirty value flag</var> is true, and the <a href=#code-point-length>code-point
+ length</a> of the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is greater than the element's
+ <a href=#maximum-allowed-value-length>maximum allowed value length</a>, then the element is
+ <a href=#suffering-from-being-too-long>suffering from being too long</a>.</p>
+
+ <p>User agents may prevent the user from causing the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to be set to a value whose
+ <a href=#code-point-length>code-point length</a> is greater than the element's
+ <a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>
+
+ </div>
+
+
+
+ <h5 id=form-submission-0><span class=secno>4.10.19.6 </span>Form submission</h5>
+
+ <p><dfn id=attributes-for-form-submission>Attributes for form submission</dfn> can be specified both
+ on <code><a href=#the-form-element>form</a></code> elements and on <a href=#concept-submit-button title=concept-submit-button>submit buttons</a> (elements that
+ represent buttons that submit forms, e.g. an <code><a href=#the-input-element>input</a></code>
+ element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is
+ in the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a>
+ state).
+
+ <p>The <a href=#attributes-for-form-submission>attributes for form submission</a> that may be
+ specified on <code><a href=#the-form-element>form</a></code> elements are <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>, <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>, <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>, <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>, and <code title=attr-fs-target><a href=#attr-fs-target>target</a></code>.</p>
+
+ <p>The corresponding <a href=#attributes-for-form-submission>attributes for form submission</a>
+ that may be specified on <a href=#concept-submit-button title=concept-submit-button>submit
+ buttons</a> are <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>. When omitted, they
+ default to the values given on the corresponding attributes on the
+ <code><a href=#the-form-element>form</a></code> element.</p>
+
+ <hr><p>The <dfn id=attr-fs-action title=attr-fs-action><code>action</code></dfn> and
+ <dfn id=attr-fs-formaction title=attr-fs-formaction><code>formaction</code></dfn>
+ content attributes, if specified, must have a value that is a
+ <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</a>.</p>
+
+ <p>The <dfn id=concept-fs-action title=concept-fs-action>action</dfn> of an element is
+ the value of the element's <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> attribute, if the
+ element is a <a href=#concept-submit-button title=concept-submit-button>submit
+ button</a> and has such an attribute, or the value of its
+ <a href=#form-owner>form owner</a>'s <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>
+ attribute, if <em>it</em> has one, or else the empty string.</p>
+
+ <hr><p>The <dfn id=attr-fs-method title=attr-fs-method><code>method</code></dfn> and
+ <dfn id=attr-fs-formmethod title=attr-fs-formmethod><code>formmethod</code></dfn>
+ content attributes are <a href=#enumerated-attribute title="enumerated attribute">enumerated
+ attributes</a> with the following keywords and states:</p>
+
+ <ul><li>The keyword <dfn id=attr-fs-method-get-keyword title=attr-fs-method-GET-keyword><code>GET</code></dfn>, mapping
+ to the state <dfn id=attr-fs-method-get title=attr-fs-method-GET>GET</dfn>, indicating
+ the HTTP GET method.</li>
+
+ <li>The keyword <dfn id=attr-fs-method-post-keyword title=attr-fs-method-POST-keyword><code>POST</code></dfn>, mapping
+ to the state <dfn id=attr-fs-method-post title=attr-fs-method-POST>POST</dfn>, indicating
+ the HTTP POST method.</li>
+
+ <li>The keyword <dfn id=attr-fs-method-put-keyword title=attr-fs-method-PUT-keyword><code>PUT</code></dfn>, mapping
+ to the state <dfn id=attr-fs-method-put title=attr-fs-method-PUT>PUT</dfn>, indicating
+ the HTTP PUT method.</li>
+
+ <li>The keyword <dfn id=attr-fs-method-delete-keyword title=attr-fs-method-DELETE-keyword><code>DELETE</code></dfn>, mapping
+ to the state <dfn id=attr-fs-method-delete title=attr-fs-method-DELETE>DELETE</dfn>, indicating
+ the HTTP DELETE method.</li>
+
+ </ul><p>The <i>missing value default</i> for these attributes is the
+ <a href=#attr-fs-method-get title=attr-fs-method-GET>GET</a> state.</p>
+
+ <p>The <dfn id=concept-fs-method title=concept-fs-method>method</dfn> of an element is
+ one of those four states. If the element is a <a href=#concept-submit-button title=concept-submit-button>submit button</a> and has a <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> attribute, then the
+ element's <a href=#concept-fs-method title=concept-fs-method>method</a> is that
+ attribute's state; otherwise, it is the <a href=#form-owner>form owner</a>'s
+ <code title=attr-fs-method><a href=#attr-fs-method>method</a></code> attribute's state.</p>
+
+ <hr><p>The <dfn id=attr-fs-enctype title=attr-fs-enctype><code>enctype</code></dfn> and
+ <dfn id=attr-fs-formenctype title=attr-fs-formenctype><code>formenctype</code></dfn>
+ content attributes are <a href=#enumerated-attribute title="enumerated attribute">enumerated
+ attributes</a> with the following keywords and states:</p>
+
+ <ul><li>The "<dfn id=attr-fs-enctype-urlencoded title=attr-fs-enctype-urlencoded><code>application/x-www-form-urlencoded</code></dfn>" keyword and corresponding state.</li>
+ <li>The "<dfn id=attr-fs-enctype-formdata title=attr-fs-enctype-formdata><code>multipart/form-data</code></dfn>" keyword and corresponding state.</li>
+ <li>The "<dfn id=attr-fs-enctype-text title=attr-fs-enctype-text><code>text/plain</code></dfn>" keyword and corresponding state.</li>
+ </ul><p>The <i>missing value default</i> for these attributes is the
+ <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>
+ state.</p>
+
+ <p>The <dfn id=concept-fs-enctype title=concept-fs-enctype>enctype</dfn> of an element
+ is one of those three states. If the element is a <a href=#concept-submit-button title=concept-submit-button>submit button</a> and has a <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> attribute, then the
+ element's <a href=#concept-fs-enctype title=concept-fs-enctype>enctype</a> is that
+ attribute's state; otherwise, it is the <a href=#form-owner>form owner</a>'s
+ <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code> attribute's state.</p>
+
+ <hr><p>The <dfn id=attr-fs-target title=attr-fs-target><code>target</code></dfn> and
+ <dfn id=attr-fs-formtarget title=attr-fs-formtarget><code>formtarget</code></dfn>
+ content attributes, if specified, must have values that are <a href=#valid-browsing-context-name-or-keyword title="valid browsing context name or keyword">valid browsing
+ context names or keywords</a>.</p>
+
+ <p>The <dfn id=concept-fs-target title=concept-fs-target>target</dfn> of an element is
+ the value of the element's <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attribute, if the
+ element is a <a href=#concept-submit-button title=concept-submit-button>submit
+ button</a> and has such an attribute; or the value of its
+ <a href=#form-owner>form owner</a>'s <code title=attr-fs-target><a href=#attr-fs-target>target</a></code>
+ attribute, if <em>it</em> has such an attribute; or, if one of the
+ child nodes of <a href=#the-head-element>the <code>head</code> element</a> is a
+ <code><a href=#the-base-element>base</a></code> element with a <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute, then the value of
+ the <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute of the
+ first such <code><a href=#the-base-element>base</a></code> element; or, if there is no such
+ element, the empty string.</p> <!-- c.f. hyperlink following -->
+
+ <hr><p>The <dfn id=attr-fs-novalidate title=attr-fs-novalidate><code>novalidate</code></dfn>
+ and <dfn id=attr-fs-formnovalidate title=attr-fs-formnovalidate><code>formnovalidate</code></dfn>
+ content attributes are <a href=#boolean-attribute title="boolean attribute">boolean
+ attributes</a>. If present, they indicate that the form is not to
+ be validated during submission.</p>
+
+ <p>The <dfn id=concept-fs-novalidate title=concept-fs-novalidate>no-validate state</dfn> of
+ an element is true if the element is a <a href=#concept-submit-button title=concept-submit-button>submit button</a> and the element's
+ <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute
+ is present, or if the element's <a href=#form-owner>form owner</a>'s <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code> attribute is present,
+ and false otherwise.</p>
+
+ <div class=example>
+
+ <p>This attribute is useful to include "save" buttons on forms that
+ have validation constraints, to allow users to save their progress
+ even though they haven't fully entered the data in the form. The
+ following example shows a simple form that has two required
+ fields. There are three buttons: one to submit the form, which
+ requires both fields to be filled in; one to save the form so that
+ the user can come back and fill it in later; and one to cancel the
+ form altogether.</p>
+
+ <pre>&lt;form action="editor.cgi" method="post"&gt;
+ &lt;p&gt;&lt;label&gt;Name: &lt;input required name=fn&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;label&gt;Essay: &lt;textarea name=essay&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;input type=submit name=submit value="Submit essay"&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;input type=submit formnovalidate name=save value="Save essay"&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;input type=submit formnovalidate name=cancel value="Cancel"&gt;&lt;/p&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+ <div class=impl>
+
+ <hr><p>The <dfn id=dom-fs-action title=dom-fs-action><code>action</code></dfn>, <dfn id=dom-fs-method title=dom-fs-method><code>method</code></dfn>, <dfn id=dom-fs-enctype title=dom-fs-enctype><code>enctype</code></dfn>, and <dfn id=dom-fs-target title=dom-fs-target><code>target</code></dfn> IDL attributes must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name. The <dfn id=dom-fs-novalidate title=dom-fs-noValidate><code>noValidate</code></dfn> IDL
+ attribute must reflect the <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code> content attribute. The
+ <dfn id=dom-fs-formaction title=dom-fs-formAction><code>formAction</code></dfn> IDL
+ attribute must reflect the <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> content attribute. The
+ <dfn id=dom-fs-formenctype title=dom-fs-formEnctype><code>formEnctype</code></dfn> IDL
+ attribute must reflect the <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> content attribute.
+ The <dfn id=dom-fs-formmethod title=dom-fs-formMethod><code>formMethod</code></dfn> IDL
+ attribute must reflect the <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> content attribute. The
+ <dfn id=dom-fs-formnovalidate title=dom-fs-formNoValidate><code>formNoValidate</code></dfn>
+ IDL attribute must reflect the <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> content
+ attribute. The <dfn id=dom-fs-formtarget title=dom-fs-formTarget><code>formTarget</code></dfn> IDL
+ attribute must reflect the <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> content attribute.
+
+ </div>
+
+
+
+ <h4 id=constraints><span class=secno>4.10.20 </span>Constraints</h4>
+
+ <h5 id=definitions><span class=secno>4.10.20.1 </span>Definitions</h5>
+
+ <div class=impl>
+
+ <p>A <a href=#category-listed title=category-listed>listed form-associated
+ element</a> is a <dfn id=candidate-for-constraint-validation>candidate for constraint validation</dfn>
+ except when a condition has <dfn id=barred-from-constraint-validation title="barred from constraint
+ validation">barred the element from constraint
+ validation</dfn>. (For example, an element is <a href=#barred-from-constraint-validation>barred from
+ constraint validation</a> if it is an <code><a href=#the-output-element>output</a></code> or
+ <code><a href=#the-fieldset-element>fieldset</a></code> element.)</p>
+
+ <p>An element can have a <dfn id=custom-validity-error-message>custom validity error message</dfn>
+ defined. Initially, an element must have its <a href=#custom-validity-error-message>custom validity
+ error message</a> set to the empty string. When its value is not
+ the empty string, the element is <a href=#suffering-from-a-custom-error>suffering from a custom
+ error</a>. It can be set using the <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ method. The user agent should use the <a href=#custom-validity-error-message>custom validity error
+ message</a> when alerting the user to the problem with the
+ control.</p>
+
+ <p>An element can be constrained in various ways. The following is
+ the list of <dfn id=validity-states>validity states</dfn> that a form control can be
+ in, making the control invalid for the purposes of constraint
+ validation. (The definitions below are non-normative; other parts of
+ this specification define more precisely when each state applies or
+ does not.)</p>
+
+ <dl><dt> <dfn id=suffering-from-being-missing>Suffering from being missing</dfn> </dt>
+
+ <dd> <p>When a control has no <a href=#concept-fe-value title=concept-fe-value>value</a> but has a <code title="">required</code> attribute (<code><a href=#the-input-element>input</a></code> <code title=attr-input-required><a href=#attr-input-required>required</a></code>, <code><a href=#the-textarea-element>textarea</a></code>
+ <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>). </dd>
+
+ <dt> <dfn id=suffering-from-a-type-mismatch>Suffering from a type mismatch</dfn> </dt>
+
+ <dd> <p>When a control that allows arbitrary user
+ input has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is not
+ in the correct syntax (<a href=#e-mail-state title=attr-input-type-email>E-mail</a>, <a href=#url-state title=attr-input-type-url>URL</a>). </dd>
+
+ <dt> <dfn id=suffering-from-a-pattern-mismatch>Suffering from a pattern mismatch</dfn> </dt>
+
+ <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that doesn't satisfy the
+ <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute.</dd>
+
+ <dt> <dfn id=suffering-from-being-too-long>Suffering from being too long</dfn> </dt>
+
+ <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is too long for the
+ <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</a> (<code><a href=#the-input-element>input</a></code>
+ <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
+ <code><a href=#the-textarea-element>textarea</a></code> <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>). </dd>
+
+ <dt> <dfn id=suffering-from-an-underflow>Suffering from an underflow</dfn> </dt>
+
+ <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is too low for the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute.</dd>
+
+ <dt> <dfn id=suffering-from-an-overflow>Suffering from an overflow</dfn> </dt>
+
+ <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is too high for the
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code> attribute.</dd>
+
+ <dt> <dfn id=suffering-from-a-step-mismatch>Suffering from a step mismatch</dfn> </dt>
+
+ <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that doesn't fit the rules
+ given by the <code title=attr-input-step><a href=#attr-input-step>step</a></code>
+ attribute.</dd>
+
+ <dt> <dfn id=suffering-from-a-custom-error>Suffering from a custom error</dfn> </dt>
+
+ <dd> <p>When a control's <a href=#custom-validity-error-message>custom validity error
+ message</a> (as set by the element's <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
+ method) is not the empty string.</p> </dd>
+
+ </dl><p class=note>An element can still suffer from these states even
+ when the element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>; thus these states can
+ be represented in the DOM even if validating the form during
+ submission wouldn't indicate a problem to the user.</p>
+
+ <p>An element <dfn id=concept-fv-valid title=concept-fv-valid>satisfies its
+ constraints</dfn> if it is not suffering from any of the above
+ <a href=#validity-states>validity states</a>.</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h5 id=constraint-validation><span class=secno>4.10.20.2 </span>Constraint validation</h5>
+
+ <p>When the user agent is required to <dfn id=statically-validate-the-constraints>statically validate the
+ constraints</dfn> of <code><a href=#the-form-element>form</a></code> element <var title="">form</var>, it must run the following steps, which return
+ either a <i>positive</i> result (all the controls in the form are
+ valid) or a <i>negative</i> result (there are invalid controls)
+ along with a (possibly empty) list of elements that are invalid and
+ for which no script has claimed responsibility:</p>
+
+ <ol><li><p>Let <var title="">controls</var> be a list of all the <a href=#category-submit title=category-submit>submittable elements</a> whose
+ <a href=#form-owner>form owner</a> is <var title="">form</var>, in <a href=#tree-order>tree
+ order</a>.</li>
+
+ <li><p>Let <var title="">invalid controls</var> be an initially
+ empty list of elements.</li>
+
+ <li>
+
+ <p>For each element <var title="">field</var> in <var title="">controls</var>, in <a href=#tree-order>tree order</a>, run the
+ following substeps:</p>
+
+ <ol><li><p>If <var title="">field</var> is not a <a href=#candidate-for-constraint-validation>candidate for
+ constraint validation</a>, then move on to the next
+ element.</li>
+
+ <li><p>Otherwise, if <var title="">field</var> <a href=#concept-fv-valid title=concept-fv-valid>satisfies its constraints</a>, then
+ move on to the next element.</li>
+
+ <li><p>Otherwise, add <var title="">field</var> to <var title="">invalid controls</var>.</li>
+
+ </ol></li>
+
+ <li><p>If <var title="">invalid controls</var> is empty, then
+ return a <i>positive</i> result and abort these steps.</li>
+
+ <li><p>Let <var title="">unhandled invalid controls</var> be an
+ initially empty list of elements.</li>
+
+ <li>
+
+ <p>For each element <var title="">field</var> in <var title="">invalid controls</var>, if any, in <a href=#tree-order>tree
+ order</a>, run the following substeps:</p>
+
+ <ol><li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-invalid>invalid</code> that is cancelable at <var title="">field</var>.</li>
+
+ <li><p>If the event was not canceled, then add <var title="">field</var> to <var title="">unhandled invalid
+ controls</var>.</li>
+
+ </ol></li>
+
+ <li><p>Return a <i>negative</i> result with the list of elements in
+ the <var title="">unhandled invalid controls</var> list.</li>
+
+ </ol><p>If a user agent is to <dfn id=interactively-validate-the-constraints>interactively validate the
+ constraints</dfn> of <code><a href=#the-form-element>form</a></code> element <var title="">form</var>, then the user agent must run the following
+ steps:</p>
+
+ <ol><li><p><a href=#statically-validate-the-constraints>Statically validate the constraints</a> of <var title="">form</var>, and let <var title="">unhandled invalid
+ controls</var> be the list of elements returned if the result was
+ <i>negative</i>.</li>
+
+ <li><p>If the result was <i>positive</i>, then return that result
+ and abort these steps.</li>
+
+ <li><p>Report the problems with the constraints of at least one of
+ the elements given in <var title="">unhandled invalid
+ controls</var> to the user. User agents may focus one of those
+ elements in the process, by running the <a href=#focusing-steps>focusing steps</a>
+ for that element, and may change the scrolling position of the
+ document, or perform some other action that brings the element to
+ the user's attention. User agents may report more than one
+ constraint violation. User agents may coalesce related constraint
+ violation reports if appropriate (e.g. if multiple radio buttons in
+ a <a href=#radio-button-group title="radio button group">group</a> are marked as
+ required, only one error need be reported). If one of the controls
+ is not <a href=#being-rendered>being rendered</a> (e.g. it has the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute set) then user agents
+ may report a script error.</li>
+
+ <li><p>Return a <i>negative</i> result.</li>
+
+ </ol></div>
+
+
+
+ <h5 id=the-constraint-validation-api><span class=secno>4.10.20.3 </span>The <dfn>constraint validation API</dfn></h5>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element will be validated when the form is submitted; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity</a></code>(<var title="">message</var>)</dt>
+
+ <dd>
+
+ <p>Sets a custom error, so that the element would fail to
+ validate. The given message is the message to be shown to the user
+ when reporting the problem to the user.</p>
+
+ <p>If the argument is the empty string, clears the custom error.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-valueMissing><a href=#dom-validitystate-valuemissing>valueMissing</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element has no value but is a required field; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-typeMismatch><a href=#dom-validitystate-typemismatch>typeMismatch</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element's value is not in the correct syntax; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-patternMismatch><a href=#dom-validitystate-patternmismatch>patternMismatch</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element's value doesn't match the provided pattern; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-tooLong><a href=#dom-validitystate-toolong>tooLong</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element's value is longer than the provided maximum length; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-rangeUnderflow><a href=#dom-validitystate-rangeunderflow>rangeUnderflow</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element's value is lower than the provided minimum; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-rangeOverflow><a href=#dom-validitystate-rangeoverflow>rangeOverflow</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element's value is higher than the provided maximum; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-stepMismatch><a href=#dom-validitystate-stepmismatch>stepMismatch</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element's value doesn't fit the rules given by the <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-customError><a href=#dom-validitystate-customerror>customError</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element has a custom error; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-valid><a href=#dom-validitystate-valid>valid</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element's value has no validity problems; false otherwise.</p>
+
+ </dd>
+
+ <dt><var title="">valid</var> = <var title="">element</var> . <code title=dom-cva-checkValidatity><a href=#dom-cva-checkvalidatity>checkValidity</a></code>()</dt>
+
+ <dd>
+
+ <p>Returns true if the element's value has no validity problems;
+ false otherwise. Fires an <code title=event-invalid>invalid</code> event at the element in the
+ latter case.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code></dt>
+
+ <dd>
+
+ <p>Returns the error message that would be shown to the user if
+ the element was to be checked for validity.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-cva-willvalidate title=dom-cva-willValidate><code>willValidate</code></dfn>
+ attribute must return true if an element is a <a href=#candidate-for-constraint-validation>candidate for
+ constraint validation</a>, and false otherwise (i.e. false if any
+ conditions are <a href=#barred-from-constraint-validation title="barred from constraint
+ validation">barring it from constraint validation</a>).</p>
+
+ <p>The <dfn id=dom-cva-setcustomvalidity title=dom-cva-setCustomValidity><code>setCustomValidity(<var title="">message</var>)</code></dfn>, when invoked, must set the
+ <a href=#custom-validity-error-message>custom validity error message</a> to the value of the given
+ <var title="">message</var> argument.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, a script checks the value of a form
+ control each time it is edited, and whenever it is not a valid
+ value, uses the <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method
+ to set an appropriate message.</p>
+
+ <pre>&lt;label&gt;Feeling: &lt;input name=f type="text" oninput="check(this)"&gt;&lt;/label&gt;
+&lt;script&gt;
+ function check(input) {
+ if (input.value == "good" ||
+ input.value == "fine" ||
+ input.value == "tired") {
+ input.setCustomValidity('"' + input.value + '" is not a feeling.');
+<!-- } else if (input.value == "...") {
+ input.setCustomValidity('...');
+--> } else {
+ // input is fine -- reset the error message
+ input.setCustomValidity('');
+ }
+ }
+&lt;/script&gt;</pre>
+
+ </div>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-cva-validity title=dom-cva-validity><code>validity</code></dfn>
+ attribute must return a <code><a href=#validitystate>ValidityState</a></code> object that
+ represents the <a href=#validity-states>validity states</a> of the element. This
+ object is <a href=#live>live</a>, and the same object must be returned
+ each time the element's <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> attribute is retrieved.</p>
+
+<pre class=idl>interface <dfn id=validitystate>ValidityState</dfn> {
+ readonly attribute boolean <a href=#dom-validitystate-valuemissing title=dom-ValidityState-valueMissing>valueMissing</a>;
+ readonly attribute boolean <a href=#dom-validitystate-typemismatch title=dom-ValidityState-typeMismatch>typeMismatch</a>;
+ readonly attribute boolean <a href=#dom-validitystate-patternmismatch title=dom-ValidityState-patternMismatch>patternMismatch</a>;
+ readonly attribute boolean <a href=#dom-validitystate-toolong title=dom-ValidityState-tooLong>tooLong</a>;
+ readonly attribute boolean <a href=#dom-validitystate-rangeunderflow title=dom-ValidityState-rangeUnderflow>rangeUnderflow</a>;
+ readonly attribute boolean <a href=#dom-validitystate-rangeoverflow title=dom-ValidityState-rangeOverflow>rangeOverflow</a>;
+ readonly attribute boolean <a href=#dom-validitystate-stepmismatch title=dom-ValidityState-stepMismatch>stepMismatch</a>;
+ readonly attribute boolean <a href=#dom-validitystate-customerror title=dom-ValidityState-customError>customError</a>;
+ readonly attribute boolean <a href=#dom-validitystate-valid title=dom-ValidityState-valid>valid</a>;
+};</pre>
+
+ <p>A <code><a href=#validitystate>ValidityState</a></code> object has the following
+ attributes. On getting, they must return true if the corresponding
+ condition given in the following list is true, and false
+ otherwise.</p>
+
+ <dl><dt><dfn id=dom-validitystate-valuemissing title=dom-ValidityState-valueMissing><code>valueMissing</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-typemismatch title=dom-ValidityState-typeMismatch><code>typeMismatch</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-patternmismatch title=dom-ValidityState-patternMismatch><code>patternMismatch</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-a-pattern-mismatch>suffering from a pattern mismatch</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-toolong title=dom-ValidityState-tooLong><code>tooLong</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-being-too-long>suffering from being too long</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-rangeunderflow title=dom-ValidityState-rangeUnderflow><code>rangeUnderflow</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-an-underflow>suffering from an underflow</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-rangeoverflow title=dom-ValidityState-rangeOverflow><code>rangeOverflow</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-stepmismatch title=dom-ValidityState-stepMismatch><code>stepMismatch</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-customerror title=dom-ValidityState-customError><code>customError</code></dfn></dt>
+ <dd> <p>The control is <a href=#suffering-from-a-custom-error>suffering from a custom error</a>.</p> </dd>
+
+ <dt><dfn id=dom-validitystate-valid title=dom-ValidityState-valid><code>valid</code></dfn></dt>
+ <dd> <p>None of the other conditions are true.</p> </dd>
+
+ </dl><p>When the <dfn id=dom-cva-checkvalidatity title=dom-cva-checkValidatity><code>checkValidity()</code></dfn>
+ method is invoked, if the element is a <a href=#candidate-for-constraint-validation>candidate for
+ constraint validation</a> and does not <a href=#concept-fv-valid title=concept-fv-valid>satisfy its constraints</a>, the user
+ agent must <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-invalid>invalid</code> that is cancelable (but in this
+ case has no default action) at the element and return
+ false. Otherwise, it must only return true without doing anything
+ else.</p>
+
+ <p>The <dfn id=dom-cva-validationmessage title=dom-cva-validationMessage><code>validationMessage</code></dfn>
+ attribute must return the empty string if the element is not a
+ <a href=#candidate-for-constraint-validation>candidate for constraint validation</a> or if it is one but
+ it <a href=#concept-fv-valid title=concept-fv-valid>satisfies its constraints</a>;
+ otherwise, it must return a suitably localized message that the user
+ agent would show the user if this were the only form control with a
+ validity constraint problem. If the user agent would not actually
+ show a textual message in such a situation (e.g. it would show a
+ graphical cue instead), then the attribute must return a suitably
+ localized message that expresses (one or more of) the validity
+ constraint(s) that the control does not satisfy. If the element is a
+ <a href=#candidate-for-constraint-validation>candidate for constraint validation</a> and is
+ <a href=#suffering-from-a-custom-error>suffering from a custom error</a>, then the <a href=#custom-validity-error-message>custom
+ validity error message</a> should be present in the return
+ value.</p>
+
+ </div>
+
+
+ <h5 id=security-forms><span class=secno>4.10.20.4 </span>Security</h5>
+
+ <p id=security-0>Servers should not rely on client-side
+ validation. Client-side validation can be intentionally bypassed by
+ hostile users, and unintentionally bypassed by users of older user
+ agents or automated tools that do not implement these features. The
+ constraint validation features are only intended to improve the user
+ experience, not to provide any kind of security mechanism.</p>
+
+
+
+
+ <h4 id=form-submission><span class=secno>4.10.21 </span><dfn>Form submission</dfn></h4>
+
+ <div class=impl>
+
+ <h5 id=introduction-1><span class=secno>4.10.21.1 </span>Introduction</h5>
+
+ </div>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>When forms are submitted, the data in the form is converted into
+ the form specified by the <a href=#concept-fs-enctype title=concept-fs-enctype>enctype</a>, and then sent to the
+ destination specified by the <a href=#concept-fs-action title=concept-fs-action>action</a> using the given <a href=#concept-fs-method title=concept-fs-method>method</a>.</p>
+
+ <p>For example, take the following form:</p>
+
+ <pre>&lt;form action="/find.cgi" method=get&gt;
+ &lt;input type=text name=t&gt;
+ &lt;input type=search name=q&gt;
+ &lt;input type=submit&gt;
+&lt;/form&gt;</pre>
+
+ <p>If the user types in "cats" in the first field and "fur" in the
+ second, and then hits the submit button, then the user agent will
+ load <code title="">/find.cgi?t=cats&amp;q=fur</code>.</p>
+
+ <p>On the other hand, consider this form:</p>
+
+ <pre>&lt;form action="/find.cgi" method=post enctype="multipart/form-data"&gt;
+ &lt;input type=text name=t&gt;
+ &lt;input type=search name=q&gt;
+ &lt;input type=submit&gt;
+&lt;/form&gt;</pre>
+
+ <p>Given the same user input, the result on submission is quite
+ different: the user agent instead does an HTTP POST to the given
+ URL, with as the entity body something like the following text:</p>
+
+ <pre>------kYFrd4jNJEgCervE
+Content-Disposition: form-data; name="t"
+
+cats
+------kYFrd4jNJEgCervE
+Content-Disposition: form-data; name="q"
+
+fur
+------kYFrd4jNJEgCervE--</pre>
+
+
+
+ <div class=impl>
+
+ <h5 id=implicit-submission><span class=secno>4.10.21.2 </span>Implicit submission</h5>
+
+ <p>User agents may establish a <a href=#concept-button title=concept-button>button</a> in each form as being the
+ form's <dfn id=default-button>default button</dfn>. This should be the first <a href=#concept-submit-button title=concept-submit-button>submit button</a> in <a href=#tree-order>tree
+ order</a> whose <a href=#form-owner>form owner</a> is that <code><a href=#the-form-element>form</a></code>
+ element, but user agents may pick another button if another would be
+ more appropriate for the platform. If the platform supports letting
+ the user submit a form implicitly (for example, on some platforms
+ hitting the "enter" key while a text field is focused implicitly
+ submits the form), then doing so must cause the form's <a href=#default-button>default
+ button</a>'s <a href=#activation-behavior>activation behavior</a>, if any, to be
+ run.</p>
+
+ <p class=note>Consequently, if the <a href=#default-button>default button</a> is
+ <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, the form is not
+ submitted when such an implicit submission mechanism is used. (A
+ button has no <a href=#activation-behavior>activation behavior</a> when disabled.)</p>
+
+ <p>If the form has no <a href=#concept-submit-button title=concept-submit-button>submit
+ button</a>, then the implicit submission mechanism must just
+ <a href=#concept-form-submit title=concept-form-submit>submit</a> the
+ <code><a href=#the-form-element>form</a></code> element from the <code><a href=#the-form-element>form</a></code> element
+ itself.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=form-submission-algorithm><span class=secno>4.10.21.3 </span>Form submission algorithm</h5>
+
+ <p>When a form <var title="">form</var> is <dfn id=concept-form-submit title=concept-form-submit>submitted</dfn> from an element <var title="">submitter</var> (typically a button), optionally with a
+ <var title="">scripted-submit</var> flag set, the user agent must
+ run the following steps:</p>
+
+ <ol><li id=sandboxSubmitBlocked><p>If <var title="">form</var> is in
+ a <code><a href=#document>Document</a></code> that has no associated <a href=#browsing-context>browsing
+ context</a> or whose <a href=#browsing-context>browsing context</a> had its
+ <a href=#sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</a> set when the
+ <code><a href=#document>Document</a></code> was created, then abort these steps without
+ doing anything.</li>
+
+ <li><p>If <var title="">form</var> is already being submitted
+ (i.e. the form was <a href=#concept-form-submit title=concept-form-submit>submitted</a> again while processing
+ the events fired from the next two steps, probably from a script
+ redundantly calling the <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code> method on <var title="">form</var>), then abort these steps. This doesn't affect
+ the earlier instance of this algorithm.</li>
+
+ <!-- lock (implicit in previous step) -->
+
+ <li><p>If the <var title="">scripted-submit</var> flag is not set,
+ and the <var title="">submitter</var> element's <a href=#concept-fs-novalidate title=concept-fs-novalidate>no-validate state</a> is false,
+ then <a href=#interactively-validate-the-constraints>interactively validate the constraints</a> of <var title="">form</var> and examine the result: if the result is
+ negative (the constraint validation concluded that there were
+ invalid fields and probably informed the user of this) then abort
+ these steps.</li>
+
+ <li><p>If the <var title="">scripted-submit</var> flag is not set,
+ then <a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named
+ <code title=event-submit>submit</code>, at <var title="">form</var>. If the event's default action is prevented
+ (i.e. if the event is canceled) then abort these steps. Otherwise,
+ continue (effectively the default action is to perform the
+ submission).</li>
+
+ <!-- if you add any steps between the "lock" and "unlock" lines,
+ make sure to update the step immediately before the "lock" line -->
+
+ <!-- unlock -->
+
+ <li><p>Let <var title="">controls</var> be a list of all the <a href=#category-submit title=category-submit>submittable elements</a> whose
+ <a href=#form-owner>form owner</a> is <var title="">form</var>, in <a href=#tree-order>tree
+ order</a>.</li>
+
+ <li><p>Let the <var title="">form data set</var> be a list of
+ name-value-type tuples, initially empty.</li>
+
+ <li id=constructing-form-data-set>
+
+ <p><strong>Constructing the form data set</strong>. For each
+ element <var title="">field</var> in <var title="">controls</var>,
+ in <a href=#tree-order>tree order</a>, run the following substeps:</p>
+
+ <ol><li>
+
+ <p>If any of the following conditions are met, then skip these
+ substeps for this element:</p>
+
+ <ul><li>The <var title="">field</var> element has a
+ <code><a href=#the-datalist-element>datalist</a></code> element ancestor.</li>
+
+ <li>The <var title="">field</var> element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</li>
+
+ <li>The <var title="">field</var> element is a <a href=#concept-button title=concept-button>button</a> but it is not <var title="">submitter</var>.</li>
+
+ <li>The <var title="">field</var> element is an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state and
+ whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is
+ false.</li>
+
+ <li>The <var title="">field</var> element is an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a> state and
+ whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is
+ false.</li>
+
+ <li>The <var title="">field</var> element is not an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, and
+ either the <var title="">field</var> element does not have a
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute specified, or
+ its <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute's value is
+ the empty string.</li>
+
+ <li>The <var title="">field</var> element is an
+ <code><a href=#the-object-element>object</a></code> element that is not using a
+ <a href=#plugin>plugin</a>.</li>
+
+ </ul><p>Otherwise, process <var title="">field</var> as follows:</p>
+
+ </li>
+
+ <li><p>Let <var title="">type</var> be the value of the <code title="">type</code> IDL attribute of <var title="">field</var>.</li> <!-- if the field is an <object>
+ element, this will get ignored. -->
+
+ <li>
+
+ <p>If the <var title="">field</var> element is an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state,
+ then run these further nested substeps:</p>
+
+ <ol><li><p>If the <var title="">field</var> element has an <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute specified and value
+ is not the empty string, let <var title="">name</var> be that
+ value followed by a single U+002E FULL STOP character
+ (.). Otherwise, let <var title="">name</var> be the empty
+ string.</li>
+
+ <li><p>Let <var title="">name<sub title="">x</sub></var> be the
+ string consisting of the concatenation of <var title="">name</var> and a single U+0078 LATIN SMALL LETTER X
+ character (x).</li>
+
+ <li><p>Let <var title="">name<sub title="">y</sub></var> be the
+ string consisting of the concatenation of <var title="">name</var> and a single U+0079 LATIN SMALL LETTER Y
+ character (y).</li>
+
+ <li><p>The <var title="">field</var> element is <var title="">submitter</var>, and before this algorithm was invoked
+ the user <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>indicated a
+ coordinate</a>. Let <var title="">x</var> be the <var title="">x</var>-component of the coordinate selected by the
+ user, and let <var title="">y</var> be the <var title="">y</var>-component of the coordinate selected by the
+ user.</li>
+
+ <li><p>Append an entry in the <var title="">form data set</var>
+ with the name <var title="">name<sub title="">x</sub></var>,
+ the value <var title="">x</var>, and the type <var title="">type</var>.</li>
+
+ <li><p>Append an entry in the <var title="">form data set</var>
+ with the name <var title="">name<sub title="">y</sub></var> and
+ the value <var title="">y</var>, and the type <var title="">type</var>.</li>
+
+ <li><p>Skip the remaining substeps for this element: if there
+ are any more elements in <var title="">controls</var>, return
+ to the top of the <a href=#constructing-form-data-set>constructing the form data
+ set</a> step, otherwise, jump to the next step in the overall
+ form submission algorithm.</li>
+
+ </ol></li>
+
+ <li><p>Let <var title="">name</var> be the value of the <var title="">field</var> element's <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute.</li>
+
+ <li><p>If the <var title="">field</var> element is a
+ <code><a href=#the-select-element>select</a></code> element, then for each <code><a href=#the-option-element>option</a></code>
+ element in the <code><a href=#the-select-element>select</a></code> element whose <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true,
+ append an entry in the <var title="">form data set</var> with the
+ <var title="">name</var> as the name, the <a href=#concept-option-value title=concept-option-value>value</a> of the
+ <code><a href=#the-option-element>option</a></code> element as the value, and <var title="">type</var> as the type.</li>
+
+ <li>
+
+ <p>Otherwise, if the <var title="">field</var> element is an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state or the
+ <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a> state,
+ then run these further nested substeps:</p>
+
+ <ol><li><p>If the <var title="">field</var> element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute specified, then
+ let <var title="">value</var> be the value of that attribute;
+ otherwise, let <var title="">value</var> be the string
+ "<code title="">on</code>".</li>
+
+ <li><p>Append an entry in the <var title="">form data set</var>
+ with <var title="">name</var> as the name, <var title="">value</var> as the value, and <var title="">type</var>
+ as the type.</li>
+
+ </ol></li>
+
+ <li><p>Otherwise, if the <var title="">field</var> element is an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state, then for
+ each file <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected</a> in the
+ <code><a href=#the-input-element>input</a></code> element, append an entry in the <var title="">form data set</var> with the <var title="">name</var> as
+ the name, the file (consisting of the name, the type, and the
+ body) as the value, and <var title="">type</var> as the type. If
+ there are no <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>,
+ then append an entry in the <var title="">form data set</var>
+ with the <var title="">name</var> as the name, the empty string
+ as the value, and <code title="">application/octet-stream</code>
+ as the type.</li>
+ <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=529859 -->
+
+ <li><p>Otherwise, if the <var title="">field</var> element is an
+ <code><a href=#the-object-element>object</a></code> element: try to obtain a form submission
+ value from the <a href=#plugin>plugin</a><!-- using NPAPI's
+ NPP_GetValue() entry point with the NPPVformValue variable -->,
+ and if that is successful, append an entry in the <var title="">form data set</var> with <var title="">name</var> as the
+ name, the returned form submission value as the value, and the
+ string "<code title="">object</code>" as the type.</li>
+
+ <li><p>Otherwise, append an entry in the <var title="">form data
+ set</var> with <var title="">name</var> as the name, the <a href=#concept-fe-value title=concept-fe-value>value</a> of the <var title="">field</var> element as the value, and <var title="">type</var> as the type.</li>
+
+ </ol></li>
+
+ <li><p>Let <var title="">action</var> be the <var title="">submitter</var> element's <a href=#concept-fs-action title=concept-fs-action>action</a>.</li>
+
+ <li>
+
+ <p>If <var title="">action</var> is the empty string, let <var title="">action</var> be <a href="#the-document's-address">the document's address</a>.</p>
+
+ <p class=note>This step is a <a href=#willful-violation>willful violation</a> of
+ RFC 3986, which would require base URL processing here. This
+ violation is motivated by a desire for compatibility with legacy
+ content. <a href=#refsRFC3986>[RFC3986]</a></p>
+
+ <!-- Don't ask me why. But that's what IE does. It even treats
+ action="" differently from action=" " or action="#" (the latter
+ two resolve to the base URL, the first one resolves to the doc
+ URL). And other browsers concur. It is even required, see e.g.
+ http://bugs.webkit.org/show_bug.cgi?id=7763
+ https://bugzilla.mozilla.org/show_bug.cgi?id=297761
+ -->
+
+ </li>
+
+ <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the
+ <a href=#url>URL</a> <var title="">action</var>, relative to the <var title="">submitter</var> element. If this fails, abort these
+ steps. Otherwise, let <var title="">action</var> be the resulting
+ <a href=#absolute-url>absolute URL</a>.</li>
+
+ <li><p>Let <var title="">scheme</var> be the <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> of the resulting
+ <a href=#absolute-url>absolute URL</a>.</li>
+
+ <li><p>Let <var title="">enctype</var> be the <var title="">submitter</var> element's <a href=#concept-fs-enctype title=concept-fs-enctype>enctype</a>.</li>
+
+ <li><p>Let <var title="">method</var> be the <var title="">submitter</var> element's <a href=#concept-fs-method title=concept-fs-method>method</a>.</li>
+
+ <li><p>Let <var title="">target</var> be the <var title="">submitter</var> element's <a href=#concept-fs-target title=concept-fs-target>target</a>.</li>
+
+ <li>
+
+ <p>Select the appropriate row in the table below based on the
+ value of <var title="">scheme</var> as given by the first cell of
+ each row. Then, select the appropriate cell on that row based on
+ the value of <var title="">method</var> as given in the first cell
+ of each column. Then, jump to the steps named in that cell and
+ defined below the table.</p>
+
+ <table><thead><tr><td>
+ <th> <a href=#attr-fs-method-get title=attr-fs-method-GET>GET</a>
+ <th> <a href=#attr-fs-method-post title=attr-fs-method-POST>POST</a>
+ <th> <a href=#attr-fs-method-put title=attr-fs-method-PUT>PUT</a>
+ <th> <a href=#attr-fs-method-delete title=attr-fs-method-DELETE>DELETE</a>
+ <tbody><tr><th> <code title="">http</code>
+ <td> <a href=#submit-mutate-action title=submit-mutate-action>Mutate action</a>
+ <td> <a href=#submit-body title=submit-body>Submit as entity body</a>
+ <td> <a href=#submit-body title=submit-body>Submit as entity body</a>
+ <td> <a href=#submit-delete-action title=submit-delete-action>Delete action</a>
+ <tr><th> <code title="">https</code>
+ <td> <a href=#submit-mutate-action title=submit-mutate-action>Mutate action</a>
+ <td> <a href=#submit-body title=submit-body>Submit as entity body</a>
+ <td> <a href=#submit-body title=submit-body>Submit as entity body</a>
+ <td> <a href=#submit-delete-action title=submit-delete-action>Delete action</a>
+ <tr><th> <code title="">ftp</code>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <tr><th> <code title="">javascript</code>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <tr><th> <code title="">data</code>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <td> <a href=#submit-data-post title=submit-data-post>Post to data:</a>
+ <td> <a href=#submit-data-put title=submit-data-put>Put to data:</a>
+ <td> <a href=#submit-get-action title=submit-get-action>Get action</a>
+ <tr><th> <code title="">mailto</code>
+ <td> <a href=#submit-mailto-headers title=submit-mailto-headers>Mail with headers</a>
+ <td> <a href=#submit-mailto-body title=submit-mailto-body>Mail as body</a>
+ <td> <a href=#submit-mailto-headers title=submit-mailto-headers>Mail with headers</a>
+ <td> <a href=#submit-mailto-headers title=submit-mailto-headers>Mail with headers</a>
+ </table><p>If <var title="">scheme</var> is not one of those listed in
+ this table, then the behavior is not defined by this
+ specification. User agents should, in the absence of another
+ specification defining this, act in a manner analogous to that
+ defined in this specification for similar schemes.</p>
+
+ <p>The behaviors are as follows:</p>
+
+ <dl><dt><dfn id=submit-mutate-action title=submit-mutate-action>Mutate action</dfn>
+ <dd>
+
+ <p>Let <var title="">query</var> be the result of encoding the
+ <var title="">form data set</var> using the <a href=#application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
+ algorithm</a>, interpreted as a US-ASCII string.</p>
+
+ <!-- by this point we've already tried to resolve the URL, so we
+ know we can parse it -->
+
+ <p>Let <var title="">destination</var> be a new <a href=#url>URL</a>
+ that is equal to the <var title="">action</var> except that its
+ <a href=#url-query title=url-query>&lt;query&gt;</a> component is
+ replaced by <var title="">query</var> (adding a U+003F QUESTION
+ MARK character (?) if appropriate).</p>
+
+ <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p><a href=#navigate>Navigate</a> <var title="">target browsing
+ context</var> to <var title="">destination</var>. If <var title="">target browsing context</var> was newly created for
+ this purpose by the steps above, then it must be navigated with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=submit-body title=submit-body>Submit as entity body</dfn>
+ <dd>
+
+ <p>Let <var title="">entity body</var> be the result of encoding
+ the <var title="">form data set</var> using the
+ <a href=#appropriate-form-encoding-algorithm>appropriate form encoding algorithm</a>.</p>
+
+ <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p>Let <var title="">MIME type</var> be determined as
+ follows:</p>
+
+ <dl><dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code></dt>
+
+ <dd>Let <var title="">MIME type</var> be "<code title="">application/x-www-form-urlencoded</code>".</dd>
+
+ <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code></dt>
+
+ <dd>Let <var title="">MIME type</var> be "<code title="">multipart/form-data</code>".</dd>
+
+ <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code></dt>
+
+ <dd>Let <var title="">MIME type</var> be "<code title="">text/plain</code>".</dd>
+
+ </dl><p>If <var title="">method</var> is anything but GET or POST,
+ and the <a href=#origin>origin</a> of <var title="">action</var> is not
+ the <a href=#same-origin>same origin</a> as that of the <code><a href=#the-form-element>form</a></code>
+ element's <code><a href=#document>Document</a></code>, then abort these steps.</p>
+ <!-- CORS, one day -->
+
+ <p>Otherwise, <a href=#navigate>navigate</a> <var title="">target
+ browsing context</var> to <var title="">action</var> using the
+ HTTP method given by <var title="">method</var> and with <var title="">entity body</var> as the entity body, of type <var title="">MIME type</var>. If <var title="">target browsing
+ context</var> was newly created for this purpose by the steps
+ above, then it must be navigated with <a href=#replacement-enabled>replacement
+ enabled</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=submit-delete-action title=submit-delete-action>Delete action</dfn>
+ <dd>
+
+ <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p>If the <a href=#origin>origin</a> of <var title="">action</var> is
+ not the <a href=#same-origin>same origin</a> as that of the
+ <code><a href=#the-form-element>form</a></code> element's <code><a href=#document>Document</a></code>, then abort
+ these steps.</p> <!-- CORS, one day -->
+
+ <p>Otherwise, <a href=#navigate>navigate</a> <var title="">target
+ browsing context</var> to <var title="">action</var> using the
+ DELETE method. If <var title="">target browsing context</var>
+ was newly created for this purpose by the steps above, then it
+ must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=submit-get-action title=submit-get-action>Get action</dfn>
+ <dd>
+
+ <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p><a href=#navigate>Navigate</a> <var title="">target browsing
+ context</var> to <var title="">action</var>. If <var title="">target browsing context</var> was newly created for
+ this purpose by the steps above, then it must be navigated with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=submit-data-post title=submit-data-post>Post to data:</dfn>
+ <dd>
+
+ <p>Let <var title="">data</var> be the result of encoding the
+ <var title="">form data set</var> using the <a href=#appropriate-form-encoding-algorithm>appropriate
+ form encoding algorithm</a>.</p>
+
+ <p>If <var title="">action</var> contains the string "<code title="">%%%%</code>" (four U+0025 PERCENT SIGN characters),
+ then %-escape all bytes in <var title="">data</var> that, if
+ interpreted as US-ASCII, do not match the <code title="">unreserved</code> production in the URI Generic Syntax,
+ and then, treating the result as a US-ASCII string, further
+ %-escape all the U+0025 PERCENT SIGN characters in the resulting
+ string and replace the first occurrence of "<code title="">%%%%</code>" in <var title="">action</var> with the
+ resulting double-escaped string. <a href=#refsRFC3986>[RFC3986]</a></p>
+
+ <p>Otherwise, if <var title="">action</var> contains the string
+ "<code title="">%%</code>" (two U+0025 PERCENT SIGN characters
+ in a row, but not four), then %-escape all characters in <var title="">data</var> that, if interpreted as US-ASCII, do not
+ match the <code title="">unreserved</code> production in the URI
+ Generic Syntax, and then, treating the result as a US-ASCII
+ string, replace the first occurrence of "<code title="">%%</code>" in <var title="">action</var> with the
+ resulting escaped string. <a href=#refsRFC3986>[RFC3986]</a></p>
+
+ <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p><a href=#navigate>Navigate</a> <var title="">target browsing
+ context</var> to the potentially modified <var title="">action</var>. If <var title="">target browsing
+ context</var> was newly created for this purpose by the steps
+ above, then it must be navigated with <a href=#replacement-enabled>replacement
+ enabled</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=submit-data-put title=submit-data-put>Put to data:</dfn>
+ <dd>
+
+ <p>Let <var title="">data</var> be the result of encoding the
+ <var title="">form data set</var> using the <a href=#appropriate-form-encoding-algorithm>appropriate
+ form encoding algorithm</a>.</p>
+
+ <p>Let <var title="">MIME type</var> be determined as
+ follows:</p>
+
+ <dl><dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code></dt>
+
+ <dd>Let <var title="">MIME type</var> be "<code title="">application/x-www-form-urlencoded</code>".</dd>
+
+ <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code></dt>
+
+ <dd>Let <var title="">MIME type</var> be "<code title="">multipart/form-data</code>".</dd>
+
+ <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code></dt>
+
+ <dd>Let <var title="">MIME type</var> be "<code title="">text/plain</code>".</dd>
+
+ </dl><p>Let <var title="">destination</var> be the result of
+ concatenating the following:</p>
+
+ <ol class=brief><li>The string "<code title="">data:</code>".</li>
+
+ <li>The value of <var title="">MIME type</var>.</li>
+
+ <li>The string "<code title="">;base64,</code>".</li>
+
+ <li>A base-64 encoded representation of <var title="">data</var>. <a href=#refsRFC2045>[RFC2045]</a></li>
+
+ </ol><p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p><a href=#navigate>Navigate</a> <var title="">target browsing
+ context</var> to <var title="">destination</var>. If <var title="">target browsing context</var> was newly created for
+ this purpose by the steps above, then it must be navigated with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=submit-mailto-headers title=submit-mailto-headers>Mail with headers</dfn>
+ <dd>
+
+ <p>Let <var title="">headers</var> be the resulting encoding the
+ <var title="">form data set</var> using the <a href=#application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
+ algorithm</a>, interpreted as a US-ASCII string.</p>
+
+ <p>Replace occurrences of U+002B PLUS SIGN characters (+) in
+ <var title="">headers</var> with the string "<code title="">%20</code>".</p>
+
+ <p>Let <var title="">destination</var> consist of all the
+ characters from the first character in <var title="">action</var> to the character immediately before the
+ first U+003F QUESTION MARK character (?), if any, or the end of
+ the string if there are none.</p>
+
+ <p>Append a single U+003F QUESTION MARK character (?) to <var title="">destination</var>.</p>
+
+ <p>Append <var title="">headers</var> to <var title="">destination</var>.</p>
+
+ <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p><a href=#navigate>Navigate</a> <var title="">target browsing
+ context</var> to <var title="">destination</var>. If <var title="">target browsing context</var> was newly created for
+ this purpose by the steps above, then it must be navigated with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=submit-mailto-body title=submit-mailto-body>Mail as body</dfn>
+ <dd>
+
+ <p>Let <var title="">body</var> be the resulting encoding the
+ <var title="">form data set</var> using the <a href=#appropriate-form-encoding-algorithm>appropriate
+ form encoding algorithm</a> and then %-escaping all the bytes
+ in the resulting byte string that, when interpreted as US-ASCII,
+ do not match the <code title="">unreserved</code> production in
+ the URI Generic Syntax. <a href=#refsRFC3986>[RFC3986]</a></p>
+
+ <p>Let <var title="">destination</var> have the same value as
+ <var title="">action</var>.</p>
+
+ <p>If <var title="">destination</var> does not contain a U+003F
+ QUESTION MARK character (?), append a single U+003F QUESTION
+ MARK character (?) to <var title="">destination</var>. Otherwise, append a single U+0026
+ AMPERSAND character (&amp;).</p>
+
+ <p>Append the string "<code title="">body=</code>" to <var title="">destination</var>.</p>
+
+ <p>Append <var title="">body</var>, interpreted as a US-ASCII
+ string, to <var title="">destination</var>.</p>
+
+ <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
+ form submission target browsing context</a>.</p>
+
+ <p><a href=#navigate>Navigate</a> <var title="">target browsing
+ context</var> to <var title="">destination</var>. If <var title="">target browsing context</var> was newly created for
+ this purpose by the steps above, then it must be navigated with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </dd>
+
+ </dl><p><dfn id=the-form-submission-target-browsing-context>The form submission target browsing context</dfn> is
+ obtained, when needed by the behaviors described above, as
+ follows: If the user indicated a specific <a href=#browsing-context>browsing
+ context</a> to use when submitting the form, then that is the
+ target browsing context. Otherwise, apply <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for
+ choosing a browsing context given a browsing context name</a>
+ using <var title="">target</var> as the name and the
+ <a href=#browsing-context>browsing context</a> of <var title="">form</var> as the
+ context in which the algorithm is executed; the resulting
+ <a href=#browsing-context>browsing context</a> is the target browsing context.</p>
+
+ <p>The <dfn id=appropriate-form-encoding-algorithm>appropriate form encoding algorithm</dfn> is
+ determined as follows:</p>
+
+ <dl><dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code></dt>
+
+ <dd>Use the <a href=#application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
+ algorithm</a>.</dd>
+
+ <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code></dt>
+
+ <dd>Use the <a href=#multipart/form-data-encoding-algorithm><code title="">multipart/form-data</code> encoding
+ algorithm</a>.</dd>
+
+ <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code></dt>
+
+ <dd>Use the <a href=#text/plain-encoding-algorithm><code title="">text/plain</code> encoding
+ algorithm</a>.</dd>
+
+ </dl></li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h5 id=url-encoded-form-data><span class=secno>4.10.21.4 </span>URL-encoded form data</h5>
+
+ <p>The <dfn id=application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
+ algorithm</dfn> is as follows:</p>
+
+ <ol><li><p>Let <var title="">result</var> be the empty string.</li>
+
+ <li>
+
+ <p>If the <code><a href=#the-form-element>form</a></code> element has an <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute,
+ then, taking into account the characters found in the <var title="">form data set</var>'s names and values, and the character
+ encodings supported by the user agent, select a character encoding
+ from the list given in the <code><a href=#the-form-element>form</a></code>'s <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute
+ that is an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>. If
+ none of the encodings are supported, then let the selected
+ character encoding be UTF-8.</p>
+
+ <p>Otherwise, if the <a href="#document's-character-encoding">document's character encoding</a> is
+ an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, then that is
+ the selected character encoding.</p>
+
+ <p>Otherwise, let the selected character encoding be UTF-8.</p>
+
+ </li>
+
+ <li><p>Let <var title="">charset</var> be the <a href=#preferred-mime-name>preferred MIME
+ name</a> of the selected character encoding.</li>
+
+ <li>
+
+ <p>For each entry in the <var title="">form data set</var>,
+ perform these substeps:</p>
+
+ <ol><li><p>If the entry's name is "<code title="">_charset_</code>"
+ and its type is "<code title="">hidden</code>", replace its value
+ with <var title="">charset</var>.</li>
+
+ <li><p>If the entry's type is "<code title="">file</code>",
+ replace its value with the file's filename only.</li>
+
+ <li><p>For each character in the entry's name and value that
+ cannot be expressed using the selected character encoding,
+ replace the character by a string consisting of a U+0026
+ AMPERSAND character (&amp;), a U+0023 NUMBER SIGN character (#),
+ one or more characters in the range U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9) representing the Unicode code point of the
+ character in base ten, and finally a U+003B SEMICOLON character
+ (;).</li><!-- we should say it should be the shortest
+ possible string, no leading zeros. this whole step as asinine,
+ though, so... -->
+
+ <li>
+
+ <p>For each character in the entry's name and value, apply the
+ appropriate subsubsteps from the following list:</p>
+
+ <dl class=switch><dt>The character is a U+0020 SPACE character</dt>
+
+ <dd>Replace the character with a single U+002B PLUS SIGN
+ character (+).</dd>
+
+
+ <!-- * - . _ 0-9 a-z A-Z -->
+
+ <dt>If the character isn't in the range U+0020, U+002A,
+ U+002D, U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005F,
+ U+0061 to U+007A</dt>
+
+ <dd>
+
+ <p>Replace the character with a string formed as follows:</p>
+
+ <ol><li><p>Let <var title="">s</var> be an empty string.</li>
+
+ <li>
+
+ <p>For each byte <var title="">b</var> of the character when
+ expressed in the selected character encoding in turn, run
+ the appropriate subsubsubstep from the list below:</p>
+
+ <dl class=switch><dt>If the byte is in the range 0x20, 0x2A, 0x2D, 0x2E,
+ 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A</dt>
+
+ <dd><p>Append to <var title="">s</var> the Unicode
+ character with the codepoint equal to the byte.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>Append to the string a U+0025 PERCENT SIGN character
+ (%) followed by two characters in the ranges U+0030 DIGIT
+ ZERO (0) to U+0039 DIGIT NINE (9) and U+0041 LATIN CAPITAL
+ LETTER A to U+0046 LATIN CAPITAL LETTER F representing the
+ hexadecimal value of the byte (zero-padded if
+ necessary).</dd>
+
+ </dl></li>
+
+ </ol></dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>Leave the character as is.</dd>
+
+ </dl></li>
+
+ <li><p>If the entry's name is "<code title="">isindex</code>",
+ its type is "<code title="">text</code>", and this is the first
+ entry in the <var title="">form data set</var>, then append the
+ value to <var title="">result</var> and skip the rest of the
+ substeps for this entry, moving on to the next entry, if any, or
+ the next step in the overall algorithm otherwise.</li>
+
+ <li><p>If this is not the first entry, append a single U+0026
+ AMPERSAND character (&amp;) to <var title="">result</var>.</li>
+
+ <li><p>Append the entry's name to <var title="">result</var>.</li>
+
+ <li><p>Append a single U+003D EQUALS SIGN character (=) to <var title="">result</var>.</li>
+
+ <li><p>Append the entry's value to <var title="">result</var>.</li>
+
+ </ol></li>
+
+ <li><p>Encode <var title="">result</var> as US-ASCII and return the
+ resulting byte stream.</li>
+
+ </ol></div>
+
+
+
+ <div class=impl>
+
+ <h5 id=multipart-form-data><span class=secno>4.10.21.5 </span>Multipart form data</h5>
+
+ <p>The <dfn id=multipart/form-data-encoding-algorithm><code title="">multipart/form-data</code> encoding
+ algorithm</dfn> is to encode the <var title="">form data set</var>
+ using the rules described by RFC2388, <cite>Returning Values from
+ Forms: <code title="">multipart/form-data</code></cite>, and return
+ the resulting byte stream. <a href=#refsRFC2388>[RFC2388]</a></p>
+
+ <p>Each entry in the <var title="">form data set</var> is a
+ <i>field</i>, the name of the entry is the <i>field name</i> and the
+ value of the entry is the <i>field value</i>, unless the entry's
+ name is "<code title="">_charset_</code>" and its type is "<code title="">hidden</code>", in which case the <i>field value</i> is the
+ character encoding used by the aforementioned algorithm to encode
+ the value of the field.</p>
+
+ <p>The order of parts must be the same as the order of fields in the
+ <var title="">form data set</var>. Multiple entries with the same
+ name must be treated as distinct fields.</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h5 id=plain-text-form-data><span class=secno>4.10.21.6 </span>Plain text form data</h5>
+
+ <p>The <dfn id=text/plain-encoding-algorithm><code title="">text/plain</code> encoding
+ algorithm</dfn> is as follows:</p>
+
+ <ol><li><p>Let <var title="">result</var> be the empty string.</li>
+
+ <li>
+
+ <!-- this is different from application/x-www-form-urlencoded in
+ that it isn't limited to ASCII-compatible encodings -->
+
+ <p>If the <code><a href=#the-form-element>form</a></code> element has an <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute,
+ then, taking into account the characters found in the <var title="">form data set</var>'s names and values, and the character
+ encodings supported by the user agent, select a character encoding
+ from the list given in the <code><a href=#the-form-element>form</a></code>'s <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code>
+ attribute. If none of the encodings are supported, then let the
+ selected character encoding be UTF-8.</p>
+
+ <p>Otherwise, the selected character encoding is the
+ <a href="#document's-character-encoding">document's character encoding</a>.</p>
+
+ </li>
+
+ <li><p>Let <var title="">charset</var> be the <a href=#preferred-mime-name>preferred MIME
+ name</a> of the selected character encoding.</li>
+
+ <li><p>If the entry's name is "<code title="">_charset_</code>" and
+ its type is "<code title="">hidden</code>", replace its value with
+ <var title="">charset</var>.</li>
+
+ <li><p>If the entry's type is "<code title="">file</code>", replace
+ its value with the file's filename only.</li>
+
+ <li>
+
+ <p>For each entry in the <var title="">form data set</var>,
+ perform these substeps:</p>
+
+ <ol><li><p>Append the entry's name to <var title="">result</var>.</li>
+
+ <li><p>Append a single U+003D EQUALS SIGN character (=) to <var title="">result</var>.</li>
+
+ <li><p>Append the entry's value to <var title="">result</var>.</li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF)
+ character pair to <var title="">result</var>.</li>
+
+ </ol></li>
+
+ <li><p>Encode <var title="">result</var> using the selected
+ character encoding and return the resulting byte stream.</li>
+
+ </ol></div>
+
+
+
+ <div class=impl>
+
+ <h4 id=resetting-a-form><span class=secno>4.10.22 </span>Resetting a form</h4>
+
+ <p>When a form <var title="">form</var> is <dfn id=concept-form-reset title=concept-form-reset>reset</dfn>, the user agent must
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-reset>reset</code>, that is cancelable, at <var title="">form</var>, and then, if that event is not canceled, must
+ invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset
+ algorithm</a> of each <a href=#category-reset title=category-reset>resettable elements</a> whose <a href=#form-owner>form
+ owner</a> is <var title="">form</var>, and <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a> from <var title="">form</var>.</p>
+
+ <p>Each <a href=#category-reset title=category-reset>resettable element</a>
+ defines its own <dfn id=concept-form-reset-control title=concept-form-reset-control>reset
+ algorithm</dfn>. Changes made to form controls as part of these
+ algorithms do not count as changes caused by the user (and thus,
+ e.g., do not cause <code title=event-input>input</code> events to
+ fire).</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h4 id=event-dispatch><span class=secno>4.10.23 </span>Event dispatch</h4>
+
+ <p>When the user agent is to <dfn id=broadcast-forminput-events>broadcast <code title=event-forminput>forminput</code> events</dfn> or
+ <dfn id=broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code>
+ events</dfn> from a <code><a href=#the-form-element>form</a></code> element <var title="">form</var>, it must run the following steps:</p>
+
+ <ol><li><p>Let <var title="">controls</var> be a list of all the <a href=#category-reset title=category-reset>resettable elements</a> whose <a href=#form-owner>form
+ owner</a> is <var title="">form</var>.</li>
+
+ <li>If the user agent was to <a href=#broadcast-forminput-events>broadcast <code title=event-forminput>forminput</code> events</a>, let <var title="">event name</var> be <code title=event-forminput>forminput</code>. Otherwise the user agent
+ was to <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code> events</a>; let <var title="">event name</var> be <code title=event-formchange>formchange</code>.</li>
+
+ <li><p>For each element in <var title="">controls</var>, in
+ <a href=#tree-order>tree order</a>, <a href=#fire-a-simple-event>fire a simple event</a> named
+ <var title="">event name</var> at the element.</li>
+
+ </ol></div>
+
+
+ <h3 id=interactive-elements><span class=secno>4.11 </span>Interactive elements</h3>
+
+ <h4 id=the-details-element><span class=secno>4.11.1 </span>The <dfn><code>details</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>One <code><a href=#the-summary-element>summary</a></code> element followed by <a href=#flow-content>flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-details-open><a href=#attr-details-open>open</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmldetailselement>HTMLDetailsElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-details-open title=dom-details-open>open</a>;
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-details-element>details</a></code> element <a href=#represents>represents</a> a
+ disclosure widget from which the user can obtain additional
+ information or controls.</p>
+
+ <p class=note>The <code><a href=#the-details-element>details</a></code> element is not appropriate
+ for footnotes. Please see <a href=#footnotes>the section on
+ footnotes</a> for details on how to mark up footnotes.</p>
+
+ <p>The <span class=impl>first</span> <code><a href=#the-summary-element>summary</a></code> element
+ child of the element, if any, <a href=#represents>represents</a> the summary or
+ legend of the details. <span class=impl>If there is no child
+ <code><a href=#the-summary-element>summary</a></code> element, the user agent should provide its own
+ legend (e.g. "Details").</span></p>
+
+ <p>The <dfn id=attr-details-open title=attr-details-open><code>open</code></dfn>
+ content attribute is a <a href=#boolean-attribute>boolean attribute</a>. If present,
+ it indicates that the details are to be shown to the user. If the
+ attribute is absent, the details are not to be shown.</p>
+
+ <div class=impl>
+
+ <p>If the attribute is removed, then the details should be
+ hidden. If the attribute is added, the details should be shown.</p>
+
+ <p>The user agent should allow the user to request that the details
+ be shown or hidden. To honor a request for the details to be shown,
+ the user agent must set the <code title=attr-details-open><a href=#attr-details-open>open</a></code> attribute on the element to
+ the value <code title="">open</code>. To honor a request for the
+ details to be hidden, the user agent must remove the <code title=attr-details-open><a href=#attr-details-open>open</a></code> attribute from the
+ element.</p>
+
+ <p>The <dfn id=dom-details-open title=dom-details-open><code>open</code></dfn>
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-details-open><a href=#attr-details-open>open</a></code> content attribute.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following example shows the <code><a href=#the-details-element>details</a></code> element
+ being used to hide technical details in a progress report.</p>
+
+ <pre>&lt;section class="progress window"&gt;
+ &lt;h1&gt;Copying "Really Achieving Your Childhood Dreams"&lt;/h1&gt;
+ &lt;details&gt;
+ &lt;summary&gt;Copying... &lt;progress max="375505392" value="97543282"&gt;&lt;/progress&gt; 25%&lt;/summary&gt;
+ &lt;dl&gt;
+ &lt;dt&gt;Transfer rate:&lt;/dt&gt; &lt;dd&gt;452KB/s&lt;/dd&gt;
+ &lt;dt&gt;Local filename:&lt;/dt&gt; &lt;dd&gt;/home/rpausch/raycd.m4v&lt;/dd&gt;
+ &lt;dt&gt;Remote filename:&lt;/dt&gt; &lt;dd&gt;/var/www/lectures/raycd.m4v&lt;/dd&gt;
+ &lt;dt&gt;Duration:&lt;/dt&gt; &lt;dd&gt;01:16:27&lt;/dd&gt;
+ &lt;dt&gt;Color profile:&lt;/dt&gt; &lt;dd&gt;SD (6-1-6)&lt;/dd&gt;
+ &lt;dt&gt;Dimensions:&lt;/dt&gt; &lt;dd&gt;320&times;240&lt;/dd&gt;
+ &lt;/dl&gt;
+ &lt;/details&gt;
+&lt;/section&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following shows how a <code><a href=#the-details-element>details</a></code> element can be
+ used to hide some controls by default:</p>
+
+ <pre>&lt;details&gt;
+ &lt;summary&gt;Name &amp; Extension:&lt;/summary&gt;
+ &lt;p&gt;&lt;input type=text name=fn value="Pillar Magazine.pdf"&gt;
+ &lt;p&gt;&lt;label&gt;&lt;input type=checkbox name=ext checked&gt; Hide extension&lt;/label&gt;
+&lt;/details&gt;</pre>
+
+ <p>One could use this in conjuction with other <code><a href=#the-details-element>details</a></code>
+ in a list to allow the user to collapse a set of fields down to a
+ small set of headings, with the ability to open each one.</p>
+
+ <p class=details-example><img alt="" src=images/sample-details-1.png><img alt="" src=images/sample-details-2.png></p>
+
+ <p>In these examples, the summary really just summarises what the
+ controls can change, and not the actual values, which is less than
+ ideal.</p>
+
+ </div>
+
+
+ <h4 id=the-summary-element><span class=secno>4.11.2 </span>The <dfn><code>summary</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd>None.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>As the first child of a <code><a href=#the-details-element>details</a></code> element.</dd>
+ <dt>Content model:</dt>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dt>DOM interface:</dt>
+ <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
+ </dl><p>The <code><a href=#the-summary-element>summary</a></code> element <a href=#represents>represents</a> a
+ summary, caption, or legend for the rest of the contents of the
+ <code><a href=#the-summary-element>summary</a></code> element's parent <code><a href=#the-details-element>details</a></code>
+ element<span class=impl>, if any</span>.</p>
+
+
+
+<!-- v2DATAGRID
+ <h4 id="datagrid">The <dfn><code>datagrid</code></dfn> element</h4>
+
+ <dl class="element">
+ <dt>Categories</dt>
+ <dd><span>Flow content</span>.</dd>
+ <dd><span>Interactive content</span>.</dd>
+ <dd><span>Sectioning root</span>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <span>flow content</span> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><span>Flow content</span>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><span>Global attributes</span></dd>
+<!- -v2DGS:
+ <dd><code title="attr-datagrid-multiple">multiple</code></dd>
+- ->
+ <dd><code title="attr-datagrid-disabled">disabled</code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class="idl">interface <dfn>HTMLDataGridElement</dfn> : <span>HTMLElement</span> {
+<!- -v2DGS:
+ attribute boolean <span title="dom-datagrid-multiple">multiple</span>;
+- -> attribute boolean <span title="dom-datagrid-disabled">disabled</span>;
+ attribute <span>DataGridListener</span> <span title="dom-datagrid-listener">listener</span>;
+<!- - v2DGS:
+ readonly attribute <span>DataGridSelection</span> <span title="dom-datagrid-selection">selection</span>;
+- ->
+ // columns
+ void <span title="dom-datagrid-addColumn">addColumn</span>(in <span>Column</span> id, in DOMString label, in DOMString type, in optional HTMLImageElement icon, in optional boolean sortable, in optional boolean hidden);
+ attribute DOMString <span title="dom-datagrid-sortColumn">sortColumn</span>;
+ attribute boolean <span title="dom-datagrid-sortAscending">sortAscending</span>;
+ void <span title="dom-datagrid-clearColumns">clearColumns</span>();
+
+ // rows
+ void <span title="dom-datagrid-renotify">renotify</span>();
+ void <span title="dom-datagrid-setRowCount">setRowCount</span>(in long childCount, in long rowCount);
+ void <span title="dom-datagrid-setRows">setRows</span>(in <span>RowList</span> rows);
+ void <span title="dom-datagrid-insertRows">insertRows</span>(in <span>RowList</span> rows);
+ void <span title="dom-datagrid-deleteRows">deleteRows</span>(in <span>RowIDList</span> rows);
+ void <span title="dom-datagrid-repaint">repaint</span>(in <span>RowID</span> row, in DOMString column);
+ void <span title="dom-datagrid-clearRows">clearRows</span>();
+<!- -
+ v2: opening and closing a row
+ moving a row's actual ID
+ - imagine new mail moving a thread up; you just want to add the new mail to the thread and move the thread's first mail to the top
+ - though actually that should probably just be done using display sorting
+- ->
+};
+
+typedef DOMString <dfn>Column</dfn>;
+typedef sequence&lt;<span>Column</span>> <dfn>ColumnList</dfn>;
+typedef sequence&lt;any> <dfn>Cell</dfn>; // <span>Column</span>, any... (exact types expected depend on the column type)
+typedef sequence&lt;<span>Cell</span>> <dfn>CellList</dfn>;
+typedef sequence&lt;any> <dfn>Row</dfn>; // <span>RowID</span>, long, long, <span>CellList</span>, optional boolean, optional long
+typedef sequence&lt;<span>Row</span>> <dfn>RowList</dfn>;
+typedef sequence&lt;unsigned long> <dfn>RowID</dfn>;
+typedef sequence&lt;<span>RowID</span>> <dfn>RowIDList</dfn>;
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn>RenderingContext2DCallback</dfn> {
+ DOMString <span title="dom-Rendering2DContextCallback-handleEvent">handleEvent</span>(in <span>CanvasRenderingContext2D</span> context, in unsigned long width, in unsigned long height);
+};</pre>
+ </dd>
+ </dl>
+
+ <!- - v2:
+ * datagrid: cells that are links (<a href=""></a>)
+ - ->
+
+ <p>The <code>datagrid</code> element <span>represents</span> an
+ interactive representation of tree, list, or tabular data.</p>
+
+ <p>The data being presented is provided by script using the methods
+ described in the following sections.</p>
+
+<!- -v2DGS:
+ <p>The <dfn
+ title="attr-datagrid-multiple"><code>multiple</code></dfn> attribute
+ is a <span>boolean attribute</span>. When set, it indicates that the
+ user can select more than one row at a time.</p>
+- ->
+
+ <p>The <dfn
+ title="attr-datagrid-disabled"><code>disabled</code></dfn> attribute
+ is a <span>boolean attribute</span> used to disable the
+ control. <span class="impl">When the attribute is set, the user
+ agent must disable the <code>datagrid</code>, preventing the user
+ from interacting with it. The <code>datagrid</code> element should
+ still continue to update itself when the underlying data changes,
+ though, as described in the next few sections. However, conformance
+ requirements stating that <code>datagrid</code> elements must react
+ to users in particular ways do not apply when the
+ <code>datagrid</code> is disabled.</span></p>
+
+ <div class="impl">
+
+ <!- -vsDGS: multiple - ->
+
+ <p>The <dfn
+ title="dom-datagrid-disabled"><code>disabled</code></dfn> IDL
+ attribute must <span>reflect</span> the content attribute of the
+ same name.</p>
+
+ </div>
+
+ <!- - v2DGPA: One possible thing to be added is a way to detect when a
+ row/selection has been deleted, activated, etc, by the user (delete
+ key, enter key, etc). (v2DGPA = <datagrid> Perform Action) - ->
+
+
+ <h5>Introduction</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>In the <code>datagrid</code> data model, data is structured as a
+ set of rows representing a tree, each row being split into a number
+ of columns. The columns are always present in the data model,
+ although individual columns might be hidden in the presentation.</p>
+
+ <hr>
+
+ <p>Each row can have child rows. Child rows may be hidden or
+ shown, by closing or opening (respectively) the parent row.</p>
+
+ <p>Rows are referred to by the path along the tree that one would
+ take to reach the row, using zero-based indices. Thus, the first row
+ of a list is row "0", the second row is row "1"; the first child row
+ of the first row is row "0,0", the second child row of the first row
+ is row "0,1"; the fourth child of the seventh child of the third
+ child of the tenth row is "9,2,6,3", etc.</p>
+
+ <p>The chains of numbers that give a row's path, or identifier, are
+ represented by arrays of positions, represented in IDL by the
+ <span>RowID</span> interface.</p>
+
+ <p>The root of the tree is represented by an empty array.</p>
+
+ <hr>
+
+ <p>Each column has a string that is used to identify it in the API,
+ a label that is shown to users interacting with the column, a type,
+ and optionally an icon.</p>
+
+ <p>The possible types are as follows:</p>
+
+ <table>
+ <thead>
+ <tr>
+ <td>Keyword
+ <td>Description
+ <tbody>
+ <tr>
+ <td><code title="datagrid-type-text">text</code>
+ <td>Simple text.
+ <tr>
+ <td><code title="datagrid-type-editable">editable</code>
+ <td>Editable text.
+ <tr>
+ <td><code title="datagrid-type-checkable">checkable</code>
+ <td>Text with a check box.
+ <tr>
+ <td><code title="datagrid-type-list">list</code>
+ <td>A list of values that the user can switch between.
+ <tr>
+ <td><code title="datagrid-type-progress">progress</code>
+ <td>A progress bar.
+ <tr>
+ <td><code title="datagrid-type-meter">meter</code>
+ <td>A gauge.
+ <tr>
+ <td><code title="datagrid-type-custom">custom</code>
+ <td>A canvas onto which arbitrary content can be drawn.
+ </table>
+
+ <p>Each column can be flagged as sortable, in which case the user
+ will be able to sort the view using that column.</p>
+
+ <p>Columns are not necessarily visible. A column can be created
+ invisible by default. The user can select which columns are to be
+ shown.</p>
+
+ <p>When no columns have been added to the <code>datagrid</code>, a
+ column with no name, whose identifier is the empty string, whose
+ type is <code title="datagrid-type-text">text</code>, and which is
+ not sortable, is implied. This column is removed if any explicit
+ columns are declared.</p>
+
+ <p>Each cell uses the type given for its column, so all cells in a
+ column present the same type of information.</p>
+
+<!- -v2DGS:
+ <p>Selection of data in a <code>datagrid</code> operates at the row
+ level. If the <code title="attr-datagrid-multiple">multiple</code>
+ attribute is present, multiple rows can be selected at once,
+ otherwise the user can only select one row at a time.</p>
+- ->
+
+ <!- - v2DGDND: selection should draggable to and from datagrids - ->
+
+
+ <h6>Example: a <code>datagrid</code> backed by a static <code>table</code> element</h6>
+
+ ...
+
+
+ <h6>Example: a <code>datagrid</code> backed by nested <code>ol</code> elements</h6>
+
+ ...
+
+
+ <h6>Example: a <code>datagrid</code> backed by a server</h6>
+
+ ...
+
+
+ <h5>Populating the <code>datagrid</code></h5>
+
+ <dl class="domintro">
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-listener">listener</code> [ = <var title="">value</var> ]</dt>
+ <dd>
+
+ <p>Return the current object that is configured as the
+ <code>datagrid</code> listener, if any. Returns null if there is
+ none.</p>
+
+ <p>The listener is an object provided by the script author that
+ receives notifications when the <code>datagrid</code> needs row
+ data to render itself, when the user opens and closes rows with
+ children, when the user edits a cell, and when the user invokes a
+ row's context menu. (The <code>DataGridListener</code> interface
+ used for this purpose is described in the next section.)</p>
+
+ <p>Can be set, to change the current listener.</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-renotify">renotify</code>()</dt>
+ <dd>
+
+ <p>Causes the <code>datagrid</code> to resend notifications to the
+ listener (if any) for any rows or cells that the
+ <code>datagrid</code> does not yet have information for.</p>
+
+ <!- - useful, e.g., if there is a server error and the script loses
+ track of what rows it's supposed to be reporting. - ->
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-addColumn">addColumn</code>(<var title="">id</var>, <var title="">label</var>, <var title="">type</var> [, <var title="">icon</var> [, <var title="">sortable</var> [, <var title="">hidden</var> ] ] ] )</dt>
+ <dd>
+
+ <p>Adds a column to the <code>datagrid</code>.</p>
+
+ <p>If a column with the given identifier has already been added,
+ it just replaces the information for that column.</p>
+
+ <p>The possible types are enumerated in the previous section.</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortColumn">sortColumn</code> [ = <var title="">value</var> ]</dt>
+ <dd>
+
+ <p>Returns the identifier of the column by which the data is to be
+ sorted.</p>
+
+ <p>Can be set, to indicate that the sort order has changed. This
+ will cause the <code>datagrid</code> to clear its position
+ information for rows, so <code
+ title="dom-datagrid-setRows">setRows()</code> will have to be
+ called again with the new sort order.</p>
+
+ <p>The columns are not actually sorted by the
+ <code>datagrid</code>; the data has to be sorted by the script
+ that adds the rows to the <code>datagrid</code>.</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortAscending">sortAscending</code> [ = <var title="">value</var> ]</dt>
+ <dd>
+
+ <p>Returns true if the data is to be sorted with smaller values
+ first; otherwise, returns false, indicating that bigger values are
+ to be put first.</p>
+
+ <p>Can be set, to indicate that the order is about to change.</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearColumns">clearColumns</code>()</dt>
+ <dd>
+
+ <p>Removes all the columns in the <code>datagrid</code>,
+ reinstating the implied column.</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRowCount">setRowCount</code>(<var title="">childCount</var>, <var title="">rowCount</var>)</dt>
+ <dd>
+
+ <p>Sets the numbers of rows in the <code>datagrid</code>,
+ excluding rows that are descendants of rows that are closed.</p>
+
+ <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
+ arguments contradict each other or previously declared information
+ (e.g. declaring that the <code>datagrid</code> has three rows when
+ the 12th row has been declared).</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRows">setRows</code>(<var title="">rows</var>)</dt>
+ <dd>
+
+ <p>Updates data for rows in the <code>datagrid</code>, or fills in
+ data for rows previously implied by a call to <code
+ title="dom-datagrid-setRowCount">setRowCount()</code> but not
+ previously declared.</p>
+
+ <p>The <var title="">rows</var> argument is an array of rows, each
+ represented by a further array consisting of:</p>
+
+ <ol class="brief">
+
+ <li>A <code>RowID</code> object identifying the row.</li>
+
+ <li>An integer giving the position of the row in its parent,
+ given the current sort order, or &#x2212;1 to set other row data
+ without setting a position or changing a previously declared
+ position.</li>
+
+ <li>An integer giving the number of children of the row, or 0 if
+ the row has no children, or &#x2212;1 if the row has children but
+ the count is currently unknown. If the number of children has
+ already been set to 0 or a positive integer, then passing
+ &#x2212;1 leaves the previous count unchanged.</li>
+
+ <li>An array giving the data for zero or more cells in the row,
+ as described below.</li>
+
+ <li>A boolean declaring whether the row is open or not. This
+ entry, if omitted, is assumed to be false (closed), unless the
+ row has already been declared as open.</li>
+
+ <li>An integer giving the number of rows that are descendants of
+ this row, excluding those that are descendants of descendants of
+ this row that are closed. This entry can be omitted if the row is
+ closed or if it has already been declared.</li>
+
+ </ol>
+
+ <p>The array giving the data for the cells in the row consists of
+ a further set of arrays, one per cell. The first item of each of
+ these arrays is the column's identifier; the subsequent values
+ vary based on the type of the column, as follows:</p>
+
+ <dl>
+
+ <dt><code title="datagrid-type-text">text</code></dt>
+ <dd>
+ <ol class="brief">
+ <li>A string giving the cell's value.
+ <li>Optionally, an <code>img</code> element giving an icon for the cell.
+ </ol>
+ </dd>
+
+ <dt><code title="datagrid-type-editable">editable</code></dt>
+ <dd>
+ <ol class="brief">
+ <li>A string giving the cell's value.
+ <li>Optionally, a <code>datalist</code> element giving a set of predefined options.
+ <li>Optionally, an <code>img</code> element giving an icon for the cell.
+ </ol>
+ </dd>
+
+ <dt><code title="datagrid-type-checkable">checkable</code></dt>
+ <dd>
+ <ol class="brief">
+ <li>A string giving the cell's value.
+ <li>A boolean, indicating whether the cell is checked (true) or not (false).
+ <li>Optionally, a boolean indicating whether the value of the cell is obscured as indeterminate (true), or not (false).
+ <li>Optionally, an <code>img</code> element giving an icon for the cell.
+ </ol>
+ </dd>
+
+ <dt><code title="datagrid-type-list">list</code></dt>
+ <dd>
+ <ol class="brief">
+ <li>A string giving the cell's current value.
+ <li>A <code>select</code> element giving the <span title="concept-select-option-list">list of options</span>.
+ <li>Optionally, an <code>img</code> element giving an icon for the cell.
+ </ol>
+ </dd>
+
+ <dt><code title="datagrid-type-progress">progress</code></dt>
+ <dd>
+ <ol class="brief">
+ <li>A value in the range 0.0 (no progress) to 1.0 (task complete).
+ </ol>
+ </dd>
+
+ <dt><code title="datagrid-type-meter">meter</code></dt>
+ <dd>
+ <ol class="brief">
+ <li>A number giving the cell's value.
+ <li>Optionally, a number giving the maximum value, if it's not 1.
+ <li>Optionally, a number giving the minimum value, if it's not 0.
+ <li>Optionally, a number giving the highest value that is considered "low".
+ <li>Optionally, a number giving the lowest value that is considered "high".
+ <li>Optionally, a number giving the value that is considered optimal.
+ </ol>
+ </dd>
+
+ <dt><code title="datagrid-type-custom">custom</code></dt>
+ <dd>
+ <ol class="brief">
+ <li>A number giving the minimum width of the cell, in CSS pixels, that is desired.
+ <li>A number giving the minimum height of the cell, in CSS pixels, that is desired.
+ <li>A function that is passed a <code>CanvasRenderingContext2D</code> object, along with the width and height (in CSS pixels) of the cell that the context will draw on.
+ </ol>
+ </dd>
+
+ </dl>
+
+ <p>While the rows in a single call to the <code
+ title="dom-datagrid-setRows">setRows()</code> method can be in any
+ order, for each row, it is important that all its ancestor rows
+ and all its open previous siblings are also declared, either in
+ the same call or in an earlier one.</p>
+
+ <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
+ arguments contradict each other or previously declared information
+ (e.g. saying that a row's position is 5 when the parent row only
+ has 3 children, or naming a column that doesn't exist, or
+ declaring a row without declaring its parent, or changing the
+ number of children that a row has while that row and its ancestors
+ are all open).</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-insertRows">insertRows</code>(<var title="">rows</var>)</dt>
+ <dd>
+
+ <p>Inserts the given rows into the <code>datagrid</code>,
+ increasing the numbers of rows that the <code>datagrid</code>
+ assumes are present.</p>
+
+ <p>The <var title="">rows</var> argument is an array of rows in
+ the same structure as the argument to the <code
+ title="dom-datagrid-setRows">setRows()</code> method described
+ above, with the same expectations of consistency (a given row's
+ ancestors and earlier open siblings being listed either earlier or
+ in the same call as a given row). However, unlike with the <code
+ title="dom-datagrid-setRows">setRows()</code> method, if a row is
+ inserted along with its child, the child is not included in the
+ child and row counts of the parent row; every row in the <var
+ title="">rows</var> argument will increase its parent's counts
+ automatically.</p>
+
+ <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
+ arguments contradict each other or previously declared
+ information.</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-deleteRows">deleteRows</code>(<var title="">rows</var>)</dt>
+ <dd>
+
+ <p>Removes the given rows from the <code>datagrid</code>, and
+ updates the number of rows known to be in the
+ <code>datagrid</code> accordingly. The argument is an array of
+ <code>RowID</code> objects identifying the rows to remove.</p>
+
+ <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the argument
+ includes a row the <code>datagrid</code> doesn't know about.</p>
+ <!- - since otherwise behaviour might depend on where the user
+ scrolled! - ->
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-repaint">repaint</code>(<var title="">row</var>, <var title="">column</var>)</dt>
+ <dd>
+
+ <p>If the given column's type is <code
+ title="datagrid-type-custom">custom</code>, then causes the
+ <code>datagrid</code> to reinvoke the function that obtains the
+ desired rendering.</p>
+
+ </dd>
+
+
+ <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearRows">clearRows</code>()</dt>
+ <dd>
+
+ <p>Clears the <code>datagrid</code> of all row data, resetting it
+ to empty<!- - v2DGS:, and clears the selection- ->.</p>
+
+ </dd>
+
+ </dl>
+
+
+ <div class="impl">
+
+ <h6>The listener</h6>
+
+ <p>The <dfn
+ title="dom-datagrid-listener"><code>listener</code></dfn> IDL
+ attribute allows authors to specify an object that will receive all
+ the notifications from the <code>datagrid</code>. Initially, its
+ value must be null. On getting, it must return its value. On
+ setting, its value must be set to the new value, and then the user
+ agent must <span>queue a task</span> to call the <code
+ title="dom-listener-initialize">initialize()</code> method with the
+ <code>datagrid</code> element as its only argument.</p>
+
+
+ <h6>The columns</h6>
+
+ <p>The columns are represented by the <dfn>column list</dfn>, an
+ ordered list of entries for columns, each of which consists of:</p>
+
+ <dl>
+
+ <dt>An identifier</dt>
+
+ <dd>A string used to identify the column in the API.</dd>
+
+ <dt>A label</dt>
+
+ <dd>A string used in the user interface.</dd>
+
+ <dt>A type</dt>
+
+ <dd>One of the types described below.</dd>
+
+ <dt>An icon</dt>
+
+ <dd>An image, copied from an <code>img</code> element when the
+ column was declared.</dd>
+
+ <dt>Whether the column is sortable</dt>
+
+ <dd>A boolean indicating whether the user can request that the data
+ be sorted by this column (true), or not (false).</dd>
+
+ <dt>Whether the column is visible</dt>
+
+ <dd>A boolean indicating whether the column is part of the
+ <code>datagrid</code>'s rendering.</dd>
+
+ </dl>
+
+ <p>Initially, the <span>column list</span> must have a single
+ column, the <dfn>default column</dfn>, whose identifier is the empty
+ string, whose label is the empty string, whose type is <code
+ title="datagrid-type-text">text</code>, with no icon, which is not
+ sortable, and which <em>is</em> visible.</p>
+
+ <hr>
+
+ <p>The <dfn title="dom-datagrid-addColumn"><code>addColumn(<var
+ title="">id</var>, <var title="">label</var>, <var
+ title="">type</var>, <var title="">icon</var>, <var
+ title="">sortable</var>, <var title="">hidden</var>)</code></dfn>
+ method must run the following steps:</p>
+
+ <ol>
+
+ <li><p>If there is already an entry in <span>column list</span>,
+ other than the <span>default column</span>, whose identifier is
+ <var title="">id</var>, throw a <code>DATAGRID_MODEL_ERR</code>
+ exception and abort these steps.</p></li>
+
+ <li>
+
+ <p>If <var title="">type</var> is not a string equal to one of the
+ <span>allowed <code>datagrid</code> column types</span>, then
+ throw a <code>DATAGRID_MODEL_ERR</code> exception and abort these
+ steps.</p>
+
+ </li>
+
+ <li><p>If the <var title="">icon</var> argument is present and not
+ null, but the given <code>img</code> element's <code
+ title="dom-img-complete">complete</code> attribute is false, then
+ let <var title="">icon</var> be null.</p></li>
+
+ <li><p>If the <var title="">icon</var> argument is present and not
+ null, then copy the image data from that <code>img</code> element,
+ and let <var title="">image</var> be the copy of that image
+ data. Otherwise, let <var title="">image</var> be nothing.</p></li>
+
+ <li><p>Append a new entry to the <span>column list</span>, with
+ <var title="">id</var> as its identifier, <var title="">label</var>
+ as its label, <var title="">type</var> as its type, and <var
+ title="">image</var> as its icon. Let the column be sortable if the
+ <var title="">sortable</var> argument is present and true, and make
+ it visible unless the <var title="">hidden</var> argument is
+ present and true.</p></li>
+
+ <li><p>If the <span>column list</span> contains the <span>default
+ column</span>, then remove the <span>default column</span> from the
+ <span>column list</span>, discard any data for cells in that column
+ in any rows in the <code>datagrid</code>, set <code
+ title="dom-datagrid-sortColumn">sortColumn</code> to <var
+ title="">id</var>, set <code
+ title="dom-datagrid-sortAscending">sortAscending</code> to true,
+ and run the <span><code>datagrid</code> resort
+ steps</span>.</p></li>
+
+ </ol>
+
+ <hr>
+
+ <p>The <dfn
+ title="dom-datagrid-sortColumn"><code>sortColumn</code></dfn> IDL
+ attribute gives the current column used for sorting. Initially, its
+ value must be the empty string. On getting, it must return its
+ current value. On setting, if the new value doesn't match the
+ identifier of one of the columns in the <span>column list</span>,
+ then the user agent must throw a <code>DATAGRID_MODEL_ERR</code>
+ exception. Otherwise, if the new value is not the same as its
+ current value, then the user agent must set the attribute to the new
+ value, and then run the <span><code>datagrid</code> resort
+ steps</span>.</p>
+
+ <p>The <dfn
+ title="dom-datagrid-sortAscending"><code>sortAscending</code></dfn>
+ IDL attribute specifies the direction that the tree is sorted in,
+ ascending (true) or descending (false). Initially, its value must be
+ true (ascending). On getting, it must return its current value. On
+ setting, if the new value is not the same as its current value, then
+ the user agent must set the attribute to the new value, and then run
+ the <span><code>datagrid</code> resort steps</span>.</p>
+
+ <p>When a column is marked as being sortable, the user agent should
+ allow the user to select that column to be the column used for
+ sorting, and should allow the user to chose whether the sort order
+ is ascending or descending.</p>
+
+ <p>When the user changes the sort order in this manner, the user
+ agent must update the <code
+ title="dom-datagrid-sortColumn">sortColumn</code> and <code
+ title="dom-datagrid-sortAscending">sortAscending</code> attributes
+ appropriately, and then run the <span><code>datagrid</code> resort
+ steps</span>.</p>
+
+ <p class="note">The <span><code>datagrid</code> resort steps</span>
+ are described in the next section.</p>
+
+ <hr>
+
+ <p>The <dfn
+ title="dom-datagrid-clearColumns"><code>clearColumns()</code></dfn>
+ method, if the <span>column list</span> doesn't contain the
+ <span>default column</span>, must empty the <span>column
+ list</span>, append the <span>default column</span> to the now empty
+ <span>column list</span>, discard any data for cells in all rows in
+ the <code>datagrid</code>, set <code
+ title="dom-datagrid-sortColumn">sortColumn</code> to the empty
+ string, set <code
+ title="dom-datagrid-sortAscending">sortAscending</code> to true, and
+ run the <span><code>datagrid</code> resort steps</span>. (If the
+ <span>column list</span> is already just the <span>default
+ column</span>, then the method does nothing.)</p>
+
+
+ <h6>The rows</h6>
+
+ <p>A <code>datagrid</code> element is intended to show a
+ representation of a tree, where typically the user only sees a
+ small part of the tree at a time.</p>
+
+ <p>To make this efficient, the <code>datagrid</code> element
+ <em>actually</em> shows a small part of a <em>sparse</em> tree, so
+ that only relevant parts of the data structure need be loaded at any
+ time. Specifically, the model requires only that all the ancestor
+ rows of the displayed rows be loaded, as well as any open earlier
+ siblings (in the displayed sort order) of the displayed rows.</p>
+
+ <p>Conceptually, therefore, a <code>datagrid</code> has a number of
+ related sparse data structures backing it.</p>
+
+ <p>The first is the <dfn>natural order sparse data tree</dfn>. This
+ is the structure in which rows are entered as they are declared, in
+ their natural order. This can differ from the order actually
+ displayed to the user. It consists of nested sparse lists of
+ rows. In the <span>natural order sparse data tree</span>, a row will
+ always have all its parents already declared. Once a row is added to
+ this structure, it can only be removed by the <code
+ title="dom-datagrid-deleteRows">deleteRows()</code> and <code
+ title="dom-datagrid-clearRows">clearRows()</code> methods. The order of
+ nodes in this tree never changes; to move a node in this tree, it
+ has to be removed and then another row (with the same data)
+ reinserted elsewhere.</p>
+
+ <p>The second structure is the <dfn>display order sparse data
+ tree</dfn>. This is a similar structure that contains a subset of
+ the rows in the <span>natural order sparse data tree</span>, ordered
+ in the order given by the <code
+ title="dom-datagrid-sortAscending">sortAscending</code> and <code
+ title="dom-datagrid-sortColumn">sortColumn</code> attributes, and
+ excluding rows with one or more ancestors that are closed. This tree
+ is cleared whenever the <code
+ title="dom-datagrid-sortAscending">sortAscending</code> and <code
+ title="dom-datagrid-sortColumn">sortColumn</code> attributes
+ change.</p>
+
+ <p>The third structure is the <dfn>display order sparse data
+ list</dfn>. This structure is a flattened representation of the
+ <span>display order sparse data tree</span>.</p>
+
+ <p>At any time, a number of consecutive rows in the <span>display
+ order sparse data list</span> are physically visible to the
+ user. The <code>datagrid</code> fires notifications to a <span
+ title="dom-datagrid-listener">listener</span> (provided by script),
+ and the listener, or other some script, is expected to feed the
+ <code>datagrid</code> with the information needed to render the
+ control.</p>
+
+ <p>A <code>datagrid</code> has a <dfn>pending <code>datagrid</code>
+ rows list</dfn>, which is a list of rows in the <span>display order
+ sparse data list</span> for which the <code>datagrid</code> has sent
+ notifications requesting information but not yet received
+ information about.</p>
+
+ <p>A <code>datagrid</code> also has a <dfn>pending
+ <code>datagrid</code> <em>cells</em> list</dfn>, which is a list of
+ row/column pairs (cells) for which the <code>datagrid</code> has
+ sent notifications requesting information but not yet received
+ information about.</p>
+
+ <p>User agents may discard information about rows that are not
+ displayed and that are not ancestors or open earlier siblings of
+ rows or ancestors of rows that are displayed.</p>
+
+ <hr>
+
+ <p>These structures are different views of the collection of rows
+ that form the <code>datagrid</code>. Each row has the following
+ information associated with it:</p>
+
+ <dl>
+
+ <dt>A parent</dt>
+
+ <dd><p>Either another row, or the <code>datagrid</code> itself. This
+ is the parent of the row in the <span>natural order sparse data
+ tree</span> and the <span>display order sparse data tree</span>
+ for the <code>datagrid</code>.</p></dd>
+
+ <dt>A natural order position relative to the other rows with the
+ same parent</dt>
+
+ <dd>
+
+ <p>This is the number of rows that precede this row under the same
+ parent in the <span>natural order sparse data tree</span>. This
+ number can't be changed relative to other rows in the same parent;
+ to change the relative natural order of data in the
+ <code>datagrid</code>, the original rows have to be removed and
+ new rows (with the same data but different natural positions)
+ inserted in their place. (The exact number of a row can change, as
+ new rows can be inserted above it.)</p>
+
+ <p>A row can be identified by a <code>RowID</code> object. This is
+ an array of numbers, consisting of the natural order positions of
+ each ancestor row and the row itself, starting from the furthest
+ ancestor. Thus, for instance, the fourth child row of the first
+ child row of the second row in a <code>datagrid</code> would be
+ identified by a <code>RowID</code> object whose value is <code
+ title="">[1, 0, 3]</code>. A row's identifier changes if rows are
+ <span title="dom-datagrid-insertRows">inserted before it</span> in
+ the <code>datagrid</code>.</p>
+
+ </dd>
+
+ <dt>A display order position relative to the other rows with
+ the same parent</dt>
+
+ <dd><p>This is the number of rows that precede this row under the
+ same parent in the <span>display order sparse data
+ tree</span>. This number can be unknown. If the sort order
+ changes, then this information is lost (as the <span>display order
+ sparse data tree</span> is cleared).</p></dd>
+
+ <dt>A child count</dt>
+
+ <dd><p>The number of rows that have this row as a parent. If this is
+ zero, the row cannot be opened. If this is &#x2212;1, then the
+ child count is unknown but the row can be opened. This value can be
+ changed by the <code title="dom-datagrid-setRows">setRows()</code>
+ method only if the current value is &#x2212;1 or if the row or one
+ of its ancestors is closed. Otherwise, it can only be changed
+ indirectly using the <code
+ title="dom-datagrid-insertRows">insertRows()</code> and <code
+ title="dom-datagrid-deleteRows">deleteRows()</code> methods.</p></dd>
+
+ <dt>An open flag</dt>
+
+ <dd><p>A boolean indicating whether the row is open (true) or
+ closed (false). Once set, the flag can only be changed by the user
+ or while one of the row's ancestors is itself closed. A row can
+ also be in a third state, "opening", which is treated as closed for
+ all purposes except that the user agent may indicate that the row
+ is in this special state, and except that when the row is updated
+ to have a row count, the row will switch to being open.</p></dd>
+
+ <dt>A row count</dt>
+
+ <dd><p>The number of rows that have this row as a parent or
+ ancestor, and that do not have an ancestor that is a descendant of
+ this row that is itself closed. If this is &#x2212;1, then the row
+ count is unknown. This value can be changed by the <code
+ title="dom-datagrid-setRows">setRows()</code> method only if the
+ row or one of its ancestors is closed (or opening, but not
+ open). Otherwise, it can only be changed indirectly using the <code
+ title="dom-datagrid-insertRows">insertRows()</code> and <code
+ title="dom-datagrid-deleteRows">deleteRows()</code>
+ methods.</p></dd>
+
+ <dt>Cells</dt>
+
+ <dd><p>The data that applies to this row. Cell data is discussed in
+ more detail below.</p></dd>
+
+ </dl>
+
+ <p>The <code>datagrid</code> itself also has a <dfn title="datagrid
+ child count">child count</dfn> and a <dfn title="datagrid row
+ count">row count</dfn>, which are analogous to the child counts and
+ row counts for rows. Initially, these must be zero.</p>
+
+ <hr>
+
+ <p>The <dfn><code>datagrid</code> resort steps</dfn>, which are
+ invoked when the sort order changes as described in the previous
+ section, are as follows:</p>
+
+ <ol>
+
+ <li>
+
+ <p>Clear the <span>display order sparse data tree</span>
+ (i.e. mark the display order position of all the rows in the
+ <code>datagrid</code> as unknown).</p>
+
+ <p>User agents may cache the position information of rows for
+ various values of <code
+ title="dom-datagrid-sortColumn">sortColumn</code> and <code
+ title="dom-datagrid-sortAscending">sortAscending</code>, instead
+ of discarding the information altogether. If the user agent caches
+ this information, and has information that applies to the current
+ values of <code title="dom-datagrid-sortColumn">sortColumn</code>
+ and <code title="dom-datagrid-sortAscending">sortAscending</code>,
+ then the user agent may repopulate the <span>display order sparse
+ data tree</span> from this information.</p>
+
+ </li>
+
+ <li>
+
+ <p>Clear the <span>pending <code>datagrid</code> rows list</span>
+ and the <span>pending <code>datagrid</code> cells list</span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Invoke the <span><code>datagrid</code> update display
+ algorithm</span>.</p>
+
+ </li>
+
+ <!- - v2: queue a task to fire an event, or tell the listener the
+ sort order changed, or something - ->
+
+ </ol>
+
+ <hr>
+
+ <p>The <dfn
+ title="dom-datagrid-renotify"><code>renotify()</code></dfn> method
+ must empty the <span>pending <code>datagrid</code> rows list</span>
+ and the <span>pending <code>datagrid</code> cells list</span>, and
+ invoke the <span><code>datagrid</code> update display
+ algorithm</span>.</p>
+
+ <hr>
+
+ <p>The <dfn title="dom-datagrid-setRowCount"><code>setRowCount(<var
+ title="">childCount</var>, <var
+ title="">rowCount</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li>
+
+ <p>Set the <span><code>datagrid</code> child count</span> to <var
+ title="">childCount</var>, the <span><code>datagrid</code> row
+ count</span> to <var title="">rowCount</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p><span>Audit the <code>datagrid</code></span>. If this fails,
+ then revert the changes made in the previous step, throw a
+ <code>DATAGRID_MODEL_ERR</code> exception, and abort these
+ steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Invoke the <span><code>datagrid</code> update display
+ algorithm</span>.</p>
+
+ </li>
+
+ </ol>
+
+ <hr>
+
+ <p>The <dfn title="dom-datagrid-setRows"><code>setRows(<var
+ title="">rows</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li>
+
+ <p><span title="type-check a RowList object">Type-check the <var
+ title="">rows</var> argument</span>. If this fails, throw a
+ <code>TypeError</code> exception, and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p><span title="partially sort a RowList object">Partially sort
+ the <var title="">rows</var> argument</span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each <code>Row</code> object in the <var
+ title="">rows</var> argument, in order, perform the appropriate
+ steps from the list below.</p>
+
+ <p class="note">The changes made to the <code>datagrid</code>'s
+ data structures in this step get reverted (as required below) if
+ any consistency errors are detected either in this step or the
+ next.</p>
+
+ <dl>
+
+ <dt>If there already exists a row in the <code>datagrid</code>'s
+ <span>natural order sparse data tree</span> with the same
+ identifier as given by the <code>Row</code> object's
+ <code>RowID</code> object, and that row and all its ancestors are
+ open</dt>
+
+ <dd>
+
+ <p>If one of the following conditions is true, then revert all
+ the changes done in this step, throw a
+ <code>DATAGRID_MODEL_ERR</code> exception, and abort these
+ steps:</p>
+
+ <ul>
+
+ <li>The value of the <code>Row</code> object's second entry is
+ neither &#x2212;1 nor equal to the child count of the
+ preexisting row.</li>
+
+ <li>The <code>Row</code> object has fewer than four
+ entries or more than six entries.</li>
+
+ <li>The <code>Row</code> object has five or more entries, and
+ its fifth entry is false.</li>
+
+ <li>The <code>Row</code> object has six entries, and its sixth
+ entry is not equal to the row count of the preexisting
+ row.</li>
+
+ </ul>
+
+ </dd>
+
+ <dt>If there already exists a row in the <code>datagrid</code>'s
+ <span>natural order sparse data tree</span> with the same
+ identifier as given by the <code>Row</code> object's
+ <code>RowID</code> object, but either that row or one of its
+ ancestors is closed</dt>
+
+ <dd>
+
+ <p>Set the preexisting row's child count to the value of the
+ <code>Row</code> object's second entry.</p>
+
+ <p>If the <code>Row</code> object has five or more entries, and
+ either its fifth entry is true and the preexisting row is closed
+ but not opening, or its fifth entry is false and the preexisting
+ row is open, then: if the preexisting row has no ancestor row
+ that is closed, then revert all the changes done in this step,
+ throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
+ these steps; otherwise, if the fifth entry is false, then close
+ the row; otherwise, open the row.</p>
+
+ <p>If the <code>Row</code> object has six entries, set the
+ preexisting row's row count to the value of the <code>Row</code>
+ object's sixth entry.</p>
+
+ <p>If the preexisting row is opening, then: increase the
+ <span><code>datagrid</code> row count</span> and the row counts
+ of any ancestor rows by the number of rows that the preexisting
+ row now has in its row count, then open the row.</p> <!- - we
+ should also "update the <span>pending <code>datagrid</code> rows
+ list</span> and the <span>pending <code>datagrid</code> cells
+ list</span> accordingly" - ->
+
+
+ </dd>
+
+ <dt>There does not exist a row in the <code>datagrid</code>'s
+ <span>natural order sparse data tree</span> with the same
+ identifier as given by the <code>Row</code> object's
+ <code>RowID</code> object</dt>
+
+ <dd>
+
+ <p>If the <code>RowID</code> object has a length greater than 1,
+ then verify that there is a row identified by the
+ <code>RowID</code> consisting of all but the last number in the
+ <code>Row</code> object's <code>RowID</code>. If there is no
+ such row present in the <span>natural order sparse data
+ tree</span>, then revert all the changes done in this step,
+ throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
+ these steps.</p>
+
+ <p>Create a row and insert it into the <span>natural order
+ sparse data tree</span>, such that its parent is the row
+ identified by the <code>RowID</code> consisting of all but the
+ last number in the <code>Row</code> object's <code>RowID</code>,
+ or the <code>datagrid</code> if the length of the
+ <code>Row</code> object's <code>RowID</code> is 1; with its
+ natural order position being the last number of the
+ <code>Row</code> object's <code>RowID</code>; with the child
+ count being the value of the third entry of the <code>Row</code>
+ object; with the row being marked closed unless the
+ <code>Row</code> object has five or more entries and its fifth
+ entry is true, in which case the row is open; and with its row
+ count being &#x2212;1 unless the <code>Row</code> object has six
+ entries, in which case the row count is equal to the value of
+ the <code>Row</code> object's sixth entry.</p>
+
+ </dd>
+
+ </dl>
+
+ </li>
+
+ <li>
+
+ <p><span>Audit the <code>datagrid</code></span>. If this fails,
+ then revert the changes made in the previous step, throw a
+ <code>DATAGRID_MODEL_ERR</code> exception, and abort these
+ steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each <code>Row</code> object in the <var
+ title="">rows</var> argument, in order, <span title="apply a Row
+ object">apply the <code>Row</code> object</span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Invoke the <span><code>datagrid</code> update display
+ algorithm</span>.</p>
+
+ </li>
+
+ </ol>
+
+ <hr>
+
+ <p>The <dfn title="dom-datagrid-insertRows"><code>insertRows(<var
+ title="">rows</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li>
+
+ <p><span title="type-check a RowList object">Type-check the <var
+ title="">rows</var> argument</span>. If this fails, throw a
+ <code>TypeError</code> exception, and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p><span title="partially sort a RowList object">Partially sort
+ the <var title="">rows</var> argument</span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each <code>Row</code> object in the <var
+ title="">rows</var> argument, in order, run the following
+ steps:</p>
+
+ <p class="note">The changes made to the <code>datagrid</code>'s
+ data structures in this step get reverted (as required below) if
+ any consistency errors are detected either in this step or the
+ next.</p>
+
+ <ol>
+
+ <li>
+
+ <p>Let <var title="">parent</var> be the row identified by the
+ <code>RowID</code> consisting of all but the last number in the
+ <code>Row</code> object's <code>RowID</code>, or the
+ <code>datagrid</code> itself if the <code>Row</code> object's
+ <code>RowID</code> has length 0.</p>
+
+ <p>If there is no such row present in the <span>natural order
+ sparse data tree</span>, then revert all the changes done in
+ this algorithm, throw a <code>DATAGRID_MODEL_ERR</code>
+ exception, and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Increment by one the natural order position of all rows whose
+ parent is <var title="">parent</var> and whose natural order
+ position is equal to or greater than the last number of the
+ <code>Row</code> object's <code>RowID</code>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the value of the <code>Row</code> object's second entry is
+ not &#x2212;1, then increment by one the display order position
+ of all rows whose parent is <var title="">parent</var> and whose
+ display order position is equal to or greater than the value of
+ the <code>Row</code> object's second entry.</p>
+
+ <!- -(Not sure how to really say this.)
+ <p>Update the <span>pending <code>datagrid</code> rows
+ list</span> and the <span>pending <code>datagrid</code> cells
+ list</span> accordingly.</p>
+ - ->
+
+ </li>
+
+ <li>
+
+ <p>Create a row and insert it into the <span>natural order
+ sparse data tree</span>, such that its parent is <var
+ title="">parent</var>; with its natural order position being the
+ last number of the <code>Row</code> object's <code>RowID</code>;
+ with the child count being the value of the third entry of the
+ <code>Row</code> object; with the row being marked closed unless
+ the <code>Row</code> object has five or more entries and its
+ fifth entry is true, in which case the row is open; and with its
+ row count being &#x2212;1 unless the <code>Row</code> object has
+ six entries, in which case the row count is equal to the value
+ of the <code>Row</code> object's sixth entry.</p>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ <li>
+
+ <p>For each <code>Row</code> object in the <var
+ title="">rows</var> argument, in order, <span title="apply a Row
+ object">apply the <code>Row</code> object</span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Invoke the <span><code>datagrid</code> update display
+ algorithm</span>.</p>
+
+ </li>
+
+ </ol>
+
+ <hr>
+
+ <p>When an algorithm requires the user agent to <dfn>type-check a
+ <code>RowList</code> object</dfn> (an array), each entry in the
+ object must be checked against the following requirements. If any
+ are false, then the type-check fails, otherwise it passes.</p>
+
+ <ul>
+
+ <li><p>The entry is a <code>Row</code> object (an
+ array).</p></li>
+
+ <li><p>The first value in the <code>Row</code> is a
+ <code>RowID</code> object (also an array), whose length is at least
+ 1, and whose values are all integers greater than or equal to
+ zero.</p></li>
+
+ <li><p>The numbers in the <code>RowID</code> object do not exactly
+ match any of the other entries in the <code>RowList</code> object
+ (i.e. no two <code>Row</code> objects have the same
+ identifier).</p></li>
+
+ <li><p>The second value in the <code>Row</code> is an integer that
+ is either &#x2212;1, zero, or a positive integer.</p></li>
+
+ <li><p>The third value in the <code>Row</code> is an integer that
+ is either &#x2212;1, zero, or a positive integer.</p></li>
+
+ <li><p>The fourth value in the <code>Row</code> is a
+ <code>CellList</code> object (yet another array).</p></li>
+
+ <li><p>Each entry in the <span>CellList</span> object is a
+ <code>Cell</code> object (again, an array).</p></li>
+
+ <li><p>Each <code>Cell</code> object in the <span>CellList</span>
+ object has as its first value a <code>Column</code> object (a
+ string), and its value is the identifier of one of the columns in
+ the <span>column list</span>.</p></li>
+
+ <li>
+
+ <p>Each <code>Cell</code> object in the <span>CellList</span>
+ object has as its second and subsequent entries values that match
+ the following requirements, as determined by the type of the
+ column identified by the first entry:</p>
+
+ <dl>
+
+ <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
+ <dd>
+
+ <p>The second entry's value is a string, and either there are
+ only two entries, or there are three, and the third entry is
+ an <code>img</code> element.</p>
+
+ <p>If there is an <code>img</code> element specified, its <code
+ title="dom-img-complete">complete</code> attribute is true.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
+ <dd>
+
+ <p>The second entry's value is a string, and either there are
+ only two entries, or the third entry is a
+ <code>datalist</code> element, and either there are only three
+ entries, or there are four, and the fourth entry is an
+ <code>img</code> element.</p>
+
+ <p>If there is an <code>img</code> element specified, its <code
+ title="dom-img-complete">complete</code> attribute is true.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
+ <dd>
+
+ <p>The second entry's value is a string, the third entry is a
+ boolean, and either there are only three entries, or the
+ fourth entry is also a boolean, and either there are only four
+ entries, or there are five, and the fifth entry is an
+ <code>img</code> element.</p>
+
+ <p>If there is an <code>img</code> element specified, its <code
+ title="dom-img-complete">complete</code> attribute is true.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
+ <dd>
+
+ <p>The second entry's value is a string, the third entry is a
+ <code>select</code> element, and either there are only three
+ entries, or there are four, and the fourth entry is an
+ <code>img</code> element.</p>
+
+ <p>If there is an <code>img</code> element specified, its <code
+ title="dom-img-complete">complete</code> attribute is true.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
+ <dd>
+
+ <p>There are only two entries, the second entry's value is a
+ number, and the number's value is between 0.0 and 1.0
+ inclusive.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
+ <dd>
+
+ <p>There are at least two, but possibly up to seven, entries,
+ all entries but the first one are numbers, and the following
+ relationships hold:</p>
+
+ <ul class="brief">
+
+ <li>The second entry is less than the third, or less than 1.0
+ if the third is absent.</li>
+
+ <li>The second entry is greater than the fourth, or greater
+ than 0.0 if the fourth is absent.</li>
+
+ <li>If there are at least three entries, the third entry is
+ greater than the fourth, or greater than zero if the fourth
+ is absent.</li>
+
+ <li>If there are at least five entries, the fifth is not
+ greater than the third and not less than the fourth.</li>
+
+ <li>If there are at least six entries, the sixth is not
+ greater than the third and not less than the fifth.</li>
+
+ <li>If there are at least seven entries, the fifth is not
+ greater than the third and not less than the fourth.</li>
+
+ </ul>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
+ <dd>
+
+ <p>There are four entries, the second and third are numbers
+ that are integers greater than zero, and the fourth is a
+ <code>Rendering2DContextCallback</code> object (a
+ function).</p>
+
+ </dd>
+
+ </dl>
+
+ </li>
+
+ <li><p>Either there are only four values in the <code>Row</code>,
+ or the fifth value in the <code>Row</code> is a boolean.</p></li>
+
+ <li><p>Either there are only four or five values in the
+ <code>Row</code>, or there are six, and the sixth value in the
+ <code>Row</code> an integer that is greater than or equal to
+ zero.</p></li>
+
+ </ul>
+
+ <p>Where the above requirements say that a value is to be a string,
+ the user agent must apply the ToString() abstract operation to the
+ value, assume that the value was indeed a string, and use the result
+ in the rest of the algorithm as if it had that had been the value
+ passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ <p>Where the above requirements say that a value is to be a number,
+ the user agent must first apply the ToNumber() abstract operation
+ to the value, and then verify that the result is neither an Infinity
+ value nor a Not-a-Number (NaN) value. If this result is indeed
+ acceptable (i.e. finite), the user agent must use the result in the
+ rest of the algorithm as if it had that had been the value passed to
+ the method. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ <p>Where the above requirements say that a value is to be an
+ integer, the user agent must first apply the ToNumber() abstract
+ operation to the value, and then verify that the result is a finite
+ integer. If so, the user agent must use the result in the rest of
+ the algorithm as if it had that had been the value passed to the
+ method. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ <p>Where the above requirements say that a value is to be a boolean,
+ the user agent must apply the ToBoolean() abstract operation to the
+ value, assume that the value was indeed a boolean, and use the
+ result in the rest of the algorithm as if it had that had been the
+ value passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ <hr>
+
+ <p>When an algorithm requires the user agent to <dfn>audit the
+ <code>datagrid</code></dfn>, the <code>datagrid</code> must be
+ checked against the following requirements. If any are false, then
+ the audit fails, otherwise it passes.</p>
+
+ <ul>
+
+ <li>There is no row whose natural order position is greater than or
+ equal to the child count of its parent row in the <span>natural
+ order sparse data tree</span>.</li>
+
+ <li>There is no row whose display order position is greater than or
+ equal to the child count of its parent row in the <span>display
+ order sparse data tree</span>.</li>
+
+ <li>There is no row such that the sum of that row's child count and
+ the row counts all the open rows that are direct children of that
+ row in the <span>natural order sparse data tree</span> is less than
+ that row's row count.</li>
+
+ <li>Of the rows whose child count is equal to the number of rows
+ that are direct children of that row in the <span>natural order
+ sparse data tree</span>, there is none such that the sum of that
+ row's child count and the row counts of all the open rows that are
+ direct children of that row in the <span>natural order sparse data
+ tree</span> is greater than that row's row count.</li>
+
+ </ul>
+
+ <p>For the purposes of this audit, the <code>datagrid</code> must be
+ treated as the parent row of all the rows that are direct children
+ of the <code>datagrid</code> in the <span>natural order sparse data
+ tree</span> and the <span>display order sparse data tree</span>. The
+ child count of this implied row is the <span><code>datagrid</code>
+ child count</span>, and the row count of this implied row is the
+ <span><code>datagrid</code> row count</span>.</p>
+
+ <hr>
+
+ <p>When an algorithm requires the user agent to <dfn>partially sort
+ a <code>RowList</code> object</dfn> (an array), the entries in the
+ object must be resorted such that <code>Row</code> objects are
+ listed after any of their ancestors and after any of their earlier
+ siblings. In other words, for any two <code>Row</code> objects <var
+ title="">a</var> and <var title="">b</var> in the
+ <code>RowList</code>, where <var title="">a</var> is before <var
+ title="">b</var> after the sort, the following conditions must
+ hold:</p>
+
+ <ul>
+
+ <li><p>If their <code>RowID</code> objects are the same length and
+ have values that are equal except for the last value, then the last
+ value of <var title="">a</var>'s <code>RowID</code>'s last value
+ must be less than <var title="">b</var>'s <code>RowID</code>'s last
+ value (i.e. earlier siblings must come before their later
+ siblings).</p></li>
+
+ <li><p>If their <code>RowID</code> objects are not the same length,
+ but the values in the shorter of the two are the same as the first
+ few values in the longer one, then <var title="">a</var>'s
+ <code>RowID</code> must be the shorter one (i.e. ancestors must
+ come before their descendants).</p></li>
+
+ </ul>
+
+ <hr>
+
+ <p>The <dfn title="dom-datagrid-deleteRows"><code>deleteRows(<var
+ title="">rows</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li>
+
+ <p>If any of the entries in <var title="">rows</var> are not
+ <code>RowID</code> objects consisting of one or more entries whose
+ values are all integers that are greater than or equal to zero,
+ then throw a <code>TypeError</code> exception and abort these
+ steps.</p>
+
+ <p>To check if a value is an integer, the user agent must first
+ apply the ToNumber() abstract operation to the value, and then
+ verify that the result is a finite integer. If so, the user agent
+ must use the result in the rest of the algorithm as if it had that
+ had been the value passed to the method. <a
+ href="#refsECMA262">[ECMA262]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>If any of the <code>RowID</code> objects in the <var
+ title="">rows</var> argument identify a row that isn't present in
+ the <span>natural order sparse data tree</span>, then throw a
+ <code>DATAGRID_MODEL_ERR</code> exception and abort these
+ steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If any row is listed twice in the <var title="">rows</var>
+ argument, then throw a <code>DATAGRID_MODEL_ERR</code> exception
+ and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Sort the <var title="">rows</var> argument such that the
+ entries are given in the same order as the rows they identify
+ would be visited in a pre-order, depth first traversal of the
+ <span>natural order sparse data tree</span>.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each row identified by entries in <var title="">rows</var>,
+ <em>in reverse order</em>, run the following steps:</p>
+
+ <ol>
+
+ <li>
+
+ <p>Decrement the child count of the row's parent row, if that
+ child count is greater than zero. If the row has no parent,
+ decrement the <span><code>datagrid</code> child
+ count</span>.</p>
+
+ <p>If the row has a parent row, and its child count is now zero,
+ then close that row.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">delta</var> be one more than the row's row
+ count if the row is open and its row count is greater than zero;
+ otherwise, let <var title="">delta</var> be one.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">ancestor</var> be the row.</p>
+
+ </li>
+
+ <li>
+
+ <p><i>Row count loop</i>: Let <var title="">ancestor</var> be
+ <var title="">ancestor</var>'s parent row, if any, or null if it
+ has none.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">ancestor</var> is null, then decrement the
+ <span><code>datagrid</code> row count</span> by <var
+ title="">delta</var>. Otherwise, if <var title="">ancestor</var>
+ is open, then decrement its row count by <var
+ title="">delta</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">ancestor</var> is not null, then jump back
+ to the step labeled <i>row count loop</i> above.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">parent</var> be the row's parent, or the
+ <code>datagrid</code> if the row has no parent.</p>
+
+ </li>
+
+ <li>
+
+ <p>Decrement by one the natural order position of all rows whose
+ parent is <var title="">parent</var> and whose natural order
+ position is equal to or greater than the row's own natural order
+ position.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the row is in the <span>display order sparse data
+ tree</span>, then decrement by one the display order position of
+ all rows whose parent is <var title="">parent</var> and whose
+ display order position is equal to or greater than the row's own
+ display order position.</p>
+
+ </li>
+
+ <li>
+
+ <p>Clear the row and its descendants from the
+ <code>Datagrid</code>.</p>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ <li>
+
+ <p>Invoke the <span><code>datagrid</code> update display
+ algorithm</span>.</p>
+
+ </li>
+
+ </ol>
+
+ <hr>
+
+ <p>The <dfn
+ title="dom-datagrid-clearRows"><code>clearRows()</code></dfn> method
+ must empty the <span>natural order sparse data tree</span>, reset
+ both the <span><code>datagrid</code> child count</span> and the
+ <span><code>datagrid</code> row count</span> to zero, and invoke the
+ <span><code>datagrid</code> update display algorithm</span>.</p>
+
+ <hr>
+
+ <p>The <dfn title="dom-datagrid-repaint"><code>repaint(<var
+ title="">row</var>, <var title="">column</var>)</code></dfn> method
+ must cause the user agent to clear its cache for the cell specified
+ by the identifier <var title="">row</var> and the column <var
+ title="">column</var>, if that column's type is <code
+ title="datagrid-type-custom">custom</code>. If the given column has
+ not been declared, or its type is not <code
+ title="datagrid-type-custom">custom</code>, then the user agent must
+ throw a <code>DATAGRID_MODEL_ERR</code> exception. If the given row
+ is not known, then the method must do nothing. If the cell is indeed
+ cleared, the user agent must reinvoke the previously registered
+ <code>RenderingContext2DCallback</code> callback when it needs to
+ repaint that row.</p>
+
+ <hr>
+
+ <p>If a row has a child count that isn't zero, then the user agent
+ should offer to the user the option of opening and closing the
+ row.</p>
+
+ <p>When a row is opened, if the row's row count is greater than
+ zero, then the user agent must increase the
+ <span><code>datagrid</code> row count</span> and the row counts of
+ any ancestor rows by the number of rows that the newly opened row
+ has in its row count<!- - we should also "update the <span>pending
+ <code>datagrid</code> rows list</span> and the <span>pending
+ <code>datagrid</code> cells list</span> accordingly" - ->, then must
+ mark the row as open, then may fill in the <span>display order
+ sparse data tree</span> with any information that the user agent has
+ cached about the display order positions of descendants of the newly
+ opened row, and then must invoke the <code
+ title="dom-listener-rowOpened">rowOpened()</code> method on the
+ current <code title="dom-datagrid-listener">listener</code> with as
+ its first argument a <code>RowID</code> object identifying the row
+ that was opened and as its second argument the boolean false, and
+ then must invoke the <span><code>datagrid</code> update display
+ algorithm</span>.</p>
+
+ <p>On the other hand, when a row is opened and the row's row count
+ is &#x2212;1, then the user agent must mark the row as opening, and
+ then must invoke the <code
+ title="dom-listener-rowOpened">rowOpened()</code> method on the
+ current <code title="dom-datagrid-listener">listener</code> with as
+ its first argument a <code>RowID</code> object identifying the row
+ that was opened and as its second argument the boolean true.</p>
+
+ <p>When a row is closed, the user agent must decrease the
+ <span><code>datagrid</code> row count</span> and the row counts of
+ any ancestor rows by the number of rows that the newly closed row
+ has in its row count, and then must invoke the <code
+ title="dom-listener-rowOpened">rowOpened()</code> method on the
+ current <code title="dom-datagrid-listener">listener</code> with as
+ its first and only argument a <code>RowID</code> object identifying
+ the row that was opened.</p>
+
+
+
+ <h6>The cells</h6>
+
+ <p>Each row has one cell per column. Each cell has the same type as
+ its column. The <dfn>allowed <code>datagrid</code> column
+ types</dfn>, what they represent, and the requirements for when the
+ user interacts with them, are as follows:</p>
+
+ <dl>
+
+ <dt><dfn title="datagrid-type-text"><code>text</code></dfn></dt>
+ <dd>
+
+ <p>The cell represents some text and an optional image.</p>
+
+ </dd>
+
+ <dt><dfn title="datagrid-type-editable"><code>editable</code></dfn></dt>
+ <dd>
+
+ <p>The cells represents some editable text, an optional
+ <code>datalist</code> giving autocompletion hints, and an
+ optional image.</p>
+
+ <p>If there is a <code>datalist</code> element, the user agent
+ should offer the suggestions represented by that element to the
+ user. The user agent may use the suggestion's <span
+ title="concept-option-label">label</span> to identify the
+ suggestion. If the user selects a suggestion, then the editable
+ text must be set to the selected suggestion's <span
+ title="concept-option-value">value</span>, as if the user had
+ written that value himself.</p>
+
+ <p>When the user edits the value, either directly or using the
+ <code>datalist</code>, the user agent must invoke the <code
+ title="dom-listener-cellChanged">cellChanged()</code> method on
+ the current <code title="dom-datagrid-listener">listener</code>
+ with as its first argument a <code>RowID</code> identifying the
+ cell's row, as its second argument the identifier of the cell's
+ column, as its third argument the new value, and as its fourth
+ argument the previous value.</p>
+
+ </dd>
+
+ <dt><dfn title="datagrid-type-checkable"><code>checkable</code></dfn></dt>
+ <dd>
+
+ <p>The cell represents some text, a check box that optionally has
+ its value obscured as indeterminate, and an optional image.</p>
+
+ <p>When the user checks or unchecks the check box, the user agent
+ must change the check box's state appropriately and stop obscuring
+ the check box as indeterminate (if it is obscuring it), and then
+ must invoke the <code
+ title="dom-listener-cellChanged">cellChanged()</code> method on
+ the current <code title="dom-datagrid-listener">listener</code>
+ with as its first argument a <code>RowID</code> identifying the
+ cell's row, as its second argument the identifier of the cell's
+ column, as its third argument true if the check box is now checked
+ and false otherwise, and as its fourth argument true if the check
+ box was previously checked and false otherwise.</p>
+
+ </dd>
+
+ <dt><dfn title="datagrid-type-list"><code>list</code></dfn></dt>
+ <dd>
+
+ <p>The cell represents some text giving the current value selected
+ from a dropdown list of options, a <code>select</code> element
+ giving the list of options, and an optional image.</p>
+
+ <p>The user agent should allow the user to change the value of the
+ cell from its current value to one of the <span
+ title="concept-option-value">values</span> given by
+ <code>option</code> elements in the <span
+ title="concept-select-option-list">list of options</span> (if
+ any). The user agent may use the <code>option</code> elements'
+ <span title="concept-option-label">labels</span> to annotate each
+ option.</p>
+
+ <p>When the user selects a new value from the <code>select</code>
+ element's <span title="concept-select-option-list">list of
+ options</span>, the user agent must invoke the <code
+ title="dom-listener-cellChanged">cellChanged()</code> method on
+ the current <code title="dom-datagrid-listener">listener</code>
+ with as its first argument a <code>RowID</code> identifying the
+ cell's row, as its second argument the identifier of the cell's
+ column, as its third argument the new value, and as its fourth
+ argument the previous value.</p>
+
+ </dd>
+
+ <dt><dfn title="datagrid-type-progress"><code>progress</code></dfn></dt>
+ <dd>
+
+ <p>The cell represents a (determinate) progress bar whose value is
+ between 0.0, indicating no progress, and 1.0, indicating the task
+ is complete.</p>
+
+ </dd>
+
+ <dt><dfn title="datagrid-type-meter"><code>meter</code></dfn></dt>
+ <dd>
+
+ <p>The cell represents a gauge, described by one to six
+ numbers.</p>
+
+ <p>The gauge's actual value is given by the first number.</p>
+
+ <p>If there is a second number, then that number is the maximum
+ value. Otherwise, the maximum value is 1.0.</p>
+
+ <p>If there is a third number, then that number is the minimum
+ value. Otherwise, the minimum value is 1.0.</p>
+
+ <p>If there is a fourth number, then that number is the low
+ boundary. Otherwise, the low boundary is the minimum value.</p>
+
+ <p>If there is a fifth number, then that number is the high
+ boundary. Otherwise, the high boundary is the maximum value.</p>
+
+ <p>If there is a sixth number, then the optimal point is the sixth
+ number. Otherwise, the optimum point is the midpoint between the
+ minimum value and the maximum value.</p>
+
+ <!- - next two paragraphs copied from <meter>: - ->
+
+ <p>If the optimum point is equal to the low boundary or the high
+ boundary, or anywhere in between them, then the region between the
+ low and high boundaries of the gauge must be treated as the
+ optimum region, and the low and high parts, if any, must be
+ treated as suboptimal. Otherwise, if the optimum point is less
+ than the low boundary, then the region between the minimum value
+ and the low boundary must be treated as the optimum region, the
+ region between the low boundary and the high boundary must be
+ treated as a suboptimal region, and the region between the high
+ boundary and the maximum value must be treated as an even less
+ good region. Finally, if the optimum point is higher than the high
+ boundary, then the situation is reversed; the region between the
+ high boundary and the maximum value must be treated as the optimum
+ region, the region between the high boundary and the low boundary
+ must be treated as a suboptimal region, and the remaining region
+ between the low boundary and the minimum value must be treated as
+ an even less good region.</p>
+
+ <p>User agents should indicate the relative position of the actual
+ value to the minimum and maximum values, and the relationship
+ between the actual value and the three regions of the gauge.</p>
+
+ </dd>
+
+ <dt><dfn title="datagrid-type-custom"><code>custom</code></dfn></dt>
+ <dd>
+
+ <p>The cell represents a dynamically generated graphical image.</p>
+
+ <p>The cell will have minimum dimensions (specified in CSS
+ pixels), and a callback (in the form of a
+ <code>RenderingContext2DCallback</code> object) to get a rendering
+ for the cell.</p>
+
+ <p>The user agent should not allow the cell to be rendered with
+ dimensions less than the given minimum width and height.</p>
+
+ <p>When the user agent needs to render the cell, the user agent
+ must <span>queue a task</span> to invoke the
+ <span>RenderingContext2DCallback</span> callback, passing it a
+ newly created <code>CanvasRenderingContext2D</code> object whose
+ <code title="dom-context-2d-canvas">canvas</code> IDL attribute is
+ null as the first argument, the actual cell width in CSS pixels as
+ the second argument, and the actual cell height in CSS pixels as
+ the third argument.</p>
+
+ <p>If the user agent is able to render graphics, then it must
+ render the graphics commands that the callback executed on the
+ provided <code>CanvasRenderingContext2D</code> object onto the
+ cell once the callback returns. The image must be clipped to the
+ dimensions of the cell. The coordinate space of the cell must be
+ aligned with that used by the 2D context such that the top left
+ corner of the cell is the 0,0 origin, with the coordinate space
+ increasing its <var title="">x</var> dimension towards the right
+ of the cell and its <var title="">y</var> axis towards the bottom
+ of the cell, and with the image not scaled (so that one CSS pixel
+ on the final rendering matches one CSS pixel in the coordinate
+ space used by the 2D context).</p>
+
+ <p>The user agent must then decouple the
+ <code>CanvasRenderingContext2D</code> object and any objects that
+ it created (such as <code>CanvasPattern</code> objects or
+ <code>ImageData</code> objects) from any real drawing surface.</p>
+
+ <p>If the user agent is unable to render graphics, then it must
+ render the text string returned by the callback instead.</p>
+
+ </dd>
+
+ </dl>
+
+ <hr>
+
+ <p>When an algorithm requires the user agent to <dfn>apply a
+ <code>Row</code> object</dfn>, the user agent must run the following
+ steps:</p>
+
+ <ol>
+
+ <li>
+
+ <p>If the value of the <code>Row</code> object's second entry is
+ not &#x2212;1, then run these substeps:</p>
+
+ <ol>
+
+ <li><p>If there is a row with the same parent as the row
+ specified by the <code>Row</code> object's <code>RowID</code>
+ object, whose display order position is currently the same as the
+ value of the <code>Row</code> object's second entry, then remove
+ that row from the <span>display order sparse data
+ tree</span>.</p></li>
+
+ <li><p>Set the display order position of the row specified by the
+ <code>Row</code> object's <code>RowID</code> to the value of the
+ <code>Row</code> object's second entry, updating its position in
+ the <span>display order sparse data tree</span>
+ accordingly.</p></li>
+
+ <li><p>If the row is in the <span>pending
+ <code>datagrid</code> rows list</span>, remove it.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li>
+
+ <p>If the fourth entry in the <code>Row</code> object (a
+ <code>CellList</code> object, an array) is not empty, then for
+ each <code>Cell</code> object in that array update the cell that
+ corresponds to the column identified by the value of the first
+ entry of the <code>Cell</code> object, by using the appropriate
+ set of steps given below as determined by the type of the
+ column. Then, if the cell is in the <span>pending
+ <code>datagrid</code> cells list</span>, remove it.</p>
+
+ <dl>
+
+ <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
+ <dd>
+
+ <p>Update the cell's text to the value given in the
+ <code>Cell</code> object's second entry.</p>
+
+ <p>If the <code>Cell</code> object has three entries, then copy
+ the image data from the <code>img</code> element given in the
+ third entry, and let the cell's image be given by that image
+ data. Otherwise, update the cell to have no image.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
+ <dd>
+
+ <p>Update the cell's text to the value given in the
+ <code>Cell</code> object's second entry.</p>
+
+ <p>If the <code>Cell</code> object has three entries, then let
+ the <code>datalist</code> element given in the third entry be
+ the <code>datalist</code> element giving autocompletion
+ hints. Otherwise, update the cell to have no
+ <code>datalist</code> element.</p>
+
+ <p>If the <code>Cell</code> object has four entries, then copy
+ the image data from the <code>img</code> element given in the
+ fourth entry, and let the cell's image be given by that image
+ data. Otherwise, update the cell to have no image.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
+ <dd>
+
+ <p>Update the cell's text to the value given in the
+ <code>Cell</code> object's second entry.</p>
+
+ <p>Update the cell's checked state to match the value of the
+ third entry: checked if true, unchecked otherwise.</p>
+
+ <p>If the <code>Cell</code> object has four entries and the
+ fourth entry is true, then update the cell to be obscured as
+ indeterminate. Otherwise, the cell's state is not obscured.</p>
+
+ <p>If the <code>Cell</code> object has five entries, then copy
+ the image data from the <code>img</code> element given in the
+ fifth entry, and let the cell's image be given by that image
+ data. Otherwise, update the cell to have no image.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
+ <dd>
+
+ <p>Update the cell's text to the value given in the
+ <code>Cell</code> object's second entry, and the
+ <code>select</code> element to be the one given in the
+ <code>Cell</code> object's third entry</p>
+
+ <p>If the <code>Cell</code> object has four entries, then copy
+ the image data from the <code>img</code> element given in the
+ fourth entry, and let the cell's image be given by that image
+ data. Otherwise, update the cell to have no image.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
+ <dd>
+
+ <p>Update the cell to be a progress bar whose progress, on the
+ scale of 0.0 (no progress) to 1.0 (task complete) is given by
+ the value in the <code>Cell</code> object's second entry.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
+ <dd>
+
+ <p>Update the cell to be a gauge configured with the numbers
+ given by the second and subsequent entries of the
+ <code>Cell</code> object.</p>
+
+ </dd>
+
+ <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
+ <dd>
+
+ <p>Update the cell's minimum width to be the length in CSS
+ pixels given by the <code>Cell</code> object's second entry.</p>
+
+ <p>Update the cell's minimum height to be the length in CSS
+ pixels given by the <code>Cell</code> object's third entry.</p>
+
+ <p>Update the cell's callback to be the
+ <code>RenderingContext2DCallback</code> object given by the
+ <code>Cell</code> object's fourth entry.</p>
+
+ </dd>
+
+ </dl>
+
+ </li>
+
+ </ol>
+
+ <hr>
+
+ <p>When the user agent is to run the <dfn><code>datagrid</code>
+ update display algorithm</dfn>, the user agent must invoke the <code
+ title="dom-listener-getRows">getRows()</code> and <code
+ title="dom-listener-getCells">getCells()</code> methods on the
+ current <code title="dom-datagrid-listener">listener</code> such
+ that all the current visible rows in the <span>display order sparse
+ data list</span>, and all the cells in the currently visible columns
+ on all the currently visible rows, have been covered.</p>
+
+ <p>A row is considered covered if it is present in the <span>pending
+ <code>datagrid</code> rows list</span>, or if the <code
+ title="dom-listener-getRows">getRows()</code> method is invoked with
+ a range that includes the row in question.</p>
+
+ <p>A cell is considered covered if it is present in the
+ <span>pending <code>datagrid</code> cells list</span>, or if the
+ <code title="dom-listener-getRows">getRows()</code> method is
+ invoked with a range that includes the row in question and a list of
+ columns that includes the cell's column, or if the <code
+ title="dom-listener-getCells">getCells()</code> method is invoked
+ with a list of rows and columns that intersects the cell in
+ question. However, the <code
+ title="dom-listener-getCells">getCells()</code> method can only be
+ used if the row is already present in the <span>display order sparse
+ data list</span>.</p>
+
+ <p>The <code title="dom-listener-getRows">getRows()</code> method,
+ if used, must be invoked with five arguments. The first argument
+ must be the index in the <span>display order sparse data list</span>
+ to the first row that the user agent is requesting, known as the
+ <i>anchor row</i>. The second argument must be the number of
+ consecutive cells for which the user agent is requesting
+ information. The third argument must be the <code>RowID</code> of
+ the row that is the nearest ancestor in the <span>display order
+ sparse data <em>tree</em></span> of the anchor row. If this is the
+ <code>datagrid</code>, then the <code>RowID</code> object must be an
+ empty array. The fourth argument must be the display order position
+ of the anchor row in the <span>display order sparse data
+ tree</span>, assuming that the row identified in the third argument
+ is indeed the anchor row's parent row. The fifth and final argument
+ must be an array of the identifiers of the columns for which the
+ user agent is requesting information, in the order they were added
+ to the <code>datagrid</code>.</p>
+
+ <p>As the <code title="dom-listener-getRows">getRows()</code> method
+ is invoked, the <span>pending <code>datagrid</code> rows list</span>
+ must be updated to include the rows for which information has been
+ requested, excluding rows for which information is already
+ available; and the <span>pending <code>datagrid</code> cells
+ list</span> must be updated to include the cells for which
+ information has been requested on those rows.</p>
+
+ <p>The <code title="dom-listener-getCells">getCells()</code> method,
+ if used, must be invoked with two arguments. The first argument must
+ be an array of <code>RowID</code> objects identifying the rows for
+ which information is being requested. The second argument must be an
+ array of the identifiers of the columns for which the user agent is
+ requesting information, in the order they were added to the
+ <code>datagrid</code>.</p>
+
+ <p>As the <code title="dom-listener-getCells">getCells()</code>
+ method is invoked, the <span>pending <code>datagrid</code> cells
+ list</span> must be updated to include the cells for which
+ information has been requested.</p>
+
+ <p>Calls to these methods should be batched so that the rows and
+ cells to be covered are handled by the fewest number of calls to
+ these methods as possible. To this end, user agents may invoke the
+ <code title="dom-listener-getRows">getRows()</code> method for a set
+ of rows that includes some rows that are already in the
+ <span>display order sparse data list</span>, and similarly may
+ invoke the <code title="dom-listener-getCells">getCells()</code>
+ method with row/column combinations that cover some cells for which
+ data is already known. Generally, however, user agents should avoid
+ invoking these methods with arguments that cause information to be
+ requested when it has already been requested or is already
+ known.</p>
+
+ <div class="example">
+
+ <p>For example, consider a case represented by the following table,
+ where the cells marked "Yes" indicate that the data has already
+ been obtained, the cells marked "Pending" indicate that the data
+ has been previously requested but not yet obtained, and the cells
+ with just a dash indicate that no information has ever been
+ obtained, or any information that had been obtained has now been
+ discarded.</p>
+
+ <table>
+ <tr> <td> <th> Row <th> Column A <th> Column B
+ <tr> <th> Row 1 <td> - <td> - <td> -
+ <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes
+ <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes
+ <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes
+ <tr> <th> Row 5 <td> - <td> - <td> -
+ <tr> <th> Row 6 <td> - <td> - <td> -
+ <tr> <th> Row 7 <td> Yes <td> Pending <td> -
+ <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending
+ </table>
+
+ <p>Thus, rows 2, 3, 4, 7, and 8 are already covered, as are the
+ cells from those rows except for the cell in column B of row 7.</p>
+
+ <p>Now consider what happens if all of these rows become visible at
+ once. The user agent has several choices, including (but not
+ limited to) the following:</p>
+
+ <ul>
+
+ <li>Fire the <code title="dom-listener-getRows">getRows()</code>
+ method for rows 1 through 8 and columns A and B all at once.</li>
+
+ <li>Fire the <code title="dom-listener-getRows">getRows()</code>
+ method for row 1, then fire it again for rows 5 through 7.</li>
+
+ <li>Fire the <code title="dom-listener-getRows">getRows()</code>
+ method for row 1, then fire it again for rows 5 and 6, and then
+ fire the <code title="dom-listener-getCells">getCells()</code>
+ method for row 7 column B.</li>
+
+ </ul>
+
+ <p>All three options are allowed, but the latter two are preferable
+ to the former, as they minimise the amount of redundant information
+ requested.</p>
+
+ <p>In any case, the data model now looks like this:</p>
+
+ <table>
+ <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
+ <tr> <th> Row 1 <td> Pending <td> Pending <td> Pending <td> -
+ <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> -
+ <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> -
+ <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> -
+ <tr> <th> Row 5 <td> Pending <td> Pending <td> Pending <td> -
+ <tr> <th> Row 6 <td> Pending <td> Pending <td> Pending <td> -
+ <tr> <th> Row 7 <td> Yes <td> Pending <td> Pending <td> -
+ <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending <td> -
+ </table>
+
+ <p>Now consider the case where a third column, column C, is added
+ to the data model. The user agent once again has several choices,
+ including (but not limited to) the following:</p>
+
+ <ul>
+
+ <li>Fire the <code title="dom-listener-getRows">getRows()</code>
+ method for rows 1 through 8 again, this time listing just column
+ C.</li>
+
+ <li>Fire the <code title="dom-listener-getRows">getRows()</code>
+ method for row 1, then fire it again for rows 5 and 6, and then
+ fire the <code title="dom-listener-getCells">getCells()</code>
+ method for the other rows (in all three cases, listing just column
+ C).</li>
+
+ </ul>
+
+ <p>The two options here are as bad as each other; the former
+ involves a lot of overlap, but the latter involves a lot of method
+ calls. Unfortunately the user agent can't do the obvious thing,
+ namely just to invoke the <code
+ title="dom-listener-getCells">getCells()</code> method for all the
+ rows listing just column C, because it doesn't have the row
+ information for all the rows yet (rows 1, 5 and 6 are still
+ pending).</p>
+
+ <p>In any case, the data model now looks like this:</p>
+
+ <table>
+ <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
+ <tr> <th> Row 1 <td> Pending <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> Pending
+ <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> Pending
+ <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> Pending
+ <tr> <th> Row 5 <td> Pending <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 6 <td> Pending <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 7 <td> Yes <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending <td> Pending
+ </table>
+
+ <p>If at this point the user scrolls around anywhere within this
+ <code>datagrid</code>, the user agent won't fire the <code
+ title="dom-listener-getRows">getRows()</code> and <code
+ title="dom-listener-getCells">getCells()</code> methods, because
+ all of the rows and cells are covered.</p>
+
+ <p>Now consider the case where the user agent receives row
+ information, but no cell information, for rows 1, 5, and 6:</p>
+
+ <table>
+ <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
+ <tr> <th> Row 1 <td> Yes <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> Pending
+ <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> Pending
+ <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> Pending
+ <tr> <th> Row 5 <td> Yes <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 6 <td> Yes <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 7 <td> Yes <td> Pending <td> Pending <td> Pending
+ <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending <td> Pending
+ </table>
+
+ <p>The user agent still won't fire any methods when the user
+ scrolls, because the data is still covered. But if the script then
+ calls the <code title="dom-datagrid-renotify">renotify()</code>
+ method, the "Pending" flags would get reset, and the model would
+ now look like this:</p>
+
+ <table>
+ <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
+ <tr> <th> Row 1 <td> Yes <td> - <td> - <td> -
+ <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> -
+ <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> -
+ <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> -
+ <tr> <th> Row 5 <td> Yes <td> - <td> - <td> -
+ <tr> <th> Row 6 <td> Yes <td> - <td> - <td> -
+ <tr> <th> Row 7 <td> Yes <td> - <td> - <td> -
+ <tr> <th> Row 8 <td> Yes <td> - <td> - <td> -
+ </table>
+
+ <p>Now, assuming that all eight rows and all three columns are
+ still visible, the user agent has the following choices (amongst
+ others):</p>
+
+ <ul>
+
+ <li>Fire the <code title="dom-listener-getRows">getCells()</code>
+ method for rows 1 through 8, listing all three columns.</li>
+
+ <li>Fire the <code title="dom-listener-getRows">getCells()</code>
+ method for rows 1 and 5 through 8, listing all three columns, and
+ then fire the method for rows 2 through 4, listing just column
+ C.</li>
+
+ <li>Fire the <code title="dom-listener-getRows">getCells()</code>
+ method for rows 1 and 5 through 8, listing just columns A abd B,
+ and then fire the method for rows 1 through 8, listing just column
+ C.</li>
+
+ </ul>
+
+ <p>Here the latter two are preferable because they result in less
+ overlap than the first.</p>
+
+ </div>
+
+ <hr>
+
+ <p>The <span>task source</span> for tasks queued on behalf of a
+ <code>datagrid</code> is the <span>DOM manipulation task
+ source</span>.</p>
+
+ </div>
+
+
+ <h5>Listening to notifications from the <code>datagrid</code></h5>
+
+ <p><i>The conformance criteria in this section apply to any
+ implementation of the <code>DataGridListener</code> interface,
+ including (and most commonly) the content author's
+ implementation(s).</i></p>
+
+ <pre class="idl">// To be implemented by Web authors as a JS object
+[NoInterfaceObject]
+interface <dfn>DataGridListener</dfn> {
+ void <span title="dom-listener-initialize">initialize</span>(in <span>HTMLDataGridElement</span> datagrid);
+
+ void <span title="dom-listener-getRows">getRows</span>(in unsigned long rowIndex, in unsigned long rowCount, in <span>RowID</span> parentRow, in unsigned long position, in <span>ColumnList</span> columns);
+ void <span title="dom-listener-getCells">getCells</span>(in <span>RowIDList</span> rows, in <span>ColumnList</span> columns);
+ void <span title="dom-listener-rowOpened">rowOpened</span>(in <span>RowID</span> row, in boolean rowCountNeeded);
+ void <span title="dom-listener-rowClosed">rowClosed</span>(in <span>RowID</span> row);
+
+ void <span title="dom-listener-cellChanged">cellChanged</span>(in <span>RowID</span> row, in <span>Column</span> column, in any newValue, in any prevValue);
+ <span>HTMLMenuElement</span> <span title="dom-listener-getRowMenu">getRowMenu</span>(in <span>RowID</span> row);
+<!- -vsDGDND
+ boolean <span title="dom-listener-canDrop">canDrop</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
+ boolean <span title="dom-listener-dropped">dropped</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
+- -><!- -v2DGPA
+ void <span title="dom-listener-performAction">performAction</span>(in <span>RowID</span> row, in DOMString action);
+- ->};</pre>
+
+ <p>The <code>DataGridListener</code> interface, once implemented by
+ an object in a script and hooked up to a <code>datagrid</code> using
+ the <code title="dom-datagrid-listener">listener</code> IDL
+ attribute, receives notifications when the <code>datagrid</code>
+ needs information (such as which rows exist) for display.</p>
+
+ <p>The following methods may be usefully implemented:</p>
+
+ <dl>
+
+ <dt><dfn title="dom-listener-initialize"><code>initialize(<var title="">datagrid</var>)</code></dfn></dt>
+
+ <dd>
+
+ <p>Called by the <code>datagrid</code> element (the one given by
+ the <var title="">datagrid</var> argument) when the <code
+ title="dom-datagrid-listener">listener</code> attribute is
+ set.</p>
+
+ </dd>
+
+ <dt><dfn title="dom-listener-getRows"><code>getRows(<var title="">rowIndex</var>, <var title="">rowCount</var>, <var title="">parentRow</var>, <var title="">position</var>, <var title="">columns</var>)</code></dfn></dt>
+
+ <dd>
+
+ <p>Called by the <code>datagrid</code> element when the user agent
+ finds itself needing to render rows for which it is lacking
+ information.</p>
+
+ <p>The <var title="">rowIndex</var> argument gives the flattened
+ index of the first row for which it needs information, ignoring
+ the tree structure of the <code>datagrid</code> model, where zero
+ is the first row of the entire tree.</p>
+
+ <p>The <var title="">rowCount</var> argument gives the number of
+ rows for which the user agent would like information.</p>
+
+ <p>The <var title="">parentRow</var> argument gives the
+ <code>RowID</code> object identifying the nearest ancestor of the
+ first row that the user agent is aware of. After the sort order
+ has changed, this will typically be the root of the tree
+ (identified by a <code>RowID</code> object consisting of an empty
+ array).
+
+ <p>The <var title="">columns</var> argument gives the columns for
+ which the user agent is lacking information, as an array of column
+ identifiers (as passed to <code
+ title="dom-datagrid-addColumn">addColumn()</code>).</p>
+
+ </dd>
+
+ <dt><dfn title="dom-listener-getCells"><code>getCells(<var title="">rows</var>, <var title="">columns</var>)</code></dfn></dt>
+
+ <dd>
+
+ <p>Called by the <code>datagrid</code> element when the user agent
+ finds itself needing to render cells for which it is lacking
+ information in rows that it does know about.</p>
+
+ <p>The <var title="">rows</var> argument gives an array of
+ <code>RowID</code> objects identifying the various rows for which
+ the user agent is lacking information.</p>
+
+ <p>The <var title="">columns</var> argument gives the columns for
+ which the user agent is lacking information, as an array of column
+ identifiers (as passed to <code
+ title="dom-datagrid-addColumn">addColumn()</code>).</p>
+
+ </dd>
+
+ <dt><dfn title="dom-listener-rowOpened"><code>rowOpened(<var title="">row</var>, <var title="">rowCountNeeded</var>)</code></dfn></dt>
+
+ <dd>
+
+ <p>Called by the <code>datagrid</code> element when the user has
+ opened a row.</p>
+
+ <p>The <var title="">row</var> argument gives an
+ <code>RowID</code> object identifying the row that was opened.</p>
+
+ <p>If the user agent also knows how many children that row has,
+ then the <var title="">rowCountNeeded</var> argument will be
+ false. Otherwise, the argument will be true, and the row will
+ remain closed until the <code
+ title="dom-datagrid-setRows">setRows()</code> method is called
+ with an accurate row count.</p>
+
+ </dd>
+
+ <dt><dfn title="dom-listener-rowClosed"><code>rowClosed(<var title="">row</var>)</code></dfn></dt>
+
+ <dd>
+
+ <p>Called by the <code>datagrid</code> element when the user has
+ opened a row.</p>
+
+ <p>The <var title="">row</var> argument gives an
+ <code>RowID</code> object identifying the row that was closed.</p>
+
+ </dd>
+
+ <dt><dfn title="dom-listener-cellChanged"><code>cellChanged(<var title="">row</var>, <var title="">column</var>, <var title="">newValue</var>, <var title="">prevValue</var>)</code></dfn></dt>
+
+ <dd>
+
+ <p>Called by the <code>datagrid</code> element when the user has
+ edited a cell or checked a check box in a cell.</p>
+
+ <p>The <var title="">row</var> argument gives an
+ <code>RowID</code> object identifying the row of the cell, and the
+ <var title="">column</var> argument gives the identifier of the
+ cell's column.</p>
+
+ <p>The <var title="">newValue</var> argument gives the new value,
+ and the <var title="">prevValue</var> argument gives the previous
+ value.</p>
+
+ </dd>
+
+ <dt><dfn title="dom-listener-getRowMenu"><code>getRowMenu(<var title="">row</var>)</code></dfn></dt>
+
+ <dd>Must return an <code>HTMLMenuElement</code> object that is to
+ be used as a context menu for row <var title="">row</var>, or null
+ if there is no particular context menu. May be omitted if none of
+ the rows have a special context menu. As this method is called
+ immediately before showing the menu in question, no precautions
+ need to be taken if the return value of this method changes.</dd>
+
+ <!- -v2DGDND, v2DFPA- ->
+
+ </dl>
+
+ <div class="impl">
+
+ <p>Objects that implement the <code>DataGridListener</code>
+ interface may omit any or all of the methods. When a method is
+ omitted, a user agent intending to call that method must instead
+ skip the method call, and must assume that the method's return value
+ is null.</p>
+
+ </div>
+
+
+
+<!- - v2DGS: <datagrid> selection (search for the bits marked "..." to see what needs filling in, at a minimum)
+
+ <h5>The selection</h5>
+
+ <pre class="idl">interface <dfn>DataGridSelection</dfn> {
+ readonly attribute unsigned long <span title="dom-DataGridSelection-length">length</span>;
+ getter <span>RowID</span> <span title="dom-DataGridSelection-item">item</span>(in unsigned long index);
+ boolean <span title="dom-DataGridSelection-isSelected">isSelected</span>(in <span>RowID</span> row);
+ void <span title="dom-DataGridSelection-setSelected">setSelected</span>(in <span>RowID</span> row, in boolean selected);
+ void <span title="dom-DataGridSelection-selectAll">selectAll</span>();
+ void <span title="dom-DataGridSelection-clear">clear</span>();
+};</pre>
+
+ <dl class="domintro">
+
+ ...
+
+ </dl>
+
+ <div class="impl">
+
+ <p>Each <code>datagrid</code> element must keep track of which rows
+ are currently selected. Initially, no rows are selected. This can be
+ changed using the methods described in this section.</p>
+
+ <p>The selection of a <code>datagrid</code> is represented by its
+ <dfn title="dom-datagrid-selection"><code>selection</code></dfn> IDL
+ attribute, which must be a <code>DataGridSelection</code> object.</p>
+
+ <p><code>DataGridSelection</code> objects represent the rows in the
+ selection. In the selection the rows must be ordered in their
+ natural order (and not, e.g., the display order). A row with an
+ ancestor that is closed cannot be selected.</p>
+
+ <p>The <dfn
+ title="dom-DataGridSelection-length"><code>length</code></dfn>
+ attribute must return the number of rows currently present in the
+ selection. This is the <var
+ title="dom-DataGridSelection-length">length</var>.</p>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are the numbers in the range zero to <span title=""><var
+ title="dom-DataGridSelection-length">length</var>-1</span>, unless
+ the <var title="dom-DataGridSelection-length">length</var> is zero,
+ in which case there are no <span>supported indexed
+ properties</span>.</p>
+
+ <p>The <dfn title="dom-DataGridSelection-item"><code>item(<var
+ title="">index</var>)</code></dfn> method must return a
+ <code>RowID</code> object identifying the <var
+ title="">index</var>th row in the selection. If the argument is out
+ of range (less than zero or greater than the number of selected rows
+ minus one), then it must raise an <code>INDEX_SIZE_ERR</code>
+ exception. <a href="#refsDOMCORE">[DOMCORE]</a></p>
+
+ <p>The <dfn
+ title="dom-DataGridSelection-isSelected"><code>isSelected()</code></dfn>
+ method must return the selected state of the row specified by its
+ argument. If the specified row is in the <span>natural order sparse
+ data tree</span> and is selected, the method must return true,
+ otherwise it must return false.</p>
+
+ <p>The <dfn
+ title="dom-DataGridSelection-setSelected"><code>setSelected()</code></dfn>
+ method takes two arguments, <var title="">row</var> and <var
+ title="">selected</var>. When invoked, it must set the selection
+ state of row <var title="">row</var> to selected if <var
+ title="">selected</var> is true, and unselected if it is false. If
+ <var title="">row</var> does not specify a row in the <span>natural
+ order sparse data tree</span> ...
+
+ <p>The <dfn
+ title="dom-DataGridSelection-selectAll"><code>selectAll()</code></dfn>
+ method must ...
+
+ <p>The <dfn
+ title="dom-DataGridSelection-clear"><code>clear()</code></dfn>
+ method must mark all the rows in the <code>datagrid</code> as not
+ selected. After a call to <code
+ title="dom-DataGridSelection-clear">clear()</code>, the <code
+ title="dom-DataGridSelection-length">length</code> attribute will
+ return zero.</p>
+
+ <p>If the <code>datagrid</code> element has a <code
+ title="attr-datagrid-multiple">multiple</code> attribute, then the
+ user agent should allow the user to select any number of rows (zero
+ or more). If the attribute is not present, then the user agent
+ should allow the user to select a row, and must not allow the user
+ to select more than a single row at a time; selecting another one
+ must unselect all the other rows.</p>
+
+ <p class="note">This only applies to the user. Scripts can select
+ multiple rows even when the <code
+ title="attr-datagrid-multiple">multiple</code> attribute is
+ absent.</p>
+
+ ...event on selection change?...
+
+ </div>
+
+ <p class="note">The <code>DataGridSelection</code> interface has no
+ relation to the <code>Selection</code> interface.</p>
+
+- ->
+
+
+<!- -vsDGDND
+ <h5>Drag and drop in <code>datagrid</code>s</h5>
+
+ <p><i>This section only applies to interactive user agents.</i></p>
+
+ ...define drag and drop in datagrids; selectiondraggable...
+- ->
+
+-->
+
+ <h4 id=the-command><span class=secno>4.11.3 </span>The <dfn><code>command</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#metadata-content>Metadata content</a>.</dd>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#metadata-content>metadata content</a> is expected.</dd>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-command-type><a href=#attr-command-type>type</a></code></dd>
+ <dd><code title=attr-command-label><a href=#attr-command-label>label</a></code></dd>
+ <dd><code title=attr-command-icon><a href=#attr-command-icon>icon</a></code></dd>
+ <dd><code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code></dd>
+ <dd><code title=attr-command-checked><a href=#attr-command-checked>checked</a></code></dd>
+ <dd><code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code></dd>
+ <!--<dd><code title="attr-command-default">default</code></dd>-->
+ <dd>Also, the <code title=attr-command-title><a href=#attr-command-title>title</a></code> attribute has special semantics on this element.</dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlcommandelement>HTMLCommandElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-command-type title=dom-command-type>type</a>;
+ attribute DOMString <a href=#dom-command-label title=dom-command-label>label</a>;
+ attribute DOMString <a href=#dom-command-icon title=dom-command-icon>icon</a>;
+ attribute boolean <a href=#dom-command-disabled title=dom-command-disabled>disabled</a>;
+ attribute boolean <a href=#dom-command-checked title=dom-command-checked>checked</a>;
+ attribute DOMString <a href=#dom-command-radiogroup title=dom-command-radiogroup>radiogroup</a>;<!--
+ attribute boolean <span title="dom-command-default">default</span>;-->
+};</pre>
+ </dd>
+ </dl><p>The <code><a href=#the-command>command</a></code> element represents a command that the user
+ can invoke.</p>
+
+ <p>The <dfn id=attr-command-type title=attr-command-type><code>type</code></dfn>
+ attribute indicates the kind of command: either a normal command
+ with an associated action, or a state or option that can be toggled,
+ or a selection of one item from a list of items.</p>
+
+ <p>The attribute is an <a href=#enumerated-attribute>enumerated attribute</a> with three
+ keywords and states. The "<dfn id=attr-command-type-keyword-command title=attr-command-type-keyword-command><code>command</code></dfn>"
+ keyword maps to the <a href=#attr-command-type-state-command title=attr-command-type-state-command>Command</a> state, the
+ "<dfn id=attr-command-type-keyword-checkbox title=attr-command-type-keyword-checkbox><code>checkbox</code></dfn>"
+ keyword maps to the <a href=#attr-command-type-state-checkbox title=attr-command-type-state-checkbox>Checkbox</a> state, and
+ the "<dfn id=attr-command-type-keyword-radio title=attr-command-type-keyword-radio><code>radio</code></dfn>"
+ keyword maps to the <a href=#attr-command-type-state-radio title=attr-command-type-state-radio>Radio</a> state. The
+ <i>missing value default</i> is the <a href=#attr-command-type-state-command title=attr-command-type-state-command>Command</a> state.</p>
+
+ <dl><dt>The <dfn id=attr-command-type-state-command title=attr-command-type-state-command>Command</dfn> state</dt>
+
+ <dd><p>The element <a href=#represents>represents</a> a normal command with an associated action.</dd>
+
+ <dt>The <dfn id=attr-command-type-state-checkbox title=attr-command-type-state-checkbox>Checkbox</dfn> state</dt>
+
+ <dd><p>The element <a href=#represents>represents</a> a state or option that can be toggled.</dd>
+
+ <dt>The <dfn id=attr-command-type-state-radio title=attr-command-type-state-radio>Radio</dfn> state</dt>
+
+ <dd><p>The element <a href=#represents>represents</a> a selection of one item from a list of items.</dd>
+
+ </dl><p>The <dfn id=attr-command-label title=attr-command-label><code>label</code></dfn>
+ attribute gives the name of the command, as shown to the user. The
+ <code title=attr-command-label><a href=#attr-command-label>label</a></code> attribute must be
+ specified and must have a value that is not the empty string.</p>
+
+ <p>The <dfn id=attr-command-title title=attr-command-title><code>title</code></dfn>
+ attribute gives a hint describing the command, which might be shown
+ to the user to help him.</p>
+
+ <p>The <dfn id=attr-command-icon title=attr-command-icon><code>icon</code></dfn>
+ attribute gives a picture that represents the command. If the
+ attribute is specified, the attribute's value must contain a
+ <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
+ spaces</a>. <span class=impl>To obtain the <a href=#absolute-url>absolute
+ URL</a> of the icon when the attribute's value is not the empty
+ string, the attribute's value must be <a href=#resolve-a-url title="resolve a
+ url">resolved</a> relative to the element. When the attribute is
+ absent, or its value is the empty string, or <a href=#resolve-a-url title="resolve a
+ url">resolving</a> its value fails, there is no icon.</span></p>
+ <!-- this is affected by the base URL being changed, so users of
+ this should cache the image once they've fetched it once, at least
+ until the relative url changes again -->
+
+ <p>The <dfn id=attr-command-disabled title=attr-command-disabled><code>disabled</code></dfn> attribute
+ is a <a href=#boolean-attribute>boolean attribute</a> that, if present, indicates that
+ the command is not available in the current state.</p>
+
+ <p class=note>The distinction between <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> and <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> is subtle. A command would be
+ disabled if, in the same context, it could be enabled if only
+ certain aspects of the situation were changed. A command would be
+ marked as hidden if, in that situation, the command will never be
+ enabled. For example, in the context menu for a water faucet, the
+ command "open" might be disabled if the faucet is already open, but
+ the command "eat" would be marked hidden since the faucet could
+ never be eaten.</p>
+
+ <p>The <dfn id=attr-command-checked title=attr-command-checked><code>checked</code></dfn>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a> that, if present,
+ indicates that the command is selected. The attribute must be
+ omitted unless the <code title=attr-command-type><a href=#attr-command-type>type</a></code>
+ attribute is in either the <a href=#attr-command-type-state-checkbox title=attr-command-type-state-checkbox>Checkbox</a> state or
+ the <a href=#attr-command-type-state-radio title=attr-command-type-state-radio>Radio</a>
+ state.</p>
+
+ <p>The <dfn id=attr-command-radiogroup title=attr-command-radiogroup><code>radiogroup</code></dfn>
+ attribute gives the name of the group of commands that will be
+ toggled when the command itself is toggled, for commands whose <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute has the value "<code title="">radio</code>". The scope of the name is the child list of
+ the parent element. The attribute must be omitted unless the <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is in the <a href=#attr-command-type-state-radio title=attr-command-type-state-radio>Radio</a> state.</p>
+
+<!--
+ <p>If the <code>command</code> element is used when <span
+ title="menu generation">generating</span> a <span>context
+ menu</span>, then the <dfn
+ title="attr-command-default"><code>default</code></dfn> attribute
+ indicates, if present, that the command is the one that would have
+ been invoked if the user had directly activated the menu's subject
+ instead of using its context menu. The <code
+ title="attr-command-default">default</code> attribute is a
+ <span>boolean attribute</span>. The attribute must be omitted unless
+ the <code title="attr-command-type">type</code> attribute is in the
+ <span title="attr-command-type-state-command">Command</span>
+ state.</p>
+
+ <div class="example">
+
+ ...an example that shows an element that, if double-clicked,
+ invokes an action, but that also has a context menu, showing the
+ various <code>command</code> attributes off, and that has a default
+ command...
+
+ </div>
+-->
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-command-type title=dom-command-type><code>type</code></dfn>, <dfn id=dom-command-label title=dom-command-label><code>label</code></dfn>, <dfn id=dom-command-icon title=dom-command-icon><code>icon</code></dfn>, <dfn id=dom-command-disabled title=dom-command-disabled><code>disabled</code></dfn>, <dfn id=dom-command-checked title=dom-command-checked><code>checked</code></dfn>, and <dfn id=dom-command-radiogroup title=dom-command-radiogroup><code>radiogroup</code></dfn><!--,
+ and <dfn title="dom-command-default"><code>default</code></dfn>-->
+ IDL attributes must <a href=#reflect>reflect</a> the respective content
+ attributes of the same name.</p>
+
+ <p>The element's <a href=#activation-behavior>activation behavior</a> depends on the
+ value of the <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute
+ of the element, as follows:</p>
+
+ <dl class=switch><dt>If the <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is
+ in the <a href=#attr-command-type-state-checkbox title=attr-command-type-state-checkbox>Checkbox</a> state</dt>
+
+ <dd><p>If the element has a <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code> attribute, the UA must
+ remove that attribute. Otherwise, the UA must add a <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code> attribute, with the
+ literal value <code title="">checked</code>. The UA must then
+ <a href=#fire-a-click-event>fire a <code title=event-click>click</code> event</a> at the
+ element.</dd>
+
+
+ <dt>If the <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is
+ in the <a href=#attr-command-type-state-radio title=attr-command-type-state-radio>Radio</a> state</dt>
+
+ <dd><p>If the element has a parent, then the UA must walk the list
+ of child nodes of that parent element, and for each node that is a
+ <code><a href=#the-command>command</a></code> element, if that element has a <code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code> attribute whose
+ value exactly matches the current element's (treating missing <code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code> attributes as if
+ they were the empty string), and has a <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code> attribute, must remove
+ that attribute.</p>
+
+ <p>Then, the element's <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code> attribute attribute
+ must be set to the literal value <code title="">checked</code> and
+ the user agent must <a href=#fire-a-click-event>fire a <code title=event-click>click</code>
+ event</a> at the element.</dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd><p>The element has no <a href=#activation-behavior>activation behavior</a>.</dd>
+
+ </dl><p class=note>Firing a synthetic <code title=event-click><a href=#event-click>click</a></code> event at the element does not cause
+ any of the actions described above to happen.</p>
+
+ <!-- v2COMMAND: the command="" attribute to make a <command> element
+ reflect the state of another command, so that the script can update
+ one place in the page and have context menus, toolbars, shortcuts,
+ etc, automatically update. Once we add this, expose the Triggers
+ facet again. -->
+
+ </div>
+
+ <p class=note><code><a href=#the-command>command</a></code> elements are not rendered
+ unless they <a href=#menus title=menu>form part of a menu</a>.</p>
+
+ <div class=example>
+
+ <p>Here is an example of a toolbar with three buttons that let the
+ user toggle between left, center, and right alignment. One could
+ imagine such a toolbar as part of a text editor. The toolbar also
+ has a separator followed by another button labeled "Publish",
+ though that button is disabled.</p>
+
+ <pre>&lt;menu type="toolbar"&gt;
+ &lt;command type="radio" radiogroup="alignment" checked="checked"
+ label="Left" icon="icons/alL.png" onclick="setAlign('left')"&gt;
+ &lt;command type="radio" radiogroup="alignment"
+ label="Center" icon="icons/alC.png" onclick="setAlign('center')"&gt;
+ &lt;command type="radio" radiogroup="alignment"
+ label="Right" icon="icons/alR.png" onclick="setAlign('right')"&gt;
+ &lt;hr&gt;
+ &lt;command type="command" disabled
+ label="Publish" icon="icons/pub.png" onclick="publish()"&gt;
+&lt;/menu&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=menus><span class=secno>4.11.4 </span>The <dfn><code>menu</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd>If the element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state: <a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Either: Zero or more <code><a href=#the-li-element>li</a></code> elements.</dd>
+ <dd>Or: <a href=#flow-content>Flow content</a>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-menu-type><a href=#attr-menu-type>type</a></code></dd>
+ <dd><code title=attr-menu-label><a href=#attr-menu-label>label</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmlmenuelement>HTMLMenuElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-menu-type title=dom-menu-type>type</a>;
+ attribute DOMString <a href=#dom-menu-label title=dom-menu-label>label</a>;
+};</pre>
+ </dl><p>The <code><a href=#menus>menu</a></code> element represents a list of commands.</p>
+
+ <!-- v2 idea: <menu> should get an icon, like <command> -->
+
+ <p>The <dfn id=attr-menu-type title=attr-menu-type><code>type</code></dfn> attribute
+ is an <a href=#enumerated-attribute>enumerated attribute</a> indicating the kind of menu
+ being declared. The attribute has three states. The <code title=attr-menu-type-context>context</code> keyword maps to the
+ <dfn id=context-menu-state title="context menu state">context menu</dfn> state, in which
+ the element is declaring a context menu. The <code title=attr-menu-type-toolbar>toolbar</code> keyword maps to the
+ <dfn id=toolbar-state title="toolbar state">toolbar</dfn> state, in which the
+ element is declaring a toolbar. The attribute may also be
+ omitted. The <i>missing value default</i> is the <dfn id=list-state title="list
+ state">list</dfn> state, which indicates that the element is merely
+ a list of commands that is neither declaring a context menu nor
+ defining a toolbar.</p>
+
+ <p>If a <code><a href=#menus>menu</a></code> element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#context-menu-state title="context menu state">context menu</a> state, then the
+ element <a href=#represents>represents</a> the commands of a context menu, and
+ the user can only interact with the commands if that context menu is
+ activated.</p>
+
+ <p>If a <code><a href=#menus>menu</a></code> element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state, then the element
+ <a href=#represents>represents</a> a list of active commands that the user can
+ immediately interact with.</p>
+
+ <p>If a <code><a href=#menus>menu</a></code> element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#list-state title="list state">list</a> state, then the element either
+ <a href=#represents>represents</a> an unordered list of items (each represented
+ by an <code><a href=#the-li-element>li</a></code> element), each of which represents a command
+ that the user can perform or activate, or, if the element has no
+ <code><a href=#the-li-element>li</a></code> element children, <a href=#flow-content>flow content</a>
+ describing available commands.</p>
+
+ <p>The <dfn id=attr-menu-label title=attr-menu-label><code>label</code></dfn>
+ attribute gives the label of the menu. It is used by user agents to
+ display nested menus in the UI. For example, a context menu
+ containing another menu would use the nested menu's <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute for the submenu's
+ menu label.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-menu-type title=dom-menu-type><code>type</code></dfn> and <dfn id=dom-menu-label title=dom-menu-label><code>label</code></dfn> IDL attributes must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ </div>
+
+
+
+ <h5 id=menus-intro><span class=secno>4.11.4.1 </span>Introduction</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The <code><a href=#menus>menu</a></code> element is used to define context menus and
+ toolbars.</p>
+
+ <p>For example, the following represents a toolbar with three menu
+ buttons on it, each of which has a dropdown menu with a series of
+ options:</p>
+
+ <pre>&lt;menu type="toolbar"&gt;
+ &lt;li&gt;
+ &lt;menu label="File"&gt;
+ &lt;button type="button" onclick="fnew()"&gt;New...&lt;/button&gt;
+ &lt;button type="button" onclick="fopen()"&gt;Open...&lt;/button&gt;
+ &lt;button type="button" onclick="fsave()"&gt;Save&lt;/button&gt;
+ &lt;button type="button" onclick="fsaveas()"&gt;Save as...&lt;/button&gt;
+ &lt;/menu&gt;
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;menu label="Edit"&gt;
+ &lt;button type="button" onclick="ecopy()"&gt;Copy&lt;/button&gt;
+ &lt;button type="button" onclick="ecut()"&gt;Cut&lt;/button&gt;
+ &lt;button type="button" onclick="epaste()"&gt;Paste&lt;/button&gt;
+ &lt;/menu&gt;
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;menu label="Help"&gt;
+ &lt;li&gt;&lt;a href="help.html"&gt;Help&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="about.html"&gt;About&lt;/a&gt;&lt;/li&gt;
+ &lt;/menu&gt;
+ &lt;/li&gt;
+&lt;/menu&gt;</pre>
+
+ <p>In a supporting user agent, this might look like this:</p>
+
+ <p><img alt="A toolbar with three buttons, labeled 'File', 'Edit', and 'Help'; where if you select the 'Edit' button you get a drop-down menu with three more options, 'Copy', 'Cut', and 'Paste'." src=images/sample-toolbar-1.png></p>
+
+ <p>In a legacy user agent, the above would look like a bulleted list
+ with three items, the first of which has four buttons, the second of
+ which has three, and the third of which has two nested bullet points
+ with two items consisting of links.</p>
+
+ <hr><p>The following implements a similar toolbar, with a single button
+ whose values, when selected, redirect the user to Web sites.</p>
+
+ <pre>&lt;form action="redirect.cgi"&gt;
+ &lt;menu type="toolbar"&gt;
+ &lt;label for="goto"&gt;Go to...&lt;/label&gt;
+ &lt;menu label="Go"&gt;
+ &lt;select id="goto"<!--
+ onchange="if (this.options[this.selectedIndex].value)
+ window.location = this.options[this.selectedIndex].value"-->&gt;
+ &lt;option value="" selected="selected"&gt; Select site: &lt;/option&gt;
+ &lt;option value="http://www.apple.com/"&gt; Apple &lt;/option&gt;
+ &lt;option value="http://www.mozilla.org/"&gt; Mozilla &lt;/option&gt;
+ &lt;option value="http://www.opera.com/"&gt; Opera &lt;/option&gt;
+ &lt;/select&gt;
+ &lt;span&gt;&lt;input type="submit" value="Go"&gt;&lt;/span&gt;
+ &lt;/menu&gt;
+ &lt;/menu&gt;
+&lt;/form&gt;</pre>
+
+ <p>The behavior in supporting user agents is similar to the example
+ above, but here the legacy behavior consists of a single
+ <code><a href=#the-select-element>select</a></code> element with a submit button. The submit button
+ doesn't appear in the toolbar, because it is not a direct child of
+ the <code><a href=#menus>menu</a></code> element or of its <code><a href=#the-li-element>li</a></code>
+ children.</p>
+
+
+
+ <div class=impl>
+
+ <h5 id=building-menus-and-toolbars><span class=secno>4.11.4.2 </span><dfn>Building menus and toolbars</dfn></h5>
+
+ <p>A menu (or toolbar) consists of a list of zero or more of the
+ following components:</p>
+
+ <ul class=brief><li><a href=#concept-command title=concept-command>Commands</a>, which can be marked as default commands</li>
+ <li>Separators</li>
+ <li>Other menus (which allows the list to be nested)</li>
+ </ul><p>The list corresponding to a particular <code><a href=#menus>menu</a></code> element
+ is built by iterating over its child nodes. For each child node in
+ <a href=#tree-order>tree order</a>, the required behavior depends on what the
+ node is, as follows:</p>
+
+ <dl class=switch><dt>An element that <a href=#concept-command title=concept-command>defines a command</a></dt>
+
+ <dd>Append the command to the menu, respecting its <a href=#concept-facet title=concept-facet>facets</a><!-- we might need to be
+ explicit about what this means for each facet, if testing shows
+ this isn't well-implemented. e.g.: If there's an Icon facet for the
+ command, it should be <span title="fetch">fetched</span> (this
+ would be http-origin privacy-sensitive), and then that image should
+ be associated with the command, such that each command only has its
+ image fetched once, to prevent changes to the base URL from having
+ effects after the image has been fetched once. (no need to resolve
+ the Icon facet, it's an absolute URL) -->. <!--If the element is a
+ <code>command</code> element with a <code
+ title="attr-command-default">default</code> attribute, mark the
+ command as being a default command.--></dd>
+
+
+ <dt>An <code><a href=#the-hr-element>hr</a></code> element</dt>
+ <dt>An <code><a href=#the-option-element>option</a></code> element that has a <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute set to the empty
+ string, and has a <code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code> attribute, and whose
+ <code><a href=#textcontent>textContent</a></code> consists of a string of one or more
+ hyphens (U+002D HYPHEN-MINUS)</dt>
+
+ <dd>Append a separator to the menu.</dd>
+
+
+ <dt>An <code><a href=#the-li-element>li</a></code> element</dt>
+ <dt>A <code><a href=#the-label-element>label</a></code> element</dt>
+
+ <dd>Iterate over the children of the element.</dd>
+
+
+ <dt>A <code><a href=#menus>menu</a></code> element with no <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute</dt>
+ <dt>A <code><a href=#the-select-element>select</a></code> element</dt>
+
+ <dd>Append a separator to the menu, then iterate over the children
+ of the <code><a href=#menus>menu</a></code> or <code><a href=#the-select-element>select</a></code> element, then
+ append another separator.</dd>
+
+ <!-- v2: we might want to support <select> in <label> as giving a named submenu -->
+
+
+ <dt>A <code><a href=#menus>menu</a></code> element with a <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute</dt>
+ <dt>An <code><a href=#the-optgroup-element>optgroup</a></code> element with a <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute</dt>
+
+ <dd>Append a submenu to the menu, using the value of the element's
+ <code title="">label</code> attribute as the label of the menu. The
+ submenu must be constructed by taking the element and creating a
+ new menu for it using the complete process described in this
+ section.</dd>
+
+
+ <dt>Any other node</dt>
+
+ <dd><a href=#ignore>Ignore</a> the node.</dd>
+
+ </dl><p>Once all the nodes have been processed as described above, the
+ user agent must the post-process the menu as follows:</p>
+
+ <ol><li>Except for separators, any menu item with no label, or whose
+ label is the empty string, must be removed.</li>
+
+ <li>Any sequence of two or more separators in a row must be
+ collapsed to a single separator.</li>
+
+ <li>Any separator at the start or end of the menu must be
+ removed.</li>
+
+ </ol></div>
+
+
+
+
+ <h5 id=context-menus><span class=secno>4.11.4.3 </span><dfn>Context menus</dfn></h5>
+
+ <p>The <dfn id=attr-contextmenu title=attr-contextmenu><code>contextmenu</code></dfn>
+ attribute gives the element's <a href=#context-menus title="context menus">context
+ menu</a>. The value must be the ID of a <code><a href=#menus>menu</a></code> element
+ in the DOM. <span class=impl>If the node that would be obtained by
+ the invoking the <code title=dom-Document-getElementById><a href=#dom-document-getelementbyid>getElementById()</a></code> method
+ using the attribute's value as the only argument is null or not a
+ <code><a href=#menus>menu</a></code> element, then the element has no assigned context
+ menu. Otherwise, the element's assigned context menu is the element
+ so identified.</span></p>
+
+ <div class=impl>
+
+ <p>When an element's context menu is requested (e.g. by the user
+ right-clicking the element, or pressing a context menu key), the UA
+ must <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-contextmenu>contextmenu</code> that bubbles and is
+ cancelable at the element for which the menu was requested.</p>
+
+ <p class=note>Typically, therefore, the firing of the <code title=event-contextmenu>contextmenu</code> event will be the
+ default action of a <code title=mouseup>mouseup</code> or <code title=event-keyup>keyup</code> event. The exact sequence of events
+ is UA-dependent, as it will vary based on platform conventions.</p>
+
+ <p>The default action of the <code title=event-contextmenu>contextmenu</code> event depends on
+ whether the element or one of its ancestors has a context menu
+ assigned (using the <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute) or not. If
+ there is no context menu assigned, the default action must be for
+ the user agent to show its default context menu, if it has one.</p>
+
+ <p>If the element or one of its ancestors <em>does</em> have a
+ context menu assigned, then the user agent must <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-show>show</code> at the
+ <code><a href=#menus>menu</a></code> element of the context menu of the nearest
+ ancestor (including the element itself) with one assigned.</p>
+ <!-- v2: include modifier key information -->
+
+ <p>The default action of <em>this</em> event is that the user agent
+ must show a context menu <a href=#building-menus-and-toolbars title="building menus and
+ toolbars">built</a> from the <code><a href=#menus>menu</a></code> element.</p>
+
+ <p>The user agent may also provide access to its default context
+ menu, if any, with the context menu shown. For example, it could
+ merge the menu items from the two menus together, or provide the
+ page's context menu as a submenu of the default menu.</p>
+
+ <p>If the user dismisses the menu without making a selection,
+ nothing in particular happens.</p>
+
+ <p>If the user selects a menu item that represents a <a href=#concept-command title=concept-command>command</a>, then the UA must invoke
+ that command's <a href=#command-facet-action title=command-facet-Action>Action</a>.</p>
+
+ <p>Context menus must not, while being shown, reflect changes in the
+ DOM; they are constructed as the default action of the <code title=event-show>show</code> event and must remain as constructed
+ until dismissed.</p>
+
+ <p>User agents may provide means for bypassing the context menu
+ processing model, ensuring that the user can always access the UA's
+ default context menus. For example, the user agent could handle
+ right-clicks that have the Shift key depressed in such a way that it
+ does not fire the <code title=event-contextmenu>contextmenu</code>
+ event and instead always shows the default context menu.</p>
+
+ <p>The <dfn id=dom-contextmenu title=dom-contextMenu><code>contextMenu</code></dfn>
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> content attribute.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Here is an example of a context menu for an input control:</p>
+
+ <pre>&lt;form name="npc"&gt;
+ &lt;label&gt;Character name: &lt;input name=char type=text contextmenu=namemenu required&gt;&lt;/label&gt;
+ &lt;menu type=context id=namemenu&gt;
+ &lt;command label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()"&gt;
+ &lt;command label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)"&gt;
+ &lt;/menu&gt;
+&lt;/form&gt;</pre>
+
+ <p>This adds to items to the control's context menu, one called
+ "Pick random name", and one called "Prefill other fields based on
+ name". They invoke scripts that are not shown in the example
+ above.</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h5 id=toolbars><span class=secno>4.11.4.4 </span><dfn>Toolbars</dfn></h5>
+
+ <p>When a <code><a href=#menus>menu</a></code> element has a <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#toolbar-state title="toolbar state">toolbar</a> state, then the user agent
+ must <a href=#building-menus-and-toolbars title="building menus and toolbars">build</a> the
+ menu for that <code><a href=#menus>menu</a></code> element, and use the result in the
+ rendering.</p>
+
+ <p>The user agent must reflect changes made to the
+ <code><a href=#menus>menu</a></code>'s DOM, by immediately <a href=#building-menus-and-toolbars title="building menus
+ and toolbars">rebuilding</a> the menu.</p>
+
+ </div>
+
+
+
+ <h4 id=commands><span class=secno>4.11.5 </span>Commands</h4>
+
+ <p>A <dfn id=concept-command title=concept-command>command</dfn> is the abstraction
+ behind menu items, buttons, and links.<!--v2COMMAND: Once a command
+ is defined, other parts of the interface can refer to the same
+ command, allowing many access points to a single feature to share
+ aspects such as the disabled state.--></p>
+
+ <p id=facets>Commands are defined to have the following
+ <dfn id=concept-facet title=concept-facet>facets</dfn>:</p>
+
+ <dl><dt><dfn id=command-facet-type title=command-facet-Type>Type</dfn></dt>
+
+ <dd>The kind of command: "command", meaning it is a normal command;
+ "radio", meaning that triggering the command will, amongst other
+ things, set the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked
+ State</a> to true (and probably uncheck some other commands); or
+ "checkbox", meaning that triggering the command will, amongst other
+ things, toggle the value of the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>.</dd>
+
+ <dt><dfn id=command-facet-id title=command-facet-ID>ID</dfn></dt>
+
+ <dd>The name of the command, for referring to the command from the
+ markup or from script. If a command has no ID, it is an
+ <dfn id=anonymous-command>anonymous command</dfn>.</dd>
+
+ <dt><dfn id=command-facet-label title=command-facet-Label>Label</dfn></dt>
+
+ <dd>The name of the command as seen by the user.</dd>
+
+ <dt><dfn id=command-facet-hint title=command-facet-Hint>Hint</dfn></dt>
+
+ <dd>A helpful or descriptive string that can be shown to the
+ user.</dd>
+
+ <dt><dfn id=command-facet-icon title=command-facet-Icon>Icon</dfn></dt>
+
+ <dd>An <a href=#absolute-url>absolute URL</a> identifying a graphical image that
+ represents the action. A command might not have an Icon.</dd> <!--
+ changing base URLs might change the icon -->
+
+ <dt><dfn id=command-facet-accesskey title=command-facet-AccessKey>Access Key</dfn></dt>
+
+ <dd>A key combination selected by the user agent that triggers the
+ command. A command might not have an Access Key.</dd>
+
+ <dt><dfn id=command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</dfn></dt>
+
+ <dd>Whether the command is hidden or not (basically, whether it
+ should be shown in menus).</dd>
+
+ <dt><dfn id=command-facet-disabledstate title=command-facet-DisabledState>Disabled State</dfn></dt>
+
+ <dd>Whether the command is relevant and can be triggered or not.</dd>
+
+ <dt><dfn id=command-facet-checkedstate title=command-facet-CheckedState>Checked State</dfn></dt>
+
+ <dd>Whether the command is checked or not.</dd>
+
+ <dt><dfn id=command-facet-action title=command-facet-Action>Action</dfn></dt>
+
+ <dd>The actual effect that triggering the command will have. This
+ could be a scripted event handler, a <a href=#url>URL</a> to which to
+ <a href=#navigate>navigate</a>, or a form submission.</dd>
+
+<!-- v2COMMAND
+ <dt><dfn title="command-facet-Triggers">Triggers</dfn></dt>
+
+ <dd>The list of elements that can trigger the command. The element
+ defining a command is always in the list of elements that can
+ trigger the command. For anonymous commands, only the element
+ defining the command is on the list, since other elements have no
+ way to refer to it.</dd>
+-->
+
+ </dl><p>These facets are exposed on elements using the <dfn id=command-api>command
+ API</dfn>:</p>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-command-ro-commandType><a href=#dom-command-ro-commandtype>commandType</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-type title=command-facet-Type>Type</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-id><a href=#dom-id>id</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-id title=command-facet-ID>ID</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-command-ro-label><a href=#dom-command-ro-label>label</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-label title=command-facet-Label>Label</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-title><a href=#dom-title>title</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-command-ro-icon><a href=#dom-command-ro-icon>icon</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-icon title=command-facet-Icon>Icon</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-accesskey title=command-facet-AccessKey>Access Key</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-hidden><a href=#dom-hidden>hidden</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-command-ro-disabled><a href=#dom-command-ro-disabled>disabled</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-command-ro-checked><a href=#dom-command-ro-checked>checked</a></code></dt>
+
+ <dd>
+
+ <p>Exposes the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> facet of the command.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-click><a href=#dom-click>click</a></code>()</dt>
+
+ <dd>
+
+ <p>Triggers the <a href=#command-facet-action title=command-facet-Action>Action</a> of the command.</p>
+
+ </dd>
+
+<!--v2COMMAND
+ <dt><var title="">element</var> . <code title="dom-command-ro-triggers">triggers</code></dt>
+
+ <dd>
+
+ <p>Exposes the <span title="command-facet-Triggers">Triggers</span> facet of the command.</p>
+
+ </dd>
+-->
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-command-ro-commandtype title=dom-command-ro-commandType><code>commandType</code></dfn>
+ attribute must return a string whose value is either "<code title="">command</code>", "<code title="">radio</code>", or "<code title="">checkbox</code>", depending on whether the <a href=#command-facet-type title=command-facet-Type>Type</a> of the command defined by the
+ element is "command", "radio", or "checkbox" respectively. If the
+ element does not define a command, it must return null.</p>
+
+ <p>The <dfn id=dom-command-ro-label title=dom-command-ro-label><code>label</code></dfn>
+ attribute must return the command's <a href=#command-facet-label title=command-facet-Label>Label</a>, or null if the element
+ does not define a command or does not specify a <a href=#command-facet-label title=command-facet-Label>Label</a>. This attribute will be
+ shadowed by the <code title="">label</code> IDL attribute on
+ various elements.</p>
+
+ <p>The <dfn id=dom-command-ro-icon title=dom-command-ro-icon><code>icon</code></dfn>
+ attribute must return the <a href=#absolute-url>absolute URL</a> of the command's
+ <a href=#command-facet-icon title=command-facet-Icon>Icon</a>. If the element does
+ not specify an icon, or if the element does not define a command,
+ then the attribute must return null. This attribute will be shadowed
+ by the <code title=dom-command-icon><a href=#dom-command-icon>icon</a></code> IDL attribute on
+ <code><a href=#the-command>command</a></code> elements.</p>
+
+ <p>The <dfn id=dom-command-ro-disabled title=dom-command-ro-disabled><code>disabled</code></dfn>
+ attribute must return true if the command's <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> is that
+ the command is disabled, and false if the command is not
+ disabled. This attribute is not affected by the command's <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>. If the
+ element does not define a command, the attribute must return
+ false. This attribute will be shadowed by the <code title="">disabled</code> IDL attribute on various elements.</p>
+
+ <p>The <dfn id=dom-command-ro-checked title=dom-command-ro-checked><code>checked</code></dfn> attribute
+ must return true if the command's <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> is that the
+ command is checked, and false if it is that the command is not
+ checked. If the element does not define a command, the attribute
+ must return false. This attribute will be shadowed by the <code title="">checked</code> IDL attribute on <code><a href=#the-input-element>input</a></code> and
+ <code><a href=#the-command>command</a></code> elements.</p>
+
+<!--v2COMMAND
+ <p>The <dfn
+ title="dom-command-ro-triggers"><code>triggers</code></dfn>
+ attribute must return a list containing the elements that can
+ trigger the command (the command's <span
+ title="command-facet-Triggers">Triggers</span>). The list must be
+ <span>live</span>. The same object must be returned each time. While
+ the element does not define a command, the list must be empty.</p>
+-->
+
+ <p class=note>The <a href=#command-facet-id title=command-facet-ID>ID</a> facet
+ is exposed by the <code title=dom-id><a href=#dom-id>id</a></code> IDL attribute,
+ the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> facet is exposed by
+ the <code title=dom-title><a href=#dom-title>title</a></code> IDL attribute, the <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> facet is exposed by
+ the <code title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL
+ attribute, and the <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden
+ State</a> facet is exposed by the <code title=dom-hidden><a href=#dom-hidden>hidden</a></code> IDL attribute.</p>
+
+ </div>
+
+ <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-commands><a href=#dom-document-commands>commands</a></code></dt>
+ <dd>
+ <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the elements in the
+ <code><a href=#document>Document</a></code> that define commands and have IDs.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-commands title=dom-document-commands><code>commands</code></dfn> attribute
+ of the document's <code><a href=#htmldocument>HTMLDocument</a></code> interface must return an
+ <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code><a href=#document>Document</a></code>
+ node, whose filter matches only elements that <a href=#concept-command title=concept-command>define commands</a> and have <a href=#command-facet-id title=command-facet-ID>IDs</a>.</p>
+
+ </div>
+
+ <hr><p>User agents may expose the <a href=#concept-command title=concept-command>commands</a> whose <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> facet is false
+ (visible), e.g. in the user agent's menu bar. User agents are
+ encouraged to do this especially for commands that have <a href=#command-facet-accesskey title=command-facet-AccessKey>Access Keys</a>, as a way to
+ advertise those keys to the user.</p>
+
+
+ <div class=impl>
+
+ <h5 id=using-the-a-element-to-define-a-command><span class=secno>4.11.5.1 </span><dfn title=a-command>Using the <code>a</code> element to define a command</dfn></h5>
+
+ <p>An <code><a href=#the-a-element>a</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute <a href=#concept-command title=concept-command>defines a command</a>.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
+ is "command".</p>
+
+ <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
+ the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
+ element, if the attribute is present and not empty. Otherwise the
+ command is an <a href=#anonymous-command>anonymous command</a>.</p>
+
+ <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
+ is the string given by the element's <code><a href=#textcontent>textContent</a></code> IDL
+ attribute.</p>
+
+ <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
+ is the value of the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute
+ of the element. If the attribute is not present, the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> is the empty string.</p>
+
+ <p>The <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the command
+ is the <a href=#absolute-url>absolute URL</a> obtained from <a href=#resolve-a-url title="resolve
+ a url">resolving</a> the value of the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute of the first
+ <code><a href=#the-img-element>img</a></code> element descendant of the element, relative to that
+ element, if there is such an element and resolving its attribute is
+ successful. Otherwise, there is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>
+
+ <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
+ command is the element's <a href=#assigned-access-key>assigned access key</a>, if
+ any.</p>
+
+ <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
+ of the command is true (hidden) if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false
+ otherwise.</p>
+
+ <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
+ State</a> facet of the command is always false. (The command is
+ always enabled.)</p>
+
+ <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
+ of the command is always false. (The command is never checked.)</p>
+
+ <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
+ command is to <a href=#fire-a-click-event title="fire a click event">fire a <code title=event-click>click</code> event</a> at the element.</p>
+
+
+ <h5 id=using-the-button-element-to-define-a-command><span class=secno>4.11.5.2 </span><dfn title=button-command>Using the <code>button</code> element to define a command</dfn></h5>
+
+ <p>A <code><a href=#the-button-element>button</a></code> element always <a href=#concept-command title=concept-command>defines a command</a>.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a>, <a href=#command-facet-id title=command-facet-ID>ID</a>, <a href=#command-facet-label title=command-facet-Label>Label</a>, <a href=#command-facet-hint title=command-facet-Hint>Hint</a>, <a href=#command-facet-icon title=command-facet-Icon>Icon</a>, <a href=#command-facet-accesskey title=command-facet-AccessKey>Access Key</a>, <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>, <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>, and <a href=#command-facet-action title=command-facet-Action>Action</a> facets of the command are
+ determined <a href=#using-the-a-element-to-define-a-command title=a-command>as for <code>a</code>
+ elements</a> (see the previous section).</p>
+
+ <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
+ State</a> of the command mirrors the <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> state of the button.</p>
+
+
+ <h5 id=using-the-input-element-to-define-a-command><span class=secno>4.11.5.3 </span><dfn title=input-command>Using the <code>input</code> element to define a command</dfn></h5>
+
+ <p>An <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a>, <a href=#reset-button-state title=attr-input-type-reset>Reset Button</a>, <a href=#image-button-state title=attr-input-type-image>Image Button</a>, <a href=#button-state title=attr-input-type-button>Button</a>, <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a>, or <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> states <a href=#concept-command title=concept-command>defines a command</a>.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
+ is "radio" if the <code title=attr-input-type><a href=#attr-input-type>type</a></code>
+ attribute is in the <code title=attr-input-type-radio><a href=#radio-button-state>Radio
+ Button</a></code> state, "checkbox" if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <code title=attr-input-type-checkbox><a href=#checkbox-state>Checkbox</a></code> state, and
+ "command" otherwise.</p>
+
+ <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
+ the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
+ element, if the attribute is present and not empty. Otherwise the
+ command is an <a href=#anonymous-command>anonymous command</a>.</p>
+
+ <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
+ depends on the Type of the command:</p>
+
+ <p>If the <a href=#command-facet-type title=command-facet-Type>Type</a> is "command",
+ then it is the string given by the <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if any, and a
+ UA-dependent, locale-dependent value that the UA uses to label the
+ button itself if the attribute is absent.</p>
+
+ <p>Otherwise, the <a href=#command-facet-type title=command-facet-Type>Type</a> is
+ "radio" or "checkbox". If the element is a <a href=#labeled-control>labeled
+ control</a>, the <code><a href=#textcontent>textContent</a></code> of the first
+ <code><a href=#the-label-element>label</a></code> element in <a href=#tree-order>tree order</a> whose
+ <a href=#labeled-control>labeled control</a> is the element in question is the <a href=#command-facet-label title=command-facet-Label>Label</a> (in DOM terms, this is the
+ string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise,
+ the value of the <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+ attribute, if present, is the <a href=#command-facet-label title=command-facet-Label>Label</a>. Otherwise, the <a href=#command-facet-label title=command-facet-Label>Label</a> is the empty string.</p>
+
+ <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
+ is the value of the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute
+ of the <code><a href=#the-input-element>input</a></code> element. If the attribute is not present, the
+ <a href=#command-facet-hint title=command-facet-Hint>Hint</a> is the empty
+ string.</p>
+
+ <p>If the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
+ attribute is in the <a href=#image-button-state title=attr-input-type-image>Image
+ Button</a> state, and the element has a <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, and that attribute's
+ value can be successfully <a href=#resolve-a-url title="resolve a
+ url">resolved</a> relative to the element, then the <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the command is the
+ <a href=#absolute-url>absolute URL</a> obtained from resolving that attribute
+ that way. Otherwise, there is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>
+
+ <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
+ command is the element's <a href=#assigned-access-key>assigned access key</a>, if
+ any.</p>
+
+ <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
+ of the command is true (hidden) if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false
+ otherwise.</p>
+
+ <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
+ State</a> of the command mirrors the <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> state of the
+ control.</p>
+
+ <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
+ of the command is true if the command is of <a href=#command-facet-type title=command-facet-Type>Type</a> "radio" or "checkbox" and the
+ element is <a href=#concept-fe-checked title=concept-fe-checked>checked</a>
+ attribute, and false otherwise.</p>
+
+ <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
+ command, if the element has a defined <a href=#activation-behavior>activation
+ behavior</a>, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
+ steps</a> on the element. Otherwise, it is just to <a href=#fire-a-click-event>fire a
+ <code title=event-click>click</code> event</a> at the
+ element.</p>
+
+
+ <h5 id=using-the-option-element-to-define-a-command><span class=secno>4.11.5.4 </span><dfn title=option-command>Using the <code>option</code> element to define a command</dfn></h5>
+
+ <p>An <code><a href=#the-option-element>option</a></code> element with an ancestor
+ <code><a href=#the-select-element>select</a></code> element and either no <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute or a <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute that is not the
+ empty string <a href=#concept-command title=concept-command>defines a
+ command</a>.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
+ is "radio" if the <code><a href=#the-option-element>option</a></code>'s nearest ancestor
+ <code><a href=#the-select-element>select</a></code> element has no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute, and
+ "checkbox" if it does.</p>
+
+ <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
+ the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
+ element, if the attribute is present and not empty. Otherwise the
+ command is an <a href=#anonymous-command>anonymous command</a>.</p>
+
+ <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
+ is the value of the <code><a href=#the-option-element>option</a></code> element's <code title=attr-option-label><a href=#attr-option-label>label</a></code> attribute, if there is one,
+ or the value of the <code><a href=#the-option-element>option</a></code> element's
+ <code><a href=#textcontent>textContent</a></code> IDL attribute if there isn't.</p>
+
+ <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
+ is the string given by the element's <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute, if any, and the empty
+ string if the attribute is absent.</p>
+
+ <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the
+ command.</p>
+
+ <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
+ command is the element's <a href=#assigned-access-key>assigned access key</a>, if
+ any.</p>
+
+ <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
+ of the command is true (hidden) if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false
+ otherwise.</p>
+
+ <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
+ State</a> of the command is true (disabled) if the element is
+ <a href=#concept-option-disabled title=concept-option-disabled>disabled</a> or if its
+ nearest ancestor <code><a href=#the-select-element>select</a></code> element is <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, and false
+ otherwise.</p>
+
+ <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
+ of the command is true (checked) if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, and
+ false otherwise.</p>
+
+ <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
+ command depends on its <a href=#command-facet-type title=command-facet-Type>Type</a>. If the command is of <a href=#command-facet-type title=command-facet-Type>Type</a> "radio" then it must <a href=#concept-select-pick title=concept-select-pick>pick</a> the <code><a href=#the-option-element>option</a></code>
+ element. Otherwise, it must <a href=#concept-select-toggle title=concept-select-toggle>toggle</a> the <code><a href=#the-option-element>option</a></code>
+ element.</p>
+
+
+ <h5 id=using-the-command-element-to-define-a-command><span class=secno>4.11.5.5 </span>Using the <dfn title=command-element><code>command</code></dfn> element to define
+ a command</h5>
+
+ <p>A <code><a href=#the-command>command</a></code> element <a href=#concept-command title=concept-command>defines a command</a>.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
+ is "radio" if the <code><a href=#the-command>command</a></code>'s <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is
+ "<code>radio</code>", "checkbox" if the attribute's value is
+ "<code>checkbox</code>", and "command" otherwise.</p>
+
+ <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
+ the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
+ element, if the attribute is present and not empty. Otherwise the
+ command is an <a href=#anonymous-command>anonymous command</a>.</p>
+
+ <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
+ is the value of the element's <code title=attr-command-label><a href=#attr-command-label>label</a></code> attribute, if there is one,
+ or the empty string if it doesn't.</p>
+
+ <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
+ is the string given by the element's <code title=attr-command-title><a href=#attr-command-title>title</a></code> attribute, if any, and the
+ empty string if the attribute is absent.</p>
+
+ <p>The <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command
+ is the <a href=#absolute-url>absolute URL</a> obtained from <a href=#resolve-a-url title="resolve
+ a url">resolving</a> the value of the element's <code title=attr-command-icon><a href=#attr-command-icon>icon</a></code> attribute, relative to the
+ element, if it has such an attribute and resolving it is
+ successful. Otherwise, there is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>
+
+ <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
+ command is the element's <a href=#assigned-access-key>assigned access key</a>, if
+ any.</p>
+
+ <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
+ of the command is true (hidden) if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false
+ otherwise.</p>
+
+ <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
+ State</a> of the command is true (disabled) if the element has a
+ <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute, and
+ false otherwise.</p>
+
+ <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
+ of the command is true (checked) if the element has a <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code> attribute, and false
+ otherwise.</p>
+
+ <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
+ command, if the element has a defined <a href=#activation-behavior>activation
+ behavior</a>, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
+ steps</a> on the element. Otherwise, it is just to <a href=#fire-a-click-event>fire a
+ <code title=event-click>click</code> event</a> at the
+ element.</p>
+
+
+
+
+
+ <h5 id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.5.6 </span><dfn title=label-command>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>label</code> element to define a command</dfn></h5>
+
+ <p>A <code><a href=#the-label-element>label</a></code> element that has an <a href=#assigned-access-key>assigned access
+ key</a> and a <a href=#labeled-control>labeled control</a> and whose
+ <a href=#labeled-control>labeled control</a> <a href=#concept-command title=concept-command>defines a
+ command</a>, itself <a href=#concept-command title=concept-command>defines a
+ command</a>.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
+ is "command".</p>
+
+ <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
+ the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
+ element, if the attribute is present and not empty. Otherwise the
+ command is an <a href=#anonymous-command>anonymous command</a>.</p>
+
+ <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
+ is the string given by the element's <code><a href=#textcontent>textContent</a></code> IDL
+ attribute.</p>
+
+ <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
+ is the value of the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute
+ of the element.</p>
+
+ <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the
+ command.</p>
+
+ <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
+ command is the element's <a href=#assigned-access-key>assigned access key</a>.</p>
+
+ <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>,
+ <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a>, and
+ <a href=#command-facet-action title=command-facet-Action>Action</a> facets of the
+ command are the same as the respective facets of the element's
+ <a href=#labeled-control>labeled control</a>.</p>
+
+ <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
+ of the command is always false. (The command is never checked.)</p>
+
+
+
+ <h5 id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.5.7 </span><dfn title=legend-command>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>legend</code> element to define a command</dfn></h5>
+
+ <p>A <code><a href=#the-legend-element>legend</a></code> element that has an <a href=#assigned-access-key>assigned access
+ key</a> and is a child of a <code><a href=#the-fieldset-element>fieldset</a></code> element that
+ has a descendant that is not a descendant of the <code><a href=#the-legend-element>legend</a></code>
+ element and is neither a <code><a href=#the-label-element>label</a></code> element nor a
+ <code><a href=#the-legend-element>legend</a></code> element but that <a href=#concept-command title=concept-command>defines a command</a>, itself <a href=#concept-command title=concept-command>defines a command</a>.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
+ is "command".</p>
+
+ <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
+ the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
+ element, if the attribute is present and not empty. Otherwise the
+ command is an <a href=#anonymous-command>anonymous command</a>.</p>
+
+ <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
+ is the string given by the element's <code><a href=#textcontent>textContent</a></code> IDL
+ attribute.</p>
+
+ <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
+ is the value of the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute
+ of the element.</p>
+
+ <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the
+ command.</p>
+
+ <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
+ command is the element's <a href=#assigned-access-key>assigned access key</a>.</p>
+
+ <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>,
+ <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a>, and
+ <a href=#command-facet-action title=command-facet-Action>Action</a> facets of the
+ command are the same as the respective facets of the first element
+ in <a href=#tree-order>tree order</a> that is a descendant of the parent of the
+ <code><a href=#the-legend-element>legend</a></code> element that <a href=#concept-command title=concept-command>defines a command</a> but is not a
+ descendant of the <code><a href=#the-legend-element>legend</a></code> element and is neither a
+ <code><a href=#the-label-element>label</a></code> nor a <code><a href=#the-legend-element>legend</a></code> element.</p>
+
+ <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
+ of the command is always false. (The command is never checked.)</p>
+
+
+
+ <h5 id=using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.5.8 </span><dfn title=accesskey-command>Using the <code title=attr-accesskey>accesskey</code> attribute to define a command on other elements</dfn></h5>
+
+ <p>An element that has an <a href=#assigned-access-key>assigned access key</a> <a href=#concept-command title=concept-command>defines a command</a>.</p>
+
+ <p>If one of the other sections that define elements that <a href=#concept-command title=concept-command>define commands</a> define that this
+ element <a href=#concept-command title=concept-command>defines a command</a>, then
+ that section applies to this element, and this section does
+ not. Otherwise, this section applies to that element.</p>
+
+ <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
+ is "command".</p>
+
+ <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
+ the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
+ element, if the attribute is present and not empty. Otherwise the
+ command is an <a href=#anonymous-command>anonymous command</a>.</p>
+
+ <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
+ depends on the element. If the element is a <a href=#labeled-control>labeled
+ control</a>, the <code><a href=#textcontent>textContent</a></code> of the first
+ <code><a href=#the-label-element>label</a></code> element in <a href=#tree-order>tree order</a> whose
+ <a href=#labeled-control>labeled control</a> is the element in question is the <a href=#command-facet-label title=command-facet-Label>Label</a> (in DOM terms, this is the
+ string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise, the
+ <a href=#command-facet-label title=command-facet-Label>Label</a> is the
+ <code><a href=#textcontent>textContent</a></code> of the element itself.</p>
+
+ <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
+ is the value of the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute
+ of the element. If the attribute is not present, the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> is the empty string.</p>
+
+ <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the
+ command.</p>
+
+ <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
+ command is the element's <a href=#assigned-access-key>assigned access key</a>.</p>
+
+ <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
+ of the command is true (hidden) if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false
+ otherwise.</p>
+
+ <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
+ State</a> facet of the command is always false. (The command is
+ always enabled.)</p>
+
+ <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
+ of the command is always false. (The command is never checked.)</p>
+
+ <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
+ command is to run the following steps:</p>
+
+ <ol><li>If the element is <a href=#focusable>focusable</a>, run the
+ <a href=#focusing-steps>focusing steps</a> for the element.</li>
+
+ <li>If the element has a defined <a href=#activation-behavior>activation behavior</a>,
+ <a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> on the
+ element.</li>
+
+ <li>Otherwise, if the element does not have a defined
+ <a href=#activation-behavior>activation behavior</a>, <a href=#fire-a-click-event>fire a <code title=event-click>click</code> event</a> at the element.</li>
+
+ </ol></div>
+
+
+
+
+ <h4 id=devices><span class=secno>4.11.6 </span>The <dfn><code>device</code></dfn> element</h4>
+
+ <dl class=element><dt>Categories</dt>
+ <dd><a href=#flow-content>Flow content</a>.</dd>
+ <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
+ <dd><a href=#interactive-content>Interactive content</a>.</dd>
+ <dt>Contexts in which this element may be used:</dt>
+ <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd>Empty.</dd>
+ <dt>Content attributes:</dt>
+ <dd><a href=#global-attributes>Global attributes</a></dd>
+ <dd><code title=attr-device-type><a href=#attr-device-type>type</a></code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class=idl>interface <dfn id=htmldeviceelement>HTMLDeviceElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <span title=dom-device-type>type</span>;
+ readonly attribute any <span title=dom-device-data>data</span>;
+};</pre>
+ </dl><p>The <code><a href=#devices>device</a></code> element represents a device selector, to
+ allow the user to give the page access to a device, for example a
+ video camera.</p>
+
+ <p>The <dfn id=attr-device-type title=attr-device-type><code>type</code></dfn>
+ attribute allows the author to specify which kind of device the page
+ would like access to. The attribute is an <a href=#enumerated-attribute>enumerated
+ attribute</a> with the keywords given in the first column of the
+ following table, and their corresponding states given in the cell in
+ second column of the same row.</p>
+
+ <p class=XXX>RS232 is only included below to give an idea of where
+ we could go with this. <strong>Should we instead just make this only
+ useful for audiovisual streams?</strong> Unless there are compelling
+ reasons, we probably should not be this generic. So far, the reasons
+ aren't that compelling.</p>
+
+ <table><thead><tr><th>Keyword
+ <th>State
+ <th>Device description
+ <th>Examples
+ <tbody><tr><td><dfn id=attr-device-type-keyword-media title=attr-device-type-keyword-media><code>media</code></dfn>
+ <td><span title=attr-device-type-media>Media</span>
+ <td>Stream of audio and/or video data.
+ <td>A webcam.
+ <tr><td><dfn id=attr-device-type-keyword-fs title=attr-device-type-keyword-fs><code>fs</code></dfn>
+ <td><span title=attr-device-type-fs>File system</span>
+ <td>File system.
+ <td>A USB-connected media player.
+ <tr><td><dfn id=attr-device-type-keyword-rs232 title=attr-device-type-keyword-rs232><code>rs232</code></dfn>
+ <td><span title=attr-device-type-rs232>RS232</span>
+ <td>RS232 device.
+ <td>A serial port.
+ </table><p class=XXX>processing model: 'change' event fires once user
+ selects a new device; .data is set to new Stream, LocalFS, or RS232
+ object as appropriate.</p>
+
+ <div class=example>
+
+ <pre>&lt;p&gt;To start chatting, select a video camera: &lt;device type=media onchange="update(this.data)"&gt;&lt;/p&gt;
+&lt;video autoplay&gt;&lt;/video&gt;
+&lt;script&gt;
+ function update(stream) {
+ document.getElementsByTagName('video')[0].src = stream.url;
+ }
+&lt;/script&gt;</pre>
+
+ </div>
+
+
+ <h5 id=stream-api><span class=secno>4.11.6.1 </span>Stream API</h5>
+
+ <p>The <code><a href=#stream>Stream</a></code> interface is used to represent
+ streams.</p>
+
+ <pre class=idl>interface <dfn id=stream>Stream</dfn> {
+ readonly attribute DOMString <a href=#dom-stream-url title=dom-stream-url>url</a>;
+ <a href=#streamrecorder>StreamRecorder</a> <a href=#dom-stream-record title=dom-stream-record>record</a>();
+};</pre>
+
+ <p>The <dfn id=dom-stream-url title=dom-stream-url><code>url</code></dfn> attribute
+ must return a <span title=fileURN>File URN</span> representing the
+ stream. <a href=#refsFILEAPI>[FILEAPI]</a></p>
+
+ <p>For audio and video streams, the stream must be in a format
+ supported by the user agent for use in <code><a href=#audio>audio</a></code> and
+ <code><a href=#video>video</a></code> elements.</p>
+
+ <p class=XXX>This will be pinned down to a specific codec.</p>
+
+ <p>When the <dfn id=dom-stream-record title=dom-stream-record><code>record()</code></dfn> method is
+ invoked, the user agent must return a new
+ <code><a href=#streamrecorder>StreamRecorder</a></code> object associated with the stream.</p>
+
+ <pre class=idl>interface <dfn id=streamrecorder>StreamRecorder</dfn> {
+ <span>File</span> <a href=#dom-streamrecorder-stop title=dom-StreamRecorder-stop>stop</a>();
+};</pre>
+
+ <p>The <dfn id=dom-streamrecorder-stop title=dom-StreamRecorder-stop><code>stop()</code></dfn> method
+ must return a new <code>File</code> object representing the data
+ that was streamed between the creation of the
+ <code><a href=#streamrecorder>StreamRecorder</a></code> object and the invocation of the <code title=dom-StreamRecorder-stop><a href=#dom-streamrecorder-stop>stop()</a></code> method. <a href=#refsFILEAPI>[FILEAPI]</a></p>
+
+ <p>For audio and video streams, the file must be in a format
+ supported by the user agent for use in <code><a href=#audio>audio</a></code> and
+ <code><a href=#video>video</a></code> elements.</p>
+
+ <p class=XXX>This again will be pinned down to a specific codec.</p>
+
+
+ <h5 id=peer-to-peer-connections><span class=secno>4.11.6.2 </span>Peer-to-peer connections</h5>
+
+ <p class=XXX>This section will be moved to a more appropriate
+ location in due course; it is here currently to keep it near the
+ <code><a href=#devices>device</a></code> element to allow reviewers to look at it.</p>
+
+ <pre class=idl>[Constructor(in DOMString serverConfiguration)]
+interface <dfn id=connectionpeer>ConnectionPeer</dfn> {
+ void sendText(in DOMString text);
+ attribute <a href=#function>Function</a> ontext; // receiving
+
+ void sendBitmap(in HTMLImageElement image);
+ attribute <a href=#function>Function</a> onbitmap; // receiving
+
+ void sendFile(in File file);
+ attribute <a href=#function>Function</a> onfile; // receiving
+
+ void addStream(in Stream stream);
+ void removeStream(in Stream stream);
+ readonly attribute Stream[] localStreams;
+ readonly attribute Stream[] remoteStreams;
+ attribute <a href=#function>Function</a> onstream; // receiving
+
+ void <span title=dom-ConnectionPeer-getLocalConfiguration>getLocalConfiguration</span>(in <a href=#connectionpeerconfigurationcallback>ConnectionPeerConfigurationCallback</a> callback); // maybe this should be in the constructor
+ void <span title=dom-ConnectionPeer-addRemoteConfiguration>addRemoteConfiguration</span>(in DOMString configuration);
+ void close(); // disconnects and stops listening
+
+ attribute <a href=#function>Function</a> onconnect;
+ attribute <a href=#function>Function</a> onerror;
+ attribute <a href=#function>Function</a> ondisconnect;
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id=connectionpeerconfigurationcallback>ConnectionPeerConfigurationCallback</dfn> {
+ void <span title=dom-ConnectionPeerConfigurationCallback-handleEvent>handleEvent</span>(in <a href=#connectionpeer>ConnectionPeer</a> server, in DOMString configuration);
+};</pre>
+
+ <p class=XXX>...</p>
+
+ <div class=XXX>
+
+ <p>This relies on some currently hypothetical other standard to
+ define:</p>
+
+ <ul><li>The format of server configuration strings.
+ <li>The format of client configuration strings.
+ <li>The protocols that clients use to talk to third-party servers mentioned in the server configuration strings.
+ <li>The protocols that clients use to talk to each other.
+ </ul></div>
+
+ <div class=example>
+
+ <p>When two peers decide they are going to set up a connection to
+ each other, they both go through these steps. The serverConfig
+ comes from a third-party server they can use to get things like
+ their public IP address or to set up NAT traversal. They also have
+ to send their respective configuration to each other using the same
+ out-of-band mechanism they used to establish that they were going
+ to communicate in the first place.</p>
+
+ <pre>var serverConfig = ...; // configuration string obtained from server
+// contains details such as the IP address of a server that can speak some
+// protocol to help the client determine its public IP address, route packets
+// if necessary, etc.
+
+var local = new ConnectionPeer(serverConfig);
+local.getLocalConfiguration(function (configuration) {
+ if (configuration != '') {
+ ...; // send configuration to other peer using out-of-band mechanism
+ } else {
+ // we've exhausted our options; wait for connection
+ }
+});
+
+function ... (configuration) {
+ // called whenever we get configuration information out-of-band
+ local.addRemoteConfiguration(configuration);
+}
+
+local.onconnect = function (event) {
+ // we are connected!
+ local.sendText('Hello');
+ local.addStream(...); // send video
+ local.onstream = function (event) {
+ // receive video
+ // (videoElement is some &lt;video&gt; element)
+ if (local.remoteStreams.length &gt; 0)
+ videoElement.src = local.remoteStreams[0].url;
+ };
+};</pre>
+
+ </div>
+
+ <p class=warning>To prevent network sniffing from allowing a
+ fourth party to establish a connection to a peer using the
+ information sent out-of-band to the other peer and thus spoofing the
+ client, the configuration information should always be transmitted
+ using an encrypted connection.</p>
+
+
+
+
+
+
+ <h3 id=links><span class=secno>4.12 </span>Links</h3>
+
+
+ <h4 id=hyperlink-elements><span class=secno>4.12.1 </span>Hyperlink elements</h4>
+
+ <p>The <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, and <code><a href=#the-link-element>link</a></code>
+ elements can, in certain situations described in the definitions of
+ those elements, represent <dfn id=hyperlink title=hyperlink>hyperlinks</dfn>.</p>
+
+ <p>The <dfn id=attr-hyperlink-href title=attr-hyperlink-href><code>href</code></dfn>
+ attribute on <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements must have
+ a value that is a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by
+ spaces</a>. This <a href=#url>URL</a> is the <i>destination
+ resource</i> of the hyperlink.</p>
+
+ <p class=note>The <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
+ attribute on <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements is not
+ required; when those elements do not have <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attributes they do not
+ represent hyperlinks.</p>
+
+ <p class=note>The <code title=attr-link-href><a href=#attr-link-href>href</a></code>
+ attribute on the <code><a href=#the-link-element>link</a></code> element <em>is</em> required (and
+ has to be a <a href=#valid-non-empty-url>valid <em>non-empty</em> URL</a>), but whether
+ a <code><a href=#the-link-element>link</a></code> element represents a hyperlink or not depends on
+ the value of the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute of
+ that element.</p>
+
+ <p>The <dfn id=attr-hyperlink-target title=attr-hyperlink-target><code>target</code></dfn>
+ attribute, if present, must be a <a href=#valid-browsing-context-name-or-keyword>valid browsing context name
+ or keyword</a>. It gives the name of the <a href=#browsing-context>browsing
+ context</a> that will be used. <span class=impl>User agents use
+ this name when <a href=#following-hyperlinks>following hyperlinks</a>.</span></p>
+
+<!--PING-->
+ <p>The <dfn id=ping title=attr-hyperlink-ping><code>ping</code></dfn> attribute, if
+ present, gives the URLs of the resources that are interested in
+ being notified if the user follows the hyperlink. The value must be
+ a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a>, each of which must be
+ a <a href=#valid-non-empty-url>valid non-empty URL</a>. <span class=impl>The value is
+ used by the user agent for <a href=#hyperlink-auditing>hyperlink
+ auditing</a>.</span></p>
+<!--PING-->
+
+ <p>For <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements that represent
+ hyperlinks, the relationship between the document containing the
+ hyperlink and the destination resource indicated by the hyperlink is
+ given by the value of the element's <dfn id=attr-hyperlink-rel title=attr-hyperlink-rel><code>rel</code></dfn> attribute, which
+ must be a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a>. The <a href=#linkTypes>allowed values and their meanings</a> are defined
+ below. The <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute has
+ no default value. If the attribute is omitted or if none of the
+ values in the attribute are recognized by the user agent, then the
+ document has no particular relationship with the destination
+ resource other than there being a hyperlink between the two.</p>
+
+ <p>The <dfn id=attr-hyperlink-media title=attr-hyperlink-media><code>media</code></dfn>
+ attribute describes for which media the target document was
+ designed. It is purely advisory. The value must be a <a href=#valid-media-query>valid
+ media query</a>. The default, if the <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code> attribute is omitted, is
+ "<code title="">all</code>".</p>
+
+ <p>The <dfn id=attr-hyperlink-hreflang title=attr-hyperlink-hreflang><code>hreflang</code></dfn>
+ attribute on hyperlink elements, if present, gives the language of
+ the linked resource. It is purely advisory. The value must be a
+ valid BCP 47 language tag. <a href=#refsBCP47>[BCP47]</a>
+ <span class=impl>User agents must not consider this attribute
+ authoritative &mdash; upon fetching the resource, user agents must
+ use only language information associated with the resource to
+ determine its language, not metadata included in the link to the
+ resource.</span></p>
+
+ <p>The <dfn id=attr-hyperlink-type title=attr-hyperlink-type><code>type</code></dfn>
+ attribute, if present, gives the <a href=#mime-type>MIME type</a> of the
+ linked resource. It is purely advisory. The value must be a
+ <a href=#valid-mime-type>valid MIME type</a>. <span class=impl>User agents must
+ not consider the <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
+ attribute authoritative &mdash; upon fetching the resource, user
+ agents must not use metadata included in the link to the resource to
+ determine its type.</span></p>
+
+
+ <div class=impl>
+
+ <h4 id=following-hyperlinks><span class=secno>4.12.2 </span><dfn>Following hyperlinks</dfn></h4>
+
+ <p>When a user <em>follows a hyperlink</em>, the user agent must
+ <a href=#resolve-a-url title="resolve a url">resolve</a> the <a href=#url>URL</a>
+ given by the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute
+ of that hyperlink, relative to the hyperlink element, and if that is
+ successful, must <a href=#navigate>navigate</a> a <a href=#browsing-context>browsing
+ context</a> to the resulting <a href=#absolute-url>absolute URL</a>. In the
+ case of server-side image maps, the URL of the hyperlink must
+ further have its <var><a href=#hyperlink-suffix>hyperlink suffix</a></var> appended to it.</p>
+
+ <p>If <a href=#resolve-a-url title="resolve a url">resolving</a> the
+ <a href=#url>URL</a> fails, the user agent may report the error to the
+ user in a user-agent-specific manner, may navigate to an error page
+ to report the error, or may ignore the error and do nothing.</p>
+
+ <p>If the user indicated a specific <a href=#browsing-context>browsing context</a>
+ when following the hyperlink, or if the user agent is configured to
+ follow hyperlinks by navigating a particular browsing context, then
+ that must be the <a href=#browsing-context>browsing context</a> that is
+ navigated.</p>
+
+ <p>Otherwise, if the hyperlink element is an <code><a href=#the-a-element>a</a></code> or
+ <code><a href=#the-area-element>area</a></code> element that has a <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, then the
+ <a href=#browsing-context>browsing context</a> that is navigated must be chosen by
+ applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
+ browsing context name</a>, using the value of the <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute as the
+ browsing context name. If these rules result in the creation of a
+ new <a href=#browsing-context>browsing context</a>, it must be navigated with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ <p>Otherwise, if the hyperlink element is a <a href=#rel-sidebar-hyperlink title=rel-sidebar-hyperlink>sidebar hyperlink</a> and the user
+ agent implements a feature that can be considered a secondary
+ browsing context, such a secondary browsing context may be selected
+ as the browsing context to be navigated.</p>
+
+ <p>Otherwise, if the hyperlink element is an <code><a href=#the-a-element>a</a></code> or
+ <code><a href=#the-area-element>area</a></code> element with no <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, but one of
+ the child nodes of <a href=#the-head-element>the <code>head</code> element</a> is a
+ <code><a href=#the-base-element>base</a></code> element with a <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute, then the browsing
+ context that is navigated must be chosen by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules
+ for choosing a browsing context given a browsing context name</a>,
+ using the value of the <code title=attr-base-target><a href=#attr-base-target>target</a></code>
+ attribute of the first such <code><a href=#the-base-element>base</a></code> element as the
+ browsing context name. If these rules result in the creation of a
+ new <a href=#browsing-context>browsing context</a>, it must be navigated with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ <p>Otherwise, the browsing context that must be navigated is the
+ same browsing context as the one which the hyperlink element itself
+ is in.</p>
+
+ <p>The navigation must be done with the <a href=#browsing-context>browsing
+ context</a> that contains the <code><a href=#document>Document</a></code> object with
+ which the hyperlink's element in question is associated as the
+ <a href=#source-browsing-context>source browsing context</a>.</p>
+
+ </div>
+
+
+<!--PING-->
+ <div class=impl>
+
+ <h5 id=hyperlink-auditing><span class=secno>4.12.2.1 </span><dfn>Hyperlink auditing</dfn></h5>
+
+ <p>If an <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code> hyperlink element has a
+ <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute, and the
+ user follows the hyperlink, and the hyperlink's <a href=#url>URL</a> can
+ be <a href=#resolve-a-url title="resolve a url">resolved</a>, relative to the
+ hyperlink element, without failure, then the user agent must take
+ the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute's value,
+ <a href=#split-a-string-on-spaces title="split a string on spaces">split that string on
+ spaces</a>, <a href=#resolve-a-url title="resolve a url">resolve</a> each
+ resulting token relative to the hyperlink element, and then should
+ send a request (as described below) to each of the resulting <a href=#absolute-url title="absolute URL">absolute URLs</a>. (Tokens that fail to
+ resolve are ignored.) This may be done in parallel with the primary
+ request, and is independent of the result of that request.</p>
+
+ <p>User agents should allow the user to adjust this behavior, for
+ example in conjunction with a setting that disables the sending of
+ HTTP <code title=http-referer>Referer</code> (sic) headers. Based
+ on the user's preferences, UAs may either <a href=#ignore>ignore</a> the
+ <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute altogether,
+ or selectively ignore URLs in the list (e.g. ignoring any
+ third-party URLs).</p>
+
+ <p>For URLs that are HTTP URLs, the requests must be performed by
+ <a href=#fetch title=fetch>fetching</a> the specified URLs using the
+ POST method, with an entity body with the <a href=#mime-type>MIME type</a>
+ <code><a href=#text/ping>text/ping</a></code> consisting of the four-character string
+ "<code title="">PING</code>", from the <a href=#origin>origin</a> of the
+ <code><a href=#document>Document</a></code> containing the <a href=#hyperlink>hyperlink</a>. <!--
+ not http-origin privacy sensitive --> All relevant cookie and HTTP
+ authentication headers must be included in the request. Which other
+ headers are required depends on the URLs involved.</p>
+
+ <dl class=switch><dt>If both the <a href="#the-document's-address" title="the document's address">address</a>
+ of the <code><a href=#document>Document</a></code> object containing the hyperlink being
+ audited and the ping URL have the <a href=#same-origin>same origin</a></dt>
+
+ <dd>The request must include a <code title=http-ping-from><a href=#ping-from>Ping-From</a></code> HTTP header with, as its
+ value, the <a href="#the-document's-address" title="the document's address">address</a> of
+ the document containing the hyperlink, and a <code title=http-ping-to><a href=#ping-to>Ping-To</a></code> HTTP header with, as its value,
+ the address of the <a href=#absolute-url>absolute URL</a> of the target of the
+ hyperlink. The request must not include a <code title=http-referer>Referer</code> (sic) HTTP header. <!-- because
+ otherwise it would look like a trustable same-origin POST --></dd>
+
+ <dt>Otherwise, if the origins are different, but the document
+ containing the hyperlink being audited was not retrieved over an
+ encrypted connection</dt>
+
+ <dd>The request must include a <code title=http-referer>Referer</code> (sic) HTTP header with, as its
+ value, the <a href="#the-document's-current-address" title="the document's current address">current
+ address</a> of the document containing the hyperlink, a <code title=http-ping-from><a href=#ping-from>Ping-From</a></code> HTTP header with the same
+ value, and a <code title=http-ping-to><a href=#ping-to>Ping-To</a></code> HTTP header
+ with, as its value, the address of the target of the
+ hyperlink.</dd>
+
+ <dt>Otherwise, the origins are different and the document
+ containing the hyperlink being audited was retrieved over an
+ encrypted connection</dt>
+
+ <dd>The request must include a <code title=http-ping-to><a href=#ping-to>Ping-To</a></code> HTTP header with, as its value,
+ the address of the target of the hyperlink. The request must
+ neither include a <code title=http-referer>Referer</code> (sic)
+ HTTP header nor include a <code title=http-ping-from><a href=#ping-from>Ping-From</a></code> HTTP header.</dd>
+
+ </dl><p class=note>To save bandwidth, implementors might also wish to
+ consider omitting optional headers such as <code>Accept</code> from
+ these requests.</p>
+
+ <p>User agents must, unless otherwise specified by the user, honor
+ the HTTP headers (including, in particular, redirects and HTTP
+ cookie headers), but must ignore any entity bodies returned in the
+ responses. User agents may close the connection prematurely once
+ they start receiving an entity body. <a href=#refsCOOKIES>[COOKIES]</a></p>
+
+ <p>For URLs that are not HTTP URLs, the requests must be performed
+ by <a href=#fetch title=fetch>fetching</a> the specified URL normally,
+ and discarding the results.</p>
+
+ <p>When the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute is
+ present, user agents should clearly indicate to the user that
+ following the hyperlink will also cause secondary requests to be
+ sent in the background, possibly including listing the actual target
+ URLs.</p>
+
+ <p class=example>For example, a visual user agent could include
+ the hostnames of the target ping URLs along with the hyperlink's
+ actual URL in a status bar or tooltip.</p>
+
+ </div>
+
+ <div class=note>
+
+ <p>The <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute is redundant
+ with pre-existing technologies like HTTP redirects and JavaScript
+ in allowing Web pages to track which off-site links are most
+ popular or allowing advertisers to track click-through rates.</p>
+
+ <p>However, the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute
+ provides these advantages to the user over those alternatives:</p>
+
+ <ul><li>It allows the user to see the final target URL
+ unobscured.</li>
+
+ <li>It allows the UA to inform the user about the out-of-band
+ notifications.</li>
+
+ <li>It allows the user to disable the notifications without losing
+ the underlying link functionality.</li>
+
+ <li>It allows the UA to optimize the use of available network
+ bandwidth so that the target page loads faster.</li>
+
+ </ul><p>Thus, while it is possible to track users without this feature,
+ authors are encouraged to use the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute so that the user
+ agent can make the user experience more transparent.</p>
+
+ </div>
+
+ <!-- resolving ping urls happens at audit time, so base URL changes
+ affect the values of ping attributes -->
+<!--PING-->
+
+
+
+ <h4 id=linkTypes><span class=secno>4.12.3 </span>Link types</h4>
+
+ <p>The following table summarizes the link types that are defined by
+ this specification. This table is non-normative; the actual
+ definitions for the link types are given in the next few
+ sections.</p>
+
+ <p>In this section, the term <i>referenced document</i> refers to
+ the resource identified by the element representing the link, and
+ the term <i>current document</i> refers to the resource within
+ which the element representing the link finds itself.</p>
+
+ <div class=impl>
+
+ <p>To determine which link types apply to a <code><a href=#the-link-element>link</a></code>,
+ <code><a href=#the-a-element>a</a></code>, or <code><a href=#the-area-element>area</a></code> element, the element's <code title="">rel</code> attribute must be <a href=#split-a-string-on-spaces title="split a string on
+ spaces">split on spaces</a>. The resulting tokens are the link
+ types that apply to that element.</p>
+
+ </div>
+
+ <p>Except where otherwise specified, a keyword must not be specified
+ more than once per <code title=attr-rel-hyperlink>rel</code>
+ attribute.</p>
+
+ <p>The link types that contain no U+003A COLON characters (:),
+ including all those defined in this specification, are <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> values<span class=impl>, and must be
+ compared as such</span>.</p>
+
+ <p class=example>Thus, <code title="">rel="next"</code> is the
+ same as <code title="">rel="NEXT"</code>.</p>
+
+ <table><thead><tr><th rowspan=2>Link type</th>
+ <th colspan=2>Effect on...</th>
+ <th rowspan=2>Brief description</th>
+ <tr><th><code><a href=#the-link-element>link</a></code></th>
+ <th><code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code></th>
+ <tbody><tr><td><code title=rel-alternate><a href=#link-type-alternate>alternate</a></code></td> <!-- second most used <link rel> value -->
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Gives alternate representations of the current document.</td>
+ <tr><td><code title=rel-archives><a href=#link-type-archives>archives</a></code></td>
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Provides a link to a collection of records, documents, or other materials of historical interest.</td>
+ <tr><td><code title=rel-author><a href=#link-type-author>author</a></code></td>
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Gives a link to the current document's author.</td>
+ <tr><td><code title=rel-bookmark><a href=#link-type-bookmark>bookmark</a></code></td> <!-- fourth most used <a rel> value -->
+ <td><em>not allowed</em></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Gives the permalink for the nearest ancestor section.</td>
+ </tr><!-- (commented out on the assumption that rel=contact is really XFN)
+ <tr>
+ <td><code title="rel-contact">contact</code></td> <!- 8th most used <a rel> value ->
+ <td><span title="hyperlink link">Hyperlink</span></td>
+ <td><span>Hyperlink</span></td>
+ <td>Gives a link to contact information for the current document.</td>
+ </tr>
+--><tr><td><code title=rel-external><a href=#link-type-external>external</a></code></td> <!-- fifth and sixth most used <a rel> value (sixth is "external nofollow") -->
+ <td><em>not allowed</em></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Indicates that the referenced document is not part of the same site as the current document.</td>
+ <tr><td><code title=rel-first><a href=#link-type-first>first</a></code></td>
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Indicates that the current document is a part of a series, and that the first document in the series is the referenced document.</td>
+ <tr><td><code title=rel-help><a href=#link-type-help>help</a></code></td>
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Provides a link to context-sensitive help.</td>
+ <tr><td><code title=rel-icon><a href=#rel-icon>icon</a></code></td> <!-- link rel="shortcut icon" and its ilk are the fourth, sixth, and ninth most used values -->
+ <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
+ <td><em>not allowed</em></td>
+ <td>Imports an icon to represent the current document.</td>
+ <tr><td><code title=rel-index><a href=#link-type-index>index</a></code></td> <!-- used more than "top" and "contents" on <link> (though on <a>, "contents" wins) -->
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Gives a link to the document that provides a table of contents or index listing the current document.</td>
+ <tr><td><code title=rel-last><a href=#link-type-last>last</a></code></td>
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Indicates that the current document is a part of a series, and that the last document in the series is the referenced document.</td>
+ <tr><td><code title=rel-license><a href=#link-type-license>license</a></code></td> <!-- seventh most used <a rel> value -->
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Indicates that the main content of the current document is covered by the copyright license described by the referenced document.</td>
+ <tr><td><code title=rel-next><a href=#link-type-next>next</a></code></td>
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Indicates that the current document is a part of a series, and that the next document in the series is the referenced document.</td>
+ <tr><td><code title=rel-nofollow><a href=#link-type-nofollow>nofollow</a></code></td> <!-- most used <a rel> value (and sixth most used is "external nofollow") -->
+ <td><em>not allowed</em></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Indicates that the current document's original author or publisher does not endorse the referenced document.</td>
+ <tr><td><code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code></td>
+ <td><em>not allowed</em></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Requires that the user agent not send an HTTP <code title=http-referer>Referer</code> (sic) header if the user follows the hyperlink.</td>
+ <tr><td><code title=rel-pingback><a href=#link-type-pingback>pingback</a></code></td>
+ <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
+ <td><em>not allowed</em></td>
+ <td>Gives the address of the pingback server that handles pingbacks to the current document.</td>
+ <tr><td><code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code></td>
+ <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
+ <td><em>not allowed</em></td>
+ <td>Specifies that the target resource should be preemptively cached.</td>
+ <tr><td><code title=rel-prev><a href=#link-type-prev>prev</a></code></td> <!-- prev is used more than previous -->
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document.</td>
+ <tr><td><code title=rel-search><a href=#link-type-search>search</a></code></td> <!-- used quite a bit -->
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Gives a link to a resource that can be used to search through the current document and its related pages.</td>
+ <tr><td><code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code></td> <!-- most commonly used <link rel> value, variants came in 7th, 8th, 12th, 17th... -->
+ <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
+ <td><em>not allowed</em></td>
+ <td>Imports a stylesheet.</td>
+ <tr><td><code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code></td> <!-- used quite a bit -->
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Specifies that the referenced document, if retrieved, is intended to be shown in the browser's sidebar (if it has one).</td>
+ <tr><td><code title=rel-tag><a href=#link-type-tag>tag</a></code></td> <!-- second and third most used <a rel> value (third is technically "category tag"). -->
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Gives a tag (identified by the given address) that applies to the current document.</td>
+ <tr><td><code title=rel-up><a href=#link-type-up>up</a></code></td>
+ <td><a href=#hyperlink-link title="hyperlink link">Hyperlink</a></td>
+ <td><a href=#hyperlink>Hyperlink</a></td>
+ <td>Provides a link to a document giving the context for the current document.</td>
+ </table><div class=impl>
+
+ <p>Some of the types described below list synonyms for these
+ values. These <!--<span class="impl">-->are to be handled as
+ specified by user agents, but<!--</span>--> must not be used in
+ documents.</p>
+
+ </div>
+
+ <!-- v2 ideas:
+ * rel="script"
+ * rel="related" // see also
+ * http://microformats.org/wiki/rel-enclosure
+ -->
+
+
+ <h5 id=link-type-alternate><span class=secno>4.12.3.1 </span>Link type "<dfn title=rel-alternate><code>alternate</code></dfn>"</h5>
+
+ <p>The <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword may be
+ used with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements.</p>
+
+ <p>The meaning of this keyword depends on the values of the other
+ attributes.</p>
+
+ <dl class=switch><dt>If the element is a <code><a href=#the-link-element>link</a></code> element and the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute also contains the
+ keyword <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code></dt>
+
+ <dd>
+
+ <p>The <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword
+ modifies the meaning of the <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword in the way
+ described for that keyword. The <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword does not create a
+ link of its own.</p>
+
+ </dd>
+
+
+ <dt>The <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword is
+ used with the <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
+ attribute set to the value <code title="">application/rss+xml</code> or the value <code title="">application/atom+xml</code></dt>
+
+ <dd>
+
+ <p>The link is a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>
+ referencing a syndication feed (though not necessarily syndicating
+ exactly the same content as the current page).</p>
+
+ <div class=impl>
+
+ <p>The first <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, or <code><a href=#the-area-element>area</a></code>
+ element in the document (in tree order) with the <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword used with the <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attribute set to the value
+ <code title="">application/rss+xml</code> or the value <code title="">application/atom+xml</code> must be treated as the default
+ syndication feed for the purposes of feed autodiscovery.</p>
+
+ <div class=example>
+ <p>The following <code><a href=#the-link-element>link</a></code> element gives the syndication
+ feed for the current page:</p>
+ <pre>&lt;link rel="alternate" type="application/atom+xml" href="data.xml"&gt;</pre>
+ <p>The following extract offers various different syndication
+ feeds:</p>
+ <pre>&lt;p&gt;You can access the planets database using Atom feeds:&lt;/p&gt;
+&lt;ul&gt;
+ &lt;li&gt;&lt;a href="recently-visited-planets.xml" rel="alternate" type="application/atom+xml"&gt;Recently Visited Planets&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="known-bad-planets.xml" rel="alternate" type="application/atom+xml"&gt;Known Bad Planets&lt;/a&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;a href="unexplored-planets.xml" rel="alternate" type="application/atom+xml"&gt;Unexplored Planets&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;</pre>
+ </div>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>The link is a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>
+ referencing an alternate representation of the current
+ document.</p>
+
+ <p>The nature of the referenced document is given by the <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes.</p>
+
+ <p>If the <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword is
+ used with the <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>
+ attribute, it indicates that the referenced document is intended for
+ use with the media specified.</p>
+
+ <p>If the <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword is
+ used with the <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>
+ attribute, and that attribute's value differs from the <a href=#root-element>root
+ element</a>'s <a href=#language>language</a>, it indicates that the
+ referenced document is a translation.</p>
+
+ <p>If the <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword is
+ used with the <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
+ attribute, it indicates that the referenced document is a
+ reformulation of the current document in the specified format.</p>
+
+ <p>The <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes can be combined
+ when specified with the <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code>
+ keyword.</p>
+
+ <div class=example>
+
+ <p>For example, the following link is a French translation that
+ uses the PDF format:</p>
+
+ <pre>&lt;link rel=alternate type=application/pdf hreflang=fr href=manual-fr&gt;</pre>
+
+ </div>
+
+ <p>This relationship is transitive &mdash; that is, if a document
+ links to two other documents with the link type "<code title=rel-alternate><a href=#link-type-alternate>alternate</a></code>", then, in addition to
+ implying that those documents are alternative representations of
+ the first document, it is also implying that those two documents
+ are alternative representations of each other.</p>
+
+ </dd>
+
+ </dl><h5 id=link-type-archives><span class=secno>4.12.3.2 </span>Link type "<dfn title=rel-archives><code>archives</code></dfn>"</h5>
+
+ <p>The <code title=rel-archives><a href=#link-type-archives>archives</a></code> keyword may be
+ used with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-archives><a href=#link-type-archives>archives</a></code> keyword indicates
+ that the referenced document describes a collection of records,
+ documents, or other materials of historical interest.</p>
+
+ <p class=example>A blog's index page could link to an index of the
+ blog's past posts with <code title="">rel="archives"</code>.</p>
+
+ <div class=impl>
+
+ <p><strong>Synonyms</strong>: For historical reasons, user agents
+ must also treat the keyword "<code title="">archive</code>" like the
+ <code title=rel-archives><a href=#link-type-archives>archives</a></code> keyword.</p>
+
+ </div>
+
+
+ <h5 id=link-type-author><span class=secno>4.12.3.3 </span>Link type "<dfn title=rel-author><code>author</code></dfn>"</h5>
+
+ <p>The <code title=rel-author><a href=#link-type-author>author</a></code> keyword may be
+ used with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>For <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements, the <code title=rel-author><a href=#link-type-author>author</a></code> keyword indicates that the
+ referenced document provides further information about the author of
+ the nearest <code><a href=#the-article-element>article</a></code> element ancestor of the element
+ defining the hyperlink, if there is one, or of the page as a whole,
+ otherwise.</p>
+
+ <p>For <code><a href=#the-link-element>link</a></code> elements, the <code title=rel-author><a href=#link-type-author>author</a></code> keyword indicates that the
+ referenced document provides further information about the author
+ for the page as a whole.</p>
+
+ <p class=note>The "referenced document" can be, and often is, a
+ <code title="">mailto:</code> URL giving the e-mail address of the
+ author. <a href=#refsMAILTO>[MAILTO]</a></p>
+
+ <div class=impl>
+
+ <p><strong>Synonyms</strong>: For historical reasons, user agents
+ must also treat <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and
+ <code><a href=#the-area-element>area</a></code> elements that have a <code title="">rev</code>
+ attribute with the value "<code>made</code>" as having the <code title=rel-author><a href=#link-type-author>author</a></code> keyword specified as a link
+ relationship.</p>
+
+ </div>
+
+
+ <h5 id=link-type-bookmark><span class=secno>4.12.3.4 </span>Link type "<dfn title=rel-bookmark><code>bookmark</code></dfn>"</h5>
+
+ <p>The <code title=rel-bookmark><a href=#link-type-bookmark>bookmark</a></code> keyword may be
+ used with <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements.</p>
+
+ <p>The <code title=rel-bookmark><a href=#link-type-bookmark>bookmark</a></code> keyword gives a
+ permalink for the nearest ancestor <code><a href=#the-article-element>article</a></code> element of
+ the linking element in question, or of <a href=#associatedSection>the section the linking element is most
+ closely associated with</a>, if there are no ancestor
+ <code><a href=#the-article-element>article</a></code> elements.</p>
+
+ <div class=example>
+ <p>The following snippet has three permalinks. A user agent could
+ determine which permalink applies to which part of the spec by
+ looking at where the permalinks are given.</p>
+ <pre> ...
+ &lt;body&gt;
+ &lt;h1&gt;Example of permalinks&lt;/h1&gt;
+ &lt;div id="a"&gt;
+ &lt;h2&gt;First example&lt;/h2&gt;
+ &lt;p&gt;&lt;a href="a.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
+ only the content from the first H2 to the second H2. The DIV isn't
+ exactly that section, but it roughly corresponds to it.&lt;/p&gt;
+ &lt;/div&gt;
+ &lt;h2&gt;Second example&lt;/h2&gt;
+ &lt;article id="b"&gt;
+ &lt;p&gt;&lt;a href="b.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
+ the outer ARTICLE element (which could be, e.g., a blog post).&lt;/p&gt;
+ &lt;article id="c"&gt;
+ &lt;p&gt;&lt;a href="c.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
+ the inner ARTICLE element (which could be, e.g., a blog comment).&lt;/p&gt;
+ &lt;/article&gt;
+ &lt;/article&gt;
+ &lt;/body&gt;
+ ...</pre>
+ </div>
+
+<!-- (commented out on the assumption that rel=contact is really XFN)
+ <h5>Link type "<dfn title="rel-contact"><code>contact</code></dfn>"</h5>
+
+ <p>The <code title="rel-contact">contact</code> keyword may be used
+ with <code>link</code>, <code>a</code>, and <code>area</code>
+ elements. For <code>link</code> elements, it creates a <span
+ title="hyperlink link">hyperlink</span>.</p>
+
+ <p>For <code>a</code> and <code>area</code> elements, the <code
+ title="rel-contact">contact</code> keyword indicates that the
+ referenced document provides further contact information for the
+ author of the nearest <code>article</code> element ancestor of the
+ element defining the hyperlink, if there is one, or of the page as a
+ whole, otherwise.</p>
+
+ <div class="impl">
+
+ <p>User agents must treat any hyperlink in an <code>address</code>
+ element as having the <code title="rel-contact">contact</code> link
+ type specified.</p>
+
+ </div>
+
+ <p>For <code>link</code> elements, the <code
+ title="rel-contact">contact</code> keyword indicates that the
+ referenced document provides further contact information for the
+ page as a whole.</p>
+-->
+
+
+ <h5 id=link-type-external><span class=secno>4.12.3.5 </span>Link type "<dfn title=rel-external><code>external</code></dfn>"</h5>
+
+ <p>The <code title=rel-external><a href=#link-type-external>external</a></code> keyword may be
+ used with <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements.</p>
+
+ <p>The <code title=rel-external><a href=#link-type-external>external</a></code> keyword indicates
+ that the link is leading to a document that is not part of the site
+ that the current document forms a part of.</p>
+
+
+ <h5 id=link-type-help><span class=secno>4.12.3.6 </span>Link type "<dfn title=rel-help><code>help</code></dfn>"</h5>
+
+ <p>The <code title=rel-help><a href=#link-type-help>help</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>For <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements, the <code title=rel-help><a href=#link-type-help>help</a></code> keyword indicates that the referenced
+ document provides further help information for the parent of the
+ element defining the hyperlink, and its children.</p>
+
+ <div class=example>
+
+ <p>In the following example, the form control has associated
+ context-sensitive help. The user agent could use this information,
+ for example, displaying the referenced document if the user presses
+ the "Help" or "F1" key.</p>
+
+ <pre> &lt;p&gt;&lt;label&gt; Topic: &lt;input name=topic&gt; &lt;a href="help/topic.html" rel="help"&gt;(Help)&lt;/a&gt;&lt;/label&gt;&lt;/p&gt;</pre>
+
+ </div>
+
+ <p>For <code><a href=#the-link-element>link</a></code> elements, the <code title=rel-help><a href=#link-type-help>help</a></code> keyword indicates that the referenced
+ document provides help for the page as a whole.</p>
+
+
+ <h5 id=rel-icon><span class=secno>4.12.3.7 </span>Link type "<dfn title=rel-icon><code>icon</code></dfn>"</h5>
+
+ <p>The <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code> elements, for which it creates an <a href=#external-resource-link title="external resource link">external resource link</a>.</p>
+
+ <div class=impl>
+
+ <p>The specified resource is an icon representing the page or site,
+ and should be used by the user agent when representing the page in
+ the user interface.</p>
+
+ </div>
+
+ <p>Icons could be auditory icons, visual icons, or other kinds of
+ icons. <span class=impl>If multiple icons are provided, the user
+ agent must select the most appropriate icon according to the <code title=attr-link-type><a href=#attr-link-type>type</a></code>, <code title=attr-link-media><a href=#attr-link-media>media</a></code>, and <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> attributes. If there are
+ multiple equally appropriate icons, user agents must use the last
+ one declared in <a href=#tree-order>tree order</a>. If the user agent tries to
+ use an icon but that icon is determined, upon closer examination, to
+ in fact be inappropriate (e.g. because it uses an unsupported
+ format), then the user agent must try the next-most-appropriate icon
+ as determined by the attributes.</span></p>
+
+ <div class=impl>
+
+ <p>There is no default type for resources given by the <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword. However, for the purposes of
+ <a href=#concept-link-type-sniffing>determining the type of the
+ resource</a>, user agents must expect the resource to be an image.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-link-sizes title=attr-link-sizes><code>sizes</code></dfn>
+ attribute gives the sizes of icons for visual media.</p>
+
+ <p>If specified, the attribute must have a value that is an
+ <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a>. The
+ values must all be either <code title=attr-link-sizes-any><a href=#attr-link-sizes-any>any</a></code> or a value that consists of
+ two <a href=#valid-non-negative-integer title="valid non-negative integer">valid non-negative
+ integers</a> that do not have a leading U+0030 DIGIT ZERO (0)
+ character and that are separated by a single U+0078 LATIN SMALL
+ LETTER X character (x).</p>
+
+ <p>The keywords represent icon sizes.</p>
+
+ <div class=impl>
+
+ <p>To parse and process the attribute's value, the user agent must
+ first <a href=#split-a-string-on-spaces title="split a string on spaces">split the attribute's
+ value on spaces</a>, and must then parse each resulting keyword
+ to determine what it represents.</p>
+
+ </div>
+
+ <p>The <dfn id=attr-link-sizes-any title=attr-link-sizes-any><code>any</code></dfn> keyword
+ represents that the resource contains a scalable icon, e.g. as
+ provided by an SVG image.</p>
+
+ <div class=impl>
+
+ <p>Other keywords must be further parsed as follows to determine
+ what they represent:</p>
+
+ <ul><li><p>If the keyword doesn't contain exactly one U+0078 LATIN
+ SMALL LETTER X character (x), then this keyword doesn't represent
+ anything. Abort these steps for that keyword.</li>
+
+ <li><p>Let <var title="">width string</var> be the string before
+ the "<code title="">x</code>".</li>
+
+ <li><p>Let <var title="">height string</var> be the string after the
+ "<code title="">x</code>".</li>
+
+ <li><p>If either <var title="">width string</var> or <var title="">height string</var> start with a U+0030 DIGIT ZERO (0)
+ character or contain any characters other than characters in the
+ range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then this
+ keyword doesn't represent anything. Abort these steps for that
+ keyword.</li>
+
+ <li><p>Apply the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a> to <var title="">width string</var> to obtain <var title="">width</var>.</li>
+
+ <li><p>Apply the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a> to <var title="">height string</var> to obtain <var title="">height</var>.</li>
+
+ <li><p>The keyword represents that the resource contains a bitmap
+ icon with a width of <var title="">width</var> device pixels and a
+ height of <var title="">height</var> device pixels.</li>
+
+ </ul></div>
+
+ <p>The keywords specified on the <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> attribute must not represent
+ icon sizes that are not actually available in the linked
+ resource.</p>
+
+ <div class=impl>
+
+ <p>If the attribute is not specified, then the user agent must
+ assume that the given icon is appropriate, but less appropriate than
+ an icon of a known and appropriate size.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following snippet shows the top part of an application with
+ several icons.</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;lsForums &mdash; Inbox&lt;/title&gt;
+ &lt;link rel=icon href=favicon.png sizes="16x16" type="image/png"&gt;
+ &lt;link rel=icon href=windows.ico sizes="32x32 48x48" type="image/vnd.microsoft.icon"&gt;
+ &lt;link rel=icon href=mac.icns sizes="128x128 512x512 8192x8192 32768x32768"&gt;
+ &lt;link rel=icon href=iphone.png sizes="59x60" type="image/png"&gt;
+ &lt;link rel=icon href=gnome.svg sizes="any" type="image/svg+xml"&gt;
+ &lt;link rel=stylesheet href=lsforums.css&gt;
+ &lt;script src=lsforums.js&gt;&lt;/script&gt;
+ &lt;meta name=application-name content="lsForums"&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ ...</pre>
+
+ </div>
+
+
+ <h5 id=link-type-license><span class=secno>4.12.3.8 </span>Link type "<dfn title=rel-license><code>license</code></dfn>"</h5>
+
+ <p>The <code title=rel-license><a href=#link-type-license>license</a></code> keyword may be used
+ with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-license><a href=#link-type-license>license</a></code> keyword indicates
+ that the referenced document provides the copyright license terms
+ under which the main content of the current document is
+ provided.</p>
+
+ <p>This specification does not specify how to distinguish between
+ the main content of a document and content that is not deemed to be
+ part of that main content. The distinction should be made clear to
+ the user.</p>
+
+ <div class=example>
+
+ <p>Consider a photo sharing site. A page on that site might
+ describe and show a photograph, and the page might be marked up as
+ follows:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Exampl Pictures: Kissat&lt;/title&gt;
+ &lt;link rel="stylesheet" href="/style/default"&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;h1&gt;Kissat&lt;/h1&gt;
+ &lt;nav&gt;
+ &lt;a href="../"&gt;Return to photo index&lt;/a&gt;
+ &lt;/nav&gt;
+ &lt;figure&gt;
+ &lt;img src="/pix/39627052_fd8dcd98b5.jpg"&gt;
+ &lt;figcaption&gt;Kissat&lt;/figcaption&gt;
+ &lt;/figure&gt;
+ &lt;p&gt;One of them has six toes!&lt;/p&gt;
+ &lt;p&gt;&lt;small&gt;&lt;a rel="license" href="http://www.opensource.org/licenses/mit-license.php"&gt;MIT Licensed&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;a href="/"&gt;Home&lt;/a&gt; | &lt;a href="../"&gt;Photo index&lt;/a&gt;
+ &lt;p&gt;&lt;small&gt;&copy; copyright 2009 Exampl Pictures. All Rights Reserved.&lt;/small&gt;&lt;/p&gt;
+ &lt;/footer&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>In this case the <code title=rel-license><a href=#link-type-license>license</a></code>
+ applies to just the photo (the main content of the document), not
+ the whole document. In particular not the design of the page
+ itself, which is covered by the copyright given at the bottom of
+ the document. This could be made clearer in the styling
+ (e.g. making the license link prominently positioned near the
+ photograph, while having the page copyright in light small text at
+ the foot of the page.</p>
+
+ </div>
+
+ <div class=impl>
+
+ <p><strong>Synonyms</strong>: For historical reasons, user agents
+ must also treat the keyword "<code title="">copyright</code>" like
+ the <code title=rel-license><a href=#link-type-license>license</a></code> keyword.</p>
+
+ </div>
+
+
+ <h5 id=link-type-nofollow><span class=secno>4.12.3.9 </span>Link type "<dfn title=rel-nofollow><code>nofollow</code></dfn>"</h5>
+
+ <p>The <code title=rel-nofollow><a href=#link-type-nofollow>nofollow</a></code> keyword may be
+ used with <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements.</p>
+
+ <p>The <code title=rel-nofollow><a href=#link-type-nofollow>nofollow</a></code> keyword indicates
+ that the link is not endorsed by the original author or publisher of
+ the page, or that the link to the referenced document was included
+ primarily because of a commercial relationship between people
+ affiliated with the two pages.</p>
+
+
+ <h5 id=link-type-noreferrer><span class=secno>4.12.3.10 </span>Link type "<dfn title=rel-noreferrer><code>noreferrer</code></dfn>"</h5>
+
+ <p>The <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword may be
+ used with <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements.</p>
+
+ <p>It indicates that no referrer information is to be leaked when
+ following the link.</p>
+
+ <div class=impl>
+
+ <p>If a user agent follows a link defined by an <code><a href=#the-a-element>a</a></code> or
+ <code><a href=#the-area-element>area</a></code> element that has the <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword, the user agent
+ must not include a <code title=http-referer>Referer</code> (sic)
+ HTTP header (<a href=#concept-http-equivalent-headers title=concept-http-equivalent-headers>or
+ equivalent</a> for other protocols) in the request.</p>
+
+ <p>This keyword also <a href=#noopener>causes the <code title=dom-opener>opener</code> attribute to remain null</a> if the
+ hyperlink creates a new <a href=#browsing-context>browsing context</a>.</p>
+
+ </div>
+
+ <!-- v2: Would be nice to apply this to other elements too,
+ e.g. letting <img> or CSS or <video> hide the referrer -->
+
+
+ <h5 id=link-type-pingback><span class=secno>4.12.3.11 </span>Link type "<dfn title=rel-pingback><code>pingback</code></dfn>"</h5>
+
+ <p>The <code title=rel-pingback><a href=#link-type-pingback>pingback</a></code> keyword may be
+ used with <code><a href=#the-link-element>link</a></code> elements, for which it creates an <a href=#external-resource-link title="external resource link">external resource link</a>.</p>
+
+ <p>For the semantics of the <code title=rel-pingback><a href=#link-type-pingback>pingback</a></code> keyword, see the Pingback 1.0
+ specification. <a href=#refsPINGBACK>[PINGBACK]</a></p>
+
+
+ <h5 id=link-type-prefetch><span class=secno>4.12.3.12 </span>Link type "<dfn title=rel-prefetch><code>prefetch</code></dfn>"</h5>
+
+ <p>The <code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code> keyword may be
+ used with <code><a href=#the-link-element>link</a></code> elements, for which it creates an <a href=#external-resource-link title="external resource link">external resource link</a>.</p>
+
+ <p>The <code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code> keyword indicates
+ that preemptively fetching and caching the specified resource is
+ likely to be beneficial, as it is highly likely that the user will
+ require this resource.</p>
+
+ <p>There is no default type for resources given by the <code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code> keyword.</p>
+
+
+ <h5 id=link-type-search><span class=secno>4.12.3.13 </span>Link type "<dfn title=rel-search><code>search</code></dfn>"</h5>
+
+ <p>The <code title=rel-search><a href=#link-type-search>search</a></code> keyword may be used
+ with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-search><a href=#link-type-search>search</a></code> keyword indicates that
+ the referenced document provides an interface specifically for
+ searching the document and its related resources.</p>
+
+ <p class=note>OpenSearch description documents can be used with
+ <code><a href=#the-link-element>link</a></code> elements and the <code title=rel-search><a href=#link-type-search>search</a></code> link type to enable user agents to
+ autodiscover search interfaces. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></p>
+
+
+ <h5 id=link-type-stylesheet><span class=secno>4.12.3.14 </span>Link type "<dfn title=rel-stylesheet><code>stylesheet</code></dfn>"</h5>
+
+ <p>The <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword may be
+ used with <code><a href=#the-link-element>link</a></code> elements, for which it creates an <a href=#external-resource-link title="external resource link">external resource link</a> that
+ contributes to the <a href=#styling>styling processing model</a>.</p>
+
+ <p>The specified resource is a resource that describes how to
+ present the document. Exactly how the resource is to be processed
+ depends on the actual type of the resource.</p>
+
+ <p>If the <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> keyword is
+ also specified on the <code><a href=#the-link-element>link</a></code> element, then <dfn id=the-link-is-an-alternative-stylesheet>the link
+ is an alternative stylesheet</dfn>; in this case, the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute must be specified on the
+ <code><a href=#the-link-element>link</a></code> element, with a non-empty value.</p>
+
+ <p>The default type for resources given by the <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword is <code title="">text/css</code>.</p>
+
+ <div class=impl>
+
+ <p><strong>Quirk</strong>: If the document has been set to
+ <a href=#quirks-mode>quirks mode</a> and the <a href=#content-type title=Content-Type>Content-Type metadata</a> of the external
+ resource is not a supported style sheet type, the user agent must
+ instead assume it to be <code title="">text/css</code>.</p>
+
+ </div>
+
+
+ <h5 id=link-type-sidebar><span class=secno>4.12.3.15 </span>Link type "<dfn title=rel-sidebar><code>sidebar</code></dfn>"</h5>
+
+ <p>The <code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code> keyword may be used
+ with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code> keyword indicates
+ that the referenced document, if retrieved, is intended to be shown
+ in a <a href=#secondary-browsing-context>secondary browsing context</a> (if possible), instead
+ of in the current <a href=#browsing-context>browsing context</a>.</p>
+
+ <p>A <a href=#hyperlink title=hyperlink>hyperlink element</a> with the <code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code> keyword specified is a <dfn id=rel-sidebar-hyperlink title=rel-sidebar-hyperlink>sidebar hyperlink</dfn>.</p>
+
+
+ <h5 id=link-type-tag><span class=secno>4.12.3.16 </span>Link type "<dfn title=rel-tag><code>tag</code></dfn>"</h5>
+
+ <p>The <code title=rel-tag><a href=#link-type-tag>tag</a></code> keyword may be used
+ with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-tag><a href=#link-type-tag>tag</a></code> keyword indicates that the
+ <em>tag</em> that the referenced document represents applies to the
+ current document.</p>
+
+ <p class=note>Since it indicates that the tag <em>applies to the
+ current document</em>, it would be inappropriate to use this keyword
+ in the markup of a <a href=#tag-cloud>tag cloud</a>, which lists
+ the popular tag across a set of pages.</p>
+
+
+ <h5 id=hierarchical-link-types><span class=secno>4.12.3.17 </span>Hierarchical link types</h5>
+
+ <p>Some documents form part of a hierarchical structure of
+ documents.</p>
+
+ <p>A hierarchical structure of documents is one where each document
+ can have various subdocuments. The document of which a document is a
+ subdocument is said to be the document's <em>parent</em>. A document
+ with no parent forms the top of the hierarchy.</p>
+
+ <p>A document may be part of multiple hierarchies.</p>
+
+
+ <h6 id=link-type-index><span class=secno>4.12.3.17.1 </span>Link type "<dfn title=rel-index><code>index</code></dfn>"</h6>
+
+ <p>The <code title=rel-index><a href=#link-type-index>index</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-index><a href=#link-type-index>index</a></code> keyword indicates that
+ the document is part of a hierarchical structure, and that the link
+ is leading to the document that is the top of the hierarchy. It
+ conveys more information when used with the <code title=rel-up><a href=#link-type-up>up</a></code> keyword (q.v.).</p>
+
+ <div class=impl>
+
+ <p><strong>Synonyms</strong>: For historical reasons, user agents
+ must also treat the keywords "<code title="">top</code>", "<code title="">contents</code>", and "<code title="">toc</code>" like the
+ <code title=rel-index><a href=#link-type-index>index</a></code> keyword.</p>
+
+ </div>
+
+
+ <h6 id=link-type-up><span class=secno>4.12.3.17.2 </span>Link type "<dfn title=rel-up><code>up</code></dfn>"</h6>
+
+ <p>The <code title=rel-up><a href=#link-type-up>up</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-up><a href=#link-type-up>up</a></code> keyword indicates that the
+ document is part of a hierarchical structure, and that the link is
+ leading to a document that is an ancestor of the current
+ document.</p>
+
+ <p>The <code title=rel-up><a href=#link-type-up>up</a></code> keyword may be repeated within
+ a <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute to indicate
+ the hierarchical distance from the current document to the
+ referenced document. If it occurs only once, then the link is
+ leading to the current document's parent; each additional occurrence
+ of the keyword represents one further level. If the <code title=rel-index><a href=#link-type-index>index</a></code> keyword is also present, then the
+ number of <code title=rel-up><a href=#link-type-up>up</a></code> keywords is the depth of
+ the current page relative to the top of the hierarchy. Only one link
+ is created for the set of one or more <code title=rel-up><a href=#link-type-up>up</a></code>
+ keywords and, if present, the <code title=rel-index><a href=#link-type-index>index</a></code>
+ keyword.</p>
+
+ <p>If the page is part of multiple hierarchies, then they should be
+ described in different <a href=#paragraph title=paragraph>paragraphs</a>. <span class=impl>User agents
+ must scope any interpretation of the <code title=rel-up><a href=#link-type-up>up</a></code>
+ and <code title=rel-index><a href=#link-type-index>index</a></code> keywords together
+ indicating the depth of the hierarchy to the <a href=#paragraph>paragraph</a>
+ in which the link finds itself, if any, or to the document
+ otherwise.</span></p>
+
+ <div class=impl>
+
+ <p>When two links have both the <code title=rel-up><a href=#link-type-up>up</a></code> and
+ <code title=rel-index><a href=#link-type-index>index</a></code> keywords specified together in
+ the same scope and contradict each other by having a different
+ number of <code title=rel-up><a href=#link-type-up>up</a></code> keywords, the link with the
+ greater number of <code title=rel-up><a href=#link-type-up>up</a></code> keywords must be
+ taken as giving the depth of the document.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This can be used to mark up a navigation style sometimes known
+ as bread crumbs. In the following example, the current page can be
+ reached via two paths.</p>
+
+ <pre>&lt;nav&gt;
+ &lt;p&gt;
+ &lt;a href="/" rel="index up up up"&gt;Main&lt;/a&gt; &gt;
+ &lt;a href="/products/" rel="up up"&gt;Products&lt;/a&gt; &gt;
+ &lt;a href="/products/dishwashers/" rel="up"&gt;Dishwashers&lt;/a&gt; &gt;
+ &lt;a&gt;Second hand&lt;/a&gt;
+ &lt;/p&gt;
+ &lt;p&gt;
+ &lt;a href="/" rel="index up up"&gt;Main&lt;/a&gt; &gt;
+ &lt;a href="/second-hand/" rel="up"&gt;Second hand&lt;/a&gt; &gt;
+ &lt;a&gt;Dishwashers&lt;/a&gt;
+ &lt;/p&gt;
+&lt;/nav&gt;</pre>
+
+ </div>
+
+ <p class=note>The <code title=dom-a-relList><a href=#dom-a-rellist>relList</a></code> IDL
+ attribute (e.g. on the <code><a href=#the-a-element>a</a></code> element) does not currently
+ represent multiple <code title=rel-up><a href=#link-type-up>up</a></code> keywords (the
+ interface hides duplicates).</p>
+
+
+ <h5 id=sequential-link-types><span class=secno>4.12.3.18 </span>Sequential link types</h5>
+
+ <p>Some documents form part of a sequence of documents.</p>
+
+ <p>A sequence of documents is one where each document can have a
+ <em>previous sibling</em> and a <em>next sibling</em>. A document
+ with no previous sibling is the start of its sequence, a document
+ with no next sibling is the end of its sequence.</p>
+
+ <p>A document may be part of multiple sequences.</p>
+
+
+ <h6 id=link-type-first><span class=secno>4.12.3.18.1 </span>Link type "<dfn title=rel-first><code>first</code></dfn>"</h6>
+
+ <p>The <code title=rel-first><a href=#link-type-first>first</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-first><a href=#link-type-first>first</a></code> keyword indicates that
+ the document is part of a sequence, and that the link is leading to
+ the document that is the first logical document in the sequence.</p>
+
+ <div class=impl>
+
+ <p><strong>Synonyms</strong>: For historical reasons, user agents
+ must also treat the keywords "<code title="">begin</code>" and
+ "<code title="">start</code>" like the <code title=rel-first><a href=#link-type-first>first</a></code> keyword.</p>
+
+ </div>
+
+
+ <h6 id=link-type-last><span class=secno>4.12.3.18.2 </span>Link type "<dfn title=rel-last><code>last</code></dfn>"</h6>
+
+ <p>The <code title=rel-last><a href=#link-type-last>last</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-last><a href=#link-type-last>last</a></code> keyword indicates that the
+ document is part of a sequence, and that the link is leading to the
+ document that is the last logical document in the sequence.</p>
+
+ <div class=impl>
+
+ <p><strong>Synonyms</strong>: For historical reasons, user agents
+ must also treat the keyword "<code title="">end</code>" like the
+ <code title=rel-last><a href=#link-type-last>last</a></code> keyword.</p>
+
+ </div>
+
+
+ <h6 id=link-type-next><span class=secno>4.12.3.18.3 </span>Link type "<dfn title=rel-next><code>next</code></dfn>"</h6>
+
+ <p>The <code title=rel-next><a href=#link-type-next>next</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-next><a href=#link-type-next>next</a></code> keyword indicates that the
+ document is part of a sequence, and that the link is leading to the
+ document that is the next logical document in the sequence.</p>
+
+
+ <h6 id=link-type-prev><span class=secno>4.12.3.18.4 </span>Link type "<dfn title=rel-prev><code>prev</code></dfn>"</h6>
+
+ <p>The <code title=rel-prev><a href=#link-type-prev>prev</a></code> keyword may be used with
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
+ elements. For <code><a href=#the-link-element>link</a></code> elements, it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink</a>.</p>
+
+ <p>The <code title=rel-prev><a href=#link-type-prev>prev</a></code> keyword indicates that the
+ document is part of a sequence, and that the link is leading to the
+ document that is the previous logical document in the sequence.</p>
+
+ <div class=impl>
+
+ <p><strong>Synonyms</strong>: For historical reasons, user agents
+ must also treat the keyword "<code title="">previous</code>" like
+ the <code title=rel-prev><a href=#link-type-prev>prev</a></code> keyword.</p>
+
+ </div>
+
+
+ <h5 id=other-link-types><span class=secno>4.12.3.19 </span>Other link types</h5>
+
+ <p><dfn id=concept-rel-extensions title=concept-rel-extensions>Extensions to the predefined
+ set of link types</dfn> may be registered in the <a href=http://wiki.whatwg.org/wiki/RelExtensions>WHATWG Wiki
+ RelExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+
+ <p>Anyone is free to edit the WHATWG Wiki RelExtensions page at any
+ time to add a type. Extension types must be specified with the
+ following information:</p>
+
+ <dl><dt>Keyword</dt>
+
+ <dd>
+
+ <p>The actual value being defined. The value should not be
+ confusingly similar to any other defined value (e.g. differing
+ only in case).</p>
+
+ <p>If the value contains a U+003A COLON character (:), it must
+ also be an <a href=#absolute-url>absolute URL</a>.</p>
+
+ </dd>
+
+
+ <dt>Effect on... <code><a href=#the-link-element>link</a></code></dt>
+
+ <dd>
+
+ <p>One of the following:</p>
+
+ <dl><dt>not allowed</dt>
+
+ <dd>The keyword is not allowed to be specified on
+ <code><a href=#the-link-element>link</a></code> elements.</dd>
+
+ <dt>Hyperlink</dt>
+
+ <dd>The keyword may be specified on a <code><a href=#the-link-element>link</a></code> element;
+ it creates a <a href=#hyperlink-link title="hyperlink link">hyperlink
+ link</a>.</dd>
+
+ <dt>External Resource</dt>
+
+ <dd>The keyword may be specified on a <code><a href=#the-link-element>link</a></code> element;
+ it creates a <a href=#external-resource-link title="external resource link">external
+ resource link</a>.</dd>
+
+ </dl></dd>
+
+
+ <dt>Effect on... <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code></dt>
+
+ <dd>
+
+ <p>One of the following:</p>
+
+ <dl><dt>not allowed</dt>
+
+ <dd>The keyword is not allowed to be specified on <code><a href=#the-a-element>a</a></code>
+ and <code><a href=#the-area-element>area</a></code> elements.</dd>
+
+ <dt>Hyperlink</dt>
+
+ <dd>The keyword may be specified on <code><a href=#the-a-element>a</a></code> and
+ <code><a href=#the-area-element>area</a></code> elements.</dd>
+
+ </dl></dd>
+
+
+ <dt>Brief description</dt>
+
+ <dd><p>A short non-normative description of what the keyword's
+ meaning is.</dd>
+
+
+ <dt>Specification</dt>
+
+ <dd><p>A link to a more detailed description of the keyword's
+ semantics and requirements. It could be another page on the Wiki,
+ or a link to an external page.</dd>
+
+
+ <dt>Synonyms</dt>
+
+ <dd><p>A list of other keyword values that have exactly the same
+ processing requirements. Authors should not use the values defined
+ to be synonyms, they are only intended to allow user agents to
+ support legacy content. Anyone may remove synonyms that are not
+ used in practice; only names that need to be processed as synonyms
+ for compatibility with legacy content are to be registered in this
+ way.</dd>
+
+
+ <dt>Status</dt>
+
+ <dd>
+
+ <p>One of the following:</p>
+
+ <dl><dt>Proposed</dt>
+
+ <dd>The keyword has not received wide peer review and
+ approval. Someone has proposed it and is, or soon will be, using
+ it.</dd>
+
+ <dt>Ratified</dt>
+
+ <dd>The keyword has received wide peer review and approval. It
+ has a specification that unambiguously defines how to handle
+ pages that use the keyword, including when they use it in
+ incorrect ways.</dd>
+
+ <dt>Discontinued</dt>
+
+ <dd>The keyword has received wide peer review and it has been
+ found wanting. Existing pages are using this keyword, but new
+ pages should avoid it. The "brief description" and
+ "specification" entries will give details of what authors should
+ use instead, if anything.</dd>
+
+ </dl><p>If a keyword is found to be redundant with existing values, it
+ should be removed and listed as a synonym for the existing
+ value.</p>
+
+ <p>If a keyword is registered in the "proposed" state for a
+ period of a month or more without being used or specified, then it
+ may be removed from the registry.</p>
+
+ <p>If a keyword is added with the "proposed" status and found to
+ be redundant with existing values, it should be removed and listed
+ as a synonym for the existing value. If a keyword is added with
+ the "proposed" status and found to be harmful, then it should be
+ changed to "discontinued" status.</p>
+
+ <p>Anyone can change the status at any time, but should only do so
+ in accordance with the definitions above.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Conformance checkers must use the information given on the WHATWG
+ Wiki RelExtensions page to establish if a value is allowed or not:
+ values defined in this specification or marked as "proposed" or
+ "ratified" must be accepted when used on the elements for which they
+ apply as described in the "Effect on..." field, whereas values
+ marked as "discontinued" or not listed in either this specification
+ or on the aforementioned page must be rejected as invalid.
+ Conformance checkers may cache this information (e.g. for
+ performance reasons or to avoid the use of unreliable network
+ connectivity).</p>
+
+ <p>When an author uses a new type not defined by either this
+ specification or the Wiki page, conformance checkers should offer to
+ add the value to the Wiki, with the details described above, with
+ the "proposed" status.</p>
+
+ </div>
+
+ <p>Types defined as extensions in the <a href=http://wiki.whatwg.org/wiki/RelExtensions>WHATWG Wiki
+ RelExtensions page</a> with the status "proposed" or "ratified" may
+ be used with the <code title="">rel</code> attribute on
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code> elements in
+ accordance to the "Effect on..." field. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+
+
+ <h3 id=common-idioms-without-dedicated-elements><span class=secno>4.13 </span>Common idioms without dedicated elements</h3>
+
+ <h4 id=tag-clouds><span class=secno>4.13.1 </span>Tag clouds</h4>
+
+ <p id=tag-cloud>This specification does not define any markup
+ specifically for marking up lists of keywords that apply to a group
+ of pages (also known as <i>tag clouds</i>). In general, authors are
+ encouraged to either mark up such lists using <code><a href=#the-ul-element>ul</a></code>
+ elements with explicit inline counts that are then hidden and turned
+ into a presentational effect using a style sheet, or to use SVG.</p>
+
+ <div class=example>
+
+ <p>Here, three tags are included in a short tag cloud:</p>
+
+ <pre>&lt;style&gt;
+@media screen, print, handheld, tv {
+ /* should be ignored by non-visual browsers */
+ .tag-cloud &gt; li &gt; span { display: none; }
+ .tag-cloud &gt; li { display: inline; }
+ .tag-cloud-1 { font-size: 0.7em; }
+ .tag-cloud-2 { font-size: 0.9em; }
+ .tag-cloud-3 { font-size: 1.1em; }
+ .tag-cloud-4 { font-size: 1.3em; }
+ .tag-cloud-5 { font-size: 1.5em; }
+}
+&lt;/style&gt;
+...
+&lt;ul class="tag-cloud"&gt;
+ &lt;li class="tag-cloud-4"&gt;&lt;a title="28 instances" href="/t/apple"&gt;apple&lt;/a&gt; &lt;span&gt;(popular)&lt;/span&gt;
+ &lt;li class="tag-cloud-2"&gt;&lt;a title="6 instances" href="/t/kiwi"&gt;kiwi&lt;/a&gt; &lt;span&gt;(rare)&lt;/span&gt;
+ &lt;li class="tag-cloud-5"&gt;&lt;a title="41 instances" href="/t/pear"&gt;pear&lt;/a&gt; &lt;span&gt;(very popular)&lt;/span&gt;
+&lt;/ul&gt;</pre>
+
+ <p>The actual frequency of each tag is given using the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute. A CSS style sheet is
+ provided to convert the markup into a cloud of differently-sized
+ words, but for user agents that do not support CSS or are not
+ visual, the markup contains annotations like "(popular)" or
+ "(rare)" to categorize the various tags by frequency, thus enabling
+ all users to benefit from the information.</p>
+
+ <p>The <code><a href=#the-ul-element>ul</a></code> element is used (rather than
+ <code><a href=#the-ol-element>ol</a></code>) because the order is not particularly important:
+ while the list is in fact ordered alphabetically, it would convey
+ the same information if ordered by, say, the length of the tag.</p>
+
+ <p>The <code title=rel-tag><a href=#link-type-tag>tag</a></code> <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>-keyword is <em>not</em> used
+ on these <code><a href=#the-a-element>a</a></code> elements because they do not represent tags
+ that apply to the page itself; they are just part of an index
+ listing the tags themselves.</p>
+
+ </div>
+
+
+ <h4 id=conversations><span class=secno>4.13.2 </span>Conversations</h4>
+
+ <!-- http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-September/022576.html -->
+
+ <p>This specification does not define a specific element for marking
+ up conversations, meeting minutes, chat transcripts, dialogues in
+ screenplays, instant message logs, and other situations where
+ different players take turns in discourse.</p>
+
+ <p>Instead, authors are encouraged to mark up conversations using
+ <code><a href=#the-p-element>p</a></code> elements and punctuation. Authors who need to mark
+ the speaker for styling purposes are encouraged to use
+ <code><a href=#the-span-element>span</a></code> or <code><a href=#the-b-element>b</a></code>. Paragraphs with their text
+ wrapped in the <code><a href=#the-i-element>i</a></code> element can be used for marking up
+ stage directions.</p>
+
+ <div class=example>
+
+ <p>This example demonstrates this using an extract from Abbot and
+ Costello's famous sketch, <cite>Who's on first</cite>:</p>
+
+<pre>&lt;p&gt; Costello: Look, you gotta first baseman?
+&lt;p&gt; Abbott: Certainly.
+&lt;p&gt; Costello: Who's playing first?
+&lt;p&gt; Abbott: That's right.
+&lt;p&gt; Costello becomes exasperated.
+&lt;p&gt; Costello: When you pay off the first baseman every month, who gets the money?
+&lt;p&gt; Abbott: Every dollar of it.</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following extract shows how an IM conversation log could be
+ marked up.</p>
+
+ <pre>&lt;p&gt; &lt;time&gt;14:22&lt;/time&gt; &lt;b&gt;egof&lt;/b&gt; I'm not that nerdy, I've only seen 30% of the star trek episodes
+&lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;b&gt;kaj&lt;/b&gt; if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy
+&lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;b&gt;egof&lt;/b&gt; it's unarguably
+&lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;i&gt;* kaj blinks&lt;/i&gt;
+&lt;p&gt; &lt;time&gt;14:24&lt;/time&gt; &lt;b&gt;kaj&lt;/b&gt; you are not helping your case</pre>
+ <!-- with thanks to http://bash.org/?854262 -->
+
+ </div>
+
+
+ <h4 id=footnotes><span class=secno>4.13.3 </span>Footnotes</h4>
+
+ <p>HTML does not have a dedicated mechanism for marking up
+ footnotes. Here are the recommended alternatives.</p>
+
+ <hr><p>For short inline annotations, the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute should be used.</p>
+
+ <div class=example>
+
+ <p>In this example, two parts of a dialogue are annotated with
+ footnote-like content using the <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute.</p>
+
+ <pre>&lt;p&gt; &lt;b&gt;Customer&lt;/b&gt;: Hello! I wish to register a complaint. Hello. Miss?
+&lt;p&gt; &lt;b&gt;Shopkeeper&lt;/b&gt;: <strong>&lt;span title="Colloquial pronunciation of 'What do you'"</strong>
+&gt;Watcha&lt;/span&gt; mean, miss?
+&lt;p&gt; &lt;b&gt;Customer&lt;/b&gt;: Uh, I'm sorry, I have a cold. I wish to make a complaint.
+&lt;p&gt; &lt;b&gt;Shopkeeper&lt;/b&gt;: Sorry, &lt;span <strong>title="This is, of course, a lie."</strong>&gt;we're
+closing for lunch&lt;/span&gt;.</pre>
+
+ </div>
+
+ <hr><p>For longer annotations, the <code><a href=#the-a-element>a</a></code> element should be
+ used, pointing to an element later in the document. The convention
+ is that the contents of the link be a number in square brackets.</p>
+
+ <div class=example>
+
+ <p>In this example, a footnote in the dialogue links to a paragraph
+ below the dialogue. The paragraph then reciprocally links back to the
+ dialogue, allowing the user to return to the location of the
+ footnote.</p>
+
+ <pre>&lt;p&gt; Announcer: Number 16: The &lt;i&gt;hand&lt;/i&gt;.
+&lt;p&gt; Interviewer: Good evening. I have with me in the studio tonight
+Mr Norman St John Polevaulter, who for the past few years has been
+contradicting people. Mr Polevaulter, why &lt;em&gt;do&lt;/em&gt; you
+contradict people?
+&lt;p&gt; Norman: I don't. &lt;sup&gt;&lt;a href="#fn1" id="r1"&gt;[1]&lt;/a&gt;&lt;/sup&gt;
+&lt;p&gt; Interviewer: You told me you did!
+<em>...</em>
+&lt;section&gt;
+ &lt;p id="fn1"&gt;&lt;a href="#r1"&gt;[1]&lt;/a&gt; This is, naturally, a lie,
+ but paradoxically if it were true he could not say so without
+ contradicting the interviewer and thus making it false.&lt;/p&gt;
+&lt;/section&gt;</pre>
+
+ </div>
+
+ <hr><p>For side notes, longer annotations that apply to entire sections
+ of the text rather than just specific words or sentences, the
+ <code><a href=#the-aside-element>aside</a></code> element should be used.</p>
+
+ <div class=example>
+
+ <p>In this example, a sidebar is given after a dialogue, giving it
+ some context.</p>
+
+ <pre>&lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
+&lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: I'm sorry?
+&lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
+&lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: No no no, this's'a tobacconist's.
+&lt;aside&gt;
+ &lt;p&gt;In 1970, the British Empire lay in ruins, and foreign
+ nationalists frequented the streets &mdash; many of them Hungarians
+ (not the streets &mdash; the foreign nationals). Sadly, Alexander
+ Yalt has been publishing incompetently-written phrase books.
+&lt;/aside&gt;</pre>
+
+ </div>
+
+ <hr><p>For figures or tables, footnotes can be included in the relevant
+ <code><a href=#the-figcaption-element>figcaption</a></code> or <code><a href=#the-caption-element>caption</a></code> element, or in
+ surrounding prose.</p>
+
+ <div class=example>
+
+ <p>In this example, a <!-- round --> table has cells with footnotes
+ that are given in prose. A <code><a href=#the-figure-element>figure</a></code> element is used to
+ give a single legend to the combination of the table and its
+ footnotes.</p>
+
+ <pre>&lt;figure&gt;
+ &lt;figcaption&gt;Table 1. Alternative activities for knights.&lt;/figcaption&gt;
+ &lt;table&gt;
+ &lt;tr&gt;
+ &lt;th&gt; Activity
+ &lt;th&gt; Location
+ &lt;th&gt; Cost
+ &lt;tr&gt;
+ &lt;td&gt; Dance
+ &lt;td&gt; Wherever possible
+ &lt;td&gt; &pound;0&lt;sup&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;
+ &lt;tr&gt;
+ &lt;td&gt; Routines, chorus scenes&lt;sup&gt;&lt;a href="#fn2"&gt;2&lt;/a&gt;&lt;/sup&gt;
+ &lt;td&gt; Undisclosed
+ &lt;td&gt; Undisclosed
+ &lt;tr&gt;
+ &lt;td&gt; Dining&lt;sup&gt;&lt;a href="#fn3"&gt;3&lt;/a&gt;&lt;/sup&gt;
+ &lt;td&gt; Camelot
+ &lt;td&gt; Cost of ham, jam, and spam&lt;sup&gt;&lt;a href="#fn4"&gt;4&lt;/a&gt;&lt;/sup&gt;
+ &lt;/table&gt;
+ &lt;p id="fn1"&gt;1. Assumed.&lt;/p&gt;
+ &lt;p id="fn2"&gt;2. Footwork impeccable.&lt;/p&gt;
+ &lt;p id="fn3"&gt;3. Quality described as "well".&lt;/p&gt;
+ &lt;p id="fn4"&gt;4. A lot.&lt;/p&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h3 id=matching-html-elements-using-selectors><span class=secno>4.14 </span>Matching HTML elements using selectors</h3>
+
+ <h4 id=selectors><span class=secno>4.14.1 </span>Case-sensitivity</h4>
+
+ <p>Attribute and element <em>names</em> of <a href=#html-elements>HTML
+ elements</a> in <a href=#html-documents>HTML documents</a> must be treated as
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a>.</p>
+
+ <p>Classes from the <code title=attr-class><a href=#classes>class</a></code> attribute
+ of <a href=#html-elements>HTML elements</a> in documents that are in <a href=#quirks-mode>quirks
+ mode</a> must be treated as <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a>.</p>
+
+ <p>Attribute selectors on an <a href=#html-elements title="HTML elements">HTML
+ element</a> in an <a href=#html-documents title="HTML documents">HTML
+ document</a> must treat the <em>values</em> of attributes with
+ the following names as <a href=#ascii-case-insensitive>ASCII case-insensitive</a>:</p>
+
+ <!-- based on Mozilla's list, which was itself based on HTML4 -->
+ <!-- WebKit's was identical at the time of writing except as noted below -->
+ <ul class=brief><li><code title="">accept</code>
+ <li><code title="">accept-charset</code>
+ <li><code title="">align</code>
+ <li><code title="">alink</code>
+ <li><code title="">axis</code>
+ <li><code title="">bgcolor</code>
+ <li><code title="">charset</code>
+ <li><code title="">checked</code>
+ <li><code title="">clear</code>
+ <li><code title="">codetype</code>
+ <li><code title="">color</code>
+ <li><code title="">compact</code>
+ <li><code title="">declare</code>
+ <li><code title="">defer</code>
+ <li><code title="">dir</code>
+ <li><code title="">direction</code> <!-- not in webkit -->
+ <li><code title="">disabled</code>
+ <li><code title="">enctype</code>
+ <li><code title="">face</code>
+ <li><code title="">frame</code>
+ <li><code title="">hreflang</code>
+ <li><code title="">http-equiv</code>
+ <li><code title="">lang</code>
+ <li><code title="">language</code>
+ <li><code title="">link</code>
+ <li><code title="">media</code>
+ <li><code title="">method</code>
+ <li><code title="">multiple</code>
+ <li><code title="">nohref</code>
+ <li><code title="">noresize</code>
+ <li><code title="">noshade</code>
+ <li><code title="">nowrap</code>
+ <li><code title="">readonly</code>
+ <li><code title="">rel</code>
+ <li><code title="">rev</code>
+ <li><code title="">rules</code>
+ <li><code title="">scope</code>
+ <li><code title="">scrolling</code>
+ <li><code title="">selected</code>
+ <li><code title="">shape</code>
+ <li><code title="">target</code>
+ <li><code title="">text</code>
+ <li><code title="">type</code>
+ <li><code title="">valign</code>
+ <li><code title="">valuetype</code>
+ <li><code title="">vlink</code>
+ </ul><p>All other attribute values on <a href=#html-elements>HTML elements</a> must be
+ treated as <a href=#case-sensitive>case-sensitive</a>.</p>
+
+
+ <h4 id=pseudo-classes><span class=secno>4.14.2 </span>Pseudo-classes</h4>
+
+ <p>There are a number of dynamic selectors that can be used with
+ HTML. This section defines when these selectors match HTML
+ elements.</p>
+
+ <dl><dt><dfn id=selector-link title=selector-link><code>:link</code></dfn></dt>
+ <dt><dfn id=selector-visited title=selector-visited><code>:visited</code></dfn></dt>
+
+ <dd>
+
+ <p>All <code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, all
+ <code><a href=#the-area-element>area</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, and all
+ <code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute, must match one of
+ <code title=selector-link><a href=#selector-link>:link</a></code> and <code title=selector-visited><a href=#selector-visited>:visited</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=selector-active title=selector-active><code>:active</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-active><a href=#selector-active>:active</a></code> pseudo-class
+ must match the following elements between the time the user begins
+ to activate the element and the time the user stops activating
+ the element:</p>
+
+ <ul><li><code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-area-element>area</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-button-element>button</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a>, <a href=#image-button-state title=attr-input-type-image>Image Button</a>, <a href=#reset-button-state title=attr-input-type-reset>Reset Button</a>, or <a href=#button-state title=attr-input-type-button>Button</a> state</li>
+
+ <li><code><a href=#the-command>command</a></code> elements that do not have a <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute</li>
+
+ <li>any other element, if it is <a href=#specially-focusable>specially
+ focusable</a></li>
+
+ </ul><p class=example>For example, if the user is using a keyboard to
+ push a <code><a href=#the-button-element>button</a></code> element by pressing the space bar, the
+ element would match this pseudo-class in between the time that the
+ element received the <code title=event-keydown>keydown</code>
+ event and the time the element received the <code title=event-keyup>keyup</code> event.</p>
+
+ </dd>
+
+
+ <dt><dfn id=selector-enabled title=selector-enabled><code>:enabled</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-enabled><a href=#selector-enabled>:enabled</a></code> pseudo-class
+ must match the following elements:</p>
+
+ <ul><li><code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-area-element>area</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-button-element>button</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute are not in the
+ <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state and that
+ are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-select-element>select</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-textarea-element>textarea</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-option-element>option</a></code> elements that do not have a <code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code> attribute</li>
+
+ <li><code><a href=#the-command>command</a></code> elements that do not have a <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute</li>
+
+ <li><code><a href=#the-li-element>li</a></code> elements that are children of
+ <code><a href=#menus>menu</a></code> elements, and that have a child element that
+ defines a <a href=#concept-command title=concept-command>command</a>, if the
+ first such element's <a href=#command-facet-disabledstate title=command-facet-disabledstate>Disabled State</a> facet
+ is false (not disabled)</li>
+
+ </ul></dd>
+
+
+ <dt><dfn id=selector-disabled title=selector-disabled><code>:disabled</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-disabled><a href=#selector-disabled>:disabled</a></code>
+ pseudo-class must match the following elements:</p>
+
+ <ul><li><code><a href=#the-button-element>button</a></code> elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute are not in the
+ <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state and that
+ are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-select-element>select</a></code> elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-textarea-element>textarea</a></code> elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-option-element>option</a></code> elements that have a <code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code> attribute</li>
+
+ <li><code><a href=#the-command>command</a></code> elements that have a <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute</li>
+
+ <li><code><a href=#the-li-element>li</a></code> elements that are children of
+ <code><a href=#menus>menu</a></code> elements, and that have a child element that
+ defines a <a href=#concept-command title=concept-command>command</a>, if the
+ first such element's <a href=#command-facet-disabledstate title=command-facet-disabledstate>Disabled State</a> facet
+ is true (disabled)</li>
+
+ </ul></dd>
+
+
+ <dt><dfn id=selector-checked title=selector-checked><code>:checked</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-checked><a href=#selector-checked>:checked</a></code> pseudo-class
+ must match the following elements:</p>
+
+ <ul><li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state and whose
+ <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is
+ true</li>
+
+ <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a> state and whose
+ <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is
+ true</li>
+
+ <li><code><a href=#the-command>command</a></code> elements whose <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is in the <a href=#attr-command-type-state-checkbox title=attr-command-type-state-checkbox>Checkbox</a> state
+ and that have a <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code>
+ attribute</li>
+
+ <li><code><a href=#the-command>command</a></code> elements whose <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is in the <a href=#attr-command-type-state-radio title=attr-command-type-state-radio>Radio</a> state and that
+ have a <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code>
+ attribute</li>
+
+ </ul></dd>
+
+
+ <dt><dfn id=selector-indeterminate title=selector-indeterminate><code>:indeterminate</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-indeterminate><a href=#selector-indeterminate>:indeterminate</a></code>
+ pseudo-class must match <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state and whose
+ <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL
+ attribute is set to true.</p>
+
+ </dd>
+
+
+ <dt><dfn id=selector-default title=selector-default><code>:default</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-default><a href=#selector-default>:default</a></code> pseudo-class
+ must match the following elements:</p>
+
+ <ul><li><code><a href=#the-button-element>button</a></code> elements that are their form's
+ <a href=#default-button>default button</a></li>
+
+ <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a> or <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, and that
+ are their form's <a href=#default-button>default button</a></li>
+<!--
+ <li><code>command</code> elements that have a <code
+ title="attr-command-default">default</code> attribute</li>
+-->
+ </ul></dd>
+
+
+ <dt><dfn id=selector-valid title=selector-valid><code>:valid</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-valid><a href=#selector-valid>:valid</a></code> pseudo-class
+ must match all elements that are <a href=#candidate-for-constraint-validation title="candidate for
+ constraint validation">candidates for constraint validation</a>
+ and that <a href=#concept-fv-valid title=concept-fv-valid>satisfy their
+ constraints</a>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=selector-invalid title=selector-invalid><code>:invalid</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-invalid><a href=#selector-invalid>:invalid</a></code> pseudo-class
+ must match all elements that are <a href=#candidate-for-constraint-validation title="candidate for
+ constraint validation">candidates for constraint validation</a>
+ but that do not <a href=#concept-fv-valid title=concept-fv-valid>satisfy their
+ constraints</a>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=selector-in-range title=selector-in-range><code>:in-range</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-in-range><a href=#selector-in-range>:in-range</a></code>
+ pseudo-class must match all elements that are <a href=#candidate-for-constraint-validation title="candidate for constraint validation">candidates for
+ constraint validation</a> and that are neither <a href=#suffering-from-an-underflow>suffering
+ from an underflow</a> nor <a href=#suffering-from-an-overflow>suffering from an
+ overflow</a>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=selector-out-of-range title=selector-out-of-range><code>:out-of-range</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-out-of-range><a href=#selector-out-of-range>:out-of-range</a></code>
+ pseudo-class must match all elements that are <a href=#candidate-for-constraint-validation title="candidate for constraint validation">candidates for
+ constraint validation</a> and that are <a href=#suffering-from-an-underflow>suffering from an
+ underflow</a> or <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=selector-required title=selector-required><code>:required</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-required><a href=#selector-required>:required</a></code>
+ pseudo-class must match the following elements:</p>
+
+ <ul><li><code><a href=#the-input-element>input</a></code> elements that are <i title=concept-input-required><a href=#concept-input-required>required</a></i></li>
+
+ <li><code><a href=#the-textarea-element>textarea</a></code> elements that have a <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>
+ attribute</li>
+
+ </ul></dd>
+
+
+ <dt><dfn id=selector-optional title=selector-optional><code>:optional</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-optional><a href=#selector-optional>:optional</a></code>
+ pseudo-class must match the following elements:</p>
+
+ <ul><li><code><a href=#the-button-element>button</a></code> elements</li>
+
+ <li><code><a href=#the-input-element>input</a></code> elements that are not <i title=concept-input-required><a href=#concept-input-required>required</a></i></li>
+
+ <li><code><a href=#the-select-element>select</a></code> elements</li>
+
+ <li><code><a href=#the-textarea-element>textarea</a></code> elements that do not have a <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>
+ attribute</li>
+
+ </ul></dd>
+
+
+ <dt><dfn id=selector-read-only title=selector-read-only><code>:read-only</code></dfn></dt>
+ <dt><dfn id=selector-read-write title=selector-read-write><code>:read-write</code></dfn></dt>
+
+ <dd>
+
+ <p>The <code title=selector-read-write><a href=#selector-read-write>:read-write</a></code>
+ pseudo-class must match the following elements:</p>
+
+ <ul><li><code><a href=#the-input-element>input</a></code> elements to which the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute applies,
+ but that are not <i title=concept-input-immutable><a href=#concept-input-immutable>immutable</a></i>
+ (i.e. that do not have the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute specified
+ and that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>)</li>
+
+ <li><code><a href=#the-textarea-element>textarea</a></code> elements that do not have a <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute, and
+ that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li>any element that is <a href=#editable>editable</a></li>
+
+ </ul><p>The <code title=selector-read-only><a href=#selector-read-only>:read-only</a></code>
+ pseudo-class must match all other <a href=#html-elements>HTML elements</a>.</p>
+
+ </dd>
+
+ </dl><p class=note>Another section of this specification defines the
+ <i><a href=#target-element>target element</a></i> used with the <code title=selector-target>:target</code> pseudo-class.</p>
+
+ <p class=note>This specification does not define when an element
+ matches the <code title=selector-hover>:hover</code>, <code title=selector-focus>:focus</code>, or <code title=selector-lang()>:lang()</code> dynamic pseudo-classes, as
+ those are all defined in sufficient detail in a language-agnostic
+ fashion in the Selectors specification. <a href=#refsSELECTORS>[SELECTORS]</a></p>
+
+ </div>
+
+
+
+
+ <div data-component="HTML Microdata (editor: Ian Hickson)">
+
+ <h2 id=microdata><span class=secno>5 </span><dfn>Microdata</dfn></h2>
+
+<!-- v2
+
+ * <itemref itemprop="foo" src="url#id"> to import the item with
+ id="id" from url into the current microdata block as the value of
+ property foo?
+
+ * splitting the 'content' part of a property into multiple sub-bits,
+ as in:
+
+ <span itemprop="tel" item-content-in-bits>
+ Telephone:
+ <span content-bit>+44</span> (0) <span content-bit>1223 123 123</span>
+ </span>
+
+ maybe vocabs that need this can use a sub vocabulary specifically
+ for this:
+
+ <span itemprop="tel" itemscope itemtype="http://bits.example/">
+ Telephone:
+ <span itemprop=bit>+44</span> (0) <span itemprop=bit>1223 123 123</span>
+ </span>
+
+-->
+
+
+ <h3 id=introduction-2><span class=secno>5.1 </span>Introduction</h3>
+
+ <h4 id=overview><span class=secno>5.1.1 </span>Overview</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Sometimes, it is desirable to annotate content with specific
+ machine-readable labels, e.g. to allow generic scripts to provide
+ services that are customised to the page, or to enable content from
+ a variety of cooperating authors to be processed by a single script
+ in a consistent manner.</p>
+
+ <p>For this purpose, authors can use the microdata features
+ described in this section. Microdata allows nested groups of
+ name-value pairs to be added to documents, in parallel with the
+ existing content.</p>
+
+
+
+ <h4 id=the-basic-syntax><span class=secno>5.1.2 </span>The basic syntax</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>At a high level, microdata consists of a group of name-value
+ pairs. The groups are called <a href=#concept-item title=concept-item>items</a>, and each name-value pair is a
+ property. Items and properties are represented by regular
+ elements.</p>
+
+ <p>To create an item, the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is used.</p>
+
+ <p>To add a property to an item, the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is used on one of
+ the <a href=#concept-item title=concept-item>item's</a> descendants.</p>
+
+ <div class=example>
+
+ <p>Here there are two items, each of which has the property "name":</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;p&gt;My name is &lt;span itemprop="name"&gt;Elizabeth&lt;/span&gt;.&lt;/p&gt;
+&lt;/div&gt;
+
+&lt;div itemscope&gt;
+ &lt;p&gt;My name is &lt;span itemprop="name"&gt;Daniel&lt;/span&gt;.&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+ </div>
+
+ <p>Properties generally have values that are strings.</p>
+
+ <div class=example>
+
+ <p>Here the item has three properties:</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;p&gt;My name is &lt;span itemprop="name"&gt;Neil&lt;/span&gt;.&lt;/p&gt;
+ &lt;p&gt;My band is called &lt;span itemprop="band"&gt;Four Parts Water&lt;/span&gt;.&lt;/p&gt;
+ &lt;p&gt;I am &lt;span itemprop="nationality"&gt;British&lt;/span&gt;.&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+ </div>
+
+ <p>Properties can also have values that are <a href=#url title=URL>URLs</a>. This is achieved using the <code><a href=#the-a-element>a</a></code>
+ element and its <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
+ attribute, the <code><a href=#the-img-element>img</a></code> element and its <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, or other elements that
+ link to or embed external resources.</p>
+
+ <div class=example>
+
+ <p>In this example, the item has one property, "image", whose value
+ is a URL:</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;img itemprop="image" src="google-logo.png" alt="Google"&gt;
+&lt;/div&gt;</pre>
+
+ </div>
+
+ <p>Properties can also have values that are dates, times, or dates
+ and times. This is achieved using the <code><a href=#the-time-element>time</a></code> element and
+ its <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute.</p>
+
+ <div class=example>
+
+ <p>In this example, the item has one property,
+ "birthday", whose value is a date:</p>
+
+ <pre>&lt;div itemscope&gt;
+ I was born on &lt;time itemprop="birthday" datetime="2009-05-10"&gt;May 10th 2009&lt;/time&gt;.
+&lt;/div&gt;</pre>
+
+ </div>
+
+ <p>Properties can also themselves be groups of name-value pairs, by
+ putting the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute
+ on the element that declares the property.</p>
+
+ <p>Items that are not part of others are called <a href=#top-level-microdata-items>top-level
+ microdata items</a>.</p>
+
+ <div class=example>
+
+ <p>In this example, the outer item represents a person, and the
+ inner one represents a band:</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;p&gt;Name: &lt;span itemprop="name"&gt;Amanda&lt;/span&gt;&lt;/p&gt;
+ &lt;p&gt;Band: &lt;span itemprop="band" itemscope&gt; &lt;span itemprop="name"&gt;Jazz Band&lt;/span&gt; (&lt;span itemprop="size"&gt;12&lt;/span&gt; players)&lt;/span&gt;&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+ <p>The outer item here has two properties, "name" and
+ "band". The "name" is "Amanda", and the
+ "band" is an item in its own right, with two
+ properties, "name" and "size". The
+ "name" of the band is "Jazz Band", and the
+ "size" is "12".</p>
+
+ <p>The outer item in this example is a top-level microdata
+ item.</p>
+
+ </div>
+
+ <p>Properties that are not descendants of the element with the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute can be associated
+ with the <a href=#concept-item title=concept-item>item</a> using the <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute. This attribute takes
+ a list of IDs of elements to crawl in addition to crawling the
+ children of the element with the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute.</p>
+
+ <div class=example>
+
+ <p>This example is the same as the previous one, but all the
+ properties are separated from their <a href=#concept-item title=concept-item>items</a>:</p>
+
+ <pre>&lt;div itemscope id="amanda" itemref="a b"&gt;&lt;/div&gt;
+&lt;p id="a"&gt;Name: &lt;span itemprop="name"&gt;Amanda&lt;/span&gt;&lt;/p&gt;
+&lt;div id="b" itemprop="band" itemscope itemref="c"&gt;&lt;/div&gt;
+&lt;div id="c"&gt;
+ &lt;p&gt;Band: &lt;span itemprop="name"&gt;Jazz Band&lt;/span&gt;&lt;/p&gt;
+ &lt;p&gt;Size: &lt;span itemprop="size"&gt;12&lt;/span&gt; players&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+ <p>This gives the same result as the previous example. The first
+ item has two properties, "name", set to "Amanda", and "band", set
+ to another item. That second item has two further properties,
+ "name", set to "Jazz Band", and "size", set to "12".</p>
+
+ </div>
+
+ <p>An <a href=#concept-item title=concept-item>item</a> can have multiple
+ properties with the same name and different values.</p>
+
+ <div class=example>
+
+ <p>This example describes an ice cream, with two flavors:</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;p&gt;Flavors in my favorite ice cream:&lt;/p&gt;
+ &lt;ul&gt;
+ &lt;li itemprop="flavor"&gt;Lemon sorbet&lt;/li&gt;
+ &lt;li itemprop="flavor"&gt;Apricot sorbet&lt;/li&gt;
+ &lt;/ul&gt;
+&lt;/div&gt;</pre>
+
+ <p>This thus results in an item with two properties, both
+ "flavor", having the values "Lemon sorbet" and "Apricot
+ sorbet".</p>
+
+ </div>
+
+ <p>An element introducing a property can also introduce multiple
+ properties at once, to avoid duplication when some of the properties
+ have the same value.</p>
+
+ <div class=example>
+
+ <p>Here we see an item with two properties,
+ "favorite-color" and "favorite-fruit", both
+ set to the value "orange":</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;span itemprop="favorite-color favorite-fruit"&gt;orange&lt;/span&gt;
+&lt;/div&gt;</pre>
+
+ </div>
+
+ <p>It's important to note that there is no relationship between the
+ microdata and the content of the document where the microdata is
+ marked up.</p>
+
+ <div class=example>
+
+ <p>There is no semantic difference, for instance, between the
+ following two examples:</p>
+
+ <pre>&lt;figure&gt;
+ &lt;img src="castle.jpeg"&gt;
+ &lt;figcaption&gt;&lt;span itemscope&gt;&lt;span itemprop="name"&gt;The Castle&lt;/span&gt;&lt;/span&gt; (1986)&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ <pre>&lt;span itemscope&gt;&lt;meta itemprop="name" content="The Castle"&gt;&lt;/span&gt;
+&lt;figure&gt;
+ &lt;img src="castle.jpeg"&gt;
+ &lt;figcaption&gt;The Castle (1986)&lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ <p>Both have a figure with a caption, and both, completely
+ unrelated to the figure, have an item with a name-value pair with
+ the name "name" and the value "The Castle". The only
+ difference is that if the user drags the caption out of the
+ document, in the former case, the item will be included in the
+ drag-and-drop data. In neither case is the image in any way
+ associated with the item.</p>
+
+ </div>
+
+
+ <h4 id=typed-items><span class=secno>5.1.3 </span>Typed items</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The examples in the previous section show how information could
+ be marked up on a page that doesn't expect its microdata to be
+ re-used. Microdata is most useful, though, when it is used in
+ contexts where other authors and readers are able to cooperate to
+ make new uses of the markup.</p>
+
+ <p>For this purpose, it is necessary to give each <a href=#concept-item title=concept-item>item</a> a type, such as
+ "http://example.com/person", or "http://example.org/cat", or
+ "http://band.example.net/". Types are identified as <a href=#url title=URL>URLs</a>.</p>
+
+ <p>The type for an <a href=#concept-item title=concept-item>item</a> is given
+ as the value of an <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code>
+ attribute on the same element as the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute.</p>
+
+ <div class=example>
+
+ <p>Here, the item is "http://example.org/animals#cat":</p>
+
+<pre>&lt;section itemscope itemtype="http://example.org/animals#cat"&gt;
+ &lt;h1 itemprop="name"&gt;Hedral&lt;/h1&gt;
+ &lt;p itemprop="desc"&gt;Hedral is a male american domestic
+ shorthair, with a fluffy black fur with white paws and belly.&lt;/p&gt;
+ &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months"&gt;
+&lt;/section&gt;</pre>
+
+ <p>In this example the "http://example.org/animals#cat" item has three
+ properties, a "name" ("Hedral"), a "desc" ("Hedral is..."), and an
+ "img" ("hedral.jpeg").</p>
+
+ </div>
+
+ <p>An item can only have one type. The type gives the context for
+ the properties, thus defining a vocabulary: a property named "class"
+ given for an item with the type "http://census.example/person" might
+ refer to the economic class of an individual, while a property named
+ "class" given for an item with the type "http://example.com/school/teacher"
+ might refer to the classroom a teacher has been assigned.</p>
+
+
+ <h4 id=global-identifiers-for-items><span class=secno>5.1.4 </span>Global identifiers for items</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Sometimes, an <a href=#concept-item title=concept-item>item</a> gives
+ information about a topic that has a global identifier. For example,
+ books can be identified by their ISBN number.</p>
+
+ <p>Vocabularies (as identified by the <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute) can be designed
+ such that <a href=#concept-item title=concept-item>items</a> get associated
+ with their global identifier in an unambiguous way by expressing the
+ global identifiers as <a href=#url title=URL>URLs</a> given in an
+ <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute.</p>
+
+ <p>The exact meaning of the <a href=#url title=URL>URLs</a> given in
+ <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attributes depends on the
+ vocabulary used.</p>
+
+ <div class=example>
+
+ <p>Here, an item is talking about a particular book:</p>
+
+<pre>&lt;dl itemscope
+ itemtype="http://vocab.example.net/book"
+ <strong>itemid="urn:isbn:0-330-34032-8"</strong>&gt;
+ &lt;dt&gt;Title
+ &lt;dd itemprop="title"&gt;The Reality Dysfunction
+ &lt;dt&gt;Author
+ &lt;dd itemprop="author"&gt;Peter F. Hamilton
+ &lt;dt&gt;Publication date
+ &lt;dd&gt;&lt;time itemprop="pubdate" datetime="1996-01-26"&gt;26 January 1996&lt;/time&gt;
+&lt;/dl&gt;</pre>
+
+ <p>The "<code title="">http://vocab.example.net/book</code>"
+ vocabulary in this example would define that the <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute takes a <code title="">urn:</code> <a href=#url>URL</a> pointing to the ISBN of the
+ book.</p>
+
+ </div>
+
+ <!-- (commented out since itemtype="" defines the meaning of the
+ identifier for now)
+ <p>Although it is common practice, authors are encouraged not to use
+ the same URL to identify multiple topics; in particular, an HTTP URL
+ usually identifies a specific resource (such as an image or
+ document), and authors are encouraged to not use them to identify
+ people, non-Web resources like companies, movies, and products, or
+ other abstract concepts. Using an HTTP URL as a global identifier
+ for something other than the resource actually designated by the URL
+ leads to a situation where it is ambiguous whether the identifier,
+ and thus the set of properties specified in the microdata,
+ references the page or something else.</p>
+ -->
+
+
+
+ <h4 id=selecting-names-when-defining-vocabularies><span class=secno>5.1.5 </span>Selecting names when defining vocabularies</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Using microdata means using a vocabulary. For some purposes, an
+ ad-hoc vocabulary is adequate. For others, a vocabulary will need to
+ be designed. Where possible, authors are encouraged to re-use
+ existing vocabularies, as this makes content re-use easier.</p>
+
+ <p>When designing new vocabularies, identifiers can be created
+ either using <a href=#url title=URL>URLs</a>, or, for properties, as
+ plain words (with no dots or colons). For URLs, conflicts with other
+ vocabularies can be avoided by only using identifiers that
+ correspond to pages that the author has control over.</p>
+
+ <div class=example>
+
+ <p>For instance, if Jon and Adam both write content at <code title="">example.com</code>, at <code title="">http://example.com/~jon/...</code> and <code title="">http://example.com/~adam/...</code> respectively, then
+ they could select identifiers of the form
+ "http://example.com/~jon/name" and "http://example.com/~adam/name"
+ respectively.</p>
+
+ </div>
+
+ <p>Properties whose names are just plain words can only be used
+ within the context of the types for which they are intended;
+ properties named using URLs can be reused in items of any type. If
+ an item has no type, and is not part of another item, then if its
+ properties have names that are just plain words, they are not
+ intended to be globally unique, and are instead only intended for
+ limited use. Generally speaking, authors are encouraged to use
+ either properties with globally unique names (URLs) or ensure that
+ their items are typed.</p>
+
+ <div class=example>
+
+ <p>Here, an item is an "http://example.org/animals#cat", and most of the
+ properties have names that are words defined in the context of that
+ type. There are also a few additional properties whose names come
+ from other vocabularies.</p>
+
+<pre>&lt;section itemscope itemtype="http://example.org/animals#cat"&gt;
+ &lt;h1 itemprop="name http://example.com/fn"&gt;Hedral&lt;/h1&gt;
+ &lt;p itemprop="desc"&gt;Hedral is a male american domestic
+ shorthair, with a fluffy &lt;span
+ itemprop="http://example.com/color"&gt;black&lt;/span&gt; fur with &lt;span
+ itemprop="http://example.com/color"&gt;white&lt;/span&gt; paws and belly.&lt;/p&gt;
+ &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months"&gt;
+&lt;/section&gt;</pre>
+
+ <p>This example has one item with the type "http://example.org/animals#cat"
+ and the following properties:</p>
+
+ <table><thead><tr><td>Property
+ <td>Value
+ <tbody><tr><td>name
+ <td>Hedral
+ <tr><td>http://example.com/fn
+ <td>Hedral
+ <tr><td>desc
+ <td>Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.
+ <tr><td>http://example.com/color
+ <td>black
+ <tr><td>http://example.com/color
+ <td>white
+ <tr><td>img
+ <td>.../hedral.jpeg
+ </table></div>
+
+
+
+ <h4 id=using-the-microdata-dom-api><span class=secno>5.1.6 </span>Using the microdata DOM API</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The microdata becomes even more useful when scripts can use it to
+ expose information to the user, for example offering it in a form
+ that can be used by other applications.</p>
+
+ <p>The <code title=dom-document-getItems><a href=#dom-document-getitems>document.getItems(<var title="">typeNames</var>)</a></code> method provides access to the
+ <a href=#top-level-microdata-items>top-level microdata items</a>. It returns a
+ <code><a href=#nodelist>NodeList</a></code> containing the items with the specified types,
+ or all types if no argument is specified.</p>
+
+ <p>Each <a href=#concept-item title=concept-item>item</a> is represented in the
+ DOM by the element on which the relevant <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is found. These
+ elements have their <code title=dom-itemScope><a href=#dom-itemscope>element.itemScope</a></code> IDL attribute set to
+ true.</p>
+
+ <p>The type of <a href=#concept-item title=concept-item>items</a> can be
+ obtained using the <code title=dom-itemType><a href=#dom-itemtype>element.itemType</a></code> IDL attribute on the
+ element with the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>
+ attribute.</p>
+
+ <div class=example>
+
+ <p>This sample shows how the <code title=dom-document-getItems><a href=#dom-document-getitems>getItems()</a></code> method can be used
+ to obtain a list of all the top-level microdata items of one type
+ given in the document:</p>
+
+ <pre>var cats = document.getItems("http://example.com/feline");</pre>
+
+ </div>
+
+ <p>Once an element representing an <a href=#concept-item title=concept-item>item</a> has been obtained, its properties
+ can be extracted using the <code title=dom-properties><a href=#dom-properties>properties</a></code> IDL attribute. This
+ attribute returns an <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code>, which can
+ be enumerated to go through each element that adds one or more
+ properties to the item. It can also be indexed by name, which will
+ return an object with a list of the elements that add properties
+ with that name.</p>
+
+ <p>Each element that adds a property also has a <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL attribute that returns
+ its value.</p>
+
+ <div class=example>
+
+ <p>This sample gets the first item of type "http://example.net/user" and
+ then pops up an alert using the "name" property from
+ that item.</p>
+
+ <pre>var user = document.getItems('http://example.net/user')[0];
+alert('Hello ' + user.properties['name'][0].content + '!');</pre>
+
+ </div>
+
+ <p>The <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> object, when indexed by
+ name in this way, actually returns a <code><a href=#propertynodelist>PropertyNodeList</a></code>
+ object with all the matching properties. The
+ <code><a href=#propertynodelist>PropertyNodeList</a></code> object can be used to obtain all the
+ values at once using <em>its</em> <code title=dom-PropertyNodeList-values><a href=#dom-propertynodelist-values>values</a></code> attribute, which
+ returns an array of all the values.</p>
+
+ <div class=example>
+
+ <p>In an earlier example, a "http://example.org/animals#cat" item had two
+ "http://example.com/color" values. This script looks up the first such
+ item and then lists all its values.</p>
+
+ <pre>var cat = document.getItems('http://example.org/animals#cat')[0];
+var colors = cat.properties['http://example.com/color'].values;
+var result;
+if (colors.length == 0) {
+ result = 'Color unknown.';
+} else if (colors.length == 1) {
+ result = 'Color: ' + colors[0];
+} else {
+ result = 'Colors:';
+ for (var i = 0; i &lt; colors.length; i += 1)
+ result += ' ' + colors[i];
+}</pre>
+
+ </div>
+
+ <p>It's also possible to get a list of all the <a href=#property-names>property
+ names</a> using the object's <code title=dom-HTMLPropertiesCollection-names><a href=#dom-htmlpropertiescollection-names>names</a></code> IDL
+ attribute.</p>
+
+ <div class=example>
+
+ <p>This example creates a big list with a nested list for each item
+ on the page, each with of all the property names used in that
+ item.</p>
+
+ <pre>var outer = document.createElement('ul');
+var items = document.getItems();
+for (var item = 0; item &lt; items.length; item += 1) {
+ var itemLi = document.createElement('li');
+ var inner = document.createElement('ul');
+ for (var name = 0; name &lt; items[item].properties.names.length; name += 1) {
+ var propLi = document.createElement('li');
+ propLi.appendChild(document.createTextNode(items[item].properties.names[name]));
+ inner.appendChild(propLi);
+ }
+ itemLi.appendChild(inner);
+ outer.appendChild(itemLi);
+}
+document.body.appendChild(outer);</pre>
+
+ <p>If faced with the following from an earlier example:</p>
+
+ <pre>&lt;section itemscope itemtype="http://example.org/animals#cat"&gt;
+ &lt;h1 itemprop="name http://example.com/fn"&gt;Hedral&lt;/h1&gt;
+ &lt;p itemprop="desc"&gt;Hedral is a male american domestic
+ shorthair, with a fluffy &lt;span
+ itemprop="http://example.com/color"&gt;black&lt;/span&gt; fur with &lt;span
+ itemprop="http://example.com/color"&gt;white&lt;/span&gt; paws and belly.&lt;/p&gt;
+ &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months"&gt;
+&lt;/section&gt;</pre>
+
+ <p>...it would result in the following output:</p>
+
+ <ul><li>
+ <ul><li>name</li>
+ <li>http://example.com/fn</li>
+ <li>desc</li>
+ <li>http://example.com/color</li>
+ <li>img</li>
+ </ul></li>
+ </ul><p>(The duplicate occurrence of "http://example.com/color" is not included
+ in the list.)</p>
+
+ </div>
+
+
+ <h3 id=encoding-microdata><span class=secno>5.2 </span>Encoding microdata</h3>
+
+
+
+ <h4 id=the-microdata-model><span class=secno>5.2.1 </span>The microdata model</h4>
+
+ <p>The microdata model consists of groups of name-value pairs known
+ as <a href=#concept-item title=concept-item>items</a>.</p>
+
+ <p>Each group is known as an <a href=#concept-item title=concept-item>item</a>. Each <a href=#concept-item title=concept-item>item</a> can have an <a href=#item-type>item type</a>,
+ a <a href=#global-identifier>global identifier</a> (if the <a href=#item-type>item type</a>
+ <a href=#support-global-identifiers-for-items title="support global identifiers for items">supports global
+ identifiers for its items</a>), and a list of name-value
+ pairs. Each name in the name-value pair is known as a <a href=#the-properties-of-an-item title="the properties of an item">property</a>, and each <a href=#the-properties-of-an-item title="the properties of an item">property</a> has one or more
+ <a href=#concept-property-value title=concept-property-value>values</a>. Each <a href=#concept-property-value title=concept-property-value>value</a> is either a string or itself a group of
+ name-value pairs (an <a href=#concept-item title=concept-item>item</a>).</p>
+
+ <p>An <a href=#concept-item title=concept-item>item</a> is said to be a
+ <dfn id=typed-item>typed item</dfn> when either it has an <a href=#item-type>item type</a>,
+ or it is the <a href=#concept-property-value title=concept-property-value>value</a> of a <a href=#the-properties-of-an-item title="the properties of an
+ item">property</a> of a <a href=#typed-item>typed item</a>. The
+ <dfn id=relevant-type>relevant type</dfn> for a <a href=#typed-item>typed item</a> is the <a href=#concept-item title=concept-item>item</a>'s <a href=#item-type>item type</a>, if it has
+ one, or else is the <a href=#relevant-type>relevant type</a> of the <a href=#concept-item title=concept-item>item</a> for which it is a <a href=#the-properties-of-an-item title="the
+ properties of an item">property</a>'s <a href=#concept-property-value title=concept-property-value>value</a>.</p>
+
+
+
+ <h4 id=items><span class=secno>5.2.2 </span>Items</h4>
+
+ <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have an
+ <dfn id=attr-itemscope title=attr-itemscope><code>itemscope</code></dfn> attribute
+ specified. The <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>
+ attribute is a <a href=#boolean-attribute>boolean attribute</a>.</p>
+
+ <p>An element with the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>
+ attribute specified creates a new <dfn id=concept-item title=concept-item>item</dfn>, a group of name-value pairs.</p>
+
+ <hr><p>Elements with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>
+ attribute may have an <dfn id=attr-itemtype title=attr-itemtype><code>itemtype</code></dfn> attribute
+ specified, to give the <a href=#item-type>item type</a> of the <a href=#concept-item title=concept-item>item</a>.</p>
+
+ <p>The <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-url>valid URL</a> that
+ is an <a href=#absolute-url>absolute URL</a> for which the string "<code title="">http://www.w3.org/1999/xhtml/microdata#</code>" is not a
+ <a href=#prefix-match>prefix match</a>.</p> <!-- we disallow that prefix so that
+ we have somewhere to put future extensions, e.g. if we ever support
+ short type names -->
+
+ <p>The <dfn id=item-type>item type</dfn> of an <a href=#concept-item title=concept-item>item</a> is the value of its element's <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute, if it has one and
+ its value is not the empty string. If the <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute is missing or its
+ value is the empty string, the <a href=#concept-item title=concept-item>item</a> is said to have no <a href=#item-type>item
+ type</a>.</p>
+
+ <p>The <a href=#item-type>item type</a> must be a type defined in an <a href=#other-applicable-specifications title="other applicable specifications">applicable
+ specification</a>.</p>
+
+ <div class=impl>
+
+ <p>Except if otherwise specified by that specification, the
+ <a href=#url>URL</a> given as the <a href=#item-type>item type</a> should not be
+ automatically dereferenced.</p>
+
+ <p class=note>A specification could define that its <a href=#item-type>item
+ type</a> can be derefenced to provide the user with help
+ information, for example. In fact, vocabulary authors are
+ encouraged to provide useful information at the given
+ <a href=#url>URL</a>.</p>
+
+ <p><a href=#item-type title="item type">Item types</a> are opaque
+ identifiers, and user agents must not dereference unknown <a href=#item-type title="item type">item types</a>, or otherwise deconstruct them,
+ in order to determine how to process <a href=#concept-item title=concept-item>items</a> that use them.</p>
+
+ </div>
+
+ <p>The <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute must
+ not be specified on elements that do not have an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>
+
+ <hr><p>Elements with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>
+ attribute and an <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code>
+ attribute that references a vocabulary that is defined to
+ <dfn id=support-global-identifiers-for-items>support global identifiers for items</dfn> may also have an
+ <dfn id=attr-itemid title=attr-itemid><code>itemid</code></dfn> attribute
+ specified, to give a global identifier for the <a href=#concept-item title=concept-item>item</a>, so that it can be related to other
+ <a href=#concept-item title=concept-item>items</a> on pages elsewhere on the
+ Web.</p>
+
+ <p>The <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially
+ surrounded by spaces</a>.</p>
+
+ <p>The <dfn id=global-identifier>global identifier</dfn> of an <a href=#concept-item title=concept-item>item</a> is the value of its element's <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute, if it has one, <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element on
+ which the attribute is specified. If the <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute is missing or if
+ resolving it fails, it is said to have no <a href=#global-identifier>global
+ identifier</a>.</p>
+
+ <p>The <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute must not be
+ specified on elements that do not have both an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute and an <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute specified, and must
+ not be specified on elements with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute whose <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute specifies a
+ vocabulary that does not <a href=#support-global-identifiers-for-items>support global identifiers for
+ items</a>, as defined by that vocabulary's specification.</p>
+
+ <hr><p>Elements with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>
+ attribute may have an <dfn id=attr-itemref title=attr-itemref><code>itemref</code></dfn> attribute specified,
+ to give a list of additional elements to crawl to find the
+ name-value pairs of the <a href=#concept-item title=concept-item>item</a>.</p>
+
+ <p>The <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute, if
+ specified, must have a value that is an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of
+ unique space-separated tokens</a> consisting of <a href=#concept-id title=concept-ID>IDs</a> of elements in the same <a href=#home-subtree>home
+ subtree</a>.</p>
+
+ <p>The <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute must not
+ be specified on elements that do not have an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>
+
+
+ <h4 id=names:-the-itemprop-attribute><span class=secno>5.2.3 </span>Names: the <dfn title=attr-itemprop><code>itemprop</code></dfn> attribute</h4>
+
+ <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have an
+ <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute specified, if
+ doing so <a href=#the-properties-of-an-item title="the properties of an item">adds a
+ property</a> to one or more <a href=#concept-item title=concept-item>items</a> (as defined below).</p>
+
+ <p>The <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute, if
+ specified, must have a value that is an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of
+ unique space-separated tokens</a> representing the names of the
+ name-value pairs that it adds. The attribute's value must have at
+ least one token.</p>
+
+ <p>Each token must be either:</p>
+
+ <ul><li>A <a href=#valid-url>valid URL</a> that is an <a href=#absolute-url>absolute URL</a>
+ for which the string "<code title="">http://www.w3.org/1999/xhtml/microdata#</code>" is not a
+ <a href=#prefix-match>prefix match</a>, or</li>
+
+ <li>If the item is a <a href=#typed-item>typed item</a>: a <dfn id=defined-property-name>defined
+ property name</dfn> allowed in this situation according to the
+ specification that defines the <a href=#relevant-type>relevant type</a> for the
+ item, or</li>
+
+ <li>If the item is not a <a href=#typed-item>typed item</a>: a string that
+ contains no U+002E FULL STOP characters (.) and no U+003A COLON
+ characters (:).</li>
+
+ </ul><p>When an element with an <code title=concept-itemprop>itemprop</code> attribute <a href=#the-properties-of-an-item title="the
+ properties of an item">adds a property</a> to multiple <a href=#concept-item title=concept-item>items</a>, the requirement above regarding
+ the tokens applies for each <a href=#concept-item title=concept-item>item</a>
+ individually.</p>
+
+ <!--
+
+ e.g.:
+
+ <div itemscope itemtype="http://example.com/a"> <ref refid="x"> </div>
+ <div itemscope itemtype="http://example.com/b"> <ref refid="x"> </div>
+ <meta id="x" itemprop="z" content="">
+
+ "z" had better be valid for both http://example.com/a and http://example.com/b
+
+ -->
+
+ <p>The <dfn id=property-names>property names</dfn> of an element are the tokens that
+ the element's <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute
+ is found to contain when its value is <a href=#split-a-string-on-spaces title="split a string on
+ spaces">split on spaces</a>, with the order preserved but with
+ duplicates removed (leaving only the first occurrence of each
+ name).</p>
+
+ <p>Within an <a href=#concept-item title=concept-item>item</a>, the properties
+ are unordered with respect to each other, except for properties with
+ the same name, which are ordered in the order they are given by the
+ algorithm that defines <a href=#the-properties-of-an-item>the properties of an item</a>.</p>
+
+ <div class=example>
+
+ <p>In the following example, the "a" property has the values "1"
+ and "2", <em>in that order</em>, but whether the "a" property comes
+ before the "b" property or not is not important:</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;p itemprop="a"&gt;1&lt;/p&gt;
+ &lt;p itemprop="a"&gt;2&lt;/p&gt;
+ &lt;p itemprop="b"&gt;test&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+ <p>Thus, the following is equivalent:</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;p itemprop="b"&gt;test&lt;/p&gt;
+ &lt;p itemprop="a"&gt;1&lt;/p&gt;
+ &lt;p itemprop="a"&gt;2&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+ <p>As is the following:</p>
+
+ <pre>&lt;div itemscope&gt;
+ &lt;p itemprop="a"&gt;1&lt;/p&gt;
+ &lt;p itemprop="b"&gt;test&lt;/p&gt;
+ &lt;p itemprop="a"&gt;2&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+ <p>And the following:</p>
+
+ <pre>&lt;div itemscope itemref="x"&gt;
+ &lt;p itemprop="b"&gt;test&lt;/p&gt;
+ &lt;p itemprop="a"&gt;2&lt;/p&gt;
+&lt;/div&gt;
+&lt;div id="x"&gt;
+ &lt;p itemprop="a"&gt;1&lt;/p&gt;
+&lt;/div&gt;
+</pre>
+
+ </div>
+
+
+
+ <h4 id=values><span class=secno>5.2.4 </span>Values</h4>
+
+ <p>The <dfn id=concept-property-value title=concept-property-value>property value</dfn> of a
+ name-value pair added by an element with an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute depends on the
+ element, as follows:</p>
+
+ <dl><dt>If the element also has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute</dt>
+
+ <dd><p>The value is the <a href=#concept-item title=concept-item>item</a>
+ created by the element.</dd>
+
+
+ <dt>If the element is a <code><a href=#meta>meta</a></code> element</dt>
+
+ <dd><p>The value is the value of the element's <code title=attr-content>content</code> attribute, if any, or the empty
+ string if there is no such attribute.</dd>
+
+
+ <dt>If the element is an <code><a href=#audio>audio</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-source-element>source</a></code>, or
+ <code><a href=#video>video</a></code> element</dt>
+
+ <dd><p>The value is the <a href=#absolute-url>absolute URL</a> that results from
+ <a href=#resolve-a-url title="resolve a url">resolving</a> the value of the
+ element's <code title="">src</code> attribute relative to the
+ element at the time the attribute is set, or the empty string if
+ there is no such attribute or if <a href=#resolve-a-url title="resolve a
+ url">resolving</a> it results in an error.</dd>
+
+
+ <dt>If the element is an <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, or
+ <code><a href=#the-link-element>link</a></code> element</dt>
+
+ <dd><p>The value is the <a href=#absolute-url>absolute URL</a> that results from
+ <a href=#resolve-a-url title="resolve a url">resolving</a> the value of the
+ element's <code title="">href</code> attribute relative to the
+ element at the time the attribute is set, or the empty string if
+ there is no such attribute or if <a href=#resolve-a-url title="resolve a
+ url">resolving</a> it results in an error.</dd>
+
+
+ <dt>If the element is an <code><a href=#the-object-element>object</a></code> element</dt>
+
+ <dd><p>The value is the <a href=#absolute-url>absolute URL</a> that results from
+ <a href=#resolve-a-url title="resolve a url">resolving</a> the value of the
+ element's <code title="">data</code> attribute relative to the
+ element at the time the attribute is set, or the empty string if
+ there is no such attribute or if <a href=#resolve-a-url title="resolve a
+ url">resolving</a> it results in an error.</dd>
+
+
+ <dt>If the element is a <code><a href=#the-time-element>time</a></code> element with a <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute</dt>
+
+ <dd><p>The value is the value of the element's <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute.</dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd><p>The value is the element's
+ <code><a href=#textcontent>textContent</a></code>.</dd>
+
+ </dl><p>The <dfn id=url-property-elements>URL property elements</dfn> are the <code><a href=#the-a-element>a</a></code>,
+ <code><a href=#the-area-element>area</a></code>, <code><a href=#audio>audio</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-link-element>link</a></code>,
+ <code><a href=#the-object-element>object</a></code>, <code><a href=#the-source-element>source</a></code>, and <code><a href=#video>video</a></code>
+ elements.</p>
+
+ <p>If a property's <a href=#concept-property-value title=concept-property-value>value</a>
+ is an <a href=#absolute-url>absolute URL</a>, the property must be specified
+ using a <a href=#url-property-elements title="URL property elements">URL property
+ element</a>.</p>
+
+ <p>If a property's <a href=#concept-property-value title=concept-property-value>value</a>
+ represents a <a href=#concept-date title=concept-date>date</a>, <a href=#concept-time title=concept-time>time</a>, or <a href=#concept-datetime title=concept-datetime>global date and time</a>, the property
+ must be specified using the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute of a
+ <code><a href=#the-time-element>time</a></code> element.</p>
+
+
+ <h4 id=associating-names-with-items><span class=secno>5.2.5 </span>Associating names with items</h4>
+
+ <p>To find <dfn id=the-properties-of-an-item>the properties of an item</dfn> defined by the
+ element <var title="">root</var>, the user agent must try to
+ <a href=#crawl-the-properties>crawl the properties</a> of the element <var title="">root</var>, with an empty list as the value of <var title="">memory</var>: if this fails, then <a href=#the-properties-of-an-item title="the
+ properties of an item">the properties of the item</a> defined by
+ the element <var title="">root</var> is an empty list; otherwise, it
+ is the returned list.</p>
+
+ <p>To <dfn id=crawl-the-properties>crawl the properties</dfn> of an element <var title="">root</var> with a list <var title="">memory</var>, the user
+ agent must run the following steps. These steps either fail or
+ return a list with a count of errors. The count of errors is used as
+ part of the authoring conformance criteria below.</p>
+
+ <ol><li><p>If <var title="">root</var> is in <var title="">memory</var>, then the algorithm fails; abort these
+ steps.</li>
+
+ <li><p><a href=#collect-all-the-elements-in-the-item>Collect all the elements in the item</a> <var title="">root</var>; let <var title="">results</var> be the
+ resulting list of elements, and <var title="">errors</var> be the
+ resulting count of errors.</li>
+
+ <li><p>Remove any elements from <var title="">results</var> that do
+ not have an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute
+ specified.</li>
+
+ <li><p>Let <var title="">new memory</var> be a new list consisting
+ of the old list <var title="">memory</var> with the addition of
+ <var title="">root</var>.</li>
+
+ <li><p>For each element in <var title="">results</var> that has an
+ <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute specified,
+ <a href=#crawl-the-properties>crawl the properties</a> of the element, with <var title="">new memory</var> as the memory. If this fails, then remove
+ the element from <var title="">results</var> and increment <var title="">errors</var>. (If it succeeds, the return value is
+ discarded.)</li>
+
+ <li><p>Sort <var title="">results</var> in <a href=#tree-order>tree
+ order</a>.</li>
+
+ <li><p>Return <var title="">results</var> and <var title="">errors</var>.</li>
+
+ </ol><p>To <dfn id=collect-all-the-elements-in-the-item>collect all the elements in the item</dfn> <var title="">root</var>, the user agent must run these steps. They
+ return a list of elements and a count of errors.</p>
+
+ <ol><li><p>Let <var title="">results</var> and <var title="">pending</var> be empty lists of elements.</li>
+
+ <li><p>Let <var title="">errors</var> be zero.</li>
+
+ <li><p>Add all the children elements of <var title="">root</var> to
+ <var title="">pending</var>.</li>
+
+ <li><p>If <var title="">root</var> has an <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute, <a href=#split-a-string-on-spaces title="split a
+ string on spaces">split the value of that <code title=attr-itemref>itemref</code> attribute on spaces</a>. For
+ each resulting token <var title="">ID</var>, if there is an element
+ in the <a href=#home-subtree>home subtree</a> of <var title="">root</var> with
+ the <a href=#concept-id title=concept-ID>ID</a> <var title="">ID</var>, then
+ add the first such element to <var title="">pending</var>.</li>
+
+ <li><p><i>Loop</i>: Remove an element from <var title="">pending</var> and let <var title="">current</var> be that
+ element.</li>
+
+ <li><p>If <var title="">current</var> is already in <var title="">results</var>, increment <var title="">errors</var>.</li>
+
+ <li><p>If <var title="">current</var> is not already in <var title="">results</var> and <var title="">current</var> does not
+ have an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute,
+ then: add all the child elements of <var title="">current</var> to
+ <var title="">pending</var>.</li>
+
+ <li><p>If <var title="">current</var> is not already in <var title="">results</var>, then: add <var title="">current</var> to
+ <var title="">results</var>.</li>
+
+ <li><p><i>End of loop</i>: If <var title="">pending</var> is not
+ empty, return to the step labeled <i>loop</i>.</li>
+
+ <li><p>Return <var title="">results</var> and <var title="">errors</var>.</li>
+
+ </ol><p>An <a href=#concept-item title=concept-item>item</a> is a <dfn id=top-level-microdata-items title="top-level microdata items">top-level microdata item</dfn> if
+ its element does not have an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute.</p>
+
+ <p>An <a href=#concept-item title=concept-item>item</a> is a <dfn id=used-microdata-items title="used
+ microdata items">used microdata item</dfn> if it is a <a href=#top-level-microdata-items title="top-level microdata items">top-level microdata item</a>,
+ or if it has an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code>
+ attribute and would be <a href=#the-properties-of-an-item title="the properties of an item">found
+ to be the property</a> of an <a href=#concept-item title=concept-item>item</a> that is itself a <a href=#used-microdata-items title="used
+ microdata items">used microdata item</a>.</p>
+
+ <p>A document must not contain any <a href=#concept-item title=concept-item>items</a> that are not <a href=#used-microdata-items>used microdata
+ items</a>.</p>
+
+ <p>A document must not contain any elements that have an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute that would not be
+ found to be a property of any of the <a href=#concept-item title=concept-item>items</a> in that document were their <a href=#the-properties-of-an-item title="the properties of an item">properties</a> all to be
+ determined.</p>
+
+ <p>A document must not contain any <a href=#concept-item title=concept-item>items</a> for which <a href=#crawl-the-properties title="crawl the
+ properties">crawling the properties</a> of the element, with an
+ empty list as the value of <var title="">memory</var>, either fails
+ or returns an error count other than zero.</p>
+
+ <p class=note>The algorithms in this section are especially
+ inefficient, in the interests of keeping them easy to
+ understand. Implementors are strongly encouraged to refactor and
+ optimize them in their user agents.</p>
+
+ <div class=example>
+
+ <p>In this example, a single license statement is applied to two
+ works, using <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> from the
+ items representing the works:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Photo gallery&lt;/title&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;h1&gt;My photos&lt;/h1&gt;
+ &lt;figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses"&gt;
+ &lt;img itemprop="work" src="images/house.jpeg" alt="A white house, boarded up, sits in a forest."&gt;
+ &lt;figcaption itemprop="title"&gt;The house I found.&lt;/figcaption&gt;
+ &lt;/figure&gt;
+ &lt;figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses"&gt;
+ &lt;img itemprop="work" src="images/mailbox.jpeg" alt="Outside the house is a mailbox. It has a leaflet inside."&gt;
+ &lt;figcaption itemprop="title"&gt;The mailbox.&lt;/figcaption&gt;
+ &lt;/figure&gt;
+ &lt;footer&gt;
+ &lt;p id="licenses"&gt;All images licensed under the &lt;a itemprop="license"
+ href="http://www.opensource.org/licenses/mit-license.php"&gt;MIT
+ license&lt;/a&gt;.&lt;/p&gt;
+ &lt;/footer&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>The above results in two items with the type "<code title="">http://n.whatwg.org/work</code>", one with:</p>
+
+ <dl class=brief><dt>work
+ <dd><code title="">images/house.jpeg</code>
+ <dt>title
+ <dd>The house I found.
+ <dt>license
+ <dd><code title="">http://www.opensource.org/licenses/mit-license.php</code>
+ </dl><p>...and one with:</p>
+
+ <dl class=brief><dt>work
+ <dd><code title="">images/mailbox.jpeg</code>
+ <dt>title
+ <dd>The mailbox.
+ <dt>license
+ <dd><code title="">http://www.opensource.org/licenses/mit-license.php</code>
+ </dl></div>
+
+
+
+ <h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>
+
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-getItems><a href=#dom-document-getitems>getItems</a></code>( [ <var title="">types</var> ] )</dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#nodelist>NodeList</a></code> of the elements in the <code><a href=#document>Document</a></code> that create <a href=#concept-item title=concept-item>items</a>, that are not part of other <a href=#concept-item title=concept-item>items</a>, and that are of one of the types given in the argument, if any are listed.</p>
+
+ <p>The <var title="">types</var> argument is interpreted as a space-separated list of types.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-properties><a href=#dom-properties>properties</a></code></dt>
+
+ <dd>
+
+ <p>If the element has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute, returns an
+ <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> object with all the element's
+ properties. Otherwise, an empty
+ <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> object.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the element's <a href=#concept-property-value title=concept-property-value>value</a>.</p>
+
+ <p>Can be set, to change the element's <a href=#concept-property-value title=concept-property-value>value</a>. Setting the <a href=#concept-property-value title=concept-property-value>value</a> when the element has
+ no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute or when
+ the element's value is an <a href=#concept-item title=concept-item>item</a>
+ throws an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-getitems title=dom-document-getItems><code>document.getItems(<var title="">typeNames</var>)</code></dfn> method takes an optional
+ string that contains an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique
+ space-separated tokens</a> representing types. When called, the
+ method must return a <a href=#live>live</a> <code><a href=#nodelist>NodeList</a></code> object
+ containing all the elements in the document, in <a href=#tree-order>tree
+ order</a>, that are each <a href=#top-level-microdata-items>top-level microdata items</a>
+ with a <a href=#item-type title="item type">type</a> equal to one of the types
+ specified in that argument, having obtained the types by <a href=#split-a-string-on-spaces title="split a string on spaces">splitting the string on
+ spaces</a>. If there are no tokens specified in the argument, or
+ if the argument is missing, then the method must return a
+ <code><a href=#nodelist>NodeList</a></code> containing all the <a href=#top-level-microdata-items>top-level microdata
+ items</a> in the document.
+ When the method is invoked on a <code><a href=#document>Document</a></code> object again
+ with the same argument, the user agent may return the same object as
+ the object returned by the earlier call. In other cases, a new
+ <code><a href=#nodelist>NodeList</a></code> object must be returned.</p>
+
+ <p>The <dfn id=dom-itemscope title=dom-itemScope><code>itemScope</code></dfn> IDL
+ attribute on <a href=#html-elements>HTML elements</a> must <a href=#reflect>reflect</a>
+ the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> content attribute.
+ The <dfn id=dom-itemtype title=dom-itemType><code>itemType</code></dfn> IDL
+ attribute on <a href=#html-elements>HTML elements</a> must <a href=#reflect>reflect</a>
+ the <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> content attribute,
+ as if it was a regular string attribute, not a <a href=#url>URL</a>
+ string attribute. The <dfn id=dom-itemid title=dom-itemId><code>itemId</code></dfn> IDL attribute on
+ <a href=#html-elements>HTML elements</a> must <a href=#reflect>reflect</a> the <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> content attribute. The <dfn id=dom-itemprop title=dom-itemProp><code>itemProp</code></dfn> IDL attribute on
+ <a href=#html-elements>HTML elements</a> must <a href=#reflect>reflect</a> the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> content attribute. The <dfn id=dom-itemref title=dom-itemRef><code>itemRef</code></dfn> IDL attribute on
+ <a href=#html-elements>HTML elements</a> must <a href=#reflect>reflect</a> the <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-properties title=dom-properties><code>properties</code></dfn> IDL
+ attribute on <a href=#html-elements>HTML elements</a> must return an
+ <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only elements that
+ have <a href=#property-names>property names</a> and are <a href=#the-properties-of-an-item title="the properties
+ of an item">the properties of the item</a> created by the element
+ on which the attribute was invoked, while that element is an <a href=#concept-item title=concept-item>item</a>, and matches nothing the rest of
+ the time.</p>
+
+ <p>The <dfn id=dom-itemvalue title=dom-itemValue><code>itemValue</code></dfn> IDL
+ attribute's behavior depends on the element, as follows:</p>
+
+ <dl><dt>If the element has no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute</dt>
+
+ <dd><p>The attribute must return null on getting and must throw an
+ <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception on setting.</p>
+
+
+ <dt>If the element has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute</dt>
+
+ <dd><p>The attribute must return the element itself on getting and
+ must throw an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception on
+ setting.</p>
+
+
+ <dt>If the element is a <code><a href=#meta>meta</a></code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> content
+ attribute.</dd>
+
+
+ <dt>If the element is an <code><a href=#audio>audio</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-source-element>source</a></code>, or
+ <code><a href=#video>video</a></code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title="">src</code> content attribute.</dd>
+
+
+ <dt>If the element is an <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, or
+ <code><a href=#the-link-element>link</a></code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title="">href</code> content attribute.</dd>
+
+
+ <dt>If the element is an <code><a href=#the-object-element>object</a></code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title="">data</code> content attribute.</dd>
+
+
+ <dt>If the element is a <code><a href=#the-time-element>time</a></code> element with a <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute</dt>
+
+ <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content
+ attribute.</dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd><p>The attribute must act the same as the element's
+ <code><a href=#textcontent>textContent</a></code> attribute.</dd>
+
+ </dl><p>When the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL
+ attribute is <a href=#reflect title=reflect>reflecting</a> a content
+ attribute or acting like the element's <code><a href=#textcontent>textContent</a></code>
+ attribute, the user agent must, on setting, convert the new value to
+ the IDL <code title="">DOMString</code> value before using it
+ according to the mappings described above.</p>
+
+ </div>
+
+ <div class=exmaple>
+
+ <p>In this example, a script checks to see if a particular element
+ <var title="">element</var> is declaring a particular property, and
+ if it is, it increments a counter:</p>
+
+ <pre>if (element.itemProp.contains('color'))
+ count += 1;</pre>
+
+ </div>
+
+ <div class=exmaple>
+
+ <p>This script iterates over each of the values of an element's
+ <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute, calling a
+ function for each referenced element:</p>
+
+ <pre>for (var index = 0; index &lt; element.itemRef.length; index += 1)
+ process(document.getElementById(element.itemRef[index]));</pre>
+
+ </div>
+
+
+
+
+ <h3 id=mdvocabs><span class=secno>5.4 </span>Microdata vocabularies</h3>
+
+
+
+ <h4 id=vcard><span class=secno>5.4.1 </span>vCard</h4>
+
+
+
+ <p>An item with the <a href=#item-type>item type</a> <dfn id=md-vcard title=md-vcard><code>http://microformats.org/profile/hcard</code></dfn>
+ represents a person's or organization's contact information.</p>
+
+ <p>This vocabulary <a href=#support-global-identifiers-for-items title="support global identifiers for
+ items">supports global identifiers for items</a>.</p>
+
+ <p>The following are the type's <a href=#defined-property-name title="defined property
+ name">defined property names</a>. They are based on the
+ vocabulary defined in the vCard specification and its extensions,
+ where more information on how to interpret the values can be
+ found. <a href=#refsRFC2426>[RFC2426]</a> <a href=#refsRFC4770>[RFC4770]</a></p>
+
+ <dl><dt><dfn id=md-vcard-fn title=md-vcard-fn><code>fn</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the formatted text corresponding to the name of the
+ person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Exactly one property with the name <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> must be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-n title=md-vcard-n><code>n</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the structured name of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#concept-item title=concept-item>item</a> with zero or more of
+ each of the <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code>, <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code>, <code title=md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code>, <code title=md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>, and
+ <code title=md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code>
+ properties.</p>
+
+ <p>Exactly one property with the name <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> must be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-n-family-name title=md-vcard-n-family-name><code>family-name</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the family name of the person, or the full name of the
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> may be present
+ within the <a href=#concept-item title=concept-item>item</a> that forms the
+ <a href=#concept-property-value title=concept-property-value>value</a> of the <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-n-given-name title=md-vcard-n-given-name><code>given-name</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the given-name of the person.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> may be present
+ within the <a href=#concept-item title=concept-item>item</a> that forms the
+ <a href=#concept-property-value title=concept-property-value>value</a> of the <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-n-additional-name title=md-vcard-n-additional-name><code>additional-name</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the any additional names of the person.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code> may be
+ present within the <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of the
+ <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-n-honorific-prefix title=md-vcard-n-honorific-prefix><code>honorific-prefix</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the honorific prefix of the person.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code> may be
+ present within the <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of the
+ <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-n-honorific-suffix title=md-vcard-n-honorific-suffix><code>honorific-suffix</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the honorific suffix of the person.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code> may be
+ present within the <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of the
+ <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-nickname title=md-vcard-nickname><code>nickname</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the nickname of the person or organization.</p>
+
+ <!-- copied from vCard -->
+ <p class=note>The nickname is the descriptive name given instead
+ of or in addition to the one belonging to a person, place, or
+ thing. It can also be used to specify a familiar form of a proper
+ name specified by the <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> or <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> properties.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-nickname><a href=#md-vcard-nickname>nickname</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-photo title=md-vcard-photo><code>photo</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a photograph of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-photo><a href=#md-vcard-photo>photo</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-bday title=md-vcard-bday><code>bday</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the birth date of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be a
+ <a href=#valid-date-string>valid date string</a>.</p>
+
+ <p>A single property with the name <code title=md-vcard-bday><a href=#md-vcard-bday>bday</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-adr title=md-vcard-adr><code>adr</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the delivery address of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#concept-item title=concept-item>item</a> with zero or more <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code>, <code title=md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code>, <code title=md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code>, and
+ <code title=md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code>
+ properties, and optionally a <code title=md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> property, optionally
+ a <code title=md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> property,
+ optionally a <code title=md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> property, and
+ optionally a <code title=md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code>
+ property.</p>
+
+ <p>If no <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> properties
+ are present within an <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
+ <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, then the <a href=#address-type-strings>address type
+ strings</a> <code title=mv-vcard-type-adr-intl>intl</code>,
+ <code title=mv-vcard-type-adr-postal>postal</code>, <code title=mv-vcard-type-adr-parcel>parcel</code>, and <code title=mv-vcard-type-adr-work>work</code> are implied.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-type title=md-vcard-adr-type><code>type</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the type of delivery address.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
+ is equal to one of the <a href=#address-type-strings>address type strings</a>.</p>
+
+ <p>Within each <a href=#concept-item title=concept-item>item</a> with the
+ type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, there must be no more
+ than one <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property <a href=#concept-item title=concept-item>item</a> with a <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> property whose value is
+ <code title=md-vcard-type-adr-pref><a href=#md-vcard-type-adr-pref>pref</a></code>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> may be present within the
+ <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property <a href=#concept-item title=concept-item>item</a> there must only be one <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> property per distinct
+ value.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-post-office-box title=md-vcard-adr-post-office-box><code>post-office-box</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the post office box component of the delivery address of
+ the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code> may be
+ present within the <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
+ <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-extended-address title=md-vcard-adr-extended-address><code>extended-address</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives an additional component of the delivery address of the
+ person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code> may
+ be present within the <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
+ <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-street-address title=md-vcard-adr-street-address><code>street-address</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the street address component of the delivery address of
+ the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code> may be
+ present within the <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
+ <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-locality title=md-vcard-adr-locality><code>locality</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the locality component (e.g. city) of the delivery
+ address of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>A single property with the name <code title=md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> may be present
+ within the <a href=#concept-item title=concept-item>item</a> that forms the
+ <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-region title=md-vcard-adr-region><code>region</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the region component (e.g. state or province) of the
+ delivery address of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>A single property with the name <code title=md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> may be present within
+ the <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-postal-code title=md-vcard-adr-postal-code><code>postal-code</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the postal code component of the delivery address of the
+ person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>A single property with the name <code title=md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> may be present
+ within the <a href=#concept-item title=concept-item>item</a> that forms the
+ <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-adr-country-name title=md-vcard-adr-country-name><code>country-name</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the country name component of the delivery address of the
+ person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>A single property with the name <code title=md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code> may be
+ present within the <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
+ <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-label title=md-vcard-label><code>label</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the formatted text corresponding to the delivery address
+ of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ either text or an <a href=#concept-item title=concept-item>item</a> with zero
+ or more <code title=md-vcard-label-type><a href=#md-vcard-label-type>type</a></code> properties
+ and exactly one <code title=md-vcard-label-value><a href=#md-vcard-label-value>value</a></code>
+ property.</p>
+
+ <p>If no <code title=md-vcard-label-type><a href=#md-vcard-label-type>type</a></code> properties
+ are present within an <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of a
+ <code title=md-vcard-label><a href=#md-vcard-label>label</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or if the <a href=#concept-property-value title=concept-property-value>value</a> of such a <code title=md-vcard-label><a href=#md-vcard-label>label</a></code> property is text, then the
+ <a href=#address-type-strings>address type strings</a> <code title=mv-vcard-type-adr-intl>intl</code>, <code title=mv-vcard-type-adr-postal>postal</code>, <code title=mv-vcard-type-adr-parcel>parcel</code>, and <code title=mv-vcard-type-adr-work>work</code> are implied.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-label><a href=#md-vcard-label>label</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-label-type title=md-vcard-label-type><code>type</code></dfn> (inside <code title=md-vcard-label><a href=#md-vcard-label>label</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the type of delivery address.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
+ is equal to one of the <a href=#address-type-strings>address type strings</a>.</p>
+
+ <p>Within each <a href=#concept-item title=concept-item>item</a> with the
+ type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, there must be no more
+ than one <code title=md-vcard-label><a href=#md-vcard-label>label</a></code> property <a href=#concept-item title=concept-item>item</a> with a <code title=md-vcard-label-type><a href=#md-vcard-label-type>type</a></code> property whose value is
+ <code title=md-vcard-type-adr-pref><a href=#md-vcard-type-adr-pref>pref</a></code>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-label-type><a href=#md-vcard-label-type>type</a></code> may be present within the
+ <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of a <code title=md-vcard-label><a href=#md-vcard-label>label</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code title=md-vcard-label><a href=#md-vcard-label>label</a></code> property <a href=#concept-item title=concept-item>item</a> there must only be one <code title=md-vcard-label-type><a href=#md-vcard-label-type>type</a></code> property per distinct
+ value.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-label-value title=md-vcard-label-value><code>value</code></dfn> (inside <code title=md-vcard-label><a href=#md-vcard-label>label</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the actual formatted text corresponding to the delivery
+ address of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Exactly one property with the name <code title=md-vcard-label-value><a href=#md-vcard-label-value>value</a></code> must be present within
+ the <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of a <code title=md-vcard-label><a href=#md-vcard-label>label</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-tel title=md-vcard-tel><code>tel</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the telephone number of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ either text that can be interpreted as a telephone number as
+ defined in the CCITT specifications E.163 and X.121, or an <a href=#concept-item title=concept-item>item</a> with zero or more <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> properties and exactly one
+ <code title=md-vcard-tel-value><a href=#md-vcard-tel-value>value</a></code> property. <a href=#refsE163>[E163]</a> <a href=#refsX121>[X121]</a></p>
+
+ <p>If no <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> properties
+ are present within an <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of a
+ <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or if the <a href=#concept-property-value title=concept-property-value>value</a> of such a <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property is text, then the <a href=#telephone-type-strings title="telephone type strings">telephone type string</a> <code title=mv-vcard-type-tel-voice>voice</code> is implied.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-tel-type title=md-vcard-tel-type><code>type</code></dfn> (inside <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the type of telephone number.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
+ is equal to one of the <a href=#telephone-type-strings>telephone type strings</a>.</p>
+
+ <p>Within each <a href=#concept-item title=concept-item>item</a> with the
+ type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, there must be no more
+ than one <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property <a href=#concept-item title=concept-item>item</a> with a <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> property whose value is
+ <code title=md-vcard-type-tel-pref><a href=#md-vcard-type-tel-pref>pref</a></code>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> may be present within the
+ <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of a <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property <a href=#concept-item title=concept-item>item</a> there must only be one <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> property per distinct
+ value.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-tel-value title=md-vcard-tel-value><code>value</code></dfn> (inside <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the actual telephone number of the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that can be interpreted as a telephone number as defined in
+ the CCITT specifications E.163 and X.121. <a href=#refsE163>[E163]</a> <a href=#refsX121>[X121]</a></p>
+
+ <p>Exactly one property with the name <code title=md-vcard-tel-value><a href=#md-vcard-tel-value>value</a></code> must be present within the
+ <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of a <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-email title=md-vcard-email><code>email</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the e-mail address of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ either text or an <a href=#concept-item title=concept-item>item</a> with zero
+ or more <code title=md-vcard-email-type><a href=#md-vcard-email-type>type</a></code> properties
+ and exactly one <code title=md-vcard-email-value><a href=#md-vcard-email-value>value</a></code>
+ property.</p>
+
+ <p>If no <code title=md-vcard-email-type><a href=#md-vcard-email-type>type</a></code> properties
+ are present within an <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
+ <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or if the <a href=#concept-property-value title=concept-property-value>value</a> of such an <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> property is text, then the
+ <a href=#e-mail-type-strings title="e-mail type strings">e-mail type string</a> <code title=mv-vcard-type-email-internet>internet</code> is
+ implied.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-email-type title=md-vcard-email-type><code>type</code></dfn> (inside <code title=md-vcard-email><a href=#md-vcard-email>email</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the type of e-mail address.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
+ is equal to one of the <a href=#e-mail-type-strings>e-mail type strings</a>.</p>
+
+ <p>Within each <a href=#concept-item title=concept-item>item</a> with the
+ type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, there must be no more
+ than one <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> property <a href=#concept-item title=concept-item>item</a> with a <code title=md-vcard-email-type><a href=#md-vcard-email-type>type</a></code> property whose value is
+ <code title=md-vcard-type-email-pref><a href=#md-vcard-type-email-pref>pref</a></code>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-email-type><a href=#md-vcard-email-type>type</a></code> may be present within the
+ <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> property <a href=#concept-item title=concept-item>item</a> there must only be one <code title=md-vcard-email-type><a href=#md-vcard-email-type>type</a></code> property per distinct
+ value.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-email-value title=md-vcard-email-value><code>value</code></dfn> (inside <code title=md-vcard-email><a href=#md-vcard-email>email</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the actual e-mail address of the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Exactly one property with the name <code title=md-vcard-email-value><a href=#md-vcard-email-value>value</a></code> must be present within
+ the <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-mailer title=md-vcard-mailer><code>mailer</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the name of the e-mail software used by the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-mailer><a href=#md-vcard-mailer>mailer</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-tz title=md-vcard-tz><code>tz</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the time zone of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text and must match the following syntax:</p>
+
+ <ol><li>Either a U+002B PLUS SIGN character (+) or a U+002D
+ HYPHEN-MINUS character (-).</li>
+
+ <li>A <a href=#valid-non-negative-integer>valid non-negative integer</a> that is exactly two
+ digits long and that represents a number in the range
+ 00..23.</li>
+
+ <li>A U+003A COLON character (:).</li>
+
+ <li>A <a href=#valid-non-negative-integer>valid non-negative integer</a> that is exactly two
+ digits long and that represents a number in the range
+ 00..59.</li>
+
+ </ol><p>Any number of properties with the name <code title=md-vcard-tz><a href=#md-vcard-tz>tz</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-geo title=md-vcard-geo><code>geo</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the geographical position of the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text and must match the following syntax:</p>
+
+ <ol><li>Optionally, either a U+002B PLUS SIGN character (+) or a
+ U+002D HYPHEN-MINUS character (-).</li>
+
+ <li>One or more digits in the range U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9).</li>
+
+ <li>Optionally*, a U+002E FULL STOP character (.) followed by one
+ or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9).</li>
+
+ <li>A U+003B SEMICOLON character (;).</li>
+
+ <li>Optionally, either a U+002B PLUS SIGN character (+) or a
+ U+002D HYPHEN-MINUS character (-).</li>
+
+ <li>One or more digits in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9).</li>
+
+ <li>Optionally*, a U+002E FULL STOP character (.) followed by one
+ or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9).</li>
+
+ </ol><p>The optional components marked with an asterisk (*) should be
+ included, and should have six digits each.</p>
+
+ <!-- copied from vCard -->
+ <p class=note>The value specifies latitude and longitude, in
+ that order (i.e., "LAT LON" ordering), in decimal degrees. The
+ longitude represents the location east and west of the prime
+ meridian as a positive or negative real number, respectively. The
+ latitude represents the location north and south of the equator as
+ a positive or negative real number, respectively.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-geo><a href=#md-vcard-geo>geo</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-title title=md-vcard-title><code>title</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the job title, functional position or function of the
+ person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-title><a href=#md-vcard-title>title</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-role title=md-vcard-role><code>role</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the role, occupation, or business category of the person
+ or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-role><a href=#md-vcard-role>role</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-logo title=md-vcard-logo><code>logo</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the logo of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-logo><a href=#md-vcard-logo>logo</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-agent title=md-vcard-agent><code>agent</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the contact information of another person who will act on
+ behalf of the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ either an <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or an <a href=#absolute-url>absolute
+ URL</a>, or text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-agent><a href=#md-vcard-agent>agent</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-org title=md-vcard-org><code>org</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the name and units of the organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ either text or an <a href=#concept-item title=concept-item>item</a> with one
+ <code title=md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code>
+ property and zero or more <code title=md-vcard-n-organization-unit>organization-unit</code>
+ properties.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-org><a href=#md-vcard-org>org</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-org-organization-name title=md-vcard-org-organization-name><code>organization-name</code></dfn> (inside <code title=md-vcard-org><a href=#md-vcard-org>org</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the name of the organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Exactly one property with the name <code title=md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code>
+ must be present within the <a href=#concept-item title=concept-item>item</a>
+ that forms the <a href=#concept-property-value title=concept-property-value>value</a>
+ of an <code title=md-vcard-org><a href=#md-vcard-org>org</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-org-organization-unit title=md-vcard-org-organization-unit><code>organization-unit</code></dfn> (inside <code title=md-vcard-org><a href=#md-vcard-org>org</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the name of the organization unit.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-org-organization-unit><a href=#md-vcard-org-organization-unit>organization-unit</a></code>
+ may be present within the <a href=#concept-item title=concept-item>item</a>
+ that forms the <a href=#concept-property-value title=concept-property-value>value</a>
+ of the <code title=md-vcard-org><a href=#md-vcard-org>org</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-categories title=md-vcard-categories><code>categories</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the name of a category or tag that the person or
+ organization could be classified as.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-categories><a href=#md-vcard-categories>categories</a></code> may be present
+ within each <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-note title=md-vcard-note><code>note</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives supplemental information or a comment about the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-note><a href=#md-vcard-note>note</a></code> may be present
+ within each <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <!-- PRODID not included -->
+
+
+ <dt><dfn id=md-vcard-rev title=md-vcard-rev><code>rev</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the revision date and time of the contact
+ information.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>
+
+ <!-- copied from vCard -->
+ <p class=note>The value distinguishes the current revision of
+ the information for other renditions of the information.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-rev><a href=#md-vcard-rev>rev</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-sort-string title=md-vcard-sort-string><code>sort-string</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the string to be used for sorting the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-sort-string><a href=#md-vcard-sort-string>sort-string</a></code> may be present
+ within each <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vcard-sound title=md-vcard-sound><code>sound</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a sound file relating to the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-sound><a href=#md-vcard-sound>sound</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <!-- UID not included - use "itemid" -->
+
+
+ <dt><dfn id=md-vcard-url title=md-vcard-url><code>url</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a <a href=#url>URL</a> relating to the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-url><a href=#md-vcard-url>url</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <!-- VERSION not included - always 3.0 -->
+
+
+ <dt><dfn id=md-vcard-class title=md-vcard-class><code>class</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the access classification of the information regarding
+ the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text with one of the following values:</p>
+
+ <ul class=brief><li><code title="">public</code></li>
+ <li><code title="">private</code></li>
+ <li><code title="">confidential</code></li>
+ </ul><p class=warning>This is merely advisory and cannot be
+ considered a confidentiality measure.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-class><a href=#md-vcard-class>class</a></code> may be present
+ within each <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ <!-- KEY not included - no way to include binary data at this time -->
+
+
+ <!-- IMPP is from RFC4770 -->
+
+ <dt><dfn id=md-vcard-impp title=md-vcard-impp><code>impp</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a <a href=#url>URL</a> for instant messaging and presence
+ protocol communications with the person or organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ either an <a href=#absolute-url>absolute URL</a> or an <a href=#concept-item title=concept-item>item</a> with zero or more <code title=md-vcard-impp-type><a href=#md-vcard-impp-type>type</a></code> properties and exactly one
+ <code title=md-vcard-impp-value><a href=#md-vcard-impp-value>value</a></code> property.</p>
+
+ <p>If no <code title=md-vcard-impp-type><a href=#md-vcard-impp-type>type</a></code> properties
+ are present within an <a href=#concept-item title=concept-item>item</a> that
+ forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
+ <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or if the <a href=#concept-property-value title=concept-property-value>value</a> of such an <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> property is an <a href=#absolute-url>absolute
+ URL</a>, then no <a href=#impp-type-strings>IMPP type strings</a> are
+ implied.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-impp-type title=md-vcard-impp-type><code>type</code></dfn> (inside <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the intended use of the IMPP <a href=#url>URL</a>.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
+ is equal to one of the <a href=#impp-type-strings>IMPP type strings</a>.</p>
+
+ <p>Within each <a href=#concept-item title=concept-item>item</a> with the
+ type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, there must be no more
+ than one <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> property <a href=#concept-item title=concept-item>item</a> with a <code title=md-vcard-impp-type><a href=#md-vcard-impp-type>type</a></code> property whose value is
+ <code title=md-vcard-type-impp-pref><a href=#md-vcard-type-impp-pref>pref</a></code>.</p>
+
+ <p>Any number of properties with the name <code title=md-vcard-impp-type><a href=#md-vcard-impp-type>type</a></code> may be present within the
+ <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> property <a href=#concept-item title=concept-item>item</a> there must only be one <code title=md-vcard-impp-type><a href=#md-vcard-impp-type>type</a></code> property per distinct
+ value.</p>
+
+ </dd>
+
+ <dt><dfn id=md-vcard-impp-value title=md-vcard-impp-value><code>value</code></dfn> (inside <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code>)</dt>
+
+ <dd>
+
+ <p>Gives the actual <a href=#url>URL</a> for instant messaging and
+ presence protocol communications with the person or
+ organization.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Exactly one property with the name <code title=md-vcard-impp-value><a href=#md-vcard-impp-value>value</a></code> must be present within
+ the <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
+
+ </dd>
+
+
+ </dl><p>The <dfn id=address-type-strings>address type strings</dfn> are:</p>
+
+ <dl><dt><dfn id=md-vcard-type-adr-dom title=md-vcard-type-adr-dom><code>dom</code></dfn></dt>
+ <dd>
+ <p>Indicates a domestic delivery address.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-adr-intl title=md-vcard-type-adr-intl><code>intl</code></dfn></dt>
+ <dd>
+ <p>Indicates an international delivery address.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-adr-postal title=md-vcard-type-adr-postal><code>postal</code></dfn></dt>
+ <dd>
+ <p>Indicates a postal delivery address.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-adr-parcel title=md-vcard-type-adr-parcel><code>parcel</code></dfn></dt>
+ <dd>
+ <p>Indicates a parcel delivery address.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-adr-home title=md-vcard-type-adr-home><code>home</code></dfn></dt>
+ <dd>
+ <p>Indicates a residential delivery address.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-adr-work title=md-vcard-type-adr-work><code>work</code></dfn></dt>
+ <dd>
+ <p>Indicates a delivery address for a place of work.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-adr-pref title=md-vcard-type-adr-pref><code>pref</code></dfn></dt>
+ <dd>
+
+ <p>Indicates the preferred delivery address when multiple
+ addresses are specified.</p>
+
+ </dd>
+
+ </dl><p>The <dfn id=telephone-type-strings>telephone type strings</dfn> are:</p>
+
+ <dl><dt><dfn id=md-vcard-type-tel-home title=md-vcard-type-tel-home><code>home</code></dfn></dt>
+ <dd>
+ <p>Indicates a residential number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-msg title=md-vcard-type-tel-msg><code>msg</code></dfn></dt>
+ <dd>
+ <p>Indicates a telephone number with voice messaging support.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-work title=md-vcard-type-tel-work><code>work</code></dfn></dt>
+ <dd>
+ <p>Indicates a telephone number for a place of work.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-voice title=md-vcard-type-tel-voice><code>voice</code></dfn></dt>
+ <dd>
+ <p>Indicates a voice telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-fax title=md-vcard-type-tel-fax><code>fax</code></dfn></dt>
+ <dd>
+ <p>Indicates a facsimile telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-cell title=md-vcard-type-tel-cell><code>cell</code></dfn></dt>
+ <dd>
+ <p>Indicates a cellular telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-video title=md-vcard-type-tel-video><code>video</code></dfn></dt>
+ <dd>
+ <p>Indicates a video conferencing telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-pager title=md-vcard-type-tel-pager><code>pager</code></dfn></dt>
+ <dd>
+ <p>Indicates a paging device telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-bbs title=md-vcard-type-tel-bbs><code>bbs</code></dfn></dt>
+ <dd>
+ <p>Indicates a bulletin board system telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-modem title=md-vcard-type-tel-modem><code>modem</code></dfn></dt>
+ <dd>
+ <p>Indicates a MODEM-connected telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-car title=md-vcard-type-tel-car><code>car</code></dfn></dt>
+ <dd>
+ <p>Indicates a car-phone telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-isdn title=md-vcard-type-tel-isdn><code>isdn</code></dfn></dt>
+ <dd>
+ <p>Indicates an ISDN service telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-pcs title=md-vcard-type-tel-pcs><code>pcs</code></dfn></dt>
+ <dd>
+ <p>Indicates a personal communication services telephone number.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-tel-pref title=md-vcard-type-tel-pref><code>pref</code></dfn></dt>
+ <dd>
+
+ <p>Indicates the preferred telephone number when multiple
+ telephone numbers are specified.</p>
+
+ </dd>
+
+ </dl><p>The <dfn id=e-mail-type-strings>e-mail type strings</dfn> are:</p>
+
+ <dl><dt><dfn id=md-vcard-type-email-internet title=md-vcard-type-email-internet><code>internet</code></dfn></dt>
+ <dd>
+ <p>Indicates an Internet e-mail address.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-email-x400 title=md-vcard-type-email-x400><code>x400</code></dfn></dt>
+ <dd>
+ <p>Indicates a X.400 addressing type.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-email-pref title=md-vcard-type-email-pref><code>pref</code></dfn></dt>
+ <dd>
+
+ <p>Indicates the preferred e-mail address when multiple e-mail
+ addresses are specified.</p>
+
+ </dd>
+
+ </dl><p>The <dfn id=impp-type-strings>IMPP type strings</dfn> are:</p>
+
+ <dl><dt><dfn id=md-vcard-type-impp-personal title=md-vcard-type-impp-personal><code>personal</code></dfn></dt>
+ <dt><dfn id=md-vcard-type-impp-business title=md-vcard-type-impp-business><code>business</code></dfn></dt>
+ <dd>
+ <p>Indicates the type of communication for which this IMPP
+ <a href=#url>URL</a> is appropriate.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-impp-home title=md-vcard-type-impp-home><code>home</code></dfn></dt>
+ <dt><dfn id=md-vcard-type-impp-work title=md-vcard-type-impp-work><code>work</code></dfn></dt>
+ <dt><dfn id=md-vcard-type-impp-mobile title=md-vcard-type-impp-mobile><code>mobile</code></dfn></dt>
+ <dd>
+ <p>Indicates the location of a device associated with this IMPP
+ <a href=#url>URL</a>.</p>
+ </dd>
+
+ <dt><dfn id=md-vcard-type-impp-pref title=md-vcard-type-impp-pref><code>pref</code></dfn></dt>
+ <dd>
+ <p>Indicates the preferred address when multiple IMPP
+ <a href=#url>URL</a>s are specified.</p>
+ </dd>
+
+ </dl><h5 id=conversion-to-vcard><span class=secno>5.4.1.1 </span>Conversion to vCard</h5>
+
+ <p>Given a list of nodes <var title="">nodes</var> in a
+ <code><a href=#document>Document</a></code>, a user agent must run the following algorithm
+ to <dfn id=extracting-a-vcard title="extracting a vCard">extract any vCard data
+ represented by those nodes</dfn> (only the first vCard is
+ returned):</p>
+
+ <ol><li><p>If none of the nodes in <var title="">nodes</var> are <a href=#concept-item title=concept-item>items</a> with the <a href=#item-type>item type</a>
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, then
+ there is no vCard. Abort the algorithm, returning nothing.</li>
+
+ <li><p>Let <var title="">node</var> be the first node in <var title="">nodes</var> that is an <a href=#concept-item title=concept-item>item</a> with the <a href=#item-type>item type</a>
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</li>
+
+ <li><p>Let <var title="">output</var> be an empty string.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">BEGIN</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">PROFILE</code>" and the value "<code title="">VCARD</code>" to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">VERSION</code>" and the value "<code title="">3.0</code>"
+ to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">SOURCE</code>" and the result of <a href=#escaping-the-vcard-text-string>escaping the vCard
+ text string</a> that is <a href="#the-document's-current-address">the document's current
+ address</a> as the value to <var title="">output</var>.</li>
+
+ <li><p>If <a href=#the-title-element>the <code>title</code> element</a> is not null,
+ <a href=#add-a-vcard-line>add a vCard line</a> with the type "<code title="">NAME</code>" and with the result of <a href=#escaping-the-vcard-text-string>escaping the
+ vCard text string</a> obtained from the <code><a href=#textcontent>textContent</a></code>
+ of <a href=#the-title-element>the <code>title</code> element</a> as the value to <var title="">output</var>.</li>
+
+ <li><p>If <var title="">node</var> has a <a href=#global-identifier>global
+ identifier</a>, <a href=#add-a-vcard-line>add a vCard line</a> with the type
+ "<code title="">UID</code>" and with the result of <a href=#escaping-the-vcard-text-string>escaping
+ the vCard text string</a> of that <a href=#global-identifier>global identifier</a>
+ as the value to <var title="">output</var>.</li>
+
+ <li>
+
+ <p>For each element <var title="">element</var> that is <a href=#the-properties-of-an-item title="the properties of an item">a property of the item</a>
+ <var title="">node</var>: for each name <var title="">name</var>
+ in <var title="">element</var>'s <a href=#property-names>property names</a>, run
+ the following substeps:</p>
+
+ <ol><li><p>Let <var title="">parameters</var> be an empty set of
+ name-value pairs.</li>
+
+ <li>
+
+ <p>Run the appropriate set of substeps from the following
+ list. The steps will set a variable <var title="">value</var>,
+ which is used in the next step.</p>
+
+ <dl><dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ and <var title="">name</var> is <code title=md-vcard-n><a href=#md-vcard-n>n</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the empty
+ string.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code>
+ in <var title="">subitem</var>.</p>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ and <var title="">name</var> is <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the empty
+ string.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li><p>If there is a property named <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> in <var title="">subitem</var>, and the first such property has a
+ <a href=#concept-property-value title=concept-property-value>value</a> that is not
+ an <a href=#concept-item title=concept-item>item</a> and whose value
+ consists only of <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
+ then add a parameter named "<code title="">TYPE</code>" whose
+ value is the <a href=#concept-property-value title=concept-property-value>value</a> of that property
+ to <var title="">parameters</var>.</li>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ and <var title="">name</var> is <code title=md-vcard-org><a href=#md-vcard-org>org</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the empty
+ string.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li>
+
+ <p>For each property named <code title=md-vcard-org-organization-unit><a href=#md-vcard-org-organization-unit>organization-unit</a></code>
+ in <var title="">subitem</var>, run the following steps:</p>
+
+ <ol><li><p>If the <a href=#concept-property-value title=concept-property-value>value</a> of the property
+ is an <a href=#concept-item title=concept-item>item</a>, then skip
+ this property.</li>
+
+ <li><p>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
+ string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the property
+ to <var title="">value</var>.</li>
+
+ </ol></li>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ with the <a href=#item-type>item type</a> <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>
+ and <var title="">name</var> is <code title=md-vcard-agent><a href=#md-vcard-agent>agent</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the result of
+ <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> obtained from
+ <a href=#extracting-a-vcard>extracting a vCard</a> from the element that
+ represents <var title="">subitem</var>.</li>
+
+ <li><p>Add a parameter named "<code title="">VALUE</code>"
+ whose value is "<code title="">VCARD</code>" to <var title="">parameters</var>.</li>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> and <var title="">name</var>
+ is none of the above</dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title="">value</code> in <var title="">subitem</var>.</p>
+
+ <li><p>If there is a property named <code title="">type</code> in <var title="">subitem</var>, and the
+ first such property has a <a href=#concept-property-value title=concept-property-value>value</a> that is not an
+ <a href=#concept-item title=concept-item>item</a> and whose value
+ consists only of <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
+ then add a parameter named "<code title="">TYPE</code>" whose
+ value is the <a href=#concept-property-value title=concept-property-value>value</a> of that property
+ to <var title="">parameters</var>.</li>
+
+ </ol></dd>
+
+ <dt>Otherwise (the property's <a href=#concept-property-value title=concept-property-value>value</a> is not an <a href=#concept-item title=concept-item>item</a>)</dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the property's <a href=#concept-property-value title=concept-property-value>value</a>.</li>
+
+ <li><p>If <var title="">element</var> is one of the <a href=#url-property-elements>URL
+ property elements</a>, add a parameter with the name "<code title="">VALUE</code>" and the value "<code title="">URI</code>" to <var title="">parameters</var>.</li>
+
+ <li><p>Otherwise, if <var title="">element</var> is a
+ <code><a href=#the-time-element>time</a></code> element and the <var title="">value</var> is
+ a <a href=#valid-date-string>valid date string</a>, add a parameter with the name
+ "<code title="">VALUE</code>" and the value "<code title="">DATE</code>" to <var title="">parameters</var>.</li>
+
+ <li><p>Otherwise, if <var title="">element</var> is a
+ <code><a href=#the-time-element>time</a></code> element and the <var title="">value</var> is
+ a <a href=#valid-global-date-and-time-string>valid global date and time string</a>, add a
+ parameter with the name "<code title="">VALUE</code>" and the
+ value "<code title="">DATE-TIME</code>" to <var title="">parameters</var>.</li>
+
+ <li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in
+ <var title="">value</var> with another U+005C REVERSE SOLIDUS
+ character (\).</li>
+
+ <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Unless <var title="">name</var> is <code title=md-vcard-geo><a href=#md-vcard-geo>geo</a></code>, prefix every U+003B SEMICOLON
+ character (;) in <var title="">value</var> with a U+005C
+ REVERSE SOLIDUS character (\).</li>
+
+ <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
+ character pair (CRLF) in <var title="">value</var> with a
+ U+005C REVERSE SOLIDUS character (\) followed by a U+006E
+ LATIN SMALL LETTER N character (n).</li>
+
+ <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) character in <var title="">value</var>
+ with a U+005C REVERSE SOLIDUS character (\) followed by a
+ U+006E LATIN SMALL LETTER N character (n).</li>
+
+ </ol></dd>
+
+ </dl></li>
+
+ <li>
+
+ <p><a href=#add-a-vcard-line>Add a vCard line</a> with the type <var title="">name</var>, the parameters <var title="">parameters</var>, and the value <var title="">value</var> to <var title="">output</var>.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">END</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</li>
+
+ </ol><p>When the above algorithm says that the user agent is to <dfn id=add-a-vcard-line>add
+ a vCard line</dfn> consisting of a type <var title="">type</var>,
+ optionally some parameters, and a value <var title="">value</var> to
+ a string <var title="">output</var>, it must run the following
+ steps:</p>
+
+ <ol><li><p>Let <var title="">line</var> be an empty string.
+
+ <li><p>Append <var title="">type</var>, <a href=#converted-to-ascii-uppercase>converted to
+ ASCII uppercase</a>, to <var title="">line</var>.</li>
+
+ <li>
+
+ <p>If there are any parameters, then for each parameter, in the
+ order that they were added, run these substeps:</p>
+
+ <ol><li><p>Append a U+003B SEMICOLON character (;) to <var title="">line</var>.</li>
+
+ <li><p>Append the parameter's name to <var title="">line</var>.</li>
+
+ <li><p>Append a U+003D EQUALS SIGN character (=) to <var title="">line</var>.</li>
+
+ <li><p>Append the parameter's value to <var title="">line</var>.</li>
+
+ </ol></li>
+
+ <li><p>Append a U+003A COLON character (:) to <var title="">line</var>.</li>
+
+ <li><p>Append <var title="">value</var> to <var title="">line</var>.</li>
+
+ <li><p>Let <var title="">maximum length</var> be 75.</li>
+
+ <li>
+
+ <p>If and while <var title="">line</var> is longer than <var title="">maximum length</var> Unicode code points long, run the
+ following substeps:</p>
+
+ <ol><li><p>Append the first <var title="">maximum length</var>
+ Unicode code points of <var title="">line</var> to <var title="">output</var>.</li>
+
+ <li><p>Remove the first <var title="">maximum length</var>
+ Unicode code points from <var title="">line</var>.</li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+0020 SPACE character to <var title="">output</var>.</li>
+
+ <li><p>Let <var title="">maximum length</var> be 74.</li>
+
+ </ol></li>
+
+ <li><p>Append (what remains of) <var title="">line</var> to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>
+
+ </ol><p>When the steps above require the user agent to obtain the result
+ of <dfn id=collecting-vcard-subproperties>collecting vCard subproperties</dfn> named <var title="">subname</var> in <var title="">subitem</var>, the user
+ agent must run the following steps:</p>
+
+ <ol><li><p>Let <var title="">value</var> be the empty string.</li>
+
+ <li>
+
+ <p>For each property named <var title="">subname</var> in the item
+ <var title="">subitem</var>, run the following substeps:</p>
+
+ <ol><li><p>If the <a href=#concept-property-value title=concept-property-value>value</a>
+ of the property is itself an <a href=#concept-item title=concept-item>item</a>, then skip this
+ property.</li>
+
+ <li><p>If this is not the first property named <var title="">subname</var> in <var title="">subitem</var> (ignoring
+ any that were skipped by the previous step), then append a U+002C
+ COMMA character (,) to <var title="">value</var>.</li>
+
+ <li><p>Append the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
+ string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the property to
+ <var title="">value</var>.</li>
+
+ </ol></li>
+
+ <li><p>Return <var title="">value</var>.</li>
+
+ </ol><p>When the steps above require the user agent to obtain the result
+ of <dfn id=collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</dfn> named <var title="">subname</var> in <var title="">subitem</var>, the user
+ agent must run the following steps:</p>
+
+ <ol><li><p>If there are no properties named <var title="">subname</var>
+ in <var title="">subitem</var>, then abort these substeps,
+ returning the empty string.</li>
+
+ <li><p>If the <a href=#concept-property-value title=concept-property-value>value</a> of
+ the first property named <var title="">subname</var> in <var title="">subitem</var> is an <a href=#concept-item title=concept-item>item</a>, then abort these substeps,
+ returning the empty string.</li>
+
+ <li><p>Return the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
+ string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the first property
+ named <var title="">subname</var> in <var title="">subitem</var>.</li>
+
+ </ol><p>When the above algorithms say the user agent is to <dfn id=escaping-the-vcard-text-string title="escaping the vCard text string">escape the vCard text
+ string</dfn> <var title="">value</var>, the user agent must use the
+ following steps:</p>
+
+ <ol><li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var title="">value</var> with another U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Prefix every U+003B SEMICOLON character (;) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
+ character pair (CRLF) in <var title="">value</var> with a U+005C
+ REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
+ LETTER N character (n).</li>
+
+ <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) character in <var title="">value</var> with a
+ U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
+ SMALL LETTER N character (n).</li>
+
+ <li><p>Return the mutated <var title="">value</var>.</li>
+
+ </ol><p class=note>This algorithm can generate invalid vCard output, if
+ the input does not conform to the rules described for the <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>
+ <a href=#item-type>item type</a> and <a href=#defined-property-name title="defined property
+ name">defined property names</a>.</p> <!-- of course since vcard
+ doesn't define error handling, this is somewhat problematic. -->
+
+
+
+ <h5 id=examples-1><span class=secno>5.4.1.2 </span>Examples</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <div class=example>
+
+ <p>Here is a long example vCard for a fictional character called
+ "Jack Bauer":</p>
+
+ <pre>&lt;section id="jack" itemscope itemtype="http://microformats.org/profile/hcard"&gt;
+ &lt;h1 itemprop="fn"&gt;Jack Bauer&lt;/h1&gt;
+ &lt;div itemprop="n"&gt;
+ &lt;meta itemprop="given-name" content="Jack"&gt;
+ &lt;meta itemprop="family-name" content="Bauer"&gt;
+ &lt;/div&gt;
+ &lt;img itemprop="photo" alt="" src="jack-bauer.jpg"&gt;
+ &lt;p itemprop="org" itemscope&gt;
+ &lt;span itemprop="organization-name"&gt;Counter-Terrorist Unit&lt;/span&gt;
+ (&lt;span itemprop="organization-unit"&gt;Los Angeles Division&lt;/span&gt;)
+ &lt;/p&gt;
+ &lt;p&gt;
+ &lt;span itemprop="adr" itemscope&gt;
+ &lt;span itemprop="street-address"&gt;10201 W. Pico Blvd.&lt;/span&gt;&lt;br&gt;
+ &lt;span itemprop="locality"&gt;Los Angeles&lt;/span&gt;,
+ &lt;span itemprop="region"&gt;CA&lt;/span&gt;
+ &lt;span itemprop="postal-code"&gt;90064&lt;/span&gt;&lt;br&gt;
+ &lt;span itemprop="country-name"&gt;United States&lt;/span&gt;&lt;br&gt;
+ &lt;/span&gt;
+ &lt;span itemprop="geo"&gt;34.052339;-118.410623&lt;/span&gt;
+ &lt;/p&gt;
+ &lt;h2&gt;Assorted Contact Methods&lt;/h2&gt;
+ &lt;ul&gt;
+ &lt;li itemprop="tel" itemscope&gt;
+ &lt;span itemprop="value"&gt;+1 (310) 597 3781&lt;/span&gt; &lt;span itemprop="type"&gt;work&lt;/span&gt;
+ &lt;meta itemprop="type" content="pref"&gt;
+ &lt;/li&gt;
+ &lt;li&gt;&lt;a itemprop="url" href="http://en.wikipedia.org/wiki/Jack_Bauer"&gt;I'm on Wikipedia&lt;/a&gt;
+ so you can leave a message on my user talk page.&lt;/li&gt;
+ &lt;li&gt;&lt;a itemprop="url" href="http://www.jackbauerfacts.com/"&gt;Jack Bauer Facts&lt;/a&gt;&lt;/li&gt;
+ &lt;li itemprop="email"&gt;&lt;a href="mailto:j.bauer@la.ctu.gov.invalid"&gt;j.bauer@la.ctu.gov.invalid&lt;/a&gt;&lt;/li&gt;
+ &lt;li itemprop="tel" itemscope&gt;
+ &lt;span itemprop="value"&gt;+1 (310) 555 3781&lt;/span&gt; &lt;span&gt;
+ &lt;meta itemprop="type" content="cell"&gt;mobile phone&lt;/span&gt;
+ &lt;/li&gt;
+ &lt;/ul&gt;
+ &lt;p itemprop="note"&gt;If I'm out in the field, you may be better off contacting &lt;span
+ itemprop="agent" itemscope itemtype="http://microformats.org/profile/hcard"&gt;&lt;a
+ itemprop="email" href="mailto:c.obrian@la.ctu.gov.invalid"&gt;&lt;span
+ itemprop="fn"&gt;&lt;span itemprop="n" itemscope&gt;&lt;span
+ itemprop="given-name"&gt;Chloe&lt;/span&gt; &lt;span
+ itemprop="family=name"&gt;O'Brian&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;
+ if it's about work, or ask &lt;span itemprop="agent"&gt;Tony Almeida&lt;/span&gt;
+ if you're interested in the CTU five-a-side football team we're trying to get going.&lt;/p&gt;
+ &lt;ins datetime="2008-07-20T21:00:00+01:00"&gt;
+ &lt;span itemprop="rev" itemscope&gt;
+ &lt;meta itemprop="type" content="date-time"&gt;
+ &lt;meta itemprop="value" content="2008-07-20T21:00:00+01:00"&gt;
+ &lt;/span&gt;
+ &lt;p itemprop="tel" itemscope&gt;&lt;strong&gt;Update!&lt;/strong&gt;
+ My new &lt;span itemprop="type"&gt;home&lt;/span&gt; phone number is
+ &lt;span itemprop="value"&gt;01632 960 123&lt;/span&gt;.&lt;/p&gt;
+ &lt;/ins&gt;
+&lt;/section&gt;</pre>
+
+ <p>The odd line wrapping is needed because newlines are meaningful
+ in microdata: newlines would be preserved in a conversion to, for
+ example, the vCard format.<p>
+
+ </div>
+
+ <div class=example>
+
+ <p>This example shows a site's contact details (using the
+ <code><a href=#the-address-element>address</a></code> element) containing an address with two street
+ components:</p>
+
+ <pre>&lt;address itemscope itemtype="http://microformats.org/profile/hcard"&gt;
+ &lt;strong itemprop="fn"&gt;&lt;span itemprop="n"&gt;&lt;span itemprop="given-name"&gt;Alfred&lt;/span&gt;
+ &lt;span itemprop="family-name"&gt;Person&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt; &lt;br&gt;
+ &lt;span itemprop="adr" itemscope&gt;
+ &lt;span itemprop="street-address"&gt;1600 Amphitheatre Parkway&lt;/span&gt; &lt;br&gt;
+ &lt;span itemprop="street-address"&gt;Building 43, Second Floor&lt;/span&gt; &lt;br&gt;
+ &lt;span itemprop="locality"&gt;Mountain View&lt;/span&gt;,
+ &lt;span itemprop="region"&gt;CA&lt;/span&gt; &lt;span itemprop="postal-code"&gt;94043&lt;/span&gt;
+ &lt;/span&gt;
+&lt;/address&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The vCard vocabulary can be used to just mark up people's
+ names:</p>
+
+ <pre>&lt;span itemscope itemtype="http://microformats.org/profile/hcard"
+&gt;&lt;span itemprop=fn&gt;&lt;span itemprop="n"&gt;&lt;span itemprop="given-name"
+&gt;George&lt;/span&gt; &lt;span itemprop="family-name"&gt;Washington&lt;/span&gt;&lt;/span
+&gt;&lt;/span&gt;&lt;/span&gt;</pre>
+
+ <p>This creates a single item with a two name-value pairs, one with
+ the name "fn" and the value "George Washington", and the other with
+ the name "n" and a second item as its value, the second item having
+ the two name-value pairs "given-name" and "family-name" with the
+ values "George" and "Washington" respectively. This is defined to
+ map to the following vCard:</p>
+
+ <pre>BEGIN:VCARD
+PROFILE:VCARD
+VERSION:3.0
+SOURCE:<var title="">document's address</var>
+FN:George Washington
+N:Washington;George;;;
+END:VCARD</pre>
+
+ </div>
+
+
+
+ <h4 id=vevent><span class=secno>5.4.2 </span>vEvent</h4>
+
+
+
+ <p>An item with the <a href=#item-type>item type</a> <dfn id=md-vevent title=md-vevent><code>http://microformats.org/profile/hcalendar#vevent</code></dfn>
+ represents an event.</p>
+
+ <p>This vocabulary <a href=#support-global-identifiers-for-items title="support global identifiers for
+ items">supports global identifiers for items</a>.</p>
+
+ <p>The following are the type's <a href=#defined-property-name title="defined property
+ name">defined property names</a>. They are based on the
+ vocabulary defined in the iCalendar specification, where more
+ information on how to interpret the values can be found. <a href=#refsRFC2445>[RFC2445]</a></p>
+
+ <p class=note>Only the parts of the iCalendar vocabulary relating
+ to events are used here; this vocabulary cannot express a complete
+ iCalendar instance.</p>
+
+ <dl><dt><dfn id=md-vevent-attach title=md-vevent-attach><code>attach</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the address of an associated document for the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Any number of properties with the name <code title=md-vevent-attach><a href=#md-vevent-attach>attach</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-categories title=md-vevent-categories><code>categories</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the name of a category or tag that the event could be
+ classified as.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vevent-categories><a href=#md-vevent-categories>categories</a></code> may be present
+ within each <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-class title=md-vevent-class><code>class</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the access classification of the information regarding
+ the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text with one of the following values:</p>
+
+ <ul class=brief><li><code title="">public</code></li>
+ <li><code title="">private</code></li>
+ <li><code title="">confidential</code></li>
+ </ul><p class=warning>This is merely advisory and cannot be
+ considered a confidentiality measure.</p>
+
+ <p>A single property with the name <code title=md-vevent-class><a href=#md-vevent-class>class</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-comment title=md-vevent-comment><code>comment</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a comment regarding the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-vevent-comment><a href=#md-vevent-comment>comment</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-description title=md-vevent-description><code>description</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a detailed description of the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>A single property with the name <code title=md-vevent-description><a href=#md-vevent-description>description</a></code> may be present
+ within each <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-geo title=md-vevent-geo><code>geo</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the geographical position of the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text and must match the following syntax:</p>
+
+ <ol><li>Optionally, either a U+002B PLUS SIGN character (+) or a
+ U+002D HYPHEN-MINUS character (-).</li>
+
+ <li>One or more digits in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9).</li>
+
+ <li>Optionally*, a U+002E FULL STOP character (.) followed by one
+ or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9).</li>
+
+ <li>A U+003B SEMICOLON character (;).</li>
+
+ <li>Optionally, either a U+002B PLUS SIGN character (+) or a
+ U+002D HYPHEN-MINUS character (-).</li>
+
+ <li>One or more digits in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9).</li>
+
+ <li>Optionally*, a U+002E FULL STOP character (.) followed by one
+ or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9).</li>
+
+ </ol><p>The optional components marked with an asterisk (*) should be
+ included, and should have six digits each.</p> <!-- iCalendar
+ actually limits the range to -91.0 < lat < 91.0; -181.0 < long <
+ 181.0, which seems weird. It also gives special meanings to
+ +90/-90 lat, and +180 long. -->
+
+ <!-- copied from vcard (not icalendar!) -->
+ <p class=note>The value specifies latitude and longitude, in
+ that order (i.e., "LAT LON" ordering), in decimal degrees. The
+ longitude represents the location east and west of the prime
+ meridian as a positive or negative real number, respectively. The
+ latitude represents the location north and south of the equator as
+ a positive or negative real number, respectively.</p>
+
+ <p>A single property with the name <code title=md-vevent-geo><a href=#md-vevent-geo>geo</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-location title=md-vevent-location><code>location</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the location of the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p> <!-- v2: support vcard here -->
+
+ <p>A single property with the name <code title=md-vevent-location><a href=#md-vevent-location>location</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <!-- PRIORITY not included - always 0 - doesn't make sense for single events -->
+
+
+ <dt><dfn id=md-vevent-resources title=md-vevent-resources><code>resources</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a resource that will be needed for the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p> <!-- v2: support vcard here -->
+
+ <p>Any number of properties with the name <code title=md-vevent-resources><a href=#md-vevent-resources>resources</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-status title=md-vevent-status><code>status</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the confirmation status of the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text with one of the following values:</p>
+
+ <ul class=brief><li><code title="">tentative</code></li>
+ <li><code title="">confirmed</code></li>
+ <li><code title="">cancelled</code></li> <!-- two Ls as per iCalendar spec -->
+ </ul><p>A single property with the name <code title=md-vevent-status><a href=#md-vevent-status>status</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-summary title=md-vevent-summary><code>summary</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a short summary of the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p>
+
+ <p>User agents should replace U+000A LINE FEED (LF) characters in
+ the <a href=#concept-property-value title=concept-property-value>value</a> by U+0020
+ SPACE characters when using the value.</p>
+
+ <p>A single property with the name <code title=md-vevent-summary><a href=#md-vevent-summary>summary</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-dtend title=md-vevent-dtend><code>dtend</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the date and time by which the event ends.</p>
+
+ <p>If the property with the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> is present within an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>
+ that has a property with the name <code title=md-vevent-dtstart><a href=#md-vevent-dtstart>dtstart</a></code> whose value is a
+ <a href=#valid-date-string>valid date string</a>, then the <a href=#concept-property-value title=concept-property-value>value</a> of the property with
+ the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> must be text
+ that is a <a href=#valid-date-string>valid date string</a> also. Otherwise, the
+ <a href=#concept-property-value title=concept-property-value>value</a> of the property
+ must be text that is a <a href=#valid-global-date-and-time-string>valid global date and time
+ string</a>.</p>
+
+ <p>In either case, the <a href=#concept-property-value title=concept-property-value>value</a> be later in time than
+ the value of the <code title=md-event-dtstart>dtstart</code>
+ property of the same <a href=#concept-item title=concept-item>item</a>.</p>
+
+ <p class=note>The time given by the <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> property is not
+ inclusive. For day-long events, therefore, the <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> property's <a href=#concept-property-value title=concept-property-value>value</a> will be the day
+ <em>after</em> the end of the event.</p>
+
+ <p>A single property with the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>,
+ so long as that <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>
+ does not have a property with the name <code title=md-vevent-duration><a href=#md-vevent-duration>duration</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-dtstart title=md-vevent-dtstart><code>dtstart</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the date and time at which the event starts.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is either a <a href=#valid-date-string>valid date string</a> or a
+ <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>
+
+ <p>Exactly one property with the name <code title=md-vevent-dtstart><a href=#md-vevent-dtstart>dtstart</a></code> must be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-duration title=md-vevent-duration><code>duration</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the duration of the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is a <a href=#valid-vevent-duration-string>valid vevent duration string</a>.</p>
+
+ <p>The duration represented is the sum of all the durations
+ represented by integers in the value.</p>
+
+ <p>A single property with the name <code title=md-vevent-duration><a href=#md-vevent-duration>duration</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>,
+ so long as that <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>
+ does not have a property with the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-transp title=md-vevent-transp><code>transp</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives whether the event is to be considered as consuming time
+ on a calendar, for the purpose of free-busy time searches.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text with one of the following values:</p>
+
+ <ul class=brief><li><code title="">opaque</code></li>
+ <li><code title="">transparent</code></li>
+ </ul><p>A single property with the name <code title=md-vevent-transp><a href=#md-vevent-transp>transp</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <!-- ATTENDEE not included; iCalendar says MUST NOT be included in
+ published events -->
+
+
+ <dt><dfn id=md-vevent-contact title=md-vevent-contact><code>contact</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the contact information for the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text.</p> <!-- v2: support vcard here -->
+
+ <p>Any number of properties with the name <code title=md-vevent-contact><a href=#md-vevent-contact>contact</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <!-- ORGANIZER not included, as it is calendar-system-specific
+ (gives a CAL-ADDRESS value); use CONTACT instead -->
+
+
+ <!-- RECURRENCE-ID not included... unclear how to make it usefully
+ work here -->
+
+
+ <!-- RELATED-TO not included, as it only makes sense for complete
+ calendars -->
+
+
+ <dt><dfn id=md-vevent-url title=md-vevent-url><code>url</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a <a href=#url>URL</a> for the event.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>A single property with the name <code title=md-vevent-url><a href=#md-vevent-url>url</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <!-- UID not included - use "itemid" -->
+
+
+ <dt><dfn id=md-vevent-exdate title=md-vevent-exdate><code>exdate</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a date and time at which the event does not occur despite
+ the recurrence rules.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is either a <a href=#valid-date-string>valid date string</a> or a
+ <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>
+
+ <p>Any number of properties with the name <code title=md-vevent-exdate><a href=#md-vevent-exdate>exdate</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-exrule title=md-vevent-exrule><code>exrule</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a rule for finding dates and times at which the event
+ does not occur despite the recurrence rules.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that matches the RECUR value type defined in the iCalendar
+ specification. <a href=#refsRFC2445>[RFC2445]</a></p>
+
+ <p>Any number of properties with the name <code title=md-vevent-exrule><a href=#md-vevent-exrule>exrule</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-rdate title=md-vevent-rdate><code>rdate</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a date and time at which the event recurs.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is one of the following:
+
+ <ul><li>A <a href=#valid-date-string>valid date string</a>.</li>
+
+ <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</li>
+
+ <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a> followed by
+ a U+002F SOLIDUS character (/) followed by a second <a href=#valid-global-date-and-time-string>valid
+ global date and time string</a> representing a later time.</li>
+
+ <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a> followed by
+ a U+002F SOLIDUS character (/) followed by a <a href=#valid-vevent-duration-string>valid vevent
+ duration string</a>.</li>
+
+ </ul><p>Any number of properties with the name <code title=md-vevent-rdate><a href=#md-vevent-rdate>rdate</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-rrule title=md-vevent-rrule><code>rrule</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a rule for finding dates and times at which the event
+ occurs.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that matches the RECUR value type defined in the iCalendar
+ specification. <a href=#refsRFC2445>[RFC2445]</a></p>
+
+ <p>Any number of properties with the name <code title=md-vevent-rrule><a href=#md-vevent-rrule>rrule</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-created title=md-vevent-created><code>created</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the date and time at which the event information was first
+ created in a calendaring system.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>
+
+ <p>A single property with the name <code title=md-vevent-created><a href=#md-vevent-created>created</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <!-- DTSTAMP not included, it gets added when serialising -->
+
+
+ <dt><dfn id=md-vevent-last-modified title=md-vevent-last-modified><code>last-modified</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the date and time at which the event information was last
+ modified in a calendaring system.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>
+
+ <p>A single property with the name <code title=md-vevent-last-modified><a href=#md-vevent-last-modified>last-modified</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-vevent-sequence title=md-vevent-sequence><code>sequence</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives a revision number for the event information.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ text that is a <a href=#valid-non-negative-integer>valid non-negative integer</a>.</p>
+
+ <p>A single property with the name <code title=md-vevent-sequence><a href=#md-vevent-sequence>sequence</a></code> may be present within
+ each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
+
+ </dd>
+
+
+ <!-- REQUEST-STATUS not included, calendaring system interop
+ feature -->
+
+
+ </dl><p>A string is a <dfn id=valid-vevent-duration-string>valid vevent duration string</dfn> if it
+ matches the following pattern:</p>
+
+ <ol><li>A U+0050 LATIN CAPITAL LETTER P character (P).</li>
+
+ <li>One of the following:
+
+ <ul><li> A <a href=#valid-non-negative-integer>valid non-negative integer</a> followed by a
+ U+0057 LATIN CAPITAL LETTER W character (W). The integer
+ represents a duration of that number of weeks. </li>
+
+ <li> At least one, and possible both in this order, of the
+ following:
+
+ <ol><li> A <a href=#valid-non-negative-integer>valid non-negative integer</a> followed by a
+ U+0044 LATIN CAPITAL LETTER D character (D). The integer
+ represents a duration of that number of days. </li>
+
+ <li> A U+0054 LATIN CAPITAL LETTER T character (T) followed by
+ any one of the following, or the first and second of the
+ following in that order, or the second and third of the
+ following in that order, or all three of the following in this
+ order:
+
+ <ol><li> A <a href=#valid-non-negative-integer>valid non-negative integer</a> followed by a
+ U+0048 LATIN CAPITAL LETTER H character (H). The integer
+ represents a duration of that number of hours. </li>
+
+ <li> A <a href=#valid-non-negative-integer>valid non-negative integer</a> followed by a
+ U+004D LATIN CAPITAL LETTER M character (M). The integer
+ represents a duration of that number of minutes. </li>
+
+ <li> A <a href=#valid-non-negative-integer>valid non-negative integer</a> followed by a
+ U+0053 LATIN CAPITAL LETTER S character (S). The integer
+ represents a duration of that number of seconds. </li>
+
+ </ol></ol></li>
+
+ </ul></li>
+
+ </ol><h5 id=conversion-to-icalendar><span class=secno>5.4.2.1 </span>Conversion to iCalendar</h5>
+
+ <p>Given a list of nodes <var title="">nodes</var> in a
+ <code><a href=#document>Document</a></code>, a user agent must run the following algorithm
+ to <dfn id=extracting-vevent-data title="extracting vEvent data">extract any vEvent data
+ represented by those nodes</dfn>:</p>
+
+ <ol><li><p>If none of the nodes in <var title="">nodes</var> are <a href=#concept-item title=concept-item>items</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>,
+ then there is no vEvent data. Abort the algorithm, returning
+ nothing.</li>
+
+ <li><p>Let <var title="">output</var> be an empty string.</li>
+
+ <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">BEGIN</code>" and the value "<code title="">VCALENDAR</code>" to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">PRODID</code>" and the value equal to a
+ user-agent-specific string representing the user agent to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">VERSION</code>" and the value "<code title="">2.0</code>"
+ to <var title="">output</var>.</li>
+
+ <li>
+
+ <p>For each node <var title="">node</var> in <var title="">nodes</var> that is an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>,
+ run the following steps:</p>
+
+ <ol><li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">BEGIN</code>" and the value "<code title="">VEVENT</code>" to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">DTSTAMP</code>" and a value consisting of an iCalendar
+ DATE-TIME string representing the current date and time, with the
+ annotation "<code title="">VALUE=DATE-TIME</code>", to <var title="">output</var>. <a href=#refsRFC2445>[RFC2445]</a></li>
+
+ <li><p>If the <a href=#concept-item title=concept-item>item</a> has a
+ <a href=#global-identifier>global identifier</a>, <a href=#add-an-icalendar-line>add an iCalendar
+ line</a> with the type "<code title="">UID</code>" and that
+ <a href=#global-identifier>global identifier</a> as the value to <var title="">output</var>.</li>
+
+ <li>
+
+ <p>For each element <var title="">element</var> that is <a href=#the-properties-of-an-item title="the properties of an item">a property of the item</a>
+ <var title="">node</var>: for each name <var title="">name</var>
+ in <var title="">element</var>'s <a href=#property-names>property names</a>,
+ run the appropriate set of substeps from the following list:</p>
+
+ <dl><dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a></dt>
+
+ <dd>
+
+ <p>Skip the property.</p>
+
+ </dd>
+
+
+ <dt>If <var title="">element</var> is a <code><a href=#the-time-element>time</a></code>
+ element</dt>
+
+ <dd>
+
+ <p>Let <var title="">value</var> be the result of stripping
+ all U+002D HYPHEN-MINUS (-) and U+003A COLON (:) characters
+ from the property's <a href=#concept-property-value title=concept-property-value>value</a>.</p>
+
+ <p>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is a <a href=#valid-date-string>valid
+ date string</a> then <a href=#add-an-icalendar-line>add an iCalendar line</a>
+ with the type <var title="">name</var> and the value <var title="">value</var> to <var title="">output</var>, with the
+ annotation "<code title="">VALUE=DATE</code>".</p>
+
+ <p>Otherwise, if the property's <a href=#concept-property-value title=concept-property-value>value</a> is a <a href=#valid-global-date-and-time-string>valid
+ global date and time string</a> then <a href=#add-an-icalendar-line>add an iCalendar
+ line</a> with the type <var title="">name</var> and the
+ value <var title="">value</var> to <var title="">output</var>,
+ with the annotation "<code title="">VALUE=DATE-TIME</code>".</p>
+
+ <p>Otherwise skip the property.</p>
+
+ </dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type <var title="">name</var> and the property's <a href=#concept-property-value title=concept-property-value>value</a> to <var title="">output</var>.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">END</code>" and the value "<code title="">VEVENT</code>"
+ to <var title="">output</var>.</li>
+
+ </ol></li>
+
+ <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">END</code>" and the value "<code title="">VCALENDAR</code>" to <var title="">output</var>.</li>
+
+ </ol><p>When the above algorithm says that the user agent is to <dfn id=add-an-icalendar-line>add
+ an iCalendar line</dfn> consisting of a type <var title="">type</var>, a value <var title="">value</var>, and
+ optionally an annotation, to a string <var title="">output</var>, it
+ must run the following steps:</p>
+
+ <ol><li><p>Let <var title="">line</var> be an empty string.</li>
+
+ <li><p>Append <var title="">type</var>, <a href=#converted-to-ascii-uppercase>converted to
+ ASCII uppercase</a>, to <var title="">line</var>.</li>
+
+ <li>
+
+ <p>If there is an annotation:</p>
+
+ <ol><li><p>Append a U+003B SEMICOLON character (;) to <var title="">line</var>.</li>
+
+ <li><p>Append the annotation to <var title="">line</var>.</li>
+
+ </ol></li>
+
+ <li><p>Append a U+003A COLON character (:) to <var title="">line</var>.</li>
+
+ <li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in
+ <var title="">value</var> with another U+005C REVERSE SOLIDUS
+ character (\).</li>
+
+ <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Prefix every U+003B SEMICOLON character (;) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
+ character pair (CRLF) in <var title="">value</var> with a U+005C
+ REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
+ LETTER N character (n).</li>
+
+ <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) character in <var title="">value</var> with a
+ U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
+ SMALL LETTER N character (n).</li>
+
+ <li><p>Append <var title="">value</var> to <var title="">line</var>.</li>
+
+ <li><p>Let <var title="">maximum length</var> be 75.</li>
+
+ <li>
+
+ <p>If and while <var title="">line</var> is longer than <var title="">maximum length</var> Unicode code points long, run the
+ following substeps:</p>
+
+ <ol><li><p>Append the first <var title="">maximum length</var>
+ Unicode code points of <var title="">line</var> to <var title="">output</var>.</li>
+
+ <li><p>Remove the first <var title="">maximum length</var>
+ Unicode code points from <var title="">line</var>.</li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+0020 SPACE character to <var title="">output</var>.</li>
+
+ <li><p>Let <var title="">maximum length</var> be 74.</li>
+
+ </ol></li>
+
+ <li><p>Append (what remains of) <var title="">line</var> to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>
+
+ </ol><p class=note>This algorithm can generate invalid iCalendar
+ output, if the input does not conform to the rules described for the
+ <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>
+ <a href=#item-type>item type</a> and <a href=#defined-property-name title="defined property
+ name">defined property names</a>.</p> <!-- of course since
+ iCalendar doesn't define error handling, this is somewhat
+ problematic. -->
+
+
+
+ <h5 id=examples-2><span class=secno>5.4.2.2 </span>Examples</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+<!-- get more from http://www.ietf.org/rfc/rfc2445.txt -->
+
+ <div class=example>
+
+ <p>Here is an example of a page that uses the vEvent vocabulary to
+ mark up an event:</p>
+
+ <pre>&lt;body itemscope itemtype="http://microformats.org/profile/hcalendar#vevent"&gt;
+ ...
+ &lt;h1 itemprop="summary"&gt;Bluesday Tuesday: Money Road&lt;/h1&gt;
+ ...
+ &lt;time itemprop="dtstart" datetime="2009-05-05T19:00:00Z"&gt;May 5th @ 7pm&lt;/time&gt;
+ (until &lt;time itemprop="dtend" datetime="2009-05-05T21:00:00Z"&gt;9pm&lt;/time&gt;)
+ ...
+ &lt;a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
+ rel="bookmark" itemprop="url"&gt;Link to this page&lt;/a&gt;
+ ...
+ &lt;p&gt;Location: &lt;span itemprop="location"&gt;The RoadHouse&lt;/span&gt;&lt;/p&gt;
+ ...
+ &lt;p&gt;&lt;input type=button value="Add to Calendar"
+ onclick="location = getCalendar(this)"&gt;&lt;/p&gt;
+ ...
+ &lt;meta itemprop="description" content="via livebrum.co.uk"&gt;
+&lt;/body&gt;</pre>
+
+ <p>The "<code title="">getCalendar()</code>" method could look like
+ this:</p>
+
+ <pre>function getCalendar(node) {
+ // This function assumes the content is valid.
+ // It is not a compliant implementation of the algorithm for <a href=#extracting-vevent-data>extracting vEvent data</a>.
+ while (node &amp;&amp; (!node.itemScope || !node.itemType == 'http://microformats.org/profile/hcalendar#vevent'))
+ node = node.parentNode;
+ if (!node) {
+ alert('No event data found.');
+ return;
+ }
+ var stamp = new Date();
+ var stampString = '' + stamp.getUTCFullYear() + (stamp.getUTCMonth() + 1) + stamp.getUTCDate() + 'T' +
+ stamp.getUTCHours() + stamp.getUTCMinutes() + stamp.getUTCSeconds() + 'Z';
+ var calendar = 'BEGIN:VCALENDAR\r\nPRODID:HTML\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nDTSTAMP:' + stampString + '\r\n';
+ if (node.itemId)
+ calendar += 'UID:' + node.itemId + '\r\n';
+ for (var propIndex = 0; propIndex &lt; node.properties.length; propIndex += 1) {
+ var prop = node.properties[propIndex];
+ var value = prop.itemValue;
+ var parameters = '';
+ if (prop.localName == 'time') {
+ value = value.replace(/[:-]/g, '');
+ if (value.match(/T/))
+ parameters = ';VALUE=DATE';
+ else
+ parameters = ';VALUE=DATE-TIME';
+ } else {
+ value = value.replace(/\\/g, '\\n');
+ value = value.replace(/;/g, '\\;');
+ value = value.replace(/,/g, '\\,');
+ value = value.replace(/\n/g, '\\n');
+ }
+ for (var nameIndex = 0; nameIndex &lt; prop.itemProp.length; nameIndex += 1) {
+ var name = prop.itemProp[nameIndex];
+ if (!name.match(/:/) &amp;&amp; !name.match(/\./))
+ calendar += name.toUpperCase() + parameters + ':' + value + '\r\n';
+ }
+ }
+ calendar += 'END:VEVENT\r\nEND:VCALENDAR\r\n';
+ return 'data:text/calendar;component=vevent,' + encodeURI(calendar);
+}</pre>
+
+ <p>The same page could offer some markup, such as the following,
+ for copy-and-pasting into blogs:</p>
+
+ <pre>&lt;div itemscope itemtype="http://microformats.org/profile/hcalendar#vevent"&gt;
+ &lt;p&gt;I'm going to
+ &lt;strong itemprop="summary"&gt;Bluesday Tuesday: Money Road&lt;/strong&gt;,
+ &lt;time itemprop="dtstart" datetime="2009-05-05T19:00:00Z"&gt;May 5th at 7pm&lt;/time&gt;
+ to &lt;time itemprop="dtend" content="2009-05-05T21:00:00Z"&gt;9pm&lt;/time&gt;,
+ at &lt;span itemprop="location"&gt;The RoadHouse&lt;/span&gt;!&lt;/p&gt;
+ &lt;p&gt;&lt;a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
+ itemprop="url"&gt;See this event on livebrum.co.uk&lt;/a&gt;.&lt;/p&gt;
+ &lt;meta itemprop="description" content="via livebrum.co.uk"&gt;
+&lt;/div&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=licensing-works><span class=secno>5.4.3 </span>Licensing works</h4>
+
+
+
+ <p>An item with the <a href=#item-type>item type</a> <dfn id=md-work title=md-work><code>http://n.whatwg.org/work</code></dfn>
+ represents a work (e.g. an article, an image, a video, a song,
+ etc). This type is primarily intended to allow authors to include
+ licensing information for works.</p>
+
+ <p>The following are the type's <a href=#defined-property-name title="defined property
+ name">defined property names</a>.</p>
+
+ <dl><dt><dfn id=md-work-work title=md-work-work><code>work</code></dfn></dt>
+
+ <dd>
+
+ <p>Identifies the work being described.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Exactly one property with the name <code title=md-work-work><a href=#md-work-work>work</a></code> must be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-work-title title=md-work-title><code>title</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the name of the work.</p>
+
+ <p>A single property with the name <code title=md-work-title><a href=#md-work-title>title</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-work-author title=md-work-author><code>author</code></dfn></dt>
+
+ <dd>
+
+ <p>Gives the name or contact information of one of the authors or
+ creators of the work.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ either an <a href=#concept-item title=concept-item>item</a> with the type
+ <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or
+ text.</p>
+
+ <p>Any number of properties with the name <code title=md-work-author><a href=#md-work-author>author</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
+
+ </dd>
+
+
+ <dt><dfn id=md-work-license title=md-work-license><code>license</code></dfn></dt>
+
+ <dd>
+
+ <p>Identifies one of the licenses under which the work is
+ available.</p>
+
+ <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
+ an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>Any number of properties with the name <code title=md-work-license><a href=#md-work-license>license</a></code> may be present within each
+ <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
+
+ </dd>
+
+ </dl><h5 id=conversion-to-rdf><span class=secno>5.4.3.1 </span>Conversion to RDF</h5>
+
+ <p>For the purposes of RDF processors, the triples obtained from the
+ following Turtle must be applied:</p>
+
+ <pre class=turtle>&lt;http://www.w3.org/1999/xhtml/microdata#http%3A%2F%2Fn.whatwg.org%2Fwork%23%3Awork&gt;
+ &lt;http://www.w3.org/2002/07/owl#equivalentProperty&gt;
+ &lt;http://www.w3.org/2002/07/owl#sameAs&gt; .
+&lt;http://www.w3.org/1999/xhtml/microdata#http%3A%2F%2Fn.whatwg.org%2Fwork%23%3Atitle&gt;
+ &lt;http://www.w3.org/2002/07/owl#equivalentProperty&gt;
+ &lt;http://purl.org/dc/terms/title&gt; .
+&lt;http://www.w3.org/1999/xhtml/microdata#http%3A%2F%2Fn.whatwg.org%2Fwork%23%3Aauthor&gt;
+ &lt;http://www.w3.org/2002/07/owl#equivalentProperty&gt;
+ &lt;http://creativecommons.org/ns#attributionName&gt; .
+&lt;http://www.w3.org/1999/xhtml/microdata#http%3A%2F%2Fn.whatwg.org%2Fwork%23%3Alicense&gt;
+ &lt;http://www.w3.org/2002/07/owl#equivalentProperty&gt;
+ &lt;http://www.w3.org/1999/xhtml/vocab#license&gt; .</pre>
+
+ <p class=note>The subjects of the statements above are the
+ predicates that result from <a href=#extracting-rdf title="extracting rdf">converting
+ to RDF</a> an HTML page containing microdata with an item whose
+ <a href=#item-type title="item type">type</a> is "<code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>".</p>
+
+
+
+ <h5 id=examples-3><span class=secno>5.4.3.2 </span>Examples</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <div class=example>
+
+ <p>This example shows an embedded image entitled <cite>My
+ Pond</cite>, licensed under the Creative Commons Attribution-Share
+ Alike 3.0 United States License and the MIT license
+ simultaneously.</p>
+
+ <pre>&lt;figure <strong>itemscope itemtype="http://n.whatwg.org/work"</strong>&gt;
+ &lt;img <strong>itemprop="work"</strong> src="mypond.jpeg"&gt;
+ &lt;figcaption&gt;
+ &lt;p&gt;&lt;cite <strong>itemprop="title"</strong>&gt;My Pond&lt;/cite&gt;&lt;/p&gt;
+ &lt;p&gt;&lt;small&gt;Licensed under the &lt;a <strong>itemprop="license"</strong>
+ href="http://creativecommons.org/licenses/by-sa/3.0/us/"&gt;Creative
+ Commons Attribution-Share Alike 3.0 United States License&lt;/a&gt;
+ and the &lt;a <strong>itemprop="license"</strong>
+ href="http://www.opensource.org/licenses/mit-license.php"&gt;MIT
+ license&lt;/a&gt;.&lt;/small&gt;
+ &lt;/figcaption&gt;
+&lt;/figure&gt;</pre>
+
+ </div>
+
+
+
+
+
+
+
+
+
+ <div class=impl>
+
+ <h3 id=converting-html-to-other-formats><span class=secno>5.5 </span>Converting HTML to other formats</h3>
+
+
+
+
+ <h4 id=json><span class=secno>5.5.1 </span>JSON</h4>
+
+ <p>Given a list of nodes <var title="">nodes</var> in a
+ <code><a href=#document>Document</a></code>, a user agent must run the following algorithm
+ to <dfn id=extracting-json title="extracting JSON">extract the microdata from those
+ nodes into a JSON form</dfn>:</p>
+
+ <ol><li><p>Let <var title="">result</var> be an empty object.</li>
+
+ <li><p>Let <var title="">items</var> be an empty array.</li>
+
+ <li><p>For each <var title="">node</var> in <var title="">nodes</var>, check if the element is a <a href=#top-level-microdata-items title="top-level microdata items">top-level microdata item</a>,
+ and if it is then <a href=#get-the-object>get the object</a> for that element and
+ add it to <var title="">items</var>.</li>
+
+ <li><p>Add an entry to <var title="">result</var> called "<code title="">items</code>" whose value is the array <var title="">items</var>.</li>
+
+ <li><p>Return the result of serializing <var title="">result</var>
+ to JSON.</li>
+
+ </ol><p>When the user agent is to <dfn id=get-the-object>get the object</dfn> for an item
+ <var title="">item</var>, it must run the following substeps:</p>
+
+ <ol><li><p>Let <var title="">result</var> be an empty object.</li>
+
+ <li><p>If the <var title="">item</var> has an <a href=#item-type>item
+ type</a>, add an entry to <var title="">result</var> called
+ "<code title="">type</code>" whose value is the <a href=#item-type>item
+ type</a> of <var title="">item</var>.</li>
+
+ <li><p>If the <var title="">item</var> has an <a href=#global-identifier>global
+ identifier</a>, add an entry to <var title="">result</var>
+ called "<code title="">id</code>" whose value is the <a href=#global-identifier>global
+ identifier</a> of <var title="">item</var>.</li>
+
+ <li><p>Let <var title="">properties</var> be an empty
+ object.</li>
+
+ <li>
+
+ <p>For each element <var title="">element</var> that has one or
+ more <a href=#property-names>property names</a> and is one of <a href=#the-properties-of-an-item title="the
+ properties of an item">the properties of the item</a> <var title="">item</var>, in the order those elements are given by the
+ algorithm that returns <a href=#the-properties-of-an-item>the properties of an item</a>, run
+ the following substeps:</p>
+
+ <ol><li><p>Let <var title="">value</var> be the <a href=#concept-property-value title=concept-property-value>property value</a> of <var title="">element</var>.</li>
+
+ <li><p>If <var title="">value</var> is an <a href=#concept-item title=concept-item>item</a>, then <a href=#get-the-object>get the
+ object</a> for <var title="">value</var>, and then replace
+ <var title="">value</var> with the object returned from those
+ steps.</li>
+
+ <li>
+
+ <p>For each name <var title="">name</var> in <var title="">element</var>'s <a href=#property-names>property names</a>, run the
+ following substeps:</p>
+
+ <ol><li><p>If there is no entry named <var title="">name</var> in
+ <var title="">properties</var>, then add an entry named <var title="">name</var> to <var title="">properties</var> whose
+ value is an empty array.</li>
+
+ <li><p>Append <var title="">value</var> to the entry named <var title="">name</var> in <var title="">properties</var>.</li>
+
+ </ol></li>
+
+ </ol></li>
+
+ <li><p>Add an entry to <var title="">result</var> called "<code title="">properties</code>" whose value is the object <var title="">properties</var>.</li>
+
+ <li><p>Return <var title="">result</var>.</li>
+
+ </ol><h4 id=rdf><span class=secno>5.5.2 </span>RDF</h4>
+
+ <p>To <dfn id=extracting-rdf title="extracting rdf">convert a <code>Document</code> to
+ RDF</dfn>, a user agent must run the following algorithm:</p>
+
+ <ol><li>
+
+ <p>If <a href=#the-title-element>the <code>title</code> element</a> is not null,
+ then generate the following triple:</p>
+
+ <dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
+ <dt>predicate <dd> <code title="">http://purl.org/dc/terms/title</code>
+ <dt>object <dd> the concatenation of the data of all the child <a href=#text-node title="text node">text nodes</a> of <a href=#the-title-element>the <code>title</code> element</a>, in <a href=#tree-order>tree order</a>, as a plain literal, with the language information set from the <a href=#language>language</a> of <a href=#the-title-element>the <code>title</code> element</a>, if it is not unknown.
+
+ </dl></li>
+
+ <li>
+
+ <p>For each <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, and
+ <code><a href=#the-link-element>link</a></code> element in the <code><a href=#document>Document</a></code>, run these
+ substeps:</p>
+
+ <ol><li><p>If the element does not have a <code title="">rel</code>
+ attribute, then skip this element.</li>
+
+ <li><p>If the element does not have an <code title="">href</code>
+ attribute, then skip this element.</li>
+
+ <li><p>If <a href=#resolve-a-url title="resolve a URL">resolving</a> the
+ element's <code title="">href</code> attribute relative to the
+ element is not successful, then skip this element.</li>
+
+ <li><p>Otherwise, <a href=#split-a-string-on-spaces title="split a string on spaces">split
+ the value of the element's <code title="">rel</code> attribute on
+ spaces</a>, obtaining <var title="">list of tokens</var>.</li>
+
+ <li><p>Convert each token in <var title="">list of tokens</var>
+ that does not contain a U+003A COLON characters (:) <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">to ASCII
+ lowercase</a>.</li>
+
+ <li><p>If <var title="">list of tokens</var> contains more than
+ one instance of the token <code title=rel-up><a href=#link-type-up>up</a></code>, then
+ remove all such tokens.</li>
+
+ <li><p>Coalesce duplicate tokens in <var title="">list of
+ tokens</var>.</li>
+
+ <li><p>If <var title="">list of tokens</var> contains both the
+ tokens <code title=rel-alternate><a href=#link-type-alternate>alternate</a></code> and <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code>, then remove them both
+ and replace them with the single (uppercase) token <code title="">ALTERNATE-STYLESHEET</code>.</li>
+
+ <li>
+
+ <p>For each token <var title="">token</var> in <var title="">list of tokens</var> that contains no U+003A COLON
+ characters (:), generate the following triple:</p>
+
+ <dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
+ <dt>predicate <dd> the concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and <var title="">token</var>, with any characters in <var title="">token</var> that are not valid in the &lt;ifragment&gt; production of the IRI syntax being %-escaped <a href=#refsRFC3987>[RFC3987]</a>
+ <dt>object <dd> the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a URL">resolving</a> the value of the element's <code title="">href</code> attribute relative to the element
+ </dl><p>For each token <var title="">token</var> in <var title="">list of tokens</var> that is an <a href=#absolute-url>absolute
+ URL</a>, generate the following triple:</p>
+
+ <dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
+ <dt>predicate <dd> <var title="">token</var>
+ <dt>object <dd> the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a URL">resolving</a> the value of the element's <code title="">href</code> attribute relative to the element
+ </dl></li>
+
+ </ol></li>
+
+ <li>
+
+ <p>For each <code><a href=#meta>meta</a></code> element in the <code><a href=#document>Document</a></code>
+ that has a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute and
+ a <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, if the
+ value of the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute
+ contains no U+003A COLON characters (:), generate the following
+ triple:</p>
+
+ <dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
+ <dt>predicate <dd> the concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and the value of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute, <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, with any characters in the value that are not valid in the &lt;ifragment&gt; production of the IRI syntax being %-escaped <a href=#refsRFC3987>[RFC3987]</a>
+ <dt>object <dd> the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, as a plain literal, with the language information set from the <a href=#language>language</a> of the element, if it is not unknown
+ </dl><p>For each <code><a href=#meta>meta</a></code> element in the <code><a href=#document>Document</a></code>
+ that has a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute and
+ a <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, if the
+ value of the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute is
+ an <a href=#absolute-url>absolute URL</a>, generate the following triple:</p>
+
+ <dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
+ <dt>predicate <dd> the value of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute
+ <dt>object <dd> the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, as a plain literal, with the language information set from the <a href=#language>language</a> of the element, if it is not unknown
+ </dl></li>
+
+ <li>
+
+ <p>For each <code><a href=#the-blockquote-element>blockquote</a></code> and <code><a href=#the-q-element>q</a></code> element in
+ the <code><a href=#document>Document</a></code> that has a <code title="">cite</code>
+ attribute that <a href=#resolve-a-url title="resolve a url">resolves</a>
+ successfully relative to the element, generate the following
+ triple:</p>
+
+ <dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
+ <dt>predicate <dd> <code title="">http://purl.org/dc/terms/source</code>
+ <dt>object <dd> the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a URL">resolving</a> the value of the element's <code title="">cite</code> attribute relative to the element
+ </dl></li>
+
+ <li>
+
+ <p>Let <var title="">memory</var> be a mapping of items to
+ subjects, initially empty.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each element that is also a <a href=#top-level-microdata-items title="top-level
+ microdata items">top-level microdata item</a>, run the
+ following steps:</p>
+
+ <ol><li>
+
+ <p><a href=#generate-the-triples-for-an-item title="generate the triples for an item">Generate the
+ triples for the item</a>. Pass a reference to <var title="">memory</var> as the item/subject list. Let <var title="">result</var> be the subject returned.</p>
+
+ </li>
+
+ <li>
+
+ <p>Generate the following triple:</p>
+
+ <dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
+ <dt>predicate <dd> <code title="">http://www.w3.org/1999/xhtml/microdata#item</code>
+ <dt>object <dd> <var title="">result</var>
+ </dl></li>
+
+ </ol></li>
+
+ </ol><p>When the user agent is to <dfn id=generate-the-triples-for-an-item>generate the triples for an
+ item</dfn> <var title="">item</var>, given a reference to an
+ item/subject list <var title="">memory</var>, and optionally given a
+ fallback type <var title="">fallback type</var> and property name
+ <var title="">fallback name</var>, it must follow the following
+ steps:</p>
+
+ <ol><li><p>If there is an entry for <var title="">item</var> in <var title="">memory</var>, then let <var title="">subject</var> be the
+ subject of that entry. Otherwise, if <var title="">item</var> has a
+ <a href=#global-identifier>global identifier</a> and that <a href=#global-identifier>global
+ identifier</a> is an <a href=#absolute-url>absolute URL</a>, let <var title="">subject</var> be that <a href=#global-identifier>global
+ identifier</a>. Otherwise, let <var title="">subject</var> be a
+ new blank node.</li>
+
+ <li><p>Add a mapping from <var title="">item</var> to <var title="">subject</var> in <var title="">memory</var>, if there
+ isn't one already.</li>
+
+ <li><p>If <var title="">item</var> has an <a href=#item-type>item type</a>
+ and that <a href=#item-type>item type</a> is an <a href=#absolute-url>absolute URL</a>,
+ let <var title="">type</var> be that <a href=#item-type>item
+ type</a>. Otherwise, let <var title="">type</var> be the empty
+ string.</li>
+
+ <!-- The special characters used in URLs beyond this point are
+ intended to make it so that a different type/name combination
+ couldn't generate the same string. ":" and "%20" are used because
+ they can't be put in /name/ when all this is used. -->
+
+ <li>
+
+ <p>If <var title="">type</var> is not the empty string, run the
+ following steps:</p>
+
+ <ol><li><p>Generate the following triple:</p>
+
+ <dl class=triple><dt>subject <dd> <var title="">subject</var>
+ <dt>predicate <dd> <code title="">http://www.w3.org/1999/02/22-rdf-syntax-ns#type</code>
+ <dt>object <dd> <var title="">type</var>
+ </dl></li>
+
+ <li><p>If <var title="">type</var> does not contain a U+0023
+ NUMBER SIGN character (#), then append a U+0023 NUMBER SIGN
+ character (#) to <var title="">type</var>.</li>
+
+ <li><p>If <var title="">type</var> does not have a U+003A COLON
+ character (:) after its U+0023 NUMBER SIGN character (#), append
+ a U+003A COLON character (:) to <var title="">type</var>.</li>
+
+ </ol></li>
+
+ <li>
+
+ <p>If <var title="">type</var> is the empty string, but <var title="">fallback type</var> is not, run the following
+ substeps:</p>
+
+ <ol><li><p>Let <var title="">type</var> have the value of <var title="">fallback type</var>.</li>
+
+ <li><p>If <var title="">type</var> does not contain a U+0023
+ NUMBER SIGN character (#), then append a U+0023 NUMBER SIGN
+ character (#) to <var title="">type</var>.</li>
+
+ <!-- Special characters beyond this point have to be something
+ not in /name/ when this is used below, so either ":", %20, %0D,
+ or %0A. This is so that a different type/name combination
+ couldn't generate the same string. -->
+
+ <li><p>If <var title="">type</var> does not have a U+003A COLON
+ character (:) after its U+0023 NUMBER SIGN character (#), append
+ a U+003A COLON character (:) to <var title="">type</var>.</li>
+
+ <li><p>If the last character of <var title="">type</var> is not a
+ U+003A COLON character (:), append a U+0025 PERCENT SIGN
+ character (%), a U+0032 DIGIT TWO character (2), and a U+0030
+ DIGIT ZERO character (0) to <var title="">type</var>.</li>
+
+ <li><p>Append the value of <var title="">fallback name</var> to
+ <var title="">type</var>, with any characters in <var title="">fallback name</var> that are not valid in the
+ &lt;ifragment&gt; production of the IRI syntax being
+ %-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
+
+ </ol></li>
+
+ <li>
+
+ <p>For each element <var title="">element</var> that has one or
+ more <a href=#property-names>property names</a> and is one of <a href=#the-properties-of-an-item title="the
+ properties of an item">the properties of the item</a> <var title="">item</var>, in the order those elements are given by the
+ algorithm that returns <a href=#the-properties-of-an-item>the properties of an item</a>, run
+ the following substep:</p>
+
+ <ol><li>
+
+ <p>For each name <var title="">name</var> in <var title="">element</var>'s <a href=#property-names>property names</a>, run the
+ following substeps:</p>
+
+ <ol><li><p>If <var title="">type</var> is the empty string and <var title="">name</var> is not an <a href=#absolute-url>absolute URL</a>, then
+ abort these substeps.</li>
+
+ <li><p>Let <var title="">value</var> be the <a href=#concept-property-value title=concept-property-value>property value</a> of <var title="">element</var>.</li>
+
+ <li><p>If <var title="">value</var> is an <a href=#concept-item title=concept-item>item</a>, then <a href=#generate-the-triples-for-an-item title="generate
+ the triples for an item">generate the triples</a> for <var title="">value</var>. Pass a reference to <var title="">memory</var> as the item/subject list, and pass <var title="">type</var> as the fallback type and <var title="">name</var> as the fallback property name. Replace <var title="">value</var> by the subject returned from those
+ steps.</li>
+
+ <!-- could support <time> here somehow, though we'd have to
+ reserialise it, check if the <time> was valid, check if it had a
+ date, a time, a timezone, etc. -->
+
+ <li><p>Otherwise, if <var title="">element</var> is not one of
+ the <a href=#url-property-elements>URL property elements</a>, let <var title="">value</var> be a plain literal, with the language
+ information set from the <a href=#language>language</a> of the element, if
+ it is not unknown.</li>
+
+ <li>
+
+ <dl><dt>If <var title="">name</var> is an <a href=#absolute-url>absolute
+ URL</a></dt>
+
+ <dd>
+
+ <p>Let <var title="">predicate</var> be <var title="">name</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">name</var> contains no U+003A COLON
+ characters (:)</dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">s</var> be <var title="">type</var>.</li>
+
+ <li><p>If the last character of <var title="">s</var> is
+ not a U+003A COLON character (:), append a U+0025 PERCENT
+ SIGN character (%), a U+0032 DIGIT TWO character (2), and a
+ U+0030 DIGIT ZERO character (0) to <var title="">s</var>.</li>
+
+ <li><p>Append the value of <var title="">name</var> to <var title="">s</var>, with any characters in <var title="">name</var> that are not valid in the
+ &lt;ifragment&gt; production of the IRI syntax being
+ %-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
+
+ <li>
+
+ <p>Let <var title="">predicate</var> be the concatenation
+ of the string "<code title="">http://www.w3.org/1999/xhtml/microdata#</code>"
+ and <var title="">s</var>, with any characters in <var title="">s</var> that are not valid in the &lt;ifragment&gt;
+ production of the IRI syntax being %-escaped, but without
+ double-escaping existing %-escapes. <a href=#refsRFC3987>[RFC3987]</a></p> <!-- this ensures
+ you can't use a URL to get the same effect -->
+
+ <p class=example>For example if the string <var title="">s</var> is "<code title="">http://example.com/a#:q%20r</code>", the
+ resulting <var title="">predicate</var> would be "<code title="">http://www.w3.org/1999/xhtml/microdata#http://example.com/a%23:q%20r</code>".</p>
+
+ </li>
+
+ </ol></dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>Generate the following triple:</p>
+
+ <dl class=triple><dt>subject <dd> <var title="">subject</var>
+ <dt>predicate <dd> <var title="">predicate</var>
+ <dt>object <dd> <var title="">value</var>
+ </dl></li>
+
+ </ol></li>
+
+ </ol></li>
+
+ <li><p>Return <var title="">subject</var>.</li>
+
+ </ol><h5 id=examples-4><span class=secno>5.5.2.1 </span>Examples</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <div class=example>
+
+ <p>Here is an example of some HTML using Microdata to express RDF
+ statements:</p>
+
+ <pre>&lt;dl itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Work"
+ itemid="http://purl.oreilly.com/works/45U8QJGZSQKDH8N"&gt;
+ &lt;dt&gt;Title&lt;/dt&gt;
+ &lt;dd&gt;&lt;cite itemprop="http://purl.org/dc/terms/title"&gt;Just a Geek&lt;/cite&gt;&lt;/dd&gt;
+ &lt;dt&gt;By&lt;/dt&gt;
+ &lt;dd&gt;&lt;span itemprop="http://purl.org/dc/terms/creator"&gt;Wil Wheaton&lt;/span&gt;&lt;/dd&gt;
+ &lt;dt&gt;Format&lt;/dt&gt;
+ &lt;dd itemprop="http://purl.org/vocab/frbr/core#realization"
+ itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Expression"
+ itemid="http://purl.oreilly.com/products/9780596007683.BOOK"&gt;
+ &lt;link itemprop="http://purl.org/dc/terms/type" href="http://purl.oreilly.com/product-types/BOOK"&gt;
+ Print
+ &lt;/dd&gt;
+ &lt;dd itemprop="http://purl.org/vocab/frbr/core#realization"
+ itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Expression"
+ itemid="http://purl.oreilly.com/products/9780596802189.EBOOK"&gt;
+ &lt;link itemprop="http://purl.org/dc/terms/type" href="http://purl.oreilly.com/product-types/EBOOK"&gt;
+ Ebook
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+
+ <p>This is equivalent to the following Turtle:</p>
+
+ <pre class=turtle>@prefix dc: &lt;http://purl.org/dc/terms/&gt; .
+ @prefix frbr: &lt;http://purl.org/vocab/frbr/core#&gt; .
+
+&lt;http://purl.oreilly.com/works/45U8QJGZSQKDH8N&gt; a frbr:Work ;
+ dc:creator "Wil Wheaton"@en ;
+ dc:title "Just a Geek"@en ;
+ frbr:realization &lt;http://purl.oreilly.com/products/9780596007683.BOOK&gt;,
+ &lt;http://purl.oreilly.com/products/9780596802189.EBOOK&gt; .
+
+&lt;http://purl.oreilly.com/products/9780596007683.BOOK&gt; a frbr:Expression ;
+ dc:type &lt;http://purl.oreilly.com/product-types/BOOK&gt; .
+
+&lt;http://purl.oreilly.com/products/9780596802189.EBOOK&gt; a frbr:Expression ;
+ dc:type &lt;http://purl.oreilly.com/product-types/EBOOK&gt; .</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>The following snippet of HTML has microdata for two people with
+ the same address:</p>
+
+ <pre>&lt;p&gt;
+ Both
+ &lt;span itemscope itemtype="http://microformats.org/profile/hcard" itemref="home"&gt;&lt;span itemprop="fn"
+ &gt;&lt;span itemprop="n" itemscope&gt;&lt;span itemprop="given-name"&gt;Princeton&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
+ and
+ &lt;span itemscope itemtype="http://microformats.org/profile/hcard" itemref="home"&gt;&lt;span itemprop="fn"
+ &gt;&lt;span itemprop="n" itemscope&gt;&lt;span itemprop="given-name"&gt;Trekkie&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
+ live at
+ &lt;span id="home" itemprop="adr" itemscope&gt;&lt;span itemprop="street-address"&gt;Avenue Q&lt;/span&gt;.&lt;/span&gt;
+&lt;/p&gt;</pre>
+
+ <p>It generates these triples expressed in Turtle (including a
+ triple that in this case is expressed twice, though that is not
+ meaningful in RDF):</p>
+
+ <pre class=turtle>@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
+@prefix dct: &lt;http://purl.org/dc/terms/&gt; .
+@prefix hcard: &lt;http://www.w3.org/1999/xhtml/microdata#http://microformats.org/profile/hcard%23:&gt; .
+
+&lt;&gt; &lt;http://www.w3.org/1999/xhtml/microdata#item&gt; _:n0 ;
+ &lt;http://www.w3.org/1999/xhtml/microdata#item&gt; _:n1 .
+_:n0 rdf:type &lt;http://microformats.org/profile/hcard&gt; ;
+ hcard:fn "Princeton" ;
+ hcard:n _:n0a
+ hcard:adr _:n2 .
+_:n0a hcard:n%20given-name "Princeton" .
+_:n1 rdf:type &lt;http://microformats.org/profile/hcard&gt; ;
+ hcard:fn "Trekkie" ;
+ hcard:n _:n1a
+ hcard:adr _:n2 .
+_:n1a hcard:n%20given-name "Trekkie" .
+_:n2 hcard:adr%20street-address "Avenue Q" ;
+ hcard:adr%20street-address "Avenue Q" .</pre>
+
+ </div>
+
+
+
+ </div><!--data-component-->
+
+
+
+ <h4 id=atom><span class=secno>5.5.3 </span>Atom</h4>
+
+ <p>Given a <code><a href=#document>Document</a></code> <var title="">source</var>, a user
+ agent may run the following algorithm to <dfn id=extracting-atom title="extracting
+ Atom">extract an Atom feed</dfn>. This is not the only algorithm
+ that can be used for this purpose; for instance, a user agent might
+ instead use the hAtom algorithm. <a href=#refsHATOM>[HATOM]</a></p>
+
+ <ol><li><p>If the <code><a href=#document>Document</a></code> <var title="">source</var> does
+ not contain any <code><a href=#the-article-element>article</a></code> elements, then return nothing
+ and abort these steps. This algorithm can only be used with
+ documents that contain distinct articles.</p>
+
+ <li><p>Let <var title="">R</var> be an empty <a href=#xml-documents title="XML
+ documents">XML</a> <code><a href=#document>Document</a></code> object whose <a href="#the-document's-address" title="the document's address">address</a> is user-agent
+ defined.</li>
+
+ <li><p>Append a <code title="">feed</code> element in the
+ <a href=#atom-namespace>Atom namespace</a> to <var title="">R</var>.</li>
+
+ <li>
+
+ <p>For each <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute and a <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute and whose <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute's value is <code title=meta-author><a href=#meta-author>author</a></code>, run the following substeps:</p>
+
+ <ol><li><p>Append an <code title="">author</code> element in the
+ <a href=#atom-namespace>Atom namespace</a> to the root element of <var title="">R</var>.</li>
+
+ <li><p>Append a <code title="">name</code> element in the
+ <a href=#atom-namespace>Atom namespace</a> to the element created in the
+ previous step.</p>
+
+ <li><p>Append a text node whose data is the value of the
+ <code><a href=#meta>meta</a></code> element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute to the element
+ created in the previous step.</li>
+
+ </ol><!-- could use vCards instead, and get <atom:email> and <atom:uri>
+ elements out of this instead of just <atom:name> --></li>
+
+ <li>
+
+ <p>If there is a <code><a href=#the-link-element>link</a></code> element whose <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute's value includes the
+ keyword <code title=rel-icon><a href=#rel-icon>icon</a></code>, and that element also
+ has an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute whose
+ value successfully <a href=#resolve-a-url title="resolve a url">resolves</a>
+ relative to the <code><a href=#the-link-element>link</a></code> element, then append an <code title="">icon</code> element in the <a href=#atom-namespace>Atom namespace</a> to
+ the root element of <var title="">R</var> whose contents is a text
+ node with its data set to the <a href=#absolute-url>absolute URL</a> resulting
+ from <a href=#resolve-a-url title="resolve a url">resolving</a> the value of the
+ <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute.</p>
+
+ <!-- could check ratio, could check type... -->
+
+ </li>
+
+ <li>
+
+ <p>Append an <code title="">id</code> element in the <a href=#atom-namespace>Atom
+ namespace</a> to the root element of <var title="">R</var>
+ whose contents is a text node with its data set to <a href="#the-document's-current-address">the
+ document's current address</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Optionally: Let <var title="">x</var> be a <code title="">link</code> element in the <a href=#atom-namespace>Atom
+ namespace</a>. Add a <code title="">rel</code> attribute whose
+ value is the string "<code title="">self</code>" to <var title="">x</var>. Append a text node with its data set to the
+ (user-agent-defined) <a href="#the-document's-address" title="the document's
+ address">address</a> of <var title="">R</var> to <var title="">x</var>. Append <var title="">x</var> to the root element
+ of <var title="">R</var>.</p>
+
+ <p class=note>This step would be skipped when the document <var title="">R</var> has no convenient <a href="#the-document's-address" title="the document's
+ address">address</a>. The presence of the <code title="">rel="self"</code> link is a "should"-level requirement in
+ the Atom specification.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">x</var> be a <code title="">link</code>
+ element in the <a href=#atom-namespace>Atom namespace</a>. Add a <code title="">rel</code> attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. If the
+ document being converted is an <a href=#html-documents title="HTML documents">HTML
+ document</a>, add a <code title="">type</code> attribute whose
+ value is the string "<code><a href=#text/html>text/html</a></code>" to <var title="">x</var>. Otherwise, the document being converted is an
+ <a href=#xml-documents title="XML documents">XML document</a>; add a <code title="">type</code> attribute whose value is the string
+ "<code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>" to <var title="">x</var>. Append a text node with its data set to
+ <a href="#the-document's-current-address">the document's current address</a> to <var title="">x</var>. Append <var title="">x</var> to the root element
+ of <var title="">R</var>.</p>
+
+ </li>
+
+ <li><p>Let <var title="">subheading text</var> be the empty
+ string.</li>
+
+ <li><p>Let <var title="">heading</var> be the first element of
+ <a href=#heading-content>heading content</a> whose nearest ancestor of
+ <a href=#sectioning-content>sectioning content</a> is <a href=#the-body-element>the body
+ element</a>, if any, or null if there is none.</li>
+
+ <li>
+
+ <p>Take the appropriate action from the following list, as
+ determined by the type of the <var title="">heading</var>
+ element:</p>
+
+ <dl><dt>If <var title="">heading</var> is null</dt>
+
+ <dd>
+
+ <p>Let <var title="">heading text</var> be the
+ <code><a href=#textcontent>textContent</a></code> of <a href=#the-title-element>the <code>title</code>
+ element</a>, if there is one, or the empty string
+ otherwise.</p>
+
+ </dd>
+
+ <dt>If <var title="">heading</var> is a <code><a href=#the-hgroup-element>hgroup</a></code> element</dt>
+
+ <dd>
+
+ <p>If <var title="">heading</var> contains no child
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements, let <var title="">heading text</var> be the empty string.</p>
+
+ <p>Otherwise, let <var title="">headings list</var> be a list of
+ all the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element children
+ of <var title="">heading</var>, sorted first by descending
+ <a href=#rank>rank</a> and then in <a href=#tree-order>tree order</a> (so
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>s first, then <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>s, etc, with each
+ group in the order they appear in the document). Then, let <var title="">heading text</var> be the <code><a href=#textcontent>textContent</a></code> of
+ the first entry in <var title="">headings list</var>, and if
+ there are multiple entries, let <var title="">subheading
+ text</var> be the <code><a href=#textcontent>textContent</a></code> of the second entry
+ in <var title="">headings list</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">heading</var> is an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element</dt>
+
+ <dd>
+
+ <p>Let <var title="">heading text</var> be the
+ <code><a href=#textcontent>textContent</a></code> of <var title="">heading</var>.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>Append a <code title="">title</code> element in the <a href=#atom-namespace>Atom
+ namespace</a> to the root element of <var title="">R</var>
+ whose contents is a text node with its data set to <var title="">heading text</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">subheading text</var> is not the empty string,
+ append a <code title="">subtitle</code> element in the <a href=#atom-namespace>Atom
+ namespace</a> to the root element of <var title="">R</var>
+ whose contents is a text node with its data set to <var title="">subheading text</var>.</p>
+
+ </li>
+
+ <li><p>Let <var title="">global update date</var> have no
+ value.</li>
+
+ <li>
+
+ <p>For each <code><a href=#the-article-element>article</a></code> element <var title="">article</var> that does not have an ancestor
+ <code><a href=#the-article-element>article</a></code> element, run the following steps:</p>
+
+ <ol><li><p>Let <var title="">E</var> be an <code title="">entry</code> element in the <a href=#atom-namespace>Atom namespace</a>,
+ and append <var title="">E</var> to the root element of <var title="">R</var>.</li>
+
+ <li><p>Let <var title="">heading</var> be the first element of
+ <a href=#heading-content>heading content</a> whose nearest ancestor of
+ <a href=#sectioning-content>sectioning content</a> is <var title="">article</var>,
+ if any, or null if there is none.</li>
+
+ <li>
+
+ <p>Take the appropriate action from the following list, as
+ determined by the type of the <var title="">heading</var>
+ element:</p>
+
+ <dl><dt>If <var title="">heading</var> is null</dt>
+
+ <dd>
+
+ <p>Let <var title="">heading text</var> be the empty
+ string.</p>
+
+ </dd>
+
+ <dt>If <var title="">heading</var> is a <code><a href=#the-hgroup-element>hgroup</a></code> element</dt>
+
+ <dd>
+
+ <p>If <var title="">heading</var> contains no child
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements, let <var title="">heading text</var> be the empty string.</p>
+
+ <p>Otherwise, let <var title="">headings list</var> be a list
+ of all the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element
+ children of <var title="">heading</var>, sorted first by
+ descending <a href=#rank>rank</a> and then in <a href=#tree-order>tree
+ order</a> (so <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>s first, then
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>s, etc, with each group in the order they
+ appear in the document). Then, let <var title="">heading
+ text</var> be the <code><a href=#textcontent>textContent</a></code> of the first entry
+ in <var title="">headings list</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">heading</var> is an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element</dt>
+
+ <dd>
+
+ <p>Let <var title="">heading text</var> be the
+ <code><a href=#textcontent>textContent</a></code> of <var title="">heading</var>.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>Append a <code title="">title</code> element in the
+ <a href=#atom-namespace>Atom namespace</a> to <var title="">E</var> whose
+ contents is a text node with its data set to <var title="">heading text</var>.</p>
+
+ </li>
+
+ <!-- <atom:author> is required either at the feed level (above)
+ or the entry level (here) but we don't provide it -->
+
+ <li>
+
+ <p>Clone <var title="">article</var> and its descendants into an
+ environment that has <a href=#concept-bc-noscript title=concept-bc-noscript>scripting
+ disabled</a>, has no <a href=#plugin title=plugin>plugins</a>, and
+ fails any attempt to <a href=#fetch title=fetch>fetch</a> any
+ resources. Let <var title="">cloned article</var> be the
+ resulting clone <code><a href=#the-article-element>article</a></code> element.</p>
+
+ </li>
+
+ <li>
+
+ <p>Remove from the subtree rooted at <var title="">cloned
+ article</var> any <code><a href=#the-article-element>article</a></code> elements other than the
+ <var title="">cloned article</var> itself, any
+ <code><a href=#the-header-element>header</a></code>, <code><a href=#the-footer-element>footer</a></code>, or <code><a href=#the-nav-element>nav</a></code>
+ elements whose nearest ancestor of <a href=#sectioning-content>sectioning
+ content</a> is the <var title="">cloned article</var>, and
+ the first element of <a href=#heading-content>heading content</a> whose nearest
+ ancestor of <a href=#sectioning-content>sectioning content</a> is the <var title="">cloned article</var>, if any.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">cloned article</var> contains any
+ <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> elements with <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> attributes whose
+ values <a href=#parse-a-global-date-and-time-string title="parse a global date and time string">parse
+ as global date and time strings</a> without errors, then let
+ <var title="">update date</var> be the value of the <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> attribute that parses
+ to the newest <a href=#concept-datetime title=concept-datetime>global date and
+ time</a>.</p>
+
+ <p>Otherwise, let <var title="">update date</var> have no
+ value.</p>
+
+ <p class=note>This value is used below; it is calculated here
+ because in certain cases the next step mutates the <var title="">cloned article</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the document being converted is an <a href=#html-documents title="HTML
+ documents">HTML document</a>, then: Let <var title="">x</var>
+ be a <code title="">content</code> element in the <a href=#atom-namespace>Atom
+ namespace</a>. Add a <code title="">type</code> attribute
+ whose value is the string "<code title="">html</code>" to <var title="">x</var>. Append a text node with its data set to the
+ result of running the <a href=#html-fragment-serialization-algorithm>HTML fragment serialization
+ algorithm</a> on <var title="">cloned article</var> to <var title="">x</var>. Append <var title="">x</var> to <var title="">E</var>.</p>
+
+ <p>Otherwise, the document being converted is an <a href=#xml-documents title="XML documents">XML document</a>: Let <var title="">x</var> be a <code title="">content</code> element in
+ the <a href=#atom-namespace>Atom namespace</a>. Add a <code title="">type</code> attribute whose value is the string "<code title="">xml</code>" to <var title="">x</var>. Append a
+ <code><a href=#the-div-element>div</a></code> element to <var title="">x</var>. Move all the
+ child nodes of the <var title="">cloned article</var> node to
+ that <code><a href=#the-div-element>div</a></code> element, preserving their relative
+ order. Append <var title="">x</var> to <var title="">E</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Establish the value of <var title="">id</var> and <var title="">has-alternate</var> from the first of the following to
+ apply:</p>
+
+ <dl><dt>If the <var title="">article</var> node has a descendant
+ <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute that
+ successfully <a href=#resolve-a-url title="resolve a url">resolves</a>
+ relative to that descendant and a <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute whose value
+ includes the <code title=rel-bookmark><a href=#link-type-bookmark>bookmark</a></code>
+ keyword</dt>
+
+ <dd>Let <var title="">id</var> be the <a href=#absolute-url>absolute URL</a>
+ resulting from <a href=#resolve-a-url title="resolve a url">resolving</a> the
+ value of the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
+ attribute of the first such <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code>
+ element, relative to the element. Let <var title="">has-alternate</var> be true.</dd>
+
+ <dt>If the <var title="">article</var> node has an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute</dt>
+
+ <dd>Let <var title="">id</var> be <a href="#the-document's-current-address">the document's current
+ address</a>, with the fragment identifier (if any) removed,
+ and with a new fragment identifier specified, consisting of the
+ value of the <var title="">article</var> element's <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute. Let <var title="">has-alternate</var> be false.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>Let <var title="">id</var> be a user-agent-defined
+ undereferenceable yet globally unique <a href=#valid-url title="valid
+ URL">valid</a> <a href=#absolute-url>absolute URL</a>. The same
+ <a href=#absolute-url>absolute URL</a> should be generated for each run of
+ this algorithm when given the same input. Let <var title="">has-alternate</var> be false.</dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>Append an <code title="">id</code> element in the <a href=#atom-namespace>Atom
+ namespace</a> to <var title="">E</var> whose contents is a
+ text node with its data set to <var title="">id</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">has-alternate</var> is true: Let <var title="">x</var> be a <code title="">link</code> element in the
+ <a href=#atom-namespace>Atom namespace</a>. Add a <code title="">rel</code>
+ attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. Append a
+ text node with its data set to <var title="">id</var> to <var title="">x</var>. Append <var title="">x</var> to <var title="">E</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">article</var> has a <code><a href=#the-time-element>time</a></code>
+ element descendant that has a <code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code> attribute and whose
+ nearest ancestor <code><a href=#the-article-element>article</a></code> element is <var title="">article</var>, and the first such element's <a href=#concept-time-date title=concept-time-date>date</a> is not unknown, then run
+ the following substeps, with <var title="">e</var> being the
+ first such element:</p>
+
+ <ol><li><p>Let <var title="">datetime</var> be a <a href=#concept-datetime title=concept-datetime>global date and time</a> whose date
+ component is the <a href=#concept-time-date title=concept-time-date>date</a> of
+ <var title="">e</var>.</li>
+
+ <li><p>If <var title="">e</var>'s <a href=#concept-time-time title=concept-time-time>time</a> and <a href=#concept-time-timezone title=concept-time-timezone>time-zone offset</a> are not
+ unknown, then let <var title="">datetime</var>'s time and
+ time-zone offset components be the <a href=#concept-time-time title=concept-time-time>time</a> and <a href=#concept-time-timezone title=concept-time-timezone>time-zone offset</a> of <var title="">e</var>. Otherwise, let them be midnight and no offset
+ respectively ("<code title="">00:00Z</code>").</li>
+
+ <li><p>Let <var title="">publication date</var> be the
+ <a href=#best-representation-of-the-global-date-and-time-string>best representation of the global date and time
+ string</a> <var title="">datetime</var>.</li>
+
+ </ol><p>Otherwise, let <var title="">publication date</var> have no
+ value.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">update date</var> has no value but <var title="">publication date</var> does, then let <var title="">update date</var> have the value of <var title="">publication date</var>.</p>
+
+ <p>Otherwise, if <var title="">publication date</var> has no
+ value but <var title="">update date</var> does, then let <var title="">publication date</var> have the value of <var title="">update date</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">update date</var> has a value, and <var title="">global update date</var> has no value or is less recent
+ than <var title="">update date</var>, then let <var title="">global update date</var> have the value of <var title="">update date</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">publication date</var> and <var title="">update date</var> both still have no value, then let
+ them both value a value that is a <a href=#valid-global-date-and-time-string>valid global date and
+ time string</a> representing the <a href=#concept-datetime title=concept-datetime>global date and time</a> of the
+ moment that this algorithm was invoked.</p>
+
+ </li>
+
+ <li>
+
+ <p>Append an <code title="">published</code> element in the
+ <a href=#atom-namespace>Atom namespace</a> to <var title="">E</var> whose
+ contents is a text node with its data set to <var title="">publication date</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Append an <code title="">updated</code> element in the
+ <a href=#atom-namespace>Atom namespace</a> to <var title="">E</var> whose
+ contents is a text node with its data set to <var title="">update date</var>.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li>
+
+ <p>If <var title="">global update date</var> has no value, then
+ let it have a value that is a <a href=#valid-global-date-and-time-string>valid global date and time
+ string</a> representing the <a href=#concept-datetime title=concept-datetime>global date and time</a> of the date
+ and time of the <code><a href=#document>Document</a></code>'s source file's last
+ modification, if it is known, or else of the moment that this
+ algorithm was invoked.</p>
+
+ </li>
+
+ <li>
+
+ <p>Insert an <code title="">updated</code> element in the
+ <a href=#atom-namespace>Atom namespace</a> into the root element of <var title="">R</var> before the first <code title="">entry</code> in
+ the <a href=#atom-namespace>Atom namespace</a> whose contents is a text node with
+ its data set to <var title="">global update date</var>.</p>
+
+ </li>
+
+ <li><p>Return the Atom document <var title="">R</var>.</li>
+
+ </ol><p class=note>The above algorithm does not guarantee that the
+ output will be a conforming Atom feed. In particular, if
+ insufficient information is provided in the document (e.g. if the
+ document does not have any <code title="">&lt;meta name="author"
+ content="..."&gt;</code> elements), then the output will not be
+ conforming.</p>
+
+ <p>The <dfn id=atom-namespace>Atom namespace</dfn> is: <code>http://www.w3.org/2005/Atom</code></p>
+
+
+
+ </div>
+
+
+
+
+
+ <h2 id=browsers><span class=secno>6 </span>Loading Web pages</h2>
+
+ <div class=impl>
+
+ <p>This section describes features that apply most directly to Web
+ browsers. Having said that, except where specified otherwise, the
+ requirements defined in this section <em>do</em> apply to all user
+ agents, whether they are Web browsers or not.</p>
+
+ </div>
+
+
+
+ <h3 id=windows><span class=secno>6.1 </span>Browsing contexts</h3>
+
+ <p>A <dfn id=browsing-context>browsing context</dfn> is an environment in which
+ <code><a href=#document>Document</a></code> objects are presented to the user.</p>
+
+ <p class=note>A tab or window in a Web browser typically contains
+ a <a href=#browsing-context>browsing context</a>, as does an <code><a href=#the-iframe-element>iframe</a></code><span class=impl> or <code><a href=#frame>frame</a></code>s in a
+ <code><a href=#frameset>frameset</a></code></span>.</p>
+
+ <p>Each <a href=#browsing-context>browsing context</a> has a corresponding
+ <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
+
+ <p>A <a href=#browsing-context>browsing context</a> has a <a href=#session-history>session
+ history</a>, which lists the <code><a href=#document>Document</a></code> objects that
+ that <a href=#browsing-context>browsing context</a> has presented, is presenting, or
+ will present. At any time, one <code><a href=#document>Document</a></code> in each
+ <a href=#browsing-context>browsing context</a> is designated the <dfn id=active-document>active
+ document</dfn>.</p>
+
+ <p>Each <code><a href=#document>Document</a></code> is associated with a
+ <code><a href=#window>Window</a></code> object. A <a href=#browsing-context>browsing context</a>'s
+ <code><a href=#windowproxy>WindowProxy</a></code> object forwards everything to the
+ <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a>'s
+ <code><a href=#window>Window</a></code> object.</p>
+
+ <p class=note>In general, there is a 1-to-1 mapping from the
+ <code><a href=#window>Window</a></code> object to the <code><a href=#document>Document</a></code> object. In
+ one particular case, a <code><a href=#window>Window</a></code> can be reused for the
+ presentation of a second <code><a href=#document>Document</a></code> in the same
+ <a href=#browsing-context>browsing context</a>, such that the mapping is then
+ 2-to-1. This occurs when a <a href=#browsing-context>browsing context</a> is <a href=#navigate title=navigate>navigated</a> from the initial
+ <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> to another, with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ <p class=note>A <code><a href=#document>Document</a></code> does not necessarily have a
+ <a href=#browsing-context>browsing context</a> associated with it. In particular,
+ data mining tools are likely to never instantiate browsing
+ contexts.</p>
+
+ <hr><p>A <a href=#browsing-context>browsing context</a> can have a <dfn id=creator-browsing-context>creator browsing
+ context</dfn>, the <a href=#browsing-context>browsing context</a> that was
+ responsible for its creation. If a <a href=#browsing-context>browsing context</a> has
+ a <a href=#parent-browsing-context>parent browsing context</a>, then that is its
+ <a href=#creator-browsing-context>creator browsing context</a>. Otherwise, if the
+ <a href=#browsing-context>browsing context</a> has an <a href=#opener-browsing-context>opener browsing
+ context</a>, then <em>that</em> is its <a href=#creator-browsing-context>creator browsing
+ context</a>. Otherwise, the <a href=#browsing-context>browsing context</a> has no
+ <a href=#creator-browsing-context>creator browsing context</a>.</p>
+
+ <p>If a <a href=#browsing-context>browsing context</a> <var title="">A</var> has a
+ <a href=#creator-browsing-context>creator browsing context</a>, then the
+ <code><a href=#document>Document</a></code> that was the <a href=#active-document>active document</a> of
+ that <a href=#creator-browsing-context>creator browsing context</a> at the time <var title="">A</var> was created is the <dfn id=creator-document>creator
+ <code>Document</code></dfn>.</p>
+
+ <div class=impl>
+
+ <p>When a <a href=#browsing-context>browsing context</a> is first created, it must be
+ created with a single <code><a href=#document>Document</a></code> in its session history,
+ whose <a href="#the-document's-address" title="the document's address">address</a> is
+ <code><a href=#about:blank>about:blank</a></code>, which is marked as being an <a href=#html-documents title="HTML documents">HTML document</a>, and whose <a href="#document's-character-encoding" title="document's character encoding">character encoding</a> is
+ UTF-8. The <code><a href=#document>Document</a></code> must have a single child
+ <code><a href=#the-html-element-0>html</a></code> node, which itself has a single child
+ <code><a href=#the-body-element-0>body</a></code> node.</p>
+
+ <p class=note>If the <a href=#browsing-context>browsing context</a> is created
+ specifically to be immediately navigated, then that initial
+ navigation will have <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ <p id=about-blank-origin>The <a href=#origin>origin</a> of the
+ <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> is set when the
+ <code><a href=#document>Document</a></code> is created. If the new <a href=#browsing-context>browsing
+ context</a> has a <a href=#creator-browsing-context>creator browsing context</a>, then the
+ <a href=#origin>origin</a> of the <code><a href=#about:blank>about:blank</a></code>
+ <code><a href=#document>Document</a></code> is the <a href=#origin>origin</a> of the
+ <a href=#creator-document>creator <code>Document</code></a>. Otherwise, the
+ <a href=#origin>origin</a> of the <code><a href=#about:blank>about:blank</a></code>
+ <code><a href=#document>Document</a></code> is a globally unique identifier assigned when
+ the new <a href=#browsing-context>browsing context</a> is created.</p>
+
+ </div>
+
+
+ <h4 id=nested-browsing-contexts><span class=secno>6.1.1 </span>Nested browsing contexts</h4>
+
+ <p>Certain elements (for example, <code><a href=#the-iframe-element>iframe</a></code> elements) can
+ instantiate further <a href=#browsing-context title="browsing context">browsing
+ contexts</a>. These are called <dfn id=nested-browsing-context title="nested browsing
+ context">nested browsing contexts</dfn>. If a browsing context <var title="">P</var> has an element <var title="">E</var> in one of its
+ <code><a href=#document>Document</a></code>s <var title="">D</var> that nests another
+ browsing context <var title="">C</var> inside it, then <var title="">P</var> is said to be the <dfn id=parent-browsing-context>parent browsing
+ context</dfn> of <var title="">C</var>, <var title="">C</var> is
+ said to be a <dfn id=child-browsing-context>child browsing context</dfn> of <var title="">P</var>, <var title="">C</var> is said to be <dfn id=browsing-context-nested-through title="browsing context nested through">nested through</dfn> <var title="">D</var>, and <var title="">E</var> is said to be the
+ <dfn id=browsing-context-container>browsing context container</dfn> of <var title="">C</var>.</p>
+
+ <p>A browsing context <var title="">A</var> is said to be an
+ ancestor of a browsing context <var title="">B</var> if there exists
+ a browsing context <var title="">A'</var> that is a <a href=#child-browsing-context>child
+ browsing context</a> of <var title="">A</var> and that is itself
+ an ancestor of <var title="">B</var>, or if there is a browsing
+ context <var title="">P</var> that is a <a href=#child-browsing-context>child browsing
+ context</a> of <var title="">A</var> and that is the <a href=#parent-browsing-context>parent
+ browsing context</a> of <var title="">B</var>.</p>
+
+ <p>The browsing context with no <a href=#parent-browsing-context>parent browsing context</a>
+ is the <dfn id=top-level-browsing-context>top-level browsing context</dfn> of all the browsing
+ contexts <a href=#nested-browsing-context title="nested browsing context">nested</a> within
+ it (either directly or indirectly through other nested browsing
+ contexts).</p>
+
+ <p>The transitive closure of <a href=#parent-browsing-context title="parent browsing
+ context">parent browsing contexts</a> for a <a href=#nested-browsing-context>nested browsing
+ context</a> gives the list of <dfn id=ancestor-browsing-context title="ancestor browsing
+ context">ancestor browsing contexts</dfn>.</p>
+
+ <p>The <dfn id=list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts</dfn> of a
+ <code><a href=#document>Document</a></code> <var title="">d</var> is the list returned by
+ the following algorithm:</p>
+
+ <ol><li><p>Let <var title="">list</var> be an empty list.</li>
+
+ <li><p>For each <a href=#child-browsing-context>child browsing context</a> of <var title="">d</var> that is <a href=#browsing-context-nested-through title="browsing context nested
+ through">nested through</a> an element that is <a href=#in-a-document title="in a
+ document">in the <code>Document</code></a> <var title="">d</var>, in the <a href=#tree-order>tree order</a> of the elements of
+ the elements nesting those <a href=#browsing-context title="browsing context">browsing
+ contexts</a>, append to the list <var title="">list</var> the
+ <a href=#list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts</a> of the
+ <a href=#active-document>active document</a> of that <a href=#child-browsing-context>child browsing
+ context</a>.</li>
+
+ <li><p>Return the constructed <var title="">list</var>.</li>
+
+ </ol><hr><p>A <code><a href=#document>Document</a></code> is said to be <dfn id=fully-active>fully active</dfn>
+ when it is the <a href=#active-document>active document</a> of its <a href=#browsing-context>browsing
+ context</a>, and either its browsing context is a <a href=#top-level-browsing-context>top-level
+ browsing context</a>, or the <code><a href=#document>Document</a></code> <a href=#browsing-context-nested-through title="browsing context nested through">through which</a> that
+ browsing context is <a href=#nested-browsing-context title="nested browsing
+ context">nested</a> is itself <a href=#fully-active>fully active</a>.</p>
+
+ <p>Because they are nested through an element, <a href=#child-browsing-context title="child
+ browsing context">child browsing contexts</a> are always tied to
+ a specific <code><a href=#document>Document</a></code> in their <a href=#parent-browsing-context>parent browsing
+ context</a>. User agents must not allow the user to interact with
+ <a href=#child-browsing-context title="child browsing context">child browsing contexts</a>
+ of elements that are in <code><a href=#document>Document</a></code>s that are not
+ themselves <a href=#fully-active>fully active</a>.</p>
+
+ <p>A <a href=#nested-browsing-context>nested browsing context</a> can have a <a href=#seamless-browsing-context-flag>seamless
+ browsing context flag</a> set, if it is embedded through an
+ <code><a href=#the-iframe-element>iframe</a></code> element with a <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attribute.</p>
+
+
+ <h5 id=navigating-nested-browsing-contexts-in-the-dom><span class=secno>6.1.1.1 </span>Navigating nested browsing contexts in the DOM</h5>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-top><a href=#dom-top>top</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> for the <a href=#top-level-browsing-context>top-level browsing context</a>.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-parent><a href=#dom-parent>parent</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> for the <a href=#parent-browsing-context>parent browsing context</a>.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-frameElement><a href=#dom-frameelement>frameElement</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#element>Element</a></code> for the <a href=#browsing-context-container>browsing context container</a>.</p>
+
+ <p>Returns null if there isn't one.</p>
+
+ <p>Throws a <code><a href=#security_err>SECURITY_ERR</a></code> exception in cross-origin situations.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-top title=dom-top><code>top</code></dfn> IDL attribute on
+ the <code><a href=#window>Window</a></code> object of a <code><a href=#document>Document</a></code> in a
+ <a href=#browsing-context>browsing context</a> <var title="">b</var> must return the
+ <code><a href=#windowproxy>WindowProxy</a></code> object of its <a href=#top-level-browsing-context>top-level browsing
+ context</a> (which would be its own <code><a href=#windowproxy>WindowProxy</a></code>
+ object if it was a <a href=#top-level-browsing-context>top-level browsing context</a>
+ itself).</p>
+
+ <p>The <dfn id=dom-parent title=dom-parent><code>parent</code></dfn> IDL
+ attribute on the <code><a href=#window>Window</a></code> object of a
+ <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a> <var title="">b</var> must return the <code><a href=#windowproxy>WindowProxy</a></code> object of
+ the <a href=#parent-browsing-context>parent browsing context</a>, if there is one (i.e. if
+ <var title="">b</var> is a <a href=#child-browsing-context>child browsing context</a>), or
+ the <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context>browsing
+ context</a> <var title="">b</var> itself, otherwise (i.e. if it
+ is a <a href=#top-level-browsing-context>top-level browsing context</a>).</p>
+
+ <p>The <dfn id=dom-frameelement title=dom-frameElement><code>frameElement</code></dfn>
+ IDL attribute on the <code><a href=#window>Window</a></code> object of a
+ <code><a href=#document>Document</a></code> <var title="">d</var>, on getting, must run
+ the following algorithm:</p>
+
+ <ol><li><p>If <var title="">d</var> is not a <code><a href=#document>Document</a></code> in a
+ <a href=#child-browsing-context>child browsing context</a>, return null and abort these
+ steps.</li>
+
+ <li><p>If the <a href=#parent-browsing-context>parent browsing context</a>'s <a href=#active-document>active
+ document</a> does not have the <a href=#same-origin title="same
+ origin">same</a> <a href=#effective-script-origin>effective script origin</a> as the
+ <a href=#entry-script>entry script</a>, then throw a <code><a href=#security_err>SECURITY_ERR</a></code>
+ exception.</li>
+
+ <li><p>Otherwise, return the <a href=#browsing-context-container>browsing context
+ container</a> for <var title="">b</var>.</li>
+
+ </ol></div>
+
+
+
+ <h4 id=auxiliary-browsing-contexts><span class=secno>6.1.2 </span>Auxiliary browsing contexts</h4>
+
+ <p>It is possible to create new browsing contexts that are related
+ to a <a href=#top-level-browsing-context>top-level browsing context</a> without being nested
+ through an element. Such browsing contexts are called <dfn id=auxiliary-browsing-context title="auxiliary browsing context">auxiliary browsing
+ contexts</dfn>. Auxiliary browsing contexts are always <a href=#top-level-browsing-context title="top-level browsing context">top-level browsing
+ contexts</a>.</p>
+
+ <p>An <a href=#auxiliary-browsing-context>auxiliary browsing context</a> has an <dfn id=opener-browsing-context>opener
+ browsing context</dfn>, which is the <a href=#browsing-context>browsing context</a>
+ from which the <a href=#auxiliary-browsing-context>auxiliary browsing context</a> was created,
+ and it has a <dfn id=furthest-ancestor-browsing-context>furthest ancestor browsing context</dfn>, which is
+ the <a href=#top-level-browsing-context>top-level browsing context</a> of the <a href=#opener-browsing-context>opener
+ browsing context</a> when the <a href=#auxiliary-browsing-context>auxiliary browsing
+ context</a> was created.</p>
+
+
+ <h5 id=navigating-auxiliary-browsing-contexts-in-the-dom><span class=secno>6.1.2.1 </span>Navigating auxiliary browsing contexts in the DOM</h5>
+
+ <p>The <dfn id=dom-opener title=dom-opener><code>opener</code></dfn> IDL
+ attribute on the <code><a href=#window>Window</a></code> object must return the
+ <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context>browsing context</a>
+ from which the current <a href=#browsing-context>browsing context</a> was created
+ (its <a href=#opener-browsing-context>opener browsing context</a>), if there is one and it
+ is still available.</p>
+
+
+
+
+ <h4 id=secondary-browsing-contexts><span class=secno>6.1.3 </span>Secondary browsing contexts</h4>
+
+ <p>User agents may support <dfn id=secondary-browsing-context title="secondary browsing
+ context">secondary browsing contexts</dfn>, which are <a href=#browsing-context title="browsing context">browsing contexts</a> that form part of
+ the user agent's interface, apart from the main content area.</p>
+
+
+ <div class=impl>
+
+ <h4 id=security-nav><span class=secno>6.1.4 </span>Security</h4>
+
+ <p id=security-1>A <a href=#browsing-context>browsing context</a> <var title="">A</var> is <dfn id=allowed-to-navigate>allowed to navigate</dfn> a second
+ <a href=#browsing-context>browsing context</a> <var title="">B</var> if one of the
+ following conditions is true:</p>
+
+ <ul><li>Either the <a href=#origin>origin</a> of the <a href=#active-document>active
+ document</a> of <var title="">A</var> is the <a href=#same-origin title="same
+ origin">same</a> as the <a href=#origin>origin</a> of the <a href=#active-document>active
+ document</a> of <var title="">B</var>, or</li>
+
+ <li>The browsing context <var title="">A</var> is a <a href=#nested-browsing-context>nested
+ browsing context</a> and its <a href=#top-level-browsing-context>top-level browsing
+ context</a> is <var title="">B</var>, or</li>
+
+ <li>The browsing context <var title="">B</var> is an
+ <a href=#auxiliary-browsing-context>auxiliary browsing context</a> and <var title="">A</var>
+ is <a href=#allowed-to-navigate>allowed to navigate</a> <var title="">B</var>'s
+ <a href=#opener-browsing-context>opener browsing context</a>, or</li>
+
+ <li>The browsing context <var title="">B</var> is not a
+ <a href=#top-level-browsing-context>top-level browsing context</a>, but there exists an
+ <a href=#ancestor-browsing-context>ancestor browsing context</a> of <var title="">B</var>
+ whose <a href=#active-document>active document</a> has the <a href=#same-origin title="same
+ origin">same</a> <a href=#origin>origin</a> as the <a href=#active-document>active
+ document</a> of <var title="">A</var> (possibly in fact being
+ <var title="">A</var> itself).</li>
+
+ </ul><hr><p>An element has a <dfn id=browsing-context-scope-origin>browsing context scope origin</dfn> if its
+ <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> is a
+ <a href=#top-level-browsing-context>top-level browsing context</a> or if all of its
+ <code><a href=#document>Document</a></code>'s <a href=#ancestor-browsing-context title="ancestor browsing
+ context">ancestor browsing contexts</a> all have <a href=#active-document title="active document">active documents</a> whose
+ <a href=#origin>origin</a> are the <a href=#same-origin>same origin</a> as the
+ element's <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>. If an element
+ has a <a href=#browsing-context-scope-origin>browsing context scope origin</a>, then its value is
+ the <a href=#origin>origin</a> of the element's <code><a href=#document>Document</a></code>.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=groupings-of-browsing-contexts><span class=secno>6.1.5 </span>Groupings of browsing contexts</h4>
+
+ <p>Each <a href=#browsing-context>browsing context</a> is defined as having a list of
+ zero or more <dfn id=directly-reachable-browsing-contexts>directly reachable browsing contexts</dfn>. These
+ are:</p>
+
+ <ul><li>All the <a href=#browsing-context>browsing context</a>'s <a href=#child-browsing-context title="child
+ browsing context">child browsing contexts</a>.</li>
+
+ <li>The <a href=#browsing-context>browsing context</a>'s <a href=#parent-browsing-context>parent browsing
+ context</a>.</li>
+
+ <li>All the <a href=#browsing-context title="browsing context">browsing contexts</a>
+ that have the <a href=#browsing-context>browsing context</a> as their <a href=#opener-browsing-context>opener
+ browsing context</a>.</li>
+
+ <li>The <a href=#browsing-context>browsing context</a>'s <a href=#opener-browsing-context>opener browsing
+ context</a>.</li>
+
+ </ul><p>The transitive closure of all the <a href=#browsing-context title="browsing
+ context">browsing contexts</a> that are <a href=#directly-reachable-browsing-contexts>directly reachable
+ browsing contexts</a> forms a <dfn id=unit-of-related-browsing-contexts>unit of related browsing
+ contexts</dfn>.</p>
+
+ <p>Each <a href=#unit-of-related-browsing-contexts>unit of related browsing contexts</a> is then
+ further divided into the smallest number of groups such that every
+ member of each group has an <a href=#effective-script-origin>effective script origin</a>
+ that, through appropriate manipulation of the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute, could
+ be made to be the same as other members of the group, but could not
+ be made the same as members of any other group. Each such group is a
+ <dfn id=unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</dfn>.</p>
+
+ <p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing
+ contexts</a> can have a <dfn id=entry-script>entry script</dfn> which is used to
+ obtain, amongst other things, the <a href="#script's-base-url">script's base URL</a> to
+ <a href=#resolve-a-url title="resolve a url">resolve</a> relative <a href=#url title=URL>URLs</a> used in scripts running in that <a href=#unit-of-related-similar-origin-browsing-contexts>unit
+ of related similar-origin browsing contexts</a>. Initially, there
+ is no <a href=#entry-script>entry script</a>.</p>
+
+ <p class=note>There is at most one <a href=#event-loop>event loop</a> per
+ <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
+
+ </div>
+
+
+
+ <h4 id=browsing-context-names><span class=secno>6.1.6 </span>Browsing context names</h4>
+
+ <p>Browsing contexts can have a <dfn id=browsing-context-name>browsing context name</dfn>. By
+ default, a browsing context has no name (its name is not set).</p>
+
+ <p>A <dfn id=valid-browsing-context-name>valid browsing context name</dfn> is any string with at
+ least one character that does not start with a U+005F LOW LINE
+ character. (Names starting with an underscore are reserved for
+ special keywords.)</p>
+
+ <p>A <dfn id=valid-browsing-context-name-or-keyword>valid browsing context name or keyword</dfn> is any string
+ that is either a <a href=#valid-browsing-context-name>valid browsing context name</a> or that is
+ an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of: <code title="">_blank</code>, <code title="">_self</code>, <code title="">_parent</code>, or <code title="">_top</code>.</p>
+
+ <div class=impl>
+
+ <p><dfn id=the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>The rules for choosing a browsing context given a browsing
+ context name</dfn> are as follows. The rules assume that they are
+ being applied in the context of a <a href=#browsing-context>browsing context</a>.</p>
+
+ <ol><li><p>If the given browsing context name is the empty string or
+ <code title="">_self</code>, then the chosen browsing context must
+ be the current one.</li>
+
+ <li><p>If the given browsing context name is <code title="">_parent</code>, then the chosen browsing context must be
+ the <a href=#parent-browsing-context><em>parent</em> browsing context</a> of the current
+ one, unless there isn't one, in which case the chosen browsing
+ context must be the current browsing context.</li>
+
+ <li><p>If the given browsing context name is <code title="">_top</code>, then the chosen browsing context must be the
+ most <a href=#top-level-browsing-context>top-level browsing context</a> of the current
+ one.</li>
+
+ <li>
+
+ <p>If the given browsing context name is not <code title="">_blank</code> and there exists a browsing context whose
+ <a href=#browsing-context-name title="browsing context name">name</a> is the same as the
+ given browsing context name, and the current browsing context is
+ <a href=#allowed-to-navigate>allowed to navigate</a> that browsing context, and the
+ user agent determines that the two browsing contexts are related
+ enough that it is ok if they reach each other, then that browsing
+ context must be the chosen one. If there are multiple matching
+ browsing contexts, the user agent should select one in some
+ arbitrary consistent manner, such as the most recently opened,
+ most recently focused, or more closely related.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise, a new browsing context is being requested, and what
+ happens depends on the user agent's configuration and/or
+ abilities:</p>
+
+ <dl><dt id=sandboxWindowOpen>If the current browsing context had
+ the <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set
+ when its <a href=#active-document>active document</a> was created.</dt>
+
+ <dd><p>The user agent may offer to create a new <a href=#top-level-browsing-context>top-level
+ browsing context</a> or reuse an existing <a href=#top-level-browsing-context>top-level
+ browsing context</a>. If the user picks one of those options,
+ then the designated browsing context must be the chosen one (the
+ browsing context's name isn't set to the given browsing context
+ name). Otherwise (if the user agent doesn't offer the option to
+ the user, or if the user declines to allow a browsing context to
+ be used) there must not be a chosen browsing context.</dd>
+
+
+ <dt id=noopener>If the user agent has been configured such that
+ in this instance it will create a new browsing context, and the
+ browsing context is being requested as part of <a href=#following-hyperlinks title="following hyperlinks">following a hyperlink</a> whose
+ <a href=#linkTypes>link types</a> include the <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword</dt>
+
+ <dd><p>A new <a href=#top-level-browsing-context>top-level browsing context</a> must be
+ created. If the given browsing context name is not <code title="">_blank</code>, then the new top-level browsing context's
+ name must be the given browsing context name (otherwise, it has
+ no name). The chosen browsing context must be this new browsing
+ context.</p>
+
+ <p class=note>If it is immediately <a href=#navigate title=navigate>navigated</a>, then the navigation will be
+ done with <a href=#replacement-enabled>replacement enabled</a>.</dd>
+
+
+ <dt>If the user agent has been configured such that in this
+ instance it will create a new browsing context, and the <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword doesn't
+ apply</dt>
+
+ <dd><p>A new <a href=#auxiliary-browsing-context>auxiliary browsing context</a> must be
+ created, with the <a href=#opener-browsing-context>opener browsing context</a> being the
+ current one. If the given browsing context name is not <code title="">_blank</code>, then the new auxiliary browsing context's
+ name must be the given browsing context name (otherwise, it has
+ no name). The chosen browsing context must be this new browsing
+ context.</p>
+
+ <p>If it is immediately <a href=#navigate title=navigate>navigated</a>,
+ then the navigation will be done with <a href=#replacement-enabled>replacement
+ enabled</a>.</dd>
+
+
+ <dt>If the user agent has been configured such that in this
+ instance it will reuse the current browsing context</dt>
+
+ <dd><p>The chosen browsing context is the current browsing
+ context.</dd>
+
+
+ <dt>If the user agent has been configured such that in this
+ instance it will not find a browsing context</dt>
+
+ <dd><p>There must not be a chosen browsing context.</dd>
+
+ </dl><p>User agent implementors are encouraged to provide a way for
+ users to configure the user agent to always reuse the current
+ browsing context.</p>
+
+ </li>
+
+ </ol></div>
+
+
+
+
+ <h3 id=the-window-object><span class=secno>6.2 </span>The <code><a href=#window>Window</a></code> object</h3>
+
+ <pre class=idl>[OverrideBuiltins, ReplaceableNamedProperties] <!-- XXX http://www.w3.org/Bugs/Public/show_bug.cgi?id=8241 -->
+interface <dfn id=window>Window</dfn> {
+ // the current browsing context
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-window title=dom-window>window</a>;
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-self title=dom-self>self</a>;
+ readonly attribute <a href=#document>Document</a> <a href=#dom-document title=dom-document>document</a>;
+ attribute DOMString <a href=#dom-name title=dom-name>name</a>;
+ [PutForwards=<a href=#dom-location-href title=dom-location-href>href</a>] readonly attribute <a href=#location>Location</a> <a href=#dom-location title=dom-location>location</a>;
+ readonly attribute <a href=#history-0>History</a> <a href=#dom-history title=dom-history>history</a>;
+ readonly attribute <a href=#undomanager>UndoManager</a> <a href=#dom-undomanager title=dom-undoManager>undoManager</a>;
+ <a href=#selection-0>Selection</a> <a href=#dom-getselection title=dom-getSelection>getSelection</a>();
+ [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-locationbar title=dom-window-locationbar>locationbar</a>;
+ [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-menubar title=dom-window-menubar>menubar</a>;
+ [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-personalbar title=dom-window-personalbar>personalbar</a>;
+ [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-scrollbars title=dom-window-scrollbars>scrollbars</a>;
+ [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-statusbar title=dom-window-statusbar>statusbar</a>;
+ [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-toolbar title=dom-window-toolbar>toolbar</a>;<!--
+ [Replaceable] readonly attribute <span>BarProp</span> <span title="dom-window-directories">directories</span>; // legacy (Gecko-only) -->
+ void <a href=#dom-window-close title=dom-window-close>close</a>();
+ void <a href=#dom-window-stop title=dom-window-stop>stop</a>();
+ void <a href=#dom-window-focus title=dom-window-focus>focus</a>();
+ void <a href=#dom-window-blur title=dom-window-blur>blur</a>();
+
+ // other browsing contexts
+ [Replaceable] readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-frames title=dom-frames>frames</a>;
+ [Replaceable] readonly attribute unsigned long <a href=#dom-length title=dom-length>length</a>;
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-top title=dom-top>top</a>;
+ [Replaceable] readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-opener title=dom-opener>opener</a>;
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-parent title=dom-parent>parent</a>;
+ readonly attribute <a href=#element>Element</a> <a href=#dom-frameelement title=dom-frameElement>frameElement</a>;
+ <a href=#windowproxy>WindowProxy</a> <a href=#dom-open title=dom-open>open</a>(in optional DOMString url, in optional DOMString target, in optional DOMString features, in optional DOMString replace);
+ <a href=#dom-window-item title=dom-window-item>getter</a> <a href=#windowproxy>WindowProxy</a> (in unsigned long index);
+ <a href=#dom-window-nameditem title=dom-window-namedItem>getter</a> any (in DOMString name);
+
+ // the user agent
+ readonly attribute <a href=#navigator>Navigator</a> <a href=#dom-navigator title=dom-navigator>navigator</a>; <!-- IE also has window.clientInformation === window.navigator -->
+ readonly attribute <a href=#applicationcache>ApplicationCache</a> <a href=#dom-applicationcache title=dom-applicationCache>applicationCache</a>;
+
+ // user prompts
+ void <a href=#dom-alert title=dom-alert>alert</a>(in DOMString message);
+ boolean <a href=#dom-confirm title=dom-confirm>confirm</a>(in DOMString message);
+ DOMString <a href=#dom-prompt title=dom-prompt>prompt</a>(in DOMString message, in optional DOMString default);
+ void <a href=#dom-print title=dom-print>print</a>();
+ any <a href=#dom-showmodaldialog title=dom-showModalDialog>showModalDialog</a>(in DOMString url, in optional any argument<!--, in optional DOMString features-->);
+
+ // <a href=#web-messaging>cross-document messaging</a>
+ void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(in any message, in DOMString targetOrigin, in optional <a href=#messageportarray>MessagePortArray</a> ports);
+
+ // <a href=#event-handler-idl-attributes>event handler IDL attributes</a>
+ attribute <a href=#function>Function</a> <a href=#handler-onabort title=handler-onabort>onabort</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onafterprint title=handler-window-onafterprint>onafterprint</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeprint title=handler-window-onbeforeprint>onbeforeprint</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onblur title=handler-window-onblur>onblur</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncanplay title=handler-oncanplay>oncanplay</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncanplaythrough title=handler-oncanplaythrough>oncanplaythrough</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onchange title=handler-onchange>onchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onclick title=handler-onclick>onclick</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oncontextmenu title=handler-oncontextmenu>oncontextmenu</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondblclick title=handler-ondblclick>ondblclick</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondrag title=handler-ondrag>ondrag</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragend title=handler-ondragend>ondragend</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragenter title=handler-ondragenter>ondragenter</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragleave title=handler-ondragleave>ondragleave</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragover title=handler-ondragover>ondragover</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondragstart title=handler-ondragstart>ondragstart</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondrop title=handler-ondrop>ondrop</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ondurationchange title=handler-ondurationchange>ondurationchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onemptied title=handler-onemptied>onemptied</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onended title=handler-onended>onended</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onerror title=handler-window-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onfocus title=handler-window-onfocus>onfocus</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onformchange title=handler-onformchange>onformchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onforminput title=handler-onforminput>onforminput</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oninput title=handler-oninput>oninput</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-oninvalid title=handler-oninvalid>oninvalid</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeydown title=handler-onkeydown>onkeydown</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeypress title=handler-onkeypress>onkeypress</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onkeyup title=handler-onkeyup>onkeyup</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onload title=handler-window-onload>onload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadeddata title=handler-onloadeddata>onloadeddata</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadedmetadata title=handler-onloadedmetadata>onloadedmetadata</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onloadstart title=handler-onloadstart>onloadstart</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousedown title=handler-onmousedown>onmousedown</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousemove title=handler-onmousemove>onmousemove</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseout title=handler-onmouseout>onmouseout</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseover title=handler-onmouseover>onmouseover</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmouseup title=handler-onmouseup>onmouseup</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onmousewheel title=handler-onmousewheel>onmousewheel</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-ononline title=handler-window-ononline>ononline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onpause title=handler-onpause>onpause</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onplay title=handler-onplay>onplay</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onplaying title=handler-onplaying>onplaying</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpagehide title=handler-window-onpagehide>onpagehide</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpageshow title=handler-window-onpageshow>onpageshow</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpopstate title=handler-window-onpopstate>onpopstate</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onprogress title=handler-onprogress>onprogress</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onratechange title=handler-onratechange>onratechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onreadystatechange title=handler-onreadystatechange>onreadystatechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onredo title=handler-window-onredo>onredo</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onresize title=handler-window-onresize>onresize</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onscroll title=handler-onscroll>onscroll</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onseeked title=handler-onseeked>onseeked</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onseeking title=handler-onseeking>onseeking</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onselect title=handler-onselect>onselect</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onshow title=handler-onshow>onshow</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onstalled title=handler-onstalled>onstalled</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onstorage title=handler-window-onstorage>onstorage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onsubmit title=handler-onsubmit>onsubmit</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onsuspend title=handler-onsuspend>onsuspend</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-ontimeupdate title=handler-ontimeupdate>ontimeupdate</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onundo title=handler-window-onundo>onundo</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onunload title=handler-window-onunload>onunload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onvolumechange title=handler-onvolumechange>onvolumechange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onwaiting title=handler-onwaiting>onwaiting</a>;
+};
+<a href=#window>Window</a> implements <a href=#eventtarget>EventTarget</a>;</pre>
+
+<!-- for more features to add here, look here:
+ http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_window.asp
+ http://www.mozilla.org/docs/dom/domref/dom_window_ref.html
+ http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindow.idl - scrollBy, etc
+ http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindowInternal.idl - DOM level 0
+-->
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-window><a href=#dom-window>window</a></code></dt>
+ <dt><var title="">window</var> . <code title=dom-frames><a href=#dom-frames>frames</a></code></dt>
+ <dt><var title="">window</var> . <code title=dom-self><a href=#dom-self>self</a></code></dt>
+
+ <dd>
+
+ <p>These attributes all return <var title="">window</var>.</p>
+
+ </dd>
+
+
+ <dt><var title="">window</var> . <code title=dom-document><a href=#dom-document>document</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <a href=#active-document>active document</a>.</p>
+
+ </dd>
+
+
+ <dt><var title="">document</var> . <code title=dom-document-defaultView><a href=#dom-document-defaultview>defaultView</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#window>Window</a></code> object of the <a href=#active-document>active document</a>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-window title=dom-window><code>window</code></dfn>, <dfn id=dom-frames title=dom-frames><code>frames</code></dfn>, and <dfn id=dom-self title=dom-self><code>self</code></dfn> IDL attributes must all
+ return the <code><a href=#window>Window</a></code> object's <a href=#browsing-context>browsing
+ context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
+
+ <p>The <dfn id=dom-document title=dom-document><code>document</code></dfn> IDL
+ attribute must return the <code><a href=#document>Document</a></code> object of the
+ <code><a href=#window>Window</a></code> object's <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing
+ context</a>'s <a href=#active-document>active document</a>.</p>
+
+ <p>The <dfn id=dom-document-defaultview title=dom-document-defaultView><code>defaultView</code></dfn> IDL
+ attribute of the <code><a href=#htmldocument>HTMLDocument</a></code> interface must return the
+ <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a>'s
+ <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=security-window><span class=secno>6.2.1 </span>Security</h4>
+
+ <p id=security-2>User agents must raise a
+ <code><a href=#security_err>SECURITY_ERR</a></code> exception whenever any of the members of a
+ <code><a href=#window>Window</a></code> object are accessed by scripts whose
+ <a href=#effective-script-origin>effective script origin</a> is not the same as the
+ <code><a href=#window>Window</a></code> object's <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective
+ script origin</a>, with the following exceptions:</p>
+
+ <ul><li>The <code title=dom-location><a href=#dom-location>location</a></code> object
+
+ <li>The <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method
+
+ <li>The <code title=dom-frames><a href=#dom-frames>frames</a></code> attribute
+
+ <li>The <a href=#dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</a>
+
+ </ul><p>When a script whose <a href=#effective-script-origin>effective script origin</a> is not
+ the same as the <code><a href=#window>Window</a></code> object's <code><a href=#document>Document</a></code>'s
+ <a href=#effective-script-origin>effective script origin</a> attempts to access that
+ <code><a href=#window>Window</a></code> object's methods or attributes, the user agent
+ must act as if any changes to the <code><a href=#window>Window</a></code> object's
+ properties, getters, setters, etc, were not present.</p>
+
+ <p>For members that return objects (including function objects),
+ each distinct <a href=#effective-script-origin>effective script origin</a> that is not the
+ same as the <code><a href=#window>Window</a></code> object's <code><a href=#document>Document</a></code>'s
+ <a href=#effective-script-origin>effective script origin</a> must be provided with a
+ separate set of objects. These objects must have the prototype chain
+ appropriate for the script for which the objects are created (not
+ those that would be appropriate for scripts whose <a href="#script's-global-object">script's
+ global object</a> is the <code><a href=#window>Window</a></code> object in
+ question).</p>
+
+ <div class=example>
+
+ <p>For instance, if two frames containing <code><a href=#document>Document</a></code>s
+ from different <a href=#origin title=origin>origins</a> access the same
+ <code><a href=#window>Window</a></code> object's <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, they
+ will get distinct objects that are not equal.</p>
+
+ </div>
+
+ </div>
+
+
+
+ <h4 id=apis-for-creating-and-navigating-browsing-contexts-by-name><span class=secno>6.2.2 </span>APIs for creating and navigating browsing contexts by name</h4>
+
+ <dl class=domintro><dt><var title="">window</var> = <var title="">window</var> . <code title=dom-open><a href=#dom-open>open</a></code>( [ <var title="">url</var> [, <var title="">target</var> [, <var title="">features</var> [, <var title="">replace</var> ] ] ] ] )</dt>
+
+ <dd>
+
+ <p>Opens a window to show <var title="">url</var> (defaults to
+ <code><a href=#about:blank>about:blank</a></code>), and returns it. The <var title="">target</var> argument gives the name of the new
+ window. If a window exists with that name already, it is
+ reused. The <var title="">replace</var> attribute, if true, means
+ that whatever page is currently open in that window will be
+ removed from the window's session history. The <var title="">features</var> argument is ignored.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-name><a href=#dom-name>name</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the name of the window.</p>
+
+ <p>Can be set, to change the name.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-close><a href=#dom-window-close>close</a></code>()</dt>
+
+ <dd>
+
+ <p>Closes the window.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-stop><a href=#dom-window-stop>stop</a></code>()</dt>
+
+ <dd>
+
+ <p>Cancels the document load.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-open title=dom-open><code>open()</code></dfn> method on
+ <code><a href=#window>Window</a></code> objects provides a mechanism for <a href=#navigate title=navigate>navigating</a> an existing <a href=#browsing-context>browsing
+ context</a> or opening and navigating an <a href=#auxiliary-browsing-context>auxiliary browsing
+ context</a>.</p>
+
+ <p>The method has four arguments, though they are all optional.</p>
+
+ <p>The first argument, <var title="">url</var>, must be a
+ <a href=#valid-non-empty-url>valid non-empty URL</a> for a page to load in the browsing
+ context. If no arguments are provided, or if the first argument is
+ the empty string, then the <var title="">url</var> argument defaults
+ to "<code><a href=#about:blank>about:blank</a></code>". The argument must be <a href=#resolve-a-url title="resolve a url">resolved</a> to an <a href=#absolute-url>absolute
+ URL</a> (or an error), relative to the <a href=#entry-script>entry
+ script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>,
+ when the method is invoked.</p>
+
+ <p>The second argument, <var title="">target</var>, specifies the
+ <a href=#browsing-context-name title="browsing context name">name</a> of the browsing
+ context that is to be navigated. It must be a <a href=#valid-browsing-context-name-or-keyword>valid browsing
+ context name or keyword</a>. If fewer than two arguments are
+ provided, then the <var title="">name</var> argument defaults to the
+ value "<code>_blank</code>".</p>
+
+ <p>The third argument, <var title="">features</var>, has no effect
+ and is supported for historical reasons only.</p>
+
+ <p>The fourth argument, <var title="">replace</var>, specifies
+ whether or not the new page will <a href=#replacement-enabled title="replacement
+ enabled">replace</a> the page currently loaded in the browsing
+ context, when <var title="">target</var> identifies an existing
+ browsing context (as opposed to leaving the current page in the
+ browsing context's <a href=#session-history>session history</a>). When three or
+ fewer arguments are provided, <var title="">replace</var> defaults
+ to false.</p>
+
+ <p>When the method is invoked, the user agent must first select a
+ <a href=#browsing-context>browsing context</a> to navigate by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the
+ rules for choosing a browsing context given a browsing context
+ name</a> using the <var title="">target</var> argument as the
+ name and the <a href=#browsing-context>browsing context</a> of the script as the
+ context in which the algorithm is executed, unless the user has
+ indicated a preference, in which case the browsing context to
+ navigate may instead be the one indicated by the user.</p>
+
+ <p class=example>For example, suppose there is a user agent that
+ supports control-clicking a link to open it in a new tab. If a user
+ clicks in that user agent on an element whose <code title=handler-onclick><a href=#handler-onclick>onclick</a></code> handler uses the <code title=dom-open><a href=#dom-open>window.open()</a></code> API to open a page in an
+ iframe, but, while doing so, holds the control key down, the user
+ agent could override the selection of the target browsing context to
+ instead target a new tab.</p>
+
+ <p>Then, the user agent must <a href=#navigate>navigate</a> the selected
+ <a href=#browsing-context>browsing context</a> to the <a href=#absolute-url>absolute URL</a> (or
+ error) obtained from <a href=#resolve-a-url title="resolve a url">resolving</a>
+ <var title="">url</var> earlier. If the <var title="">replace</var>
+ is true, then <a href=#replacement-enabled title="replacement enabled">replacement must be
+ enabled</a>; otherwise, it must not be enabled unless the
+ <a href=#browsing-context>browsing context</a> was just created as part of
+ <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a browsing
+ context name</a>. The navigation must be done with the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the
+ <a href=#entry-script>entry script</a> as the <a href=#source-browsing-context>source browsing
+ context</a>.</p>
+
+ <p>The method must return the <code><a href=#windowproxy>WindowProxy</a></code> object of the
+ <a href=#browsing-context>browsing context</a> that was navigated, or null if no
+ browsing context was navigated.</p>
+
+ <hr><p>The <dfn id=dom-name title=dom-name><code>name</code></dfn> attribute of
+ the <code><a href=#window>Window</a></code> object must, on getting, return the current
+ name of the <a href=#browsing-context>browsing context</a>, and, on setting, set the
+ name of the <a href=#browsing-context>browsing context</a> to the new value.</p>
+
+ <p class=note>The name <a href=#resetBCName>gets reset</a> when
+ the browsing context is navigated to another domain.</p>
+
+ <hr><p>The <dfn id=dom-window-close title=dom-window-close><code>close()</code></dfn>
+ method on <code><a href=#window>Window</a></code> objects should, if the corresponding
+ <a href=#browsing-context>browsing context</a> <var title="">A</var> is an
+ <a href=#auxiliary-browsing-context>auxiliary browsing context</a> that was created by a script
+ (as opposed to by an action of the user), and if the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the
+ <a href=#concept-script title=concept-script>script</a> that invokes the method
+ is <a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing
+ context</a> <var title="">A</var>, close the <a href=#browsing-context>browsing
+ context</a> <var title="">A</var> (and may <a href=#a-browsing-context-is-discarded title="a
+ browsing context is discarded">discard</a> it too).</p>
+
+ <p>The <dfn id=dom-window-stop title=dom-window-stop><code>stop()</code></dfn> method
+ on <code><a href=#window>Window</a></code> objects should, if there is an existing
+ attempt to <a href=#navigate>navigate</a> the <a href=#browsing-context>browsing context</a>
+ and that attempt is not currently running the <a href=#unload-a-document>unload a
+ document</a> algorithm, cancel that <a href=#navigate title=navigate>navigation</a> and any associated instances of
+ the <a href=#fetch title=fetch>fetch algorithm</a>. Otherwise, it must
+ do nothing.</p>
+
+ </div>
+
+
+ <h4 id=accessing-other-browsing-contexts><span class=secno>6.2.3 </span>Accessing other browsing contexts</h4>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-length><a href=#dom-length>length</a></code></dt>
+
+ <dd>
+
+ <p>Returns the number of <a href=#child-browsing-context title="child browsing
+ context">child browsing contexts</a>.</p>
+
+ </dd>
+
+ <dt><var title="">window</var>[<var title="">index</var>]</dt>
+
+ <dd>
+
+ <p>Returns the indicated <a href=#child-browsing-context>child browsing context</a>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-length title=dom-length><code>length</code></dfn> IDL
+ attribute on the <code><a href=#window>Window</a></code> interface must return the
+ number of <a href=#child-browsing-context title="child browsing context">child browsing
+ contexts</a> that are <a href=#browsing-context-nested-through title="browsing context nested
+ through">nested through</a> elements that are <a href=#in-a-document title="in a
+ document">in the <code>Document</code></a> that is the
+ <a href=#active-document>active document</a> of that <code><a href=#window>Window</a></code> object, if
+ that <code><a href=#window>Window</a></code>'s <a href=#browsing-context>browsing context</a> shares the
+ same <a href=#event-loop>event loop</a> as the <a href="#script's-browsing-context">script's browsing
+ context</a> of the <a href=#entry-script>entry script</a> accessing the IDL
+ attribute; otherwise, it must return zero.</p>
+
+ <!-- in other words, frames are only accessible to same-thread processes -->
+
+ <p>The <span>indices of the supported indexed properties</span> on
+ the <code><a href=#window>Window</a></code> object at any instant are the numbers in the
+ range 0 .. <span title=""><var title="">n</var>-1</span>, where <var title="">n</var> is the number returned by the <code title=dom-length><a href=#dom-length>length</a></code> IDL attribute. If <var title="">n</var> is zero then there are no <span>supported indexed
+ properties</span>.</p>
+
+ <p>When a <code><a href=#window>Window</a></code> object is <dfn id=dom-window-item title=dom-window-item>indexed to retrieve an indexed
+ property</dfn> <var title="">index</var>, the value returned must be
+ the <code><a href=#windowproxy>WindowProxy</a></code> object of the <var title="">index</var>th <a href=#child-browsing-context>child browsing context</a> of the
+ <code><a href=#document>Document</a></code> that is nested through an element that is
+ <a href=#in-a-document title="in a document">in the <code>Document</code></a>,
+ sorted in the <a href=#tree-order>tree order</a> of the elements nesting those
+ <a href=#browsing-context title="browsing context">browsing contexts</a>.</p>
+
+ <p>These properties are the <dfn id=dynamic-nested-browsing-context-properties>dynamic nested browsing context
+ properties</dfn>.</p>
+
+ </div>
+
+
+
+ <h4 id=named-access-on-the-window-object><span class=secno>6.2.4 </span>Named access on the <code><a href=#window>Window</a></code> object</h4>
+
+ <dl class=domintro><dt><var title="">window</var>[<var title="">name</var>]</dt>
+
+ <dd>
+
+ <p>Returns the indicated element or collection of elements.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <code><a href=#window>Window</a></code> interface <span title="support named
+ properties">supports named properties</span>. The <span>names of the
+ supported named properties</span> at any moment consist of:</p>
+
+ <ul><li>the value of the <code title="">name</code> content attribute
+ for all <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
+ <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
+ <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
+ <code><a href=#the-object-element>object</a></code> elements in the <a href=#active-document>active document</a>
+ that have a <code title="">name</code> content attribute, and</li>
+
+ <li>the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> content
+ attribute of any <a href=#html-elements title="HTML elements">HTML element</a> in
+ the <a href=#active-document>active document</a> with an <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute.</li>
+
+ </ul><p>When <dfn id=dom-window-nameditem title=dom-window-namedItem>the <code>Window</code>
+ object is indexed for property retrieval</dfn> using a name <var title="">name</var>, then the user agent must return the value
+ obtained using the following steps:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">elements</var> be the list of <a href=#dom-window-nameditem-filter title=dom-window-namedItem-filter>named elements</a> with the
+ name <var title="">name</var> in the <a href=#active-document>active document</a>.
+
+ <p class=note>There will be at least one such element, by
+ definition.<!-- (If there wasn't, then this algorithm wouldn't
+ have been invoked by Web IDL.) --></p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">elements</var> contains an <code><a href=#the-iframe-element>iframe</a></code>
+ element, then return the <code><a href=#windowproxy>WindowProxy</a></code> object of the
+ <a href=#nested-browsing-context>nested browsing context</a> represented by the first such
+ <code><a href=#the-iframe-element>iframe</a></code> element in <a href=#tree-order>tree order</a>, and abort
+ these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise, if <var title="">elements</var> has only one
+ element, return that element and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only <a href=#dom-window-nameditem-filter title=dom-window-namedItem-filter>named elements</a> with
+ the name <var title="">name</var>.</p> <!-- the same one each time
+ is returned, because of the rule under collections -->
+
+ </li>
+
+ </ol><p><dfn id=dom-window-nameditem-filter title=dom-window-nameditem-filter>Named elements</dfn>
+ with the name <var title="">name</var>, for the purposes of the
+ above algorithm, are those that are either:</p>
+
+ <ul><li><code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
+ <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
+ <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, or
+ <code><a href=#the-object-element>object</a></code> elements that have a <code title=attr-name>name</code> content attribute whose value is <var title="">name</var>, or</li>
+
+ <li><a href=#html-elements>HTML elements</a> elements that have an <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute whose value is <var title="">name</var>.</li>
+
+ </ul></div>
+
+
+ <div class=impl>
+
+ <h4 id=garbage-collection-and-browsing-contexts><span class=secno>6.2.5 </span>Garbage collection and browsing contexts</h4>
+
+ <p>A <a href=#browsing-context>browsing context</a> has a strong reference to each of
+ its <code><a href=#document>Document</a></code>s and its <code><a href=#windowproxy>WindowProxy</a></code> object,
+ and the user agent itself has a strong reference to its <a href=#top-level-browsing-context title="top-level browsing context">top-level browsing
+ contexts</a>.</p>
+
+ <p>A <code><a href=#document>Document</a></code> has a strong reference to its
+ <code><a href=#window>Window</a></code> object.</p>
+
+ <p class=note>A <code><a href=#window>Window</a></code> object <a href=#implied-strong-reference title="implied
+ strong reference">has a strong reference</a> to its
+ <code><a href=#document>Document</a></code> object through its <code title=dom-document><a href=#dom-document>document</a></code> attribute. Thus, references
+ from other scripts to either of those objects will keep both
+ alive. Similarly, both <code><a href=#document>Document</a></code> and <code><a href=#window>Window</a></code>
+ objects have <a href=#implied-strong-reference title="implied strong reference">implied strong
+ references</a> to the <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
+
+ <p>Each <a href=#concept-script title=concept-script>script</a> has a strong
+ reference to its <a href="#script's-browsing-context" title="script's browsing context">browsing
+ context</a> and its <a href="#script's-document" title="script's
+ document">document</a>.</p>
+
+ <p>When a <a href=#browsing-context>browsing context</a> is to <dfn id=discard-a-document>discard a
+ <code>Document</code></dfn>, the user agent must run the following
+ steps:</p>
+
+ <ol><li><p>Set the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
+ false.</li>
+
+ <li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
+ the <code><a href=#document>Document</a></code> that are defined by this specification or
+ any other relevant specifications.</li>
+
+ <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a>
+ associated with the <code><a href=#document>Document</a></code> in any <a href=#task-source>task
+ source</a>, without running those tasks.</li>
+
+ <li><p><a href=#a-browsing-context-is-discarded title="a browsing context is discarded">Discard</a>
+ all the <a href=#child-browsing-context title="child browsing context">child browsing
+ contexts</a> of the <code><a href=#document>Document</a></code>.</li>
+
+ <li><p>Lose the strong reference from the <code><a href=#document>Document</a></code>'s
+ <a href=#browsing-context>browsing context</a> to the
+ <code><a href=#document>Document</a></code>.</li>
+
+ </ol><p class=note>Whenever a <code><a href=#document>Document</a></code> object is <a href=#discard-a-document title="discard a Document">discarded</a>, it is also removed from
+ the list of <span>the worker's <code><a href=#document>Document</a></code>s</span> of each
+ worker whose list contains that <code><a href=#document>Document</a></code>.</p>
+
+ <p>When <dfn id=a-browsing-context-is-discarded>a <em><span>browsing context</span></em> is
+ discarded</dfn>, the strong reference from the user agent itself to
+ the <a href=#browsing-context>browsing context</a> must be severed, and all the
+ <code><a href=#document>Document</a></code> objects for all the entries in the
+ <a href=#browsing-context>browsing context</a>'s session history must be <a href=#discard-a-document title="discard a document">discarded</a> as well.</p>
+
+ <p>User agents may <a href=#a-browsing-context-is-discarded title="a browsing context is
+ discarded">discard</a> <a href=#top-level-browsing-context title="top-level browsing
+ context">top-level browsing contexts</a> at any time (typically,
+ in response to user requests, e.g. when a user closes a window
+ containing one or more <a href=#top-level-browsing-context title="top-level browsing
+ context">top-level browsing contexts</a>). Other <a href=#browsing-context title="browsing context">browsing contexts</a> must be discarded
+ once their <code><a href=#windowproxy>WindowProxy</a></code> object is eligible for garbage
+ collection.</p>
+
+ </div>
+
+
+
+ <h4 id=browser-interface-elements><span class=secno>6.2.6 </span>Browser interface elements</h4>
+
+ <p>To allow Web pages to integrate with Web browsers, certain Web
+ browser interface elements are exposed in a limited way to scripts
+ in Web pages.</p>
+
+ <p>Each interface element is represented by a <code><a href=#barprop>BarProp</a></code>
+ object:</p>
+
+ <pre class=idl>interface <dfn id=barprop>BarProp</dfn> {
+ attribute boolean <a href=#dom-barprop-visible title=dom-BarProp-visible>visible</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-locationbar><a href=#dom-window-locationbar>locationbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
+ <dd>
+ <p>Returns true if the location bar is visible; otherwise, returns false.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-menubar><a href=#dom-window-menubar>menubar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
+ <dd>
+ <p>Returns true if the menu bar is visible; otherwise, returns false.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-personalbar><a href=#dom-window-personalbar>personalbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
+ <!--<dt><var title="">window</var> . <code title="dom-window-directories">directories</code> . <code title="dom-BarProp-visible">visible</code></dt>-->
+ <dd>
+ <p>Returns true if the personal bar is visible; otherwise, returns false.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-scrollbars><a href=#dom-window-scrollbars>scrollbars</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
+ <dd>
+ <p>Returns true if the scroll bars are visible; otherwise, returns false.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-statusbar><a href=#dom-window-statusbar>statusbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
+ <dd>
+ <p>Returns true if the status bar is visible; otherwise, returns false.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-toolbar><a href=#dom-window-toolbar>toolbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
+ <dd>
+ <p>Returns true if the toolbar is visible; otherwise, returns false.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-barprop-visible title=dom-BarProp-visible>visible</dfn> attribute, on
+ getting, must return either true or a value determined by the user
+ agent to most accurately represent the visibility state of the user
+ interface element that the object represents, as described below. On
+ setting, the new value must be discarded.</p>
+
+ <p>The following <code><a href=#barprop>BarProp</a></code> objects exist for each
+ <code><a href=#document>Document</a></code> object in a <a href=#browsing-context>browsing
+ context</a>. Some of the user interface elements represented by
+ these objects might have no equivalent in some user agents; for
+ those user agents, except when otherwise specified, the object must
+ act as if it was present and visible (i.e. its <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code> attribute must return
+ true).</p>
+
+ <dl><dt><dfn id=the-location-bar-barprop-object>The location bar <code>BarProp</code> object</dfn></dt>
+
+ <dd>Represents the user interface element that contains a control
+ that displays the <a href=#url>URL</a> of the <a href=#active-document>active
+ document</a>, or some similar interface concept.</dd>
+
+ <dt><dfn id=the-menu-bar-barprop-object>The menu bar <code>BarProp</code> object</dfn></dt>
+
+ <dd>Represents the user interface element that contains a list of
+ commands in menu form, or some similar interface concept.</dd>
+
+ <dt><dfn id=the-personal-bar-barprop-object>The personal bar <code>BarProp</code> object</dfn></dt>
+
+ <dd>Represents the user interface element that contains links to
+ the user's favorite pages, or some similar interface concept.</dd>
+
+ <dt><dfn id=the-scrollbar-barprop-object>The scrollbar <code>BarProp</code> object</dfn></dt>
+
+ <dd>Represents the user interface element that contains a scrolling
+ mechanism, or some similar interface concept.</dd>
+
+ <dt><dfn id=the-status-bar-barprop-object>The status bar <code>BarProp</code> object</dfn></dt>
+
+ <dd>Represents a user interface element found immediately below or
+ after the document, as appropriate for the user's media. If the
+ user agent has no such user interface element, then the object may
+ act as if the corresponding user interface element was absent
+ (i.e. its <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code>
+ attribute may return false).</dd>
+
+ <dt><dfn id=the-toolbar-barprop-object>The toolbar <code>BarProp</code> object</dfn></dt>
+
+ <dd>Represents the user interface element found immediately above
+ or before the document, as appropriate for the user's media. If the
+ user agent has no such user interface element, then the object may
+ act as if the corresponding user interface element was absent
+ (i.e. its <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code>
+ attribute may return false).</dd>
+
+ </dl><p>The <dfn id=dom-window-locationbar title=dom-window-locationbar><code>locationbar</code></dfn>
+ attribute must return <a href=#the-location-bar-barprop-object>the location bar <code>BarProp</code>
+ object</a>.</p>
+
+ <p>The <dfn id=dom-window-menubar title=dom-window-menubar><code>menubar</code></dfn>
+ attribute must return <a href=#the-menu-bar-barprop-object>the menu bar <code>BarProp</code>
+ object</a>.</p>
+
+ <p>The <dfn id=dom-window-personalbar title=dom-window-personalbar><code>personalbar</code></dfn>
+ attribute must return <a href=#the-personal-bar-barprop-object>the personal bar <code>BarProp</code>
+ object</a>.</p>
+
+ <p>The <dfn id=dom-window-scrollbars title=dom-window-scrollbars><code>scrollbars</code></dfn>
+ attribute must return <a href=#the-scrollbar-barprop-object>the scrollbar <code>BarProp</code>
+ object</a>.</p>
+
+ <p>The <dfn id=dom-window-statusbar title=dom-window-statusbar><code>statusbar</code></dfn> attribute
+ must return <a href=#the-status-bar-barprop-object>the status bar <code>BarProp</code>
+ object</a>.</p>
+
+ <p>The <dfn id=dom-window-toolbar title=dom-window-toolbar><code>toolbar</code></dfn>
+ attribute must return <a href=#the-toolbar-barprop-object>the toolbar <code>BarProp</code>
+ object</a>.</p>
+
+<!--
+ <p>For legacy reasons, the <dfn
+ title="dom-window-directories"><code>directories</code></dfn>
+ attribute must also return <span>the personal bar
+ <code>BarProp</code> object</span>.</p>
+-->
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-windowproxy-object><span class=secno>6.2.7 </span>The <code><a href=#windowproxy>WindowProxy</a></code> object</h4>
+
+
+ <p>As mentioned earlier, each <a href=#browsing-context>browsing context</a> has a
+ <dfn id=windowproxy><code>WindowProxy</code></dfn> object. This object is unusual
+ in that all operations that would be performed on it must be
+ performed on the <code><a href=#window>Window</a></code> object of the <a href=#browsing-context>browsing
+ context</a>'s <a href=#active-document>active document</a> instead. It is thus
+ indistinguishable from that <code><a href=#window>Window</a></code> object in every way
+ until the <a href=#browsing-context>browsing context</a> is navigated.</p>
+
+ <p>There is no <code><a href=#windowproxy>WindowProxy</a></code> interface object.</p>
+
+ <p class=note>The <code><a href=#windowproxy>WindowProxy</a></code> object allows scripts
+ to act as if each <a href=#browsing-context>browsing context</a> had a single
+ <code><a href=#window>Window</a></code> object, while still keeping separate
+ <code><a href=#window>Window</a></code> objects for each <code><a href=#document>Document</a></code>.</p>
+
+ <div class=example>
+
+ <p>In the following example, the variable <var title="">x</var> is
+ set to the <code><a href=#windowproxy>WindowProxy</a></code> object returned by the <code title=dom-window><a href=#dom-window>window</a></code> accessor on the global object. All
+ of the expressions following the assignment return true, because in
+ every respect, the <code><a href=#windowproxy>WindowProxy</a></code> object acts like the
+ underlying <code><a href=#window>Window</a></code> object.</p>
+
+ <pre>var x = window;
+x instanceof Window; // true
+x === this; // true</pre>
+
+ </div>
+
+ </div>
+
+
+
+ <h3 id=origin-0><span class=secno>6.3 </span>Origin</h3>
+ <!-- Hallowed are the Ori -->
+
+ <p>The <dfn id=origin>origin</dfn> of a resource and the <dfn id=effective-script-origin>effective script
+ origin</dfn> of a resource are both either opaque identifiers or
+ tuples consisting of a scheme component, a host component, a port
+ component, and optionally extra data.</p>
+
+ <p class=note>The extra data could include the certificate of the
+ site when using encrypted connections, to ensure that if the site's
+ secure certificate changes, the origin is considered to change as
+ well.</p>
+
+
+ <div class=impl>
+
+ <p>These characteristics are defined as follows:</p>
+
+ <dl><dt>For URLs</dt>
+
+ <dd>
+
+ <p>The <a href=#origin>origin</a> and <a href=#effective-script-origin>effective script
+ origin</a> of the <a href=#url>URL</a> is whatever is returned by
+ the following algorithm:</p>
+
+ <ol><li><p>Let <var title="">url</var> be the <a href=#url>URL</a> for
+ which the <a href=#origin>origin</a> is being determined.</li>
+
+ <li><p><a href=#parse-a-url title="parse a url">Parse</a> <var title="">url</var>.</li>
+
+ <li><p>If <var title="">url</var> identifies a resource that is
+ its own trust domain (e.g. it identifies an e-mail on an IMAP
+ server or a post on an NNTP server) then return a globally unique
+ identifier specific to the resource identified by <var title="">url</var>, so that if this algorithm is invoked again
+ for <a href=#url title=URL>URLs</a> that identify the same resource,
+ the same identifier will be returned.</li>
+
+ <li><p>If <var title="">url</var> does not use a server-based
+ naming authority, or if parsing <var title="">url</var> failed,
+ or if <var title="">url</var> is not an <a href=#absolute-url>absolute
+ URL</a>, then return a new globally unique
+ identifier.</li>
+
+ <li><p>Let <var title="">scheme</var> be the <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> component of <var title="">url</var>, <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>
+
+ <li><p>If the UA doesn't support the protocol given by <var title="">scheme</var>, then return a new globally unique
+ identifier.</li>
+
+ <li><p>If <var title="">scheme</var> is "<code title="">file</code>", then the user agent may return a
+ UA-specific value.</li>
+
+ <li><p>Let <var title="">host</var> be the <a href=#url-host title=url-host>&lt;host&gt;</a> component of <var title="">url</var>.</li>
+
+ <li>
+
+ <p>Apply the IDNA ToASCII algorithm to <var title="">host</var>,
+ with both the AllowUnassigned and UseSTD3ASCIIRules flags
+ set. Let <var title="">host</var> be the result of the ToASCII
+ algorithm.</p>
+
+ <p>If ToASCII fails to convert one of the components of the
+ string, e.g. because it is too long or because it contains
+ invalid characters, then return a new globally unique
+ identifier. <a href=#refsRFC3490>[RFC3490]</a></p>
+
+ </li>
+
+ <li><p>Let <var title="">host</var> be the result of converting
+ <var title="">host</var> <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">to
+ ASCII lowercase</a>.</li>
+
+ <li><p>If there is no <a href=#url-port title=url-port>&lt;port&gt;</a>
+ component, then let <var title="">port</var> be the default port
+ for the protocol given by <var title="">scheme</var>. Otherwise,
+ let <var title="">port</var> be the <a href=#url-port title=url-port>&lt;port&gt;</a> component of <var title="">url</var>.</li>
+
+ <li><p>Return the tuple (<var title="">scheme</var>, <var title="">host</var>, <var title="">port</var>).</li>
+
+ </ol><p>In addition, if the <a href=#url>URL</a> is in fact associated with
+ a <code><a href=#document>Document</a></code> object that was created by parsing the
+ resource obtained from fetching <a href=#url>URL</a>, and this was
+ done over a secure connection, then the server's secure
+ certificate may be added to the origin as additional data.</p>
+
+ </dd>
+
+ <dt>For scripts</dt>
+
+ <dd>
+
+ <p>The <a href=#origin>origin</a> and <a href=#effective-script-origin>effective script
+ origin</a> of a script are determined from another resource,
+ called the <i>owner</i>:</p>
+
+ <dl class=switch><dt>If a script is in a <code><a href=#script>script</a></code> element</dt>
+
+ <dd>The owner is the <code><a href=#document>Document</a></code> to which the
+ <code><a href=#script>script</a></code> element belongs.</dd>
+
+
+ <dt>If a script is in an <a href=#event-handler-content-attributes title="event handler content
+ attributes">event handler content attribute</a></dt>
+
+ <dd>The owner is the <code><a href=#document>Document</a></code> to which the
+ attribute node belongs.</dd>
+
+
+ <dt>If a script is a function or other code reference created by
+ another script</dt>
+
+ <dd>The owner is the script that created it.</dd>
+
+
+ <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a> that was returned as the
+ location of an HTTP redirect (<a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a> in
+ other protocols)</dt>
+
+ <dd>The owner is the <a href=#url>URL</a> that redirected to the
+ <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a>.</dd>
+
+
+ <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a> in an attribute</dt>
+
+ <dd>The owner is the <code><a href=#document>Document</a></code> of the element on
+ which the attribute is found.</dd>
+
+
+ <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a> in a style sheet</dt>
+
+ <dd>The owner is the <a href=#url>URL</a> of the style sheet.</dd>
+
+
+ <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a> to which a <a href=#browsing-context>browsing
+ context</a> is being <a href=#navigate title=navigate>navigated</a>,
+ the URL having been provided by the user (e.g. by using a
+ <i>bookmarklet</i>)</dt>
+
+ <dd>The owner is the <code><a href=#document>Document</a></code> of the <a href=#browsing-context>browsing
+ context</a>'s <a href=#active-document>active document</a>.</dd>
+
+
+ <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a> to which a <a href=#browsing-context>browsing
+ context</a> is being <a href=#navigate title=navigate>navigated</a>,
+ the URL having been declared in markup</dt>
+
+ <dd>The owner is the <code><a href=#document>Document</a></code> of the element
+ (e.g. an <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code> element) that
+ declared the URL.</dd>
+
+
+ <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a> to which a <a href=#browsing-context>browsing
+ context</a> is being <a href=#navigate title=navigate>navigated</a>,
+ the URL having been provided by script</dt>
+
+ <dd>The owner is the script that provided the URL.</dd>
+
+ </dl><p>The <a href=#origin>origin</a> of the script is then equal to the
+ <a href=#origin>origin</a> of the owner, and the <a href=#effective-script-origin>effective script
+ origin</a> of the script is equal to the <a href=#effective-script-origin>effective script
+ origin</a> of the owner.</p>
+
+ </dd>
+
+ <dt>For <code><a href=#document>Document</a></code> objects and images</dt>
+
+ <dd>
+
+ <dl class=switch><dt id=sandboxOrigin>If a <code><a href=#document>Document</a></code> is in a
+ <a href=#browsing-context>browsing context</a> whose <a href=#sandboxed-origin-browsing-context-flag>sandboxed origin
+ browsing context flag</a> was set when the
+ <code><a href=#document>Document</a></code> was created</dt>
+
+ <dt>If a <code><a href=#document>Document</a></code> was generated from a resource
+ labeled as <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code></dt>
+
+ <dd>The <a href=#origin>origin</a> is a globally unique identifier
+ assigned when the <code><a href=#document>Document</a></code> is created.</dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> or image was returned by the
+ <code>XMLHttpRequest</code> API</dt>
+
+ <dd>The <a href=#origin>origin</a> is equal to the <span>XMLHttpRequest
+ origin</span> of the <code>XMLHttpRequest</code> object. <a href=#refsXHR>[XHR]</a></dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> or image was generated from a
+ <a href=#javascript-protocol title="javascript protocol"><code>javascript:</code>
+ URL</a></dt>
+
+ <dd>The <a href=#origin>origin</a> is equal to the <a href=#origin>origin</a>
+ of the script of that <a href=#javascript-protocol title="javascript
+ protocol"><code>javascript:</code> URL</a>.</dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> or image was served over the
+ network and has an address that uses a URL scheme with a
+ server-based naming authority</dt>
+
+ <dd>The <a href=#origin>origin</a> is the <a href=#origin>origin</a> of the
+ <a href="#the-document's-address" title="the document's address">address</a> of the
+ <code><a href=#document>Document</a></code> or the <a href=#url>URL</a> of the image, as
+ appropriate.</dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> or image was generated from a
+ <code title="">data:</code> URL that was returned as the location
+ of an HTTP redirect (<a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a> in
+ other protocols)</dt>
+
+ <dd>The <a href=#origin>origin</a> is the <a href=#origin>origin</a> of the
+ <a href=#url>URL</a> that redirected to the <code title="">data:</code> URL.</dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> or image was generated from a
+ <code title="">data:</code> URL found in another
+ <code><a href=#document>Document</a></code> or in a script</dt>
+
+ <dd>The <a href=#origin>origin</a> is the <a href=#origin>origin</a> of the
+ <code><a href=#document>Document</a></code> or script that initiated the <a href=#navigate title=navigate>navigation</a> to that <a href=#url>URL</a>.</dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> has the <a href="#the-document's-address" title="the
+ document's address">address</a>
+ "<code><a href=#about:blank>about:blank</a></code>"</dt>
+
+ <dd>The <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> is <a href=#about-blank-origin>the <span>origin</span> it was
+ assigned when its browsing context was created</a>.</dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a></dt>
+
+ <dd>The <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> is the
+ <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing
+ context</a>'s <a href=#browsing-context-container>browsing context container</a>'s
+ <code><a href=#document>Document</a></code>.</dd>
+
+
+ <dt>If a <code><a href=#document>Document</a></code> or image was obtained in some
+ other manner (e.g. a <code title="">data:</code> URL typed in by
+ the user, a <code><a href=#document>Document</a></code> created using the <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>
+ API, etc)</dt>
+
+ <dd>The <a href=#origin>origin</a> is a globally unique identifier
+ assigned when the <code><a href=#document>Document</a></code> or image is created.</dd>
+
+ </dl><p>When a <code><a href=#document>Document</a></code> is created, its <a href=#effective-script-origin>effective
+ script origin</a> is initialized to the <a href=#origin>origin</a> of
+ the <code><a href=#document>Document</a></code>. However, the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute can
+ be used to change it.</p>
+
+ </dd>
+
+ <dt>For <code><a href=#audio>audio</a></code> and <code><a href=#video>video</a></code> elements</dt>
+
+ <dd>
+
+ <p>If value of the <a href=#media-element>media element</a>'s <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute is the
+ empty string, the <a href=#origin>origin</a> is the same as the
+ <a href=#origin>origin</a> of the element's <code><a href=#document>Document</a></code>'s
+ <a href=#origin>origin</a>.</p>
+
+ <p>Otherwise, the <a href=#origin>origin</a> is equal to the
+ <a href=#origin>origin</a> of the <a href=#absolute-url>absolute URL</a> given by the
+ <a href=#media-element>media element</a>'s <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute.</p>
+
+ </dd>
+
+ </dl><p>The <dfn id=unicode-serialization-of-an-origin>Unicode serialization of an origin</dfn> is the string
+ obtained by applying the following algorithm to the given
+ <a href=#origin>origin</a>:</p>
+
+ <ol><li><p>If the <a href=#origin>origin</a> in question is not a
+ scheme/host/port tuple, then return the literal string "<code title="">null</code>" and abort these steps.</li>
+
+ <li><p>Otherwise, let <var title="">result</var> be the scheme part
+ of the <a href=#origin>origin</a> tuple.</li>
+
+ <li><p>Append the string "<code title="">://</code>" to <var title="">result</var>.</li>
+
+ <li><p>Apply the IDNA ToUnicode algorithm to each component of the
+ host part of the <a href=#origin>origin</a> tuple, and append the results
+ &mdash; each component, in the same order, separated by U+002E FULL
+ STOP characters (.) &mdash; to <var title="">result</var>. <a href=#refsRFC3490>[RFC3490]</a></li>
+
+ <li><p>If the port part of the <a href=#origin>origin</a> tuple gives a port
+ that is different from the default port for the protocol given by
+ the scheme part of the <a href=#origin>origin</a> tuple, then append a
+ U+003A COLON character (:) and the given port, in base ten, to
+ <var title="">result</var>.</li>
+
+ <li><p>Return <var title="">result</var>.</li>
+
+ </ol><p>The <dfn id=ascii-serialization-of-an-origin>ASCII serialization of an origin</dfn> is the string
+ obtained by applying the following algorithm to the given
+ <a href=#origin>origin</a>:</p>
+
+ <ol><li><p>If the <a href=#origin>origin</a> in question is not a
+ scheme/host/port tuple, then return the literal string "<code title="">null</code>" and abort these steps.</li>
+
+ <li><p>Otherwise, let <var title="">result</var> be the scheme part
+ of the <a href=#origin>origin</a> tuple.</li>
+
+ <li><p>Append the string "<code title="">://</code>" to <var title="">result</var>.</li>
+
+ <li>
+
+ <p>Apply the IDNA ToASCII algorithm the host part of the
+ <a href=#origin>origin</a> tuple, with both the AllowUnassigned and
+ UseSTD3ASCIIRules flags set, and append the results <var title="">result</var>.</p>
+
+ <p>If ToASCII fails to convert one of the components of the
+ string, e.g. because it is too long or because it contains invalid
+ characters, then return the empty string and abort these steps. <a href=#refsRFC3490>[RFC3490]</a></p>
+
+ </li>
+
+ <li><p>If the port part of the <a href=#origin>origin</a> tuple gives a port
+ that is different from the default port for the protocol given by
+ the scheme part of the <a href=#origin>origin</a> tuple, then append a
+ U+003A COLON character (:) and the given port, in base ten, to
+ <var title="">result</var>.</li>
+
+ <li><p>Return <var title="">result</var>.</li>
+
+ </ol><p>Two <a href=#origin title=origin>origins</a> are said to be the
+ <dfn id=same-origin>same origin</dfn> if the following algorithm returns true:</p>
+
+ <ol><li><p>Let <var title="">A</var> be the first <a href=#origin>origin</a>
+ being compared, and <var title="">B</var> be the second
+ <a href=#origin>origin</a> being compared.</li>
+
+ <li><p>If <var title="">A</var> and <var title="">B</var> are both
+ opaque identifiers, and their value is equal, then return
+ true.</li>
+
+ <li><p>Otherwise, if either <var title="">A</var> or <var title="">B</var> or both are opaque identifiers, return
+ false.</li>
+
+ <li><p>If <var title="">A</var> and <var title="">B</var> have
+ scheme components that are not identical, return false.</li>
+
+ <li><p>If <var title="">A</var> and <var title="">B</var> have host
+ components that are not identical, return false.</li>
+
+ <li><p>If <var title="">A</var> and <var title="">B</var> have port
+ components that are not identical, return false.</li>
+
+ <li><p>If either <var title="">A</var> or <var title="">B</var>
+ have additional data, but that data is not identical for both,
+ return false.</li>
+
+ <li><p>Return true.</li>
+
+ </ol></div>
+
+
+ <h4 id=relaxing-the-same-origin-restriction><span class=secno>6.3.1 </span>Relaxing the same-origin restriction</h4>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-domain><a href=#dom-document-domain>domain</a></code> [ = <var title="">domain</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current domain used for security checks.</p>
+
+ <p>Can be set to a value that removes subdomains, to change the
+ <a href=#effective-script-origin>effective script origin</a> to allow pages on other
+ subdomains of the same domain (if they do the same thing) to
+ access each other.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-domain title=dom-document-domain><code>domain</code></dfn>
+ attribute on <code><a href=#document>Document</a></code> objects must be initialized to
+ <a href="#the-document's-domain">the document's domain</a>, if it has one, and the empty
+ string otherwise. If the value is an IPv6 address, then the square
+ brackets from the host portion of the <a href=#url-host title=url-host>&lt;host&gt;</a> component must be omitted from
+ the attribute's value.</p>
+
+ <p>On getting, the attribute must return its current
+ value, unless the document was created by
+ <code>XMLHttpRequest</code>, in which case it must throw an
+ <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception.</p>
+
+ <p>On setting, the user agent must run the following algorithm:</p>
+
+ <ol><li>
+
+ <p>If the document was created by <code>XMLHttpRequest</code>,
+ throw an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception and abort these
+ steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the new value is an IP address, let <var title="">new
+ value</var> be the new value. Otherwise, apply the IDNA ToASCII
+ algorithm to the new value, with both the AllowUnassigned and
+ UseSTD3ASCIIRules flags set, and let <var title="">new value</var>
+ be the result of the ToASCII algorithm.</p>
+
+ <p>If ToASCII fails to convert one of the components of the
+ string, e.g. because it is too long or because it contains invalid
+ characters, then throw a <code><a href=#security_err>SECURITY_ERR</a></code> exception and abort
+ these steps. <a href=#refsRFC3490>[RFC3490]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">new value</var> is not exactly equal to the
+ current value of the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute, then
+ run these substeps:</p>
+
+ <ol><li>
+
+ <p>If the current value is an IP address, throw a
+ <code><a href=#security_err>SECURITY_ERR</a></code> exception and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">new value</var>, prefixed by a U+002E FULL
+ STOP (.), does not exactly match the end of the current value,
+ throw a <code><a href=#security_err>SECURITY_ERR</a></code> exception and abort these
+ steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">new value</var> matches a suffix in the
+ Public Suffix List, or, if <var title="">new value</var>,
+ prefixed by a U+002E FULL STOP (.), matches the end of a
+ suffix in the Public Suffix List, then throw a
+ <code><a href=#security_err>SECURITY_ERR</a></code> exception and abort these steps. <a href=#refsPSL>[PSL]</a></p>
+
+ <p>Suffixes must be compared after applying the IDNA ToASCII
+ algorithm to them, with both the AllowUnassigned and
+ UseSTD3ASCIIRules flags set, in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner. <a href=#refsRFC3490>[RFC3490]</a></p>
+
+ </li>
+
+ </ol></li>
+
+ <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>
+
+ <li>
+
+ <p>Set the attribute's value to <var title="">new value</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Set the host part of the <a href=#effective-script-origin>effective script origin</a>
+ tuple of the <code><a href=#document>Document</a></code> to <var title="">new
+ value</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Set the port part of the <a href=#effective-script-origin>effective script origin</a>
+ tuple of the <code><a href=#document>Document</a></code> to "manual override" (a value
+ that, for the purposes of <a href=#same-origin title="same origin">comparing
+ origins</a>, is identical to "manual override" but not
+ identical to any other value).</p>
+
+ </li>
+
+ </ol><p>The <dfn id="the-document's-domain" title="the document's domain">domain</dfn> of a
+ <code><a href=#document>Document</a></code> is the host part of the document's
+ <a href=#origin>origin</a>, if that is a scheme/host/port tuple. If it
+ isn't, then the document does not have a domain.</p>
+
+ </div>
+
+ <p class=note>The <code title=dom-document-domain><a href=#dom-document-domain>domain</a></code>
+ attribute is used to enable pages on different hosts of a domain to
+ access each others' DOMs.</p>
+
+ <p class=warning>Do not use the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute when
+ using shared hosting. If an untrusted third party is able to host an
+ HTTP server at the same IP address but on a different port, then the
+ same-origin protection that normally protects two different sites on
+ the same host will fail, as the ports are ignored when comparing
+ origins after the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute has
+ been used.</p>
+
+
+
+ <h3 id=history><span class=secno>6.4 </span>Session history and navigation</h3>
+
+ <h4 id=the-session-history-of-browsing-contexts><span class=secno>6.4.1 </span>The session history of browsing contexts</h4>
+
+ <p>The sequence of <code><a href=#document>Document</a></code>s in a <a href=#browsing-context>browsing
+ context</a> is its <dfn id=session-history>session history</dfn>.</p>
+
+ <p><code><a href=#history-0>History</a></code> objects provide a representation of the
+ pages in the session history of <a href=#browsing-context title="browsing
+ context">browsing contexts</a>. Each <a href=#browsing-context>browsing
+ context</a>, including <a href=#nested-browsing-context title="nested browsing
+ context">nested browsing contexts</a>, has a distinct session
+ history.</p>
+
+ <p>Each <code><a href=#document>Document</a></code> object in a <a href=#browsing-context>browsing
+ context</a>'s <a href=#session-history>session history</a> is associated with a
+ unique instance of the <code><a href=#history-0>History</a></code> object, although they
+ all must model the same underlying <a href=#session-history>session history</a>.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-history title=dom-history><code>history</code></dfn> attribute
+ of the <code><a href=#window>Window</a></code> interface must return the object
+ implementing the <code><a href=#history-0>History</a></code> interface for that
+ <code><a href=#window>Window</a></code> object's <code><a href=#document>Document</a></code>.</p>
+
+ </div>
+
+ <p><code><a href=#history-0>History</a></code> objects represent their <a href=#browsing-context>browsing
+ context</a>'s session history as a flat list of <a href=#session-history-entry title="session history entry">session history entries</a>. Each
+ <dfn id=session-history-entry>session history entry</dfn> consists of either a
+ <a href=#url>URL</a> or a <a href=#state-object>state object</a>, or both<span class=impl>, and may in addition have a title, a
+ <code><a href=#document>Document</a></code> object, form data, a scroll position, and
+ other information associated with it</span>.</p>
+
+ <div class=impl>
+
+ <p class=note>This does not imply that the user interface need be
+ linear. See the <a href=#history-notes>notes below</a>.</p>
+
+ </div>
+
+ <p class=note>Titles associated with <a href=#session-history-entry title="session history
+ entry">session history entries</a> need not have any relation
+ with the current <code><a href=#the-title-element-0>title</a></code> of the
+ <code><a href=#document>Document</a></code>. The title of a <a href=#session-history-entry>session history
+ entry</a> is intended to explain the state of the document at
+ that point, so that the user can navigate the document's
+ history.</p>
+
+ <p>URLs without associated <a href=#state-object title="state object">state
+ objects</a> are added to the session history as the user (or
+ script) navigates from page to page.</p>
+
+ <p>A <dfn id=state-object>state object</dfn> is an object representing a user
+ interface state.</p>
+
+ <p>Pages can <a href=#dom-history-pushstate title=dom-history-pushState>add</a> <a href=#state-object title="state object">state objects</a> between their entry in the
+ session history and the next ("forward") entry. These are then <a href=#event-popstate title=event-popstate>returned to the script</a> when the user
+ (or script) goes back in the history, thus enabling authors to use
+ the "navigation" metaphor even in one-page applications.</p>
+
+ <div class=note>
+
+ <p><a href=#state-object title="state object">State objects</a> are intended to
+ be used for two main purposes: first, storing a preparsed
+ description of the state in the <a href=#url>URL</a> so that in the
+ simple case an author doesn't have to do the parsing (though one
+ would still need the parsing for handling <a href=#url title=URL>URLs</a> passed around by users, so it's only a minor
+ optimization), and second, so that the author can store state that
+ one wouldn't store in the URL because it only applies to the current
+ <code><a href=#document>Document</a></code> instance and it would have to be reconstructed
+ if a new <code><a href=#document>Document</a></code> were opened.</p>
+
+ <p>An example of the latter would be something like keeping track of
+ the precise coordinate from which a popup <code><a href=#the-div-element>div</a></code> was made
+ to animate, so that if the user goes back, it can be made to animate
+ to the same location. Or alternatively, it could be used to keep a
+ pointer into a cache of data that would be fetched from the server
+ based on the information in the <a href=#url>URL</a>, so that when going
+ back and forward, the information doesn't have to be fetched
+ again.</p>
+
+ </div>
+
+ <hr><p>At any point, one of the entries in the session history is the
+ <dfn id=current-entry>current entry</dfn>. This is the entry representing the
+ <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
+ context</a>. The <a href=#current-entry>current entry</a> is usually an entry
+ for the <a href=#dom-location-href title=dom-location-href>location</a> of the
+ <code><a href=#document>Document</a></code>. However, it can also be one of the entries
+ for <a href=#state-object title="state object">state objects</a> added to the
+ history by that document.</p>
+
+ <p>Entries that consist of <a href=#state-object title="state object">state
+ objects</a> share the same <code><a href=#document>Document</a></code> as the entry for
+ the page that was active when they were added.</p>
+
+ <p>Contiguous entries that differ just by fragment identifier also
+ share the same <code><a href=#document>Document</a></code>.</p>
+
+ <p class=note>All entries that share the same
+ <code><a href=#document>Document</a></code> (and that are therefore merely different
+ states of one particular document) are contiguous by definition.</p>
+
+ <div class=impl>
+
+ <p>User agents may <a href=#discard-a-document title="discard a Document">discard</a>
+ the <code><a href=#document>Document</a></code> objects of entries other than the
+ <a href=#current-entry>current entry</a> that are not referenced from any script,
+ reloading the pages afresh when the user or script navigates back to
+ such pages. This specification does not specify when user agents
+ should discard <code><a href=#document>Document</a></code> objects and when they should
+ cache them.</p>
+
+ <p>Entries that have had their <code><a href=#document>Document</a></code> objects
+ discarded must, for the purposes of the algorithms given below, act
+ as if they had not. When the user or script navigates back or
+ forwards to a page which has no in-memory DOM objects, any other
+ entries that shared the same <code><a href=#document>Document</a></code> object with it
+ must share the new object as well.</p>
+
+ </div>
+
+
+ <h4 id=the-history-interface><span class=secno>6.4.2 </span>The <code><a href=#history-0>History</a></code> interface</h4>
+
+ <pre class=idl>interface <dfn id=history-0>History</dfn> {
+ readonly attribute long <a href=#dom-history-length title=dom-history-length>length</a>;
+ void <a href=#dom-history-go title=dom-history-go>go</a>(in optional long delta);
+ void <a href=#dom-history-back title=dom-history-back>back</a>();
+ void <a href=#dom-history-forward title=dom-history-forward>forward</a>();
+ void <a href=#dom-history-pushstate title=dom-history-pushState>pushState</a>(in any data, in DOMString title, in optional DOMString url);
+ void <a href=#dom-history-replacestate title=dom-history-replaceState>replaceState</a>(in any data, in DOMString title, in optional DOMString url);
+};</pre>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-length><a href=#dom-history-length>length</a></code></dt>
+
+ <dd>
+
+ <p>Returns the number of entries in the <a href=#joint-session-history>joint session history</a>.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-go><a href=#dom-history-go>go</a></code>( [ <var title="">delta</var> ] )</dt>
+
+ <dd>
+
+ <p>Goes back or forward the specified number of steps in the <a href=#joint-session-history>joint session history</a>.</p>
+
+ <p>A zero delta will reload the current page.</p>
+
+ <p>If the delta is out of range, does nothing.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-back><a href=#dom-history-back>back</a></code>()</dt>
+
+ <dd>
+
+ <p>Goes back one step in the <a href=#joint-session-history>joint session history</a>.</p>
+
+ <p>If there is no previous page, does nothing.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-forward><a href=#dom-history-forward>forward</a></code>()</dt>
+
+ <dd>
+
+ <p>Goes forward one step in the <a href=#joint-session-history>joint session history</a>.</p>
+
+ <p>If there is no next page, does nothing.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState</a></code>(<var title="">data</var>, <var title="">title</var> [, <var title="">url</var> ] )</dt>
+
+ <dd>
+
+ <p>Pushes the given data onto the session history, with the given title, and, if provided, the given URL.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState</a></code>(<var title="">data</var>, <var title="">title</var> [, <var title="">url</var> ] )</dt>
+
+ <dd>
+
+ <p>Updates the current entry in the session histor to have the given data, title, and, if provided, URL.</p>
+
+ </dd>
+
+ </dl><p>The <dfn id=joint-session-history>joint session history</dfn> of a <code><a href=#history-0>History</a></code>
+ object is the union of all the <a href=#session-history title="session history">session
+ histories</a> of all <a href=#browsing-context title="browsing context">browsing
+ contexts</a> of all the <a href=#fully-active>fully active</a>
+ <code><a href=#document>Document</a></code> objects that share the <code><a href=#history-0>History</a></code>
+ object's <a href=#top-level-browsing-context>top-level browsing context</a>, with all the
+ entries that are <a href=#current-entry title="current entry">current entries</a>
+ in their respective <a href=#session-history title="session history">session
+ histories</a> removed except for the <a href=#current-entry-of-the-joint-session-history>current entry of the
+ joint session history</a>.</p>
+
+ <p>The <dfn id=current-entry-of-the-joint-session-history>current entry of the joint session history</dfn> is the
+ entry that most recently became a <a href=#current-entry>current entry</a> in its
+ <a href=#session-history>session history</a>.</p>
+
+ <p>Entries in the <a href=#joint-session-history>joint session history</a> are ordered
+ chronologically by the time they were added to their respective
+ <a href=#session-history title="session history">session histories</a>. (Since all
+ these <a href=#browsing-context title="browsing context">browsing contexts</a> by
+ definition share an <a href=#event-loop>event loop</a>, there is always a
+ well-defined sequential order in which their <a href=#session-history title="session
+ history">session histories</a> had their entries added.) Each
+ entry has an index; the earliest entry has index 0, and the
+ subsequent entries are numbered with consecutively increasing
+ integers (1, 2, 3, etc).</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-history-length title=dom-history-length><code>length</code></dfn>
+ attribute of the <code><a href=#history-0>History</a></code> interface must return the
+ number of entries in the <a href=#joint-session-history>joint session history</a>.</p>
+
+ <p>The actual entries are not accessible from script.</p>
+
+ <p>When the <dfn id=dom-history-go title=dom-history-go><code>go(<var title="">delta</var>)</code></dfn> method is invoked, if the
+ argument to the method was omitted or has the value zero, the user
+ agent must act as if the <code title=dom-location-reload><a href=#dom-location-reload>location.reload()</a></code> method was
+ called instead. Otherwise, the user agent must <a href=#traverse-the-history-by-a-delta>traverse the
+ history by a delta</a> whose value is the value of the method's
+ argument.</p>
+
+ <p>When the <dfn id=dom-history-back title=dom-history-back><code>back()</code></dfn>
+ method is invoked, the user agent must <a href=#traverse-the-history-by-a-delta>traverse the history by
+ a delta</a> &minus;1.</p>
+
+ <p>When the <dfn id=dom-history-forward title=dom-history-forward><code>forward()</code></dfn>method is
+ invoked, the user agent must <a href=#traverse-the-history-by-a-delta>traverse the history by a
+ delta</a> +1.</p>
+
+ <p>To <dfn id=traverse-the-history-by-a-delta>traverse the history by a delta</dfn> <var title="">delta</var>, the user agent must <a href=#queue-a-task>queue a task</a>
+ to run the following steps. The <a href=#task-source>task source</a> for the
+ queued task is the <a href=#history-traversal-task-source>history traversal task source</a>.</p>
+
+ <ol><li><p>Let <var title="">delta</var> be the argument to the
+ method.</li>
+
+ <li><p>If the index of the <a href=#current-entry-of-the-joint-session-history>current entry of the joint session
+ history</a> plus <var title="">delta</var> is less than zero or
+ greater than or equal to the number of items in the <a href=#joint-session-history>joint
+ session history</a>, then the user agent must do nothing.</p>
+
+ <li><p>Let <var title="">specified entry</var> be the entry in the
+ <a href=#joint-session-history>joint session history</a> whose index is the sum of <var title="">delta</var> and the index of the <a href=#current-entry-of-the-joint-session-history>current entry of
+ the joint session history</a>.</li>
+
+ <li><p>Let <var title="">specified browsing context</var> be the
+ <a href=#browsing-context>browsing context</a> of the <var title="">specified
+ entry</var>.</li>
+
+ <!-- XXX if going to another doc, try to unload the document here
+ (firing beforeunload, unload, pagehide) -->
+
+ <li><p><a href=#traverse-the-history>Traverse the history</a> of the <var title="">specified browsing context</var> to the <var title="">specified entry</var>.</p>
+
+ </ol><p>When the user navigates through a <a href=#browsing-context>browsing context</a>,
+ e.g. using a browser's back and forward buttons, the user agent must
+ <a href=#traverse-the-history-by-a-delta>traverse the history by a delta</a> equivalent to the
+ action specified by the user.</p>
+
+ <hr><p>The <dfn id=dom-history-pushstate title=dom-history-pushState><code>pushState(<var title="">data</var>, <var title="">title</var>, <var title="">url</var>)</code></dfn> method adds a state object entry to
+ the history.</p>
+
+ <p>The <dfn id=dom-history-replacestate title=dom-history-replaceState><code>replaceState(<var title="">data</var>, <var title="">title</var>, <var title="">url</var>)</code></dfn> method updates the state object,
+ title, and optionally the <a href=#url>URL</a> of the <a href=#current-entry>current
+ entry</a> in the history.</p>
+
+ <p>When either of these methods is invoked, the user agent must run
+ the following steps:</p>
+
+ <ol><li><p>Let <var title="">clone data</var> be a <a href=#structured-clone>structured
+ clone</a> of the specified <var title="">data</var>. If this
+ throws an exception, then rethrow that exception and abort these
+ steps.</li>
+
+ <li>
+
+ <p>If a third argument is specified, run these substeps:</p>
+
+ <ol><li><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the
+ third argument, relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>.</li>
+
+ <li>If that fails, raise a <code><a href=#security_err>SECURITY_ERR</a></code> exception
+ and abort these steps.</li>
+
+ <li>Compare the resulting <a href=#absolute-url>absolute URL</a> to <a href="#the-document's-address">the
+ document's address</a>. If any part of these two <a href=#url title=URL>URLs</a> differ other than the <a href=#url-path title=url-path>&lt;path&gt;</a>, <a href=#url-query title=url-query>&lt;query&gt;</a>, and <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> components, then
+ raise a <code><a href=#security_err>SECURITY_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li>If the <a href=#origin>origin</a> of the resulting <a href=#absolute-url>absolute
+ URL</a> is not the same as the <a href=#origin>origin</a> of the
+ <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
+ document">document</a>, and either the <a href=#url-path title=url-path>&lt;path&gt;</a> or <a href=#url-query title=url-query>&lt;query&gt;</a> components of the two
+ <a href=#url title=URL>URLs</a> compared in the previous step
+ differ, raise a <code><a href=#security_err>SECURITY_ERR</a></code> exception and abort
+ these steps. (This prevents sandboxed content from spoofing other
+ pages on the same origin.)</li>
+
+ </ol><p>For the purposes of the comparisons in the above substeps, the
+ <a href=#url-path title=url-path>&lt;path&gt;</a> and <a href=#url-query title=url-query>&lt;query&gt;</a> components can only be the
+ same if the URLs are both <a href=#hierarchical-url title="hierarchical
+ URL">hierarchical URLs</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the method invoked was the <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> method:</p>
+
+ <ol><li>
+
+ <p>Remove all the entries in the <a href=#browsing-context>browsing context</a>'s
+ <a href=#session-history>session history</a> after the <a href=#current-entry>current
+ entry</a>. If the <a href=#current-entry>current entry</a> is the last
+ entry in the session history, then no entries are
+ removed.</p>
+
+ <p class=note>This <a href=#history-notes>doesn't
+ necessarily have to affect</a> the user agent's user
+ interface.</p>
+
+ </li>
+
+ <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> queued
+ by the <a href=#history-traversal-task-source>history traversal task source</a>.</li>
+
+ <li><p>Add a state object entry to the session history, after the
+ <a href=#current-entry>current entry</a>, with <var title="">cloned data</var> as
+ the state object, the given <var title="">title</var> as the title,
+ and, if the third argument is present, the <a href=#absolute-url>absolute
+ URL</a> that was found earlier in this algorithm as the
+ <a href=#url>URL</a> of the entry.</li>
+
+ <li><p>Update the <a href=#current-entry>current entry</a> to be the this newly
+ added entry.</li>
+
+ </ol><p>Otherwise, if the method invoked was the <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState()</a></code> method:</p>
+
+ <ol><li><p>Update the <a href=#current-entry>current entry</a> in the session
+ history so that <var title="">cloned data</var> is the entry's
+ new state object, the given <var title="">title</var> is the new
+ title, and, if the third argument is present, the <a href=#absolute-url>absolute
+ URL</a> that was found earlier in this algorithm is the
+ entry's new <a href=#url>URL</a>.</li>
+
+ </ol></li>
+
+ <li>
+
+ <p>If the third argument is present, set <a href="#the-document's-current-address">the document's
+ current address</a> to the <a href=#absolute-url>absolute URL</a> that was
+ found earlier in this algorithm.</p>
+
+ <p class=note>Since this is neither a <a href=#navigate title=navigate>navigation</a> of the <a href=#browsing-context>browsing
+ context</a> nor a <a href=#traverse-the-history title="traverse the history">history
+ traversal</a>, it does not cause a <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> event to be fired.</p>
+
+ </li>
+
+ </ol><p class=note>The <var title="">title</var> is purely
+ advisory. User agents might use the title in the user interface.</p>
+
+ <p>User agents may limit the number of state objects added to the
+ session history per page. If a page hits the UA-defined limit, user
+ agents must remove the entry immediately after the first entry for
+ that <code><a href=#document>Document</a></code> object in the session history after
+ having added the new entry. (Thus the state history acts as a FIFO
+ buffer for eviction, but as a LIFO buffer for navigation.)</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Consider a game where the user can navigate along a line, such
+ that the user is always at some coordinate, and such that the user
+ can bookmark the page corresponding to a particular coordinate, to
+ return to it later.</p>
+
+ <p>A static page implementing the x=5 position in such a game could
+ look like the following:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;!-- this is http://example.com/line?x=5 --&gt;
+&lt;title&gt;Line Game - 5&lt;/title&gt;
+&lt;p&gt;You are at coordinate 5 on the line.&lt;/p&gt;
+&lt;p&gt;
+ &lt;a href="?x=6"&gt;Advance to 6&lt;/a&gt; or
+ &lt;a href="?x=4"&gt;retreat to 4&lt;/a&gt;?
+&lt;/p&gt;</pre>
+
+ <p>The problem with such a system is that each time the user
+ clicks, the whole page has to be reloaded. Here instead is another
+ way of doing it, using script:</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;!-- this starts off as http://example.com/line?x=5 --&gt;
+&lt;title&gt;Line Game - 5&lt;/title&gt;
+&lt;p&gt;You are at coordinate &lt;span id="coord"&gt;5&lt;/span&gt; on the line.&lt;/p&gt;
+&lt;p&gt;
+ &lt;a href="?x=6" onclick="go(1)"&gt;Advance to 6&lt;/a&gt; or
+ &lt;a href="?x=4" onclick="go(-1)"&gt;retreat to 4&lt;/a&gt;?
+&lt;/p&gt;
+&lt;script&gt;
+ var currentPage = 5; // prefilled by server
+ function go(d) {
+ history.pushState(currentPage, 'Line Game - ' + currentPage, '?x=' + currentPage);
+ setupPage(currentPage + d);
+ }
+ onpopstate = function(event) {
+ setupPage(event.state);
+ }
+ function setupPage(page) {
+ currentPage = page;
+ document.title = 'Line Game - ' + currentPage;
+ document.getElementById('coord').textContent = currentPage;
+ document.links[0].href = '?x=' + (currentPage+1);
+ document.links[0].textContent = 'Advance to ' + (currentPage+1);
+ document.links[1].href = '?x=' + (currentPage-1);
+ document.links[1].textContent = 'retreat to ' + (currentPage-1);
+ }
+&lt;/script&gt;</pre>
+
+ <p>In systems without script, this still works like the previous
+ example. However, users that <em>do</em> have script support can
+ now navigate much faster, since there is no network access for the
+ same experience. Furthermore, contrary to the experience the user
+ would have with just a na&iuml;ve script-based approach,
+ bookmarking and navigating the session history still work.</p>
+
+ <p>In the example above, the <var title="">data</var> argument to
+ the <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> method
+ is the same information as would be sent to the server, but in a
+ more convenient form, so that the script doesn't have to parse the
+ URL each time the user navigates.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>Applications might not use the same title for a <a href=#session-history-entry>session
+ history entry</a> as the value of the document's
+ <code><a href=#the-title-element-0>title</a></code> element at that time. For example, here is a
+ simple page that shows a block in the <code><a href=#the-title-element-0>title</a></code> element.
+ Clearly, when navigating backwards to a previous state the user
+ does not go back in time, and therefore it would be inappropriate
+ to put the time in the session history title.</p>
+
+ <pre>&lt;!DOCTYPE HTML&gt;
+&lt;TITLE&gt;Line&lt;/TITLE&gt;
+&lt;SCRIPT&gt;
+ setInterval(function () { document.title = 'Line - ' + new Date(); }, 1000);
+ var i = 1;
+ function inc() {
+ set(i+1);
+ history.pushState(i, 'Line - ' + i);
+ }
+ function set(newI) {
+ i = newI;
+ document.forms.F.I.value = newI;
+ }
+&lt;/SCRIPT&gt;
+&lt;BODY ONPOPSTATE="recover(event.state)"&gt;
+&lt;FORM NAME=F&gt;
+State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BUTTON ONCLICK="inc()"&gt;
+&lt;/FORM&gt;</pre>
+
+ </div>
+
+
+
+ <h4 id=the-location-interface><span class=secno>6.4.3 </span>The <code><a href=#location>Location</a></code> interface</h4>
+
+ <p>Each <code><a href=#document>Document</a></code> object in a <a href=#browsing-context>browsing
+ context</a>'s session history is associated with a unique
+ instance of a <code><a href=#location>Location</a></code> object.</p>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-location><a href=#dom-document-location>location</a></code> [ = <var title="">value</var> ]</dt>
+ <dt><var title="">window</var> . <code title=dom-location><a href=#dom-location>location</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#location>Location</a></code> object with the current page's location.</p>
+
+ <p>Can be set, to navigate to another page.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-location title=dom-document-location><code>location</code></dfn> attribute
+ of the <code><a href=#htmldocument>HTMLDocument</a></code> interface must return the
+ <code><a href=#location>Location</a></code> object for that <code><a href=#document>Document</a></code> object,
+ if it is in a <a href=#browsing-context>browsing context</a>, and null otherwise.</p>
+
+ <p>The <dfn id=dom-location title=dom-location><code>location</code></dfn>
+ attribute of the <code><a href=#window>Window</a></code> interface must return the
+ <code><a href=#location>Location</a></code> object for that <code><a href=#window>Window</a></code> object's
+ <code><a href=#document>Document</a></code>.</p>
+
+ </div>
+
+ <p><code><a href=#location>Location</a></code> objects provide a representation of <a href="#the-document's-current-address" title="the document's current address">their document's current
+ address</a>, and allow the <a href=#current-entry>current entry</a> of the
+ <a href=#browsing-context>browsing context</a>'s session history to be changed, by
+ adding or replacing entries in the <code title=dom-history><a href=#dom-history>history</a></code> object.</p>
+
+ <pre class=idl>interface <dfn id=location>Location</dfn> {
+ stringifier attribute DOMString <a href=#dom-location-href title=dom-location-href>href</a>;
+ void <a href=#dom-location-assign title=dom-location-assign>assign</a>(in DOMString url);
+ void <a href=#dom-location-replace title=dom-location-replace>replace</a>(in DOMString url);
+ void <a href=#dom-location-reload title=dom-location-reload>reload</a>();
+
+ // <a href=#url-decomposition-idl-attributes>URL decomposition IDL attributes</a> <!-- blame brendan for these "innovative" names -->
+ attribute DOMString <a href=#dom-location-protocol title=dom-location-protocol>protocol</a>;
+ attribute DOMString <a href=#dom-location-host title=dom-location-host>host</a>;
+ attribute DOMString <a href=#dom-location-hostname title=dom-location-hostname>hostname</a>;
+ attribute DOMString <a href=#dom-location-port title=dom-location-port>port</a>;
+ attribute DOMString <a href=#dom-location-pathname title=dom-location-pathname>pathname</a>;
+ attribute DOMString <a href=#dom-location-search title=dom-location-search>search</a>;
+ attribute DOMString <a href=#dom-location-hash title=dom-location-hash>hash</a>;
+
+ // resolving relative URLs
+ DOMString <a href=#dom-location-resolveurl title=dom-location-resolveURL>resolveURL</a>(in DOMString url);
+};</pre>
+
+ <dl class=domintro><dt><var title="">location</var> . <code title=dom-location-href><a href=#dom-location-href>href</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current page's location.</p>
+
+ <p>Can be set, to navigate to another page.</p>
+
+ </dd>
+
+ <dt><var title="">location</var> . <code title=dom-location-assign><a href=#dom-location-assign>assign</a></code>(<var title="">url</var>)</dt>
+
+ <dd>
+
+ <p>Navigates to the given page.</p>
+
+ </dd>
+
+ <dt><var title="">location</var> . <code title=dom-location-replace><a href=#dom-location-replace>replace</a></code>(<var title="">url</var>)</dt>
+
+ <dd>
+
+ <p>Removes the current page from the session history and navigates to the given page.</p>
+
+ </dd>
+
+ <dt><var title="">location</var> . <code title=dom-location-reload><a href=#dom-location-reload>reload</a></code>()</dt>
+
+ <dd>
+
+ <p>Reloads the current page.</p>
+
+ </dd>
+
+ <dt><var title="">url</var> = <var title="">location</var> . <code title=dom-location-resolveURL><a href=#dom-location-resolveurl>resolveURL</a></code>(<var title="">url</var>)</dt>
+
+ <dd>
+
+ <p>Resolves the given relative URL to an absolute URL.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-location-href title=dom-location-href><code>href</code></dfn>
+ attribute must return <a href="#the-document's-current-address" title="the document's current
+ address">the current address</a> of the associated
+ <code><a href=#document>Document</a></code> object, as an <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>On setting, <!-- READ ME WHEN EDITING THIS: Mozilla does this,
+ but IE doesn't. What should we do?: the behavior depends on the
+ context in which the script that set the attribute is running. If
+ the script ran as the direct result of the execution of a
+ <code>script</code> element in the document represented by the
+ <code>Location</code> object's associated <code>Document</code>
+ object, then the user agent must act as if the <code
+ title="dom-location-replace">replace()</code> method had been called
+ with the new value as its argument. Otherwise,--> the user agent
+ must act as if the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code>
+ method had been called with the new value as its argument.</p><!--
+ v2: may wish to allow replace instead as a UI improvement -->
+
+ <!-- we could change the magic .location setter to simply refer
+ straight to assign(), so we don't have two levels of indirection -->
+
+ <p>When the <dfn id=dom-location-assign title=dom-location-assign><code>assign(<var title="">url</var>)</code></dfn> method is invoked, the UA must
+ <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative to
+ the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
+ URL</a>, and if that is successful, must <a href=#navigate>navigate</a>
+ the <a href=#browsing-context>browsing context</a> to the specified <var title="">url</var>. If the <a href=#browsing-context>browsing context</a>'s
+ <a href=#session-history>session history</a> contains only one
+ <code><a href=#document>Document</a></code>, and that was the <code><a href=#about:blank>about:blank</a></code>
+ <code><a href=#document>Document</a></code> created when the <a href=#browsing-context>browsing context</a>
+ was created, then the navigation must be done with
+ <a href=#replacement-enabled>replacement enabled</a>.</p> <!-- READ ME WHEN EDITING
+ THIS: IE and Firefox only seem to treat it that way if the DOM is
+ still a virgin DOM; Safari doesn't check that. Thus this might need
+ changing if testing shows the IE/Firefox behaviour is required
+ here. -->
+
+ <p>When the <dfn id=dom-location-replace title=dom-location-replace><code>replace(<var title="">url</var>)</code></dfn> method is invoked, the UA must
+ <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative to
+ the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
+ URL</a>, and if that is successful, <a href=#navigate>navigate</a> the
+ <a href=#browsing-context>browsing context</a> to the specified <var title="">url</var> with <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ <p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done
+ with the <a href="#script's-browsing-context" title="script's browsing context">browsing
+ context</a> of the script that invoked the method as the
+ <a href=#source-browsing-context>source browsing context</a>.</p>
+
+ <p>If the <a href=#resolve-a-url title="resolve a url">resolving</a> step of the
+ <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods is not
+ successful, then the user agent must instead throw a
+ <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception.</p>
+
+ <p>When the <dfn id=dom-location-reload title=dom-location-reload><code>reload()</code></dfn> method is
+ invoked, the user agent must run the appropriate steps from the
+ following list:</p>
+
+ <dl class=switch><dt>If the currently executing <a href=#concept-task title=concept-task>task</a> is the dispatch of a <code title=event-resize>resize</code> event in response to the user
+ resizing the <a href=#browsing-context>browsing context</a></dt>
+
+ <dd><p>Repaint the <a href=#browsing-context>browsing context</a> and abort these
+ steps.</dd> <!-- this theoretically would have no effect but in
+ practice can be useful to work around rendering bugs. -->
+
+ <dt>Otherwise</dt>
+
+ <dd><p><a href=#navigate>Navigate</a> the <a href=#browsing-context>browsing context</a> to
+ <a href="#the-document's-current-address">the document's current address</a> with
+ <a href=#replacement-enabled>replacement enabled</a>. The <a href=#source-browsing-context>source browsing
+ context</a> must be the <a href=#browsing-context>browsing context</a> being
+ navigated.</dd> <!-- it appears that document.reload() always
+ uses GET and does not, e.g., re-POST. -->
+
+ <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/141 -->
+
+ </dl><p>When a user requests that the current page be reloaded through a
+ user interface element, the user agent should <a href=#navigate>navigate</a>
+ the <a href=#browsing-context>browsing context</a> to the same resource as
+ <code><a href=#document>Document</a></code>, with <a href=#replacement-enabled>replacement enabled</a>. In the
+ case of non-idempotent methods (e.g. HTTP POST), the user agent
+ should prompt the user to confirm the operation first, since
+ otherwise transactions (e.g. purchases or database modifications)
+ could be repeated. User agents may allow the user to explicitly
+ override any caches when reloading.</p>
+
+ </div>
+
+ <p>The <code><a href=#location>Location</a></code> interface also has the complement of
+ <a href=#url-decomposition-idl-attributes>URL decomposition IDL attributes</a>, <dfn id=dom-location-protocol title=dom-location-protocol><code>protocol</code></dfn>, <dfn id=dom-location-host title=dom-location-host><code>host</code></dfn>, <dfn id=dom-location-port title=dom-location-port><code>port</code></dfn>, <dfn id=dom-location-hostname title=dom-location-hostname><code>hostname</code></dfn>, <dfn id=dom-location-pathname title=dom-location-pathname><code>pathname</code></dfn>, <dfn id=dom-location-search title=dom-location-search><code>search</code></dfn>, and <dfn id=dom-location-hash title=dom-location-hash><code>hash</code></dfn>. <span class=impl>These must follow the rules given for URL decomposition IDL
+ attributes, with the <a href=#concept-uda-input title=concept-uda-input>input</a>
+ being <a href="#the-document's-current-address" title="the document's current address">the current
+ address</a> of the associated <code><a href=#document>Document</a></code> object, as an
+ <a href=#absolute-url>absolute URL</a> (same as the <code title=dom-location-href><a href=#dom-location-href>href</a></code> attribute), and the <a href=#concept-uda-setter title=concept-uda-setter>common setter action</a> being the
+ same as setting the <code title=dom-location-href><a href=#dom-location-href>href</a></code>
+ attribute to the new output value.</span></p>
+
+ <div class=impl>
+
+ <hr><p>The <dfn id=dom-location-resolveurl title=dom-location-resolveURL><code>resolveURL(<var title="">url</var>)</code></dfn> method must <a href=#resolve-a-url title="resolve a
+ url">resolve</a> its <var title="">url</var> argument, relative
+ to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base
+ URL">base URL</a>, and if that succeeds, return the resulting
+ <a href=#absolute-url>absolute URL</a>. If it fails, it must throw a
+ <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception instead.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=security-location><span class=secno>6.4.3.1 </span>Security</h5>
+
+ <p id=security-3>User agents must raise a
+ <code><a href=#security_err>SECURITY_ERR</a></code> exception whenever any of the members of a
+ <code><a href=#location>Location</a></code> object are accessed by scripts whose
+ <a href=#effective-script-origin>effective script origin</a> is not the <a href=#same-origin title="same
+ origin">same</a> as the <code><a href=#location>Location</a></code> object's associated
+ <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a>, with
+ the following exceptions:</p>
+
+ <ul><li>The <code title=dom-location-href><a href=#dom-location-href>href</a></code> setter, if the
+ script is running in a <a href=#browsing-context>browsing context</a> that is
+ <a href=#allowed-to-navigate>allowed to navigate</a> the browsing context with which
+ the <code><a href=#location>Location</a></code> object is associated
+
+ <li>The <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> method,
+ if the script is running in a <a href=#browsing-context>browsing context</a> that is
+ <a href=#allowed-to-navigate>allowed to navigate</a> the browsing context with which
+ the <code><a href=#location>Location</a></code> object is associated
+
+ </ul></div>
+
+
+ <div class=impl>
+
+ <h4 id=history-notes><span class=secno>6.4.4 </span>Implementation notes for session history</h4>
+ <!-- don't change the ID without updating multiple internal links -->
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The <code><a href=#history-0>History</a></code> interface is not meant to place
+ restrictions on how implementations represent the session history to
+ the user.</p>
+
+ <p>For example, session history could be implemented in a tree-like
+ manner, with each page having multiple "forward" pages. This
+ specification doesn't define how the linear list of pages in the
+ <code title=dom-history><a href=#dom-history>history</a></code> object are derived from the
+ actual session history as seen from the user's perspective.</p>
+
+ <p>Similarly, a page containing two <code><a href=#the-iframe-element>iframe</a></code>s has a <code title=dom-history><a href=#dom-history>history</a></code> object distinct from the
+ <code><a href=#the-iframe-element>iframe</a></code>s' <code title=dom-history><a href=#dom-history>history</a></code>
+ objects, despite the fact that typical Web browsers present the user
+ with just one "Back" button, with a session history that interleaves
+ the navigation of the two inner frames and the outer page.</p>
+
+ <p><strong>Security</strong>: It is suggested that to avoid letting
+ a page "hijack" the history navigation facilities of a UA by abusing
+ <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code>, the UA
+ provide the user with a way to jump back to the previous page
+ (rather than just going back to the previous state). For example,
+ the back button could have a drop down showing just the pages in the
+ session history, and not showing any of the states. Similarly, an
+ aural browser could have two "back" commands, one that goes back to
+ the previous state, and one that jumps straight back to the previous
+ page.</p>
+
+ <p>In addition, a user agent could ignore calls to <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> that are invoked on
+ a timer, or from event listeners that are not triggered in response
+ to a clear user action, or that are invoked in rapid succession.</p>
+
+ </div>
+
+
+ <h3 id=browsing-the-web><span class=secno>6.5 </span>Browsing the Web</h3>
+
+ <div class=impl>
+
+ <h4 id=navigating-across-documents><span class=secno>6.5.1 </span>Navigating across documents</h4>
+
+ <p>Certain actions cause the <a href=#browsing-context>browsing context</a> to
+ <i><a href=#navigate>navigate</a></i> to a new resource. Navigation always involves
+ <dfn id=source-browsing-context>source browsing context</dfn>, which is the browsing context
+ which was responsible for starting the navigation.</p>
+
+ <p class=example>For example, <a href=#following-hyperlinks title="following
+ hyperlinks">following a hyperlink</a>, <a href=#concept-form-submit title=concept-form-submit>form submission</a>, and the <code title=dom-open><a href=#dom-open>window.open()</a></code> and <code title=dom-location-assign><a href=#dom-location-assign>location.assign()</a></code> methods can all
+ cause a browsing context to navigate.</p>
+
+ <p>A user agent may provide various ways for the user to explicitly
+ cause a browsing context to navigate, in addition to those defined
+ in this specification.</p>
+
+ <!-- NAVIGATE <dfn>navigate</dfn> -->
+ <p>When a browsing context is <dfn id=navigate title=navigate>navigated</dfn>
+ to a new resource, the user agent must run the following steps:</p>
+
+ <ol><li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>
+
+ <li id=sandboxLinks>
+
+ <p>If the <a href=#source-browsing-context>source browsing context</a> is not the same as
+ the <a href=#browsing-context>browsing context</a> being navigated, and the
+ <a href=#source-browsing-context>source browsing context</a> is not one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
+ contexts</a> of the <a href=#browsing-context>browsing context</a> being
+ navigated, and the <a href=#browsing-context>browsing context</a> being navigated is
+ not both a <a href=#top-level-browsing-context>top-level browsing context</a> and one of the
+ <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
+ contexts</a> of the <a href=#source-browsing-context>source browsing context</a>, and
+ the <a href=#source-browsing-context>source browsing context</a> had its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed
+ navigation browsing context flag</a> set when its <a href=#active-document>active
+ document</a> was created, then abort these steps.</p>
+
+ <p>Otherwise, if the <a href=#browsing-context>browsing context</a> being navigated
+ is a <a href=#top-level-browsing-context>top-level browsing context</a>, and is one of the
+ <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
+ contexts</a> of the <a href=#source-browsing-context>source browsing context</a>, and
+ the <a href=#source-browsing-context>source browsing context</a> had its <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed
+ top-level navigation browsing context flag</a> set when its
+ <a href=#active-document>active document</a> was created, then abort these
+ steps.</p>
+
+ <p>In both cases, the user agent may additionally offer to open
+ the new resource in a new <a href=#top-level-browsing-context>top-level browsing context</a>
+ or in the <a href=#top-level-browsing-context>top-level browsing context</a> of the
+ <a href=#source-browsing-context>source browsing context</a>, at the user's option, in
+ which case the user agent must <a href=#navigate>navigate</a> that
+ designated <a href=#top-level-browsing-context>top-level browsing context</a> to the new
+ resource as if the user had requested it independently.</p>
+
+ </li>
+
+ <li id=seamlessLinks><p>If the <a href=#source-browsing-context>source browsing
+ context</a> is the same as the <a href=#browsing-context>browsing context</a>
+ being navigated, and this browsing context has its <a href=#seamless-browsing-context-flag>seamless
+ browsing context flag</a> set, then find the nearest
+ <a href=#ancestor-browsing-context>ancestor browsing context</a> that does not have its
+ <a href=#seamless-browsing-context-flag>seamless browsing context flag</a> set, and continue these
+ steps as if <em>that</em> <a href=#browsing-context>browsing context</a> was the one
+ that was going to be <a href=#navigate title=navigate>navigated</a>
+ instead.</li>
+
+ <li><p>If there is a preexisting attempt to navigate the
+ <a href=#browsing-context>browsing context</a>, and the <a href=#source-browsing-context>source browsing
+ context</a> is the same as the <a href=#browsing-context>browsing context</a>
+ being navigated, and that attempt is currently
+ running the <a href=#unload-a-document>unload a document</a> algorithm, and the
+ <a href=#origin>origin</a> of the <a href=#url>URL</a> of the resource being
+ loaded in that navigation is not the <a href=#same-origin>same origin</a> as
+ the <a href=#origin>origin</a> of the <a href=#url>URL</a> of the resource
+ being loaded in <em>this</em> navigation, then abort these steps
+ without affecting the preexisting attempt to navigate the
+ <a href=#browsing-context>browsing context</a>.</li>
+ <!-- http://www.hixie.ch/tests/adhoc/html/navigation/unload/ -->
+
+ <li><p>If there is a preexisting attempt to navigate the
+ <a href=#browsing-context>browsing context</a>, and either that attempt has not yet
+ <a href=#concept-navigate-mature title=concept-navigate-mature>matured</a> (i.e. it has
+ not passed the point of making its <code><a href=#document>Document</a></code> the
+ <a href=#active-document>active document</a>), or that navigation's resource is not
+ to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, or its
+ resource's <a href=#absolute-url>absolute URL</a> differs from this attempt's by
+ more than the presence, absence, or value of the <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component, then cancel
+ that preexisting attempt to navigate the <a href=#browsing-context>browsing
+ context</a>.</li>
+
+ <li id=navigate-fragid-step><p><i>Fragment identifiers</i>: If
+ the <a href=#absolute-url>absolute URL</a> of the new resource is the same as
+ the <a href="#the-document's-address" title="the document's address">address</a> of the
+ <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
+ being navigated, ignoring any <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> components of those
+ <a href=#url title=URL>URLs</a>, and the new resource is to be
+ fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
+ equivalent</a>, and the <a href=#absolute-url>absolute URL</a> of the new
+ resource has a <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a>
+ component (even if it is empty), then <a href=#scroll-to-fragid title=navigate-fragid>navigate to that fragment identifier</a>
+ and abort these steps.</li>
+
+ <li><p>Cancel <em>any</em> preexisting attempt to navigate the
+ <a href=#browsing-context>browsing context</a>.</li>
+
+ <li><p>If the new resource is to be handled using a mechanism that
+ does not affect the browsing context, e.g. ignoring the navigation
+ request altogether because the specified scheme is not one of the
+ supported protocols, then abort these steps and proceed with that
+ mechanism instead.</li>
+
+ <li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to
+ unload</a> the <code><a href=#document>Document</a></code> object. If the user
+ <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then
+ these steps must be aborted.</li>
+
+ <li>
+
+ <p>If the new resource is to be handled by displaying some sort of
+ inline content, e.g. an error message because the specified scheme
+ is not one of the supported protocols, or an inline prompt to
+ allow the user to select <a href=#dom-navigator-registerprotocolhandler title=dom-navigator-registerProtocolHandler>a registered
+ handler</a> for the given scheme, then <a href=#read-ua-inline title=navigate-ua-inline>display the inline content</a> and
+ abort these steps.</p>
+
+ <p class=note>In the case of a registered handler being used,
+ the algorithm will be reinvoked with a new URL to handle the
+ request.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the new resource is to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, then
+ check if there are any <a href=#relevant-application-cache title="relevant application
+ cache">relevant application caches</a> that are identified by a
+ URL with the <a href=#same-origin>same origin</a> as the URL in question, and
+ that have this URL as one of their entries, excluding entries
+ marked as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>. If so, then the
+ user agent must then get the resource from the <a href=#concept-appcache-selection title=concept-appcache-selection>most appropriate application
+ cache</a> of those that match.</p>
+
+ <p class=example>For example, imagine an HTML page with an
+ associated application cache displaying an image and a form, where
+ the image is also used by several other application caches. If the
+ user right-clicks on the image and chooses "View Image", then the
+ user agent could decide to show the image from any of those
+ caches, but it is likely that the most useful cache for the user
+ would be the one that was used for the aforementioned HTML
+ page. On the other hand, if the user submits the form, and the
+ form does a POST submission, then the user agent will not use an
+ application cache at all; the submission will be made to the
+ network.</p>
+
+ <p>Otherwise, unless it has already been obtained<!-- it's
+ obtained by <object>, for instance -->, <a href=#fetch>fetch</a> the new
+ resource, with the <i>manual redirect flag</i> set.</p>
+
+ <p>If the resource is being fetched using a method other than one
+ <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>equivalent to</a>
+ HTTP's GET<!-- or HEAD (but that can't happen) -->, or, if the
+ <a href=#navigate title=navigate>navigation algorithm</a> was invoked as
+ a result of the <a href=#concept-form-submit title=concept-form-submit>form submission
+ algorithm</a>, then the <a href=#fetch title=fetch>fetching
+ algorithm</a> must be invoked from the <a href=#origin>origin</a> of
+ the <a href=#active-document>active document</a> of the <a href=#source-browsing-context>source browsing
+ context</a>, if any.</p> <!-- potentially http-origin privacy
+ sensitive -->
+
+ <p>If the <a href=#browsing-context>browsing context</a> being navigated is a
+ <a href=#child-browsing-context>child browsing context</a> for an <code><a href=#the-iframe-element>iframe</a></code> or
+ <code><a href=#the-object-element>object</a></code> element, then the <a href=#fetch title=fetch>fetching
+ algorithm</a> must be invoked from the <code><a href=#the-iframe-element>iframe</a></code> or
+ <code><a href=#the-object-element>object</a></code> element's <a href=#browsing-context-scope-origin>browsing context scope
+ origin</a>, if it has one.</p> <!-- potentially http-origin
+ privacy sensitive -->
+
+ </li>
+
+ <li>
+
+ <p>At this point, unless this step has already been reached once
+ before in the execution of this instance of the algorithm, the
+ user agents must return to whatever algorithm invoked the
+ navigation steps and must continue these steps asynchronously.</p>
+
+ </li>
+
+ <li>
+
+ <p>If fetching the resource results in a redirect, and either the
+ <a href=#url>URL</a> of the target of the redirect has the <a href=#same-origin>same
+ origin</a> as the original resource, or the resource is being
+ obtained using the POST method or a safe method (in HTTP terms),
+ return to <a href=#navigate-fragid-step>the step labeled
+ "fragment identifiers"</a> with the new resource.</p>
+
+ <p>Otherwise, if fetching the resource results in a redirect but
+ the <a href=#url>URL</a> of the target of the redirect does not have
+ the <a href=#same-origin>same origin</a> as the original resource and the
+ resource is being obtained using a method that is neither the POST
+ method nor a safe method (in HTTP terms), then abort these
+ steps. The user agent may indicate to the user that the navigation
+ has been aborted for security reasons.</p>
+
+ </li>
+
+ <li><p>Wait for one or more bytes to be available or for the user
+ agent to establish that the resource in question is empty. During
+ this time, the user agent may allow the user to cancel this
+ navigation attempt or start other navigation attempts.</li>
+
+ <li>
+
+ <p>If the resource was not fetched from an <a href=#application-cache>application
+ cache</a>, and was to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, and its
+ URL <a href=#concept-appcache-matches-fallback title=concept-appcache-matches-fallback>matches the
+ fallback namespace</a> of one or more <a href=#relevant-application-cache title="relevant
+ application cache">relevant application caches</a>, and the
+ user didn't cancel the navigation attempt during the previous
+ step, and the navigation attempt failed (e.g. the server returned
+ a 4xx or 5xx status code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or
+ there was a DNS error), then:</p> <!-- note that a redirect can
+ never reach this point as it is handled earlier, meaning that a
+ captive portal captures URLs in fallback namespaces and you can't
+ ever get to the fallback file of a resource if you have a captive
+ portal -->
+
+ <p>Let <var title="">candidate</var> be the <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback resource</a>
+ specified for the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a> in
+ question. If multiple application caches match, the user agent
+ must use the fallback of the <a href=#concept-appcache-selection title=concept-appcache-selection>most appropriate application
+ cache</a> of those that match.</p>
+
+ <p>If <var title="">candidate</var> is not marked as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then the user
+ agent must discard the failed load and instead continue along
+ these steps using <var title="">candidate</var> as the
+ resource. <a href="#the-document's-address">The document's address</a>, if appropriate,
+ will still be the originally requested URL, not the fallback URL,
+ but the user agent may indicate to the user that the original page
+ load failed, that the page used was a fallback resource, and what
+ the URL of the fallback resource actually is.</p>
+
+ </li>
+
+ <li><p>If the document's out-of-band metadata (e.g. HTTP headers),
+ not counting any <a href=#content-type title=Content-Type>type information</a>
+ (such as the Content-Type HTTP header), requires some sort of
+ processing that will not affect the browsing context, then perform
+ that processing and abort these steps.</p>
+
+ <div class=note>
+ <p>Such processing might be triggered by, amongst other things, the
+ following:</p>
+ <ul class=brief><li>HTTP status codes (e.g. 204 No Content or 205 Reset Content)</li>
+ <li>HTTP Content-Disposition headers</li>
+ <li>Network errors</li>
+ </ul></div>
+
+ <!-- theorectically, HTTP 205 processing would occur here,
+ resetting all forms with no other effect. However, it seems nobody
+ actually wants to use this ability, so requiring it here seems
+ like unnecessary work. -->
+
+ <p>HTTP 401 responses that do not include a challenge recognized
+ by the user agent must be processed as if they had no challenge,
+ e.g. rendering the entity body as if the response had been 200
+ OK.</p>
+
+ <p>User agents may show the entity body of an HTTP 401 response
+ even when the response do include a recognized challenge, with the
+ option to login being included in a non-modal fashion, to enable
+ the information provided by the server to be used by the user
+ before authenticating. Similarly, user agents should allow the
+ user to authenticate (in a non-modal fashion) against
+ authentication challenges included in other responses such as HTTP
+ 200 OK responses, effectively allowing resources to present HTTP
+ login forms without requiring their use.</p>
+
+ </li>
+
+ <li><p>Let <var title="">type</var> be <a href=#content-type-sniffing-0 title="Content-Type
+ sniffing">the sniffed type of the resource</a>.</li>
+
+ <li><p>If the user agent has been configured to process resources
+ of the given <var title="">type</var> using some mechanism other
+ than rendering the content in a <a href=#browsing-context>browsing context</a>, then
+ skip this step. Otherwise, if the <var title="">type</var> is one
+ of the following types, jump to the appropriate entry in the
+ following list, and process the resource as described there:</p>
+
+ <dl class=switch><!-- an <span>HTML MIME type</span> --><dt>"<code><a href=#text/html>text/html</a></code>"</dt>
+ <dt>"<code><a href=#text/html-sandboxed>text/html-sandboxed</a></code>"</dt>
+ <dd>Follow the steps given in the <a href=#read-html title=navigate-html>HTML document</a> section, and abort
+ these steps.</dd>
+
+ <!-- an <span>XML MIME type</span> -->
+ <dt>Any type ending in "<code title="">+xml</code>"</dt> <!-- no need to say that the _subtype_ ends in "+xml" so long as the "sniffed type" algorithm continues to drop parameters -->
+ <dt>"<code>application/xml</code>"</dt>
+ <dt>"<code>text/xml</code>"</dt>
+ <dd>Follow the steps given in the <a href=#read-xml title=navigate-xml>XML
+ document</a> section. If that section determines that the
+ content is <em>not</em> to be displayed as a generic XML
+ document, then proceed to the next step in this overall set of
+ steps. Otherwise, abort these steps.</dd>
+
+ <dt>"<code>text/plain</code>"</dt>
+ <dd>Follow the steps given in the <a href=#read-text title=navigate-text>plain text file</a> section, and abort
+ these steps.</dd>
+
+ <dt>A supported image type</dt>
+ <dd>Follow the steps given in the <a href=#read-image title=navigate-image>image</a> section, and abort these
+ steps.</dd>
+
+ <dt>A type that will use an external application to render the
+ content in the <a href=#browsing-context>browsing context</a></dt>
+ <dd>Follow the steps given in the <a href=#read-plugin title=navigate-plugin>plugin</a> section, and abort these
+ steps.</dd>
+
+ </dl><p><dfn id="set-the-document's-address" title="set the document's address">Setting the document's
+ address</dfn>: If there is no <dfn id=override-url>override URL</dfn>, then any
+ <code><a href=#document>Document</a></code> created by these steps must have its <a href="#the-document's-address" title="the document's address">address</a> set to the
+ <a href=#url>URL</a> that was originally to be <a href=#fetch title=fetch>fetched</a>, ignoring any other data that was
+ used to obtain the resource (e.g. the entity body in the case of a
+ POST submission is not part of <a href="#the-document's-address">the document's
+ address</a>, nor is the URL of the fallback resource in the
+ case of the original load having failed and that URL having been
+ found to match a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
+ namespace</a>). However, if there <em>is</em> an <a href=#override-url>override
+ URL</a>, then any <code><a href=#document>Document</a></code> created by these steps
+ must have its <a href="#the-document's-address" title="the document's address">address</a>
+ set to that <a href=#url>URL</a> instead.</p>
+
+ <p class=note>An <a href=#override-url title="override URL">override URL</a>
+ is set when <a href=#concept-js-deref title=concept-js-deref>dereferencing a
+ <code>javascript:</code> URL</a>.</p>
+
+ <p><dfn id=create-a-document-object title="create a Document object">Creating a new
+ <code>Document</code> object</dfn>: When a <code><a href=#document>Document</a></code>
+ is created as part of the above steps, a new <code><a href=#window>Window</a></code>
+ object must be created and associated with the
+ <code><a href=#document>Document</a></code>, with one exception: if the <a href=#browsing-context>browsing
+ context</a>'s only entry in its <a href=#session-history>session history</a> is
+ the <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> that was added
+ when the <a href=#browsing-context>browsing context</a> was created, and navigation
+ is occurring with <a href=#replacement-enabled>replacement enabled</a>, and that
+ <code><a href=#document>Document</a></code> has the <a href=#same-origin>same origin</a> as the new
+ <code><a href=#document>Document</a></code>, then the <code><a href=#window>Window</a></code> object of that
+ <code><a href=#document>Document</a></code> must be used instead, and the <code title=dom-document><a href=#dom-document>document</a></code> attribute of the
+ <code><a href=#window>Window</a></code> object must be changed to point to the new
+ <code><a href=#document>Document</a></code> instead.</p>
+
+ </li>
+
+ <li id=navigate-non-Document>
+
+ <p><i>Non-document content</i>: If, given <var title="">type</var>, the new resource is to be handled by
+ displaying some sort of inline content, e.g. a native rendering of
+ the content, an error message because the specified type is not
+ supported, or an inline prompt to allow the user to select <a href=#dom-navigator-registercontenthandler title=dom-navigator-registerContentHandler>a registered
+ handler</a> for the given type, then <a href=#read-ua-inline title=navigate-ua-inline>display the inline content</a> and
+ abort these steps.</p>
+
+ <p class=note>In the case of a registered handler being used,
+ the algorithm will be reinvoked with a new URL to handle the
+ request.</p>
+
+ </li>
+
+ <li><p>Otherwise, the document's <var title="">type</var> is such
+ that the resource will not affect the browsing context,
+ e.g. because the resource is to be handed to an external
+ application. Process the resource appropriately.</p>
+
+ </ol><hr><p>Some of the sections below, to which the above algorithm defers
+ in certain cases, require the user agent to <dfn id=update-the-session-history-with-the-new-page>update the session
+ history with the new page</dfn>. When a user agent is required to do
+ this, it must <a href=#queue-a-task>queue a task</a> to run the following
+ steps:</p>
+
+ <ol><li><p><a href=#unload-a-document title="unload a document">Unload</a> the
+ <code><a href=#document>Document</a></code> object of the <a href=#current-entry>current entry</a>,
+ with the <var title="">recycle</var> parameter set to
+ false.</li>
+
+ <li>
+
+ <dl><dt>If the navigation was initiated for <dfn id=entry-update>entry update</dfn> of
+ an entry</dt>
+
+ <dd>
+
+ <ol><li><p>Replace the <code><a href=#document>Document</a></code> of the entry being
+ updated, and any other entries that referenced the same
+ document as that entry, with the new
+ <code><a href=#document>Document</a></code>.</li>
+
+ <li><p><a href=#traverse-the-history>Traverse the history</a> to the new
+ entry.</li>
+
+ </ol><p class=note>This can only happen if the entry being updated
+ is no the <a href=#current-entry>current entry</a>, and can never happen with
+ <a href=#replacement-enabled>replacement enabled</a>. (It happens when the user
+ tried to traverse to a session history entry that no longer had
+ a <code><a href=#document>Document</a></code> object.)</p>
+
+ </dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <ol><li>
+
+ <p>Remove all the entries in the <a href=#browsing-context>browsing
+ context</a>'s <a href=#session-history>session history</a> after the
+ <a href=#current-entry>current entry</a>. If the <a href=#current-entry>current entry</a>
+ is the last entry in the session history, then no entries are
+ removed.</p>
+
+ <p class=note>This <a href=#history-notes>doesn't
+ necessarily have to affect</a> the user agent's user
+ interface.</p>
+
+ </li>
+
+ <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a>
+ queued by the <a href=#history-traversal-task-source>history traversal task
+ source</a>.</li> <!-- so the network is racing
+ history.back(), in the case of setting location.href="" and
+ then calling history.back() -->
+
+ <li><p>Append a new entry at the end of the <code><a href=#history-0>History</a></code>
+ object representing the new resource and its
+ <code><a href=#document>Document</a></code> object and related state.</li>
+
+ <li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry. If
+ the navigation was initiated with <a href=#replacement-enabled>replacement
+ enabled</a>, then the traversal must itself be initiated
+ with <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </li>
+
+ </ol></dd>
+
+ </dl></li>
+
+ <li><p>The <a href=#navigate title=navigate>navigation algorithm</a> has
+ now <dfn id=concept-navigate-mature title=concept-navigate-mature>matured</dfn>.</li>
+
+ <li><p><i>Fragment identifier loop</i>: <a href=#spin-the-event-loop>Spin the event
+ loop</a> for a user-agent-defined amount of time, as desired by
+ the user agent implementor. (This is intended to allow the user
+ agent to optimize the user experience in the face of performance
+ concerns.)</li>
+
+ <li><p>If the <code><a href=#document>Document</a></code> object has no parser, or its
+ parser has <a href=#stop-parsing title="stop parsing">stopped parsing</a>, or
+ the user agent has reason to believe the user is no longer
+ interested in scrolling to the fragment identifier, then abort
+ these steps.</li>
+
+ <li><p><a href=#scroll-to-the-fragment-identifier>Scroll to the fragment identifier</a> given in
+ <a href="#the-document's-current-address">the document's current address</a>. If this fails to find
+ <a href=#the-indicated-part-of-the-document title="the indicated part of the document">an indicated part
+ of the document</a>, then return to the <i>fragment identifier
+ loop</i> step.</li>
+
+ </ol><p>The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#networking-task-source>networking task
+ source</a>.</p>
+
+
+ <h4 id=read-html><span class=secno>6.5.2 </span><dfn title=navigate-html>Page load processing model for HTML files</dfn></h4>
+
+ <p>When an HTML document is to be loaded in a <a href=#browsing-context>browsing
+ context</a>, the user agent must <a href=#queue-a-task>queue a task</a> to
+ <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being
+ an <a href=#html-documents title="HTML documents">HTML document</a>, create an
+ <a href=#html-parser>HTML parser</a>, and associate it with the document. Each
+ <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking
+ task source</a> places on the <a href=#task-queue>task queue</a> while the
+ <a href=#fetch title=fetch>fetching algorithm</a> runs must then fill
+ the parser's <a href=#the-input-stream>input stream</a> with the fetched bytes and
+ cause the <a href=#html-parser>HTML parser</a> to perform the appropriate
+ processing of the input stream.</p>
+
+ <p class=note>The <a href=#the-input-stream>input stream</a> converts bytes into
+ characters for use in the <a href=#tokenization title=tokenization>tokenizer</a>. This process relies, in part,
+ on character encoding information found in the real <a href=#content-type title=Content-Type>Content-Type metadata</a> of the resource;
+ the "sniffed type" is not used for this purpose.</p>
+
+ <!-- next two paragraphs are nearly identical to the navigate-text
+ section, keep them in sync -->
+
+ <p>When no more bytes are available, the user agent must <a href=#queue-a-task>queue
+ a task</a> for the parser to process the implied EOF character,
+ which eventually causes a <code title=event-load>load</code> event
+ to be fired.</p>
+
+ <p>After creating the <code><a href=#document>Document</a></code> object, but before any
+ script execution, certainly before the parser <a href=#stop-parsing title="stop
+ parsing">stops</a>, the user agent must <a href=#update-the-session-history-with-the-new-page>update the session
+ history with the new page</a>.</p>
+
+ <p class=note><a href=#concept-appcache-init title=concept-appcache-init>Application
+ cache selection</a> happens <a href=#parser-appcache>in the
+ HTML parser</a>.</p>
+
+ <p>The <a href=#task-source>task source</a> for the two tasks mentioned in this
+ section must be the <a href=#networking-task-source>networking task source</a>.</p>
+
+
+
+ <h4 id=read-xml><span class=secno>6.5.3 </span><dfn title=navigate-xml>Page load processing model for XML files</dfn></h4>
+
+ <p>When faced with displaying an XML file inline, user agents must
+ first <a href=#create-a-document-object>create a <code>Document</code> object</a>, following
+ the requirements of the XML and Namespaces in XML recommendations,
+ RFC 3023, DOM3 Core, and other relevant specifications. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsRFC3023>[RFC3023]</a> <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+ <p>The actual HTTP headers and other metadata, not the headers as
+ mutated or implied by the algorithms given in this specification,
+ are the ones that must be used when determining the character
+ encoding according to the rules given in the above
+ specifications. Once the character encoding is established, the
+ <a href="#document's-character-encoding">document's character encoding</a> must be set to that
+ character encoding.</p>
+
+ <p>If the root element, as parsed according to the XML
+ specifications cited above, is found to be an <code><a href=#the-html-element-0>html</a></code>
+ element with an attribute <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> whose value is not the
+ empty string, then, as soon as the element is <a href=#insert-an-element-into-a-document title="insert an
+ element into a document">inserted into the document</a>, the user
+ agent must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of
+ that attribute relative to that element, and if that is successful,
+ must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache
+ selection algorithm</a> with the resulting <a href=#absolute-url>absolute
+ URL</a> with any <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component removed as
+ the manifest URL, and passing in the newly-created
+ <code><a href=#document>Document</a></code>. Otherwise, if the attribute is absent, its
+ value is the empty string, or resolving its value fails, then as
+ soon as the root element is <a href=#insert-an-element-into-a-document title="insert an element into a
+ document">inserted into the document</a>, the user agent must run
+ the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
+ algorithm</a> with no manifest, and passing in the
+ <code><a href=#document>Document</a></code>.</p>
+
+ <p class=note>Because the processing of the <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute happens
+ only once the root element is parsed, any URLs referenced by
+ processing instructions before the root element (such as <code title="">&lt;?xml-stylesheet?&gt;</code> and <code title="">&lt;?xbl?&gt;</code> PIs) will be fetched from the network and
+ cannot be cached.</p><!-- v2: fix this somehow -->
+
+ <p>User agents may examine the namespace of the root
+ <code><a href=#element>Element</a></code> node of this <code><a href=#document>Document</a></code> object to
+ perform namespace-based dispatch to alternative processing tools,
+ e.g. determining that the content is actually a syndication feed and
+ passing it to a feed handler. If such processing is to take place,
+ abort the steps in this section, and jump to <a href=#navigate-non-Document>the next step</a> (labeled
+ "non-document content") in the <a href=#navigate>navigate</a> steps
+ above.</p>
+
+ <p>Otherwise, then, with the newly created <code><a href=#document>Document</a></code>,
+ the user agents must <a href=#update-the-session-history-with-the-new-page>update the session history with the new
+ page</a>. User agents may do this before the complete document
+ has been parsed (thus achieving <i>incremental rendering</i>), and
+ must do this before any scripts are to be executed.</p>
+
+ <p>Error messages from the parse process (e.g. XML namespace
+ well-formedness errors) may be reported inline by mutating the
+ <code><a href=#document>Document</a></code>.</p>
+
+
+ <h4 id=read-text><span class=secno>6.5.4 </span><dfn title=navigate-text>Page load processing model for text files</dfn></h4>
+
+ <p>When a plain text document is to be loaded in a <a href=#browsing-context>browsing
+ context</a>, the user agent should <a href=#queue-a-task>queue a task</a> to
+ <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being
+ an <a href=#html-documents title="HTML documents">HTML document</a>, create an
+ <a href=#html-parser>HTML parser</a>, associate it with the document, act as if
+ the tokenizer had emitted a start tag token with the tag name "pre"
+ followed by a single U+000A LINE FEED (LF) character<!-- to get
+ eaten, so that a leading LF in the text/plain stream doesn't get
+ eaten itself-->, and switch the <a href=#html-parser>HTML parser</a>'s tokenizer
+ to the <a href=#plaintext-state>PLAINTEXT state</a>. Each <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task
+ source</a> places on the <a href=#task-queue>task queue</a> while the <a href=#fetch title=fetch>fetching algorithm</a> runs must then fill the
+ parser's <a href=#the-input-stream>input stream</a> with the fetched bytes and cause
+ the <a href=#html-parser>HTML parser</a> to perform the appropriate processing
+ of the input stream.</p>
+
+ <p>The rules for how to convert the bytes of the plain text document
+ into actual characters are defined in RFC 2046, RFC 2646, and
+ subsequent versions thereof. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsRFC2646>[RFC2646]</a></p>
+
+ <p>The <a href="#document's-character-encoding">document's character encoding</a> must be set to the
+ character encoding used to decode the document.</p>
+
+ <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent
+ must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache
+ selection algorithm</a> with no manifest, and passing in the
+ newly-created <code><a href=#document>Document</a></code>.</p>
+
+ <!-- next two paragraphs are nearly identical to the navigate-html
+ section and similar to the "navigate-ua-inline" section, and the
+ next three are similar to the navigate-image and navigate-plugin
+ sections; keep them all in sync -->
+
+ <p>When no more bytes are available, the user agent must <a href=#queue-a-task>queue
+ a task</a> for the parser to process the implied EOF character,
+ which eventually causes a <code title=event-load>load</code> event
+ to be fired.</p>
+
+ <p>After creating the <code><a href=#document>Document</a></code> object, but potentially
+ before the page has finished parsing, the user agent must
+ <a href=#update-the-session-history-with-the-new-page>update the session history with the new page</a>.</p>
+
+ <p>User agents may add content to the <code><a href=#the-head-element-0>head</a></code> element of
+ the <code><a href=#document>Document</a></code>, e.g. linking to a style sheet or an XBL
+ binding, providing script, giving the document a <code><a href=#the-title-element-0>title</a></code>,
+ etc.</p>
+
+ <p>The <a href=#task-source>task source</a> for the two tasks mentioned in this
+ section must be the <a href=#networking-task-source>networking task source</a>.</p>
+
+
+ <h4 id=read-image><span class=secno>6.5.5 </span><dfn title=navigate-image>Page load processing model for images</dfn></h4>
+
+ <p>When an image resource is to be loaded in a <a href=#browsing-context>browsing
+ context</a>, the user agent should <a href=#create-a-document-object>create a
+ <code>Document</code> object</a>, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a>, append an
+ <code><a href=#the-html-element-0>html</a></code> element to the <code><a href=#document>Document</a></code>, append a
+ <code><a href=#the-head-element-0>head</a></code> element and a <code><a href=#the-body-element-0>body</a></code> element to the
+ <code><a href=#the-html-element-0>html</a></code> element, append an <code><a href=#the-img-element>img</a></code> to the
+ <code><a href=#the-body-element-0>body</a></code> element, and set the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute of the <code><a href=#the-img-element>img</a></code>
+ element to the address of the image.</p>
+
+ <!-- next three paragraphs are similar to the navigate-text section,
+ keep them in sync -->
+
+ <p>Then, the user agent must act as if it had <a href=#stop-parsing title="stop
+ parsing">stopped parsing</a>.</p>
+
+ <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent
+ must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache
+ selection algorithm</a> with no manifest, and passing in the
+ newly-created <code><a href=#document>Document</a></code>.</p>
+
+ <p>After creating the <code><a href=#document>Document</a></code> object, but potentially
+ before the page has finished fully loading, the user agent must
+ <a href=#update-the-session-history-with-the-new-page>update the session history with the new page</a>.</p>
+
+ <p>User agents may add content to the <code><a href=#the-head-element-0>head</a></code> element of
+ the <code><a href=#document>Document</a></code>, or attributes to the <code><a href=#the-img-element>img</a></code>
+ element, e.g. to link to a style sheet or an XBL binding, to provide
+ a script, to give the document a <code><a href=#the-title-element-0>title</a></code>, etc.</p>
+
+
+ <h4 id=read-plugin><span class=secno>6.5.6 </span><dfn title=navigate-plugin>Page load processing model for content that uses plugins</dfn></h4>
+
+ <p>When a resource that requires an external resource to be rendered
+ is to be loaded in a <a href=#browsing-context>browsing context</a>, the user agent
+ should <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it
+ as being an <a href=#html-documents title="HTML documents">HTML document</a>,
+ append an <code><a href=#the-html-element-0>html</a></code> element to the <code><a href=#document>Document</a></code>,
+ append a <code><a href=#the-head-element-0>head</a></code> element and a <code><a href=#the-body-element-0>body</a></code> element
+ to the <code><a href=#the-html-element-0>html</a></code> element, append an <code><a href=#the-embed-element>embed</a></code> to
+ the <code><a href=#the-body-element-0>body</a></code> element, and set the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute of the
+ <code><a href=#the-embed-element>embed</a></code> element to the address of the resource.</p>
+
+ <!-- next three paragraphs are similar to the navigate-text section,
+ keep them in sync -->
+
+ <p>Then, the user agent must act as if it had <a href=#stop-parsing title="stop
+ parsing">stopped parsing</a>.</p>
+
+ <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent
+ must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache
+ selection algorithm</a> with no manifest, and passing in the
+ newly-created <code><a href=#document>Document</a></code>.</p>
+
+ <p>After creating the <code><a href=#document>Document</a></code> object, but potentially
+ before the page has finished fully loading, the user agent must
+ <a href=#update-the-session-history-with-the-new-page>update the session history with the new page</a>.</p>
+
+ <p>User agents may add content to the <code><a href=#the-head-element-0>head</a></code> element of
+ the <code><a href=#document>Document</a></code>, or attributes to the <code><a href=#the-embed-element>embed</a></code>
+ element, e.g. to link to a style sheet or an XBL binding, or to give
+ the document a <code><a href=#the-title-element-0>title</a></code>.</p>
+
+ <p class=note id=sandboxPluginNavigate>If the <a href=#sandboxed-plugins-browsing-context-flag>sandboxed
+ plugins browsing context flag</a> was set on the <a href=#browsing-context>browsing
+ context</a> when the <code><a href=#document>Document</a></code> was created, the
+ synthesized <code><a href=#the-embed-element>embed</a></code> element will <a href=#sandboxPluginEmbed>fail to render the content</a>.</p>
+
+
+ <h4 id=read-ua-inline><span class=secno>6.5.7 </span><dfn title=navigate-ua-inline>Page load processing model for inline content that doesn't have a DOM</dfn></h4>
+
+ <p>When the user agent is to display a user agent page inline in a
+ <a href=#browsing-context>browsing context</a>, the user agent should <a href=#create-a-document-object>create a
+ <code>Document</code> object</a>, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a>, and then either
+ associate that <code><a href=#document>Document</a></code> with a custom rendering that is
+ not rendered using the normal <code><a href=#document>Document</a></code> rendering rules,
+ or mutate that <code><a href=#document>Document</a></code> until it represents the content
+ the user agent wants to render.</p>
+
+ <!-- next two paragraphs are similar to the navigate-text section,
+ keep them in sync -->
+
+ <p>Once the page has been set up, the user agent must act as if it
+ had <a href=#stop-parsing title="stop parsing">stopped parsing</a>.</p>
+
+ <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent
+ must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache
+ selection algorithm</a> with no manifest, passing in the
+ newly-created <code><a href=#document>Document</a></code>.</p>
+
+ <p>After creating the <code><a href=#document>Document</a></code> object, but potentially
+ before the page has been completely set up, the user agent must
+ <a href=#update-the-session-history-with-the-new-page>update the session history with the new page</a>.</p>
+
+
+
+ <h4 id=scroll-to-fragid><span class=secno>6.5.8 </span><dfn title=navigate-fragid>Navigating to a fragment identifier</dfn></h4>
+
+ <p>When a user agent is supposed to navigate to a fragment
+ identifier, then the user agent must <a href=#queue-a-task>queue a task</a> to
+ run the following steps:</p>
+
+ <ol><li>
+
+ <p>Remove all the entries in the <a href=#browsing-context>browsing context</a>'s
+ <a href=#session-history>session history</a> after the <a href=#current-entry>current
+ entry</a>. If the <a href=#current-entry>current entry</a> is the last entry
+ in the session history, then no entries are removed.</p>
+
+ <p class=note>This <a href=#history-notes>doesn't necessarily
+ have to affect</a> the user agent's user interface.</p>
+
+ </li>
+
+ <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> queued by
+ the <a href=#history-traversal-task-source>history traversal task source</a>.</li>
+
+ <li><p>Append a new entry at the end of the <code><a href=#history-0>History</a></code>
+ object representing the new resource and its <code><a href=#document>Document</a></code>
+ object and related state. Its <a href=#url>URL</a> must be set to the
+ address to which the user agent was <a href=#navigate title=navigate>navigating</a>. The title must be left
+ unset.</li>
+
+ <li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry. This
+ will <a href=#scroll-to-the-fragment-identifier>scroll to the fragment identifier</a> given in what
+ is now <a href="#the-document's-current-address">the document's current address</a>.</li>
+
+ </ol><p class=note>If the scrolling fails because the relevant ID has
+ not yet been parsed, then the original <a href=#navigate title=navigate>navigation</a> algorithm will take care of the
+ scrolling instead, as the last few steps of its <a href=#update-the-session-history-with-the-new-page>update the
+ session history with the new page</a> algorithm.</p>
+
+ <hr><p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment
+ identifier</dfn>, it must change the scrolling position of the
+ document, or perform some other action, such that <a href=#the-indicated-part-of-the-document>the
+ indicated part of the document</a> is brought to the user's
+ attention. If there is no indicated part, then the user agent must
+ not scroll anywhere.</p>
+
+ <p><dfn id=the-indicated-part-of-the-document>The indicated part of the document</dfn> is the one that the
+ fragment identifier, if any, identifies. The semantics of the
+ fragment identifier in terms of mapping it to a specific DOM Node is
+ defined by the specification that defines the <a href=#mime-type>MIME type</a>
+ used by the <code><a href=#document>Document</a></code> (for example, the processing of
+ fragment identifiers for <a href=#xml-mime-type title="XML MIME type">XML MIME
+ types</a> is the responsibility of RFC3023). <a href=#refsRFC3023>[RFC3023]</a></p>
+
+ <p>For HTML documents (and <a href=#html-mime-type title="HTML MIME type">HTML MIME
+ types</a>), the following processing model must be followed to
+ determine what <a href=#the-indicated-part-of-the-document>the indicated part of the document</a>
+ is.</p>
+
+ <ol><li><p><a href=#parse-a-url title="parse a url">Parse</a> the <a href=#url>URL</a>,
+ and let <var title="">fragid</var> be the <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component of the
+ URL.</li><!-- parsing can't fail, since we checked earlier on
+ when navigating -->
+
+ <li><p>If <var title="">fragid</var> is the empty string, then
+ <a href=#the-indicated-part-of-the-document>the indicated part of the document</a> is the top of the
+ document; stop the algorithm here.</li>
+
+ <li><p>Let <var title="">decoded fragid</var> be the result of
+ expanding any sequences of percent-encoded octets in <var title="">fragid</var> that are valid UTF-8 sequences into Unicode
+ characters as defined by UTF-8. If any percent-encoded octets in
+ that string are not valid UTF-8 sequences, then skip this step and
+ the next one.</p>
+
+ <li><p>If this step was not skipped and there is an element in the
+ DOM that has an ID exactly equal to <var title="">decoded
+ fragid</var>, then the first such element in tree order is
+ <a href=#the-indicated-part-of-the-document>the indicated part of the document</a>; stop the algorithm
+ here.</li>
+
+ <li><p>If there is an <code><a href=#the-a-element>a</a></code> element in the DOM that has a
+ <code title=attr-a-name><a href=#attr-a-name>name</a></code> attribute whose value is
+ exactly equal to <var title="">fragid</var> (<em>not</em> <var title="">decoded fragid</var>), then the first such element in tree
+ order is <a href=#the-indicated-part-of-the-document>the indicated part of the document</a>; stop the
+ algorithm here.</li>
+
+ <li><p>If <var title="">fragid</var> is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string <code title="">top</code>, then <a href=#the-indicated-part-of-the-document>the indicated part of the
+ document</a> is the top of the document; stop the algorithm
+ here.</li>
+
+ <li><p>Otherwise, there is no <a href=#the-indicated-part-of-the-document title="the indicated part of
+ the document">indicated part of the document</a>.</li>
+
+ </ol><p>For the purposes of the interaction of HTML with Selectors' <code title=selector-target>:target</code> pseudo-class, the
+ <dfn id=target-element><i>target element</i></dfn> is <a href=#the-indicated-part-of-the-document>the indicated part of the
+ document</a>, if that is an element; otherwise there is no
+ <i><a href=#target-element>target element</a></i>. <a href=#refsSELECTORS>[SELECTORS]</a></p>
+
+ </div>
+
+
+
+ <h4 id=history-traversal><span class=secno>6.5.9 </span>History traversal</h4> <!-- session history -->
+
+ <div class=impl>
+
+ <p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn>
+ to a <i>specified entry</i>, optionally with <a href=#replacement-enabled>replacement
+ enabled</a>, the user agent must act as follows:</p>
+
+ <ol><li><p>If there is no longer a <code><a href=#document>Document</a></code> object for the
+ entry in question, the user agent must <a href=#navigate>navigate</a> the
+ browsing context to the location for that entry to perform an
+ <a href=#entry-update>entry update</a> of that entry, and abort these steps. The
+ "<a href=#navigate>navigate</a>" algorithm reinvokes this "traverse"
+ algorithm to complete the traversal, at which point there
+ <em>is</em> a <code><a href=#document>Document</a></code> object and so this step gets
+ skipped. The navigation must be done using the same <a href=#source-browsing-context>source
+ browsing context</a> as was used the first time this entry was
+ created. (This can never happen with <a href=#replacement-enabled>replacement
+ enabled</a>.)</li>
+
+ <li><p>If the <a href=#current-entry>current entry</a>'s title was not set by the
+ <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> or <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState()</a></code> methods,
+ then set its title to the value returned by the <code title=dom-document-title><a href=#document.title>document.title</a></code> IDL
+ attribute.</li>
+
+ <li>
+
+ <p>If appropriate, update the <a href=#current-entry>current entry</a> in the
+ <a href=#browsing-context>browsing context</a>'s <code><a href=#document>Document</a></code> object's
+ <code><a href=#history-0>History</a></code> object to reflect any state that the user
+ agent wishes to persist. The entry is then said to be <dfn id=an-entry-with-persisted-user-state>an
+ entry with persisted user state</dfn>.</p>
+
+ <p class=example>For example, some user agents might want to
+ persist the scroll position, or the values of form controls.</p>
+
+ </li>
+
+ <li><p>If the <i>specified entry</i> has a different
+ <code><a href=#document>Document</a></code> object than the <a href=#current-entry>current entry</a>
+ then the user agent must run the following substeps:</p>
+
+ <ol><li>If the browsing context is a <a href=#top-level-browsing-context>top-level browsing
+ context</a>, but not an <a href=#auxiliary-browsing-context>auxiliary browsing
+ context</a>, and the <a href=#origin>origin</a> of the
+ <code><a href=#document>Document</a></code> of the <i>specified entry</i> is not the
+ <a href=#same-origin title="same origin">same</a> as the <a href=#origin>origin</a>
+ of the <code><a href=#document>Document</a></code> of the <a href=#current-entry>current entry</a>,
+ then the following sub-sub-steps must be run:
+
+ <ol><li>The current <a href=#browsing-context-name>browsing context name</a> must be
+ stored with all the entries in the history that are associated
+ with <code><a href=#document>Document</a></code> objects with the <a href=#same-origin>same
+ origin</a> as the <a href=#active-document>active document</a> <em>and</em>
+ that are contiguous with the <a href=#current-entry>current entry</a>.</li>
+
+ <li id=resetBCName>The browsing context's <a href=#browsing-context-name>browsing
+ context name</a> must be unset.</li>
+
+ </ol></li>
+
+ <li id=appcache-history-2>The user agent must make the
+ <i>specified entry</i>'s <code><a href=#document>Document</a></code> object the
+ <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
+ context</a>.</li>
+
+ <li>If the <i>specified entry</i> has a <a href=#browsing-context-name>browsing
+ context name</a> stored with it, then the following
+ sub-sub-steps must be run:
+
+ <ol><li>The browsing context's <a href=#browsing-context-name>browsing context name</a>
+ must be set to the name stored with the specified entry.</li>
+
+ <li>Any <a href=#browsing-context-name>browsing context name</a> stored with the
+ entries in the history that are associated with
+ <code><a href=#document>Document</a></code> objects with the <a href=#same-origin>same origin</a>
+ as the new <a href=#active-document>active document</a>, and that are
+ contiguous with the specified entry, must be cleared.</li>
+
+ </ol></li>
+
+ <li id=history-autocomplete><p>If the <i>specified entry</i>'s
+ <code><a href=#document>Document</a></code> has any <code><a href=#the-input-element>input</a></code> elements whose
+ <a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">off</i>, invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each
+ of those elements.</li>
+
+ <li><p>If the <a href=#current-document-readiness>current document readiness</a> of the
+ <i>specified entry</i>'s <code><a href=#document>Document</a></code> is "complete",
+ <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event at the
+ <code><a href=#window>Window</a></code> object of that <code><a href=#document>Document</a></code>, but
+ with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
+ <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
+ <code><a href=#window>Window</a></code> object), using the
+ <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code>
+ attribute set to true. This event must not bubble, must not be
+ cancelable, and has no default action.</li>
+
+ </ol></li>
+
+ <li><p>Set <a href="#the-document's-current-address">the document's current address</a> to the URL
+ of the <i>specified entry</i>.</li>
+
+ <li><p>If the <i>specified entry</i> has a URL that differs from
+ the <a href=#current-entry>current entry</a>'s only by its fragment identifier,
+ and the two share the same <code><a href=#document>Document</a></code> object, then let
+ <var title="">hash changed</var> be true, and let <var title="">old
+ URL</var> be the URL of the <a href=#current-entry>current entry</a> and <var title="">new URL</var> be the URL of the <i>specified
+ entry</i>. Otherwise, let <var title="">hash changed</var> be
+ false.</li>
+
+ <li><p>If the traversal was initiated with <dfn id=replacement-enabled>replacement
+ enabled</dfn>, remove the entry immediately before the
+ <var title="">specified entry</var> in the session history.</p>
+
+ <li><p>If the <i>specified entry</i> is not <a href=#an-entry-with-persisted-user-state>an entry with
+ persisted user state</a>, but its URL has a fragment identifier,
+ <a href=#scroll-to-the-fragment-identifier>scroll to the fragment identifier</a>.</li>
+
+ <li><p>If the entry is <a href=#an-entry-with-persisted-user-state>an entry with persisted user
+ state</a>, the user agent may update aspects of the document and
+ its rendering, for instance the scroll position or values of form
+ fields, that it had previously recorded.</li>
+
+ <li>
+
+ <p>If the <i>specified entry</i> is a state object or the first
+ entry for a <code><a href=#document>Document</a></code>, the user agent must run the
+ following substeps:</p>
+
+ <ol><li><p>If the entry is a <a href=#state-object>state object</a> entry, let <var title="">state</var> be a <a href=#structured-clone>structured clone</a> of that
+ state object. Otherwise, let <var title="">state</var> be
+ null.</li>
+
+ <li>
+
+ <p>Run the appropriate steps according to the conditions
+ described:</p>
+
+ <dl class=switch><dt>If the <a href=#current-document-readiness>current document readiness</a> is set to the
+ string "complete"</dt>
+
+ <dd><p><a href=#queue-a-task>Queue a task</a> to fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
+ <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, using
+ the <code><a href=#popstateevent>PopStateEvent</a></code> interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute set to
+ the value of <var title="">state</var>. This event must bubble
+ but not be cancelable and has no default action.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>Let the <code><a href=#document>Document</a></code>'s <dfn id=pending-state-object>pending state
+ object</dfn> be <var title="">state</var>. (If there was already
+ a <a href=#pending-state-object>pending state object</a>, the previous one is
+ discarded.)</p>
+
+ <p class=note>The event will then be fired just after the <code title=event-load>load</code> event.</dd>
+
+ </dl></li>
+
+ </ol></li>
+
+ <li><p>If <var title="">hash changed</var> is true, then
+ <a href=#queue-a-task>queue a task</a> to fire a <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> event at the
+ <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code> object, using
+ the <code><a href=#hashchangeevent>HashChangeEvent</a></code> interface, with the <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code> attribute set to
+ <var title="">old URL</var> and the <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code> attribute set to
+ <var title="">new URL</var>. This event must bubble but not be
+ cancelable and has no default action.</li>
+
+ <li><p>The <a href=#current-entry>current entry</a> is now the <i>specified
+ entry</i>.</li>
+
+ </ol><p>The <a href=#pending-state-object>pending state object</a> must be initially null.</p>
+
+ <p>The <a href=#task-source>task source</a> for the tasks mentioned above is the
+ <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
+
+
+ <h5 id=event-definitions><span class=secno>6.5.9.1 </span>Event definitions</h5>
+
+ </div>
+
+ <p>The <dfn id=event-popstate title=event-popstate><code>popstate</code></dfn> event
+ is fired when navigating to a <a href=#session-history-entry>session history entry</a>
+ that represents a state object.</p>
+
+ <pre class=idl>interface <dfn id=popstateevent>PopStateEvent</dfn> : <a href=#event>Event</a> {
+ readonly attribute any <a href=#dom-popstateevent-state title=dom-PopStateEvent-state>state</a>;
+ void <a href=#dom-popstateevent-initpopstateevent title=dom-PopStateEvent-initPopStateEvent>initPopStateEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any stateArg);
+};</pre>
+
+ <dl class=domintro><dt><var title="">event</var> . <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code></dt>
+
+ <dd>
+
+ <p>Returns a copy of the information that was provided to <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> or <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState()</a></code>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-popstateevent-initpopstateevent title=dom-PopStateEvent-initPopStateEvent><code>initPopStateEvent()</code></dfn>
+ method must initialize the event in a manner analogous to the
+ similarly-named method in the DOM Events interfaces. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>The <dfn id=dom-popstateevent-state title=dom-PopStateEvent-state><code>state</code></dfn>
+ attribute represents the context information for the event, or null,
+ if the state represented is the initial state of the
+ <code><a href=#document>Document</a></code>.</p>
+
+ </div>
+
+ <hr><p>The <dfn id=event-hashchange title=event-hashchange><code>hashchange</code></dfn>
+ event is fired when navigating to a <a href=#session-history-entry>session history
+ entry</a> whose <a href=#url>URL</a> differs from that of the
+ previous one only in the fragment identifier.</p>
+
+ <pre class=idl>interface <dfn id=hashchangeevent>HashChangeEvent</dfn> : <a href=#event>Event</a> {
+ readonly attribute any <a href=#dom-hashchangeevent-oldurl title=dom-HashChangeEvent-oldURL>oldURL</a>;
+ readonly attribute any <a href=#dom-hashchangeevent-newurl title=dom-HashChangeEvent-newURL>newURL</a>;
+ void <a href=#dom-hashchangeevent-inithashchangeevent title=dom-HashChangeEvent-initHashChangeEvent>initHashChangeEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString oldURLArg, in DOMString newURLArg);
+};</pre>
+
+ <dl class=domintro><dt><var title="">event</var> . <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <a href=#url>URL</a> of the <a href=#session-history-entry>session history
+ entry</a> that was previously current.</p>
+
+ </dd>
+
+
+ <dt><var title="">event</var> . <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <a href=#url>URL</a> of the <a href=#session-history-entry>session history
+ entry</a> that is now current.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-hashchangeevent-inithashchangeevent title=dom-HashChangeEvent-initHashChangeEvent><code>initHashChangeEvent()</code></dfn>
+ method must initialize the event in a manner analogous to the
+ similarly-named method in the DOM Events interfaces. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>The <dfn id=dom-hashchangeevent-oldurl title=dom-HashChangeEvent-oldURL><code>oldURL</code></dfn>
+ attribute represents context information for the event, specifically
+ the URL of the <a href=#session-history-entry>session history entry</a> that was traversed
+ from.</p>
+
+ <p>The <dfn id=dom-hashchangeevent-newurl title=dom-HashChangeEvent-newURL><code>newURL</code></dfn>
+ attribute represents context information for the event, specifically
+ the URL of the <a href=#session-history-entry>session history entry</a> that was traversed
+ to.</p>
+
+ </div>
+
+ <hr><p>The <dfn id=event-pageshow title=event-pageshow><code>pageshow</code></dfn> event
+ is fired when traversing <em>to</em> a <a href=#session-history-entry>session history
+ entry</a>.</p>
+
+ <p>The <dfn id=event-pagehide title=event-pagehide><code>pagehide</code></dfn>
+ event is fired when traversing <em>from</em> a <a href=#session-history-entry>session history
+ entry</a>.</p>
+
+ <pre class=idl>interface <dfn id=pagetransitionevent>PageTransitionEvent</dfn> : <a href=#event>Event</a> {
+ readonly attribute any <a href=#dom-pagetransitionevent-persisted title=dom-PageTransitionEvent-persisted>persisted</a>;
+ void <a href=#dom-pagetransitionevent-initpagetransitionevent title=dom-PageTransitionEvent-initPageTransitionEvent>initPageTransitionEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any persistedArg);
+};</pre>
+
+ <dl class=domintro><dt><var title="">event</var> . <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code></dt>
+
+ <dd>
+
+ <p>Returns false if the page is newly being loaded (and the <code title=event-load>load</code> event will fire). Otherwise, returns true.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-pagetransitionevent-initpagetransitionevent title=dom-PageTransitionEvent-initPageTransitionEvent><code>initPageTransitionEvent()</code></dfn>
+ method must initialize the event in a manner analogous to the
+ similarly-named method in the DOM Events interfaces. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>The <dfn id=dom-pagetransitionevent-persisted title=dom-PageTransitionEvent-persisted><code>persisted</code></dfn>
+ attribute represents the context information for the event.</p>
+
+ </div>
+
+
+
+ <h4 id=unloading-documents><span class=secno>6.5.10 </span>Unloading documents</h4>
+
+ <div class=impl>
+
+ <p>A <code><a href=#document>Document</a></code> has a <var title=concept-document-salvageable>salvageable</var> state, which
+ is initially true.</p>
+
+ <p>When a user agent is to <dfn id=prompt-to-unload-a-document>prompt to unload a document</dfn>,
+ it must run the following steps.</p>
+
+ <ol><li><p>Let <var title="">event</var> be a new
+ <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> event object with the name <code title=event-beforeunload>beforeunload</code>, which does not
+ bubble but is cancelable.</li>
+
+ <li><p><i>Dispatch</i>: Dispatch <var title="">event</var> at the
+ <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</li>
+
+ <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>
+
+ <li><p>If any event listeners were triggered by the earlier
+ <i>dispatch</i> step, then set the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
+ false.</li>
+
+ <li>
+
+ <p>If the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
+ attribute of the <var title="">event</var> object is not the empty
+ string, or if the event was canceled, then the user agent should
+ ask the user to confirm that they wish to unload the document.</p>
+
+ <p>The prompt shown by the user agent may include the string of
+ the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
+ attribute, or some leading subset thereof. (A user agent may want
+ to truncate the string to 1024 characters for display, for
+ instance.)</p>
+
+ <p>The user agent must <a href=#pause>pause</a> while waiting for the
+ user's response.</p>
+
+ <p>If the user did not confirm the page navigation, then the user
+ agent <dfn id=refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</dfn>.</p>
+
+ </li>
+
+ <li><p>If this algorithm was invoked by another instance of the
+ "prompt to unload a document" algorithm (i.e. through the steps
+ below that invoke this algorithm for all descendant browsing
+ contexts), then abort these steps here.</li>
+
+ <li><p>Let <var title="">descendants</var> be the <a href=#list-of-the-descendant-browsing-contexts>list of the
+ descendant browsing contexts</a> of the
+ <code><a href=#document>Document</a></code>.</li>
+
+ <li>
+
+ <p>If <var title="">descendants</var> is not an empty list, then
+ for each <a href=#browsing-context>browsing context</a> <var title="">b</var> in
+ <var title="">descendants</var> run the following substeps:</p>
+
+ <ol><li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to
+ unload</a> the <a href=#active-document>active document</a> of the
+ <a href=#browsing-context>browsing context</a> <var title="">b</var>. If the user
+ <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then
+ the user implicitly also <a href=#refused-to-allow-the-document-to-be-unloaded title="refused to allow the
+ document to be unloaded">refused to allow <em>this</em> document
+ to be unloaded</a>; abort these steps.</p>
+
+ <li><p>If <var title=concept-document-salvageable>salvageable</var> state of
+ the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
+ context</a> <var title="">b</var> is false, then set the <var title=concept-document-salvageable>salvageable</var> state of
+ <em>this</em> document to false also.</li>
+
+ </ol></li>
+
+ </ol><p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run
+ the following steps. These steps are passed an argument, <var title="">recycle</var>, which is either true or false, indicating
+ whether the <code><a href=#document>Document</a></code> object is going to be
+ re-used. (This is set by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>
+
+ <ol><li><p>Fire a <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event at
+ the <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, but
+ with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
+ <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
+ <code><a href=#window>Window</a></code> object), using the
+ <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code>
+ attribute set to true. This event must not bubble, must not be
+ cancelable, and has no default action.</li>
+
+ <li><p><i>Unload event</i>: <a href=#fire-a-simple-event>Fire a simple event</a> named
+ <code title=event-unload>unload</code> at the
+ <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</li>
+
+ <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>
+
+ <li><p>If any event listeners were triggered by the earlier
+ <i>unload event</i> step, then set the <code><a href=#document>Document</a></code>
+ object's <var title=concept-document-salvageable>salvageable</var> state to
+ false.</li>
+
+ <li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
+ <code><a href=#document>Document</a></code> that are defined by this specification or any
+ other relevant specifications.</li>
+
+ <li><p>If this algorithm was invoked by another instance of the
+ "unload a document" algorithm (i.e. through the steps below that
+ invoke this algorithm for all descendant browsing contexts), then
+ abort these steps here.</li>
+
+ <li><p>Let <var title="">descendants</var> be the <a href=#list-of-the-descendant-browsing-contexts>list of the
+ descendant browsing contexts</a> of the
+ <code><a href=#document>Document</a></code>.</li>
+
+ <li>
+
+ <p>If <var title="">descendants</var> is not an empty list, then
+ for each <a href=#browsing-context>browsing context</a> <var title="">b</var> in
+ <var title="">descendants</var> run the following substeps:</p>
+
+ <ol><li><p><a href=#unload-a-document title="unload a document">Unload</a> the
+ <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
+ <var title="">b</var> with the <var title="">recycle</var>
+ parameter set to false.</li>
+
+ <li><p>If <var title=concept-document-salvageable>salvageable</var> state of
+ the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
+ context</a> <var title="">b</var> is false, then set the <var title=concept-document-salvageable>salvageable</var> state of
+ <em>this</em> document to false also.</li>
+
+ </ol></li>
+
+ <li><p>If <var title=concept-document-salvageable>salvageable</var> and <var title="">recycle</var> are both false, then the
+ <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> must <a href=#discard-a-document title="discard a document">discard the
+ <code>Document</code></a>.</li>
+
+ </ol><p>This specification defines the following <dfn id=unloading-document-cleanup-steps>unloading document
+ cleanup steps</dfn>. Other specifications can define more.</p>
+
+ <ol><li><p>If there are any outstanding transactions that have
+ callbacks that involve <a href=#concept-script title=concept-script>scripts</a>
+ whose <a href="#script's-global-object" title="script's global object">global object</a> is
+ the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object, roll them
+ back (without invoking any of the callbacks) and set the
+ <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
+ false. <a href=#refsWEBSQL>[WEBSQL]</a> </li>
+
+ <li><p><span>Close the WebSocket connection</span> of any
+ <code>WebSocket</code> objects that were created by the <code title=dom-WebSocket>WebSocket()</code> constructor visible on the
+ <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object. If this
+ affected any <code>WebSocket</code> objects, the set
+ <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
+ false.
+
+ <a href=#refsWEBSOCKET>[WEBSOCKET]</a>
+
+ </li>
+
+ <li><p>If the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state is
+ false, empty the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code>'s
+ <a href=#list-of-active-timeouts>list of active timeouts</a> and its <a href=#list-of-active-intervals>list of active
+ intervals</a>.</li>
+
+ </ol><h5 id=event-definition><span class=secno>6.5.10.1 </span>Event definition</h5>
+
+ </div>
+
+ <pre class=idl>interface <dfn id=beforeunloadevent>BeforeUnloadEvent</dfn> : <a href=#event>Event</a> {
+ attribute DOMString <a href=#dom-beforeunloadevent-returnvalue title=dom-BeforeUnloadEvent-returnValue>returnValue</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">event</var> . <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current return value of the event (the message to show the user).</p>
+
+ <p>Can be set, to update the message.</p>
+
+ </dd>
+
+ </dl><p class=note>There are no <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>-specific
+ initialization methods.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-beforeunloadevent-returnvalue title=dom-BeforeUnloadEvent-returnValue><code>returnValue</code></dfn>
+ attribute represents the message to show the user. When the event is
+ created, the attribute must be set to the empty string. On getting,
+ it must return the last value it was set to. On setting, the
+ attribute must be set to the new value.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=aborting-a-document-load><span class=secno>6.5.11 </span>Aborting a document load</h4>
+
+ <p>If the user cancels any instance of the <a href=#fetch title=fetch>fetching algorithm</a> in the context of a
+ <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a>, then, if
+ that <code><a href=#document>Document</a></code> is an <a href=#active-document>active document</a>, the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-abort>abort</code> at that
+ <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</p>
+
+ <!-- I'd love to make this more precise, anyone have any suggestions
+ on what it should say? -->
+
+ </div>
+
+
+ <h3 id=offline><span class=secno>6.6 </span>Offline Web applications</h3>
+
+ <!-- v2 ideas for appcache:
+
+ * A way to limit what gets download when the user agent is
+ updating the application cache and it turns out the server has
+ changed EVERY page because every page has a dynamic "site last
+ modified" date on it.
+
+ http://groups.google.com/group/gears-users/browse_thread/thread/efbd808325df607a/c73adb34f9b63cf7?hl=en&q=whatwg#c73adb34f9b63cf7
+
+
+ * Multiuser appcaches.
+
+ If the application code (HTML, JS, CSS) is all the same for two
+ users, then appcache works for multiple users by just having
+ the data for the users separate from the logic.
+
+ This is the expected model for most apps. For example, your
+ typical blog has just one set of CSS for all users.
+
+ For systems where the user affects what HTML, JS, and CSS is
+ served back, the spec as written pretty much requires that
+ there be one app per user, and one generic "login" app that
+ then redirects to one of those other apps - and where each app
+ has a different base URL, separate manifest, etc.
+
+ An alternative that we could explore in a future version is to
+ have the manifest include a manifest name, and then have script
+ that allows you to "activate" a particular manifest name for a
+ given appcache.
+
+ So each appcache group would be futher subdivided into named
+ subgroups, and for a given manifest URL with such a group of
+ subgroups, one subgroup would be the default one at a time. The
+ inactive ones would just lie dormant, but and the active ones
+ would act like now, but there'd be a scripted way to change the
+ default (and maybe query what available variants exist for the
+ current appcache), so that you could log back in as someone
+ else by just making the script pick the other user's variant,
+ and then reloading.
+
+ -->
+
+ <h4 id=introduction-3><span class=secno>6.6.1 </span>Introduction</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>In order to enable users to continue interacting with Web
+ applications and documents even when their network connection is
+ unavailable &mdash; for instance, because they are traveling outside
+ of their ISP's coverage area &mdash; authors can provide a manifest
+ which lists the files that are needed for the Web application to
+ work offline and which causes the user's browser to keep a copy of
+ the files for use offline.</p>
+
+ <p>To illustrate this, consider a simple clock applet consisting of
+ an HTML page "<code title="">clock.html</code>", a CSS style sheet
+ "<code title="">clock.css</code>", and a JavaScript script "<code title="">clock.js</code>".</p>
+
+ <p>Before adding the manifest, these three files might look like
+ this:</p>
+
+ <pre>&lt;!-- clock.html --&gt;
+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Clock&lt;/title&gt;
+ &lt;script src="clock.js"&gt;&lt;/script&gt;
+ &lt;link rel="stylesheet" href="clock.css"&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;p&gt;The time is: &lt;output id="clock"&gt;&lt;/output&gt;&lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+ <pre>/* clock.css */
+output { font: 2em sans-serif; }</pre>
+ <pre>/* clock.js */
+setTimeout(function () {
+ document.getElementById('clock').value = new Date();
+}, 1000);</pre>
+
+ <p>If the user tries to open the "<code title="">clock.html</code>"
+ page while offline, though, the user agent (unless it happens to
+ have it still in the local cache) will fail with an error.</p>
+
+ <p>The author can instead provide a manifest of the three files:</p>
+
+ <pre>CACHE MANIFEST
+clock.html
+clock.css
+clock.js</pre>
+
+ <p>With a small change to the HTML file, the manifest (served as
+ <code><a href=#text/cache-manifest>text/cache-manifest</a></code>) is linked to the application:</p>
+
+ <pre>&lt;!-- clock.html --&gt;
+&lt;!DOCTYPE HTML&gt;
+&lt;html manifest="clock.manifest"&gt;
+ &lt;head&gt;
+ &lt;title&gt;Clock&lt;/title&gt;
+ &lt;script src="clock.js"&gt;&lt;/script&gt;
+ &lt;link rel="stylesheet" href="clock.css"&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;p&gt;The time is: &lt;output id="clock"&gt;&lt;/output&gt;&lt;/p&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</pre>
+
+ <p>Now, if the user goes to the page, the browser will cache the
+ files and make them available even when the user is offline.</p>
+
+ <p class=note>Authors are encouraged to include the main page in
+ the manifest also, but in practice the page that referenced the
+ manifest is automatically cached even if it isn't explicitly
+ mentioned.</p>
+
+ <p class=note>HTTP cache headers and restrictions on caching pages
+ served over TLS (encrypted, using <code title="">https:</code>) are
+ overridden by manifests. Thus, pages will not expire from an
+ application cache before the user agent has updated it, and even
+ applications served over TLS can be made to work offline.</p>
+
+<!--(doesn't currently function)
+ <p><a href="http://www.whatwg.org/demos/offline/clock/clock2.html">View this example online</a>.</p>
+-->
+
+ <h5 id=appcacheevents><span class=secno>6.6.1.1 </span>Event summary</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>When the user visits a page that declares a manifest, the browser
+ will try to update the cache. It does this by fetching a copy of the
+ manifest and, if the manifest has changed since the user agent last
+ saw it, redownloading all the resources it mentions and caching them
+ anew.</p>
+
+ <p>As this is going on, a number of events get fired on the
+ <code><a href=#applicationcache>ApplicationCache</a></code> object to keep the script updated as
+ to the state of the cache update, so that the user can be notified
+ appropriately. The events are as follows:</p>
+
+ <table><thead><tr><th> Event name
+ <th> Interface
+ <th> Dispatched when...
+ <th> Next events
+ <tbody><tr><td> <dfn id=event-appcache-checking title=event-appcache-checking><code>checking</code></dfn>
+ <td> <code><a href=#event>Event</a></code>
+ <td> The user agent is checking for an update, or attempting to download the manifest for the first time. <strong>This is always the first event in the sequence.</strong>
+ <td> <code title=event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code>, <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code>, <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>, <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>
+ <tr><td> <dfn id=event-appcache-noupdate title=event-appcache-noupdate><code>noupdate</code></dfn>
+ <td> <code><a href=#event>Event</a></code>
+ <td> The manifest hadn't changed.
+ <td> Last event in sequence.
+ <tr><td> <dfn id=event-appcache-downloading title=event-appcache-downloading><code>downloading</code></dfn>
+ <td> <code><a href=#event>Event</a></code>
+ <td> The user agent has found an update and is fetching it, or is downloading the resources listed by the manifest for the first time.
+ <td> <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>, <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code>, <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code>
+ <tr><td> <dfn id=event-appcache-progress title=event-appcache-progress><code>progress</code></dfn>
+ <td> <code>ProgressEvent</code>
+ <td> The user agent is downloading resources listed by the manifest.
+ <td> <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>, <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code>, <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code>
+ <tr><td> <dfn id=event-appcache-cached title=event-appcache-cached><code>cached</code></dfn>
+ <td> <code><a href=#event>Event</a></code>
+ <td> The resources listed in the manifest have been downloaded, and the application is now cached.
+ <td> Last event in sequence.
+ <tr><td> <dfn id=event-appcache-updateready title=event-appcache-updateready><code>updateready</code></dfn>
+ <td> <code><a href=#event>Event</a></code>
+ <td> The resources listed in the manifest have been newly redownloaded, and the script can use <code title=dom-appcache-swapCache><a href=#dom-appcache-swapcache>swapCache()</a></code> to switch to the new cache.
+ <td> Last event in sequence.
+ <tr><td> <dfn id=event-appcache-obsolete title=event-appcache-obsolete><code>obsolete</code></dfn>
+ <td> <code><a href=#event>Event</a></code>
+ <td> The manifest was found to have become a 404 or 410 page, so the application cache is being deleted.
+ <td> Last event in sequence.
+ <tr><td rowspan=4> <dfn id=event-appcache-error title=event-appcache-error><code>error</code></dfn>
+ <td rowspan=4> <code><a href=#event>Event</a></code>
+ <td> The manifest was a 404 or 410 page, so the attempt to cache the application has been aborted.
+ <td rowspan=3> Last event in sequence.
+ <tr><td> The manifest hadn't changed, but the page referencing the manifest failed to download properly.
+ <tr><td> A fatal error occurred while fetching the resources listed in the manifest.
+ <tr><td> The manifest changed while the update was being run.
+ <td> The user agent will try fetching the files again momentarily.
+ </table><div class=impl>
+
+ <h4 id=appcache><span class=secno>6.6.2 </span>Application caches</h4>
+
+ <p>An <dfn id=application-cache>application cache</dfn> is a set of cached resources
+ consisting of:</p>
+
+ <ul><li>
+
+ <p>One or more resources (including their out-of-band metadata,
+ such as HTTP headers, if any), identified by URLs, each falling
+ into one (or more) of the following categories:</p>
+
+ <dl><dt><dfn id=concept-appcache-master title=concept-appcache-master>Master entries</dfn>
+
+ <dd>Documents that were added to the cache because a
+ <a href=#browsing-context>browsing context</a> was <a href=#navigate title=navigate>navigated</a> to that document and the
+ document indicated that this was its cache, using the <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute.
+
+
+ <dt><dfn id=concept-appcache-manifest title=concept-appcache-manifest>The manifest</dfn>
+
+ <dd>The resource corresponding to the URL that was given in a
+ master entry's <code><a href=#the-html-element-0>html</a></code> element's <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute. The
+ manifest is fetched and processed during the <a href=#application-cache-download-process>application
+ cache download process</a>. All the <a href=#concept-appcache-master title=concept-appcache-master>master entries</a> have
+ the <a href=#same-origin title="same origin">same origin</a> as the manifest.
+
+
+ <dt><dfn id=concept-appcache-explicit title=concept-appcache-explicit>Explicit entries</dfn>
+
+ <dd>Resources that were listed in the cache's <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> in an <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit
+ section</a>. Explicit entries can also be marked as <dfn id=concept-appcache-foreign title=concept-appcache-foreign>foreign</dfn>, which means that
+ they have a <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code>
+ attribute but that it doesn't point at this cache's <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>.
+
+
+ <dt><dfn id=concept-appcache-fallback title=concept-appcache-fallback>Fallback entries</dfn>
+
+ <dd>Resources that were listed in the cache's <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> in a <a href=#concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback
+ section</a>.
+
+
+ </dl><p class=note>A URL in the list can be flagged with multiple
+ different types, and thus an entry can end up being categorized as
+ multiple entries. For example, an entry can be a manifest entry
+ and an explicit entry at the same time, if the manifest is listed
+ within the manifest.</p>
+
+ </li>
+
+ <li>Zero or more <dfn id=concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
+ namespaces</dfn>: URLs, used as <a href=#concept-appcache-matches-fallback title=concept-appcache-matches-fallback>prefix match
+ patterns</a>, each of which is mapped to a <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entry</a>. Each
+ namespace URL has the <a href=#same-origin>same origin</a> as <a href=#concept-appcache-manifest title=concept-appcache-manifest>the manifest</a>.</li>
+
+ <li>Zero or more URLs that form the <dfn id=concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist
+ namespaces</dfn>.
+
+ <li>An <dfn id=concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
+ wildcard flag</dfn>, which is either <i title="">open</i> or <i title="">blocking</i>.</li>
+
+ </ul><p>Each <a href=#application-cache>application cache</a> has a <dfn id=concept-appcache-completeness title=concept-appcache-completeness>completeness flag</dfn>, which is
+ either <i>complete</i> or <i>incomplete</i>.</p>
+
+ <hr><p>An <dfn id=application-cache-group>application cache group</dfn> is a group of <a href=#application-cache title="application cache">application caches</a>, identified by
+ the <a href=#absolute-url>absolute URL</a> of a resource <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> which is used to
+ populate the caches in the group.</p>
+
+ <p>An <a href=#application-cache>application cache</a> is <dfn id=concept-appcache-newer title=concept-appcache-newer>newer</dfn> than another if it was
+ created after the other (in other words, <a href=#application-cache title="application
+ cache">application caches</a> in an <a href=#application-cache-group>application cache
+ group</a> have a chronological order).</p>
+
+ <p>Only the newest <a href=#application-cache>application cache</a> in an
+ <a href=#application-cache-group>application cache group</a> can have its <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> set to
+ <i>incomplete</i>; the others are always all <i>complete</i>.</p>
+
+ <p>Each <a href=#application-cache-group>application cache group</a> has an <dfn id=concept-appcache-status title=concept-appcache-status>update status</dfn>, which is one of
+ the following: <i>idle</i>, <i>checking</i>, <i>downloading</i>.</p>
+
+ <p>A <dfn id=relevant-application-cache>relevant application cache</dfn> is an <a href=#application-cache>application
+ cache</a> that is the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> in its <a href=#application-cache-group title="application cache group">group</a> to be
+ <i>complete</i>.</p>
+
+ <p>Each <a href=#application-cache-group>application cache group</a> has a <dfn id=concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</dfn>. Each entry in this list consists of a resource and a
+ corresponding <code><a href=#document>Document</a></code> object. It is used during the
+ <a href=#application-cache-download-process>application cache download process</a> to ensure that new
+ master entries are cached even if the <a href=#application-cache-download-process>application cache
+ download process</a> was already running for their
+ <a href=#application-cache-group>application cache group</a> when they were loaded.</p>
+
+ <p>An <a href=#application-cache-group>application cache group</a> can be marked as <dfn id=concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</dfn>, meaning that it
+ must be ignored when looking at what <a href=#application-cache-group title="application cache
+ group">application cache groups</a> exist.</p>
+
+ <hr><p>A <dfn id=cache-host>cache host</dfn> is a <code><a href=#document>Document</a></code> or a
+ <code>SharedWorkerGlobalScope</code> object. A <a href=#cache-host>cache
+ host</a> can be associated with an <a href=#application-cache>application
+ cache</a>.
+
+ <a href=#refsWEBWORKERS>[WEBWORKERS]</a>
+
+ </p>
+
+ <p>A <code><a href=#document>Document</a></code> initially is not associated with an
+ <a href=#application-cache>application cache</a>, but can become associated with one
+ early during the page load process, when steps <a href=#parser-appcache>in the parser</a> and in the <a href=#navigate title=navigate>navigation</a> sections cause <a href=#concept-appcache-init title=concept-appcache-init>cache selection</a> to occur.</p>
+
+ <p>A <code>SharedWorkerGlobalScope</code> can be associated with an
+ <a href=#application-cache>application cache</a> when it is created.
+
+ <a href=#refsWEBWORKERS>[WEBWORKERS]</a>
+
+ </p>
+
+ <p>Each <a href=#cache-host>cache host</a> has an associated
+ <code><a href=#applicationcache>ApplicationCache</a></code> object.</p>
+
+ <hr><p>Multiple <a href=#application-cache title="application cache">application
+ caches</a> in different <a href=#application-cache-group title="application cache
+ group">application cache groups</a> can contain the same
+ resource, e.g. if the manifests all reference that resource. If the
+ user agent is to <dfn id=concept-appcache-selection title=concept-appcache-selection>select an
+ application cache</dfn> from a list of <a href=#relevant-application-cache title="relevant
+ application cache">relevant application caches</a> that contain a
+ resource, the user agent must use the application cache that the
+ user most likely wants to see the resource from, taking into account
+ the following:</p>
+
+ <ul><li>which application cache was most recently updated,
+
+ <li>which application cache was being used to display the
+ resource from which the user decided to look at the new resource,
+ and
+
+ <li>which application cache the user prefers.
+
+ </ul><hr><p>A URL <dfn id=concept-appcache-matches-fallback title=concept-appcache-matches-fallback>matches a
+ fallback namespace</dfn> if there exists a <a href=#relevant-application-cache>relevant
+ application cache</a> whose <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>'s URL has the
+ <a href=#same-origin>same origin</a> as the URL in question, and that has a
+ <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>
+ that is a <a href=#prefix-match>prefix match</a> for the URL being examined. If
+ multiple fallback namespaces match the same URL, the longest one is
+ the one that matches. A URL looking for a fallback namespace can
+ match more than one application cache at a time, but only matches
+ one namespace in each cache.</p>
+
+ <div class=example>
+
+ <p>If a manifest <code title="">http://example.com/app1/manifest</code> declares that
+ <code title="">http://example.com/resources/images</code> is a
+ fallback namespace, and the user navigates to <code title="">HTTP://EXAMPLE.COM:80/resources/images/cat.png</code>,
+ then the user agent will decide that the application cache
+ identified by <code title="">http://example.com/app1/manifest</code> contains a
+ namespace with a match for that URL.</p>
+
+ <!-- "resolve a url" canonicalises the case for the scheme and host
+ and removes the port if it is the default -->
+
+ </div>
+
+ </div>
+
+
+
+ <h4 id=manifests><span class=secno>6.6.3 </span>The cache manifest syntax</h4>
+
+
+ <h5 id=a-sample-manifest><span class=secno>6.6.3.1 </span>A sample manifest</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>This example manifest requires two images and a style sheet to be
+ cached and whitelists a CGI script.</p>
+
+ <pre>CACHE MANIFEST
+# the above line is required
+
+# this is a comment
+# there can be as many of these anywhere in the file
+# they are all ignored
+ # comments can have spaces before them
+ # but must be alone on the line
+
+# blank lines are ignored too
+
+# these are files that need to be cached they can either be listed
+# first, or a "CACHE:" header could be put before them, as is done
+# lower down.
+images/sound-icon.png
+images/background.png
+# note that each file has to be put on its own line
+
+# here is a file for the online whitelist -- it isn't cached, and
+# references to this file will bypass the cache, always hitting the
+# network (or trying to, if the user is offline).
+NETWORK:
+comm.cgi
+
+# here is another set of files to cache, this time just the CSS file.
+CACHE:
+style/default.css</pre>
+
+ <p>It could equally well be written as follows:</p>
+
+ <pre>CACHE MANIFEST
+NETWORK:
+comm.cgi
+CACHE:
+style/default.css
+images/sound-icon.png
+images/background.png</pre>
+
+ <hr><p>The following manifest defines a catch-all error page that is
+ displayed for any page on the site while the user is offline. It
+ also specifies that the <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
+ wildcard flag</a> is <i title="">open</i>, meaning that accesses
+ to resources on other sites will not be blocked. (Resources on the
+ same site are already not blocked because of the catch-all fallback
+ namespace.)</p>
+
+ <p>So long as all pages on the site reference this manifest, they
+ will get cached locally as they are fetched, so that subsequent hits
+ to the same page will load the page immediately from the
+ cache. Until the manifest is changed, those pages will not be
+ fetched from the server again. When the manifest changes, then all
+ the files will be redownloaded.</p>
+
+ <p>Subresources, such as style sheets, images, etc, would only be
+ cached using the regular HTTP caching semantics, however.</p>
+
+ <pre>CACHE MANIFEST
+FALLBACK:
+/ /offline.html
+NETWORK:
+*</pre>
+
+
+ <h5 id=writing-cache-manifests><span class=secno>6.6.3.2 </span>Writing cache manifests</h5>
+
+ <p>Manifests must be served using the
+ <code><a href=#text/cache-manifest>text/cache-manifest</a></code> <a href=#mime-type>MIME type</a>. All
+ resources served using the <code><a href=#text/cache-manifest>text/cache-manifest</a></code>
+ <a href=#mime-type>MIME type</a> must follow the syntax of application cache
+ manifests, as described in this section.</p>
+
+ <p>An application cache manifest is a text file, whose text is
+ encoded using UTF-8. Data in application cache manifests is
+ line-based. Newlines must be represented by U+000A LINE FEED (LF)
+ characters, U+000D CARRIAGE RETURN (CR) characters, or U+000D
+ CARRIAGE RETURN (CR) U+000A LINE FEED (LF) pairs.</p>
+
+ <p class=note>This is a <a href=#willful-violation>willful violation</a> of two
+ aspects of RFC 2046, which requires all <code title="">text/*</code>
+ types to support an open-ended set of character encodings and only
+ allows CRLF line breaks. These requirements, however, are outdated;
+ UTF-8 is now widely used, such that supporting other encodings is no
+ longer necessary, and use of CR, LF, and CRLF line breaks is
+ commonly supported and indeed sometimes CRLF is <em>not</em>
+ supported by text editors. <a href=#refsRFC2046>[RFC2046]</a></p>
+ <!-- also RFC 2045 for charset -->
+
+ <p>The first line of an application cache manifest must consist of
+ the string "CACHE", a single U+0020 SPACE character, the string
+ "MANIFEST", and either a U+0020 SPACE character, a U+0009 CHARACTER
+ TABULATION (tab) character, a U+000A LINE FEED (LF) character, or a
+ U+000D CARRIAGE RETURN (CR) character. The first line may optionally
+ be preceded by a U+FEFF BYTE ORDER MARK (BOM) character. If any
+ other text is found on the first line, it is ignored.</p>
+
+ <p>Subsequent lines, if any, must all be one of the following:</p>
+
+ <dl><dt>A blank line
+ <dd>
+ <p>Blank lines must consist of zero or more U+0020 SPACE and
+ U+0009 CHARACTER TABULATION (tab) characters only.</p>
+
+ <dt>A comment
+ <dd>
+ <p>Comment lines must consist of zero or more U+0020 SPACE and
+ U+0009 CHARACTER TABULATION (tab) characters, followed by a single
+ U+0023 NUMBER SIGN character (#), followed by zero or more
+ characters other than U+000A LINE FEED (LF) and U+000D CARRIAGE
+ RETURN (CR) characters.</p>
+
+ <p class=note>Comments must be on a line on their own. If they
+ were to be included on a line with a URL, the "#" would be
+ mistaken for part of a fragment identifier.</p>
+
+ <dt>A section header
+ <dd>
+ <p>Section headers change the current section. There are three
+ possible section headers:
+
+ <dl><dt><code>CACHE:</code>
+ <dd>Switches to the <dfn id=concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit section</dfn>.
+
+ <dt><code>FALLBACK:</code>
+ <dd>Switches to the <dfn id=concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback section</dfn>.
+
+ <dt><code>NETWORK:</code>
+ <dd>Switches to the <dfn id=concept-appcache-manifest-network title=concept-appcache-manifest-network>online whitelist section</dfn>.
+
+ </dl><p>Section header lines must consist of zero or more U+0020 SPACE
+ and U+0009 CHARACTER TABULATION (tab) characters, followed by one
+ of the names above (including the U+003A COLON character (:))
+ followed by zero or more U+0020 SPACE and U+0009 CHARACTER
+ TABULATION (tab) characters.</p>
+
+ <p>Ironically, by default, the current section is the
+ <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit section</a>.</p>
+
+ <dt>Data for the current section
+ <dd>
+ <p>The format that data lines must take depends on the current
+ section.</p>
+
+ <p>When the current section is the <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit
+ section</a>, data lines must consist of zero or more U+0020
+ SPACE and U+0009 CHARACTER TABULATION (tab) characters, a
+ <a href=#valid-url>valid URL</a> identifying a resource other than the
+ manifest itself, and then zero or more U+0020 SPACE and U+0009
+ CHARACTER TABULATION (tab) characters.</p>
+
+ <p>When the current section is the <a href=#concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback
+ section</a>, data lines must consist of zero or more U+0020
+ SPACE and U+0009 CHARACTER TABULATION (tab) characters, a
+ <a href=#valid-url>valid URL</a> identifying a resource other than the
+ manifest itself, one or more U+0020 SPACE and U+0009 CHARACTER
+ TABULATION (tab) characters, another <a href=#valid-url>valid URL</a>
+ identifying a resource other than the manifest itself, and then
+ zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
+ characters.</p>
+
+ <p>When the current section is the <a href=#concept-appcache-manifest-network title=concept-appcache-manifest-network>online whitelist
+ section</a>, data lines must consist of zero or more U+0020
+ SPACE and U+0009 CHARACTER TABULATION (tab) characters, either a
+ single U+002A ASTERISK character (*) <!--
+ concept-appcache-onlinewhitelist-wildcard --> or a <a href=#valid-url>valid
+ URL</a> identifying a resource other than the manifest itself,
+ and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION
+ (tab) characters.</p>
+
+<!--
+ <p class="note">The URLs in data lines can't be empty strings,
+ since those would be relative URLs to the manifest itself. Such
+ lines would be confused with blank or invalid lines, anyway.</p>
+-->
+
+ </dl><p>Manifests may contain sections more than once. Sections may be
+ empty.</p>
+
+ <p>If the manifest's <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a>
+ is <code title="">https:</code> or another scheme intended for
+ encrypted data transfer, then all URLs in <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit sections</a>
+ must have the <a href=#same-origin>same origin</a> as the manifest itself.</p>
+
+ <p>URLs that are to be fallback pages associated with <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespaces</a>, and
+ those namespaces themselves, must be given in <a href=#concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback sections</a>,
+ with the namespace being the first URL of the data line, and the
+ corresponding fallback page being the second URL. All the other
+ pages to be cached must be listed in <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit
+ sections</a>.</p>
+
+ <p><a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>Fallback
+ namespaces</a> and <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a> must have
+ the <a href=#same-origin>same origin</a> as the manifest itself.</p>
+
+ <p>A <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
+ namespace</a> must not be listed more than once.</p>
+
+ <p>Namespaces that the user agent is to put into the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a>
+ must all be specified in <a href=#concept-appcache-manifest-network title=concept-appcache-manifest-network>online whitelist
+ sections</a>. (This is needed for any URL that the page is
+ intending to use to communicate back to the server.) To specify that
+ all URLs are automatically whitelisted in this way, a U+002A
+ ASTERISK character character (*) may be specified as one of the
+ URLs. <!-- concept-appcache-onlinewhitelist-wildcard --></p>
+
+ <p>Authors should not include namespaces in the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> for
+ which another namespace in the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> is
+ a <a href=#prefix-match>prefix match</a>.</p>
+
+ <p>Relative URLs must be given relative to the manifest's own
+ URL. All URLs in the manifest must have the same <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> as the manifest itself
+ (either explicitly or implicitly, through the use of relative
+ URLs).</p>
+
+ <p>URLs in manifests must not have fragment identifiers (i.e. the
+ U+0023 NUMBER SIGN character isn't allowed in URLs in
+ manifests).</p>
+
+ <p><a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>Fallback
+ namespaces</a> and namespaces in the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> are
+ matched by <a href=#prefix-match>prefix match</a>.</p>
+
+
+ <div class=impl>
+
+ <h5 id=parsing-cache-manifests><span class=secno>6.6.3.3 </span>Parsing cache manifests</h5>
+
+ <p>When a user agent is to <dfn id=parse-a-manifest>parse a manifest</dfn>, it means
+ that the user agent must run the following steps:</p>
+
+ <ol><li><p>The user agent must decode the byte stream corresponding with
+ the manifest to be parsed, treating it as UTF-8. Bytes or sequences
+ of bytes that are not valid UTF-8 sequences must be interpreted as
+ a U+FFFD REPLACEMENT CHARACTER. <!--All U+0000 NULL characters must
+ be replaced by U+FFFD REPLACEMENT CHARACTERs. (this isn't black-box
+ testable since neither U+0000 nor U+FFFD are valid anywhere in the
+ syntax and thus both will be treated the same anyway)--></li>
+
+ <li><p>Let <var title="">base URL</var> be the <a href=#absolute-url>absolute
+ URL</a> representing the manifest.</li>
+
+ <li><p>Let <var title="">explicit URLs</var> be an initially empty
+ list of <a href=#absolute-url title="absolute URL">absolute URLs</a> for <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit entries</a>.</li>
+
+ <li><p>Let <var title="">fallback URLs</var> be an initially empty
+ mapping of <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
+ namespaces</a> to <a href=#absolute-url title="absolute URL">absolute
+ URLs</a> for <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
+ entries</a>.</li>
+
+ <li><p>Let <var title="">online whitelist namespaces</var> be an
+ initially empty list of <a href=#absolute-url title="absolute URL">absolute
+ URLs</a> for an <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online
+ whitelist</a>.</li>
+
+ <li><p>Let <var title="">online whitelist wildcard flag</var> be <i title="">blocking</i>. <!--
+ concept-appcache-onlinewhitelist-wildcard --></li>
+
+ <li><p>Let <var title="">input</var> be the decoded text of the
+ manifest's byte stream.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the first
+ character.</li>
+
+ <li><p>If <var title="">position</var> is pointing at a U+FEFF BYTE
+ ORDER MARK (BOM) character, then advance <var title="">position</var> to the next character.</li>
+
+ <li><p>If the characters starting from <var title="">position</var>
+ are "CACHE", followed by a U+0020 SPACE character, followed by
+ "MANIFEST", then advance <var title="">position</var> to the next
+ character after those. Otherwise, this isn't a cache manifest;
+ abort this algorithm with a failure while checking for the magic
+ signature.</li>
+
+ <li><p>If the character at <var title="">position</var> is neither
+ a U+0020 SPACE character, a U+0009 CHARACTER TABULATION (tab)
+ character, U+000A LINE FEED (LF) character, nor a U+000D CARRIAGE
+ RETURN (CR) character, then this isn't a cache manifest; abort this
+ algorithm with a failure while checking for the magic
+ signature.</li>
+
+ <li><p>This is a cache manifest. The algorithm cannot fail beyond
+ this point (though bogus lines can get ignored).</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
+ <em>not</em> U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR)
+ characters, and ignore those characters. (Extra text on the first
+ line, after the signature, is ignored.)</li>
+
+ <li><p>Let <var title="">mode</var> be "explicit".</li>
+
+ <li><p><i>Start of line</i>: If <var title="">position</var> is
+ past the end of <var title="">input</var>, then jump to the last
+ step. Otherwise, <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> that
+ are U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), U+0020
+ SPACE, or U+0009 CHARACTER TABULATION (tab) characters.</li>
+ <!-- strips leading spaces, ignores space-only lines, ignores blank lines -->
+
+ <li><p>Now, <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> that are
+ <em>not</em> U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR)
+ characters, and let the result be <var title="">line</var>.</li>
+
+ <li><p>Drop any trailing U+0020 SPACE and U+0009 CHARACTER
+ TABULATION (tab) characters at the end of <var title="">line</var>.</li>
+
+ <li><p>If <var title="">line</var> is the empty string, then jump
+ back to the step labeled "start of line".</li>
+
+ <li><p>If the first character in <var title="">line</var> is a
+ U+0023 NUMBER SIGN character (#), then jump back to the step
+ labeled "start of line".</li>
+
+ <li><p>If <var title="">line</var> equals "CACHE:" (the word
+ "CACHE" followed by a U+003A COLON character (:)), then set <var title="">mode</var> to "explicit" and jump back to the step
+ labeled "start of line".</li>
+
+ <li><p>If <var title="">line</var> equals "FALLBACK:" (the word
+ "FALLBACK" followed by a U+003A COLON character (:)), then set <var title="">mode</var> to "fallback" and jump back to the step
+ labeled "start of line".</li>
+
+ <li><p>If <var title="">line</var> equals "NETWORK:" (the word
+ "NETWORK" followed by a U+003A COLON character (:)), then set <var title="">mode</var> to "online whitelist" and jump back to the step
+ labeled "start of line".</li>
+
+ <li><p>If <var title="">line</var> ends with a U+003A COLON
+ character (:), then set <var title="">mode</var> to "unknown" and
+ jump back to the step labeled "start of line".</li>
+
+ <li><p>This is either a data line or it is syntactically
+ incorrect.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">line</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p>Let <var title="">tokens</var> be a list of strings,
+ initially empty.</li>
+
+ <li>
+
+ <p>While <var title="">position</var> doesn't point past the end
+ of <var title="">line</var>:</p>
+
+ <ol><li><p>Let <var title="">current token</var> be an empty
+ string.</li>
+
+ <li><p>While <var title="">position</var> doesn't point past the
+ end of <var title="">line</var> and the character at <var title="">position</var> is neither a U+0020 SPACE nor a U+0009
+ CHARACTER TABULATION (tab) character, add the character at <var title="">position</var> to <var title="">current token</var> and
+ advance <var title="">position</var> to the next character in
+ <var title="">input</var>.</li>
+
+ <li><p>Add <var title="">current token</var> to the <var title="">tokens</var> list.</li>
+
+ <li><p>While <var title="">position</var> doesn't point past the
+ end of <var title="">line</var> and the character at <var title="">position</var> is either a U+0020 SPACE or a U+0009
+ CHARACTER TABULATION (tab) character, advance <var title="">position</var> to the next character in <var title="">input</var>.</li>
+
+ </ol></li>
+
+ <li>
+
+ <p>Process <var title="">tokens</var> as follows:</p>
+
+ <dl class=switch><dt>If <var title="">mode</var> is "explicit"</dt>
+
+ <dd>
+
+ <p><a href=#resolve-a-url title="resolve a url">Resolve</a> the first item in
+ <var title="">tokens</var>, relative to <var title="">base
+ URL</var>; ignore the rest.</p>
+
+ <p>If this fails, then jump back to the step labeled "start of
+ line".</p>
+
+ <p>If the resulting <a href=#absolute-url>absolute URL</a> has a different
+ <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> component than
+ the manifest's URL (compared in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner), then jump back to the step
+ labeled "start of line". If the manifest's <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> is <code title="">https:</code> or another scheme intended for encrypted
+ data transfer, and the resulting <a href=#absolute-url>absolute URL</a> does
+ not have the <a href=#same-origin>same origin</a> as the manifest's URL,
+ then jump back to the step labeled "start of line".</p>
+
+ <p>Drop the <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a>
+ component of the resulting <a href=#absolute-url>absolute URL</a>, if it has
+ one.</p>
+
+ <p>Add the resulting <a href=#absolute-url>absolute URL</a> to the <var title="">explicit URLs</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">mode</var> is "fallback"</dt>
+
+ <dd>
+
+ <p>Let <var title="">part one</var> be the first token in <var title="">tokens</var>, and let <var title="">part two</var> be
+ the second token in <var title="">tokens</var>.</p>
+
+ <p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">part
+ one</var> and <var title="">part two</var>, relative to <var title="">base URL</var>.</p>
+
+ <p>If either fails, then jump back to the step labeled "start of
+ line".</p>
+
+ <p>If the <a href=#absolute-url>absolute URL</a> corresponding to either <var title="">part one</var> or <var title="">part two</var> does not
+ have the <a href=#same-origin>same origin</a> as the manifest's URL, then
+ jump back to the step labeled "start of line".</p> <!-- SECURITY
+ -->
+
+ <p>Drop any the <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> components of the
+ resulting <a href=#absolute-url title="absolute URL">absolute URLs</a>.</p>
+
+ <p>If the <a href=#absolute-url>absolute URL</a> corresponding to <var title="">part one</var> is already in the <var title="">fallback
+ URLs</var> mapping as a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>,
+ then jump back to the step labeled "start of line".</p>
+
+ <p>Otherwise, add the <a href=#absolute-url>absolute URL</a> corresponding to
+ <var title="">part one</var> to the <var title="">fallback
+ URLs</var> mapping as a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>,
+ mapped to the <a href=#absolute-url>absolute URL</a> corresponding to <var title="">part two</var> as the <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entry</a>.</p>
+
+ </dd>
+
+ <dt>If <var title="">mode</var> is "online whitelist"</dt>
+
+ <dd>
+
+ <p>If the first item in <var title="">tokens</var> is a U+002A
+ ASTERISK character (*), then set <var title="">online whitelist
+ wildcard flag</var> to <i title="">open</i> and jump back to the
+ step labeled "start of line".</p>
+
+ <p>Otherwise, <a href=#resolve-a-url title="resolve a url">resolve</a> the
+ first item in <var title="">tokens</var>, relative to <var title="">base URL</var>; ignore the rest.</p>
+
+ <p>If this fails, then jump back to the step labeled "start of
+ line".</p>
+
+ <p>If the resulting <a href=#absolute-url>absolute URL</a> has a different
+ <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> component than
+ the manifest's URL (compared in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner), then jump back to the step
+ labeled "start of line".</p>
+
+ <p>Drop the <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a>
+ component of the resulting <a href=#absolute-url>absolute URL</a>, if it has
+ one.</p>
+
+ <p>Add the resulting <a href=#absolute-url>absolute URL</a> to the <var title="">online whitelist namespaces</var>.</p>
+
+ </dd>
+
+ <dt>If <var title="">mode</var> is "unknown"</dt>
+
+ <dd>
+
+ <p>Do nothing. The line is ignored.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li><p>Jump back to the step labeled "start of line". (That step
+ jumps to the next, and last, step when the end of the file is
+ reached.)</li>
+
+ <li><p>Return the <var title="">explicit URLs</var> list, the <var title="">fallback URLs</var> mapping, the <var title="">online
+ whitelist namespaces</var>, and the <var title="">online whitelist
+ wildcard flag</var>.</li>
+
+ </ol><div class=note>
+
+ <p>If a resource is listed in the <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit section</a>
+ or as a <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
+ entry</a> in the <a href=#concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback section</a>,
+ the resource will always be taken from the cache, regardless of any
+ other matching entries in the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespaces</a> or
+ <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist
+ namespaces</a>.</p>
+
+ <p>When a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
+ namespace</a> and an <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist
+ namespace</a> overlap, the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist
+ namespace</a> has priority.</p>
+
+ <p>The <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
+ wildcard flag</a> is applied last, only for URLs that match
+ neither the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online
+ whitelist namespace</a> nor the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a> and
+ that are not listed in the <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit
+ section</a>.</p>
+
+ </div>
+
+
+ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.6.4 </span>Downloading or updating an application cache</h4>
+
+ <p>When the user agent is required (by other parts of this
+ specification) to start the <dfn id=application-cache-download-process>application cache download
+ process</dfn> for an <a href=#absolute-url>absolute URL</a> purported to identify
+ a <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>, or for an
+ <a href=#application-cache-group>application cache group</a>, potentially given a particular
+ <a href=#cache-host>cache host</a>, and potentially given a <a href=#concept-appcache-master title=concept-appcache-master>master</a> resource, the user
+ agent must run the steps below. These steps are always run
+ asynchronously, in parallel with the <a href=#event-loop>event loop</a> <a href=#concept-task title=concept-task>tasks</a>.</p>
+
+ <p>Some of these steps have requirements that only apply if the user
+ agent <dfn id=shows-caching-progress>shows caching progress</dfn>. Support for this is
+ optional. Caching progress UI could consist of a progress bar or
+ message panel in the user agent's interface, or an overlay, or
+ something else. Certain events fired during the <a href=#application-cache-download-process>application
+ cache download process</a> allow the script to override the display
+ of such an interface. The goal of this is to allow Web applications
+ to provide more seamless update mechanisms, hiding from the user the
+ mechanics of the application cache mechanism. User agents may
+ display user interfaces independent of this, but are encouraged to
+ not show prominent update progress notifications for applications
+ that cancel the relevant events.</p>
+
+ <p class=note>These events are delayed until after the <code title=event-load>load</code> event has fired.</p>
+
+ <p>The <a href=#application-cache-download-process>application cache download process</a> steps are as
+ follows:
+
+ <ol><li><p>Optionally, wait until the permission to start the
+ <a href=#application-cache-download-process>application cache download process</a> has been obtained
+ from the user and until the user agent is confident that the
+ network is available. This could include doing nothing until the
+ user explicitly opts-in to caching the site, or could involve
+ prompting the user for permission. The algorithm might never get
+ past this point. (This step is particularly intended to be used by
+ user agents running on severely space-constrained devices or in
+ highly privacy-sensitive environments).</li>
+
+ <li>
+
+ <p>Atomically, so as to avoid race conditions, perform the
+ following substeps:</p>
+
+ <ol><li>
+
+ <p>Pick the appropriate substeps:</p>
+
+ <dl class=switch><dt>If these steps were invoked with an <a href=#absolute-url>absolute
+ URL</a> purported to identify a <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a></dt>
+
+ <dd>
+
+ <p>Let <var title="">manifest URL</var> be that <a href=#absolute-url>absolute
+ URL</a>.</p>
+
+ <p>If there is no <a href=#application-cache-group>application cache group</a>
+ identified by <var title="">manifest URL</var>, then create a
+ new <a href=#application-cache-group>application cache group</a> identified by <var title="">manifest URL</var>. Initially, it has no <a href=#application-cache title="application cache">application caches</a>. One will
+ be created later in this algorithm.</p>
+
+ </dd>
+
+
+ <dt>If these steps were invoked with an <a href=#application-cache-group>application cache
+ group</a></dt>
+
+ <dd>
+
+ <p>Let <var title="">manifest URL</var> be the <a href=#absolute-url>absolute
+ URL</a> of the <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> used to
+ identify the <a href=#application-cache-group>application cache group</a> to be
+ updated.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li><p>Let <var title="">cache group</var> be the
+ <a href=#application-cache-group>application cache group</a> identified by <var title="">manifest URL</var>.</li>
+
+ <li><p>If these steps were invoked with a <a href=#concept-appcache-master title=concept-appcache-master>master</a> resource, then add
+ the resource, along with the resource's <code><a href=#document>Document</a></code>, to
+ <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>.</li>
+
+ <li><p>If these steps were invoked with a <a href=#cache-host>cache
+ host</a>, and the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache group</var> is <i>checking</i> or
+ <i>downloading</i>, then <a href=#queue-a-post-load-task>queue a post-load task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code> that is
+ cancelable at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of that
+ <a href=#cache-host>cache host</a>. The default action of this event must
+ be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the
+ display of some sort of user interface indicating to the user
+ that the user agent is checking to see if it can download the
+ application.</li>
+
+ <li><p>If these steps were invoked with a <a href=#cache-host>cache
+ host</a>, and the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache group</var> is <i>downloading</i>, then also
+ <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code> that is
+ cancelable at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of that
+ <a href=#cache-host>cache host</a>. The default action of this event must
+ be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the
+ display of some sort of user interface indicating to the user the
+ application is being downloaded.</li>
+
+ <li><p>If the <a href=#concept-appcache-status title=concept-appcache-status>status</a>
+ of the <var title="">cache group</var> is either <i>checking</i>
+ or <i>downloading</i>, then abort this instance of the
+ <a href=#application-cache-download-process>application cache download process</a>, as an update is
+ already in progress.</li>
+
+ <li><p>Set the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache group</var> to <i>checking</i>.</p>
+
+ <li><p>For each <a href=#cache-host>cache host</a> associated with an
+ <a href=#application-cache>application cache</a> in <var title="">cache
+ group</var>, <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> that is cancelable named <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>. The default action of these events must be, if the
+ user agent <a href=#shows-caching-progress>shows caching progress</a>, the display of
+ some sort of user interface indicating to the user that the user
+ agent is checking for the availability of updates.</li>
+
+ </ol><p class=note>The remainder of the steps run asynchronously.</p>
+
+ <p>If <var title="">cache group</var> already has an
+ <a href=#application-cache>application cache</a> in it, then this is an <dfn id=concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</dfn>. Otherwise,
+ this is a <dfn id=concept-appcache-cache title=concept-appcache-cache>cache
+ attempt</dfn>.</p>
+
+ </li>
+
+ <li><p>If this is a <a href=#concept-appcache-cache title=concept-appcache-cache>cache
+ attempt</a>, then this algorithm was invoked with a <a href=#cache-host>cache
+ host</a>; <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code> that is cancelable
+ at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of that <a href=#cache-host>cache
+ host</a>. The default action of this event must be, if the user
+ agent <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort
+ of user interface indicating to the user that the user agent is
+ checking for the availability of updates.</li>
+
+ <li>
+
+ <p><i>Fetching the manifest</i>: <a href=#fetch>Fetch</a> the resource
+ from <var title="">manifest URL</var>, and let <var title="">manifest</var> be that resource.</p> <!-- http-origin
+ privacy sensitive, though it doesn't matter, since this can never
+ be cross-origin -->
+
+ <p>If the resource is labeled with the <a href=#mime-type>MIME type</a>
+ <code><a href=#text/cache-manifest>text/cache-manifest</a></code>, parse <var title="">manifest</var> according to the <a href=#parse-a-manifest title="parse a
+ manifest">rules for parsing manifests</a>, obtaining a list of
+ <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit entries</a>,
+ <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a>
+ and the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
+ namespaces</a> that map to them, entries for the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a>,
+ and a value for the <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
+ wildcard flag</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <i>fetching the manifest</i> fails due to a 404 or 410
+ response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or
+ equivalent</a>, then run these substeps:</p>
+
+ <ol><li><p>Mark <var title="">cache group</var> as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>. This <var title="">cache group</var> no longer exists for any purpose other
+ than the processing of <code><a href=#document>Document</a></code> objects already
+ associated with an <a href=#application-cache>application cache</a> in the <var title="">cache group</var>.</li>
+
+ <li><p>Let <var title="">task list</var> be an empty list of
+ <a href=#concept-task title=concept-task>tasks</a>.</p>
+
+ <li><p>For each <a href=#cache-host>cache host</a> associated with an
+ <a href=#application-cache>application cache</a> in <var title="">cache
+ group</var>, create a <a href=#concept-task title=concept-task>task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code> that is
+ cancelable at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the
+ <a href=#cache-host>cache host</a>, and add it to <var title="">task
+ list</var>. The default action of these events must be, if the
+ user agent <a href=#shows-caching-progress>shows caching progress</a>, the display of
+ some sort of user interface indicating to the user that the
+ application is no longer available for offline use.</li>
+
+ <li><p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>, create a <a href=#concept-task title=concept-task>task</a>
+ to <a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named
+ <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> (not <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>!) at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a> the <code><a href=#document>Document</a></code> for this entry, if there
+ still is one, and add it to <var title="">task list</var>. The
+ default action of this event must be, if the user agent
+ <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
+ user interface indicating to the user that the user agent failed
+ to save the application for offline use.</li>
+
+ <li><p>If <var title="">cache group</var> has an
+ <a href=#application-cache>application cache</a> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
+ <i>incomplete</i>, then discard that <a href=#application-cache>application
+ cache</a>.</p>
+
+ <li><p>If appropriate, remove any user interface indicating that
+ an update for this cache is in progress.</li>
+
+ <li><p>Let the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache group</var> be <i>idle</i>.</li>
+
+ <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load
+ task">queue that task as a post-load task</a>.</li>
+
+ <li><p>Abort the <a href=#application-cache-download-process>application cache download
+ process</a>.</li>
+
+ </ol></li>
+
+ <li>
+
+ <p>Otherwise, if <i>fetching the manifest</i> fails in some other
+ way (e.g. the server returns another 4xx or 5xx response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or
+ there is a DNS error, or the connection times out, or the user
+ cancels the download, or the parser for manifests fails when
+ checking the magic signature), or if the server returned a
+ redirect, or if the resource is labeled with a <a href=#mime-type>MIME
+ type</a> other than <code><a href=#text/cache-manifest>text/cache-manifest</a></code>, then run
+ the <a href=#cache-failure-steps>cache failure steps</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade
+ attempt</a> and the newly downloaded <var title="">manifest</var> is byte-for-byte identical to the manifest
+ found in the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a>
+ <a href=#application-cache>application cache</a> in <var title="">cache group</var>,
+ or the server reported it as "304 Not Modified" <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, then
+ run these substeps:</p>
+
+ <ol><li><p>Let <var title="">cache</var> be the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
+ cache</a> in <var title="">cache group</var>.</li>
+
+ <li><p>Let <var title="">task list</var> be an empty list of
+ <a href=#concept-task title=concept-task>tasks</a>.</p>
+
+ <li>
+
+ <p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>, wait for the resource for this entry to have
+ either completely downloaded or failed.</p>
+
+ <p>If the download failed (e.g. the connection times out, or the
+ user cancels the download), then create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that is cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a> the <code><a href=#document>Document</a></code> for this entry, if there
+ still is one, and add it to <var title="">task list</var>. The
+ default action of this event must be, if the user agent
+ <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
+ user interface indicating to the user that the user agent failed
+ to save the application for offline use.</p>
+
+ <p>Otherwise, associate the <code><a href=#document>Document</a></code> for this entry
+ with <var title="">cache</var>; store the resource for this
+ entry in <var title="">cache</var>, if it isn't already there,
+ and categorize its entry as a <a href=#concept-appcache-master title=concept-appcache-master>master entry</a>. If the
+ resource's <a href=#url>URL</a> has a <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component, it must
+ be removed from the entry in <var title="">cache</var>
+ (application caches never include fragment identifiers).</p>
+
+ <p class=note>HTTP caching rules, such as <code title="">Cache-Control: no-store</code>, are ignored for the
+ purposes of the <a href=#application-cache-download-process>application cache download
+ process</a>.</p>
+
+ </li>
+
+ <li><p>For each <a href=#cache-host>cache host</a> associated with an
+ <a href=#application-cache>application cache</a> in <var title="">cache
+ group</var>, create a <a href=#concept-task title=concept-task>task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named <code title=event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>, and add it to <var title="">task list</var>. The
+ default action of these events must be, if the user agent
+ <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
+ user interface indicating to the user that the application is up
+ to date.</li>
+
+ <li><p>Empty <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>.</li>
+
+ <li><p>If appropriate, remove any user interface indicating that
+ an update for this cache is in progress.</li>
+
+ <li><p>Let the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache group</var> be <i>idle</i>.</li>
+
+ <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load
+ task">queue that task as a post-load task</a>.</li>
+
+ <li><p>Abort the <a href=#application-cache-download-process>application cache download
+ process</a>.</li>
+
+ </ol></li>
+
+ <li><p>Let <var title="">new cache</var> be a newly created
+ <a href=#application-cache>application cache</a> in <var title="">cache
+ group</var>. Set its <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> to
+ <i>incomplete</i>.</li>
+
+ <li><p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>, associate the <code><a href=#document>Document</a></code> for this entry
+ with <var title="">new cache</var>.</li>
+
+ <li><p>Set the <a href=#concept-appcache-status title=concept-appcache-status>status</a>
+ of <var title="">cache group</var> to <i>downloading</i>.</li>
+
+ <li><p>For each <a href=#cache-host>cache host</a> associated with an
+ <a href=#application-cache>application cache</a> in <var title="">cache group</var>,
+ <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that is cancelable named <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>. The default action of these events must be, if the
+ user agent <a href=#shows-caching-progress>shows caching progress</a>, the display of some
+ sort of user interface indicating to the user that a new version is
+ being downloaded.</li>
+
+ <li><p>Let <var title="">file list</var> be an empty list of
+ URLs with flags.</li>
+
+ <li><p>Add all the URLs in the list of <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit entries</a> obtained
+ by parsing <var title="">manifest</var> to <var title="">file
+ list</var>, each flagged with "explicit entry".</li>
+
+ <li><p>Add all the URLs in the list of <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a> obtained
+ by parsing <var title="">manifest</var> to <var title="">file
+ list</var>, each flagged with "fallback entry".</li>
+
+ <li><p>If this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade
+ attempt</a>, then add all the URLs of <a href=#concept-appcache-master title=concept-appcache-master>master entries</a> in the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
+ cache</a> in <var title="">cache group</var> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
+ <i>complete</i> to <var title="">file list</var>, each flagged with
+ "master entry".</li>
+
+ <li><p>If any URL is in <var title="">file list</var> more than
+ once, then merge the entries into one entry for that URL, that
+ entry having all the flags that the original entries had.</li>
+
+ <li>
+
+ <p>For each URL in <var title="">file list</var>, run the
+ following steps. These steps may be run in parallel for two or
+ more of the URLs at a time.</p>
+
+ <ol><li>
+
+ <p>If the resource URL being processed was flagged as neither an
+ "explicit entry" nor or a "fallback entry", then the user agent
+ may skip this URL.</p>
+
+ <p class=note>This is intended to allow user agents to expire
+ resources not listed in the manifest from the cache. Generally,
+ implementors are urged to use an approach that expires
+ lesser-used resources first.</p>
+
+ </li>
+
+ <li><p>For each <a href=#cache-host>cache host</a> associated with an
+ <a href=#application-cache>application cache</a> in <var title="">cache
+ group</var>, <a href=#queue-a-post-load-task>queue a post-load task</a> to fire an event
+ with the name <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, which does not
+ bubble, which is cancelable, and which uses the
+ <code>ProgressEvent</code> interface, at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>. The <code title=dom-ProgressEvents-lengthComputable>lengthComputable</code>
+ attribute must be set to true, the <code title=dom-ProgressEvents-total>total</code> attribute must be
+ set to the number of files in <var title="">file list</var>, and
+ the <code title=dom-ProgressEvents-loaded>loaded</code>
+ attribute must be set to the number of number of files in <var title="">file list</var> that have been either downloaded or
+ skipped so far. The default action of these events must be, if
+ the user agent <a href=#shows-caching-progress>shows caching progress</a>, the display
+ of some sort of user interface indicating to the user that a file
+ is being downloaded in preparation for updating the
+ application. <a href=#refsPROGRESS>[PROGRESS]</a></li>
+
+ <li>
+
+ <p><a href=#fetch>Fetch</a> the resource, from the <a href=#origin>origin</a>
+ of the <a href=#url>URL</a> <var title="">manifest URL</var>. If
+ this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade
+ attempt</a>, then use the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
+ cache</a> in <var title="">cache group</var> as an HTTP
+ cache, and honor HTTP caching semantics (such as expiration,
+ ETags, and so forth) with respect to that cache. User agents may
+ also have other caches in place that are also honored.</p> <!--
+ not http-origin privacy sensitive -->
+
+ <p class=note>If the resource in question is already being
+ downloaded for other reasons then the existing download process
+ can sometimes be used for the purposes of this step, as defined
+ by the <a href=#fetch title=fetch>fetching</a> algorithm.</p>
+
+ <p class=example>An example of a resource that might already
+ be being downloaded is a large image on a Web page that is being
+ seen for the first time. The image would get downloaded to
+ satisfy the <code><a href=#the-img-element>img</a></code> element on the page, as well as
+ being listed in the cache manifest. According to the rules for
+ <a href=#fetch title=fetch>fetching</a> that image only need be
+ downloaded once, and it can be used both for the cache and for
+ the rendered Web page.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the previous step fails (e.g. the server returns a 4xx or
+ 5xx response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or
+ equivalent</a>, or there is a DNS error, or the connection
+ times out, or the user cancels the download), or if the server
+ returned a redirect, then run the first appropriate step from
+ the following list:</p>
+
+ <dl class=switch><dt>If the URL being processed was flagged as an "explicit
+ entry" or a "fallback entry"</dt>
+
+ <dd>
+
+ <p>Run the <a href=#cache-failure-steps>cache failure steps</a>.</p>
+
+ <p class=note>Redirects are fatal because they are either
+ indicative of a network problem (e.g. a captive portal); or
+ would allow resources to be added to the cache under URLs that
+ differ from any URL that the networking model will allow
+ access to, leaving orphan entries; or would allow resources to
+ be stored under URLs different than their true URLs. All of
+ these situations are bad.</p>
+
+ </dd>
+
+ <dt>If the error was a 404 or 410 HTTP response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a></dt>
+
+ <dd>
+
+ <p>Skip this resource. It is dropped from the cache.</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>Copy the resource and its metadata from the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
+ cache</a> in <var title="">cache group</var> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a>
+ is <i>complete</i>, and act as if that was the fetched
+ resource, ignoring the resource obtained from the network.</p>
+
+ </dd>
+
+ </dl><p>User agents may warn the user of these errors as an aid to
+ development.</p>
+
+ <p class=note>These rules make errors for resources listed in
+ the manifest fatal, while making it possible for other resources
+ to be removed from caches when they are removed from the server,
+ without errors, and making non-manifest resources survive
+ server-side errors.</p>
+
+ </li>
+
+ <li><p>Otherwise, the fetching succeeded. Store the resource in
+ the <var title="">new cache</var>.</li>
+
+ <li><p>If the URL being processed was flagged as an "explicit
+ entry" in <var title="">file list</var>, then categorize the
+ entry as an <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit
+ entry</a>.</li>
+
+ <li><p>If the URL being processed was flagged as a "fallback
+ entry" in <var title="">file list</var>, then categorize the
+ entry as a <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
+ entry</a>.</li>
+
+ <li><p>If the URL being processed was flagged as an "master
+ entry" in <var title="">file list</var>, then categorize the
+ entry as a <a href=#concept-appcache-master title=concept-appcache-master>master
+ entry</a>.</li>
+
+ <li><p>As an optimization, if the resource is an HTML or XML file
+ whose root element is an <code><a href=#the-html-element-0>html</a></code> element with a <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute whose value
+ doesn't match the manifest URL of the application cache being
+ processed, then the user agent should mark the entry as being
+ <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>.</p>
+
+ </ol></li>
+
+ <li><p>For each <a href=#cache-host>cache host</a> associated with an
+ <a href=#application-cache>application cache</a> in <var title="">cache group</var>,
+ <a href=#queue-a-post-load-task>queue a post-load task</a> to fire an event with the name
+ <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, which does
+ not bubble, which is cancelable, and which uses the
+ <code>ProgressEvent</code> interface, at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>. The <code title=dom-ProgressEvents-lengthComputable>lengthComputable</code>
+ attribute must be set to true, the <code title=dom-ProgressEvents-total>total</code> and the <code title=dom-ProgressEvents-loaded>loaded</code> attributes must be
+ set to the number of number of files in <var title="">file
+ list</var>. The default action of these events must be, if the user
+ agent <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort
+ of user interface indicating to the user that all the files have
+ been downloaded. <a href=#refsPROGRESS>[PROGRESS]</a></li>
+
+ <li><p>Store the list of <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespaces</a>,
+ and the URLs of the <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a> that they
+ map to, in <var title="">new cache</var>.</li>
+
+ <li><p>Store the URLs that form the new <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> in
+ <var title="">new cache</var>.</li>
+
+ <li><p>Store the value of the new <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
+ wildcard flag</a> in <var title="">new cache</var>.</li>
+
+ <li>
+
+ <p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>, wait for the resource for this entry to have
+ either completely downloaded or failed.</p>
+
+ <p>If the download failed (e.g. the connection times out, or the
+ user cancels the download), then run these substeps:</p>
+
+ <ol><li><p>Unassociate the <code><a href=#document>Document</a></code> for this entry from
+ <var title="">new cache</var>.</li>
+
+ <li><p><a href=#queue-a-post-load-task>Queue a post-load task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that is cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the
+ <code><a href=#document>Document</a></code> for this entry, if there still is one. The
+ default action of this event must be, if the user agent
+ <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
+ user interface indicating to the user that the user agent failed
+ to save the application for offline use.</p>
+
+ <li>
+
+ <p>If this is a <a href=#concept-appcache-cache title=concept-appcache-cache>cache
+ attempt</a> and this entry is the last entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>, then run these further substeps:</p>
+
+ <ol><li><p>Discard <var title="">cache group</var> and its only
+ <a href=#application-cache>application cache</a>, <var title="">new
+ cache</var>.</p>
+
+ <li><p>If appropriate, remove any user interface indicating
+ that an update for this cache is in progress.</li>
+
+ <li><p>Abort the <a href=#application-cache-download-process>application cache download
+ process</a>.</li>
+
+ </ol></li>
+
+ <li><p>Otherwise, remove this entry from <var title="">cache
+ group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list
+ of pending master entries</a>.</li>
+
+ </ol><p>Otherwise, store the resource for this entry in <var title="">new cache</var>, if it isn't already there, and
+ categorize its entry as a <a href=#concept-appcache-master title=concept-appcache-master>master entry</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p><a href=#fetch>Fetch</a> the resource from <var title="">manifest
+ URL</var> again, and let <var title="">second manifest</var> be
+ that resource.</p> <!-- http-origin privacy sensitive, though it
+ doesn't matter, since this can never be cross-origin -->
+
+ </li>
+
+ <li>
+
+ <p>If the previous step failed for any reason, or if the fetching
+ attempt involved a redirect, or if <var title="">second
+ manifest</var> and <var title="">manifest</var> are not
+ byte-for-byte identical, then schedule a rerun of the entire
+ algorithm with the same parameters after a short delay, and run
+ the <a href=#cache-failure-steps>cache failure steps</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise, store <var title="">manifest</var> in <var title="">new cache</var>, if it's not there already, and
+ categorize its entry as <a href=#concept-appcache-manifest title=concept-appcache-manifest>the manifest</a>.</p>
+
+ </li>
+
+ <li><p>Set the <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> of
+ <var title="">new cache</var> to <i>complete</i>.</li>
+
+ <li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>
+
+ <li>
+
+ <p>If this is a <a href=#concept-appcache-cache title=concept-appcache-cache>cache
+ attempt</a>, then for each <a href=#cache-host>cache host</a> associated
+ with an <a href=#application-cache>application cache</a> in <var title="">cache
+ group</var>, create a <a href=#concept-task title=concept-task>task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>, and add it to <var title="">task list</var>. The
+ default action of these events must be, if the user agent
+ <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
+ user interface indicating to the user that the application has
+ been cached and that they can now use it offline.</p>
+
+ <p>Otherwise, it is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a>. For each
+ <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application
+ cache</a> in <var title="">cache group</var>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> that is cancelable named <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>, and add it to <var title="">task list</var>. The
+ default action of these events must be, if the user agent
+ <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
+ user interface indicating to the user that a new version is
+ available and that they can activate it by reloading the page.</p>
+
+ </li>
+
+ <li><p>If appropriate, remove any user interface indicating that
+ an update for this cache is in progress.</li>
+
+ <li><p>Set the <a href=#concept-appcache-status title=concept-appcache-status>update
+ status</a> of <var title="">cache group</var> to
+ <i>idle</i>.</li>
+
+ <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load
+ task">queue that task as a post-oad task</a>.</li>
+
+ </ol><p>The <dfn id=cache-failure-steps>cache failure steps</dfn> are as follows:</p>
+
+ <ol><li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>
+
+ <li>
+
+ <p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>, run the following further substeps. These steps
+ may be run in parallel for two or more entries at a time.</p>
+
+ <ol><li><p>Wait for the resource for this entry to have either
+ completely downloaded or failed.</p>
+
+ <li><p>Unassociate the <code><a href=#document>Document</a></code> for this entry from
+ its <a href=#application-cache>application cache</a>, if it has one.</li>
+
+ <li><p>Create a <a href=#concept-task title=concept-task>task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the
+ <code><a href=#document>Document</a></code> for this entry, if there still is one, and
+ add it to <var title="">task list</var>. The default action of
+ these events must be, if the user agent <a href=#shows-caching-progress>shows caching
+ progress</a>, the display of some sort of user interface
+ indicating to the user that the user agent failed to save the
+ application for offline use.</p>
+
+ </ol></li>
+
+ <li><p>For each <a href=#cache-host>cache host</a> still associated with an
+ <a href=#application-cache>application cache</a> in <var title="">cache group</var>,
+ create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> that is cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at the
+ <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
+ host</a>, and add it to <var title="">task list</var>. The
+ default action of these events must be, if the user agent
+ <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
+ user interface indicating to the user that the user agent failed to
+ save the application for offline use.</li>
+
+ <li><p>Empty <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
+ entries</a>.</li>
+
+ <li><p>If <var title="">cache group</var> has an <a href=#application-cache>application
+ cache</a> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
+ <i>incomplete</i>, then discard that <a href=#application-cache>application
+ cache</a>.</p>
+
+ <li><p>If appropriate, remove any user interface indicating that an
+ update for this cache is in progress.</li>
+
+ <li><p>Let the <a href=#concept-appcache-status title=concept-appcache-status>status</a>
+ of <var title="">cache group</var> be <i>idle</i>.</li>
+
+ <li><p>If this was a <a href=#concept-appcache-cache title=concept-appcache-cache>cache
+ attempt</a>, discard <var title="">cache group</var>
+ altogether.</p>
+
+ <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load
+ task">queue that task as a post-load task</a>.</li>
+
+ <li><p>Abort the <a href=#application-cache-download-process>application cache download
+ process</a>.</li>
+
+ </ol><p>Attempts to <a href=#fetch>fetch</a> resources as part of the
+ <a href=#application-cache-download-process>application cache download process</a> may be done with
+ cache-defeating semantics, to avoid problems with stale or
+ inconsistent intermediary caches.</p>
+
+ <hr><p>User agents may invoke the <a href=#application-cache-download-process>application cache download
+ process</a>, in the background, for any <a href=#application-cache>application
+ cache</a>, at any time (with no <a href=#cache-host>cache host</a>). This
+ allows user agents to keep caches primed and to update caches even
+ before the user visits a site.</p>
+
+ <hr><p>Each <code><a href=#document>Document</a></code> has a list of <dfn id=pending-application-cache-download-process-tasks>pending application
+ cache download process tasks</dfn> that is used to delay events
+ fired by the algorithm above until the document's <code title=event-load>load</code> event has fired. When the
+ <code><a href=#document>Document</a></code> is created, the list must be empty.</p>
+
+ <p>When the steps above say to <dfn id=queue-a-post-load-task>queue a post-load task</dfn>
+ <var title="">task</var>, where <var title="">task</var> is a <a href=#concept-task title=concept-task>task</a> that dispatches an event on a
+ target <code><a href=#applicationcache>ApplicationCache</a></code> object <var title="">target</var>, the user agent must run the appropriate steps
+ from the following list:</p>
+
+ <dl><dt>If <var title="">target</var>'s <code><a href=#document>Document</a></code> has
+ <a href=#completely-loaded>completely loaded</a></dt>
+
+ <dd><p><a href=#queue-a-task title="queue a task">Queue</a> the task <var title="">task</var>.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>Add <var title="">task</var> to <var title="">target</var>'s
+ <code><a href=#document>Document</a></code>'s list of <a href=#pending-application-cache-download-process-tasks>pending application cache
+ download process tasks</a>.</dd>
+
+ </dl><p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#networking-task-source>networking task
+ source</a>.</p>
+
+
+
+
+ <h4 id=the-application-cache-selection-algorithm><span class=secno>6.6.5 </span>The application cache selection algorithm</h4>
+
+ <p>When the <dfn id=concept-appcache-init title=concept-appcache-init>application cache
+ selection algorithm</dfn> algorithm is invoked with a
+ <code><a href=#document>Document</a></code> <var title="">document</var> and optionally a
+ manifest <a href=#url>URL</a> <var title="">manifest URL</var>, the user
+ agent must run the first applicable set of steps from the following
+ list:</p>
+
+ <dl class=switch><dt>If there is a <var title="">manifest URL</var>, and <var title="">document</var> was loaded from an <a href=#application-cache>application
+ cache</a>, and the URL of the <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> of that cache's
+ <a href=#application-cache-group>application cache group</a> is <em>not</em> the same as
+ <var title="">manifest URL</var></dt>
+
+ <dd>
+
+ <p>Mark the entry for the resource from which <var title="">document</var> was taken in the <a href=#application-cache>application
+ cache</a> from which it was loaded as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>.</p>
+
+ <p>Restart the current navigation from the top of the <a href=#navigate title=navigate>navigation algorithm</a>, undoing any changes
+ that were made as part of the initial load (changes can be avoided
+ by ensuring that the step to <a href=#update-the-session-history-with-the-new-page>update the session history with
+ the new page</a> is only ever completed <em>after</em> this
+ <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
+ algorithm</a> is run, though this is not required).</p>
+
+ <p class=note>The navigation will not result in the same
+ resource being loaded, because "foreign" entries are never picked
+ during navigation.</p>
+
+ <p>User agents may notify the user of the inconsistency between
+ the cache manifest and the document's own metadata, to aid in
+ application development.</p>
+
+ </dd>
+
+
+ <dt>If <var title="">document</var> was loaded from an
+ <a href=#application-cache>application cache</a><!--[redundant], and either there is
+ no <var title="">manifest URL</var>, or the URL of the <span
+ title="concept-appcache-manifest">manifest</span> of the cache's
+ <span>application cache group</span> is the same as <var
+ title="">manifest URL</var>--></dt>
+
+ <dd>
+
+ <p>Associate <var title="">document</var> with the
+ <a href=#application-cache>application cache</a> from which it was loaded. Invoke,
+ in the background, the <a href=#application-cache-download-process>application cache download
+ process</a> for that <a href=#application-cache>application cache</a>'s
+ <a href=#application-cache-group>application cache group</a>, with <var title="">document</var> as the <a href=#cache-host>cache host</a>.</p>
+
+ </dd>
+
+
+ <dt>If <var title="">document</var> <!--[redundant] was not loaded
+ from an <span>application cache</span>, but it--> was loaded using
+ HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
+ equivalent</a>, and, there is a <var title="">manifest
+ URL</var>, and <var title="">manifest URL</var> has the <a href=#same-origin>same
+ origin</a> as <var title="">document</var></dt>
+
+ <dd>
+
+ <p>Invoke, in the background, the <a href=#application-cache-download-process>application cache download
+ process</a> for <var title="">manifest URL</var>, with <var title="">document</var> as the <a href=#cache-host>cache host</a> and with
+ the resource from which <var title="">document</var> was parsed as
+ the <a href=#concept-appcache-master title=concept-appcache-master>master</a>
+ resource.</p>
+
+ </dd>
+
+
+ <dt>Otherwise</dt> <!-- not from cache and either no <var
+ title="">manifest URL</var>, or non-GET, or wrong-origin manifest -->
+
+ <dd>
+
+ <p>The <code><a href=#document>Document</a></code> is not associated with any
+ <a href=#application-cache>application cache</a>.</p>
+
+ <p>If there was a <var title="">manifest URL</var>, the user agent
+ may report to the user that it was ignored, to aid in application
+ development.</p>
+
+ </dd>
+
+ </dl><h4 id=changesToNetworkingModel><span class=secno>6.6.6 </span>Changes to the networking model</h4>
+
+ <p>When a <a href=#cache-host>cache host</a> is associated with an
+ <a href=#application-cache>application cache</a> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
+ <i>complete</i>, any and all loads for resources related to that
+ <a href=#cache-host>cache host</a> other than those for <a href=#child-browsing-context title="child
+ browsing context">child browsing contexts</a> must go through the
+ following steps instead of immediately invoking the mechanisms
+ appropriate to that resource's scheme:</p>
+
+ <ol><li><p>If the resource is not to be fetched using the HTTP GET
+ mechanism <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
+ equivalent</a>, or if its <a href=#url>URL</a> has a different <a href=#url-scheme title=url-scheme>&lt;scheme&gt;</a> component than the
+ <a href=#application-cache>application cache</a>'s <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>, then
+ <a href=#fetch>fetch</a> the resource normally and abort these
+ steps.</li>
+
+ <li><p>If the resource's URL is <a href=#concept-appcache-master title=concept-appcache-master>a master entry</a>, <a href=#concept-appcache-manifest title=concept-appcache-manifest>the manifest</a>, <a href=#concept-appcache-explicit title=concept-appcache-explicit>an explicit entry</a>, or
+ <a href=#concept-appcache-fallback title=concept-appcache-fallback>a fallback entry</a> in
+ the <a href=#application-cache>application cache</a>, then get the resource from the
+ cache (instead of fetching it), and abort these steps.</li>
+
+ <li><p>If there is an entry in the <a href=#application-cache>application cache</a>'s
+ <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online
+ whitelist</a> that has the <a href=#same-origin>same origin</a> as the
+ resource's URL and that is a <a href=#prefix-match>prefix match</a> for the
+ resource's URL, then <a href=#fetch>fetch</a> the resource normally and
+ abort these steps.</li>
+
+ <li>
+
+ <p>If the resource's URL has the <a href=#same-origin>same origin</a> as the
+ manifest's URL, and there is a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>
+ <var title="">f</var> in the <a href=#application-cache>application cache</a> that
+ is a <a href=#prefix-match>prefix match</a> for the resource's URL, then:</p>
+
+ <p><a href=#fetch>Fetch</a> the resource normally. If this results in a
+ redirect to a resource with another <a href=#origin>origin</a>
+ (indicative of a captive portal), or a 4xx or 5xx status code
+ <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>,
+ or if there were network errors (but not if the user canceled the
+ download), then instead get, from the cache, the resource of the
+ <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entry</a>
+ corresponding to the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>
+ <var title="">f</var>. Abort these steps.</p>
+
+ </li>
+
+ <li><p>If the <a href=#application-cache>application cache</a>'s <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
+ wildcard flag</a> is <i title="">open</i>, then
+ <a href=#fetch>fetch</a> the resource normally and abort these
+ steps.</li>
+
+ <li><p>Fail the resource load as if there had been a generic
+ network error.</li>
+
+ </ol><p class=note>The above algorithm ensures that so long as the
+ <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online
+ whitelist wildcard flag</a> is <i title="">blocking</i>,
+ resources that are not present in the <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> will always fail
+ to load (at least, after the <a href=#application-cache>application cache</a> has been
+ primed the first time), making the testing of offline applications
+ simpler.</p>
+
+ </div>
+
+
+ <h4 id=expiring-application-caches><span class=secno>6.6.7 </span>Expiring application caches</h4>
+
+ <p>As a general rule, user agents should not expire application
+ caches, except on request from the user, or after having been left
+ unused for an extended period of time.</p>
+
+ <p>Application caches and cookies have similar implications with
+ respect to privacy (e.g. if the site can identify the user when
+ providing the cache, it can store data in the cache that can be used
+ for cookie resurrection). Implementors are therefore encouraged to
+ expose application caches in a manner related to HTTP cookies,
+ allowing caches to be expunged together with cookies and other
+ origin-specific data.</p>
+
+ <p class=example>For example, a user agent could have a "delete
+ site-specific data" feature that clears all cookies, application
+ caches, local storage, databases, etc, from an origin all at
+ once.</p>
+
+
+
+ <h4 id=application-cache-api><span class=secno>6.6.8 </span>Application cache API</h4>
+
+ <pre class=idl>interface <dfn id=applicationcache>ApplicationCache</dfn> {
+
+ // <a href=#concept-appcache-status title=concept-appcache-status>update status</a>
+ const unsigned short <a href=#dom-appcache-uncached title=dom-appcache-UNCACHED>UNCACHED</a> = 0;
+ const unsigned short <a href=#dom-appcache-idle title=dom-appcache-IDLE>IDLE</a> = 1;
+ const unsigned short <a href=#dom-appcache-checking title=dom-appcache-CHECKING>CHECKING</a> = 2;
+ const unsigned short <a href=#dom-appcache-downloading title=dom-appcache-DOWNLOADING>DOWNLOADING</a> = 3;
+ const unsigned short <a href=#dom-appcache-updateready title=dom-appcache-UPDATEREADY>UPDATEREADY</a> = 4;
+ const unsigned short <a href=#dom-appcache-obsolete title=dom-appcache-OBSOLETE>OBSOLETE</a> = 5;
+ readonly attribute unsigned short <a href=#dom-appcache-status title=dom-appcache-status>status</a>;
+
+ // updates
+ void <a href=#dom-appcache-update title=dom-appcache-update>update</a>();
+ void <a href=#dom-appcache-swapcache title=dom-appcache-swapCache>swapCache</a>();
+
+ // events
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-onchecking title=handler-appcache-onchecking>onchecking</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-onerror title=handler-appcache-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-onnoupdate title=handler-appcache-onnoupdate>onnoupdate</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-ondownloading title=handler-appcache-ondownloading>ondownloading</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-onprogress title=handler-appcache-onprogress>onprogress</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-onupdateready title=handler-appcache-onupdateready>onupdateready</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-oncached title=handler-appcache-oncached>oncached</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-appcache-onobsolete title=handler-appcache-onobsolete>onobsolete</a>;
+};
+<a href=#applicationcache>ApplicationCache</a> implements <a href=#eventtarget>EventTarget</a>;</pre>
+
+ <dl class=domintro><dt><var title="">cache</var> = <var title="">window</var> . <code title=dom-applicationCache><a href=#dom-applicationcache>applicationCache</a></code></dt>
+ <dd>
+
+ <p>(In a window.) Returns the <code><a href=#applicationcache>ApplicationCache</a></code> object that applies to the <a href=#active-document>active document</a> of that <code><a href=#window>Window</a></code>.</p>
+
+ </dd>
+
+ <dt><var title="">cache</var> = <var title="">self</var> . <code title=dom-applicationCache><a href=#dom-applicationcache>applicationCache</a></code></dt>
+ <dd>
+
+ <p>(In a shared worker.) Returns the <code><a href=#applicationcache>ApplicationCache</a></code> object that applies to the current shared worker.
+
+ <a href=#refsWEBWORKERS>[WEBWORKERS]</a>
+
+ </p>
+
+ </dd>
+
+ <dt><var title="">cache</var> . <code title=dom-appcache-status><a href=#dom-appcache-status>status</a></code></dt>
+ <dd>
+
+ <p>Returns the current status of the application cache, as given by the constants defined below.</p>
+
+ </dd>
+
+ <dt><var title="">cache</var> . <code title=dom-appcache-update><a href=#dom-appcache-update>update</a></code>()</dt>
+ <dd>
+
+ <p>Invokes the <a href=#application-cache-download-process>application cache download process</a>.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if there is no application cache to update.</p>
+
+ </dd>
+
+ <dt><var title="">cache</var> . <code title=dom-appcache-swapCache><a href=#dom-appcache-swapcache>swapCache</a></code>()</dt>
+ <dd>
+
+ <p>Switches to the most recent application cache, if there is a
+ newer one. If there isn't, throws an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</p>
+
+ <p>This does not cause previously-loaded resources to be reloaded;
+ for example, images do not suddenly get reloaded and style sheets
+ and scripts do not get reparsed or reevaluated. The only change is
+ that subsequent requests for cached resources will obtain the
+ newer copies.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>There is a one-to-one mapping from <a href=#cache-host title="cache host">cache
+ hosts</a> to <code><a href=#applicationcache>ApplicationCache</a></code> objects. The <dfn id=dom-applicationcache title=dom-applicationCache><code>applicationCache</code></dfn>
+ attribute on <code><a href=#window>Window</a></code> objects must return the
+ <code><a href=#applicationcache>ApplicationCache</a></code> object associated with the
+ <code><a href=#window>Window</a></code> object's <a href=#active-document>active document</a>. The <dfn id=dom-sharedworkerglobalscope-applicationcache title=dom-SharedWorkerGlobalScope-applicationCache><code>applicationCache</code></dfn>
+ attribute on <code>SharedWorkerGlobalScope</code> objects must
+ return the <code><a href=#applicationcache>ApplicationCache</a></code> object associated with the
+ worker.
+
+ <a href=#refsWEBWORKERS>[WEBWORKERS]</a>
+
+ </p>
+
+ <p class=note>A <code><a href=#window>Window</a></code> or
+ <code>SharedWorkerGlobalScope</code> object has an associated
+ <code><a href=#applicationcache>ApplicationCache</a></code> object even if that <a href=#cache-host>cache
+ host</a> has no actual <a href=#application-cache>application cache</a>.</p>
+
+ <hr><p>The <dfn id=dom-appcache-status title=dom-appcache-status><code>status</code></dfn>
+ attribute, on getting, must return the current state of the
+ <a href=#application-cache>application cache</a> that the
+ <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache host</a> is
+ associated with, if any. This must be the appropriate value from the
+ following list:</p>
+
+ </div>
+
+ <dl><dt><dfn id=dom-appcache-uncached title=dom-appcache-UNCACHED><code>UNCACHED</code></dfn>
+ (numeric value 0)</dt>
+
+ <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
+ host</a> is not associated with an <a href=#application-cache>application
+ cache</a> at this time.</dd>
+
+ <dt><dfn id=dom-appcache-idle title=dom-appcache-IDLE><code>IDLE</code></dfn>
+ (numeric value 1)</dt>
+
+ <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
+ host</a> is associated with an <a href=#application-cache>application cache</a>
+ whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
+ <i>idle</i>, and that <a href=#application-cache>application cache</a> is the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> cache in its
+ <a href=#application-cache-group>application cache group</a>, and the <a href=#application-cache-group>application
+ cache group</a> is not marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>.</dd>
+
+ <dt><dfn id=dom-appcache-checking title=dom-appcache-CHECKING><code>CHECKING</code></dfn>
+ (numeric value 2)</dt>
+
+ <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
+ host</a> is associated with an <a href=#application-cache>application cache</a>
+ whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
+ <i>checking</i>.</dd>
+
+ <dt><dfn id=dom-appcache-downloading title=dom-appcache-DOWNLOADING><code>DOWNLOADING</code></dfn>
+ (numeric value 3)</dt>
+
+ <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
+ host</a> is associated with an <a href=#application-cache>application cache</a>
+ whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
+ <i>downloading</i>.</dd>
+
+ <dt><dfn id=dom-appcache-updateready title=dom-appcache-UPDATEREADY><code>UPDATEREADY</code></dfn>
+ (numeric value 4)</dt>
+
+ <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
+ host</a> is associated with an <a href=#application-cache>application cache</a>
+ whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
+ <i>idle</i>, and whose <a href=#application-cache-group>application cache group</a> is not
+ marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>,
+ but that <a href=#application-cache>application cache</a> is <em>not</em> the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> cache in its
+ group.</dd>
+
+ <dt><dfn id=dom-appcache-obsolete title=dom-appcache-OBSOLETE><code>OBSOLETE</code></dfn>
+ (numeric value 5)</dt>
+
+ <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
+ host</a> is associated with an <a href=#application-cache>application cache</a>
+ whose <a href=#application-cache-group>application cache group</a> is marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>.</dd>
+
+ </dl><div class=impl>
+
+ <hr><p>If the <dfn id=dom-appcache-update title=dom-appcache-update><code>update()</code></dfn> method is
+ invoked, the user agent must invoke the <a href=#application-cache-download-process>application cache
+ download process</a>, in the background, for the <a href=#application-cache>application
+ cache</a> with which the <code><a href=#applicationcache>ApplicationCache</a></code> object's
+ <a href=#cache-host>cache host</a> is associated, but without giving that
+ <a href=#cache-host>cache host</a> to the algorithm. If there is no such
+ <a href=#application-cache>application cache</a>, or if it is marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>, then the method
+ must raise an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception instead.</p>
+
+ <p>If the <dfn id=dom-appcache-swapcache title=dom-appcache-swapCache><code>swapCache()</code></dfn> method
+ is invoked, the user agent must run the following steps:
+
+ <ol><li><p>Check that <code><a href=#applicationcache>ApplicationCache</a></code> object's
+ <a href=#cache-host>cache host</a> is associated with an <a href=#application-cache>application
+ cache</a>. If it is not, then raise an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li><p>Let <var title="">cache</var> be the <a href=#application-cache>application
+ cache</a> with which the <code><a href=#applicationcache>ApplicationCache</a></code> object's
+ <a href=#cache-host>cache host</a> is associated. (By definition, this is the
+ same as the one that was found in the previous step.)</li>
+
+ <li><p>If <var title="">cache</var>'s <a href=#application-cache-group>application cache
+ group</a> is marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>, then unassociate
+ the <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache host</a>
+ from <var title="">cache</var> and abort these steps. (Resources
+ will now load from the network instead of the cache.)</li>
+
+ <li><p>Check that there is an application cache in the same
+ <a href=#application-cache-group>application cache group</a> as <var title="">cache</var>
+ whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness
+ flag</a> is <i>complete</i> and that is <a href=#concept-appcache-newer title=concept-appcache-newer>newer</a> than <var title="">cache</var>. If there is not, then raise an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li><p>Let <var title="">new cache</var> be the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
+ cache</a> in the same <a href=#application-cache-group>application cache group</a> as
+ <var title="">cache</var> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
+ <i>complete</i>.</li>
+
+ <li><p>Unassociate the <code><a href=#applicationcache>ApplicationCache</a></code> object's
+ <a href=#cache-host>cache host</a> from <var title="">cache</var> and instead
+ associate it with <var title="">new cache</var>.</li>
+
+ </ol><p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported, as IDL attributes, by
+ all objects implementing the <code><a href=#applicationcache>ApplicationCache</a></code>
+ interface:</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-appcache-onchecking title=handler-appcache-onchecking><code>onchecking</code></dfn> <td> <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code>
+ <tr><td><dfn id=handler-appcache-onerror title=handler-appcache-onerror><code>onerror</code></dfn> <td> <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>
+ <tr><td><dfn id=handler-appcache-onnoupdate title=handler-appcache-onnoupdate><code>onnoupdate</code></dfn> <td> <code title=event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code>
+ <tr><td><dfn id=handler-appcache-ondownloading title=handler-appcache-ondownloading><code>ondownloading</code></dfn> <td> <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code>
+ <tr><td><dfn id=handler-appcache-onprogress title=handler-appcache-onprogress><code>onprogress</code></dfn> <td> <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>
+ <tr><td><dfn id=handler-appcache-onupdateready title=handler-appcache-onupdateready><code>onupdateready</code></dfn> <td> <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code>
+ <tr><td><dfn id=handler-appcache-oncached title=handler-appcache-oncached><code>oncached</code></dfn> <td> <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code>
+ <tr><td><dfn id=handler-appcache-onobsolete title=handler-appcache-onobsolete><code>onobsolete</code></dfn> <td> <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>
+ </table></div>
+
+
+ <h4 id=browser-state><span class=secno>6.6.9 </span>Browser state</h4>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-onLine><a href=#dom-navigator-online>onLine</a></code></dt>
+
+ <dd>
+
+ <p>Returns false if the user agent is definitely offline
+ (disconnected from the network). Returns true if the user agent
+ might be online.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-navigator-online title=dom-navigator-onLine><code>navigator.onLine</code></dfn>
+ attribute must return false if the user agent will not contact the
+ network when the user follows links or when a script requests a
+ remote page (or knows that such an attempt would fail), and must
+ return true otherwise.</p>
+
+ <p>When the value that would be returned by the <code title=dom-navigator-onLine><a href=#dom-navigator-online>navigator.onLine</a></code> attribute of
+ the <code><a href=#window>Window</a></code> changes from true to false, the user agent
+ must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <dfn id=event-offline title=event-offline><code>offline</code></dfn> at the
+ <code><a href=#window>Window</a></code> object.</p>
+
+ <p>On the other hand, when the value that would be returned by the
+ <code title=dom-navigator-onLine><a href=#dom-navigator-online>navigator.onLine</a></code> attribute
+ of the <code><a href=#window>Window</a></code> changes from false to true, the user
+ agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <dfn id=event-online title=event-online><code>online</code></dfn> at the
+ <code><a href=#window>Window</a></code> object.</p>
+
+ <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#networking-task-source>networking task
+ source</a>.</p>
+
+ </div>
+
+ <p class=note>This attribute is inherently unreliable. A computer
+ can be connected to a network without having Internet access.</p>
+
+
+
+ <h2 id=webappapis><span class=secno>7 </span>Web application APIs</h2>
+
+ <h3 id=scripting><span class=secno>7.1 </span>Scripting</h3>
+
+ <h4 id=introduction-4><span class=secno>7.1.1 </span>Introduction</h4>
+
+ <p>Various mechanisms can cause author-provided executable code to
+ run in the context of a document. These mechanisms include, but are
+ probably not limited to:</p>
+
+ <ul><li>Processing of <code><a href=#script>script</a></code> elements.</li>
+
+ <li>Processing of inline <code title="javascript
+ protocol"><a href=#javascript-protocol>javascript:</a></code> URLs (e.g. the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute of <code><a href=#the-img-element>img</a></code>
+ elements, or an <code title="">@import</code> rule in a CSS
+ <code><a href=#the-style-element>style</a></code> element block).</li>
+
+ <li>Event handlers, whether registered through the DOM using <code title="">addEventListener()</code>, by explicit <a href=#event-handler-content-attributes>event handler
+ content attributes</a>, by <a href=#event-handler-idl-attributes>event handler IDL
+ attributes</a>, or otherwise.</li>
+
+ <li>Processing of technologies like XBL or SVG that have their own
+ scripting features.</li>
+
+ </ul><div class=impl>
+
+ <h4 id=enabling-and-disabling-scripting><span class=secno>7.1.2 </span>Enabling and disabling scripting</h4>
+
+ <p><dfn id=concept-bc-script title=concept-bc-script>Scripting is enabled</dfn> in a
+ <em><a href=#browsing-context>browsing context</a></em> when all of the
+ following conditions are true:</p>
+
+ <ul><li>The user agent supports scripting.</li>
+
+ <li>The user has not disabled scripting for this <a href=#browsing-context>browsing
+ context</a> at this time. (User agents may provide users with
+ the option to disable scripting globally, or in a finer-grained
+ manner, e.g. on a per-origin basis.)</li>
+
+ <li id=sandboxScriptBlocked>The <a href=#browsing-context>browsing context</a> did
+ not have the <a href=#sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag</a>
+ set when the <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active
+ document</a> was created.</li>
+
+ </ul><p><dfn id=concept-bc-noscript title=concept-bc-noscript>Scripting is disabled</dfn> in a
+ <a href=#browsing-context>browsing context</a> when any of the above conditions are
+ false (i.e. when scripting is not <a href=#concept-bc-script title=concept-bc-script>enabled</a>).</p>
+
+ <hr><p><dfn id=concept-n-script title=concept-n-script>Scripting is enabled</dfn> for a
+ <em>node</em> if the <code><a href=#document>Document</a></code> object of the node (the
+ node itself, if it is itself a <code><a href=#document>Document</a></code> object) has an
+ associated <a href=#browsing-context>browsing context</a>, and <a href=#concept-bc-script title=concept-bc-script>scripting is enabled</a> in that
+ <a href=#browsing-context>browsing context</a>.</p>
+
+ <p><dfn id=concept-n-noscript title=concept-n-noscript>Scripting is disabled</dfn> for a
+ node if there is no such <a href=#browsing-context>browsing context</a>, or if <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a> in that
+ <a href=#browsing-context>browsing context</a>.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <!-- SCRIPT EXEC (marks areas related to creation of scripts) -->
+ <h4 id=processing-model-1><span class=secno>7.1.3 </span>Processing model</h4>
+
+ <h5 id=definitions-0><span class=secno>7.1.3.1 </span>Definitions</h5>
+
+ <p>A <dfn id=concept-script title=concept-script>script</dfn> has:</p>
+
+ <dl><dt>A <dfn id=script-execution-environment>script execution environment</dfn></dt>
+
+ <dd>
+
+ <p>The characteristics of the script execution environment depend
+ on the language, and are not defined by this specification.</p>
+
+ <p class=example>In JavaScript, the script execution environment
+ consists of the interpreter, the stack of <i>execution
+ contexts</i>, the <i>global code</i> and <i>function code</i> and
+ the Function objects resulting, and so forth.</p>
+
+ </dd>
+
+ <dt>A <dfn id=list-of-code-entry-points>list of code entry-points</dfn></dt>
+
+ <dd>
+
+ <p>Each code entry-point represents a block of executable code
+ that the script exposes to other scripts and to the user
+ agent.</p>
+
+ <p class=example>Each Function object in a JavaScript
+ <a href=#script-execution-environment>script execution environment</a> has a corresponding code
+ entry-point, for instance.</p>
+
+ <p>The main program code of the script, if any, is the
+ <dfn id=initial-code-entry-point><i>initial code entry-point</i></dfn>. Typically, the code
+ corresponding to this entry-point is executed immediately after
+ the script is parsed.</p>
+
+ <p class=example>In JavaScript, this corresponds to the
+ execution context of the global code.</p>
+
+ </dd>
+
+ <dt>A relationship with the <dfn id="script's-global-object">script's global object</dfn></dt>
+
+ <dd>
+
+ <p>An object that provides the APIs that the code can use.</p>
+
+ <p class=example>This is typically a <code><a href=#window>Window</a></code>
+ object. In JavaScript, this corresponds to the <i>global
+ object</i>.</p>
+
+ <p class=note>When a <a href="#script's-global-object">script's global object</a> is an
+ empty object, it can't do anything that interacts with the
+ environment.</p>
+
+ <p>If the <a href="#script's-global-object">script's global object</a> is a
+ <code><a href=#window>Window</a></code> object, then in JavaScript, the ThisBinding of
+ the global execution context for this script must be the
+ <code><a href=#window>Window</a></code> object's <code><a href=#windowproxy>WindowProxy</a></code> object,
+ rather than the global object. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ <p class=note>This is a <a href=#willful-violation>willful violation</a> of the
+ JavaScript specification current at the time of writing
+ (ECMAScript edition 5, as defined in section 10.4.1.1 Initial
+ Global Execution Context, step 3). The JavaScript specification
+ requires that the <code title="">this</code> keyword in the global
+ scope return the global object, but this is not compatible with
+ the security design prevalent in implementations as specified
+ herein. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </dd>
+
+ <dt>A relationship with the <dfn id="script's-browsing-context">script's browsing context</dfn></dt>
+
+ <dd>
+
+ <p>A <a href=#browsing-context>browsing context</a> that is assigned responsibility
+ for actions taken by the script.</p>
+
+ <p class=example>When a script creates and <a href=#navigate title=navigate>navigates</a> a new <a href=#top-level-browsing-context>top-level browsing
+ context</a>, the <code title=dom-opener><a href=#dom-opener>opener</a></code>
+ attribute of the new <a href=#browsing-context>browsing context</a>'s
+ <code><a href=#window>Window</a></code> object will be set to the <a href="#script's-browsing-context">script's
+ browsing context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
+
+ </dd>
+
+ <dt>A relationship with the <dfn id="script's-document">script's document</dfn></dt>
+
+ <dd>
+
+ <p>A <code><a href=#document>Document</a></code> that is assigned responsibility for
+ actions taken by the script.</p>
+
+ <p class=example>When a script <a href=#fetch title=fetch>fetches</a> a resource, the <a href="#the-document's-current-address" title="the
+ document's current address">current address</a> of the
+ <a href="#script's-document">script's document</a> will be used to set the <code title=http-referer>Referer</code> (sic) header.</p>
+
+ </dd>
+
+ <dt>A <dfn id="script's-url-character-encoding" title="script's URL character encoding">URL character encoding</dfn></dt>
+
+ <dd>
+
+ <p>A character encoding, set when the script is created, used to
+ encode URLs. <span id=sce-not-copy title="">If the character
+ encoding is set from another source, e.g. a <a href="#document's-character-encoding">document's
+ character encoding</a>, then the <a href="#script's-url-character-encoding">script's URL character
+ encoding</a> must follow the source, so that if the source's
+ changes, so does the script's.</span></p>
+
+ </dd>
+
+ <dt>A <dfn id="script's-base-url" title="script's base URL">base URL</dfn></dt>
+
+ <dd>
+
+ <p>A <a href=#url>URL</a>, set when the script is created, used to
+ resolve relative URLs. <span id=sbu-not-copy title="">If the
+ base URL is set from another source, e.g. a <a href=#document-base-url>document base
+ URL</a>, then the <a href="#script's-base-url">script's base URL</a> must follow
+ the source, so that if the source's changes, so does the
+ script's.</span></p>
+
+ </dd>
+
+ </dl></div>
+
+
+ <div class=impl>
+
+ <h5 id=calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</h5>
+
+ <p>When a user agent is to <dfn id=jump-to-a-code-entry-point>jump to a code entry-point</dfn> for
+ a <a href=#concept-script title=concept-script>script</a>, for example to invoke
+ an event listener defined in that <a href=#concept-script title=concept-script>script</a>, the user agent must run the
+ following steps:</p>
+
+ <ol><li><p>If the <a href="#script's-global-object">script's global object</a> is a
+ <code><a href=#window>Window</a></code> object whose <code><a href=#document>Document</a></code> object is
+ not <a href=#fully-active>fully active</a>, then abort these steps without doing
+ anything. The callback is not fired.</p>
+
+ <li><p>Set the <a href=#entry-script>entry script</a> to be the <a href=#concept-script title=concept-script>script</a> being invoked.</li>
+
+ <li><p>Make the <a href=#script-execution-environment title="script execution environment">script
+ execution environment</a> for the <a href=#concept-script title=concept-script>script</a> execute the code for the given
+ code entry-point.</li>
+
+ <li><p>Set the <a href=#entry-script>entry script</a> back to whatever it was
+ when this algorithm started.</li>
+
+ </ol><p>This algorithm is not invoked by one script calling another.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</h5>
+
+ <p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script title="create a
+ script">created</dfn>, given some script source, its scripting
+ language, a global object, a browsing context, a URL character
+ encoding, and a base URL, the user agent must run the following
+ steps:</p>
+
+ <ol><li><p>If <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is
+ disabled</a> for <a href=#browsing-context>browsing context</a> passed to this
+ algorithm, then abort these steps, as if the script did nothing but
+ return void.</p>
+
+ <li><p>Set up a <a href=#script-execution-environment>script execution environment</a> as
+ appropriate for the scripting language.</li>
+
+ <li><p>Parse/compile/initialize the source of the script using the
+ <a href=#script-execution-environment>script execution environment</a>, as appropriate for the
+ scripting language, and thus obtain the <a href=#list-of-code-entry-points>list of code
+ entry-points</a> for the script. If the semantics of the
+ scripting language and the given source code are such that there is
+ executable code to be immediately run, then the <i><a href=#initial-code-entry-point>initial code
+ entry-point</a></i> is the entry-point for that code.</li>
+
+ <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the
+ <a href="#script's-browsing-context">script's browsing context</a>, the <a href="#script's-document">script's
+ document</a>, the <a href="#script's-url-character-encoding">script's URL character encoding</a>,
+ and the <a href="#script's-base-url">script's base URL</a> from the settings passed to
+ this algorithm.</li>
+
+ <li><p><a href=#jump-to-a-code-entry-point title="jump to a code entry-point">Jump</a> to the
+ <a href=#concept-script title=concept-script>script</a>'s <i><a href=#initial-code-entry-point>initial code
+ entry-point</a></i>.</li>
+
+ </ol><hr><p>When the user agent is to <dfn id=create-an-impotent-script>create an impotent script</dfn>,
+ given some script source, its scripting language, and a browsing
+ context, the user agent must <a href=#create-a-script>create a script</a>, using the
+ given script source and scripting language, using a new empty object
+ as the global object, and using the given browsing context as the
+ browsing context. The URL character encoding and base URL for the
+ resulting <a href=#concept-script title=concept-script>script</a> are not
+ important as no APIs are exposed to the script.</p>
+
+ <hr><p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script-from-a-node title="create a
+ script from a node">created from a node</dfn> <var title="">node</var>, given some script source and its scripting
+ language, the user agent must <a href=#create-a-script>create a script</a>, using
+ the given script source and scripting language, and using <a href=#the-script-settings-determined-from-the-node>the
+ script settings determined from the node</a> <var title="">node</var>.</p>
+
+ <p><dfn id=the-script-settings-determined-from-the-node>The script settings determined from the node</dfn> <var title="">node</var> are computed as follows:</p>
+
+ <ol><li><p>Let <var title="">document</var> be the
+ <code><a href=#document>Document</a></code> of <var title="">node</var> (or <var title="">node</var> itself if it is a
+ <code><a href=#document>Document</a></code>).</li>
+
+ <li><p>The browsing context is the <a href=#browsing-context>browsing context</a> of
+ <var title="">document</var>.</p>
+
+ <li><p>The global object is the <code><a href=#window>Window</a></code> object of
+ <var title="">document</var>.</li>
+
+ <li><p>The URL character encoding is the <a href="#document's-character-encoding" title="document's
+ character encoding">character encoding</a> of <var title="">document</var>. (<a href=#sce-not-copy>This is a
+ reference, not a copy</a>.)</li>
+
+ <li><p>The base URL is the <a href=#document-base-url title="document base URL">base
+ URL</a> of <var title="">document</var>. (<a href=#sbu-not-copy>This is a reference, not a copy</a>.)</li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h5 id=killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</h5>
+
+ <p>User agents may impose resource limitations on scripts, for
+ example CPU quotas, memory limits, total execution time limits, or
+ bandwidth limitations. When a script exceeds a limit, the user agent
+ may either throw a <code><a href=#quota_exceeded_err>QUOTA_EXCEEDED_ERR</a></code> exception, abort
+ the script without an exception, prompt the user, or throttle script
+ execution.</p>
+
+ <div class=example>
+
+ <p>For example, the following script never terminates. A user agent
+ could, after waiting for a few seconds, prompt the user to either
+ terminate the script or let it continue.</p>
+
+ <pre>&lt;script&gt;
+ while (true) { /* loop */ }
+&lt;/script&gt;</pre>
+
+ </div>
+
+ <p>User agents are encouraged to allow users to disable scripting
+ whenever the user is prompted either by a script (e.g. using the
+ <code title=dom-alert><a href=#dom-alert>window.alert()</a></code> API) or because of a
+ script's actions (e.g. because it has exceeded a time limit).</p>
+
+ <p>If scripting is disabled while a script is executing, the script
+ should be terminated immediately.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=event-loops><span class=secno>7.1.4 </span>Event loops</h4>
+
+ <h5 id=definitions-1><span class=secno>7.1.4.1 </span>Definitions</h5>
+
+ <p>To coordinate events, user interaction, scripts, rendering,
+ networking, and so forth, user agents must use <dfn id=event-loop title="event
+ loop">event loops</dfn> as described in this section.</p>
+
+ <p>There must be at least one <a href=#event-loop>event loop</a> per user
+ agent, and at most one <a href=#event-loop>event loop</a> per <a href=#unit-of-related-similar-origin-browsing-contexts>unit of
+ related similar-origin browsing contexts</a>.</p>
+
+ <p>An <a href=#event-loop>event loop</a> always has at least one <a href=#browsing-context>browsing
+ context</a>. If an <a href=#event-loop>event loop</a>'s <a href=#browsing-context title="browsing context">browsing contexts</a> all go away, then
+ the <a href=#event-loop>event loop</a> goes away as well. A <a href=#browsing-context>browsing
+ context</a> always has an <a href=#event-loop>event loop</a> coordinating
+ its activities.</p>
+
+
+ <p class=note>Other specifications can define new kinds of event
+ loops that aren't associated with browsing contexts; in particular,
+ the Web Workers specification does so.</p>
+
+
+ <p>An <a href=#event-loop>event loop</a> has one or more <dfn id=task-queue title="task
+ queue">task queues</dfn>. A <a href=#task-queue>task queue</a> is an ordered
+ list of <dfn id=concept-task title=concept-task>tasks</dfn>, which can be:</p>
+
+ <dl><dt>Events</dt>
+
+ <dd>
+
+ <p>Asynchronously dispatching an <code><a href=#event>Event</a></code> object at a
+ particular <code><a href=#eventtarget>EventTarget</a></code> object is a task.</p>
+
+ <p class=note>Not all events are dispatched using the <a href=#task-queue>task
+ queue</a>, many are dispatched synchronously during other
+ tasks.</p>
+
+ </dd>
+
+
+ <dt>Parsing</dt>
+
+ <dd><p>The <a href=#html-parser>HTML parser</a> tokenizing a single byte, and
+ then processing any resulting tokens, is a task.</dd>
+
+
+ <dt>Callbacks</dt>
+
+ <dd><p>Calling a callback asynchronously is a task.</dd>
+
+
+ <dt>Using a resource</dt>
+
+ <dd><p>When an algorithm <a href=#fetch title=fetch>fetches</a> a
+ resource, if the fetching occurs asynchronously then the processing
+ of the resource once some or all of the resource is available is a
+ task.</dd>
+
+
+ <dt>Reacting to DOM manipulation</dt>
+
+ <dd><p>Some elements have tasks that trigger in response to DOM
+ manipulation, e.g. when that element is <a href=#insert-an-element-into-a-document title="insert an
+ element into a document">inserted into the document</a>.</p>
+
+ </dl><p>When a user agent is to <dfn id=queue-a-task>queue a task</dfn>, it must add the
+ given task to one of the <a href=#task-queue title="task queue">task queues</a>
+ of the relevant <a href=#event-loop>event loop</a>. All the tasks from one
+ particular <dfn id=task-source>task source</dfn> (e.g. the callbacks generated by
+ timers, the events dispatched for mouse movements, the tasks queued
+ for the parser) must always be added to the same <a href=#task-queue>task
+ queue</a>, but tasks from different <a href=#task-source title="task
+ source">task sources</a> may be placed in different <a href=#task-queue title="task queue">task queues</a>.</p>
+
+ <p class=example>For example, a user agent could have one
+ <a href=#task-queue>task queue</a> for mouse and key events (the <a href=#user-interaction-task-source>user
+ interaction task source</a>), and another for everything
+ else. The user agent could then give keyboard and mouse events
+ preference over other tasks three quarters of the time, keeping the
+ interface responsive but not starving other task queues, and never
+ processing events from any one <a href=#task-source>task source</a> out of
+ order.</p>
+
+ <p>Each <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> onto a <a href=#task-queue>task queue</a> of
+ an <a href=#event-loop>event loop</a> defined by this specification is
+ associated with a <code><a href=#document>Document</a></code>; if the task was queued in
+ the context of an element, then it is the element's
+ <code><a href=#document>Document</a></code>; if the task was queued in the context of a
+ <a href=#browsing-context>browsing context</a>, then it is the <a href=#browsing-context>browsing
+ context</a>'s <a href=#active-document>active document</a> at the time the task
+ was queued; if the task was queued by or for a <a href=#concept-script title=concept-script>script</a> then the document is the
+ <a href="#script's-document">script's document</a>.</p>
+
+ <p>A user agent is required to have one <dfn id=storage-mutex>storage
+ mutex</dfn>. This mutex is used to control access to shared state
+ like cookies. At any one point, the <a href=#storage-mutex>storage mutex</a> is
+ either free, or owned by a particular <a href=#event-loop>event loop</a> or
+ instance of the <a href=#fetch title=fetch>fetching</a> algorithm.</p>
+
+ <p>Whenever a <a href=#concept-script title=concept-script>script</a> calls into
+ a <a href=#plugin>plugin</a>, and whenever a <a href=#plugin>plugin</a> calls into
+ a <a href=#concept-script title=concept-script>script</a>, the user agent must
+ release the <a href=#storage-mutex>storage mutex</a>.</p>
+
+
+ <h5 id=processing-model-2><span class=secno>7.1.4.2 </span>Processing model</h5>
+
+ <p>An <a href=#event-loop>event loop</a> must continually run through the
+ following steps for as long as it exists:</p>
+
+ <ol><li><p>Run the oldest <a href=#concept-task title=concept-task>task</a> on one
+ of the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
+ queues</a>, ignoring tasks whose associated
+ <code><a href=#document>Document</a></code>s are not <a href=#fully-active>fully active</a>. The user
+ agent may pick any <a href=#task-queue>task queue</a>.</li>
+
+ <li><p>If the <a href=#storage-mutex>storage mutex</a> is now owned by the
+ <a href=#event-loop>event loop</a>, release it so that it is once again
+ free.</p>
+
+ <li><p>Remove that task from its <a href=#task-queue>task queue</a>.</li>
+
+ <li><p>If any asynchronously-running algorithms are <dfn id=await-a-stable-state title="await a stable state">awaiting a stable state</dfn>, then
+ run their <dfn id=synchronous-section>synchronous section</dfn> and then resume running
+ their asynchronous algorithm.</p>
+
+ <p class=note>A <a href=#synchronous-section>synchronous section</a> never mutates
+ the DOM, runs any script, or has any other side-effects.</p>
+
+ <p class=note>Steps in <a href=#synchronous-section title="synchronous
+ section">synchronous sections</a> are marked with
+ &#8987;.</li>
+
+ <li><p>If necessary, update the rendering or user interface of any
+ <code><a href=#document>Document</a></code> or <a href=#browsing-context>browsing context</a> to reflect
+ the current state.</li>
+
+ <li><p>Return to the first step of the <a href=#event-loop>event
+ loop</a>.</li>
+
+ </ol><hr><p>When an algorithm says to <dfn id=spin-the-event-loop>spin the event loop</dfn> until
+ a condition <var title="">goal</var> is met, the user agent must run
+ the following steps:</p>
+
+ <ol><li><p>Let <var title="">task source</var> be the <a href=#task-source>task
+ source</a> of the currently running <a href=#concept-task title=concept-task>task</a>.</li>
+
+ <li><p>Stop the currently running <a href=#concept-task title=concept-task>task</a>, allowing the <a href=#event-loop>event
+ loop</a> to resume, but continue these steps
+ asynchronously.</li>
+
+ <li><p>Wait until the condition <var title="">goal</var> is
+ met.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to continue running these steps,
+ using the <a href=#task-source>task source</a> <var title="">task
+ source</var>. Wait until this task runs before continuing these
+ steps.</li>
+
+ <li><p>Return to the caller.</li>
+
+ </ol><hr><p>Some of the algorithms in this specification, for historical
+ reasons, require the user agent to <dfn id=pause>pause</dfn> while running a
+ <a href=#concept-task title=concept-task>task</a> until some condition has been
+ met. While a user agent has a paused <a href=#concept-task title=concept-task>task</a>, the corresponding <a href=#event-loop>event
+ loop</a> must not run further <a href=#concept-task title=concept-task>tasks</a>, and any script in the currently
+ running <a href=#concept-task title=concept-task>task</a> must block. User
+ agents should remain responsive to user input while paused, however,
+ albeit in a reduced capacity since the <a href=#event-loop>event loop</a> will
+ not be doing anything.</p>
+
+ <hr><p>When a user agent is to <dfn id=obtain-the-storage-mutex>obtain the storage mutex</dfn> as
+ part of running a <a href=#concept-task title=concept-task>task</a>, it must
+ run through the following steps:</p>
+
+ <ol><li><p>If the <a href=#storage-mutex>storage mutex</a> is already owned by this
+ <a href=#concept-task title=concept-task>task</a>'s <a href=#event-loop>event loop</a>,
+ then abort these steps.</li>
+
+ <li><p>Otherwise, <a href=#pause>pause</a> until the <a href=#storage-mutex>storage
+ mutex</a> can be taken by the <a href=#event-loop>event loop</a>.</li>
+
+ <li><p>Take ownership of the <a href=#storage-mutex>storage mutex</a>.</li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h5 id=generic-task-sources><span class=secno>7.1.4.3 </span>Generic task sources</h5>
+
+ <p>The following <a href=#task-source title="task source">task sources</a> are
+ used by a number of mostly unrelated features in this and other
+ specifications.</p>
+
+ <dl><dt>The <dfn id=dom-manipulation-task-source>DOM manipulation task source</dfn></dt>
+
+ <dd>
+
+ <p>This <a href=#task-source>task source</a> is used for features that react
+ to DOM manipulations, such as things that happen asynchronously
+ when an element is <a href=#insert-an-element-into-a-document title="insert an element into a
+ document">inserted into the document</a>.</p>
+
+ <!--
+ <p>Asynchronous mutation events must be dispatched using <span
+ title="concept-task">tasks</span> <span title="queue a
+ task">queued</span> with the <span>DOM manipulation task
+ source</span>. <a href="#refsDOMEVENTS">[DOMEVENTS]</a></p>
+ -->
+
+ </dd>
+
+ <dt>The <dfn id=user-interaction-task-source>user interaction task source</dfn></dt>
+
+ <dd>
+
+ <p>This <a href=#task-source>task source</a> is used for features that react
+ to user interaction, for example keyboard or mouse input.</p>
+
+ <p>Asynchronous events sent in response to user input (e.g. <code title=event-click><a href=#event-click>click</a></code> events) must be dispatched using
+ <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a
+ task">queued</a> with the <a href=#user-interaction-task-source>user interaction task
+ source</a>. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ </dd>
+
+ <dt>The <dfn id=networking-task-source>networking task source</dfn></dt>
+
+ <dd>
+
+ <p>This <a href=#task-source>task source</a> is used for features that trigger
+ in response to network activity.</p>
+
+ <!-- XHR should use this -->
+
+ </dd>
+
+ <dt>The <dfn id=history-traversal-task-source>history traversal task source</dfn></dt>
+
+ <dd>
+
+ <p>This <a href=#task-source>task source</a> is used to queue calls to <code title=dom-history-back><a href=#dom-history-back>history.back()</a></code> and similar
+ APIs.</p>
+
+ </dd>
+
+ </dl></div>
+
+
+
+ <div class=impl>
+
+ <!-- SCRIPT EXEC -->
+ <h4 id=javascript-protocol><span class=secno>7.1.5 </span><dfn title="javascript protocol">The <code title="">javascript:</code> protocol</dfn></h4>
+
+ <p>When a <a href=#url>URL</a> using the <code title="">javascript:</code> protocol is <dfn id=concept-js-deref title=concept-js-deref>dereferenced</dfn>, the user agent must run
+ the following steps:</p>
+
+ <ol><li><p>Let the script source be the string obtained using the
+ content retrieval operation defined for <code title="">javascript:</code> URLs. <a href=#refsJSURL>[JSURL]</a></li>
+
+ <li>
+
+ <p>Use the appropriate step from the following list:</p>
+
+ <dl><dt>If a <a href=#browsing-context>browsing context</a> is being <a href=#navigate title=navigate>navigated</a> to a <code>javascript:</code>
+ URL, and the <a href=#active-document>active document</a> of that browsing
+ context has the <a href=#same-origin>same origin</a> as the script given by
+ that URL</dt>
+
+ <dd>
+
+ <!-- http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/ -->
+
+ <p>Let <var title="">address</var> be the <a href="#the-document's-address" title="the
+ document's address">address</a> of the <a href=#active-document>active
+ document</a> of the <a href=#browsing-context>browsing context</a> being
+ navigated.</p>
+
+ <p>If <var title="">address</var> is <code><a href=#about:blank>about:blank</a></code>,
+ and the <a href=#browsing-context>browsing context</a> being navigated has a
+ <a href=#creator-browsing-context>creator browsing context</a>, then let <var title="">address</var> be the <a href="#the-document's-address" title="the document's
+ address">address</a> of the <a href=#creator-document>creator
+ <code>Document</code></a> instead.</p>
+
+ <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a
+ script</a> from the <code><a href=#document>Document</a></code> node of the
+ <a href=#active-document>active document</a>, using the aforementioned script
+ source, and assuming the scripting language is JavaScript.</p>
+
+ <p>Let <var title="">result</var> be the return value of the
+ <i><a href=#initial-code-entry-point>initial code entry-point</a></i> of this <a href=#concept-script title=concept-script>script</a>. If an exception was
+ raised, let <var title="">result</var> be void instead. (The
+ result will be void also if <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a>.)</p>
+
+ <p>When it comes time to <a href="#set-the-document's-address">set the document's address</a>
+ in the <a href=#navigate title=navigate>navigation algorithm</a>, use
+ <var title="">address</var> as the <a href=#override-url>override
+ URL</a>.</p>
+
+ </dd>
+
+ <dt>If the <code><a href=#document>Document</a></code> object of the element,
+ attribute, or style sheet from which the <code>javascript:</code>
+ URL was reached has an associated <a href=#browsing-context>browsing
+ context</a></dt>
+
+ <dd>
+
+ <p><a href=#create-an-impotent-script>Create an impotent script</a> using the
+ aforementioned script source, with the scripting language set to
+ JavaScript, and with the <code><a href=#document>Document</a></code>'s object's
+ <a href=#browsing-context>browsing context</a> as the browsing context.</p>
+
+ <p>Let <var title="">result</var> be the return value of the
+ <i><a href=#initial-code-entry-point>initial code entry-point</a></i> of this <a href=#concept-script title=concept-script>script</a>. If an exception was
+ raised, let <var title="">result</var> be void instead. (The
+ result will be void also if <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a>.)</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>Let <var title="">result</var> be void.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>If the result of executing the script is void (there is no
+ return value), then the URL must be treated in a manner equivalent
+ to an HTTP resource with an HTTP 204 No Content response.</p>
+
+ <p>Otherwise, the URL must be treated in a manner equivalent to an
+ HTTP resource with a 200 OK response whose <a href=#content-type title=Content-Type>Content-Type metadata</a> is
+ <code><a href=#text/html>text/html</a></code> and whose response body is the return value
+ converted to a string value.</p>
+
+ <p class=note>Certain contexts, in particular <code><a href=#the-img-element>img</a></code>
+ elements, ignore the <a href=#content-type title=Content-Type>Content-Type
+ metadata</a>.</p>
+
+ </li>
+
+ </ol><div class=example>
+
+ <p>So for example a <code title="">javascript:</code> URL for a
+ <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute of an
+ <code><a href=#the-img-element>img</a></code> element would be evaluated in the context of an
+ empty object as soon as the attribute is set; it would then be
+ sniffed to determine the image type and decoded as an image.</p>
+
+ <p>A <code title="">javascript:</code> URL in an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute of an <code><a href=#the-a-element>a</a></code>
+ element would only be evaluated when the link was <a href=#following-hyperlinks title="following hyperlinks">followed</a>.</p>
+
+ <p>The <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute of an
+ <code><a href=#the-iframe-element>iframe</a></code> element would be evaluated in the context of
+ the <code><a href=#the-iframe-element>iframe</a></code>'s own <a href=#browsing-context>browsing context</a>; once
+ evaluated, its return value (if it was not void) would replace that
+ <a href=#browsing-context>browsing context</a>'s document, thus changing the
+ variables visible in that <a href=#browsing-context>browsing context</a>.</p>
+
+ </div>
+
+ </div>
+
+
+
+ <h4 id=events><span class=secno>7.1.6 </span>Events</h4>
+
+ <div class=impl>
+
+ <h5 id=event-handler-attributes><span class=secno>7.1.6.1 </span>Event handlers</h5>
+
+ </div>
+
+ <!--test: <a href="http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E">test</a>-->
+
+ <p>Many objects can have <dfn id=event-handlers>event handlers</dfn> specified. These
+ act as bubbling event listeners for the object on which they are
+ specified.</p>
+
+ <p>An <a href=#event-handlers title="event handlers">event handler</a> can either
+ have the value null or be set to a <code><a href=#function>Function</a></code>
+ object. <span class=impl>Initially, event handlers must be set to
+ null.</span></p>
+
+ <p>Event handlers are exposed in one or two ways.</p>
+
+ <p>The first way, common to all event handlers, is as an <a href=#event-handler-idl-attributes title="event handler IDL attributes">event handler IDL
+ attribute</a>.</p>
+
+ <p>The second way is as an <a href=#event-handler-content-attributes title="event handler content
+ attributes">event handler content attribute</a>. Event handlers
+ on <a href=#html-elements>HTML elements</a> and some of the event handlers on
+ <code><a href=#window>Window</a></code> objects are exposed in this way.</p>
+
+ <div class=impl>
+
+ <hr><p><dfn id=event-handler-idl-attributes>Event handler IDL attributes</dfn>, on setting, must set the
+ corresponding event handler to their new value, and on
+ getting, must return whatever the current value of the corresponding
+ event handler is (possibly null).</p>
+
+ <p>If an <a href=#event-handler-idl-attributes title="event handler IDL attributes">event handler
+ IDL attribute</a> exposes an <a href=#event-handlers title="event handlers">event
+ handler</a> of an object that doesn't exist, it must always
+ return null on getting and must do nothing on setting.</p>
+
+ <p class=note>This can happen in particular for <a href=#event-handler-idl-attributes title="event
+ handler IDL attributes">event handler IDL attribute</a> on
+ <code><a href=#the-body-element-0>body</a></code> elements that do not have corresponding
+ <code><a href=#window>Window</a></code> objects.</p>
+
+ <p class=note>Certain event handler IDL attributes have additional
+ requirements, in particular the <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> attribute of
+ <code><a href=#messageport>MessagePort</a></code> objects.</p>
+
+ <hr></div>
+
+ <p><dfn id=event-handler-content-attributes>Event handler content attributes</dfn>, when specified, must
+ contain valid JavaScript code matching the <code title="">FunctionBody</code> production. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ <div class=impl>
+
+ <!-- SCRIPT EXEC -->
+ <p>When an <a href=#event-handler-content-attributes title="event handler content attributes">event
+ handler content attribute</a> is set, if the element is owned by
+ a <code><a href=#document>Document</a></code> that is in a <a href=#browsing-context>browsing context</a>,
+ and <a href=#concept-bc-script title=concept-bc-script>scripting is enabled</a> for
+ that <a href=#browsing-context>browsing context</a>, the user agent must run the
+ following steps to create a <a href=#concept-script title=concept-script>script</a> after setting the content
+ attribute to its new value:</p>
+
+ <ol><li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for
+ JavaScript.</li>
+
+ <li>
+
+ <p>Using this script execution environment, create a function
+ object (as defined in ECMAScript edition 5 section 13.2 Creating
+ Function Objects), with:</p>
+
+ <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>
+
+ <dd>
+
+ <dl class=switch><dt>If the attribute is the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> attribute of the
+ <code><a href=#window>Window</a></code> object</dt>
+
+ <dd>Let the function have three arguments, named <code title="">event</code>, <code title="">source</code>, and <code title="">fileno</code>.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>Let the function have a single argument called <code title="">event</code>.</dd>
+
+ </dl></dd>
+
+ <dt>Function body <var title="">FunctionBody</var></dt>
+
+ <dd>The <a href=#event-handler-content-attributes title="event handler content attributes">event
+ handler content attribute</a>'s new value.</dd>
+
+ <dt>Lexical Environment <var title="">Scope</var></dt>
+
+ <dd>
+
+ <ol><li>Let <var title="">Scope</var> be the result of
+ NewObjectEnvironment(the element's <code><a href=#document>Document</a></code>, the
+ <var title="">global environment</var>).</li>
+
+ <li>If the element has a <a href=#form-owner>form owner</a>, let <var title="">Scope</var> be the result of NewObjectEnvironment(the
+ element's <a href=#form-owner>form owner</a>, <var title="">Scope</var>).</li>
+
+ <li>Let <var title="">Scope</var> be the result of
+ NewObjectEnvironment(the element's object, <var title="">Scope</var>).</li>
+
+ </ol><p class=note>NewObjectEnvironment() is defined in ECMAScript
+ edition 5 section 10.2.2.3 NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </dd>
+
+ <dt>Boolean flag <var title="">Strict</var></dt>
+
+ <dd>False.</dd>
+
+ </dl><p>Let this new function be the only entry in the script's
+ <a href=#list-of-code-entry-points>list of code entry-points</a>.</p>
+
+ </li>
+
+ <li><p>If the previous steps failed to compile the script, then set
+ the corresponding <a href=#event-handlers title="event handlers">event handler</a>
+ to null and abort these steps.</li>
+
+ <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the
+ <a href="#script's-browsing-context">script's browsing context</a>, the <a href="#script's-document">script's
+ document</a>, the <a href="#script's-url-character-encoding">script's URL character encoding</a>,
+ and the <a href="#script's-base-url">script's base URL</a> from <a href=#the-script-settings-determined-from-the-node>the script
+ settings determined from the node</a> on which the attribute is
+ being set.</li>
+
+ <li><p>Set the corresponding <a href=#event-handlers title="event handlers">event
+ handler</a> to the aforementioned function.</li>
+
+ </ol><p>When an event handler content attribute is removed, the user
+ agent must set the corresponding <a href=#event-handlers title="event handlers">event
+ handler</a> to null.</p>
+ <!--
+ http://software.hixie.ch/utilities/js/live-dom-viewer/saved/245 onload
+ http://software.hixie.ch/utilities/js/live-dom-viewer/saved/247 onclick
+ see http://www.w3.org/Bugs/Public/show_bug.cgi?id=7626#c5 for reasoning
+ -->
+
+ </div>
+
+ <p class=note>When an <a href=#event-handler-content-attributes title="event handler content
+ attributes">event handler content attribute</a> is set on an
+ element owned by a <code><a href=#document>Document</a></code> that is not in a
+ <a href=#browsing-context>browsing context</a>, the corresponding event handler is
+ not changed.</p>
+
+ <!-- v2: we should probably support HTML4's Content-Script-Type header here. -->
+
+ <div class=impl>
+
+ <hr><p>All <a href=#event-handlers>event handlers</a> on an object, whether an element
+ or some other object, and whether set to null or to a
+ <code><a href=#function>Function</a></code> object, must be registered as event listeners
+ on the object when it is created, as if the <code title=dom-EventTarget-addEventListener>addEventListener()</code>
+ method on the object's <code><a href=#eventtarget>EventTarget</a></code> interface had been
+ invoked, with the event type (<var title=dom-event-type>type</var>
+ argument) equal to the type corresponding to the event handler (the
+ <dfn id=event-handler-event-type>event handler event type</dfn>), the listener set to be a
+ target and bubbling phase listener (<var title=dom-event-useCapture>useCapture</var> argument set to
+ false), and the event listener itself (<var title=dom-event-listener>listener</var> argument) set to do
+ nothing while the event handler's value is not a
+ <code><a href=#function>Function</a></code> object, and set to invoke the <code title=dom-function-call><a href=#dom-function-call>call()</a></code> callback of the
+ <code><a href=#function>Function</a></code> object associated with the event handler
+ otherwise.</p>
+
+ </div>
+
+ <p class=note><a href=#event-handlers>Event handlers</a> <span class=impl>therefore</span> always fire before event listeners
+ attached using <code title=dom-EventTarget-addEventListener>addEventListener()</code>.</p>
+
+ <div class=impl>
+
+ <p class=note>The <var title=dom-event-listener>listener</var>
+ argument is emphatically <em>not</em> the <a href=#event-handlers title="event
+ handlers">event handler</a> itself.</p>
+
+ <p class=note>The interfaces implemented by the event object do
+ not influence whether an <a href=#event-handlers title="event handlers">event
+ handler</a> is triggered or not.</p>
+
+ <p>When an <a href=#event-handlers title="event handlers">event handler</a>'s
+ <code><a href=#function>Function</a></code> object is invoked, its <code title=dom-function-call><a href=#dom-function-call>call()</a></code> callback must be invoked
+ with one argument, set to the <code><a href=#event>Event</a></code> object of the event
+ in question.</p>
+
+ <p>The handler's return value must then be processed as follows:</p>
+
+ <dl class=switch><dt>If the event type is <code class=event-mouseover>mouseover</code></dt>
+
+ <dd><p>If the return value is a boolean with the value true, then
+ the event must be canceled.</dd>
+
+ <dt>If the event object is a <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> object</dt>
+
+ <dd><p>If the return value is a string, and the event object's
+ <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
+ attribute's value is the empty string, then set the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
+ attribute's value to the return value.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>If the return value is a boolean with the value false, then
+ the event must be canceled.</dd>
+
+ </dl></div>
+
+ <!-- IE actually uncancels the event if the function returns true -->
+
+ <hr><p>The <code><a href=#function>Function</a></code> interface represents a function in the
+ scripting language being used. It is represented in IDL as
+ follows:</p>
+
+ <pre class=idl>[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id=function>Function</dfn> {
+ any <a href=#dom-function-call title=dom-function-call>call</a>(in any... arguments);
+};</pre>
+
+ <p>The <dfn id=dom-function-call title=dom-function-call><code>call(...)</code></dfn>
+ method is the object's callback.</p>
+
+ <p class=note>In JavaScript, any <code title="">Function</code>
+ object implements this interface.</p>
+
+ <p>If the <code><a href=#function>Function</a></code> object is a JavaScript <code title="">Function</code>, then when it is invoked by the user agent,
+ the user agent must set the <var title="">thisArg</var> (as defined
+ by ECMAScript edition 5 section 10.4.3 Entering Function Code) to
+ the <a href=#event-handlers title="event handlers">event handler</a>'s object. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ <div class=example>
+
+ <p>For example, the following document fragment:</p>
+
+ <pre>&lt;body onload="alert(this)" onclick="alert(this)"&gt;</pre>
+
+ <p>...leads to an alert saying "<code title="">[object&nbsp;Window]</code>" when the document is loaded,
+ and an alert saying "<code title="">[object&nbsp;HTMLBodyElement]</code>" whenever the user
+ clicks something in the page.</p>
+
+ </div>
+
+ <p>The return value of the function is affects whether the event is
+ canceled or not: <span class=impl>as described above,</span> if
+ the return value is false, the event is canceled (except for <code class=event-mouseover>mouseover</code> events, where the return
+ value has to be true to cancel the event). With <code title=event-beforeunload>beforeunload</code> events, the value is
+ instead used to determine the message to show the user.</p>
+
+
+ <div class=impl>
+
+ <h5 id=event-handlers-on-elements,-document-objects,-and-window-objects><span class=secno>7.1.6.2 </span>Event handlers on elements, <code><a href=#document>Document</a></code> objects, and <code><a href=#window>Window</a></code> objects</h5>
+
+ <p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported by all <a href=#html-elements>HTML
+ elements</a>, as both content attributes and IDL attributes, and
+ on <code><a href=#document>Document</a></code> and <code><a href=#window>Window</a></code> objects, as IDL
+ attributes.</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-onabort title=handler-onabort><code>onabort</code></dfn> <td> <code title=event-abort>abort</code>
+ <tr><td><dfn id=handler-oncanplay title=handler-oncanplay><code>oncanplay</code></dfn> <td> <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code>
+ <tr><td><dfn id=handler-oncanplaythrough title=handler-oncanplaythrough><code>oncanplaythrough</code></dfn> <td> <code title=event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code>
+ <tr><td><dfn id=handler-onchange title=handler-onchange><code>onchange</code></dfn> <td> <code title=event-change>change</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onclick title=handler-onclick><code>onclick</code></dfn> <td> <code title=event-click><a href=#event-click>click</a></code> <!-- widely used -->
+ <tr><td><dfn id=handler-oncontextmenu title=handler-oncontextmenu><code>oncontextmenu</code></dfn> <td> <code title=event-contextmenu>contextmenu</code> <!-- widely used -->
+ <tr><td><dfn id=handler-ondblclick title=handler-ondblclick><code>ondblclick</code></dfn> <td> <code title=event-dblclick>dblclick</code> <!-- widely used -->
+ <tr><td><dfn id=handler-ondrag title=handler-ondrag><code>ondrag</code></dfn> <td> <code title=event-drag><a href=#event-drag>drag</a></code>
+ <tr><td><dfn id=handler-ondragend title=handler-ondragend><code>ondragend</code></dfn> <td> <code title=event-dragend><a href=#event-dragend>dragend</a></code>
+ <tr><td><dfn id=handler-ondragenter title=handler-ondragenter><code>ondragenter</code></dfn> <td> <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code>
+ <tr><td><dfn id=handler-ondragleave title=handler-ondragleave><code>ondragleave</code></dfn> <td> <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code>
+ <tr><td><dfn id=handler-ondragover title=handler-ondragover><code>ondragover</code></dfn> <td> <code title=event-dragover><a href=#event-dragover>dragover</a></code>
+ <tr><td><dfn id=handler-ondragstart title=handler-ondragstart><code>ondragstart</code></dfn> <td> <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> <!-- widely used -->
+ <tr><td><dfn id=handler-ondrop title=handler-ondrop><code>ondrop</code></dfn> <td> <code title=event-drop><a href=#event-drop>drop</a></code>
+ <tr><td><dfn id=handler-ondurationchange title=handler-ondurationchange><code>ondurationchange</code></dfn> <td> <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code>
+ <tr><td><dfn id=handler-onemptied title=handler-onemptied><code>onemptied</code></dfn> <td> <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code>
+ <tr><td><dfn id=handler-onended title=handler-onended><code>onended</code></dfn> <td> <code title=event-media-ended><a href=#event-media-ended>ended</a></code>
+ <tr><td><dfn id=handler-onformchange title=handler-onformchange><code>onformchange</code></dfn> <td> <code title=event-formchange>formchange</code>
+ <tr><td><dfn id=handler-onforminput title=handler-onforminput><code>onforminput</code></dfn> <td> <code title=event-forminput>forminput</code>
+ <tr><td><dfn id=handler-oninput title=handler-oninput><code>oninput</code></dfn> <td> <code title=event-input>input</code>
+ <tr><td><dfn id=handler-oninvalid title=handler-oninvalid><code>oninvalid</code></dfn> <td> <code title=event-invalid>invalid</code>
+ <tr><td><dfn id=handler-onkeydown title=handler-onkeydown><code>onkeydown</code></dfn> <td> <code title=event-keydown>keydown</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onkeypress title=handler-onkeypress><code>onkeypress</code></dfn> <td> <code title=event-keypress>keypress</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onkeyup title=handler-onkeyup><code>onkeyup</code></dfn> <td> <code title=event-keyup>keyup</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onloadeddata title=handler-onloadeddata><code>onloadeddata</code></dfn> <td> <code title=event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code>
+ <tr><td><dfn id=handler-onloadedmetadata title=handler-onloadedmetadata><code>onloadedmetadata</code></dfn> <td> <code title=event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code>
+ <tr><td><dfn id=handler-onloadstart title=handler-onloadstart><code>onloadstart</code></dfn> <td> <code title=event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code>
+ <tr><td><dfn id=handler-onmousedown title=handler-onmousedown><code>onmousedown</code></dfn> <td> <code title=event-mousedown>mousedown</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onmousemove title=handler-onmousemove><code>onmousemove</code></dfn> <td> <code title=event-mousemove>mousemove</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onmouseout title=handler-onmouseout><code>onmouseout</code></dfn> <td> <code title=event-mouseout>mouseout</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onmouseover title=handler-onmouseover><code>onmouseover</code></dfn> <td> <code title=event-mouseover>mouseover</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onmouseup title=handler-onmouseup><code>onmouseup</code></dfn> <td> <code title=event-mouseup>mouseup</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onmousewheel title=handler-onmousewheel><code>onmousewheel</code></dfn> <td> <code title=event-mousewheel>mousewheel</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onpause title=handler-onpause><code>onpause</code></dfn> <td> <code title=event-media-pause><a href=#event-media-pause>pause</a></code>
+ <tr><td><dfn id=handler-onplay title=handler-onplay><code>onplay</code></dfn> <td> <code title=event-media-play><a href=#event-media-play>play</a></code>
+ <tr><td><dfn id=handler-onplaying title=handler-onplaying><code>onplaying</code></dfn> <td> <code title=event-media-playing><a href=#event-media-playing>playing</a></code>
+ <tr><td><dfn id=handler-onprogress title=handler-onprogress><code>onprogress</code></dfn> <td> <code title=event-media-progress><a href=#event-media-progress>progress</a></code>
+ <tr><td><dfn id=handler-onratechange title=handler-onratechange><code>onratechange</code></dfn> <td> <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code>
+ <tr><td><dfn id=handler-onreadystatechange title=handler-onreadystatechange><code>onreadystatechange</code></dfn> <td> <code title=event-readystatechange>readystatechange</code>
+ <tr><td><dfn id=handler-onscroll title=handler-onscroll><code>onscroll</code></dfn> <td> <code title=event-scroll>scroll</code> <!-- widely used --> <!-- [CSSOM] -->
+ <tr><td><dfn id=handler-onseeked title=handler-onseeked><code>onseeked</code></dfn> <td> <code title=event-media-seeked><a href=#event-media-seeked>seeked</a></code>
+ <tr><td><dfn id=handler-onseeking title=handler-onseeking><code>onseeking</code></dfn> <td> <code title=event-media-seeking><a href=#event-media-seeking>seeking</a></code>
+ <tr><td><dfn id=handler-onselect title=handler-onselect><code>onselect</code></dfn> <td> <code title=event-select>select</code> <!-- widely used --> <!-- [CSSOM] -->
+ <tr><td><dfn id=handler-onshow title=handler-onshow><code>onshow</code></dfn> <td> <code title=event-show>show</code>
+ <tr><td><dfn id=handler-onstalled title=handler-onstalled><code>onstalled</code></dfn> <td> <code title=event-media-stalled><a href=#event-media-stalled>stalled</a></code>
+ <tr><td><dfn id=handler-onsubmit title=handler-onsubmit><code>onsubmit</code></dfn> <td> <code title=event-submit>submit</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onsuspend title=handler-onsuspend><code>onsuspend</code></dfn> <td> <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code>
+ <tr><td><dfn id=handler-ontimeupdate title=handler-ontimeupdate><code>ontimeupdate</code></dfn> <td> <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code>
+ <tr><td><dfn id=handler-onvolumechange title=handler-onvolumechange><code>onvolumechange</code></dfn> <td> <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code>
+ <tr><td><dfn id=handler-onwaiting title=handler-onwaiting><code>onwaiting</code></dfn> <td> <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code>
+
+<!-- not supported, use dnd: -->
+<!--<tr><td><dfn title="handler-onbeforecopy"><code>onbeforecopy</code></dfn> <td> <code title="event-beforecopy">beforecopy</code>--> <!-- widely used -->
+<!--<tr><td><dfn title="handler-oncopy"><code>oncopy</code></dfn> <td> <code title="event-copy">copy</code>--> <!-- widely used -->
+<!--<tr><td><dfn title="handler-onpaste"><code>onpaste</code></dfn> <td> <code title="event-paste">paste</code>--> <!-- widely used -->
+<!-- not supported yet (v2?): -->
+<!--<tr><td><dfn title="handler-onselectstart"><code>onselectstart</code></dfn> <td> <code title="event-selectstart">selectstart</code>--> <!-- widely used -->
+ </table><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported by all <a href=#html-elements>HTML
+ elements</a> other than <code><a href=#the-body-element-0>body</a></code>, as both content
+ attributes and IDL attributes, and on <code><a href=#document>Document</a></code> objects,
+ as IDL attributes:</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-onblur title=handler-onblur><code>onblur</code></dfn> <td> <code title=event-blur>blur</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onerror title=handler-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
+ <tr><td><dfn id=handler-onfocus title=handler-onfocus><code>onfocus</code></dfn> <td> <code title=event-focus>focus</code> <!-- widely used -->
+ <tr><td><dfn id=handler-onload title=handler-onload><code>onload</code></dfn> <td> <code title=event-load>load</code>
+ </table><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported by <code><a href=#window>Window</a></code>
+ objects, as IDL attributes on the <code><a href=#window>Window</a></code> object, and
+ with corresponding content attributes and IDL attributes exposed on
+ the <code><a href=#the-body-element-0>body</a></code> and <code><a href=#frameset>frameset</a></code> elements:</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-window-onafterprint title=handler-window-onafterprint><code>onafterprint</code></dfn> <td> <code title=event-afterprint>afterprint</code>
+ <tr><td><dfn id=handler-window-onbeforeprint title=handler-window-onbeforeprint><code>onbeforeprint</code></dfn> <td> <code title=event-beforeprint>beforeprint</code>
+ <tr><td><dfn id=handler-window-onbeforeunload title=handler-window-onbeforeunload><code>onbeforeunload</code></dfn> <td> <code title=event-beforeunload>beforeunload</code>
+ <tr><td><dfn id=handler-window-onblur title=handler-window-onblur><code>onblur</code></dfn> <td> <code title=event-blur>blur</code>
+ <tr><td><dfn id=handler-window-onerror title=handler-window-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
+ <tr><td><dfn id=handler-window-onfocus title=handler-window-onfocus><code>onfocus</code></dfn> <td> <code title=event-focus>focus</code>
+ <tr><td><dfn id=handler-window-onhashchange title=handler-window-onhashchange><code>onhashchange</code></dfn> <td> <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-onload title=handler-window-onload><code>onload</code></dfn> <td> <code title=event-load>load</code> <!-- widely used -->
+ <tr><td><dfn id=handler-window-onmessage title=handler-window-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code> <!-- new for postMessage -->
+ <tr><td><dfn id=handler-window-onoffline title=handler-window-onoffline><code>onoffline</code></dfn> <td> <code title=event-offline><a href=#event-offline>offline</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-ononline title=handler-window-ononline><code>ononline</code></dfn> <td> <code title=event-online><a href=#event-online>online</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-onpagehide title=handler-window-onpagehide><code>onpagehide</code></dfn> <td> <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-onpageshow title=handler-window-onpageshow><code>onpageshow</code></dfn> <td> <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-onpopstate title=handler-window-onpopstate><code>onpopstate</code></dfn> <td> <code title=event-popstate><a href=#event-popstate>popstate</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-onredo title=handler-window-onredo><code>onredo</code></dfn> <td> <code title=event-redo><a href=#event-redo>redo</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-onresize title=handler-window-onresize><code>onresize</code></dfn> <td> <code title=event-resize>resize</code> <!-- widely used --> <!-- [CSSOM] -->
+ <tr><td><dfn id=handler-window-onstorage title=handler-window-onstorage><code>onstorage</code></dfn> <td> <code title=event-storage>storage</code> <!-- new -->
+ <tr><td><dfn id=handler-window-onundo title=handler-window-onundo><code>onundo</code></dfn> <td> <code title=event-undo><a href=#event-undo>undo</a></code> <!-- new -->
+ <tr><td><dfn id=handler-window-onunload title=handler-window-onunload><code>onunload</code></dfn> <td> <code title=event-unload>unload</code> <!-- widely used -->
+ </table><p class=note>The <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code>
+ handler is also used for <a href=#runtime-script-errors>reporting script errors</a>.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=event-firing><span class=secno>7.1.6.3 </span>Event firing</h5>
+
+ <p>Certain operations and methods are defined as firing events on
+ elements. For example, the <code title=dom-click><a href=#dom-click>click()</a></code>
+ method on the <code><a href=#htmlelement>HTMLElement</a></code> interface is defined as
+ firing a <code title=event-click><a href=#event-click>click</a></code> event on the
+ element. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p><dfn id=fire-a-click-event title="fire a click event">Firing a <code title=event-click>click</code> event</dfn> means that a <code title=event-click><a href=#event-click>click</a></code> event, which bubbles and is
+ cancelable, and which uses the <code>MouseEvent</code> interface,
+ must be dispatched at the given target. The event object must have
+ its <code title="">screenX</code>, <code title="">screenY</code>,
+ <code title="">clientX</code>, <code title="">clientY</code>, and
+ <code title="">button</code> attributes set to 0, its <code title="">ctrlKey</code>, <code title="">shiftKey</code>, <code title="">altKey</code>, and <code title="">metaKey</code> attributes
+ set according to the current state of the key input device, if any
+ (false for any keys that are not available), its <code title="">detail</code> attribute set to 1, and its <code title="">relatedTarget</code> attribute set to null. The <code title="">getModifierState()</code> method on the object must return
+ values appropriately describing the state of the key input device at
+ the time the event is created.</p>
+
+ <p><dfn id=fire-a-simple-event title="fire a simple event">Firing a simple event named <var title="">e</var></dfn> means that an event with the name <var title="">e</var>, which does not bubble (except where otherwise
+ stated) and is not cancelable (except where otherwise stated), and
+ which uses the <code><a href=#event>Event</a></code> interface, must be dispatched at
+ the given target.</p>
+
+<!--
+ <p><dfn title="fire a progress event">Firing a progress event named
+ <var title="">e</var></dfn>, optionally in the context of a
+ particular instance of the <span title="fetch">fetching
+ algorithm</span>, means that an event with the name <var
+ title="">e</var>, which does not bubble (except where otherwise
+ stated) and is not cancelable (except where otherwise stated), and
+ which uses the <code>ProgressEvent</code> interface, must be
+ dispatched at the given target element. If there is a <span
+ title="fetch">fetching algorithm</span>, and the <span>URL</span>
+ being <span title="fetch">fetched</span> has the <span>same
+ origin</span> as the <code>Document</code> of the target element,
+ then the <code
+ title="dom-ProgressEvents-lengthComputable">lengthComputable</code>
+ attribute must be set to true if the <span title="fetch">fetching
+ algorithm</span>'s subject has a known <span
+ title="concept-fetch-total">size</span>; the <code
+ title="dom-ProgressEvents-total">total</code> attribute must be set
+ to the subject's <span title="concept-fetch-total">size</span> if it
+ is known and zero otherwise; and the <code
+ title="dom-ProgressEvents-loaded">loaded</code> attribute must be
+ set to the <span title="concept-fetch-loaded">number of bytes
+ downloaded</span>, excluding HTTP headers <span
+ title="concept-http-equivalent-headers">or
+ equivalent</span>. Otherwise, the <code
+ title="dom-ProgressEvents-lengthComputable">lengthComputable</code>
+ attribute must be set to false, and the <code
+ title="dom-ProgressEvents-total">total</code> and the <code
+ title="dom-ProgressEvents-loaded">loaded</code> attributes must be
+ set to zero. <a href="#r-e-f-sPROGRESS">[PROGRESS]</a></p>
+(also fix reference in line above)-->
+
+ <p>The default action of these event is to do nothing except where
+ otherwise stated.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=events-and-the-window-object><span class=secno>7.1.6.4 </span>Events and the <code><a href=#window>Window</a></code> object</h5>
+
+ <p>When an event is dispatched at a DOM node in a
+ <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a>, if the
+ event is not a <code title=event-load>load</code> event, the user
+ agent must also dispatch the event to the <code><a href=#window>Window</a></code>, as
+ follows:</p>
+
+ <ol><li>In the capture phase, the event must propagate to the
+ <code><a href=#window>Window</a></code> object before propagating to any of the nodes,
+ as if the <code><a href=#window>Window</a></code> object was the parent of the
+ <code><a href=#document>Document</a></code> in the dispatch chain.</li>
+
+ <li>In the bubble phase, the event must propagate up to the
+ <code><a href=#window>Window</a></code> object at the end of the phase, unless bubbling
+ has been prevented, again as if the <code><a href=#window>Window</a></code> object was
+ the parent of the <code><a href=#document>Document</a></code> in the dispatch chain.</li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h5 id=runtime-script-errors><span class=secno>7.1.6.5 </span>Runtime script errors</h5>
+
+ <p><i>This section only applies to user agents that support
+ scripting in general and JavaScript in particular.</i></p>
+
+ <p>Whenever an uncaught runtime script error occurs in one of the
+ scripts associated with a <code><a href=#document>Document</a></code>, the user agent must
+ <a href=#report-the-error>report the error</a> using the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> <a href=#event-handlers title="event
+ handlers">event handler</a> of the <a href="#script's-global-object">script's global
+ object</a>. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then
+ the error may be reported to the user.</p>
+
+ <hr><p>When the user agent is required to <dfn id=report-the-error title="report the
+ error">report an error</dfn> <var title="">error</var> using the
+ <a href=#event-handlers title="event handlers">event handler</a> <var title="">onerror</var>, it must run these steps, after which the
+ error is either <dfn id=concept-error-handled title=concept-error-handled><i>handled</i></dfn> or <dfn id=concept-error-nothandled title=concept-error-nothandled><i>not handled</i></dfn>:</p>
+
+ <dl class=switch><dt>If the value of <var title="">onerror</var> is a
+ <code><a href=#function>Function</a></code></dt>
+
+ <dd>
+
+ <p>The function must be invoked with three arguments. The three
+ arguments passed to the function are all <code>DOMString</code>s;
+ the first must give the message that the UA is considering
+ reporting, the second must give the <a href=#absolute-url>absolute URL</a> of
+ the resource in which the error occurred, and the third must give
+ the line number in that resource on which the error occurred.</p>
+
+ <p>If the function returns false, then the error is <i title=concept-error-handled><a href=#concept-error-handled>handled</a></i>. Otherwise, the error is
+ <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>.</p>
+
+ <p>Any uncaught exceptions thrown or errors caused by this
+ function may be reported to the user immediately after the error
+ that the function was called for; the <a href=#report-the-error title="report the
+ error">report an error</a> algorithm must not be used to handle
+ exceptions thrown or errors caused by this function.</p>
+
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>The error is <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>.</p>
+
+ </dd>
+
+ </dl></div>
+
+
+ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>
+
+ <p>The <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
+ and <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval()</a></code>
+ methods allow authors to schedule timer-based callbacks.</p>
+
+<pre class=idl>[Supplemental, NoInterfaceObject]
+interface <dfn id=windowtimers>WindowTimers</dfn> {
+ long <a href=#dom-windowtimers-settimeout title=dom-windowtimers-setTimeout>setTimeout</a>(in any handler, in optional any timeout, in any... args);
+ void <a href=#dom-windowtimers-cleartimeout title=dom-windowtimers-clearTimeout>clearTimeout</a>(in long handle);
+ long <a href=#dom-windowtimers-setinterval title=dom-windowtimers-setInterval>setInterval</a>(in any handler, in optional any timeout, in any... args);
+ void <a href=#dom-windowtimers-clearinterval title=dom-windowtimers-clearInterval>clearInterval</a>(in long handle);
+};
+<a href=#window>Window</a> implements <a href=#windowtimers>WindowTimers</a>;</pre>
+
+ <dl class=domintro><dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout</a></code>( <var title="">handler</var> [, <var title="">timeout</var> [, <var title="">arguments</var> ] ] )</dt>
+
+ <dd>
+
+ <p>Schedules a timeout to run <var title="">handler</var> after
+ <var title="">timeout</var> milliseconds. Any <var title="">arguments</var> are passed straight through to the <var title="">handler</var>.</p>
+
+ </dd>
+
+ <dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout</a></code>( <var title="">code</var> [, <var title="">timeout</var> ] )</dt>
+
+ <dd>
+
+ <p>Schedules a timeout to compile and run <var title="">code</var>
+ after <var title="">timeout</var> milliseconds.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-windowtimers-clearTimeout><a href=#dom-windowtimers-cleartimeout>clearTimeout</a></code>( <var title="">handle</var> )</dt>
+
+ <dd>
+
+ <p>Cancels the timeout set with <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout()</a></code> identified by <var title="">handle</var>.</p>
+
+ </dd>
+
+ <dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval</a></code>( <var title="">handler</var> [, <var title="">timeout</var> [, <var title="">arguments</var> ] ] )</dt>
+
+ <dd>
+
+ <p>Schedules a timeout to run <var title="">handler</var> every
+ <var title="">timeout</var> milliseconds. Any <var title="">arguments</var> are passed straight through to the <var title="">handler</var>.</p>
+
+ </dd>
+
+ <dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval</a></code>( <var title="">code</var> [, <var title="">timeout</var> ] )</dt>
+
+ <dd>
+
+ <p>Schedules a timeout to compile and run <var title="">code</var>
+ every <var title="">timeout</var> milliseconds.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-windowtimers-clearInterval><a href=#dom-windowtimers-clearinterval>clearInterval</a></code>( <var title="">handle</var> )</dt>
+
+ <dd>
+
+ <p>Cancels the timeout set with <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval()</a></code> identified by <var title="">handle</var>.</p>
+
+ </dd>
+
+ </dl><p class=note>This API does not guarantee that timers will fire
+ exactly on schedule. Delays due to CPU load, other tasks, etc, are
+ to be expected.</p>
+
+ <div class=impl>
+
+ <p class=note>The <code><a href=#windowtimers>WindowTimers</a></code> interface adds to the
+ <code><a href=#window>Window</a></code> interface and the <code>WorkerUtils</code>
+ interface (part of Web Workers).</p>
+
+ <p>Each object that implements the <code><a href=#windowtimers>WindowTimers</a></code>
+ interface has a <dfn id=list-of-active-timeouts>list of active timeouts</dfn> and a <dfn id=list-of-active-intervals>list
+ of active intervals</dfn>. Each entry in these lists is identified
+ by a number, which must be unique within its list for the lifetime
+ of the object that implements the <code><a href=#windowtimers>WindowTimers</a></code>
+ interface.</p>
+
+ <hr><p>The <dfn id=dom-windowtimers-settimeout title=dom-windowtimers-setTimeout><code>setTimeout()</code></dfn>
+ method must run the following steps:
+
+ <ol><li><p>Let <var title="">handle</var> be a user-agent-defined integer
+ that is greater than zero that will identify the timeout to be set
+ by this call.</li>
+
+ <li><p>Add an entry to the <a href=#list-of-active-timeouts>list of active timeouts</a> for
+ <var title="">handle</var>.</li>
+
+ <li><p><a href=#get-the-timed-task>Get the timed task</a> <var title="">handle</var> in
+ the <a href=#list-of-active-timeouts>list of active timeouts</a>, and let <var title="">task</var> be the result.</li>
+
+ <li><p><a href=#get-the-timeout>Get the timeout</a>, and let <var title="">timeout</var> be the result.</li>
+
+ <li><p>If the currently running <a href=#concept-task title=concept-task>task</a> is a task that was created by the
+ <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
+ method, and <var title="">timeout</var> is less than 4, then
+ increase <var title="">timeout</var> to 4.</li>
+
+ <li><p>Return <var title="">handle</var>, and then continue running
+ this algorithm asynchronously.</li>
+
+ <li>
+
+ <p>If the <a href=#method-context>method context</a> is a <code><a href=#window>Window</a></code>
+ object, wait until the <code><a href=#document>Document</a></code> associated with the
+ <a href=#method-context>method context</a> has been <a href=#fully-active>fully active</a> for
+ a further <var title="">timeout</var> milliseconds (not
+ necessarily consecutively).</p>
+
+ <p>Otherwise, if the <a href=#method-context>method context</a> is a
+ <code>WorkerUtils</code> object, wait until <var title="">timeout</var> milliseconds have passed with the worker
+ not suspended (not necessarily consecutively).</p>
+
+ <p>Otherwise, act as described in the specification that defines
+ that the <code><a href=#windowtimers>WindowTimers</a></code> interface is implemented by
+ some other object.</p>
+
+ </li>
+
+ <li><p>Wait until any invocations of this algorithm started before
+ this one whose <var title="">timeout</var> is equal to or less than
+ this one's have completed.</li>
+
+ <li><p><a href=#queue-a-task title="queue a task">Queue</a> the <var title="">task</var> <a href=#concept-task title=concept-task>task</a>.</li>
+
+ </ol><p>The <dfn id=dom-windowtimers-cleartimeout title=dom-windowtimers-clearTimeout><code>clearTimeout()</code></dfn>
+ method must clear the entry identified as <var title="">handle</var>
+ from the <a href=#list-of-active-timeouts>list of active timeouts</a> of the
+ <code><a href=#windowtimers>WindowTimers</a></code> object on which the method was invoked,
+ where <var title="">handle</var> is the argument passed to the
+ method.</p>
+
+ <hr><p>The <dfn id=dom-windowtimers-setinterval title=dom-windowtimers-setInterval><code>setInterval()</code></dfn>
+ method must run the following steps:
+
+ <ol><li><p>Let <var title="">handle</var> be a user-agent-defined integer
+ that is greater than zero that will identify the interval to be set
+ by this call.</li>
+
+ <li><p>Add an entry to the <a href=#list-of-active-intervals>list of active intervals</a> for
+ <var title="">handle</var>.</li>
+
+ <li><p><a href=#get-the-timed-task>Get the timed task</a> <var title="">handle</var> in
+ the <a href=#list-of-active-intervals>list of active intervals</a>, and let <var title="">task</var> be the result.</li>
+
+ <li><p><a href=#get-the-timeout>Get the timeout</a>, and let <var title="">timeout</var> be the result.</li>
+
+ <li><p>If <var title="">timeout</var> is less than 10, then
+ increase <var title="">timeout</var> to 10.</li> <!-- (but see
+ note below about IE) -->
+
+ <li><p>Return <var title="">handle</var>, and then continue running
+ this algorithm asynchronously.</li>
+
+ <!-- Note: IE doesn't actually run intervals with duration zero, it
+ aborts roughly here in the algorithm for them. -->
+
+ <li>
+
+ <p><i title="">Wait</i>: If the <a href=#method-context>method context</a> is a
+ <code><a href=#window>Window</a></code> object, wait until the <code><a href=#document>Document</a></code>
+ associated with the <a href=#method-context>method context</a> has been <a href=#fully-active>fully
+ active</a> for a further <var title="">interval</var>
+ milliseconds (not necessarily consecutively).</p>
+
+ <p>Otherwise, if the <a href=#method-context>method context</a> is a
+ <code>WorkerUtils</code> object, wait until <var title="">interval</var> milliseconds have passed with the worker
+ not suspended (not necessarily consecutively).</p>
+
+ <p>Otherwise, act as described in the specification that defines
+ that the <code><a href=#windowtimers>WindowTimers</a></code> interface is implemented by
+ some other object.</p>
+
+ </li>
+
+ <li><p><a href=#queue-a-task title="queue a task">Queue</a> the <var title="">task</var> <a href=#concept-task title=concept-task>task</a>.</li>
+
+ <li><p>Return to the step labeled <i>wait</i>.</li>
+
+ </ol><p>The <dfn id=dom-windowtimers-clearinterval title=dom-windowtimers-clearInterval><code>clearInterval()</code></dfn>
+ method must clear the entry identified as <var title="">handle</var>
+ from the <a href=#list-of-active-intervals>list of active intervals</a> of the
+ <code><a href=#windowtimers>WindowTimers</a></code> object on which the method was invoked,
+ where <var title="">handle</var> is the argument passed to the
+ method.</p>
+
+ <hr><p>The <dfn id=method-context>method context</dfn>, when referenced by the algorithms
+ in this section, is the object on which the method for which the
+ algorithm is running is implemented (a <code><a href=#window>Window</a></code> or
+ <code>WorkerUtils</code> object).</p>
+
+ <p>When the above methods are invoked and try to <dfn id=get-the-timed-task>get the timed
+ task</dfn> <var title="">handle</var> in list <var title="">list</var>,
+ they must run the following steps:</p>
+
+ <ol><li>
+
+ <p>If the first argument to the invoked method is an object that
+ has an internal [[Call]] method, then return a <a href=#concept-task title=concept-task>task</a> that checks if the entry for <var title="">handle</var> in <var title="">list</var> has been cleared,
+ and if it has not, calls the aforementioned [[Call]] method with
+ as its arguments the third and subsequent arguments to the invoked
+ method (if any), and abort these steps.</p>
+
+ <p>Otherwise, continue with the remaining steps.</p>
+
+ </li>
+
+ <li><p>Apply the ToString() abstract operation to the first
+ argument to the method, and let <var title="">script source</var>
+ be the result. <a href=#refsECMA262>[ECMA262]</a></li>
+
+ <li><p>Let <var title="">script language</var> be
+ JavaScript.</li>
+
+ <li>
+
+ <p>If the <a href=#method-context>method context</a> is a <code><a href=#window>Window</a></code>
+ object, let <var title="">global object</var> be the <a href=#method-context>method
+ context</a>, let <var title="">browsing context</var> be the
+ <a href=#browsing-context>browsing context</a> with which <var title="">global
+ object</var> is associated, let <var title="">character
+ encoding</var> be the <a href="#document's-character-encoding" title="document's character
+ encoding">character encoding</a> of the <code><a href=#document>Document</a></code>
+ associated with <var title="">global object</var> (<a href=#sce-not-copy>this is a reference, not a copy</a>), and let
+ <var title="">base URL</var> be the <a href=#document-base-url title="document base
+ URL">base URL</a> of the <code><a href=#document>Document</a></code> associated with
+ <var title="">global object</var> (<a href=#sbu-not-copy>this is
+ a reference, not a copy</a>).</p>
+
+ <p>Otherwise, if the <a href=#method-context>method context</a> is a
+ <code>WorkerUtils</code> object, let <var title="">global
+ object</var>, <var title="">browsing context</var>, <var title="">document</var>, <var title="">character encoding</var>,
+ and <var title="">base URL</var> be the <a href="#script's-global-object">script's global
+ object</a>, <a href="#script's-browsing-context">script's browsing context</a>,
+ <a href="#script's-document">script's document</a>, <a href="#script's-url-character-encoding">script's URL character
+ encoding</a>, and <a href="#script's-base-url">script's base URL</a> (respectively)
+ of the <a href=#concept-script title=concept-script>script</a> that the
+ <span>run a worker</span> algorithm created when it created the
+ <a href=#method-context>method context</a>.</p>
+
+ <p>Otherwise, act as described in the specification that defines
+ that the <code><a href=#windowtimers>WindowTimers</a></code> interface is implemented by
+ some other object.</p>
+
+ </li>
+
+ <li><p>Return a <a href=#concept-task title=concept-task>task</a> that checks
+ if the entry for <var title="">handle</var> in <var title="">list</var> has been cleared, and if it has not, <a href=#create-a-script title="create a script">creates a script</a> using <var title="">script source</var> as the script source, <var title="">scripting language</var> as the scripting language, <var title="">global object</var> as the global object, <var title="">browsing context</var> as the browsing context, <var title="">document</var> as the document, <var title="">character
+ encoding</var> as the URL character encoding, and <var title="">base URL</var> as the base URL.</li>
+
+ </ol><p>When the above methods are to <dfn id=get-the-timeout>get the timeout</dfn>, they
+ must run the following steps:</p>
+
+ <ol><li><p>Let <var title="">timeout</var> be the second argument to
+ the method, or zero if the argument was omitted.</li>
+
+ <li><p>Apply the ToString() abstract operation to <var title="">timeout</var>, and let <var title="">timeout</var>
+ be the result. <a href=#refsECMA262>[ECMA262]</a></li>
+
+ <li><p>Apply the ToNumber() abstract operation to <var title="">timeout</var>, and let <var title="">timeout</var> be the
+ result. <a href=#refsECMA262>[ECMA262]</a></li>
+
+ <li><p>If <var title="">timeout</var> is an Infinity value, a
+ Not-a-Number (NaN) value, or negative, let <var title="">timeout</var> be zero.</li>
+
+ <li><p>Round <var title="">timeout</var> down to the nearest
+ integer, and let <var title="">timeout</var> be the
+ result.</li>
+
+ <li><p>Return <var title="">timeout</var>.</li>
+
+ </ol><hr><p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <dfn id=timer-task-source>timer task
+ source</dfn>.</p>
+
+ </div>
+
+
+
+ <h3 id=user-prompts><span class=secno>7.3 </span>User prompts</h3>
+
+ <!--
+ v2 ideas:
+ * in-window modal dialogs
+ - escape/enter handling
+ - dragging the window out of the tab
+ * in-window non-modal palettes
+ - with a solution for the mobile space
+ -->
+
+ <h4 id=simple-dialogs><span class=secno>7.3.1 </span>Simple dialogs</h4>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-alert><a href=#dom-alert>alert</a></code>(<var title="">message</var>)</dt>
+ <dd>
+
+ <p>Displays a modal alert with the given message, and waits for the user to dismiss it.</p>
+
+ <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
+ method is implied when this method is invoked.</p>
+
+ </dd>
+
+ <dt><var title="">result</var> = <var title="">window</var> . <code title=dom-confirm><a href=#dom-confirm>confirm</a></code>(<var title="">message</var>)</dt>
+ <dd>
+
+ <p>Displays a modal OK/Cancel prompt with the given message, waits
+ for the user to dismiss it, and returns true if the user clicks OK
+ and false if the user clicks Cancel.</p>
+
+ <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
+ method is implied when this method is invoked.</p>
+
+ </dd>
+
+ <dt><var title="">result</var> = <var title="">window</var> . <code title=dom-prompt><a href=#dom-prompt>prompt</a></code>(<var title="">message</var> [, <var title="">default</var>] )</dt>
+ <dd>
+
+ <p>Displays a modal text field prompt with the given message,
+ waits for the user to dismiss it, and returns the value that the
+ user entered. If the user cancels the prompt, then returns null
+ instead. If the second argument is present, then the given value
+ is used as a default.</p>
+
+ <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
+ method is implied when this method is invoked.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-alert title=dom-alert><code>alert(<var title="">message</var>)</code></dfn> method, when invoked, must
+ release the <a href=#storage-mutex>storage mutex</a> and show the given <var title="">message</var> to the user. The user agent may make the
+ method wait for the user to acknowledge the message before
+ returning; if so, the user agent must <a href=#pause>pause</a> while the
+ method is waiting.</p>
+
+ <p>The <dfn id=dom-confirm title=dom-confirm><code>confirm(<var title="">message</var>)</code></dfn> method, when invoked, must
+ release the <a href=#storage-mutex>storage mutex</a> and show the given <var title="">message</var> to the user, and ask the user to respond with
+ a positive or negative response. The user agent must then
+ <a href=#pause>pause</a> as the method waits for the user's response. If
+ the user responds positively, the method must return true, and if
+ the user responds negatively, the method must return false.</p>
+
+ <p>The <dfn id=dom-prompt title=dom-prompt><code>prompt(<var title="">message</var>, <var title="">default</var>)</code></dfn>
+ method, when invoked, must release the <a href=#storage-mutex>storage mutex</a>,
+ show the given <var title="">message</var> to the user, and ask the
+ user to either respond with a string value or abort. The user agent
+ must then <a href=#pause>pause</a> as the method waits for the user's
+ response. The second argument is optional. If the second argument
+ (<var title="">default</var>) is present, then the response must be
+ defaulted to the value given by <var title="">default</var>. If the
+ user aborts, then the method must return null; otherwise, the method
+ must return the string that the user responded with.</p>
+
+ </div>
+
+
+ <h4 id=printing><span class=secno>7.3.2 </span>Printing</h4>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-print><a href=#dom-print>print</a></code>()</dt>
+
+ <dd>
+
+ <p>Prompts the user to print the page.</p>
+
+ <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
+ method is implied when this method is invoked.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-print title=dom-print><code>print()</code></dfn> method,
+ when invoked, must run the <a href=#printing-steps>printing steps</a>.</p>
+
+ <p>User agents should also run the <a href=#printing-steps>printing steps</a>
+ whenever the user asks for the opportunity to <a href=#obtain-a-physical-form>obtain a
+ physical form</a> (e.g. printed copy), or the representation of a
+ physical form (e.g. PDF copy), of a document.</p>
+
+ <p>The <dfn id=printing-steps>printing steps</dfn> are as follows:</p>
+
+ <ol><li>
+
+ <p>The user agent may display a message to the user and/or may
+ abort these steps.</p>
+
+ <p class=example>For instance, a kiosk browser could silently
+ ignore any invocations of the <code title=dom-print><a href=#dom-print>print()</a></code> method.</p>
+
+ <p class=example>For instance, a browser on a mobile device
+ could detect that there are no printers in the vicinity and
+ display a message saying so before continuing to offer a "save to
+ PDF" option.</p>
+
+ </li>
+
+ <li>
+
+ <p>The user agent must <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-beforeprint>beforeprint</code> at the
+ <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code> that is
+ being printed, as well as any <a href=#nested-browsing-context title="nested browsing
+ context">nested browsing contexts</a> in it.</p>
+
+ <p class=example>The <code title=event-beforeprint>beforeprint</code> event can be used
+ to annotate the printed copy, for instance adding the time at
+ which the document was printed.</p>
+
+ </li>
+
+ <li>
+
+ <p>The user agent must release the <a href=#storage-mutex>storage mutex</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>The user agent should offer the user the opportunity to
+ <a href=#obtain-a-physical-form>obtain a physical form</a> (or the representation of a
+ physical form) of the document. The user agent may wait for the
+ user to either accept or decline before returning; if so, the user
+ agent must <a href=#pause>pause</a> while the method is waiting. Even if
+ the user agent doesn't wait at this point, the user agent must use
+ the state of the relevant documents as they are at this point in
+ the algorithm if and when it eventually creates the alternate
+ form.</p>
+
+ </li>
+
+ <li>
+
+ <p>The user agent must <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-afterprint>afterprint</code> at the
+ <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code> that is
+ being printed, as well as any <a href=#nested-browsing-context title="nested browsing
+ context">nested browsing contexts</a> in it.</p>
+
+ <p class=example>The <code title=event-afterprint>afterprint</code> event can be used
+ to revert annotations added in the earlier event, as well as
+ showing post-printing UI. For instance, if a page is walking the
+ user through the steps of applying for a home loan, the script
+ could automatically advance to the next step after having printed
+ a form or other.</p>
+
+ </li>
+
+ </ol></div>
+
+
+ <h4 id=dialogs-implemented-using-separate-documents><span class=secno>7.3.3 </span>Dialogs implemented using separate documents</h4>
+
+ <dl class=domintro><dt><var title="">result</var> = <var title="">window</var> . <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog</a></code>(<var title="">url</var> [, <var title="">argument</var>] )</dt>
+
+ <dd>
+
+ <p>Prompts the user with the given page, waits for that page to
+ close, and returns the return value.</p>
+
+ <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
+ method is implied when this method is invoked.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-showmodaldialog title=dom-showModalDialog><code>showModalDialog(<var title="">url</var>, <var title="">argument</var><!--, <var
+ title="">features</var>-->)</code></dfn> method, when invoked, must
+ cause the user agent to run the following steps:</p>
+
+ <ol><li>
+
+ <p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">url</var> relative to the <a href=#entry-script>entry script</a>'s
+ <a href="#script's-base-url" title="script's base URL">base URL</a>.</p>
+
+ <p>If this fails, then throw a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception
+ and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Release the <a href=#storage-mutex>storage mutex</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the user agent is configured such that this invocation of
+ <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> is
+ somehow disabled, then return the empty string and abort these
+ steps.</p>
+
+ <p class=note>User agents are expected to disable this method in
+ certain cases to avoid user annoyance (e.g. as part of their popup
+ blocker feature). For instance, a user agent could require that a
+ site be white-listed before enabling this method, or the user
+ agent could be configured to only allow one modal dialog at a
+ time.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">the list of background browsing
+ contexts</var> be a list of all the browsing contexts that:</p>
+
+ <ul><li>are part of the same <a href=#unit-of-related-browsing-contexts>unit of related browsing
+ contexts</a> as the browsing context of the
+ <code><a href=#window>Window</a></code> object on which the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was
+ called, and that</li>
+
+ <li>have an <a href=#active-document>active document</a> whose
+ <a href=#origin>origin</a> is the <a href=#same-origin title="same origin">same</a>
+ as the <a href=#origin>origin</a> of the <a href=#concept-script title=concept-script>script</a> that called the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method at
+ the time the method was called,</li> <!-- Note that changing
+ document.domain to talk to another domain doesn't make you able
+ to block that domain -->
+
+ </ul><p>...as well as any browsing contexts that are nested inside any
+ of the browsing contexts matching those conditions.</p>
+
+ </li>
+
+ <li>
+
+ <p>Disable the user interface for all the browsing contexts in
+ <var title="">the list of background browsing contexts</var>. This
+ should prevent the user from navigating those browsing contexts,
+ causing events to be sent to those browsing context, or editing
+ any content in those browsing contexts. However, it does not
+ prevent those browsing contexts from receiving events from sources
+ other than the user, from running scripts, from running
+ animations, and so forth.</p>
+
+ </li>
+
+ <li>
+
+ <p>Create a new <a href=#auxiliary-browsing-context>auxiliary browsing context</a>, with the
+ <a href=#opener-browsing-context>opener browsing context</a> being the browsing context of
+ the <code><a href=#window>Window</a></code> object on which the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was
+ called. The new auxiliary browsing context has no name.</p>
+
+ <p class=note>This <a href=#browsing-context>browsing context</a>'s
+ <code><a href=#document>Document</a></code>s' <code><a href=#window>Window</a></code> objects all implement
+ the <code><a href=#windowmodal>WindowModal</a></code> interface.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the <a href=#dialog-arguments>dialog arguments</a> of the new browsing
+ context be set to the value of <var title="">argument</var>, or
+ the 'undefined' value if the argument was omitted.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let the <a href="#dialog-arguments'-origin">dialog arguments' origin</a> be the
+ <a href=#origin>origin</a> of the <a href=#concept-script title=concept-script>script</a> that called the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>
+
+ </li>
+
+ <li>
+
+ <p><a href=#navigate>Navigate</a> the new <a href=#browsing-context>browsing context</a> to
+ the <a href=#absolute-url>absolute URL</a> that resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> <var title="">url</var>
+ earlier, with <a href=#replacement-enabled>replacement enabled</a>, and with the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the
+ <a href=#concept-script title=concept-script>script</a> that invoked the method
+ as the <a href=#source-browsing-context>source browsing context</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p><a href=#spin-the-event-loop>Spin the event loop</a> until the new <a href=#browsing-context>browsing
+ context</a> is closed. (The user agent must allow the user to
+ indicate that the <a href=#browsing-context>browsing context</a> is to be
+ closed.)</p>
+
+ </li>
+
+ <li>
+
+ <p>Reenable the user interface for all the browsing contexts in
+ <var title="">the list of background browsing contexts</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Return the <a href=#auxiliary-browsing-context>auxiliary browsing context</a>'s
+ <a href=#return-value>return value</a>.</p>
+
+ </li>
+
+ </ol><p>The <code><a href=#window>Window</a></code> objects of <code><a href=#document>Document</a></code>s hosted
+ by <a href=#browsing-context title="browsing context">browsing contexts</a> created
+ by the above algorithm must all have the <code><a href=#windowmodal>WindowModal</a></code>
+ interface added to their <code><a href=#window>Window</a></code> interface:</p>
+
+ </div>
+
+ <pre class=idl>[Supplemental, NoInterfaceObject] interface <dfn id=windowmodal>WindowModal</dfn> {
+ readonly attribute any <a href=#dom-windowmodal-dialogarguments title=dom-WindowModal-dialogArguments>dialogArguments</a>;
+ attribute DOMString <a href=#dom-windowmodal-returnvalue title=dom-WindowModal-returnValue>returnValue</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-WindowModal-dialogArguments><a href=#dom-windowmodal-dialogarguments>dialogArguments</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <var title="">argument</var> argument that was
+ passed to the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-WindowModal-returnValue><a href=#dom-windowmodal-returnvalue>returnValue</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the current return value for the window.</p>
+
+ <p>Can be set, to change the value that will be returned by the
+ <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code>
+ method.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Such browsing contexts have associated <dfn id=dialog-arguments>dialog
+ arguments</dfn>, which are stored along with the <dfn id="dialog-arguments'-origin">dialog
+ arguments' origin</dfn>. These values are set by the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method in the
+ algorithm above, when the browsing context is created, based on the
+ arguments provided to the method.</p>
+
+ <p>The <dfn id=dom-windowmodal-dialogarguments title=dom-WindowModal-dialogArguments><code>dialogArguments</code></dfn>
+ IDL attribute, on getting, must check whether its browsing context's
+ <a href=#active-document>active document</a>'s <a href=#origin>origin</a> is the <a href=#same-origin title="same origin">same</a> as the <a href="#dialog-arguments'-origin">dialog arguments'
+ origin</a>. If it is, then the browsing context's <a href=#dialog-arguments>dialog
+ arguments</a> must be returned unchanged. Otherwise, if the
+ <a href=#dialog-arguments>dialog arguments</a> are an object, then the empty string
+ must be returned, and if the <a href=#dialog-arguments>dialog arguments</a> are not
+ an object, then the stringification of the <a href=#dialog-arguments>dialog
+ arguments</a> must be returned.
+
+ <p>These browsing contexts also have an associated <dfn id=return-value>return
+ value</dfn>. The <a href=#return-value>return value</a> of a browsing context
+ must be initialized to the empty string when the browsing context is
+ created.</p>
+
+ <p>The <dfn id=dom-windowmodal-returnvalue title=dom-WindowModal-returnValue><code>returnValue</code></dfn>
+ IDL attribute, on getting, must return the <a href=#return-value>return value</a>
+ of its browsing context, and on setting, must set the <a href=#return-value>return
+ value</a> to the given new value.</p>
+
+ </div>
+
+ <p class=note>The <code title=dom-window-close><a href=#dom-window-close>window.close()</a></code> method can be used to
+ close the browsing context.</p>
+
+
+
+
+ <h3 id=system-state-and-capabilities><span class=secno>7.4 </span>System state and capabilities</h3>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-navigator title=dom-navigator><code>navigator</code></dfn>
+ attribute of the <code><a href=#window>Window</a></code> interface must return an
+ instance of the <code><a href=#navigator>Navigator</a></code> interface, which represents
+ the identity and state of the user agent (the client), and allows
+ Web pages to register themselves as potential protocol and content
+ handlers:</p>
+
+ </div>
+
+ <pre class=idl>interface <dfn id=navigator>Navigator</dfn> {
+ // objects implementing this interface also implement the interfaces given below
+};
+<a href=#navigator>Navigator</a> implements <a href=#navigatorid>NavigatorID</a>;
+<a href=#navigator>Navigator</a> implements <a href=#navigatoronline>NavigatorOnLine</a>;
+<a href=#navigator>Navigator</a> implements <a href=#navigatorabilities>NavigatorAbilities</a>;
+
+[Supplemental, NoInterfaceObject]
+interface <dfn id=navigatorid>NavigatorID</dfn> {<!--
+ readonly attribute DOMString <span title="dom-navigator-appCodeName">appCodeName</span>;-->
+ readonly attribute DOMString <a href=#dom-navigator-appname title=dom-navigator-appName>appName</a>;
+ readonly attribute DOMString <a href=#dom-navigator-appversion title=dom-navigator-appVersion>appVersion</a>;
+ readonly attribute DOMString <a href=#dom-navigator-platform title=dom-navigator-platform>platform</a>;
+ readonly attribute DOMString <a href=#dom-navigator-useragent title=dom-navigator-userAgent>userAgent</a>;
+};
+
+[Supplemental, NoInterfaceObject]
+interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {
+ readonly attribute boolean <a href=#dom-navigator-online title=dom-navigator-onLine>onLine</a>;
+};
+
+[Supplemental, NoInterfaceObject]
+interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
+ // content handler registration
+ void <a href=#dom-navigator-registerprotocolhandler title=dom-navigator-registerProtocolHandler>registerProtocolHandler</a>(in DOMString scheme, in DOMString url, in DOMString title);
+ void <a href=#dom-navigator-registercontenthandler title=dom-navigator-registerContentHandler>registerContentHandler</a>(in DOMString mimeType, in DOMString url, in DOMString title);
+ void <a href=#dom-navigator-yieldforstorageupdates title=dom-navigator-yieldForStorageUpdates>yieldForStorageUpdates</a>();
+<!-- v2: cookieEnabled geolocator javaEnabled mozIsLocallyAvailable preference
+ readonly attribute <span>MimeTypeArray</span> <span title="dom-navigator-mimeTypes">mimeTypes</span>;
+ readonly attribute <span>PluginArray</span> <span title="dom-navigator-plugins">plugins</span>;
+ (the latter is used in a <video> element demo now, so we might need to pull this forward from v2!)
+-->};</pre>
+
+ <div class=impl>
+
+ <p>These interfaces are defined separately so that other
+ specifications can re-use parts of the <code><a href=#navigator>Navigator</a></code>
+ interface.</p>
+
+ <!-- v2: also, see window.external.AddSearchProvider() and similar DOM APIs from IE -->
+
+ <!-- v2: also, could expose languages:
+ <dt><dfn title="dom-navigator-browserLanguage"><code>browserLanguage</code></dfn></dt> <!- - Opera and IE only - ->
+ <dd><p>Must return either null or a language tag representing the language the browser uses in its interface.</p></dd>
+ <dt><dfn title="dom-navigator-userLanguage"><code>userLanguage</code></dfn></dt> <!- - Opera and IE only - ->
+ <dt><dfn title="dom-navigator-language"><code>language</code></dfn></dt> <!- - Opera, Safari, and Mozilla only - ->
+ <dd><p>Must return either null or a language tag representing the user's preferred language.</p></dd>
+ -->
+
+ </div>
+
+
+ <h4 id=client-identification><span class=secno>7.4.1 </span>Client identification</h4>
+
+ <p>In certain cases, despite the best efforts of the entire
+ industry, Web browsers have bugs and limitations that Web authors
+ are forced to work around.</p>
+
+ <p>This section defines a collection of attributes that can be used
+ to determine, from script, the kind of user agent in use, in order
+ to work around these issues.</p>
+
+ <p>Client detection should always be limited to detecting known
+ current versions; future versions and unknown versions should always
+ be assumed to be fully compliant.</p>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-appName><a href=#dom-navigator-appname>appName</a></code></dt>
+ <dd>
+ <p>Returns the name of the browser.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-appVersion><a href=#dom-navigator-appversion>appVersion</a></code></dt>
+ <dd>
+ <p>Returns the version of the browser.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-platform><a href=#dom-navigator-platform>platform</a></code></dt>
+ <dd>
+ <p>Returns the name of the platform.</p>
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-userAgent><a href=#dom-navigator-useragent>userAgent</a></code></dt>
+ <dd>
+ <p>Returns the complete User-Agent header.</p>
+ </dd>
+
+ </dl><div class=impl>
+
+ <dl><!-- redundant
+ <dt><dfn title="dom-navigator-appCodeName"><code>appCodeName</code></dfn></dt>
+ <dd><p>Must return the string "<code title="">Mozilla</code>".</p></dd>
+ --><!-- appMinorVersion: IE only. In IE8b1, returns " Beta" (with the space) --><dt><dfn id=dom-navigator-appname title=dom-navigator-appName><code>appName</code></dfn></dt>
+ <dd><p>Must return either the string "<code title="">Netscape</code>" or the full name of the browser, e.g. "<code title="">Mellblom Browsernator</code>".</dd>
+
+ <dt><dfn id=dom-navigator-appversion title=dom-navigator-appVersion><code>appVersion</code></dfn></dt>
+ <dd><p>Must return either the string "<code title="">4.0</code>" or a string representing the version of the browser in detail, e.g. "<code title="">1.0 (VMS; en-US) Mellblomenator/9000</code>".</dd>
+
+ <!-- buildID: Mozilla only -->
+
+ <!-- oscpu: Mozilla only -->
+
+ <dt><dfn id=dom-navigator-platform title=dom-navigator-platform><code>platform</code></dfn></dt>
+ <dd><p>Must return either the empty string or a string representing the platform on which the browser is executing, e.g. "<code title="">MacIntel</code>", "<code title="">Win32</code>", "<code title="">FreeBSD i386</code>", "<code title="">WebTV OS</code>".</dd>
+
+ <!-- product: Mozilla and Safari only; always returns "Gecko" -->
+
+ <!-- productSub: Mozilla and Safari only; returns same as buildID in Mozilla, and returns the fixed string "20030107" in Safari -->
+
+ <!-- securityPolicy: Mozilla only; always returns "" -->
+
+ <!-- taintEnabled(): Opera, IE and Mozilla have this function as one that always returns false -->
+
+ <dt><dfn id=dom-navigator-useragent title=dom-navigator-userAgent><code>userAgent</code></dfn></dt>
+ <dd><p>Must return the string used for the value of the "<code title="">User-Agent</code>" header in HTTP requests, or the empty string if no such header is ever sent.</dd>
+
+ <!-- vendor: Mozilla and Safari only; always returns "" in Mozilla, and returns the fixed string "Apple Computer, Inc." in Safari -->
+
+ <!-- vendorSub: Mozilla and Safari only; always returns "" -->
+
+ </dl></div>
+
+
+ <h4 id=custom-handlers><span class=secno>7.4.2 </span>Custom scheme and content handlers</h4>
+
+ <p>The <dfn id=dom-navigator-registerprotocolhandler title=dom-navigator-registerProtocolHandler><code>registerProtocolHandler()</code></dfn>
+ method allows Web sites to register themselves as possible handlers
+ for particular schemes. For example, an online telephone messaging
+ service could register itself as a handler of the <code>sms:</code>
+ scheme (<a href=#refsRFC5724>[RFC5724]</a>), so that if the user
+ clicks on such a link, he is given the opportunity to use that Web
+ site. Analogously, the <dfn id=dom-navigator-registercontenthandler title=dom-navigator-registerContentHandler><code>registerContentHandler()</code></dfn>
+ method allows Web sites to register themselves as possible handlers
+ for content in a particular <a href=#mime-type>MIME type</a>. For example, the
+ same online telephone messaging service could register itself as a
+ handler for <code>text/directory</code> files (<a href=#refsRFC2425>[RFC2425]</a>), so that if the user has no
+ native application capable of handling vCards (<a href=#refsRFC2426>[RFC2426]</a>), his Web browser can instead
+ suggest he use that site to view contact information stored on
+ vCards that he opens.</p>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler</a></code>(<var title="">scheme</var>, <var title="">url</var>, <var title="">title</var>)</dt>
+ <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler</a></code>(<var title="">mimeType</var>, <var title="">url</var>, <var title="">title</var>)</dt>
+
+ <dd>
+
+ <p>Registers a handler for the given scheme or content type, at
+ the given URL, with the given title.</p>
+
+ <p>The string "<code title="">%s</code>" in the URL is used as a
+ placeholder for where to put the URL of the content to be
+ handled.</p>
+
+ <p>Throws a <code><a href=#security_err>SECURITY_ERR</a></code> exception if the user agent
+ blocks the registration (this might happen if trying to register
+ as a handler for "http", for instance).</p>
+
+ <p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> if the "<code title="">%s</code>" string is missing in the URL.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>User agents may, within the constraints described in this
+ section, do whatever they like when the methods are called. A UA
+ could, for instance, prompt the user and offer the user the
+ opportunity to add the site to a shortlist of handlers, or make the
+ handlers his default, or cancel the request. UAs could provide such
+ a UI through modal UI or through a non-modal transient notification
+ interface. UAs could also simply silently collect the information,
+ providing it only when relevant to the user.</p>
+
+ <p>User agents should keep track of which sites have registered
+ handlers (even if the user has declined such registrations) so that
+ the user is not repeatedly prompted with the same request.</p>
+
+ <p>The arguments to the methods have the following meanings and
+ corresponding implementation requirements:</p>
+
+ <dl><dt><var title="">protocol</var> (<code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> only)</dt>
+
+ <dd>
+
+ <p>A scheme, such as <code>ftp</code> or <code>sms</code>. The
+ scheme must be compared in an <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
+ manner by user agents for the purposes of comparing with the
+ scheme part of URLs that they consider against the list of
+ registered handlers.</p>
+
+ <p>The <var title="">scheme</var> value, if it contains a colon
+ (as in "<code>ftp:</code>"), will never match anything, since
+ schemes don't contain colons.</p>
+
+ <p class=note>This feature is not intended to be used with
+ non-standard protocols.</p>
+
+ </dd>
+
+ <dt><var title="">mimeType</var> (<code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> only)</dt>
+
+ <dd>
+
+ <p>A <a href=#mime-type>MIME type</a>, such as
+ <code>model/vnd.flatland.3dml</code> or
+ <code>application/vnd.google-earth.kml+xml</code>. The <a href=#mime-type>MIME
+ type</a> must be compared in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner by user agents for the purposes of
+ comparing with MIME types of documents that they consider against
+ the list of registered handlers.</p>
+
+ <p>User agents must compare the given values only to the MIME
+ type/subtype parts of content types, not to the complete type
+ including parameters. Thus, if <var title="">mimeType</var> values
+ passed to this method include characters such as commas or
+ whitespace, or include MIME parameters, then the handler being
+ registered will never be used.</p>
+
+ <p class=note>The type is compared to the <a href=#mime-type>MIME type</a>
+ used by the user agent <em>after</em> the sniffing algorithms have
+ been applied.</p>
+
+ </dd>
+
+
+ <dt><var title="">url</var></dt>
+
+ <dd>
+
+ <p>A string used to build the <a href=#url>URL</a> of the page that
+ will handle the requests.</p>
+
+ <p>When the user agent uses this URL, it must replace the first
+ occurrence of the exact literal string "<code title="">%s</code>"
+ with an escaped version of the <a href=#absolute-url>absolute URL</a> of the
+ content in question (as defined below), then <a href=#resolve-a-url title="resolve
+ a url">resolve</a> the resulting URL, relative to the <a href="#script's-base-url" title="script's base URL">base URL</a> of the <a href=#entry-script>entry
+ script</a> at the time the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>
+ or <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code>
+ methods were invoked, and then <a href=#navigate>navigate</a> an
+ appropriate <a href=#browsing-context>browsing context</a> to the resulting URL
+ using the GET method (<a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
+ equivalent</a> for non-HTTP URLs).</p>
+
+ <p>To get the escaped version of the <a href=#absolute-url>absolute URL</a> of
+ the content in question, the user agent must replace every
+ character in that <a href=#absolute-url>absolute URL</a> that doesn't match the
+ &lt;query&gt; production defined in RFC 3986 by the
+ percent-encoded form of that character. <a href=#refsRFC3986>[RFC3986]</a></p>
+
+ <div class=example>
+
+ <p>If the user had visited a site at <code title="">http://example.com/</code> that made the following
+ call:</p>
+
+ <pre>navigator.registerContentHandler('application/x-soup', 'soup?url=%s', 'SoupWeb&trade;')</pre>
+
+ <p>...and then, much later, while visiting <code title="">http://www.example.net/</code>, clicked on a link such
+ as:</p>
+
+ <pre>&lt;a href="chickenk&iuml;wi.soup"&gt;Download our Chicken K&iuml;wi soup!&lt;/a&gt;</pre>
+
+ <p>...then, assuming this <code>chickenk&iuml;wi.soup</code> file
+ was served with the <a href=#mime-type>MIME type</a>
+ <code>application/x-soup</code>, the UA might navigate to the
+ following URL:</p>
+
+ <pre>http://example.com/soup?url=http://www.example.net/chickenk%C3%AFwi.soup</pre>
+
+ <p>This site could then fetch the <code>chickenk&iuml;wi.soup</code>
+ file and do whatever it is that it does with soup (synthesize it
+ and ship it to the user, or whatever).</p>
+
+ </div>
+
+ </dd>
+
+ <dt><var title="">title</var></dt>
+
+ <dd>
+
+ <p>A descriptive title of the handler, which the UA might use to
+ remind the user what the site in question is.</p>
+
+ </dd>
+
+ </dl><p>User agents should raise <code><a href=#security_err>SECURITY_ERR</a></code> exceptions if
+ the methods are called with <var title="">scheme</var> or <var title="">mimeType</var> values that the UA deems to be
+ "privileged". For example, a site attempting to register a handler
+ for <code>http</code> URLs or <code><a href=#text/html>text/html</a></code> content in a
+ Web browser would likely cause an exception to be raised.</p>
+
+ <p>User agents must raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if the
+ <var title="">url</var> argument passed to one of these methods does
+ not contain the exact literal string "<code>%s</code>", or if <a href=#resolve-a-url title="resolve a url">resolving</a> the <var title="">url</var>
+ argument with the first occurrence of the string "<code title="">%s</code>" removed, relative to the <a href=#entry-script>entry
+ script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, is
+ not successful.</p>
+
+ <p>User agents must not raise any other exceptions (other than
+ binding-specific exceptions, such as for an incorrect number of
+ arguments in an JavaScript implementation).</p>
+
+ <p>This section does not define how the pages registered by these
+ methods are used, beyond the requirements on how to process the <var title="">url</var> value (see above). To some extent, the <a href=#navigate title=navigate>processing model for navigating across
+ documents</a> defines some cases where these methods are
+ relevant, but in general UAs may use this information wherever they
+ would otherwise consider handing content to native plugins or helper
+ applications.</p>
+
+ <p>UAs must not use registered content handlers to handle content
+ that was returned as part of a non-GET transaction (or rather, as
+ part of any non-idempotent transaction), as the remote site would
+ not be able to fetch the same data.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=security-and-privacy><span class=secno>7.4.2.1 </span>Security and privacy</h5>
+
+ <p>These mechanisms can introduce a number of concerns, in
+ particular privacy concerns.</p>
+
+ <p><strong>Hijacking all Web usage.</strong> User agents should not
+ allow schemes that are key to its normal operation, such as
+ <code>http</code> or <code>https</code>, to be rerouted through
+ third-party sites. This would allow a user's activities to be
+ trivially tracked, and would allow user information, even in secure
+ connections, to be collected.</p>
+
+ <p><strong>Hijacking defaults.</strong> It is strongly recommended
+ that user agents do not automatically change any defaults, as this
+ could lead the user to send data to remote hosts that the user is
+ not expecting. New handlers registering themselves should never
+ automatically cause those sites to be used.</p>
+
+ <p><strong>Registration spamming.</strong> User agents should
+ consider the possibility that a site will attempt to register a
+ large number of handlers, possibly from multiple domains (e.g. by
+ redirecting through a series of pages each on a different domain,
+ and each registering a handler for <code>video/mpeg</code> &mdash;
+ analogous practices abusing other Web browser features have been
+ used by pornography Web sites for many years). User agents should
+ gracefully handle such hostile attempts, protecting the user.</p>
+
+ <p><strong>Misleading titles.</strong> User agents should not rely
+ wholly on the <var title="">title</var> argument to the methods when
+ presenting the registered handlers to the user, since sites could
+ easily lie. For example, a site <code>hostile.example.net</code>
+ could claim that it was registering the "Cuddly Bear Happy Content
+ Handler". User agents should therefore use the handler's domain in
+ any UI along with any title.</p>
+
+ <p><strong>Hostile handler metadata.</strong> User agents should
+ protect against typical attacks against strings embedded in their
+ interface, for example ensuring that markup or escape characters in
+ such strings are not executed, that null bytes are properly handled,
+ that over-long strings do not cause crashes or buffer overruns, and
+ so forth.</p>
+
+ <p><strong>Leaking Intranet URLs.</strong> The mechanism described
+ in this section can result in secret Intranet URLs being leaked, in
+ the following manner:</p>
+
+ <ol><li>The user registers a third-party content handler as the default
+ handler for a content type.</li>
+
+ <li>The user then browses his corporate Intranet site and accesses
+ a document that uses that content type.</li>
+
+ <li>The user agent contacts the third party and hands the third
+ party the URL to the Intranet content.</li>
+
+ </ol><p>No actual confidential file data is leaked in this manner, but
+ the URLs themselves could contain confidential information. For
+ example, the URL could be
+ <code>http://www.corp.example.com/upcoming-aquisitions/the-sample-company.egf</code>,
+ which might tell the third party that Example Corporation is
+ intending to merge with The Sample Company. Implementors might wish
+ to consider allowing administrators to disable this feature for
+ certain subdomains, content types, or schemes.</p>
+
+ <p><strong>Leaking secure URLs.</strong> User agents should not send
+ HTTPS URLs to third-party sites registered as content handlers, in
+ the same way that user agents do not send <code title=http-referer>Referer</code> (sic) HTTP headers from secure
+ sites to third-party sites.</p>
+
+ <p><strong>Leaking credentials.</strong> User agents must never send
+ username or password information in the URLs that are escaped and
+ included sent to the handler sites. User agents may even avoid
+ attempting to pass to Web-based handlers the URLs of resources
+ that are known to require authentication to access, as such sites
+ would be unable to access the resources in question without
+ prompting the user for credentials themselves (a practice that would
+ require the user to know whether to trust the third-party handler, a
+ decision many users are unable to make or even understand).</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h5 id=sample-handler-impl><span class=secno>7.4.2.2 </span>Sample user interface</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>A simple implementation of this feature for a desktop Web browser
+ might work as follows.</p>
+
+ <p>The <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>
+ method could display a modal dialog box:</p>
+
+ <p><img alt="The modal dialog box could have the title 'Content Handler Registration', and could say 'This Web page: Kittens at work http://kittens.example.org/ ...would like permission to handle files of type: application/x-meowmeow using the following Web-based application: Kittens-at-work displayer http://kittens.example.org/?show=%s Do you trust the administrators of the &quot;kittens.example.org&quot; domain?' with two buttons, 'Trust kittens.example.org' and 'Cancel'." src=images/sample-content-handler-registration.png></p>
+
+ <p>In this dialog box, "Kittens at work" is the title of the page
+ that invoked the method, "http://kittens.example.org/" is the URL of
+ that page, "application/x-meowmeow" is the string that was passed to
+ the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>
+ method as its first argument (<var title="">mimeType</var>),
+ "http://kittens.example.org/?show=%s" was the second argument (<var title="">url</var>), and "Kittens-at-work displayer" was the third
+ argument (<var title="">title</var>).</p>
+
+ <p>If the user clicks the Cancel button, then nothing further
+ happens. If the user clicks the "Trust" button, then the handler is
+ remembered.</p>
+
+ <p>When the user then attempts to fetch a URL that uses the
+ "application/x-meowmeow" <a href=#mime-type>MIME type</a>, then it might
+ display a dialog as follows:</p>
+
+ <p><img alt="The dialog box could have the title 'Unknown File Type' and could say 'You have attempted to access:' followed by a URL, followed by a prompt such as 'How would you like FerretBrowser to handle this resource?' with three radio buttons, one saying 'Contact the FerretBrowser plugin registry to see if there is an official way to handle this resource.', one saying 'Pass this URL to a local application' with an application selector, and one saying 'Pass this URL to the &quot;Kittens-at-work displayer&quot; application at &quot;kittens.example.org&quot;', with a checkbox labeld 'Always do this for resources using the &quot;application/x-meowmeow&quot; type in future.', and with two buttons, 'Ok' and 'Cancel'." src=images/sample-content-handler.png></p>
+
+ <p>In this dialog, the third option is the one that was primed by
+ the site registering itself earlier.</p>
+
+ <p>If the user does select that option, then the browser, in
+ accordance with the requirements described in the previous two
+ sections, will redirect the user to
+ "http://kittens.example.org/?show=data%3Aapplication/x-meowmeow;base64,S2l0dGVucyBhcmUgdGhlIGN1dGVzdCE%253D".</p>
+
+ <p>The <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code>
+ method would work equivalently, but for schemes instead of unknown
+ content types.</p>
+
+ </div>
+
+
+
+ <h4 id=manually-releasing-the-storage-mutex><span class=secno>7.4.3 </span>Manually releasing the storage mutex</h4>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>yieldForStorageUpdates</a></code>()</dt>
+
+ <dd>
+
+ <p>If a script uses the <code title=dom-document-cookie><a href=#dom-document-cookie>document.cookie</a></code> API, or the
+ <code title=dom-localStorage>localStorage</code> API, the
+ browser will block other scripts from accessing cookies or storage
+ until the first script finishes.
+
+ <a href=#refsWEBSTORAGE>[WEBSTORAGE]</a>
+
+ </p>
+
+ <p>Calling the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
+ method tells the user agent to unblock any other scripts that may
+ be blocked, even though the script hasn't returned.</p>
+
+ <p>Values of cookies and items in the <code>Storage</code> objects
+ of <code title=dom-localStorage>localStorage</code> attributes
+ can change after calling this method, whence its name.
+
+ <a href=#refsWEBSTORAGE>[WEBSTORAGE]</a>
+
+ </p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-navigator-yieldforstorageupdates title=dom-navigator-yieldForStorageUpdates><code>yieldForStorageUpdates()</code></dfn>
+ method, when invoked, must, if the <a href=#storage-mutex>storage mutex</a> is
+ owned by the <a href=#event-loop>event loop</a> of the <a href=#concept-task title=concept-task>task</a> that resulted in the method being
+ called, release the <a href=#storage-mutex>storage mutex</a> so that it is once
+ again free. Otherwise, it must do nothing.</p>
+
+ </div>
+
+
+
+
+ <h2 id=editing><span class=secno>8 </span><dfn>User interaction</dfn></h2>
+
+
+ <h3 id=the-hidden-attribute><span class=secno>8.1 </span>The <dfn title=attr-hidden><code>hidden</code></dfn> attribute</h3>
+
+ <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> content attribute set. The <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute is a <a href=#boolean-attribute>boolean
+ attribute</a>. When specified on an element, it indicates that
+ the element is not yet, or is no longer, relevant. <span class=impl>User agents should not render elements that have the
+ <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute
+ specified.</span></p>
+
+ <div class=example>
+
+ <p>In the following skeletal example, the attribute is used to hide
+ the Web game's main screen until the user logs in:</p>
+
+ <pre> &lt;h1&gt;The Example Game&lt;/h1&gt;
+ &lt;section id="login"&gt;
+ &lt;h2&gt;Login&lt;/h2&gt;
+ &lt;form&gt;
+ ...
+ &lt;!-- calls login() once the user's credentials have been checked --&gt;
+ &lt;/form&gt;
+ &lt;script&gt;
+ function login() {
+ // switch screens
+ document.getElementById('login').hidden = true;
+ document.getElementById('game').hidden = false;
+ }
+ &lt;/script&gt;
+ &lt;/section&gt;
+ &lt;section id="game" hidden&gt;
+ ...
+ &lt;/section&gt;</pre>
+
+ </div>
+
+ <p>The <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute must not be
+ used to hide content that could legitimately be shown in another
+ presentation. For example, it is incorrect to use <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> to hide panels in a tabbed dialog,
+ because the tabbed interface is merely a kind of overflow
+ presentation &mdash; one could equally well just show all the form
+ controls in one big page with a scrollbar. It is similarly incorrect
+ to use this attribute to hide content just from one presentation
+ &mdash; if something is marked <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>, it is hidden from all
+ presentations, including, for instance, screen readers.</p>
+
+ <!-- for example, "<a hidden href=#content>Skip to content</a>" would be inappropriate. -->
+ <!-- (but only add that example if you first add some more good valid examples -->
+
+ <p>Elements that are not <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>
+ should not link to or refer to elements that are <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>.</p>
+
+ <div class=example>
+
+ <p>For example, it would be incorrect to use the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute to link to a
+ section marked with the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>
+ attribute. If the content is not applicable or relevant, then there
+ is no reason to link to it.</p>
+
+ <p>It would similarly be incorrect to use the ARIA <code title=attr-aria-describedby>aria-describedby</code> attribute to
+ refer to descriptions that are themselves <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>. Hiding a section means that it
+ is not applicable or relevant to anyone at the current time, so
+ clearly it cannot be a valid description of content the user can
+ interact with.</p>
+
+ </div>
+
+ <p>Elements in a section hidden by the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute are still active,
+ e.g. scripts and form controls in such sections still execute
+ and submit respectively. Only their presentation to the user
+ changes.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-hidden title=dom-hidden><code>hidden</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
+ </div>
+
+
+
+ <h3 id=activation><span class=secno>8.2 </span>Activation</h3>
+
+ <!-- v2 idea: HTMLImageElement.click(x, y); or clickPoint(), if
+ click() can't be done in IE; can this be emulated in IE by
+ posting a synthetic mouse click event with those X and Y
+ coords? (ack Csaba Gabor)
+ -->
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-click><a href=#dom-click>click</a></code>()</dt>
+
+ <dd>
+
+ <p>Acts as if the element was clicked.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Each element has a <var title="">click in progress</var> flag,
+ initially set to false.</p>
+
+ <p>The <dfn id=dom-click title=dom-click><code>click()</code></dfn> method must
+ run these steps:</p>
+
+ <ol><li><p>If the element's <var title="">click in progress</var> flag
+ is set to true, then abort these steps.</li>
+
+ <li><p>Set the <var title="">click in progress</var> flag on the
+ element to true.</li>
+
+ <li><p>If the element has a defined <a href=#activation-behavior>activation behavior</a>,
+ <a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> on the
+ element. Otherwise, <a href=#fire-a-click-event>fire a <code>click</code> event</a> at
+ the element.</li>
+
+ <li><p>Set the <var title="">click in progress</var> flag on the
+ element to false.</li>
+
+ </ol></div>
+
+
+ <h3 id=scrolling-elements-into-view><span class=secno>8.3 </span>Scrolling elements into view</h3> <!-- maybe this should move to [CSSOM] -->
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-scrollIntoView><a href=#dom-scrollintoview>scrollIntoView</a></code>( [ <var title="">top</var> ] )</dt>
+
+ <dd>
+
+ <p>Scrolls the element into view. If the <var title="">top</var>
+ argument is true, then the element will be scrolled to the top of
+ the viewport, otherwise it'll be scrolled to the bottom. The
+ default is the top.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-scrollintoview title=dom-scrollIntoView><code>scrollIntoView([<var title="">top</var>])</code></dfn> method, when called, must cause
+ the element on which the method was called to have the attention of
+ the user called to it.</p>
+
+ <p class=note>In a speech browser, this could happen by having the
+ current playback position move to the start of the given
+ element.</p>
+
+ <p>If the element in question cannot be brought to the user's
+ attention, e.g. because it is <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>, or is not <a href=#being-rendered>being
+ rendered</a>, then the user agent must do nothing instead.</p>
+
+ <p>In visual user agents, if the argument is present and has the
+ value false, the user agent should scroll the element into view such
+ that both the bottom and the top of the element are in the viewport,
+ with the bottom of the element aligned with the bottom of the
+ viewport. If it isn't possible to show the entire element in that
+ way, or if the argument is omitted or is true, then the user agent
+ should instead align the top of the element with the top of the
+ viewport. If the entire scrollable part of the content is visible
+ all at once (e.g. if a page is shorter than the viewport), then the
+ user agent should not scroll anything. Visual user agents should
+ further scroll horizontally as necessary to bring the element to the
+ attention of the user.</p>
+
+ <p>Non-visual user agents may ignore the argument, or may treat it
+ in some media-specific manner most useful to the user.</p>
+
+ </div>
+
+
+ <h3 id=focus><span class=secno>8.4 </span>Focus</h3>
+
+ <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%20%0A...%3Cform%3E%3Cinput%20name%3Da%20onfocus%3D%22value%2B%3D1%3Bd.name%3D%27a%27%3Bname%3D%27d%27%3Bb.focus()%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22value%2B%3D1%3Bc.focus()%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22value%2B%3D1%3Bd.focus()%22%3E%0A%3Cinput%20name%3Dd%20onfocus%3D%22value%2B%3D1%3Ba.focus()%22%3E -->
+
+ <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af1%20%27%3Bb.focus()%3Balert(document.activeElement.name)%3Bt.value%2B%3D%27af2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22t.value%2B%3D%27cf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27cf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27cb%20%27%3B%22%3E%0A -->
+
+ <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%20onload%3D%22document.forms%5B0%5D.a.focus()%22%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onblur%3D%22t.value%2B%3D'ab%20'%3B%20b.focus()%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D'bf1%20'%3Ba.focus()%3Bt.value%2B%3D'bf2%20'%3B%22%20onblur%3D%22t.value%2B%3D'bb%20'%3B%22%3E -->
+
+ <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%3E...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab1%20%27%3Bb.focus()%3Bt.value%2B%3D%27ab2%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Ba.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E -->
+
+ <!-- v2: more things to define, if no other specs define them:
+ - define onfocus/onblur behaviour for Window
+ - Other things to look at are IE's focus APIs (HTMLElement.setActive(),
+ onBeforeActivate, onActivate, onBeforeDeactivate, onDeactivate):
+ https://bugzilla.mozilla.org/show_bug.cgi?id=296471
+ https://bugzilla.mozilla.org/show_bug.cgi?id=296469
+ http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setactive.asp
+ http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onbeforeactivate.asp
+ -->
+
+ <div class=impl>
+
+ <p>When an element is <i>focused</i>, key events received by the
+ document must be targeted at that element. There may be no element
+ focused; when no element is focused, key events received by the
+ document must be targeted at <a href=#the-body-element>the body element</a>.</p>
+
+ <p>User agents may track focus for each <a href=#browsing-context>browsing
+ context</a> or <code><a href=#document>Document</a></code> individually, or may support
+ only one focused element per <a href=#top-level-browsing-context>top-level browsing context</a>
+ &mdash; user agents should follow platform conventions in this
+ regard.</p>
+
+ <p>Which elements within a <a href=#top-level-browsing-context>top-level browsing context</a>
+ currently have focus must be independent of whether or not the
+ <a href=#top-level-browsing-context>top-level browsing context</a> itself has the <i>system
+ focus</i>.</p>
+
+ <p class=note>When an element is focused, the element matches the
+ CSS <code>:focus</code> pseudo-class.</p>
+
+ </div>
+
+
+ <h4 id=sequential-focus-navigation><span class=secno>8.4.1 </span>Sequential focus navigation</h4>
+
+ <p>The <dfn id=attr-tabindex title=attr-tabindex><code>tabindex</code></dfn>
+ content attribute specifies whether the element is focusable,
+ whether it can be reached using sequential focus navigation, and the
+ relative order of the element for the purposes of sequential focus
+ navigation. The name "tab index" comes from the common use of the
+ "tab" key to navigate through the focusable elements. The term
+ "tabbing" refers to moving forward through the focusable elements
+ that can be reached using sequential focus navigation.</p>
+
+ <p>The <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute, if
+ specified, must have a value that is a <a href=#valid-integer>valid
+ integer</a>.</p>
+
+ <div class=impl>
+
+ <p>If the attribute is specified, it must be parsed using the
+ <a href=#rules-for-parsing-integers>rules for parsing integers</a>. The attribute's values have
+ the following meanings:</p>
+
+ <dl><dt>If the attribute is omitted or parsing the value returns an
+ error</dt>
+
+ <dd>
+
+ <p>The user agent should follow platform conventions to determine if
+ the element is to be focusable and, if so, whether the element can
+ be reached using sequential focus navigation, and if so, what its
+ relative order should be.</p>
+
+ </dd>
+
+ <dt id=negative-tabindex>If the value is a negative integer</dt>
+
+ <dd>
+
+ <p>The user agent must allow the element to be focused, but should
+ not allow the element to be reached using sequential focus
+ navigation.</p>
+
+ </dd>
+
+ <dt>If the value is a zero</dt>
+
+ <dd>
+
+ <p>The user agent must allow the element to be focused, should
+ allow the element to be reached using sequential focus navigation,
+ and should follow platform conventions to determine the element's
+ relative order.</p>
+
+ </dd>
+
+ <dt>If the value is greater than zero</dt>
+
+ <dd>
+
+ <p>The user agent must allow the element to be focused, should
+ allow the element to be reached using sequential focus navigation,
+ and should place the element in the sequential focus navigation
+ order so that it is:</p>
+
+ <ul><li>before any focusable element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has been
+ omitted or whose value, when parsed, returns an error,</li>
+
+ <li>before any focusable element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal
+ to or less than zero,</li>
+
+ <li>after any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value
+ greater than zero but less than the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute on the
+ element,</li>
+
+ <li>after any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal
+ to the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code>
+ attribute on the element but that is earlier in the document in
+ <a href=#tree-order>tree order</a> than the element,</li>
+
+ <li>before any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal
+ to the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code>
+ attribute on the element but that is later in the document in
+ <a href=#tree-order>tree order</a> than the element, and</li>
+
+ <li>before any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value
+ greater than the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute on the
+ element.</li>
+
+ </ul></dd>
+
+ </dl><p>An element is <dfn id=specially-focusable>specially focusable</dfn> if the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute's definition above
+ defines the element to be focusable.</p>
+
+ <p>An element that is <a href=#specially-focusable>specially focusable</a> but does not
+ otherwise have an <a href=#activation-behavior>activation behavior</a> defined has an
+ <a href=#activation-behavior>activation behavior</a> that does nothing.</p>
+
+ <p class=note>This means that an element that is only focusable
+ because of its <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute
+ will fire a <code title=event-click><a href=#event-click>click</a></code> event in response
+ to a non-mouse activation (e.g. hitting the "enter" key while the
+ element is focused).</p>
+
+ <p>The <dfn id=dom-tabindex title=dom-tabIndex><code>tabIndex</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> content attribute. If the
+ attribute is not present, or parsing its value returns an error,
+ then the IDL attribute must return 0 for elements that are focusable
+ and &minus;1 for elements that are not focusable.</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h4 id=focus-management><span class=secno>8.4.2 </span>Focus management</h4>
+
+ <p>An element is <dfn id=focusable>focusable</dfn> if the user agent's default
+ behavior allows it to be focusable or if the element is
+ <a href=#specially-focusable>specially focusable</a>, but only if the element is either
+ <a href=#being-rendered>being rendered</a> or <!-- CANVAS-FOCUS-FALLBACK --> is a
+ descendant of a <code><a href=#the-canvas-element>canvas</a></code> element that
+ <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a>.</p>
+
+ <p>User agents should make the following elements
+ <a href=#focusable>focusable</a>, unless platform conventions dictate
+ otherwise:</p>
+
+ <ul><li><code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute</li>
+
+ <li><code><a href=#the-button-element>button</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute are not in the
+ <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state and that
+ are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-select-element>select</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-textarea-element>textarea</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>
+
+ <li><code><a href=#the-command>command</a></code> elements that do not have a <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute</li>
+
+ <li>Elements with a <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code>
+ attribute set, if that would enable the user agent to allow the
+ user to begin a drag operations for those elements without the use
+ of a pointing device</li>
+
+ </ul><p>In addition, each shape that is generated for an
+ <code><a href=#the-area-element>area</a></code> element should be <a href=#focusable>focusable</a>, unless
+ platform conventions dictate otherwise. (A single <code><a href=#the-area-element>area</a></code>
+ element can correspond to multiple shapes, since image maps can be
+ reused with multiple images on a page.)</p>
+
+ <hr><p>The <dfn id=focusing-steps>focusing steps</dfn> are as follows:</p>
+
+ <ol><li><p>If focusing the element will remove the focus from another
+ element, then run the <a href=#unfocusing-steps>unfocusing steps</a> for that
+ element.</li>
+
+ <li>
+
+ <p>Make the element the currently focused element in its
+ <a href=#top-level-browsing-context>top-level browsing context</a>.</p>
+
+ <p>Some elements, most notably <code><a href=#the-area-element>area</a></code>, can correspond
+ to more than one distinct focusable area. If a particular area was
+ indicated when the element was focused, then that is the area that
+ must get focus; otherwise, e.g. when using the <code title=dom-focus><a href=#dom-focus>focus()</a></code> method, the first such region in
+ tree order is the one that must be focused.</p>
+
+ </li>
+
+ <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-focus>focus</code> at the element.</li>
+
+ </ol><p>User agents must synchronously run the <a href=#focusing-steps>focusing
+ steps</a> for an element whenever the user moves the focus to a
+ <a href=#focusable>focusable</a> element.</p>
+
+ <p>The <dfn id=unfocusing-steps>unfocusing steps</dfn> are as follows:</p>
+
+ <ol><li><p>If the element is an <code><a href=#the-input-element>input</a></code> element, and the
+ <code title=event-input-change><a href=#event-input-change>change</a></code> event applies to the
+ element, and the element does not have a defined <a href=#activation-behavior>activation
+ behavior</a>, and the user has changed the element's <a href=#concept-fe-value title=concept-fe-value>value</a> or its list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>
+ while the control was focused without committing that change, then
+ <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at the element, then
+ <a href=#broadcast-formchange-events>broadcast <code title=event-formchange>formchange</code>
+ events</a> at the element's <a href=#form-owner>form owner</a>.</p>
+
+ <li><p>Unfocus the element.</li>
+
+ <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-blur>blur</code> at the element.</li>
+
+ </ol><p>When an element that is focused stops being a
+ <a href=#focusable>focusable</a> element, or stops being focused without
+ another element being explicitly focused in its stead, the user
+ agent should synchronously run the <a href=#focusing-steps>focusing steps</a> for
+ <a href=#the-body-element>the body element</a>, if there is one; if there is not,
+ then the user agent should synchronously run the <a href=#unfocusing-steps>unfocusing
+ steps</a> for the affected element only.</p>
+
+ <p class=example>For example, this might happen because the
+ element is removed from its <code><a href=#document>Document</a></code>, or has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute added. It would also
+ happen to an <code><a href=#the-input-element>input</a></code> element when the element gets <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</p>
+
+ </div>
+
+
+ <h4 id=document-level-focus-apis><span class=secno>8.4.3 </span>Document-level focus APIs</h4>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-activeElement><a href=#dom-document-activeelement>activeElement</a></code></dt>
+
+ <dd>
+
+ <p>Returns the currently focused element.</p>
+
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-hasFocus><a href=#dom-document-hasfocus>hasFocus</a></code>()</dt>
+
+ <dd>
+
+ <p>Returns true if the document has focus; otherwise, returns false.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-focus><a href=#dom-window-focus>focus</a></code>()</dt>
+
+ <dd>
+
+ <p>Focuses the window. Use of this method is discouraged. Allow the user to control window focus instead.</p>
+
+ </dd>
+
+ <dt><var title="">window</var> . <code title=dom-window-blur><a href=#dom-window-blur>blur</a></code>()</dt>
+
+ <dd>
+
+ <p>Unfocuses the window. Use of this method is discouraged. Allow the user to control window focus instead.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-document-activeelement title=dom-document-activeElement><code>activeElement</code></dfn>
+ attribute on <code><a href=#htmldocument>HTMLDocument</a></code> objects must return the
+ element in the document that is focused. If no element in the
+ <code><a href=#document>Document</a></code> is focused, this must return <a href=#the-body-element>the body
+ element</a>.</p>
+
+ <p>The <dfn id=dom-document-hasfocus title=dom-document-hasFocus><code>hasFocus()</code></dfn> method
+ on <code><a href=#htmldocument>HTMLDocument</a></code> objects must return true if the
+ document's <a href=#browsing-context>browsing context</a> is focused, and all its
+ <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
+ contexts</a> are also focused, and the <a href=#top-level-browsing-context>top-level browsing
+ context</a> has the <i>system focus</i>.</p>
+
+ <p>The <dfn id=dom-window-focus title=dom-window-focus><code>focus()</code></dfn>
+ method on the <code><a href=#window>Window</a></code> object, when invoked, provides a
+ hint to the user agent that the script believes the user might be
+ interested in the contents of the <a href=#browsing-context>browsing context</a> of
+ the <code><a href=#window>Window</a></code> object on which the method was invoked.</p>
+
+ <p>User agents are encouraged to have this <code title=dom-window-focus><a href=#dom-window-focus>focus()</a></code> method trigger some kind of
+ notification.</p>
+
+ <p>The <dfn id=dom-window-blur title=dom-window-blur><code>blur()</code></dfn> method
+ on the <code><a href=#window>Window</a></code> object, when invoked, provides a hint to
+ the user agent that the script believes the user probably is not
+ currently interested in the contents of the <a href=#browsing-context>browsing
+ context</a> of the <code><a href=#window>Window</a></code> object on which the method
+ was invoked, but that the contents might become interesting again in
+ the future.</p>
+
+ <p>User agents are encouraged to ignore calls to this <code title=dom-window-blur><a href=#dom-window-blur>blur()</a></code> method entirely.</p>
+
+ <p class=note>Historically the <code title=dom-window-blur><a href=#dom-window-blur>focus()</a></code> and <code title=dom-window-blur><a href=#dom-window-blur>blur()</a></code> methods actually affected the
+ system focus, but hostile sites widely abuse this behavior to the
+ user's detriment.</p>
+
+ </div>
+
+
+ <h4 id=element-level-focus-apis><span class=secno>8.4.4 </span>Element-level focus APIs</h4>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-focus><a href=#dom-focus>focus</a></code>()</dt>
+
+ <dd>
+
+ <p>Focuses the element.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-blur><a href=#dom-blur>blur</a></code>()</dt>
+
+ <dd>
+
+ <p>Unfocuses the element. Use of this method is discouraged. Focus
+ another element instead.</p>
+
+ <p>Do not use this method to hide the focus ring if you find the
+ focus ring unsightly. Instead, use a CSS rule to override the
+ 'outline' property.</p>
+
+ <div class=example>
+
+ <p>For example, to hide the outline from links, you could use:</p>
+
+ <pre>:link:focus, :visited:focus { outline: none; }</pre>
+
+ </div>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-focus title=dom-focus><code>focus()</code></dfn> method,
+ when invoked, must run the following algorithm:</p>
+
+ <ol><li><p>If the element is marked as <i><a href=#locked-for-focus>locked for focus</a></i>, then abort
+ these steps.</li>
+
+ <li><p>If the element is not <a href=#focusable>focusable</a>, then abort these
+ steps.</li>
+
+ <li><p>Mark the element as <dfn id=locked-for-focus>locked for focus</dfn>.</li>
+
+ <li><p>If the element is not already focused, run the <a href=#focusing-steps>focusing
+ steps</a> for the element.</li>
+
+ <li><p>Unmark the element as <i><a href=#locked-for-focus>locked for focus</a></i>.</li>
+
+ </ol><p>The <dfn id=dom-blur title=dom-blur><code>blur()</code></dfn> method, when
+ invoked, should run the <a href=#focusing-steps>focusing steps</a> for <a href=#the-body-element>the
+ body element</a>, if there is one; if there is not, then it
+ should run the <a href=#unfocusing-steps>unfocusing steps</a> for the element on
+ which the method was called instead. User agents may selectively or
+ uniformly ignore calls to this method for usability reasons.</p>
+
+ <p class=example>For example, if the <code title=dom-blur><a href=#dom-blur>blur()</a></code> method is unwisely being used to
+ remove the focus ring for aesthetics reasons, the page would become
+ unusable by keyboard users. Ignoring calls to this method would thus
+ allow keyboard users to interact with the page.</p>
+
+ </div>
+
+
+
+
+ <h3 id=the-accesskey-attribute><span class=secno>8.5 </span>The <dfn title=attr-accesskey><code>accesskey</code></dfn> attribute</h3>
+
+ <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute set. The
+ <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> attribute's value is
+ used by the user agent as a guide for creating a keyboard shortcut
+ that activates or focuses the element.</p>
+
+ <p>If specified, the value must be an <a href=#ordered-set-of-unique-space-separated-tokens>ordered set of unique
+ space-separated tokens</a>, each of which must be exactly one
+ Unicode code point in length.</p>
+
+ <div class=impl>
+
+ <p>An element's <dfn id=assigned-access-key>assigned access key</dfn> is a key combination
+ derived from the element's <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute as
+ follows:</p>
+
+ <ol><li><p>If the element has no <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> attribute, then skip to the
+ <i>fallback</i> step below.</li>
+
+ <li><p>Otherwise, the user agent must <a href=#split-a-string-on-spaces title="split a string
+ on spaces">split the attribute's value on spaces</a>, and let
+ <var title="">keys</var> be the resulting tokens.</li>
+
+ <li>
+
+ <p>For each value in <var title="">keys</var> in turn, in the
+ order the tokens appeared in the attribute's value, run the
+ following substeps:</p>
+
+ <ol><li><p>If the value is not a string exactly one Unicode code
+ point in length, then skip the remainder of these steps for this
+ value.</li>
+
+ <li><p>If the value does not correspond to a key on the system's
+ keyboard, then skip the remainder of these steps for this
+ value.</li>
+
+ <li><p>If the user agent can find a combination of modifier keys
+ that, with the key that corresponds to the value given in the
+ attribute, can be used as a shortcut key, then the user agent may
+ assign that combination of keys as the element's <a href=#assigned-access-key>assigned
+ access key</a> and abort these steps.</li>
+
+ </ol></li>
+
+ <li><p><i>Fallback</i>: Optionally, the user agent may assign a key
+ combination of its choosing as the element's <a href=#assigned-access-key>assigned access
+ key</a> and then abort these steps.</li>
+
+ <li><p>If this step is reached, the element has no <a href=#assigned-access-key>assigned
+ access key</a>.</li>
+
+ </ol><p>Once a user agent has selected and assigned an access key for an
+ element, the user agent should not change the element's
+ <a href=#assigned-access-key>assigned access key</a> unless the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute is changed
+ or the element is moved to another <code><a href=#document>Document</a></code>.</p>
+
+ <p>When the user presses the key combination corresponding to the
+ <a href=#assigned-access-key>assigned access key</a> for an element, if the element
+ <a href=#concept-command title=concept-command>defines a command</a>, and the
+ command's <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden
+ State</a> facet is false (visible), and the command's <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> facet is
+ also false (enabled), then the user agent must trigger the <a href=#command-facet-action title=command-facet-Action>Action</a> of the command.</p>
+
+ <p>User agents may expose elements that have an <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> attribute in other ways as
+ well, e.g. in a menu displayed in response to a specific key
+ combination.</p>
+
+ </div>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-accesskey title=dom-accessKey><code>accessKey</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-accesskeylabel title=dom-accessKeyLabel><code>accessKeyLabel</code></dfn> IDL
+ attribute must return a string that represents the element's
+ <a href=#assigned-access-key>assigned access key</a>, if any. If the element does not
+ have one, then the IDL attribute must return the empty string.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, a variety of links are given with
+ access keys so that keyboard users familiar with the site can
+ more quickly navigate to the relevant pages:</p>
+
+ <pre>&lt;nav&gt;
+ &lt;p&gt;
+ &lt;a title="Consortium Activities" accesskey="A" href="/Consortium/activities"&gt;Activities&lt;/a&gt; |
+ &lt;a title="Technical Reports and Recommendations" accesskey="T" href="/TR/"&gt;Technical Reports&lt;/a&gt; |
+ &lt;a title="Alphabetical Site Index" accesskey="S" href="/Consortium/siteindex"&gt;Site Index&lt;/a&gt; |
+ &lt;a title="About This Site" accesskey="B" href="/Consortium/"&gt;About Consortium&lt;/a&gt; |
+ &lt;a title="Contact Consortium" accesskey="C" href="/Consortium/contact"&gt;Contact&lt;/a&gt;
+ &lt;/p&gt;
+&lt;/nav&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, the search field is given two possible
+ access keys, "s" and "0" (in that order). A user agent on a device
+ with a full keyboard might pick
+ <kbd><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd></kbd> as the
+ shortcut key, while a user agent on a small device with just a
+ numeric keypad might pick just the plain unadorned key
+ <kbd><kbd>0</kbd></kbd>:</p>
+
+ <pre>&lt;form action="/search"&gt;
+ &lt;label&gt;Search: &lt;input type="search" name="q" accesskey="s 0"&gt;&lt;/label&gt;
+ &lt;input type="submit"&gt;
+&lt;/form&gt;</pre>
+
+ </div>
+
+ <div class=example>
+
+ <p>In the following example, a button has possible access keys
+ described. A script then tries to update the button's label to
+ advertise the key combination the user agent selected.</p>
+
+ <pre>&lt;input type=submit accesskey="N @ 1" value="Compose"&gt;
+...
+&lt;script&gt;
+ function labelButton(button) {
+ if (button.accessKeyLabel)
+ button.value += ' (' + button.accessKeyLabel + ')';
+ }
+ var inputs = document.getElementsByTagName('input');
+ for (var i = 0; i &lt; inputs.length; i += 1) {
+ if (inputs[i].type == "submit")
+ labelButton(inputs[i]);
+ }
+&lt;/script&gt;</pre>
+
+ <p>On one user agent, the button's label might become
+ "<samp>Compose (&#8984;N)</samp>". On another, it might become
+ "<samp>Compose (Alt+&#8679;+1)</samp>". If the user agent doesn't
+ assign a key, it will be just "<samp>Compose</samp>". The exact
+ string depends on what the <a href=#assigned-access-key>assigned access key</a> is, and
+ on how the user agent represents that key combination.</p>
+
+ </div>
+
+
+
+ <h3 id=selection><span class=secno>8.6 </span>The text selection APIs</h3>
+
+ <p>Every <a href=#browsing-context>browsing context</a> has <dfn id=the-selection title="the
+ selection">a selection</dfn>. The selection can be empty, and the
+ selection can have more than one range (a disjointed selection). The
+ user agent should allow the user to change the selection. User
+ agents are not required to let the user select more than one range,
+ and may collapse multiple ranges in the selection to a single range
+ when the user interacts with the selection. (But, of course, the
+ user agent may let the user create selections with multiple
+ ranges.)</p>
+
+ <p>This one selection must be shared by all the content of the
+ browsing context (though not by nested <a href=#browsing-context title="browsing
+ context">browsing contexts</a>), including any editing hosts in
+ the document. (Editing hosts that are not inside a document cannot
+ have a selection.)</p>
+
+ <div class=impl>
+
+ <p>If the selection is empty (collapsed, so that it has only one
+ segment and that segment's start and end points are the same) then
+ the selection's position should equal the caret position. When the
+ selection is not empty, this specification does not define the caret
+ position; user agents should follow platform conventions in deciding
+ whether the caret is at the start of the selection, the end of the
+ selection, or somewhere else.</p>
+
+ <p>On some platforms (such as those using Wordstar editing
+ conventions), the caret position is totally independent of the start
+ and end of the selection, even when the selection is empty. On such
+ platforms, user agents may ignore the requirement that the cursor
+ position be linked to the position of the selection altogether.</p>
+
+ </div>
+
+ <p>Mostly for historical reasons, in addition to the <a href=#browsing-context>browsing
+ context</a>'s <a href=#the-selection title="the selection">selection</a>, each
+ <code><a href=#the-textarea-element>textarea</a></code> and <code><a href=#the-input-element>input</a></code> element has an
+ independent selection. These are the <dfn id=text-field-selection title="text field
+ selection">text field selections</dfn>.</p>
+
+ <div class=impl>
+
+ <p>User agents may selectively ignore attempts to use the API to
+ adjust the selection made after the user has modified the
+ selection. For example, if the user has just selected part of a
+ word, the user agent could ignore attempts to use the API call to
+ immediately unselect the selection altogether, but could allow
+ attempts to change the selection to select the entire word.</p>
+
+ <p>User agents may also allow the user to create selections that are
+ not exposed to the API.</p>
+
+ </div>
+
+ <!-- v2DATAGRID v2DGS:
+ <p>The <code>datagrid</code> and <code>select</code> elements also
+ have selections, indicating which items have been picked by the
+ user. These are not discussed in this section.</p>
+ -->
+ <p>The <code><a href=#the-select-element>select</a></code> element also has a selection, indicating
+ which items have been picked by the user. This is not discussed in
+ this section.</p>
+
+ <p class=note>This specification does not specify how selections
+ are presented to the user. <!-- The Selectors specification, in
+ conjunction with CSS, can be used to style text selections using the
+ <code title="selector-selection">::selection</code>
+ pseudo-element. <a href="#refsSELECTORS">[SELECTORS]</a> <a
+ href="#refsCSS">[CSS]</a> --></p>
+
+
+
+ <h4 id=documentSelection><span class=secno>8.6.1 </span>APIs for the browsing context selection</h4>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-getSelection><a href=#dom-getselection>getSelection</a></code>()</dt>
+ <dt><var title="">document</var> . <code title=dom-document-getSelection><a href=#dom-document-getselection>getSelection</a></code>()</dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#selection-0>Selection</a></code> object for the window, which
+ stringifies to the text of the current selection.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-getselection title=dom-getSelection><code>getSelection()</code></dfn> method on
+ the <code><a href=#window>Window</a></code> interface must return the
+ <code><a href=#selection-0>Selection</a></code> object representing <a href=#the-selection>the
+ selection</a> of that <code><a href=#window>Window</a></code> object's
+ <a href=#browsing-context>browsing context</a>.
+
+ <p>For historical reasons, the <dfn id=dom-document-getselection title=dom-document-getSelection><code>getSelection()</code></dfn>
+ method on the <code><a href=#htmldocument>HTMLDocument</a></code> interface must return the
+ same <code><a href=#selection-0>Selection</a></code> object.</p>
+
+ </div>
+
+ <pre class=idl>interface <dfn id=selection-0>Selection</dfn> {
+ readonly attribute Node <a href=#dom-selection-anchornode title=dom-selection-anchorNode>anchorNode</a>;
+ readonly attribute long <a href=#dom-selection-anchoroffset title=dom-selection-anchorOffset>anchorOffset</a>;
+ readonly attribute Node <a href=#dom-selection-focusnode title=dom-selection-focusNode>focusNode</a>;
+ readonly attribute long <a href=#dom-selection-focusoffset title=dom-selection-focusOffset>focusOffset</a>;
+ readonly attribute boolean <a href=#dom-selection-iscollapsed title=dom-selection-isCollapsed>isCollapsed</a>;
+ void <a href=#dom-selection-collapse title=dom-selection-collapse>collapse</a>(in Node parentNode, in long offset);
+ void <a href=#dom-selection-collapsetostart title=dom-selection-collapseToStart>collapseToStart</a>();
+ void <a href=#dom-selection-collapsetoend title=dom-selection-collapseToEnd>collapseToEnd</a>();
+ void <a href=#dom-selection-selectallchildren title=dom-selection-selectAllChildren>selectAllChildren</a>(in Node parentNode);
+ void <a href=#dom-selection-deletefromdocument title=dom-selection-deleteFromDocument>deleteFromDocument</a>();
+ readonly attribute long <a href=#dom-selection-rangecount title=dom-selection-rangeCount>rangeCount</a>;
+ Range <a href=#dom-selection-getrangeat title=dom-selection-getRangeAt>getRangeAt</a>(in long index);
+ void <a href=#dom-selection-addrange title=dom-selection-addRange>addRange</a>(in Range range);
+ void <a href=#dom-selection-removerange title=dom-selection-removeRange>removeRange</a>(in Range range);
+ void <a href=#dom-selection-removeallranges title=dom-selection-removeAllRanges>removeAllRanges</a>();
+ <a href=#dom-selection-tostring title=dom-selection-toString>stringifier</a> DOMString ();
+};</pre>
+<!--
+ See also:
+ http://lxr.mozilla.org/mozilla/source/content/base/public/nsISelection.idl
+ This spec doesn't have everything from there yet, in particular
+ selectionLanguageChange() and containsNode() are missing. They are missing
+ because I couldn't work out how to define them in terms of Ranges.
+
+ I also haven't included extend():
+
+ void <span title="dom-selection-extend">extend</span>(in Node parentNode, in long offset);
+ // raise if no range
+ // raise WRONG_DOCUMENT_ERR if parentNode not in document
+ // do something
+
+ ...mostly because I can't work out how to describe what it does quickly.
+-->
+
+ <p>The <code><a href=#selection-0>Selection</a></code> interface represents a list of
+ <code><a href=#range>Range</a></code> objects. The first item in the list has index 0,
+ and the last item has index <var title="">count</var>-1, where <var title="">count</var> is the number of ranges in the list. <a href=#refsDOMRANGE>[DOMRANGE]</a></p>
+
+ <p>All of the members of the <code><a href=#selection-0>Selection</a></code> interface are
+ defined in terms of operations on the <code><a href=#range>Range</a></code> objects
+ represented by this object. These operations can raise exceptions,
+ as defined for the <code><a href=#range>Range</a></code> interface; this can therefore
+ result in the members of the <code><a href=#selection-0>Selection</a></code> interface
+ raising exceptions as well, in addition to any explicitly called out
+ below.</p>
+
+ <dl class=domintro><dt><var title="">selection</var> . <code title=dom-selection-anchorNode><a href=#dom-selection-anchornode>anchorNode</a></code></dt>
+
+ <dd>
+
+ <p>Returns the element that contains the start of the selection.</p>
+
+ <p>Returns null if there's no selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-anchorOffset><a href=#dom-selection-anchoroffset>anchorOffset</a></code></dt>
+
+ <dd>
+
+ <p>Returns the offset of the start of the selection relative to the element that contains the start of the selection.</p>
+
+ <p>Returns 0 if there's no selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-focusNode><a href=#dom-selection-focusnode>focusNode</a></code></dt>
+
+ <dd>
+
+ <p>Returns the element that contains the end of the selection.</p>
+
+ <p>Returns null if there's no selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-focusOffset><a href=#dom-selection-focusoffset>focusOffset</a></code></dt>
+
+ <dd>
+
+ <p>Returns the offset of the end of the selection relative to the element that contains the end of the selection.</p>
+
+ <p>Returns 0 if there's no selection.</p>
+
+ </dd>
+
+ <dt><var title="">collapsed</var> = <var title="">selection</var> . <code title=dom-selection-isCollapsed><a href=#dom-selection-iscollapsed>isCollapsed</a></code>()</dt>
+
+ <dd>
+
+ <p>Returns true if there's no selection or if the selection is empty. Otherwise, returns false.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-collapse><a href=#dom-selection-collapse>collapse</a></code>(<var title="">parentNode</var>, <var title="">offset</var>)</dt>
+
+ <dd>
+
+ <p>Replaces the selection with an empty one at the given position.</p>
+
+ <p>Throws a <code><a href=#wrong_document_err>WRONG_DOCUMENT_ERR</a></code> exception if the given node is in a different document.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-collapseToStart><a href=#dom-selection-collapsetostart>collapseToStart</a></code>()</dt>
+
+ <dd>
+
+ <p>Replaces the selection with an empty one at the position of the start of the current selection.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if there is no selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-collapseToEnd><a href=#dom-selection-collapsetoend>collapseToEnd</a></code>()</dt>
+
+ <dd>
+
+ <p>Replaces the selection with an empty one at the position of the end of the current selection.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if there is no selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-selectAllChildren><a href=#dom-selection-selectallchildren>selectAllChildren</a></code>(<var title="">parentNode</var>)</dt>
+
+ <dd>
+
+ <p>Replaces the selection with one that contains all the contents of the given element.</p>
+
+ <p>Throws a <code><a href=#wrong_document_err>WRONG_DOCUMENT_ERR</a></code> exception if the given node is in a different document.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-deleteFromDocument><a href=#dom-selection-deletefromdocument>deleteFromDocument</a></code>()</dt>
+
+ <dd>
+
+ <p>Deletes the selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-rangeCount><a href=#dom-selection-rangecount>rangeCount</a></code></dt>
+
+ <dd>
+
+ <p>Returns the number of ranges in the selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-getRangeAt><a href=#dom-selection-getrangeat>getRangeAt</a></code>(<var title="">index</var>)</dt>
+
+ <dd>
+
+ <p>Returns the given range.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the value is out of range.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-addRange><a href=#dom-selection-addrange>addRange</a></code>(<var title="">range</var>)</dt>
+
+ <dd>
+
+ <p>Adds the given range to the selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-removeRange><a href=#dom-selection-removerange>removeRange</a></code>(<var title="">range</var>)</dt>
+
+ <dd>
+
+ <p>Removes the given range from the selection, if the range was one of the ones in the selection.</p>
+
+ </dd>
+
+ <dt><var title="">selection</var> . <code title=dom-selection-removeAllRanges><a href=#dom-selection-removeallranges>removeAllRanges</a></code>()</dt>
+
+ <dd>
+
+ <p>Removes all the ranges in the selection.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-selection-anchornode title=dom-selection-anchorNode><code>anchorNode</code></dfn>
+ attribute must return the value returned by the <code title=dom-Range-startContainer><a href=#dom-range-startcontainer>startContainer</a></code> attribute of the last
+ <code><a href=#range>Range</a></code> object in the list, or null if the list is
+ empty.</p>
+
+ <p>The <dfn id=dom-selection-anchoroffset title=dom-selection-anchorOffset><code>anchorOffset</code></dfn>
+ attribute must return the value returned by the <code title=dom-Range-startOffset><a href=#dom-range-startoffset>startOffset</a></code> attribute of the last <code><a href=#range>Range</a></code>
+ object in the list, or 0 if the list is empty.</p>
+
+ <p>The <dfn id=dom-selection-focusnode title=dom-selection-focusNode><code>focusNode</code></dfn>
+ attribute must return the value returned by the <code title=dom-Range-endContainer><a href=#dom-range-endcontainer>endContainer</a></code> attribute of the last
+ <code><a href=#range>Range</a></code> object in the list, or null if the list is
+ empty.</p>
+
+ <p>The <dfn id=dom-selection-focusoffset title=dom-selection-focusOffset><code>focusOffset</code></dfn>
+ attribute must return the value returned by the <code title=dom-Range-endOffset><a href=#dom-range-endoffset>endOffset</a></code> attribute of the last <code><a href=#range>Range</a></code>
+ object in the list, or 0 if the list is empty.</p>
+
+ <p>The <dfn id=dom-selection-iscollapsed title=dom-selection-isCollapsed><code>isCollapsed</code></dfn>
+ attribute must return true if there are zero ranges, or if there is
+ exactly one range and its <code title=dom-Range-collapsed><a href=#dom-range-collapsed>collapsed</a></code> attribute
+ is itself true. Otherwise it must return false.</p>
+
+ <p>The <dfn id=dom-selection-collapse title=dom-selection-collapse><code>collapse(<var title="">parentNode</var>, <var title="">offset</var>)</code></dfn>
+ method must raise a <code><a href=#wrong_document_err>WRONG_DOCUMENT_ERR</a></code> DOM exception if
+ <var title="">parentNode</var>'s <code><a href=#document>Document</a></code> is not the
+ <code><a href=#htmldocument>HTMLDocument</a></code> object with which the
+ <code><a href=#selection-0>Selection</a></code> object is associated. Otherwise it is, and
+ the method must remove all the ranges in the <code><a href=#selection-0>Selection</a></code>
+ list, then create a new <code><a href=#range>Range</a></code> object, add it to the
+ list, and invoke its <code title=dom-Range-setStart()>setStart()</code> and <code title=dom-Range-setEnd()>setEnd()</code> methods with the <var title="">parentNode</var> and <var title="">offset</var> values as
+ their arguments.</p>
+
+ <p>The <dfn id=dom-selection-collapsetostart title=dom-selection-collapseToStart><code>collapseToStart()</code></dfn>
+ method must raise an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> DOM exception if
+ there are no ranges in the list. Otherwise, it must invoke the <code title=dom-selection-collapse><a href=#dom-selection-collapse>collapse()</a></code> method with the
+ <code title=dom-Range-startContainer><a href=#dom-range-startcontainer>startContainer</a></code> and <code title=dom-Range-startOffset><a href=#dom-range-startoffset>startOffset</a></code> values of the first <code><a href=#range>Range</a></code>
+ object in the list as the arguments.</p>
+
+ <p>The <dfn id=dom-selection-collapsetoend title=dom-selection-collapseToEnd><code>collapseToEnd()</code></dfn>
+ method must raise an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> DOM exception if
+ there are no ranges in the list. Otherwise, it must invoke the <code title=dom-selection-collapse><a href=#dom-selection-collapse>collapse()</a></code> method with the
+ <code title=dom-Range-endContainer><a href=#dom-range-endcontainer>endContainer</a></code> and <code title=dom-Range-endOffset><a href=#dom-range-endoffset>endOffset</a></code> values of the last <code><a href=#range>Range</a></code>
+ object in the list as the arguments.</p>
+
+ <p>The <dfn id=dom-selection-selectallchildren title=dom-selection-selectAllChildren><code>selectAllChildren(<var title="">parentNode</var>)</code></dfn>
+ method must invoke the <code title=dom-selection-collapse><a href=#dom-selection-collapse>collapse()</a></code> method with the
+ <var title="">parentNode</var> value as the first argument and 0 as the
+ second argument, and must then invoke the <code title=dom-Range-selectNodeContents()>selectNodeContents()</code> method on the first (and only)
+ range in the list with the <var title="">parentNode</var> value as the
+ argument.</p>
+
+ <p>The <dfn id=dom-selection-deletefromdocument title=dom-selection-deleteFromDocument><code>deleteFromDocument()</code></dfn>
+ method must invoke the <code title=dom-Range-deleteContents()>deleteContents()</code> method
+ on each range in the list, if any, from first to last.</p>
+
+ <p>The <dfn id=dom-selection-rangecount title=dom-selection-rangeCount><code>rangeCount</code></dfn>
+ attribute must return the number of ranges in the list.</p>
+
+ <p>The <dfn id=dom-selection-getrangeat title=dom-selection-getRangeAt><code>getRangeAt(<var title="">index</var>)</code></dfn>
+ method must return the <var title="">index</var>th range in the list. If
+ <var title="">index</var> is less than zero or greater or equal to the value
+ returned by the <code title=dom-selection-rangeCount><a href=#dom-selection-rangecount>rangeCount</a></code> attribute, then
+ the method must raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> DOM
+ exception.</p>
+
+ <p>The <dfn id=dom-selection-addrange title=dom-selection-addRange><code>addRange(<var title="">range</var>)</code></dfn>
+ method must add the given <var title="">range</var> Range object to the list
+ of selections, at the end (so the newly added range is the new last
+ range). Duplicates are not prevented; a range may be added more than
+ once in which case it appears in the list more than once, which (for
+ example) will cause <a href=#dom-selection-tostring title=dom-selection-toString>stringification</a> to return the
+ range's text twice.</p>
+
+ <p>The <dfn id=dom-selection-removerange title=dom-selection-removeRange><code>removeRange(<var title="">range</var>)</code></dfn>
+ method must remove the first occurrence of <var title="">range</var> in the
+ list of ranges, if it appears at all.</p>
+
+ <p>The <dfn id=dom-selection-removeallranges title=dom-selection-removeAllRanges><code>removeAllRanges()</code></dfn>
+ method must remove all the ranges from the list of ranges, such that
+ the <code title=dom-selection-rangeCount><a href=#dom-selection-rangecount>rangeCount</a></code>
+ attribute returns 0 after the <code title=dom-selection-removeAllRanges><a href=#dom-selection-removeallranges>removeAllRanges()</a></code>
+ method is invoked (and until a new range is added to the list,
+ either through this interface or via user interaction).</p>
+
+ <p>Objects implementing this interface must <dfn id=dom-selection-tostring title=dom-selection-toString>stringify</dfn> to a concatenation
+ of the results of invoking the <code title="">toString()</code>
+ method of the <code><a href=#range>Range</a></code> object on each of the ranges of the
+ selection, in the order they appear in the list (first to last).</p>
+
+ </div>
+
+ <div class=example>
+ <p>In the following document fragment, the emphasized parts
+ indicate the selection.</p>
+ <pre>&lt;p&gt;The cute girl likes <em>the </em>&lt;cite&gt;<em>Oxford English</em> Dictionary&lt;/cite&gt;.&lt;/p&gt;</pre>
+ <p>If a script invoked <code title="">window.getSelection().toString()</code>, the return value
+ would be "<code>the Oxford English</code>".</p>
+ </div>
+
+ <!-- v2DATAGRID v2DGS:
+ <p class="note">The <code>Selection</code> interface has no relation
+ to the <code>DataGridSelection</code> interface.</p>
+ -->
+
+
+ <h4 id=textFieldSelection><span class=secno>8.6.2 </span>APIs for the text field selections</h4>
+
+ <!-- v2 idea: DOM Range APIs to expose the textarea/input edited
+ value (ack martijnw) -->
+
+ <p>The <code><a href=#the-input-element>input</a></code> and <code><a href=#the-textarea-element>textarea</a></code> elements define
+ the following members in their DOM interfaces for handling their
+ text selection:</p>
+
+ <pre class="idl extract"> void <a href=#dom-textarea/input-select title=dom-textarea/input-select>select</a>();
+ attribute unsigned long <a href=#dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart>selectionStart</a>;
+ attribute unsigned long <a href=#dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd>selectionEnd</a>;
+ void <a href=#dom-textarea/input-setselectionrange title=dom-textarea/input-setSelectionRange>setSelectionRange</a>(in unsigned long start, in unsigned long end);</pre>
+ <!-- v2: also add textLength? it seems to be widely used -->
+
+ <p>These methods and attributes expose and control the selection of
+ <code><a href=#the-input-element>input</a></code> and <code><a href=#the-textarea-element>textarea</a></code> text fields.</p>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select</a></code>()</dt>
+
+ <dd>
+
+ <p>Selects everything in the text field.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-textarea/input-selecionStart>selectionStart</code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the offset to the start of the selection.</p>
+
+ <p>Can be set, to change the start of the selection.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-textarea/input-selecionEnd>selectionEnd</code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the offset to the end of the selection.</p>
+
+ <p>Can be set, to change the end of the selection.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange</a></code>(<var title="">start</var>, <var title="">end</var>)</dt>
+
+ <dd>
+
+ <p>Changes the selection to cover the given substring.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>When these methods and attributes are used with
+ <code><a href=#the-input-element>input</a></code> elements while they don't apply, they must raise
+ an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception. Otherwise, they must
+ act as described below.</p>
+
+ <p>The <dfn id=dom-textarea/input-select title=dom-textarea/input-select><code>select()</code></dfn> method
+ must cause the contents of the text field to be fully selected.</p>
+
+ <p>The <dfn id=dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart><code>selectionStart</code></dfn>
+ attribute must, on getting, return the offset (in logical order) to
+ the character that immediately follows the start of the
+ selection. If there is no selection, then it must return the offset
+ (in logical order) to the character that immediately follows the
+ text entry cursor.</p>
+
+ <p>On setting, it must act as if the <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
+ method had been called, with the new value as the first argument,
+ and the current value of the <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
+ attribute as the second argument, unless the current value of the
+ <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> is
+ less than the new value, in which case the second argument must also
+ be the new value.</p>
+
+ <p>The <dfn id=dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd><code>selectionEnd</code></dfn>
+ attribute must, on getting, return the offset (in logical order) to
+ the character that immediately follows the end of the selection. If
+ there is no selection, then it must return the offset (in logical
+ order) to the character that immediately follows the text entry
+ cursor.</p>
+
+ <p>On setting, it must act as if the <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
+ method had been called, with the current value of the <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>
+ attribute as the first argument, and new value as the second
+ argument.</p>
+
+ <p>The <dfn id=dom-textarea/input-setselectionrange title=dom-textarea/input-setSelectionRange><code>setSelectionRange(<var title="">start</var>, <var title="">end</var>)</code></dfn> method
+ must set the selection of the text field to the sequence of
+ characters starting with the character at the <var title="">start</var>th position (in logical order) and ending with
+ the character at the <span title="">(<var title="">end</var>-1)</span>th position. Arguments greater than the
+ length of the value in the text field must be treated as pointing at
+ the end of the text field. If <var title="">end</var> is less than
+ or equal to <var title="">start</var> then the start of the
+ selection and the end of the selection must both be placed
+ immediately before the character with offset <var title="">end</var>. In UAs where there is no concept of an empty
+ selection, this must set the cursor to be just before the character
+ with offset <var title="">end</var>.</p>
+
+ </div>
+
+ <div class=example>
+
+ <p>To obtain the currently selected text, the following JavaScript
+ suffices:</p>
+
+ <pre>var selectionText = control.value.substring(control.selectionStart, control.selectionEnd);</pre>
+
+ <p>...where <var title="">control</var> is the <code><a href=#the-input-element>input</a></code>
+ or <code><a href=#the-textarea-element>textarea</a></code> element.</p>
+
+ </div>
+
+ <p>Characters with no visible rendering, such as U+200D ZERO WIDTH
+ JOINER, still count as characters. Thus, for instance, the selection
+ can include just an invisible character, and the text insertion
+ cursor can be placed to one side or another of such a character.</p>
+
+
+
+ <h3 id=contenteditable><span class=secno>8.7 </span>The <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute</h3>
+
+ <p>The <dfn id=attr-contenteditable title=attr-contenteditable><code>contenteditable</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a> whose keywords are
+ the empty string, <code title="">true</code>, and <code title="">false</code>. The empty string and the <code title="">true</code> keyword map to the <i>true</i> state. The <code title="">false</code> keyword maps to the <i>false</i> state. In
+ addition, there is a third state, the <i>inherit</i> state, which is
+ the <i>missing value default</i> (and the <i>invalid value
+ default</i>).</p>
+
+ <p>The <i>true</i> state indicates that the element is editable. The
+ <i>inherit</i> state indicates that the element is editable if its
+ parent is. The <i>false</i> state indicates that the element is not
+ editable.</p>
+
+ <div class=impl>
+
+ <p>Specifically, if an <a href=#html-elements title="HTML elements">HTML
+ element</a> has a <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute set to
+ the true state, or it has its <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute set to
+ the inherit state and if its nearest ancestor <a href=#html-elements title="HTML
+ elements">HTML element</a> with the <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute set to
+ a state other than the inherit state has its attribute set to the
+ true state, or if it and its ancestors all have their <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute set to
+ the inherit state but the <code><a href=#document>Document</a></code> has <code title=dom-document-designMode><a href=#designMode>designMode</a></code> enabled, then the
+ UA must treat the element as <dfn id=editable>editable</dfn> (as described
+ below).</p>
+
+ <p>Otherwise, either the <a href=#html-elements title="HTML elements">HTML
+ element</a> has a <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute set to
+ the false state, or its <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute is set
+ to the inherit state and its nearest ancestor <a href=#html-elements title="HTML
+ elements">HTML element</a> with the <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute set to
+ a state other than the inherit state has its attribute set to the
+ false state, or all its ancestors have their <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute set to
+ the inherit state and the <code><a href=#document>Document</a></code> itself has <code title=dom-document-designMode><a href=#designMode>designMode</a></code> disabled; either
+ way, the element is not editable.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-contentEditable><a href=#dom-contenteditable>contentEditable</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns "<code title="">true</code>", "<code title="">false</code>", or "<code title="">inherit</code>", based
+ on the state of the <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute.</p>
+
+ <p>Can be set, to change that state.</p>
+
+ <p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if the new value
+ isn't one of those strings.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title=dom-isContentEditable><a href=#dom-iscontenteditable>isContentEditable</a></code></dt>
+
+ <dd>
+
+ <p>Returns true if the element is editable; otherwise, returns false.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-contenteditable title=dom-contentEditable><code>contentEditable</code></dfn> IDL
+ attribute, on getting, must return the string "<code title="">true</code>" if the content attribute is set to the true
+ state, <code title="">false</code>" if the content attribute is set
+ to the false state, and "<code title="">inherit</code>"
+ otherwise. On setting, if the new value is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">inherit</code>" then the content attribute must be removed,
+ if the new value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
+ the string "<code title="">true</code>" then the content attribute
+ must be set to the string "<code title="">true</code>", if the new
+ value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
+ "<code title="">false</code>" then the content attribute must be set
+ to the string "<code title="">false</code>", and otherwise the
+ attribute setter must raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception.</p>
+
+ <p>The <dfn id=dom-iscontenteditable title=dom-isContentEditable><code>isContentEditable</code></dfn>
+ IDL attribute, on getting, must return true if the element is
+ <a href=#editable>editable</a>, and false otherwise.</p>
+
+ <p>If an element is <a href=#editable>editable</a> and its parent element is
+ not, or if an element is <a href=#editable>editable</a> and it has no parent
+ element, then the element is an <dfn id=editing-host>editing host</dfn>. Editable
+ elements can be nested. User agents must make editing hosts
+ focusable (which typically means they enter the <a href=#attr-tabindex title=attr-tabindex>tab order</a>). An editing host can contain
+ non-editable sections, these are handled as described below. An
+ editing host can contain non-editable sections that contain further
+ editing hosts.</p>
+
+ <p>When an editing host has focus, it must have a <dfn id=caret-position>caret
+ position</dfn> that specifies where the current editing position
+ is. It may also have a <a href=#the-selection title="the
+ selection">selection</a>.</p>
+
+ <p class=note>How the caret and selection are represented depends
+ entirely on the UA.</p>
+
+ <!-- v2: would be useful to have a way to mark an element as
+ unremovable. -->
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=user-editing-actions><span class=secno>8.7.1 </span>User editing actions</h4>
+
+ <p>There are several actions that the user agent should allow the
+ user to perform while the user is interacting with an editing
+ host. How exactly each action is triggered is not defined for every
+ action, but when it is not defined, suggested key bindings are
+ provided to guide implementors.</p>
+
+ <dl><dt>Move the caret</dt>
+
+ <dd><p>User agents must allow users to move the caret to any
+ position within an editing host, even into nested editable
+ elements. This could be triggered as the default action of <code title=event-keydown>keydown</code> events with various key
+ identifiers and as the default action of <code title=event-mousedown>mousedown</code> events.</dd>
+
+
+ <dt>Change the selection</dt>
+
+ <dd><p>User agents must allow users to change <a href=#the-selection>the
+ selection</a> within an editing host, even into nested editable
+ elements. User agents may prevent selections from being made in
+ ways that cross from editable elements into non-editable elements
+ (e.g. by making each non-editable descendant atomically selectable,
+ but not allowing text selection within them). This could be
+ triggered as the default action of <code title=event-keydown>keydown</code> events with various key
+ identifiers and as the default action of <code title=event-mousedown>mousedown</code> events.</dd>
+
+
+ <dt id=contenteditable-insertText>Insert text</dt>
+
+ <dd><p>This action must be triggered as the default action of a
+ <code title=event-textInput>textInput</code> event, and may be
+ triggered by other commands as well. It must cause the user agent
+ to insert the specified text (given by the event object's <code title="">data</code> attribute in the case of the <code title=event-textInput>textInput</code> event) at the caret.</p>
+
+ <p>If the caret is positioned somewhere where <a href=#phrasing-content>phrasing
+ content</a> is not allowed (e.g. inside an empty <code><a href=#the-ol-element>ol</a></code>
+ element), then the user agent must not insert the text directly at
+ the caret position. In such cases the behavior is UA-dependent,
+ but user agents must not, in response to a request to insert text,
+ generate a DOM that is less conformant than the DOM prior to the
+ request.</p>
+
+ <p>User agents should allow users to insert new paragraphs into
+ elements that contains only content other than paragraphs.</p>
+
+ <div class=example>
+ <p>For example, given the markup:</p>
+ <pre>&lt;section&gt;
+ &lt;dl&gt;
+ &lt;dt&gt; Ben &lt;/dt&gt;
+ &lt;dd&gt; Goat &lt;/dd&gt;
+ &lt;/dl&gt;
+&lt;/section&gt;</pre>
+ <p>...the user agent should allow the user to insert
+ <code><a href=#the-p-element>p</a></code> elements before and after the <code><a href=#the-dl-element>dl</a></code>
+ element, as children of the <code><a href=#the-section-element>section</a></code> element.</p>
+ </div>
+
+ </dd>
+
+
+ <dt id=contenteditable-breakBlock>Break block</dt>
+
+ <dd><p>UAs should offer a way for the user to request that the
+ current paragraph be broken at the caret, e.g. as the default
+ action of a <code title=event-keydown>keydown</code> event whose
+ identifier is the "Enter" key and that has no modifiers set.</p>
+
+ <p>The exact behavior is UA-dependent, but user agents must not,
+ in response to a request to break a paragraph, generate a DOM that
+ is less conformant than the DOM prior to the request.</dd>
+
+
+ <dt id=contenteditable-br>Insert a line separator</dt>
+
+ <dd><p>UAs should offer a way for the user to request an explicit
+ line break at the caret position without breaking the paragraph,
+ e.g. as the default action of a <code title=event-keydown>keydown</code> event whose identifier is the
+ "Enter" key and that has a shift modifier set. Line separators are
+ typically found within a poem verse or an address. To insert a line
+ break, the user agent must insert a <code><a href=#the-br-element>br</a></code> element.</p>
+
+ <p>If the caret is positioned somewhere where <a href=#phrasing-content>phrasing
+ content</a> is not allowed (e.g. in an empty <code><a href=#the-ol-element>ol</a></code>
+ element), then the user agent must not insert the <code><a href=#the-br-element>br</a></code>
+ element directly at the caret position. In such cases the behavior
+ is UA-dependent, but user agents must not, in response to a request
+ to insert a line separator, generate a DOM that is less conformant
+ than the DOM prior to the request.</dd>
+
+
+ <dt id=contenteditable-delete>Delete</dt>
+
+ <dd><p>UAs should offer a way for the user to delete text and
+ elements, including non-editable descendants, e.g. as the default
+ action of <code title=event-keydown>keydown</code> events whose
+ identifiers are "U+0008" or "U+007F".</p>
+
+ <p>Five edge cases in particular need to be considered carefully
+ when implementing this feature: backspacing at the start of an
+ element, backspacing when the caret is immediately after an
+ element, forward-deleting at the end of an element,
+ forward-deleting when the caret is immediately before an element,
+ and deleting a <a href=#the-selection title="the selection">selection</a> whose
+ start and end points do not share a common parent node.</p>
+
+ <p>In any case, the exact behavior is UA-dependent, but user
+ agents must not, in response to a request to delete text or an
+ element, generate a DOM that is less conformant than the DOM prior
+ to the request.</dd>
+
+
+ <dt id=contenteditable-wrapSemantic>Insert, and wrap text in,
+ semantic elements</dt>
+
+ <dd><p>UAs should offer the user the ability to mark text and
+ paragraphs with semantics that HTML can express.</p>
+
+ <p>UAs should similarly offer a way for the user to insert empty
+ semantic elements to subsequently fill by entering text
+ manually.</p>
+
+ <p>UAs should also offer a way to remove those semantics from
+ marked up text, and to remove empty semantic element that have been
+ inserted.</p>
+
+ <p>In response to a request from a user to mark text up in italics,
+ user agents should use the <code><a href=#the-i-element>i</a></code> element to represent the
+ semantic. The <code><a href=#the-em-element>em</a></code> element should be used only if the
+ user agent is sure that the user means to indicate stress
+ emphasis.</p>
+
+ <p>In response to a request from a user to mark text up in bold,
+ user agents should use the <code><a href=#the-b-element>b</a></code> element to represent the
+ semantic. The <code><a href=#the-strong-element>strong</a></code> element should be used only if
+ the user agent is sure that the user means to indicate
+ importance.</p>
+
+ <p>The exact behavior is UA-dependent, but user agents must not,
+ in response to a request to wrap semantics around some text or to
+ insert or remove a semantic element, generate a DOM that is less
+ conformant than the DOM prior to the request.</dd>
+
+
+ <dt>Select and move non-editable elements nested inside editing hosts</dt>
+
+ <dd><p>UAs should offer a way for the user to move images and other
+ non-editable parts around the content within an editing host. This
+ may be done using the <a href=#dnd>drag and drop</a> mechanism. User
+ agents must not, in response to a request to move non-editable
+ elements nested inside editing hosts, generate a DOM that is less
+ conformant than the DOM prior to the request.</dd>
+
+
+ <dt>Edit form controls nested inside editing hosts</dt>
+
+ <dd><p>When an <a href=#editable>editable</a> form control is edited, the
+ changes must be reflected in both its current value <em>and</em>
+ its default value. For <code><a href=#the-input-element>input</a></code> elements this means
+ updating the <code title=dom-input-defaultValue><a href=#dom-input-defaultvalue>defaultValue</a></code> IDL attribute as
+ well as the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL
+ attribute; for <code><a href=#the-select-element>select</a></code> elements it means updating the
+ <code><a href=#the-option-element>option</a></code> elements' <code title=dom-option-defaultSelected><a href=#dom-option-defaultselected>defaultSelected</a></code> IDL
+ attribute as well as the <code title=dom-option-selected><a href=#dom-option-selected>selected</a></code> IDL attribute; for
+ <code><a href=#the-textarea-element>textarea</a></code> elements this means updating the <code title=dom-textarea-defaultValue><a href=#dom-textarea-defaultvalue>defaultValue</a></code> IDL attribute
+ as well as the <code title=dom-textarea-value><a href=#dom-textarea-value>value</a></code> IDL
+ attribute. (Updating the <code title="">default*</code> IDL
+ attributes causes content attributes to be updated as well.)</dd>
+
+ </dl><p>User agents may perform several commands per user request; for
+ example if the user selects a block of text and hits
+ <kbd><kbd>Enter</kbd></kbd>, the UA might interpret that as a
+ request to delete the content of <a href=#the-selection>the selection</a> followed
+ by a request to break the paragraph at that position.</p>
+
+ <p>User agents may add <a href=#dom-changes>DOM changes</a> entries to the
+ <a href=#undo-transaction-history>undo transaction history</a> of the <a href=#editing-host>editing
+ host</a>'s <code><a href=#document>Document</a></code> object each time an action is
+ triggered.</p>
+
+ <p>All of the actions defined above, whether triggered by the user
+ or programmatically (e.g. by <code title=dom-document-execCommand><a href=#execCommand>execCommand()</a></code> commands),
+ must fire mutation events as appropriate.</p>
+
+ </div>
+
+
+
+ <h4 id=making-entire-documents-editable><span class=secno>8.7.2 </span>Making entire documents editable</h4>
+
+ <div class=impl>
+
+ <p>Documents have a <dfn id=designMode title=dom-document-designMode><code>designMode</code></dfn>, which
+ can be either enabled or disabled.</p>
+
+ </div>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-designMode><a href=#designMode>designMode</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns "<code title="">on</code>" if the document is editable,
+ and "<code title="">off</code>" if it isn't.</p>
+
+ <p>Can be set, to change the document's current state.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <code title=dom-document-designMode><a href=#designMode>designMode</a></code> IDL
+ attribute on the <code><a href=#document>Document</a></code> object takes two values,
+ "<code title="">on</code>" and "<code title="">off</code>". When it
+ is set, the new value must be compared in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner to these two values. If it matches
+ the "<code title="">on</code>" value, then <code title=dom-document-designMode><a href=#designMode>designMode</a></code> must be enabled,
+ and if it matches the "<code title="">off</code>" value, then <code title=dom-document-designMode><a href=#designMode>designMode</a></code> must be
+ disabled. Other values must be ignored.</p>
+
+ <p>When <code title=dom-document-designMode><a href=#designMode>designMode</a></code> is
+ enabled, the IDL attribute must return the value "<code title="">on</code>", and when it is disabled, it must return the
+ value "<code title="">off</code>".</p>
+
+ <p>The last state set must persist until the document is destroyed
+ or the state is changed. Initially, documents must have their <code title=dom-document-designMode><a href=#designMode>designMode</a></code> disabled.</p>
+
+ </div>
+
+
+
+ <h3 id=spelling-and-grammar-checking><span class=secno>8.8 </span>Spelling and grammar checking</h3>
+
+ <div class=impl>
+
+ <p>User agents can support the checking of spelling and grammar of
+ editable text, either in form controls (such as the value of
+ <code><a href=#the-textarea-element>textarea</a></code> elements), or in elements in an <a href=#editing-host>editing
+ host</a> (using <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>).</p>
+
+ <p>For each element, user agents must establish a <dfn id=concept-spellcheck-default title=concept-spellcheck-default>default behavior</dfn>, either
+ through defaults or through preferences expressed by the user. There
+ are three possible default behaviors for each element:</p>
+
+ <dl><dt><dfn id=concept-spellcheck-default-true title=concept-spellcheck-default-true>true-by-default</dfn>
+
+ <dd>The element will be checked for spelling and grammar if its
+ contents are editable.
+
+ <dt><dfn id=concept-spellcheck-default-false title=concept-spellcheck-default-false>false-by-default</dfn>
+
+ <dd>The element will never be checked for spelling and grammar.
+
+ <dt><dfn id=concept-spellcheck-default-inherit title=concept-spellcheck-default-inherit>inherit-by-default</dfn>
+
+ <dd>The element's default behavior is the same as its parent
+ element's. Elements that have no parent element cannot have this as
+ their default behavior.
+
+ </dl><hr></div>
+
+ <p>The <dfn id=attr-spellcheck title=attr-spellcheck><code>spellcheck</code></dfn>
+ attribute is an <a href=#enumerated-attribute>enumerated attribute</a> whose keywords are
+ the empty string, <code title="">true</code> and <code title="">false</code>. The empty string and the <code title="">true</code> keyword map to the <i>true</i> state. The <code title="">false</code> keyword maps to the <i>false</i> state. In
+ addition, there is a third state, the <i>default</i> state, which is
+ the <i>missing value default</i> (and the <i>invalid value
+ default</i>).</p>
+
+ <p>The <i>true</i> state indicates that the element is to have its
+ spelling and grammar checked. The <i>default</i> state indicates
+ that the element is to act according to a default behavior, possibly
+ based on the parent element's own <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> state. The <i>false</i>
+ state indicates that the element is not to be checked.</p>
+
+ <div class=impl>
+
+ <hr></div>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-spellcheck><a href=#dom-spellcheck>spellcheck</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns "<code title="">true</code>", "<code title="">false</code>", or "<code title="">default</code>", based
+ on the state of the <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> attribute.</p>
+
+ <p>Can be set, to change that state.</p>
+
+ <p>Throws a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception if the new value
+ isn't one of those strings.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-spellcheck title=dom-spellcheck><code>spellcheck</code></dfn> IDL
+ attribute, on getting, must return the string "<code title="">true</code>" if the content attribute is set to the true
+ state, <code title="">false</code>" if the content attribute is set
+ to the false state, and "<code title="">default</code>"
+ otherwise. On setting, if the new value is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">default</code>" then the content attribute must be removed,
+ if the new value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
+ the string "<code title="">true</code>" then the content attribute
+ must be set to the string "<code title="">true</code>", if the new
+ value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
+ "<code title="">false</code>" then the content attribute must be set
+ to the string "<code title="">false</code>", and otherwise the
+ attribute setter must raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception.</p>
+
+ <p class=note>The <code title=dom-spellcheck><a href=#dom-spellcheck>spellcheck</a></code>
+ IDL attribute is not affected by user preferences that override the
+ <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute,
+ and therefore might not reflect the actual spellchecking state.</p>
+
+ <p>On setting, if the new value is true, then the element's <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute must be
+ set to the literal string "<code title="">true</code>", otherwise it
+ must be set to the literal string "<code title="">false</code>".
+
+ <hr><p>User agents must only consider the following pieces of text as
+ checkable for the purposes of this feature:</p>
+
+ <ul><li>The value of <code><a href=#the-input-element>input</a></code> elements to which the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute applies,
+ whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attributes are not
+ in the <a href=#password-state title=attr-input-type-password>Password</a>
+ state, and that are not <i title=concept-input-immutable><a href=#concept-input-immutable>immutable</a></i> (i.e. that do not
+ have the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>
+ attribute specified and that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>).</li>
+
+ <li>The value of <code><a href=#the-textarea-element>textarea</a></code> elements that do not have a
+ <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute and
+ that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</li>
+
+ <li>Text in <a href=#text-node title="text node">text nodes</a> that are
+ children of <a href=#editable>editable</a> elements.</li>
+
+ <li>Text in attributes of <a href=#editable>editable</a> elements.</li>
+
+ </ul><p>For text that is part of a <a href=#text-node>text node</a>, the element
+ with which the text is associated is the element that is the
+ immediate parent of the first character of the word, sentence, or
+ other piece of text. For text in attributes, it is the attribute's
+ element. For the values of <code><a href=#the-input-element>input</a></code> and
+ <code><a href=#the-textarea-element>textarea</a></code> elements, it is the element itself.</p>
+
+ <p>To determine if a word, sentence, or other piece of text in an
+ applicable element (as defined above) is to have spelling- and/or
+ grammar-checking enabled, the UA must use the following
+ algorithm:</p>
+
+ <ol><!-- user override --><li>If the user has disabled the checking for this text, then the
+ checking is disabled.</li>
+
+ <li>Otherwise, if the user has forced the checking for this text to
+ always be enabled, then the checking is enabled.</li>
+
+ <!-- content attribute: on, off -->
+
+ <li>Otherwise, if the element with which the text is associated has
+ a <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content
+ attribute, then: if that attribute is in the <i>true</i> state,
+ then checking is enabled; otherwise, if that attribute is in the
+ <i>false</i> state, then checking is disabled.</li>
+
+ <!-- inherit, if there is one to inherit from -->
+
+ <li>Otherwise, if there is an ancestor element with a <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute that is
+ not in the <i>default</i> state, then: if the nearest such
+ ancestor's <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content
+ attribute is in the <i>true</i> state, then checking is enabled;
+ otherwise, checking is disabled.</li>
+
+ <!-- default -->
+
+ <li>Otherwise, if the element's <a href=#concept-spellcheck-default title=concept-spellcheck-default>default behavior</a> is <a href=#concept-spellcheck-default-true title=concept-spellcheck-default-true>true-by-default</a>,
+ then checking is enabled.</li>
+
+ <li>Otherwise, if the element's <a href=#concept-spellcheck-default title=concept-spellcheck-default>default behavior</a> is <a href=#concept-spellcheck-default-false title=concept-spellcheck-default-false>false-by-default</a>,
+ then checking is disabled.</li>
+
+ <!-- default inheritance -->
+
+ <li>Otherwise, if the element's parent element has <em>its</em>
+ checking enabled, then checking is enabled.</li>
+
+ <li>Otherwise, checking is disabled.</li>
+
+ </ol><p>If the checking is enabled for a word/sentence/text, the user
+ agent should indicate spelling and/or grammar errors in that
+ text. User agents should take into account the other semantics given
+ in the document when suggesting spelling and grammar
+ corrections. User agents may use the language of the element to
+ determine what spelling and grammar rules to use, or may use the
+ user's preferred language settings. UAs should use
+ <code><a href=#the-input-element>input</a></code> element attributes such as <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> to ensure that the
+ resulting value is valid, where possible.</p>
+
+ <p>If checking is disabled, the user agent should not indicate
+ spelling or grammar errors for that text.</p>
+
+ <div class=example>
+
+ <p>The element with ID "a" in the following example would be the
+ one used to determine if the word "Hello" is checked for spelling
+ errors. In this example, it would not be.</p>
+
+ <pre>&lt;div contenteditable="true"&gt;
+ &lt;span spellcheck="false" id="a"&gt;Hell&lt;/span&gt;&lt;em&gt;o!&lt;/em&gt;
+&lt;/div&gt;</pre>
+
+ <p>The element with ID "b" in the following example would have
+ checking enabled (the leading space character in the attribute's
+ value on the <code><a href=#the-input-element>input</a></code> element causes the attribute to be
+ ignored, so the ancestor's value is used instead, regardless of the
+ default).</p>
+
+ <pre>&lt;p spellcheck="true"&gt;
+ &lt;label&gt;Name: &lt;input spellcheck=" false" id="b"&gt;&lt;/label&gt;
+&lt;/p&gt;</pre>
+
+ </div>
+
+ </div>
+
+ <p class=note>This specification does not define the user
+ interface for spelling and grammar checkers. A user agent could
+ offer on-demand checking, could perform continuous checking while
+ the checking is enabled, or could use other interfaces.</p>
+
+
+ <h3 id=dnd><span class=secno>8.9 </span><dfn>Drag and drop</dfn></h3>
+
+<!-- v2 ideas for drag and drop:
+
+ * being able to animate a drop target:
+
+ > To implement this with simple interface I've proposed, events
+ > should be handled either by existing elements (like list
+ > items that compare their size and position of dragged element
+ > to decide whether element should be dropped before or after)
+ > or handled by container that would probably need to calculate
+ > positions of it's children and create new element to show
+ > drop target. Smooth Mac-like drag'n'drop can be implemented
+ > by animating drop target's padding/margin. So that's quite a
+ > bit of code that's going to be reinvented each time someone
+ > implements reordering.
+
+ <hyatt> :droptarget
+ <hyatt> or something
+ <hyatt> we don't support a pseudo-class for the drop target but that's a great idea
+ <Hixie_> yeah, thinking about that too
+ <Hixie_> :drop-target, :drop-target(above), :drop-target(below) and having ondragover be able to say "not on me, but next to me maybe"
+
+ * We should let drop targets communicate back to drag sources if
+ they want to communicate. (e.g. expose Window, and thus
+ postMessage(), on the dataTransfer object on drop.)
+
+ We should let drag sources provide a set of options via a
+ context menu when the drop happens. (So that, e.g., the source
+ can know whether a capabilities URI that it is passing along is
+ supposed to be read-write access or read-only access to the
+ object being dragged.)
+
+ We should let potential drop targets see the types (but not the
+ contents!) of dragged data so they can establish if they care
+ or not. (dataTransfer.hasType())
+
+ Ack: Ben Laurie (@g)
+
+ * Promises. Should be able to say "if you accept this drop, then
+ I can provide the File object that corresponds to it
+ eventually".
+
+ * Exposing more information about each item. Best idea (from
+ Eduard Pascual) is to have a new attribute on dataTransfer
+ that's a list of items, each of which has:
+
+ dataTransfer.items = DataTransferItems
+
+ DataTransferItems.length
+ .getItem(n) = DataTransferItem
+ .add(stringData, type)
+ .add(blobData)
+ .add(fileData)
+ .add(dataTransferItem)
+ .clear()
+
+ DataTransferItem.kind = 'string', 'file', 'blob', ...
+ .type = MIME type
+ .binary = boolean
+ .getTextData(function callback (data)) - throws if binary is true
+ .getBlob() - returns File or Blob
+
+-->
+
+ <p>This section defines an event-based drag-and-drop mechanism.</p>
+
+ <p>This specification does not define exactly what a
+ <em>drag-and-drop operation</em> actually is.</p>
+
+ <p>On a visual medium with a pointing device, a drag operation could
+ be the default action of a <code title=event-mousedown>mousedown</code> event that is followed by a
+ series of <code title=event-mousemove>mousemove</code> events, and
+ the drop could be triggered by the mouse being released.</p>
+
+ <p>On media without a pointing device, the user would probably have
+ to explicitly indicate his intention to perform a drag-and-drop
+ operation, stating what he wishes to drag and what he wishes to
+ drop, respectively.</p>
+
+ <div class=impl>
+
+ <p>However it is implemented, drag-and-drop operations must have a
+ starting point (e.g. where the mouse was clicked, or the start of
+ <a href=#the-selection>the selection</a> or element that was selected for the
+ drag), may have any number of intermediate steps (elements that the
+ mouse moves over during a drag, or elements that the user picks as
+ possible drop points as he cycles through possibilities), and must
+ either have an end point (the element above which the mouse button
+ was released, or the element that was finally selected), or be
+ canceled. The end point must be the last element selected as a
+ possible drop point before the drop occurs (so if the operation is
+ not canceled, there must be at least one element in the middle
+ step).</p>
+
+ </div>
+
+
+ <h4 id=introduction-5><span class=secno>8.9.1 </span>Introduction</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>To make an element draggable is simple: give the element a <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> attribute, and set an event
+ listener for <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> that
+ stores the data being dragged.</p>
+
+ <p>The event handler typically needs to check that it's not a text
+ selection that is being dragged, and then needs to store data into
+ the <code><a href=#datatransfer>DataTransfer</a></code> object and set the allowed effects
+ (copy, move, link, or some combination).</p>
+
+ <p>For example:</p>
+
+ <pre>&lt;p&gt;What fruits do you like?&lt;/p&gt;
+&lt;ol ondragstart="dragStartHandler(event)"&gt;
+ &lt;li draggable data-value="fruit-apple"&gt;Apples&lt;/li&gt;
+ &lt;li draggable data-value="fruit-orange"&gt;Oranges&lt;/li&gt;
+ &lt;li draggable data-value="fruit-pear"&gt;Pears&lt;/li&gt;
+&lt;/ol&gt;
+&lt;script&gt;
+ var internalDNDType = 'text/x-example'; // set this to something specific to your site
+ function dragStartHandler(event) {
+ if (event.target instanceof HTMLLIElement) {
+ // use the element's data-value="" attribute as the value to be moving:
+ event.dataTransfer.setData(internalDNDType, event.target.dataset.value);
+ event.effectAllowed = 'move'; // only allow moves
+ } else {
+ event.preventDefault(); // don't allow selection to be dragged
+ }
+ }
+&lt;/script&gt;</pre>
+
+ <hr><p>To accept a drop, the drop target has to listen to at least three
+ events. First, the <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code>
+ event, which is used to determine whether or not the drop target is
+ to accept the drop. If the drop is to be accepted, then this event
+ has to be canceled. Second, the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event, which is used to
+ determine what feedback is to be shown to the user. If the event is
+ canceled, then the feedback (typically the cursor) is updated based
+ on the <code title=dom-DataTransfer-DropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code>
+ attribute's value, as set by the event handler; otherwise, the
+ default behavior (typically to do nothing) is used instead. Finally,
+ the <code title=event-drop><a href=#event-drop>drop</a></code> event, which allows the
+ actual drop to be performed. This event also needs to be canceled,
+ so that the <code title=dom-DataTransfer-DropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute's
+ value can be used by the source (otherwise it's reset).</p>
+
+ <p>For example:</p>
+
+ <pre>&lt;p&gt;Drop your favorite fruits below:&lt;/p&gt;
+&lt;ol class="dropzone"
+ ondragenter="dragEnterHandler(event)"
+ ondragover="dragOverHandler(event)"
+ ondrop="dropHandler(event)"&gt;
+&lt;/ol&gt;
+&lt;script&gt;
+ var internalDNDType = 'text/x-example'; // set this to something specific to your site
+ function dragEnterHandler(event) {
+ // cancel the event if the drag contains data of our type
+ if (event.dataTransfer.types.contains(internalDNDType))
+ event.preventDefault();
+ }
+ function dragOverHandler(event) {
+ event.dataTransfer.dropEffect = 'move';
+ event.preventDefault();
+ }
+ function dropHandler(event) {
+ // drop the data
+ var li = document.createElement('li');
+ var data = event.dataTransfer.getData(internalDNDType);
+ if (data == 'fruit-apple') {
+ li.textContent = 'Apples';
+ } else if (data == 'fruit-orange') {
+ li.textContent = 'Oranges';
+ } else if (data == 'fruit-pear') {
+ li.textContent = 'Pears';
+ } else {
+ li.textContent = 'Unknown Fruit';
+ }
+ event.target.appendChild(li);
+ }
+&lt;/script&gt;</pre>
+
+ <hr><p>To remove the original element (the one that was dragged) from
+ the display, the <code title=event-dragend><a href=#event-dragend>dragend</a></code> event
+ can be used.</p>
+
+ <p>For our example here, that means updating the original markup to
+ handle that event:</p>
+
+
+ <pre>&lt;p&gt;What fruits do you like?&lt;/p&gt;
+&lt;ol ondragstart="dragStartHandler(event)" ondragend="dragEndHandler(event)"&gt;
+ <em>...as before...</em>
+&lt;/ol&gt;
+&lt;script&gt;
+ function dragStartHandler(event) {
+ // <em>...as before...</em>
+ }
+ function dragEndHandler(event) {
+ // remove the dragged element
+ event.target.parentNode.removeChild(event.target);
+ }
+&lt;/script&gt;</pre>
+
+
+
+
+ <h4 id=the-dragevent-and-datatransfer-interfaces><span class=secno>8.9.2 </span>The <code><a href=#dragevent>DragEvent</a></code> and <code><a href=#datatransfer>DataTransfer</a></code> interfaces</h4>
+
+ <p>The drag-and-drop processing model involves several events. They
+ all use the <code><a href=#dragevent>DragEvent</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=dragevent>DragEvent</dfn> : <span>MouseEvent</span> {
+ readonly attribute <a href=#datatransfer>DataTransfer</a> <a href=#dom-dragevent-datatransfer title=dom-DragEvent-dataTransfer>dataTransfer</a>;
+
+ void <a href=#dom-dragevent-initdragevent title=dom-DragEvent-initDragEvent>initDragEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dummyArg<!-- used to be viewArg, back when we had views -->, in long detailArg, in long screenXArg, in long screenYArg, in long clientXArg, in long clientYArg, in boolean ctrlKeyArg, in boolean altKeyArg, in boolean shiftKeyArg, in boolean metaKeyArg, in unsigned short buttonArg, in EventTarget relatedTargetArg, in <a href=#datatransfer>DataTransfer</a> dataTransferArg);
+};</pre>
+
+ <dl class=domintro><dt><var title="">event</var> . <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#datatransfer>DataTransfer</a></code> object for the event.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-dragevent-initdragevent title=dom-DragEvent-initDragEvent><code>initDragEvent()</code></dfn>
+ method must initialize the event in a manner analogous to the
+ similarly-named method in the DOM Events interfaces, except that the
+ <var title="">dummyArg</var> argument must be ignored. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>The <dfn id=dom-dragevent-datatransfer title=dom-DragEvent-dataTransfer><code>dataTransfer</code></dfn>
+ attribute of the <code><a href=#dragevent>DragEvent</a></code> interface represents the
+ context information for the event.</p>
+
+ </div>
+
+ <pre class=idl>interface <dfn id=datatransfer>DataTransfer</dfn> {
+ attribute DOMString <a href=#dom-datatransfer-dropeffect title=dom-DataTransfer-dropEffect>dropEffect</a>;
+ attribute DOMString <a href=#dom-datatransfer-effectallowed title=dom-DataTransfer-effectAllowed>effectAllowed</a>;
+
+ readonly attribute DOMStringList <a href=#dom-datatransfer-types title=dom-DataTransfer-types>types</a>;
+ void <a href=#dom-datatransfer-cleardata title=dom-DataTransfer-clearData>clearData</a>(in optional DOMString format);
+ void <a href=#dom-datatransfer-setdata title=dom-DataTransfer-setData>setData</a>(in DOMString format, in DOMString data);
+ DOMString <a href=#dom-datatransfer-getdata title=dom-DataTransfer-getData>getData</a>(in DOMString format);
+ readonly attribute <span>FileList</span> <a href=#dom-datatransfer-files title=dom-DataTransfer-files>files</a>;
+
+ void <a href=#dom-datatransfer-setdragimage title=dom-DataTransfer-setDragImage>setDragImage</a>(in Element image, in long x, in long y);
+ void <a href=#dom-datatransfer-addelement title=dom-DataTransfer-addElement>addElement</a>(in Element element);
+};</pre>
+
+ <p><code><a href=#datatransfer>DataTransfer</a></code> objects can hold pieces of data, each
+ associated with a unique format. Formats are generally given by
+ <a href=#mime-type title="MIME type">MIME types</a>, with some values
+ special-cased for legacy reasons. However, the API does not enforce
+ this; non-MIME-type values can be added as well. All formats are
+ identified by strings that are <a href=#converted-to-ascii-lowercase>converted to ASCII
+ lowercase</a> by the API.</p>
+
+ <dl class=domintro><dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the kind of operation that is currently selected. If
+ the kind of operation isn't one of those that is allowed by the
+ <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
+ attribute, then the operation will fail.</p>
+
+ <p>Can be set, to change the selected operation.</p>
+
+ <p>The possible values are <code title="">none</code>, <code title="">copy</code>, <code title="">link</code>, and <code title="">move</code>.</p>
+
+ </dd>
+
+ <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the kinds of operations that are to be allowed.</p>
+
+ <p>Can be set, to change the allowed operations.</p>
+
+ <p>The possible values are <code title="">none</code>, <code title="">copy</code>, <code title="">copyLink</code>, <code title="">copyMove</code>, <code title="">link</code>, <code title="">linkMove</code>, <code title="">move</code>, <code title="">all</code>, and <code title="">uninitialized</code>,</p>
+
+ </dd>
+
+ <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-types><a href=#dom-datatransfer-types>types</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code>DOMStringList</code> listing the formats that
+ were set in the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code>
+ event. In addition, if any files are being dragged, then one of
+ the types will be the string "<code title="">Files</code>".</p>
+
+ </dd>
+
+ <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData</a></code>( [ <var title="">format</var> ] )</dt>
+
+ <dd>
+
+ <p>Removes the data of the specified formats. Removes all data if
+ the argument is omitted.</p>
+
+ </dd>
+
+ <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-setData><a href=#dom-datatransfer-setdata>setData</a></code>(<var title="">format</var>, <var title="">data</var>)</dt>
+
+ <dd>
+
+ <p>Adds the specified data.</p>
+
+ </dd>
+
+ <dt><var title="">data</var> = <var title="">dataTransfer</var> . <code title=dom-DataTransfer-getData><a href=#dom-datatransfer-getdata>getData</a></code>(<var title="">format</var>)</dt>
+
+ <dd>
+
+ <p>Returns the specified data. If there is no such data, returns the empty string.</p>
+
+ </dd>
+
+ <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-files><a href=#dom-datatransfer-files>files</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code>FileList</code> of the files being dragged, if any.</p>
+
+ </dd>
+
+ <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-setDragImage><a href=#dom-datatransfer-setdragimage>setDragImage</a></code>(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Uses the given element to update the drag feedback, replacing any previously specified feedback.</p>
+
+ </dd>
+
+ <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-addElement><a href=#dom-datatransfer-addelement>addElement</a></code>(<var title="">element</var>)</dt>
+
+ <dd>
+
+ <p>Adds the given element to the list of elements used to render the drag feedback.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>When a <code><a href=#datatransfer>DataTransfer</a></code> object is created, it must be
+ initialized as follows:</p>
+
+ <ul><li>The <code><a href=#datatransfer>DataTransfer</a></code> object must initially contain no
+ data, no elements, and have no associated image.</li>
+
+ <li>The <code><a href=#datatransfer>DataTransfer</a></code> object's <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
+ attribute must be set to "<code title="">uninitialized</code>".</li>
+
+ <li>The <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code>
+ attribute must be set to "<code title="">none</code>".</li>
+
+ </ul><p>The <dfn id=dom-datatransfer-dropeffect title=dom-DataTransfer-dropEffect><code>dropEffect</code></dfn>
+ attribute controls the drag-and-drop feedback that the user is given
+ during a drag-and-drop operation.</p>
+
+ <p>The attribute must ignore any attempts to set it to a value other
+ than <code title="">none</code>, <code title="">copy</code>, <code title="">link</code>, and <code title="">move</code>. On getting,
+ the attribute must return the last of those four values that it was
+ set to.</p>
+
+ <p>The <dfn id=dom-datatransfer-effectallowed title=dom-DataTransfer-effectAllowed><code>effectAllowed</code></dfn>
+ attribute is used in the drag-and-drop processing model to
+ initialize the <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute
+ during the <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> and <code title=event-dragover><a href=#event-dragover>dragover</a></code> events.</p>
+
+ <p>The attribute must ignore any attempts to set it to a value other
+ than <code title="">none</code>, <code title="">copy</code>, <code title="">copyLink</code>, <code title="">copyMove</code>, <code title="">link</code>, <code title="">linkMove</code>, <code title="">move</code>, <code title="">all</code>, and <code title="">uninitialized</code>. On getting, the attribute must return
+ the last of those values that it was set to.</p>
+
+ <p>The <dfn id=dom-datatransfer-types title=dom-DataTransfer-types><code>types</code></dfn>
+ attribute must return a <a href=#live>live</a> <code>DOMStringList</code>
+ that contains the list of formats that were added to the
+ <code><a href=#datatransfer>DataTransfer</a></code> object in the corresponding <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event. The same object must
+ be returned each time. If any files were included in the drag, then
+ the <code>DOMStringList</code> object must in addition include the
+ string "<code title="">Files</code>". (This value can be
+ distinguished from the other values because it is not
+ lowercase.)</p>
+
+ <p>The <dfn id=dom-datatransfer-cleardata title=dom-DataTransfer-clearData><code>clearData()</code></dfn>
+ method, when called with no arguments, must clear the
+ <code><a href=#datatransfer>DataTransfer</a></code> object of all data (for all formats).</p>
+
+ <p class=note>The <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData()</a></code> method does
+ not affect whether any files were included in the drag, so the <code title=dom-DataTransfer-types><a href=#dom-datatransfer-types>types</a></code> attribute's list might
+ still not be empty after calling <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData()</a></code> (it would
+ still contain the "<code title="">Files</code>" string if any files
+ were included in the drag).</p>
+
+ <p>When called with an argument, the <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData(<var title="">format</var>)</a></code> method must clear the
+ <code><a href=#datatransfer>DataTransfer</a></code> object of any data associated with the
+ given <var title="">format</var>, <a href=#converted-to-ascii-lowercase>converted to ASCII
+ lowercase</a>. If <var title="">format</var> (after conversion to
+ lowercase) is the value "<code title="">text</code>", then it must
+ be treated as "<code title="">text/plain</code>". If the <var title="">format</var> (after conversion to lowercase) is "<code title="">url</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>
+
+ <p>The <dfn id=dom-datatransfer-setdata title=dom-DataTransfer-setData><code>setData(<var title="">format</var>, <var title="">data</var>)</code></dfn> method
+ must add <var title="">data</var> to the data stored in the
+ <code><a href=#datatransfer>DataTransfer</a></code> object, labeled as being of the type <var title="">format</var>, <a href=#converted-to-ascii-lowercase>converted to ASCII
+ lowercase</a>. This must replace any previous data that had been
+ set for that format. If <var title="">format</var> (after conversion
+ to lowercase) is the value "<code title="">text</code>", then it
+ must be treated as "<code title="">text/plain</code>". If the <var title="">format</var> (after conversion to lowercase) is "<code title="">url</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>
+
+ <p>The <dfn id=dom-datatransfer-getdata title=dom-DataTransfer-getData><code>getData(<var title="">format</var>)</code></dfn> method must return the data that
+ is associated with the type <var title="">format</var>
+ <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, if any, and must return
+ the empty string otherwise. If <var title="">format</var> (after
+ conversion to lowercase) is the value "<code title="">text</code>",
+ then it must be treated as "<code title="">text/plain</code>". If
+ the <var title="">format</var> (after conversion to lowercase) is
+ "<code title="">url</code>", then the data associated with the
+ "<code title="">text/uri-list</code>" format must be parsed as
+ appropriate for <code title="">text/uri-list</code> data, and the
+ first URL from the list must be returned. If there is no data with
+ that format, or if there is but it has no URLs, then the method must
+ return the empty string. <a href=#refsRFC2483>[RFC2483]</a></p>
+
+ <p>The <dfn id=dom-datatransfer-files title=dom-DataTransfer-files><code>files</code></dfn>
+ attribute must return the <code>FileList</code> object that contains
+ the files that are stored in the <code><a href=#datatransfer>DataTransfer</a></code>
+ object. There is one such object per <code><a href=#datatransfer>DataTransfer</a></code>
+ object.</p>
+
+ <p class=note>This version of the API does not expose the types of
+ the files during the drag.</p>
+
+ <p>The <dfn id=dom-datatransfer-setdragimage title=dom-DataTransfer-setDragImage><code>setDragImage(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>)</code></dfn> method sets which element to use <a href=#base-dnd-feedback>to generate the drag feedback</a>. The
+ <var title="">element</var> argument can be any
+ <code><a href=#element>Element</a></code>; if it is an <code><a href=#the-img-element>img</a></code> element, then the
+ user agent should use the element's image (at its intrinsic size) to
+ generate the feedback, otherwise the user agent should base the
+ feedback on the given element (but the exact mechanism for doing so
+ is not specified).</p>
+
+ <p>The <dfn id=dom-datatransfer-addelement title=dom-DataTransfer-addElement><code>addElement(<var title="">element</var>)</code></dfn> method is an alternative way of
+ specifying how the user agent is to <a href=#base-dnd-feedback>render the drag feedback</a>. It adds an
+ element to the <code><a href=#datatransfer>DataTransfer</a></code> object.</p>
+
+ <p class=note>The difference between <code title=dom-DataTransfer-setDragImage><a href=#dom-datatransfer-setdragimage>setDragImage()</a></code> and
+ <code title=dom-DataTransfer-addElement><a href=#dom-datatransfer-addelement>addElement()</a></code> is
+ that the latter automatically generates the image based on the
+ current rendering of the elements added, whereas the former uses the
+ exact specified image.</p>
+
+ </div>
+
+
+ <h4 id=dndevents><span class=secno>8.9.3 </span>Events fired during a drag-and-drop action</h4>
+
+ <p>The following events are involved in the drag-and-drop
+ model.</p>
+
+ <div class=impl>
+
+ <p>Whenever the processing model described below causes one of these
+ events to be fired, the event fired must use the
+ <code><a href=#dragevent>DragEvent</a></code> interface defined above, must have the
+ bubbling and cancelable behaviors given in the table below, and must
+ have the context information set up as described after the table,
+ with the <code title=dom-UIEvent-detail>detail</code> attribute
+ set to zero, the mouse and key attributes set according to the state
+ of the input devices as they would be for user interaction events,
+ and the <code title="">relatedTarget</code> attribute set to
+ null.</p>
+
+ <p>If there is no relevant pointing device, the object must have its
+ <code title="">screenX</code>, <code title="">screenY</code>, <code title="">clientX</code>, <code title="">clientY</code>, and <code title="">button</code> attributes set to 0.</p>
+
+ <!-- interaction event spec point -->
+
+ </div>
+
+ <table><thead><tr><th> Event Name </th>
+ <th> Target </th>
+ <th> Bubbles? </th>
+ <th> Cancelable? </th>
+ <th> <code title=dom-DataTransfer-dataTransfer>dataTransfer</code> </th>
+ <th> <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> </th>
+ <th> <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> </th>
+ <th> Default Action </th>
+ <tbody><tr><td><dfn id=event-dragstart title=event-dragstart><code>dragstart</code></dfn></td>
+ <td><a href=#source-node>Source node</a></td>
+ <td>&#10003; Bubbles</td>
+ <td>&#10003; Cancelable</td>
+ <td>Contains <a href=#source-node>source node</a> unless a selection is being dragged, in which case it is empty; <code title=dom-datatransfer-files><a href=#dom-datatransfer-files>files</a></code> returns any files included in the drag operation</td>
+ <td><code title="">uninitialized</code></td>
+ <td><code title="">none</code></td>
+ <td>Initiate the drag-and-drop operation</td>
+ <tr><td><dfn id=event-drag title=event-drag><code>drag</code></dfn></td>
+ <td><a href=#source-node>Source node</a></td>
+ <td>&#10003; Bubbles</td>
+ <td>&#10003; Cancelable</td>
+ <td>Empty</td>
+ <td><a href=#effectAllowed-initialization>Same as last event</a></td>
+ <td><code title="">none</code></td>
+ <td>Continue the drag-and-drop operation</td>
+ <tr><td><dfn id=event-dragenter title=event-dragenter><code>dragenter</code></dfn></td>
+ <td><a href=#immediate-user-selection>Immediate user selection</a> or <a href=#the-body-element>the body element</a></td>
+ <td>&#10003; Bubbles</td>
+ <td>&#10003; Cancelable</td>
+ <td>Empty</td>
+ <td><a href=#effectAllowed-initialization>Same as last event</a></td>
+ <td><a href=#dropEffect-initialization>Based on <code>effectAllowed</code> value</a></td>
+ <td>Reject <a href=#immediate-user-selection>immediate user selection</a> as potential <a href=#current-target-element title="current target element">target element</a></td>
+ <tr><td><dfn id=event-dragleave title=event-dragleave><code>dragleave</code></dfn></td>
+ <td><a href=#current-target-element title="current target element">Previous target element</a></td>
+ <td>&#10003; Bubbles</td>
+ <td>&mdash;</td>
+ <td>Empty</td>
+ <td><a href=#effectAllowed-initialization>Same as last event</a></td>
+ <td><code title="">none</code></td>
+ <td>None</td>
+ <tr><td><dfn id=event-dragover title=event-dragover><code>dragover</code></dfn></td>
+ <td><a href=#current-target-element>Current target element</a></td>
+ <td>&#10003; Bubbles</td>
+ <td>&#10003; Cancelable</td>
+ <td>Empty</td>
+ <td><a href=#effectAllowed-initialization>Same as last event</a></td>
+ <td><a href=#dropEffect-initialization>Based on <code>effectAllowed</code> value</a></td>
+ <td>Reset the <a href=#current-drag-operation>current drag operation</a> to "none"</td>
+ <tr><td><dfn id=event-drop title=event-drop><code>drop</code></dfn></td>
+ <td><a href=#current-target-element>Current target element</a></td>
+ <td>&#10003; Bubbles</td>
+ <td>&#10003; Cancelable</td>
+ <td><code title=dom-datatransfer-getdata><a href=#dom-datatransfer-getdata>getData()</a></code> returns data set in <code title=dom-dragstart>dragstart</code> event; <code title=dom-datatransfer-files><a href=#dom-datatransfer-files>files</a></code> returns any files included in the drag operation</td>
+ <td><a href=#effectAllowed-initialization>Same as last event</a></td>
+ <td><a href=#current-drag-operation>Current drag operation</a></td>
+ <td>Varies</td>
+ <tr><td><dfn id=event-dragend title=event-dragend><code>dragend</code></dfn></td>
+ <td><a href=#source-node>Source node</a></td>
+ <td>&#10003; Bubbles</td>
+ <td>&mdash;</td>
+ <td>Empty</td>
+ <td><a href=#effectAllowed-initialization>Same as last event</a></td>
+ <td><a href=#current-drag-operation>Current drag operation</a></td>
+ <td>Varies</td>
+ </table><p class=note>"Empty" in the table above means that the <code title=dom-datatransfer-getdata><a href=#dom-datatransfer-getdata>getData()</a></code> and <code title=dom-dataTransfer-files><a href=#dom-datatransfer-files>files</a></code> attributes act as if
+ there is no data being dragged.</p>
+
+ <div class=impl>
+
+ <p>The <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code>
+ object's contents are empty (the <code title=dom-datatransfer-getdata><a href=#dom-datatransfer-getdata>getData()</a></code> and <code title=dom-dataTransfer-files><a href=#dom-datatransfer-files>files</a></code> attributes act as if
+ there is no data being dragged) except for <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> events and <code title=event-drop><a href=#event-drop>drop</a></code> events, for which the contents are
+ set as described in the processing model, below.</p>
+
+ <p id=effectAllowed-initialization>The <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
+ attribute must be set to "<code title="">uninitialized</code>" for
+ <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> events, and to
+ whatever value the field had after the last drag-and-drop event was
+ fired for all other events (only counting events fired by the user
+ agent for the purposes of the drag-and-drop model described
+ below).</p>
+
+ <p id=dropEffect-initialization>The <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute must
+ be set to "<code title="">none</code>" for <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code>, <code title=event-drag><a href=#event-drag>drag</a></code>, and <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> events (except when stated
+ otherwise in the algorithms given in the sections below), to the
+ value corresponding to the <a href=#current-drag-operation>current drag operation</a> for
+ <code title=event-drop><a href=#event-drop>drop</a></code> and <code title=event-dragend><a href=#event-dragend>dragend</a></code> events, and to a value based on
+ the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
+ attribute's value and to the drag-and-drop source, as given by the
+ following table, for the remaining events (<code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> and <code title=event-dragover><a href=#event-dragover>dragover</a></code>):</p>
+
+ <table><thead><tr><th><code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code></th>
+ <th><code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code></th>
+ </thead><tr><td><code title="">none</code></td>
+ <td><code title="">none</code></td>
+ <tr><td><code title="">copy</code>, <code title="">copyLink</code>, <code title="">copyMove</code>, <code title="">all</code></td>
+ <td><code title="">copy</code></td>
+ <tr><td><code title="">link</code>, <code title="">linkMove</code></td>
+ <td><code title="">link</code></td>
+ <tr><td><code title="">move</code></td>
+ <td><code title="">move</code></td>
+ <tr><td><code title="">uninitialized</code> when what is being dragged is a selection from a text field</td>
+ <td><code title="">move</code></td>
+ <tr><td><code title="">uninitialized</code> when what is being dragged is a selection</td>
+ <td><code title="">copy</code></td>
+ <tr><td><code title="">uninitialized</code> when what is being dragged is an <code><a href=#the-a-element>a</a></code> element with an <code>href</code> attribute</td>
+ <td><code title="">link</code></td>
+ <tr><td>Any other case</td>
+ <td><code title="">copy</code></td>
+ </table></div>
+
+
+ <div class=impl>
+
+ <h4 id=drag-and-drop-processing-model><span class=secno>8.9.4 </span>Drag-and-drop processing model</h4>
+
+ <p>When the user attempts to begin a drag operation, the user agent
+ must first determine what is being dragged. If the drag operation
+ was invoked on a selection, then it is the selection that is being
+ dragged. Otherwise, it is the first element, going up the ancestor
+ chain, starting at the node that the user tried to drag, that has
+ the IDL attribute <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> set
+ to true. If there is no such element, then nothing is being dragged,
+ the drag-and-drop operation is never started, and the user agent
+ must not continue with this algorithm.</p>
+
+ <p class=note><code><a href=#the-img-element>img</a></code> elements and <code><a href=#the-a-element>a</a></code>
+ elements with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
+ attribute have their <code title=dom-draggable><a href=#dom-draggable>draggable</a></code>
+ attribute set to true by default.</p>
+
+ <p>If the user agent determines that something can be dragged, a
+ <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event must then be
+ fired at the <a href=#source-node>source node</a>.</p>
+
+ <p>The <dfn id=source-node>source node</dfn> depends on the kind of drag and how it
+ was initiated. If it is a selection that is being dragged, then the
+ <a href=#source-node>source node</a> is the text node that the user started the
+ drag on (typically the text node that the user originally
+ clicked). If the user did not specify a particular node, for example
+ if the user just told the user agent to begin a drag of "the
+ selection", then the <a href=#source-node>source node</a> is the first text node
+ containing a part of the selection. If it is not a selection that is
+ being dragged, then the <a href=#source-node>source node</a> is the element that
+ is being dragged.</p>
+
+ <p>Multiple events are fired on the <a href=#source-node>source node</a> during
+ the course of the drag-and-drop operation.</p>
+
+ <hr><p>The <dfn id=list-of-dragged-nodes>list of dragged nodes</dfn> also depends on the kind of
+ drag. If it is a selection that is being dragged, then the
+ <a href=#list-of-dragged-nodes>list of dragged nodes</a> contains, in <a href=#tree-order>tree
+ order</a>, every node that is partially or completely included in
+ the selection (including all their ancestors). Otherwise, the
+ <a href=#list-of-dragged-nodes>list of dragged nodes</a> contains only the <a href=#source-node>source
+ node</a>.</p>
+
+ <hr><p>If it is a selection that is being dragged, the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> member of the
+ event must be created with no nodes. Otherwise, it must be created
+ containing just the <a href=#source-node>source node</a>. Script can use the
+ <code title=dom-DataTransfer-addElement><a href=#dom-datatransfer-addelement>addElement()</a></code> method
+ to add further elements to the list of what is being dragged. (This
+ list is only used for rendering the drag feedback.)</p>
+
+ <p>The <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code>
+ member of the event also has data added to it, as follows:</p>
+
+ <ul><li>
+
+ <p>If it is a selection that is being dragged, then the user agent
+ must add the text of the selection to the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> member,
+ associated with the <code title="">text/plain</code> format.</p>
+
+ </li>
+
+ <li>
+
+ <p>If files are being dragged, then the user agent must add the
+ files to the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> member's
+ <code title=dom-datatransfer-files><a href=#dom-datatransfer-files>files</a></code> attribute's
+ <code>FileList</code> object. (Dragging files can only happen from
+ outside a <a href=#browsing-context>browsing context</a>, for example from a file
+ system manager application, and thus the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event is actually implied
+ in this case.)</p>
+
+ </li>
+
+
+
+ <li>
+
+ <p>The user agent must take the <a href=#list-of-dragged-nodes>list of dragged nodes</a>
+ and <a href=#extracting-json title="extracting JSON">extract the microdata from those
+ nodes into a JSON form</a>, and then must add the resulting
+ string to the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> member,
+ associated with the <code title="">application/microdata+json</code> format.</p>
+
+ </li>
+
+
+<!-- v2: deal with multiple vCards -->
+<!--
+ <li>
+
+ <p>The user agent must take the <span>list of dragged nodes</span>
+ and <span title="extracting a vCard">extract the vCard data from
+ those nodes</span>, and then must add the resulting string to the
+ <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
+ member, associated with the <code
+ title="">text/directory;profile=vcard</code> format.</p>
+
+ </li>
+
+ <li>
+
+ <p>The user agent must take the <span>list of dragged nodes</span>
+ and <span title="extracting vEvent data">extract the vEvent data
+ from those nodes</span>, and then must add the resulting string to
+ the <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
+ member, associated with the <code
+ title="">text/calendar;component=vevent</code> format.</p>
+
+ </li>
+-->
+
+ <!-- v2: text/html -->
+
+ <li>
+
+ <p>The user agent must run the following steps:</p>
+
+ <ol><li><p>Let <var title="">urls</var> be an empty list of <a href=#absolute-url title="absolute URL">absolute URLs</a>.</li>
+
+ <li>
+
+ <p>For each <var title="">node</var> in <var title="">nodes</var>:</p>
+
+ <dl><dt>If the node is an <code><a href=#the-a-element>a</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code></dt>
+
+ <dd>Add to <var title="">urls</var> the result of <a href=#resolve-a-url title="resolve a url">resolving</a> the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute relative to
+ the element.</dd>
+
+ <dt>If the node is an <code><a href=#the-img-element>img</a></code> element with an <code title=attr-img-src><a href=#attr-img-src>src</a></code></dt>
+
+ <dd>Add to <var title="">urls</var> the result of <a href=#resolve-a-url title="resolve a url">resolving</a> the element's <code title=attr-img-src><a href=#attr-img-src>src</a></code> content attribute relative to the
+ element.</dd>
+
+ <!-- v2: more -->
+
+ </dl></li>
+
+ <li><p>If <var title="">urls</var> is still empty, abort these
+ steps.</li>
+
+ <li><p>Let <var title="">url string</var> be the result of
+ concatenating the strings in <var title="">urls</var>, in the
+ order they were added, separated by a U+000D CARRIAGE RETURN
+ U+000A LINE FEED character pair (CRLF).</li>
+
+ <li><p>Add <var title="">url string</var> to the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> member,
+ associated with the <code title="">text/uri-list</code>
+ format.</li>
+
+ </ol></li>
+
+ </ul><hr><p>If the event is canceled, then the drag-and-drop operation must
+ not occur; the user agent must not continue with this algorithm.</p>
+
+ <p>If it is not canceled, then the drag-and-drop operation must be
+ initiated.</p>
+
+ <p class=note>Since events with no event listeners registered are,
+ almost by definition, never canceled, drag-and-drop is always
+ available to the user if the author does not specifically prevent
+ it.</p>
+
+ <p id=base-dnd-feedback>The drag-and-drop feedback must be
+ generated from the first of the following sources that is
+ available:</p>
+
+ <ol><li>The element specified in the last call to the <code title=dom-DataTransfer-setDragImage><a href=#dom-datatransfer-setdragimage>setDragImage()</a></code> method
+ of the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code>
+ object of the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event,
+ if the method was called. In visual media, if this is used, the
+ <var title="">x</var> and <var title="">y</var> arguments that were
+ passed to that method should be used as hints for where to put the
+ cursor relative to the resulting image. The values are expressed as
+ distances in CSS pixels from the left side and from the top side of
+ the image respectively. <a href=#refsCSS>[CSS]</a></li>
+
+ <li>The elements that were added to the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object, both
+ before the event was fired, and during the handling of the event
+ using the <code title=dom-DataTransfer-addElement><a href=#dom-datatransfer-addelement>addElement()</a></code>
+ method, if any such elements were indeed added.</li>
+
+ <li>The selection that the user is dragging.</li>
+
+ </ol><p>The user agent must take a note of <a href=#dom-datatransfer-setdata title=dom-DataTransfer-setData>the data that was placed</a> in
+ the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code>
+ object. This data will be made available again when the <code title=event-drop><a href=#event-drop>drop</a></code> event is fired.</p>
+
+ <p>From this point until the end of the drag-and-drop operation,
+ device input events (e.g. mouse and keyboard events) must be
+ suppressed. In addition, the user agent must track all DOM changes
+ made during the drag-and-drop operation, and add them to its <a href=#undo>undo history</a> as one atomic operation once the
+ drag-and-drop operation has ended.</p>
+
+ <p>During the drag operation, the element directly indicated by the
+ user as the drop target is called the <dfn id=immediate-user-selection>immediate user
+ selection</dfn>. (Only elements can be selected by the user; other
+ nodes must not be made available as drop targets.)
+
+ However, the <a href=#immediate-user-selection>immediate user selection</a> is not
+ necessarily the <dfn id=current-target-element>current target element</dfn>, which is the
+ element currently selected for the drop part of the drag-and-drop
+ operation.
+
+ The <a href=#immediate-user-selection>immediate user selection</a> changes as the user
+ selects different elements (either by pointing at them with a
+ pointing device, or by selecting them in some other way). The
+ <a href=#current-target-element>current target element</a> changes when the <a href=#immediate-user-selection>immediate
+ user selection</a> changes, based on the results of event
+ listeners in the document, as described below.</p>
+
+ <p>Both the <a href=#current-target-element>current target element</a> and the
+ <a href=#immediate-user-selection>immediate user selection</a> can be null, which means no
+ target element is selected. They can also both be elements in other
+ (DOM-based) documents, or other (non-Web) programs altogether. (For
+ example, a user could drag text to a word-processor.) The
+ <a href=#current-target-element>current target element</a> is initially null.</p>
+
+ <p>In addition, there is also a <dfn id=current-drag-operation>current drag operation</dfn>,
+ which can take on the values "none", "copy", "link", and "move".
+ Initially, it has the value "none". It is updated by the user agent
+ as described in the steps below.</p>
+
+ <p>User agents must, as soon as the drag operation is initiated and
+ every 350ms (&plusmn;200ms) thereafter for as long as the drag
+ operation is ongoing, <a href=#queue-a-task>queue a task</a> to perform the
+ following steps in sequence:</p>
+
+ <ol><li>
+
+ <p>If the user agent is still performing the previous iteration of
+ the sequence (if any) when the next iteration becomes due, the
+ user agent must not execute the overdue iteration, effectively
+ "skipping missed frames" of the drag-and-drop operation.</p>
+
+ </li>
+
+ <li>
+
+ <p>The user agent must fire a <code title=event-drag><a href=#event-drag>drag</a></code>
+ event at the <a href=#source-node>source node</a>. If this event is canceled,
+ the user agent must set the <a href=#current-drag-operation>current drag operation</a> to
+ none (no drag operation).</p>
+
+ </li>
+
+ <li>
+
+ <p>Next, if the <code title=event-drag><a href=#event-drag>drag</a></code> event was not
+ canceled and the user has not ended the drag-and-drop operation,
+ the user agent must check the state of the drag-and-drop
+ operation, as follows:</p>
+
+ <ol><li>
+
+ <p>First, if the user is indicating a different <a href=#immediate-user-selection>immediate
+ user selection</a> than during the last iteration (or if this
+ is the first iteration), and if this <a href=#immediate-user-selection>immediate user
+ selection</a> is not the same as the <a href=#current-target-element>current target
+ element</a>, then the <a href=#current-target-element>current target element</a> must
+ be updated, as follows:</p>
+
+ <dl class=switch><dt>If the new <a href=#immediate-user-selection>immediate user selection</a> is null, or
+ is in a non-DOM document or application</dt>
+
+ <dd><p>The user agent must set the <a href=#current-target-element>current target
+ element</a> to the same value.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>The user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at the
+ <a href=#immediate-user-selection>immediate user selection</a>.</p>
+
+ <p>If the event is canceled, then the <a href=#current-target-element>current target
+ element</a> must be set to the <a href=#immediate-user-selection>immediate user
+ selection</a>.</p>
+
+ <p>Otherwise, the user agent must act as follows:</p>
+
+ <dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text
+ field (e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code>
+ element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code>
+ attribute is in the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
+ <a href=#editable>editable</a> element</dt>
+
+ <dd><p>The <a href=#current-target-element>current target element</a> must be set to
+ the <a href=#immediate-user-selection>immediate user selection</a> anyway.</dd>
+
+ <dt>If the <a href=#current-target-element>current target element</a> is
+ <a href=#the-body-element>the body element</a></dt>
+
+ <dd><p>The <a href=#current-target-element>current target element</a> is left
+ unchanged.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>The user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at <a href=#the-body-element>the
+ body element</a>, and the <a href=#current-target-element>current target
+ element</a> must be set to <a href=#the-body-element>the body element</a>,
+ regardless of whether that event was canceled or not. (If
+ <a href=#the-body-element>the body element</a> is null, then the <a href=#current-target-element>current
+ target element</a> would be set to null too in this case,
+ it wouldn't be set to the <code><a href=#document>Document</a></code>
+ object.)</dd>
+
+ </dl></dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>If the previous step caused the <a href=#current-target-element>current target
+ element</a> to change, and if the previous target element was
+ not null or a part of a non-DOM document, the user agent must fire
+ a <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> event at the
+ previous target element.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <a href=#current-target-element>current target element</a> is a DOM element,
+ the user agent must fire a <code title=event-dragover><a href=#event-dragover>dragover</a></code> event at this <a href=#current-target-element>current
+ target element</a>.</p>
+
+ <p>If the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event is
+ not canceled, the user agent must act as follows:</p>
+
+ <dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field
+ (e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
+ whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
+ the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
+ <a href=#editable>editable</a> element</dt>
+
+ <dd><p>The user agent must set the <a href=#current-drag-operation>current drag
+ operation</a> to either "copy" or "move", as appropriate
+ given the platform conventions.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>The user agent must reset the <a href=#current-drag-operation>current drag
+ operation</a> to "none".</dd>
+
+ </dl><p>Otherwise (if the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event <em>is</em>
+ canceled), the <a href=#current-drag-operation>current drag operation</a> must be set
+ based on the values the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> and
+ <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code>
+ attributes of the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object
+ had after the event was handled, as per the following table:</p>
+
+ <table><thead><tr><th><code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code></th>
+ <th><code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code></th>
+ <th>Drag operation</th>
+ </thead><tr><td><code title="">uninitialized</code>, <code title="">copy</code>, <code title="">copyLink</code>, <code title="">copyMove</code>, or <code title="">all</code></td>
+ <td><code title="">copy</code></td>
+ <td>"copy"</td>
+ <tr><td><code title="">uninitialized</code>, <code title="">link</code>, <code title="">copyLink</code>, <code title="">linkMove</code>, or <code title="">all</code></td>
+ <td><code title="">link</code></td>
+ <td>"link"</td>
+ <tr><td><code title="">uninitialized</code>, <code title="">move</code>, <code title="">copyMove</code>, <code title="">linkMove</code>, or <code title="">all</code></td>
+ <td><code title="">move</code></td>
+ <td>"move"</td>
+ <tr><td colspan=2>Any other case</td>
+ <td>"none"</td>
+ </table><p>Then, regardless of whether the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event was canceled or
+ not, the drag feedback (e.g. the mouse cursor) must be updated
+ to match the <a href=#current-drag-operation>current drag operation</a>, as
+ follows:</p>
+
+ <table><thead><tr><th>Drag operation</th>
+ <th>Feedback</th>
+ </thead><tr><td>"copy"</td>
+ <td>Data will be copied if dropped here.</td>
+ <tr><td>"link"</td>
+ <td>Data will be linked if dropped here.</td>
+ <tr><td>"move"</td>
+ <td>Data will be moved if dropped here.</td>
+ <tr><td>"none"</td>
+ <td>No operation allowed, dropping here will cancel the drag-and-drop operation.</td>
+ </table></li>
+
+ <li>
+
+ <p>Otherwise, if the <a href=#current-target-element>current target element</a> is not a
+ DOM element, the user agent must use platform-specific mechanisms
+ to determine what drag operation is being performed (none, copy,
+ link, or move). This sets the <em>current drag operation</em>.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li>
+
+ <p>Otherwise, if the user ended the drag-and-drop operation (e.g.
+ by releasing the mouse button in a mouse-driven drag-and-drop
+ interface), or if the <code title=event-drag><a href=#event-drag>drag</a></code> event
+ was canceled, then this will be the last iteration. The user agent
+ must execute the following steps, then stop looping.</p>
+
+ <ol><li>
+
+ <p>If the <a href=#current-drag-operation>current drag operation</a> is none (no drag
+ operation), or, if the user ended the drag-and-drop operation by
+ canceling it (e.g. by hitting the <kbd>Escape</kbd> key), or if
+ the <a href=#current-target-element>current target element</a> is null, then the drag
+ operation failed. If the <a href=#current-target-element>current target element</a> is
+ a DOM element, the user agent must fire a <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> event at it; otherwise,
+ if it is not null, it must use platform-specific conventions for
+ drag cancellation.</p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise, the drag operation was as success. If the
+ <a href=#current-target-element>current target element</a> is a DOM element, the user
+ agent must fire a <code title=event-drop><a href=#event-drop>drop</a></code> event at
+ it; otherwise, it must use platform-specific conventions for
+ indicating a drop.</p>
+
+ <p>When the target is a DOM element, the <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute
+ of the event's <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object
+ must be given the value representing the <a href=#current-drag-operation>current drag
+ operation</a> (<code title="">copy</code>, <code title="">link</code>, or <code title="">move</code>), and the
+ object must be set up so that the <code title=dom-DataTransfer-getData><a href=#dom-datatransfer-getdata>getData()</a></code> method will
+ return the data that was added during the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event, and the <code title=dom-datatransfer-files><a href=#dom-datatransfer-files>files</a></code> attribute will
+ return a <code>FileList</code> object with any files that were
+ dragged.</p>
+
+ <p>If the event is canceled, the <a href=#current-drag-operation>current drag
+ operation</a> must be set to the value of the <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute
+ of the event's <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object as
+ it stood after the event was handled.</p>
+
+ <p>Otherwise, the event is not canceled, and the user agent must
+ perform the event's default action, which depends on the exact
+ target as follows:</p>
+
+ <dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field
+ (e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
+ whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
+ the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
+ <a href=#editable>editable</a> element</dt>
+
+ <dd>The user agent must insert the data associated with the
+ <code>text/plain</code> format, if any, into the text field or
+ <a href=#editable>editable</a> element in a manner consistent with
+ platform-specific conventions (e.g. inserting it at the current
+ mouse cursor position, or inserting it at the end of the
+ field).</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>Reset the <a href=#current-drag-operation>current drag operation</a> to
+ "none".</dd>
+
+ </dl></li>
+
+ <li>
+
+ <p>Finally, the user agent must fire a <code title=event-dragend><a href=#event-dragend>dragend</a></code> event at the <a href=#source-node>source
+ node</a>, with the <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute
+ of the event's <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object
+ being set to the value corresponding to the <a href=#current-drag-operation>current drag
+ operation</a>.</p>
+
+ <p class=note>The <a href=#current-drag-operation>current drag operation</a> can
+ change during the processing of the <code title=event-drop><a href=#event-drop>drop</a></code> event, if one was fired.</p>
+
+ <p>The event is not cancelable. After the event has been
+ handled, the user agent must act as follows:</p>
+
+ <dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field
+ (e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
+ whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
+ the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state), and
+ a <code title=event-drop><a href=#event-drop>drop</a></code> event was fired in the
+ previous step, and the <a href=#current-drag-operation>current drag operation</a> is
+ "move", and the source of the drag-and-drop operation is a
+ selection in the DOM</dt>
+
+ <dd>The user agent should delete the range representing the
+ dragged selection from the DOM.</dd>
+
+ <dt>If the <a href=#current-target-element>current target element</a> is a text field
+ (e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
+ whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
+ the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state), and
+ a <code title=event-drop><a href=#event-drop>drop</a></code> event was fired in the
+ previous step, and the <a href=#current-drag-operation>current drag operation</a> is
+ "move", and the source of the drag-and-drop operation is a
+ selection in a text field</dt>
+
+ <dd>The user agent should delete the dragged selection from the
+ relevant text field.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>The event has no default action.</dd>
+
+ </dl></li>
+
+ </ol></li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h5 id=when-the-drag-and-drop-operation-starts-or-ends-in-another-document><span class=secno>8.9.4.1 </span>When the drag-and-drop operation starts or ends in another
+ document</h5>
+
+ <p>The model described above is independent of which
+ <code><a href=#document>Document</a></code> object the nodes involved are from; the events
+ must be fired as described above and the rest of the processing
+ model must be followed as described above, irrespective of how many
+ documents are involved in the operation.</p>
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h5 id=when-the-drag-and-drop-operation-starts-or-ends-in-another-application><span class=secno>8.9.4.2 </span>When the drag-and-drop operation starts or ends in another
+ application</h5>
+
+ <p>If the drag is initiated in another application, the <a href=#source-node>source
+ node</a> is not a DOM node, and the user agent must use
+ platform-specific conventions instead when the requirements above
+ involve the source node. User agents in this situation must act as
+ if the dragged data had been added to the <code><a href=#datatransfer>DataTransfer</a></code>
+ object when the drag started, even though no <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event was actually fired;
+ user agents must similarly use platform-specific conventions when
+ deciding on what drag feedback to use.</p>
+
+ <p>All the format strings must be <a href=#converted-to-ascii-lowercase>converted to ASCII
+ lowercase</a>. If the platform conventions do not use <a href=#mime-type title="MIME type">MIME types</a> to label the dragged data, the
+ user agent must map the types to MIME types first.</p>
+
+ <p>If a drag is started in a document but ends in another
+ application, then the user agent must instead replace the parts of
+ the processing model relating to handling the <em>target</em>
+ according to platform-specific conventions.</p>
+
+ <p>In any case, scripts running in the context of the document must
+ not be able to distinguish the case of a drag-and-drop operation
+ being started or ended in another application from the case of a
+ drag-and-drop operation being started or ended in another document
+ from another domain.</p>
+
+ </div>
+
+
+ <h4 id=the-draggable-attribute><span class=secno>8.9.5 </span>The <dfn title=attr-draggable><code>draggable</code></dfn> attribute</h4>
+
+ <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute set. The
+ <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> attribute is an
+ <a href=#enumerated-attribute>enumerated attribute</a>. It has three states. The first
+ state is <i>true</i> and it has the keyword <code title="">true</code>. The second state is <i>false</i> and it has
+ the keyword <code title="">false</code>. The third state is
+ <i>auto</i>; it has no keywords but it is the <i>missing value
+ default</i>.</p>
+
+ <p>The <i>true</i> state means the element is draggable; the
+ <i>false</i> state means that it is not. The <i>auto</i> state
+ uses the default behavior of the user agent.</p>
+
+ <dl class=domintro><dt><var title="">element</var> . <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns true if the element is draggable; otherwise, returns
+ false.</p>
+
+ <p>Can be set, to override the default and set the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-draggable title=dom-draggable><code>draggable</code></dfn> IDL
+ attribute, whose value depends on the content attribute's in the way
+ described below, controls whether or not the element is
+ draggable. Generally, only text selections are draggable, but
+ elements whose <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL
+ attribute is true become draggable as well.</p>
+
+ <p>If an element's <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code>
+ content attribute has the state <i>true</i>, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute must return
+ true.</p>
+
+ <p>Otherwise, if the element's <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute has the
+ state <i>false</i>, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute must return
+ false.</p>
+
+ <p>Otherwise, the element's <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute has the
+ state <i>auto</i>. If the element is an <code><a href=#the-img-element>img</a></code> element,
+ or, if the element is an <code><a href=#the-a-element>a</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute must return
+ true.</p>
+
+ <p>Otherwise, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> DOM
+ must return false.</p>
+
+ <p>If the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute
+ is set to the value false, the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute must be
+ set to the literal value <code title="">false</code>. If the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute is set to the
+ value true, the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code>
+ content attribute must be set to the literal value <code title="">true</code>.</p>
+
+ </div>
+
+
+<!--
+ <h4>Copy and paste</h4>
+
+ <p>Copy-and-paste is a form of drag-and-drop: the "copy" part is
+ equivalent to dragging content to another application (the
+ "clipboard"), and the "paste" part is equivalent to dragging content
+ <em>from</em> another application.</p>
+
+ <p>Select-and-paste (a model used by mouse operations in the X
+ Window System) is equivalent to a drag-and-drop operation where the
+ source is the selection.</p>
+
+
+ <div class="impl">
+
+ <h5>Copy to clipboard</h5>
+
+ <p>When the user invokes a copy operation, the user agent must act
+ as if the user had invoked a drag on the current selection. If the
+ drag-and-drop operation initiates, then the user agent must act as
+ if the user had indicated (as the <span>immediate user
+ selection</span>) a hypothetical application representing the
+ clipboard. Then, the user agent must act as if the user had ended
+ the drag-and-drop operation without canceling it. If the
+ drag-and-drop operation didn't get canceled, the user agent should
+ then follow the relevant platform-specific conventions for copy
+ operations (e.g. updating the clipboard).</p>
+
+ <p>The events involved in this process are the <code
+ title="event-dragstart">dragstart</code>, <code
+ title="event-drag">drag</code>, and <code
+ title="event-dragend">dragend</code> events.</p>
+
+
+ <h5>Cut to clipboard</h5>
+
+ <p>When the user invokes a cut operation, the user agent must act as
+ if the user had invoked a copy operation (see the previous section),
+ followed, if the copy was completed successfully, by <a
+ href="#contenteditable-delete">a selection delete operation</a>.</p>
+
+ <p>The events involved in this process are the <code
+ title="event-dragstart">dragstart</code>, <code
+ title="event-drag">drag</code>, and <code
+ title="event-dragend">dragend</code> events.</p>
+
+
+ <h5>Paste from clipboard</h5>
+
+ <p>When the user invokes a clipboard paste operation, the user agent
+ must act as if the user had invoked a drag on a hypothetical
+ application representing the clipboard, setting the data associated
+ with the drag as the content on the clipboard (in whatever formats
+ are available).</p>
+
+ <p>Then, the user agent must act as if the user had indicated (as
+ the <span>immediate user selection</span>) the element with the
+ keyboard focus, and then ended the drag-and-drop operation without
+ canceling it.</p>
+
+ <p>The events involved in this process are the <code
+ title="event-dragenter">dragenter</code>, <code
+ title="event-dragover">dragover</code>, <code
+ title="event-dragleave">dragleave</code>, and <code
+ title="event-drop">drop</code> events.</p>
+
+
+ <h5>Paste from selection</h5>
+
+ <p>When the user invokes a selection paste operation, the user agent
+ must act as if the user had invoked a drag on the current selection,
+ then indicated (as the <span>immediate user selection</span>) the
+ element with the keyboard focus, and then ended the drag-and-drop
+ operation without canceling it.</p>
+
+ <p>All the drag-and-drop events can be involved in this process.</p>
+
+ </div>
+-->
+
+
+ <div class=impl>
+
+ <h4 id=security-risks-in-the-drag-and-drop-model><span class=secno>8.9.6 </span>Security risks in the drag-and-drop model</h4>
+
+ <p>User agents must not make the data added to the
+ <code><a href=#datatransfer>DataTransfer</a></code> object during the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event available to scripts
+ until the <code title=event-drop><a href=#event-drop>drop</a></code> event, because
+ otherwise, if a user were to drag sensitive information from one
+ document to a second document, crossing a hostile third document in
+ the process, the hostile document could intercept the data.</p>
+
+ <p>For the same reason, user agents must consider a drop to be
+ successful only if the user specifically ended the drag operation
+ &mdash; if any scripts end the drag operation, it must be considered
+ unsuccessful (canceled) and the <code title=event-drop><a href=#event-drop>drop</a></code>
+ event must not be fired.</p>
+
+ <p>User agents should take care to not start drag-and-drop
+ operations in response to script actions. For example, in a
+ mouse-and-window environment, if a script moves a window while the
+ user has his mouse button depressed, the UA would not consider that
+ to start a drag. This is important because otherwise UAs could cause
+ data to be dragged from sensitive sources and dropped into hostile
+ documents without the user's consent.</p>
+
+ </div>
+
+
+ <h3 id=undo><span class=secno>8.10 </span><dfn>Undo history</dfn></h3>
+
+ <div class=impl>
+
+ <h4 id=definitions-2><span class=secno>8.10.1 </span>Definitions</h4>
+
+ <p>The user agent must associate an <dfn id=undo-transaction-history>undo transaction
+ history</dfn> with each <code><a href=#htmldocument>HTMLDocument</a></code> object.</p>
+
+ <p>The <a href=#undo-transaction-history>undo transaction history</a> is a list of
+ entries. The entries are of two types: <a href=#dom-changes>DOM changes</a> and
+ <a href=#undo-object title="undo object">undo objects</a>.</p>
+
+ <p>Each <dfn id=dom-changes>DOM changes</dfn> entry in the <a href=#undo-transaction-history>undo transaction
+ history</a> consists of batches of one or more of the
+ following:</p>
+
+ <ul><li>Changes to the content attributes of an <code><a href=#element>Element</a></code>
+ node.</li>
+
+ <li>Changes to the DOM hierarchy of nodes that are descendants of
+ the <code><a href=#htmldocument>HTMLDocument</a></code> object (<code title=dom-Node-parentNode><a href=#dom-node-parentnode>parentNode</a></code>, <code title=dom-Node-childNodes><a href=#dom-node-childnodes>childNodes</a></code>).</li>
+
+ <li>Changes to internal state, such as a form control's <a href=#concept-fe-value title=concept-fe-value>value</a> or <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness
+ flag</a>.</li>
+
+ </ul><p><dfn id=undo-object>Undo object</dfn> entries consist of objects representing
+ state that scripts running in the document are managing. For
+ example, a Web mail application could use an <a href=#undo-object>undo
+ object</a> to keep track of the fact that a user has moved an
+ e-mail to a particular folder, so that the user can undo the
+ action and have the e-mail return to its former location.</p>
+
+ <p>Broadly speaking, <a href=#dom-changes>DOM changes</a> entries are handled by
+ the UA in response to user edits of form controls and <a href=#editing-host title="editing host">editing hosts</a> on the page, and
+ <a href=#undo-object>undo object</a> entries are handled by script in response
+ to higher-level user actions (such as interactions with server-side
+ state, or in the implementation of a drawing tool).</p>
+
+ </div>
+
+
+ <h4 id=the-undomanager-interface><span class=secno>8.10.2 </span>The <code><a href=#undomanager>UndoManager</a></code> interface</h4>
+
+ <p>To manage <a href=#undo-object>undo object</a> entries in the <a href=#undo-transaction-history>undo
+ transaction history</a>, the <code><a href=#undomanager>UndoManager</a></code>
+ interface can be used:</p>
+
+ <pre class=idl>interface <dfn id=undomanager>UndoManager</dfn> {
+ readonly attribute unsigned long <a href=#dom-undomanager-length title=dom-UndoManager-length>length</a>;
+ getter any <a href=#dom-undomanager-item title=dom-UndoManager-item>item</a>(in unsigned long index);
+ readonly attribute unsigned long <a href=#dom-undomanager-position title=dom-UndoManager-position>position</a>;
+ unsigned long <a href=#dom-undomanager-add title=dom-UndoManager-add>add</a>(in any data, in DOMString title);
+ void <a href=#dom-undomanager-remove title=dom-UndoManager-remove>remove</a>(in unsigned long index);
+ void <a href=#dom-undomanager-clearundo title=dom-UndoManager-clearUndo>clearUndo</a>();
+ void <a href=#dom-undomanager-clearredo title=dom-UndoManager-clearRedo>clearRedo</a>();
+};</pre>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-undoManager><a href=#dom-undomanager>undoManager</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#undomanager>UndoManager</a></code> object.</p>
+
+ </dd>
+
+ <dt><var title="">undoManager</var> . <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code></dt>
+ <dd>
+
+ <p>Returns the number of entries in the undo history.</p>
+
+ </dd>
+
+ <dt><var title="">data</var> = <var title="">undoManager</var> . <code title=dom-UndoManager-item><a href=#dom-undomanager-item>item</a></code>(<var title="">index</var>)</dt>
+ <dt><var title="">undoManager</var>[<var title="">index</var>]</dt>
+ <dd>
+
+ <p>Returns the entry with index <var title="">index</var> in the undo history.</p>
+
+ <p>Returns null if <var title="">index</var> is out of range.</p>
+
+ </dd>
+
+ <dt><var title="">undoManager</var> . <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code></dt>
+ <dd>
+
+ <p>Returns the number of the current entry in the undo history. (Entries at and past this point are <em>redo</em> entries.)</p>
+
+ </dd>
+
+ <dt><var title="">undoManager</var> . <code title=dom-UndoManager-add><a href=#dom-undomanager-add>add</a></code>(<var title="">data</var>, <var title="">title</var>)</dt>
+ <dd>
+
+ <p>Adds the specified entry to the undo history.</p>
+
+ </dd>
+
+ <dt><var title="">undoManager</var> . <code title=dom-UndoManager-remove><a href=#dom-undomanager-remove>remove</a></code>(<var title="">index</var>)</dt>
+ <dd>
+
+ <p>Removes the specified entry to the undo history.</p>
+
+ <p>Throws an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the given index is out of range.</p>
+
+ </dd>
+
+ <dt><var title="">undoManager</var> . <code title=dom-UndoManager-clearUndo><a href=#dom-undomanager-clearundo>clearUndo</a></code>()</dt>
+ <dd>
+
+ <p>Removes all entries before the current position in the undo history.</p>
+
+ </dd>
+
+ <dt><var title="">undoManager</var> . <code title=dom-UndoManager-clearRedo><a href=#dom-undomanager-clearredo>clearRedo</a></code>()</dt>
+ <dd>
+
+ <p>Removes all entries at and after the current position in the undo history.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-undomanager title=dom-undoManager><code>undoManager</code></dfn>
+ attribute of the <code><a href=#window>Window</a></code> interface must return the
+ object implementing the <code><a href=#undomanager>UndoManager</a></code> interface for that
+ <code><a href=#window>Window</a></code> object's associated
+ <code><a href=#htmldocument>HTMLDocument</a></code> object.</p>
+
+ <p><code><a href=#undomanager>UndoManager</a></code> objects represent their document's
+ <a href=#undo-transaction-history>undo transaction history</a>. Only <a href=#undo-object>undo object</a>
+ entries are visible with this API, but this does not mean that
+ <a href=#dom-changes>DOM changes</a> entries are absent from the <a href=#undo-transaction-history>undo
+ transaction history</a>.</p>
+
+ <p>The <dfn id=dom-undomanager-length title=dom-UndoManager-length><code>length</code></dfn>
+ attribute must return the number of <a href=#undo-object>undo object</a> entries
+ in the <a href=#undo-transaction-history>undo transaction history</a>. This is the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var>.</p>
+
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are the numbers in the range zero to <span title=""><var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var>-1</span>, unless the
+ <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var> is zero, in which
+ case there are no <span>supported indexed properties</span>.</p>
+
+ <p>The <dfn id=dom-undomanager-item title=dom-UndoManager-item><code>item(<var title="">n</var>)</code></dfn> method must return the <var title="">n</var>th <a href=#undo-object>undo object</a> entry in the <a href=#undo-transaction-history>undo
+ transaction history</a>, if there is one, or null otherwise.</p>
+
+ <p>The <a href=#undo-transaction-history>undo transaction history</a> has a <dfn id=undo-position title="undo
+ position">current position</dfn>. This is the position between two
+ entries in the <a href=#undo-transaction-history>undo transaction history</a>'s list where
+ the previous entry represents what needs to happen if the user
+ invokes the "undo" command (the "undo" side, lower numbers), and the
+ next entry represents what needs to happen if the user invokes the
+ "redo" command (the "redo" side, higher numbers).</p>
+
+ <p>The <dfn id=dom-undomanager-position title=dom-UndoManager-position><code>position</code></dfn>
+ attribute must return the index of the <a href=#undo-object>undo object</a>
+ entry nearest to the <a href=#undo-position>undo position</a>, on the "redo"
+ side. If there are no <a href=#undo-object>undo object</a> entries on the "redo"
+ side, then the attribute must return the same as the <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code> attribute. If there are
+ no <a href=#undo-object>undo object</a> entries on the "undo" side of the
+ <a href=#undo-position>undo position</a>, the <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> attribute returns
+ zero.</p>
+
+ <p class=note>Since the <a href=#undo-transaction-history>undo transaction history</a>
+ contains both <a href=#undo-object>undo object</a> entries and <a href=#dom-changes>DOM
+ changes</a> entries, but the <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> attribute only
+ returns indices relative to <a href=#undo-object>undo object</a> entries, it is
+ possible for several "undo" or "redo" actions to be performed
+ without the value of the <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> attribute
+ changing.</p>
+
+ <p>The <dfn id=dom-undomanager-add title=dom-UndoManager-add><code>add(<var title="">data</var>,
+ <var title="">title</var>)</code></dfn> method's behavior depends on the
+ current state. Normally, it must insert the <var title="">data</var> object
+ passed as an argument into the <a href=#undo-transaction-history>undo transaction history</a>
+ immediately before the <a href=#undo-position>undo position</a>, optionally
+ remembering the given <var title="">title</var> to use in the UI. If the
+ method is called <a href=#undo:-moving-back-in-the-undo-transaction-history title=do-undo>during an undo
+ operation</a>, however, the object must instead be added
+ immediately <em>after</em> the <a href=#undo-position>undo position</a>.</p>
+
+ <p>If the method is called and there is neither <a href=#undo:-moving-back-in-the-undo-transaction-history title=do-undo>an undo operation in progress</a> nor <a href=#redo:-moving-forward-in-the-undo-transaction-history title=do-redo>a redo operation in progress</a> then any entries
+ in the <a href=#undo-transaction-history>undo transaction history</a> after the <a href=#undo-position>undo
+ position</a> must be removed (as if <code title=dom-UndoManager-clearRedo><a href=#dom-undomanager-clearredo>clearRedo()</a></code> had been
+ called).</p>
+
+ <p>The <dfn id=dom-undomanager-remove title=dom-UndoManager-remove><code>remove(<var title="">index</var>)</code></dfn> method must remove the <a href=#undo-object>undo
+ object</a> entry with the specified <var title="">index</var>. If
+ the index is less than zero or greater than or equal to <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code> then the method must
+ raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception. <a href=#dom-changes>DOM
+ changes</a> entries are unaffected by this method.</p>
+
+ <p>The <dfn id=dom-undomanager-clearundo title=dom-UndoManager-clearUndo><code>clearUndo()</code></dfn>
+ method must remove all entries in the <a href=#undo-transaction-history>undo transaction
+ history</a> before the <a href=#undo-position>undo position</a>, be they
+ <a href=#dom-changes>DOM changes</a> entries or <a href=#undo-object>undo object</a>
+ entries.</p>
+
+ <p>The <dfn id=dom-undomanager-clearredo title=dom-UndoManager-clearRedo><code>clearRedo()</code></dfn>
+ method must remove all entries in the <a href=#undo-transaction-history>undo transaction
+ history</a> after the <a href=#undo-position>undo position</a>, be they
+ <a href=#dom-changes>DOM changes</a> entries or <a href=#undo-object>undo object</a>
+ entries.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=undo:-moving-back-in-the-undo-transaction-history><span class=secno>8.10.3 </span><dfn title=do-undo>Undo: moving back in the undo transaction history</dfn></h4>
+
+ <p>When the user invokes an undo operation, or when the <code title=dom-document-execCommand><a href=#execCommand>execCommand()</a></code> method is
+ called with the <code title=command-undo><a href=#command-undo>undo</a></code> command, the
+ user agent must perform an undo operation.</p>
+
+ <p>If the <a href=#undo-position>undo position</a> is at the start of the
+ <a href=#undo-transaction-history>undo transaction history</a>, then the user agent must do
+ nothing.</p>
+
+ <p>If the entry immediately before the <a href=#undo-position>undo position</a> is
+ a <a href=#dom-changes>DOM changes</a> entry, then the user agent must remove
+ that <a href=#dom-changes>DOM changes</a> entry, reverse the DOM changes that
+ were listed in that entry, and, if the changes were reversed with no
+ problems, add a new <a href=#dom-changes>DOM changes</a> entry (consisting of
+ the opposite of those DOM changes) to the <a href=#undo-transaction-history>undo transaction
+ history</a> on the other side of the <a href=#undo-position>undo
+ position</a>.</p>
+
+ <p>If the DOM changes cannot be undone (e.g. because the DOM state
+ is no longer consistent with the changes represented in the entry),
+ then the user agent must simply remove the <a href=#dom-changes>DOM changes</a>
+ entry, without doing anything else.</p>
+
+ <p>If the entry immediately before the <a href=#undo-position>undo position</a> is
+ an <a href=#undo-object>undo object</a> entry, then the user agent must first
+ remove that <a href=#undo-object>undo object</a> entry from the <a href=#undo-transaction-history>undo
+ transaction history</a>, and then must fire an <code title=event-undo><a href=#event-undo>undo</a></code> event at the <code><a href=#window>Window</a></code>
+ object, using the <a href=#undo-object>undo object</a> entry's associated undo
+ object as the event's data.</p>
+
+ <p>Any calls to <code title=dom-undoManager-add><a href=#dom-undomanager-add>add()</a></code> while
+ the event is being handled will be used to populate the redo
+ history, and will then be used if the user invokes the "redo"
+ command to undo his undo.</p>
+
+
+ <h4 id=redo:-moving-forward-in-the-undo-transaction-history><span class=secno>8.10.4 </span><dfn title=do-redo>Redo: moving forward in the undo transaction history</dfn></h4>
+
+ <p>When the user invokes a redo operation, or when the <code title=dom-document-execCommand><a href=#execCommand>execCommand()</a></code> method is
+ called with the <code title=command-redo><a href=#command-redo>redo</a></code> command, the
+ user agent must perform a redo operation.</p>
+
+ <p>This is mostly the opposite of an <a href=#undo:-moving-back-in-the-undo-transaction-history title=do-undo>undo
+ operation</a>, but the full definition is included here for
+ completeness.</p>
+
+ <p>If the <a href=#undo-position>undo position</a> is at the end of the <a href=#undo-transaction-history>undo
+ transaction history</a>, then the user agent must do nothing.</p>
+
+ <p>If the entry immediately after the <a href=#undo-position>undo position</a> is
+ a <a href=#dom-changes>DOM changes</a> entry, then the user agent must remove
+ that <a href=#dom-changes>DOM changes</a> entry, reverse the DOM changes that
+ were listed in that entry, and, if the changes were reversed with no
+ problems, add a new <a href=#dom-changes>DOM changes</a> entry (consisting of
+ the opposite of those DOM changes) to the <a href=#undo-transaction-history>undo transaction
+ history</a> on the other side of the <a href=#undo-position>undo
+ position</a>.</p>
+
+ <p>If the DOM changes cannot be redone (e.g. because the DOM state
+ is no longer consistent with the changes represented in the entry),
+ then the user agent must simply remove the <a href=#dom-changes>DOM changes</a>
+ entry, without doing anything else.</p>
+
+ <p>If the entry immediately after the <a href=#undo-position>undo position</a> is
+ an <a href=#undo-object>undo object</a> entry, then the user agent must first
+ remove that <a href=#undo-object>undo object</a> entry from the <a href=#undo-transaction-history>undo
+ transaction history</a>, and then must fire a <code title=event-redo><a href=#event-redo>redo</a></code> event at the <code><a href=#window>Window</a></code>
+ object, using the <a href=#undo-object>undo object</a> entry's associated undo
+ object as the event's data.</p>
+
+ </div>
+
+
+ <h4 id=the-undomanagerevent-interface-and-the-undo-and-redo-events><span class=secno>8.10.5 </span>The <code><a href=#undomanagerevent>UndoManagerEvent</a></code> interface and the <code title=event-undo><a href=#event-undo>undo</a></code> and <code title=event-redo><a href=#event-redo>redo</a></code> events</h4>
+
+ <pre class=idl>interface <dfn id=undomanagerevent>UndoManagerEvent</dfn> : <a href=#event>Event</a> {
+ readonly attribute any <a href=#dom-undomanagerevent-data title=dom-UndoManagerEvent-data>data</a>;
+ void <a href=#dom-undomanagerevent-initundomanagerevent title=dom-UndoManagerEvent-initUndoManagerEvent>initUndoManagerEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg);
+};</pre>
+
+ <dl class=domintro><dt><var title="">event</var> . <code title=dom-UndoManagerEvent-data><a href=#dom-undomanagerevent-data>data</a></code></dt>
+
+ <dd>
+
+ <p>Returns the data that was passed to the <code title=dom-undomanager-add><a href=#dom-undomanager-add>add()</a></code> method.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-undomanagerevent-initundomanagerevent title=dom-UndoManagerEvent-initUndoManagerEvent><code>initUndoManagerEvent()</code></dfn>
+ method must initialize the event in a manner analogous to the
+ similarly-named method in the DOM Events interfaces. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>The <dfn id=dom-undomanagerevent-data title=dom-UndoManagerEvent-data><code>data</code></dfn>
+ attribute represents the <a href=#undo-object>undo object</a> for the event.</p>
+
+ <p>The <dfn id=event-undo title=event-undo><code>undo</code></dfn> and <dfn id=event-redo title=event-redo><code>redo</code></dfn> events do not bubble,
+ cannot be canceled, and have no default action. When the user agent
+ fires one of these events it must use the
+ <code><a href=#undomanagerevent>UndoManagerEvent</a></code> interface, with the <code title=dom-UndoManagerEvent-data><a href=#dom-undomanagerevent-data>data</a></code> field containing the
+ relevant <a href=#undo-object>undo object</a>.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=implementation-notes><span class=secno>8.10.6 </span>Implementation notes</h4>
+
+ <p>How user agents present the above conceptual model to the user is
+ not defined. The undo interface could be a filtered view of the
+ <a href=#undo-transaction-history>undo transaction history</a>, it could manipulate the
+ <a href=#undo-transaction-history>undo transaction history</a> in ways not described above,
+ and so forth. For example, it is possible to design a UA that
+ appears to have separate <a href=#undo-transaction-history title="undo transaction history">undo
+ transaction histories</a> for each form control; similarly, it is
+ possible to design systems where the user has access to more undo
+ information than is present in the official (as described above)
+ <a href=#undo-transaction-history>undo transaction history</a> (such as providing a
+ tree-based approach to document state). Such UI models should be
+ based upon the single <a href=#undo-transaction-history>undo transaction history</a>
+ described in this section, however, such that to a script there is
+ no detectable difference.</p>
+
+ </div>
+
+
+
+
+
+ <h3 id=editing-apis><span class=secno>8.11 </span>Editing APIs</h3>
+
+ <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-execCommand><a href=#execCommand>execCommand</a></code>(<var title="">commandId</var> [, <var title="">showUI</var> [, <var title="">value</var> ] ] )</dt>
+
+ <dd>
+
+ <p>Runs the action specified by the first argument, as described
+ in the list below. The second and third arguments sometimes affect
+ the action. (If they don't they are ignored.)</p>
+
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-queryCommandEnabled><a href=#dom-document-querycommandenabled>queryCommandEnabled</a></code>(<var title="">commandId</var>)</dt>
+
+ <dd>
+
+ <p>Returns whether the given command is enabled, as described in the list below.</p>
+
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-queryCommandIndeterm><a href=#dom-document-querycommandindeterm>queryCommandIndeterm</a></code>(<var title="">commandId</var>)</dt>
+
+ <dd>
+
+ <p>Returns whether the given command is indeterminate, as described in the list below.</p>
+
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-queryCommandState><a href=#dom-document-querycommandstate>queryCommandState</a></code>(<var title="">commandId</var>)</dt>
+
+ <dd>
+
+ <p>Returns the state of the command, as described in the list below.</p>
+
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-queryCommandSupported><a href=#dom-document-querycommandsupported>queryCommandSupported</a></code>(<var title="">commandId</var>)</dt>
+
+ <dd>
+
+ <p>Returns true if the command is supported; otherwise, returns false.</p>
+
+ </dd>
+
+ <dt><var title="">document</var> . <code title=dom-document-queryCommandValue><a href=#dom-document-querycommandvalue>queryCommandValue</a></code>(<var title="">commandId</var>)</dt>
+
+ <dd>
+
+ <p>Returns the value of the command, as described in the list below.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=execCommand title=dom-document-execCommand><code>execCommand(<var title="">commandId</var>, <var title="">showUI</var>, <var title="">value</var>)</code></dfn> method on the
+ <code><a href=#htmldocument>HTMLDocument</a></code> interface allows scripts to perform
+ actions on the <a href=#the-selection title="the selection">current selection</a>
+ or at the current caret position. Generally, these commands would be
+ used to implement editor UI, for example having a "delete" button on
+ a toolbar.</p>
+
+ <p>There are three variants to this method, with one, two, and three
+ arguments respectively. The <var title="">showUI</var> and <var title="">value</var> parameters, even if specified, are ignored
+ except where otherwise stated.</p>
+
+ <p>When <code title=dom-document-execCommand><a href=#execCommand>execCommand()</a></code>
+ is invoked, the user agent must follow the following steps:</p>
+
+ <ol><li>If the given <var title="">commandId</var> maps to an entry in
+ the list below whose "Enabled When" entry has a condition that is
+ currently false, do nothing; abort these steps.</li>
+
+ <li>Otherwise, execute the "Action" listed below for the given <var title="">commandId</var>.</li>
+
+ </ol></div>
+
+ <p>A document is <dfn id=ready-for-editing-host-commands>ready for editing host commands</dfn> if it
+ has a selection that is entirely within an <a href=#editing-host>editing
+ host</a>, or if it has no selection but its caret is inside an
+ <a href=#editing-host>editing host</a>.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=dom-document-querycommandenabled title=dom-document-queryCommandEnabled><code>queryCommandEnabled(<var title="">commandId</var>)</code></dfn> method, when invoked, must
+ return true if the condition listed below under "Enabled When" for
+ the given <var title="">commandId</var> is true, and false
+ otherwise.</p>
+
+ <p>The <dfn id=dom-document-querycommandindeterm title=dom-document-queryCommandIndeterm><code>queryCommandIndeterm(<var title="">commandId</var>)</code></dfn> method, when invoked, must
+ return true if the condition listed below under "Indeterminate When"
+ for the given <var title="">commandId</var> is true, and false
+ otherwise.</p>
+
+ <p>The <dfn id=dom-document-querycommandstate title=dom-document-queryCommandState><code>queryCommandState(<var title="">commandId</var>)</code></dfn> method, when invoked, must
+ return the value expressed below under "State" for the given <var title="">commandId</var>.</p>
+
+ <p>The <dfn id=dom-document-querycommandsupported title=dom-document-queryCommandSupported><code>queryCommandSupported(<var title="">commandId</var>)</code></dfn> method, when invoked, must
+ return true if the given <var title="">commandId</var> is in the
+ list below, and false otherwise.</p>
+
+ <p>The <dfn id=dom-document-querycommandvalue title=dom-document-queryCommandValue><code>queryCommandValue(<var title="">commandId</var>)</code></dfn> method, when invoked, must
+ return the value expressed below under "Value" for the given <var title="">commandId</var>.</p>
+
+ </div>
+
+ <p>The possible values for <var title="">commandId</var>, and their
+ corresponding meanings, are as follows. <span class=impl>These
+ values must be compared to the argument in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner.</span></p>
+
+ <dl><dt><dfn id=command-bold title=command-bold><code>bold</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is bold.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <em><code><a href=#the-b-element>b</a></code></em> element (or, again,
+ unwrapped, or have that semantic inserted or removed, as defined by
+ the UA).</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: True if the selection, or the caret, if
+ there is no selection, is, or is contained within, a
+ <code><a href=#the-b-element>b</a></code> element. False otherwise.</dd>
+ <dd><strong>Value</strong>: The string "<code title="">true</code>"
+ if the expression given for the "State" above is true, the string
+ "<code title="">false</code>" otherwise.</dd>
+
+ <dt><dfn id=command-createlink title=command-createLink><code>createLink</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is a
+ link or not. If the second argument is true, and a link is to be
+ added, the user agent will ask the user for the address. Otherwise,
+ the third argument will be used as the address.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <em><code><a href=#the-a-element>a</a></code></em> element (or, again,
+ unwrapped, or have that semantic inserted or removed, as defined by
+ the UA). If the user agent creates an <code><a href=#the-a-element>a</a></code> element or
+ modifies an existing <code><a href=#the-a-element>a</a></code> element, then if the <var title="">showUI</var> argument is present and has the value false,
+ then the value of the <var title="">value</var> argument must be
+ used as the <a href=#url>URL</a> of the link. Otherwise, the user agent
+ should prompt the user for the URL of the link.</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-delete title=command-delete><code>delete</code></dfn></dt>
+ <dd><strong>Summary</strong>: Deletes the selection or the
+ character before the cursor.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had performed <a href=#contenteditable-delete>a backspace
+ operation</a>.</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-formatblock title=command-formatBlock><code>formatBlock</code></dfn></dt>
+ <dd><strong>Summary</strong>: Wraps the selection in the element
+ given by the second argument. If the second argument doesn't
+ specify an element that is a <dfn id=formatblock-candidate><code title="">formatBlock</code>
+ candidate</dfn>, does nothing.</dd>
+ <dd class=impl>
+ <p><strong>Action</strong>: The user agent must run the following
+ steps:</p>
+ <ol><li><p>If the <var title="">value</var> argument wasn't
+ specified, abort these steps without doing anything.</li>
+ <li><p>If the <var title="">value</var> argument has a leading
+ U+003C LESS-THAN SIGN character (&lt;) and a trailing U+003E
+ GREATER-THAN SIGN character (&gt;), then remove the first and last
+ characters from <var title="">value</var>.</li>
+ <li>
+ <p>If <var title="">value</var> is (now) an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the tag name of an element
+ defined by this specification that is defined to be a
+ <a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>, then,
+ for every position in the selection, take the nearest
+ <a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>
+ ancestor element of that position that contains only
+ <a href=#phrasing-content>phrasing content</a>, and, if that element is
+ <a href=#editable>editable</a>, is not an <a href=#editing-host>editing host</a>, and
+ has a parent element whose content model allows that parent to
+ contain any <a href=#flow-content>flow content</a>, replace it with an
+ element in the HTML namespace whose name is <var title="">value</var>, and move all the children that were in it
+ to the new element, and copy all the attributes that were on it
+ to the new element.</p>
+ <p>If there is no selection, then, where in the description
+ above refers to the selection, the user agent must act as if the
+ selection was an empty range (with just one position) at the
+ caret position.</p>
+ </li>
+ </ol></dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-forwarddelete title=command-forwardDelete><code>forwardDelete</code></dfn></dt>
+ <dd><strong>Summary</strong>: Deletes the selection or the
+ character after the cursor.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had performed <a href=#contenteditable-delete>a forward delete
+ operation</a>.</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-insertimage title=command-insertImage><code>insertImage</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is an
+ image or not. If the second argument is true, and an image is to be
+ added, the user agent will ask the user for the address. Otherwise,
+ the third argument will be used as the address.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act
+ as if the user had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <em><code><a href=#the-img-element>img</a></code></em> element (or, again,
+ unwrapped, or have that semantic inserted or removed, as defined by
+ the UA). If the user agent creates an <code><a href=#the-img-element>img</a></code> element or
+ modifies an existing <code><a href=#the-img-element>img</a></code> element, then if the <var title="">showUI</var> argument is present and has the value false,
+ then the value of the <var title="">value</var> argument must be
+ used as the <a href=#url>URL</a> of the image. Otherwise, the user
+ agent should prompt the user for the URL of the image.</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-inserthtml title=command-insertHTML><code>insertHTML</code></dfn></dt>
+ <dd><strong>Summary</strong>: Replaces the selection with the value
+ of the third argument parsed as HTML.</dd>
+ <dd class=impl>
+ <p><strong>Action</strong>: The user agent must run the following
+ steps:</p>
+ <ol><li><p>If the document is an <a href=#xml-documents title="XML documents">XML
+ document</a>, then throw an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code>
+ exception and abort these steps.</li><!-- v2 support XML? -->
+ <li><p>If the <var title="">value</var> argument wasn't
+ specified, abort these steps without doing anything.</li>
+ <li><p>If there is a selection, act as if the user had requested
+ that <a href=#contenteditable-delete>the selection be
+ deleted</a>.</li>
+ <li><p>Invoke the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a>
+ with an arbitrary orphan <code><a href=#the-body-element-0>body</a></code> element owned by the
+ same <code><a href=#document>Document</a></code> as the <i><a href=#context>context</a></i> element and with
+ the <var title="">value</var> argument as <i><a href=#the-input-element>input</a></i>.</li>
+ <li><p>Insert the nodes returned by the previous step into the
+ document at the location of the caret, firing any mutation events
+ as appropriate.</li>
+ </ol></dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-insertlinebreak title=command-insertLineBreak><code>insertLineBreak</code></dfn></dt>
+ <dd><strong>Summary</strong>: Inserts a line break.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had <a href=#contenteditable-br>requested a line
+ separator</a>.</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-insertorderedlist title=command-insertOrderedList><code>insertOrderedList</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is an ordered list.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <code><a href=#the-ol-element>ol</a></code> element (or unwrapped, or, if
+ there is no selection, have that semantic inserted or removed
+ &mdash; the exact behavior is UA-defined).</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-insertunorderedlist title=command-insertUnorderedList><code>insertUnorderedList</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is an unordered list.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <code><a href=#the-ul-element>ul</a></code> element (or unwrapped, or, if
+ there is no selection, have that semantic inserted or removed
+ &mdash; the exact behavior is UA-defined).</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-insertparagraph title=command-insertParagraph><code>insertParagraph</code></dfn></dt>
+ <dd><strong>Summary</strong>: Inserts a paragraph break.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had performed a <a href=#contenteditable-breakBlock>break
+ block</a> editing action.</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-inserttext title=command-insertText><code>insertText</code></dfn></dt>
+ <dd><strong>Summary</strong>: Inserts the text given in the third parameter.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had <a href=#contenteditable-insertText>inserted text</a>
+ corresponding to the <var title="">value</var> parameter.</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-italic title=command-italic><code>italic</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is italic.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <em><code><a href=#the-i-element>i</a></code></em> element (or, again,
+ unwrapped, or have that semantic inserted or removed, as defined by
+ the UA).</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: True if the selection, or the caret, if
+ there is no selection, is, or is contained within, a
+ <code><a href=#the-i-element>i</a></code> element. False otherwise.</dd>
+ <dd><strong>Value</strong>: The string "<code title="">true</code>"
+ if the expression given for the "State" above is true, the string
+ "<code title="">false</code>" otherwise.</dd>
+
+ <dt><dfn id=command-redo title=command-redo><code>redo</code></dfn></dt>
+ <dd><strong>Summary</strong>: Acts as if the user had requested a redo.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must <a href=#redo:-moving-forward-in-the-undo-transaction-history title=do-redo>move forward one step</a> in its <a href=#undo-transaction-history>undo
+ transaction history</a>, restoring the associated state. If the
+ <a href=#undo-position>undo position</a> is at the end of the <a href=#undo-transaction-history>undo
+ transaction history</a>, the user agent must do nothing. See the
+ <a href=#undo>undo history</a>.</dd>
+ <dd><strong>Enabled When</strong>: The <a href=#undo-position>undo position</a>
+ is not at the end of the <a href=#undo-transaction-history>undo transaction
+ history</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-selectall title=command-selectAll><code>selectAll</code></dfn></dt>
+ <dd><strong>Summary</strong>: Selects all the editable content.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must change the
+ selection so that all the content in the currently focused
+ <a href=#editing-host>editing host</a> is selected. If no <a href=#editing-host>editing
+ host</a> is focused, then the content of the entire document
+ must be selected.</dd>
+ <dd><strong>Enabled When</strong>: Always.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-subscript title=command-subscript><code>subscript</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is subscripted.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <em><code><a href=#the-sub-and-sup-elements>sub</a></code></em> element (or, again,
+ unwrapped, or have that semantic inserted or removed, as defined by
+ the UA).</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: True if the selection, or the caret, if
+ there is no selection, is, or is contained within, a
+ <code><a href=#the-sub-and-sup-elements>sub</a></code> element. False otherwise.</dd>
+ <dd><strong>Value</strong>: The string "<code title="">true</code>"
+ if the expression given for the "State" above is true, the string
+ "<code title="">false</code>" otherwise.</dd>
+
+ <dt><dfn id=command-superscript title=command-superscript><code>superscript</code></dfn></dt>
+ <dd><strong>Summary</strong>: Toggles whether the selection is superscripted.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must act as if the user
+ had requested that the selection <a href=#contenteditable-wrapSemantic>be wrapped in the
+ semantics</a> of the <code><a href=#the-sub-and-sup-elements>sup</a></code> element (or unwrapped, or, if
+ there is no selection, have that semantic inserted or removed
+ &mdash; the exact behavior is UA-defined).</dd>
+ <dd><strong>Enabled When</strong>: The document is <a href=#ready-for-editing-host-commands>ready for
+ editing host commands</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: True if the selection, or the caret, if
+ there is no selection, is, or is contained within, a
+ <code><a href=#the-sub-and-sup-elements>sup</a></code> element. False otherwise.</dd>
+ <dd><strong>Value</strong>: The string "<code title="">true</code>"
+ if the expression given for the "State" above is true, the string
+ "<code title="">false</code>" otherwise.</dd>
+
+ <dt><dfn id=command-undo title=command-undo><code>undo</code></dfn></dt>
+ <dd><strong>Summary</strong>: Acts as if the user had requested an undo.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must <a href=#undo:-moving-back-in-the-undo-transaction-history title=do-undo>move back one step</a> in its <a href=#undo-transaction-history>undo
+ transaction history</a>, restoring the associated state. If the
+ <a href=#undo-position>undo position</a> is at the start of the <a href=#undo-transaction-history>undo
+ transaction history</a>, the user agent must do nothing. See the
+ <a href=#undo>undo history</a>.</dd>
+ <dd><strong>Enabled When</strong>: The <a href=#undo-position>undo position</a>
+ is not at the start of the <a href=#undo-transaction-history>undo transaction
+ history</a>.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-unlink title=command-unlink><code>unlink</code></dfn></dt>
+ <dd><strong>Summary</strong>: Removes all links from the selection.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must remove all
+ <code><a href=#the-a-element>a</a></code> elements that have <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attributes and that are partially
+ or completely included in the current selection.</dd>
+ <dd><strong>Enabled When</strong>: The document has a selection
+ that is entirely within an <a href=#editing-host>editing host</a> and that
+ contains (either partially or completely) at least one
+ <code><a href=#the-a-element>a</a></code> element that has an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt><dfn id=command-unselect title=command-unselect><code>unselect</code></dfn></dt>
+ <dd><strong>Summary</strong>: Unselects everything.</dd>
+ <dd class=impl><strong>Action</strong>: The user agent must change the
+ selection so that nothing is selected.</dd>
+ <dd><strong>Enabled When</strong>: Always.</dd>
+ <dd><strong>Indeterminate When</strong>: Never.</dd>
+ <dd><strong>State</strong>: Always false.</dd>
+ <dd><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ <dt class=impl><code><var title="">vendorID</var>-<var title="">customCommandID</var></code></dt>
+ <dd class=impl><strong>Action</strong>: User agents may implement
+ vendor-specific extensions to this API. Vendor-specific extensions
+ to the list of commands should use the syntax <code><var title="">vendorID</var>-<var title="">customCommandID</var></code>
+ so as to prevent clashes between extensions from different vendors
+ and future additions to this specification.</dd>
+ <dd class=impl><strong>Enabled When</strong>: UA-defined.</dd>
+ <dd class=impl><strong>Indeterminate When</strong>: UA-defined.</dd>
+ <dd class=impl><strong>State</strong>: UA-defined.</dd>
+ <dd class=impl><strong>Value</strong>: UA-defined.</dd>
+
+ <dt class=impl>Anything else</dt>
+ <dd class=impl><strong>Action</strong>: User agents must do nothing.</dd>
+ <dd class=impl><strong>Enabled When</strong>: Never.</dd>
+ <dd class=impl><strong>Indeterminate When</strong>: Never.</dd>
+ <dd class=impl><strong>State</strong>: Always false.</dd>
+ <dd class=impl><strong>Value</strong>: Always the string "<code title="">false</code>".</dd>
+
+ </dl><!--
+v2 (well, really v0):
+ "forecolor", "hilitecolor", "fontname", "fontsize", "justifyleft",
+ "justifycenter", "justifyright", "justifyfull", "indent", "outdent"
+--><h2 id=comms><span class=secno>9 </span>Communication</h2>
+
+ <div data-component="Web Messaging (editor: Ian Hickson)">
+
+
+
+ <h3 id=event-definitions-0><span class=secno>9.1 </span>Event definitions</h3>
+
+ <p>Messages in <span>server-sent events</span>, <span>Web
+ sockets</span>, <a href=#web-messaging>cross-document messaging</a>, and
+ <a href=#channel-messaging>channel messaging</a> use the <dfn id=event-message title=event-message><code>message</code></dfn> event.
+
+ <a href=#refsEVENTSOURCE>[EVENTSOURCE]</a>
+ <a href=#refsWEBSOCKET>[WEBSOCKET]</a>
+
+ </p>
+
+ <p>The following interface is defined for this event:</p>
+
+ <pre class=idl>interface <dfn id=messageevent>MessageEvent</dfn> : <a href=#event>Event</a> {
+ readonly attribute any <a href=#dom-messageevent-data title=dom-MessageEvent-data>data</a>;
+ readonly attribute DOMString <a href=#dom-messageevent-origin title=dom-MessageEvent-origin>origin</a>;
+ readonly attribute DOMString <a href=#dom-messageevent-lasteventid title=dom-MessageEvent-lastEventId>lastEventId</a>;
+ readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-messageevent-source title=dom-MessageEvent-source>source</a>;
+ readonly attribute <a href=#messageportarray>MessagePortArray</a> <a href=#dom-messageevent-ports title=dom-MessageEvent-ports>ports</a>;
+ void <a href=#dom-messageevent-initmessageevent title=dom-MessageEvent-initMessageEvent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <a href=#messageportarray>MessagePortArray</a> portsArg);
+};</pre>
+
+ <dl class=domintro><dt><var title="">event</var> . <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code></dt>
+
+ <dd>
+
+ <p>Returns the data of the message.</p>
+
+ </dd>
+
+ <dt><var title="">event</var> . <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code></dt>
+
+ <dd>
+
+ <p>Returns the origin of the message, for <span>server-sent
+ events</span> and <a href=#web-messaging>cross-document messaging</a>.</p>
+
+ </dd>
+
+ <dt><var title="">event</var> . <code title=dom-MessageEvent-lastEventId><a href=#dom-messageevent-lasteventid>lastEventId</a></code></dt>
+
+ <dd>
+
+ <p>Returns the last event ID, for <span>server-sent
+ events</span>.</p>
+
+ </dd>
+
+ <dt><var title="">event</var> . <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> of the source window, for
+ <a href=#web-messaging>cross-document messaging</a>.</p>
+
+ </dd>
+
+ <dt><var title="">event</var> . <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code></dt>
+
+ <dd>
+
+ <p>Returns the <code><a href=#messageportarray>MessagePortArray</a></code> sent with the
+ message, for <a href=#web-messaging>cross-document messaging</a> and
+ <a href=#channel-messaging>channel messaging</a>.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-messageevent-initmessageevent title=dom-MessageEvent-initMessageEvent><code>initMessageEvent()</code></dfn>
+ method must initialize the event in a manner analogous to the
+ similarly-named method in the DOM Events interfaces. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>The <dfn id=dom-messageevent-data title=dom-MessageEvent-data><code>data</code></dfn>
+ attribute represents the message being sent.</p>
+
+ <p>The <dfn id=dom-messageevent-origin title=dom-MessageEvent-origin><code>origin</code></dfn> attribute
+ represents, in <span>server-sent events</span> and
+ <a href=#web-messaging>cross-document messaging</a>, the <a href=#origin>origin</a> of
+ the document that sent the message (typically the scheme, hostname,
+ and port of the document, but not its path or fragment
+ identifier).</p>
+
+ <p>The <dfn id=dom-messageevent-lasteventid title=dom-MessageEvent-lastEventId><code>lastEventId</code></dfn>
+ attribute represents, in <span>server-sent events</span>, the <span title=concept-event-stream-last-event-id>last event ID
+ string</span> of the event source.</p>
+
+ <p>The <dfn id=dom-messageevent-source title=dom-MessageEvent-source><code>source</code></dfn> attribute
+ represents, in <a href=#web-messaging>cross-document messaging</a>, the
+ <code><a href=#windowproxy>WindowProxy</a></code> of the <a href=#browsing-context>browsing context</a> of the
+ <code><a href=#window>Window</a></code> object from which the message came.</p>
+
+ <p>The <dfn id=dom-messageevent-ports title=dom-MessageEvent-ports><code>ports</code></dfn>
+ attribute represents, in <a href=#web-messaging>cross-document messaging</a> and
+ <a href=#channel-messaging>channel messaging</a> the <code><a href=#messageportarray>MessagePortArray</a></code>
+ being sent, if any.</p>
+
+ <p>Except where otherwise specified, when the user agent creates and
+ dispatches a <code title=event-message><a href=#event-message>message</a></code> event in the
+ algorithms described in the following sections, the <code title=dom-MessageEvent-lastEventId><a href=#dom-messageevent-lasteventid>lastEventId</a></code> attribute
+ must be the empty string, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be the
+ empty string, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
+ null, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
+ attribute must be null.</p>
+
+ </div>
+
+
+ </div><!--data-component-->
+
+
+
+
+ <div data-component="Web Messaging (editor: Ian Hickson)">
+
+
+
+ <h3 id=web-messaging><span class=secno>9.2 </span><dfn id=crossDocumentMessages>Cross-document messaging</dfn></h3>
+
+ <p>Web browsers, for security and privacy reasons, prevent documents
+ in different domains from affecting each other; that is, cross-site
+ scripting is disallowed.</p>
+
+ <p>While this is an important security feature, it prevents pages
+ from different domains from communicating even when those pages are
+ not hostile. This section introduces a messaging system that allows
+ documents to communicate with each other regardless of their source
+ domain, in a way designed to not enable cross-site scripting
+ attacks.</p>
+
+ <div class=impl>
+
+ <p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> in <a href=#web-messaging>cross-document
+ messaging</a> is the <dfn id=posted-message-task-source>posted message task source</dfn>.</p>
+
+ </div>
+
+
+ <h4 id=introduction-6><span class=secno>9.2.1 </span>Introduction</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <div class=example>
+
+ <p>For example, if document A contains an <code><a href=#the-iframe-element>iframe</a></code>
+ element that contains document B, and script in document A calls
+ <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> on the
+ <code><a href=#window>Window</a></code> object of document B, then a message event will
+ be fired on that object, marked as originating from the
+ <code><a href=#window>Window</a></code> of document A. The script in document A might
+ look like:</p>
+
+ <pre>var o = document.getElementsByTagName('iframe')[0];
+o.contentWindow.postMessage('Hello world', 'http://b.example.org/');</pre>
+
+ <p>To register an event handler for incoming events, the script
+ would use <code title="">addEventListener()</code> (or similar
+ mechanisms). For example, the script in document B might look
+ like:</p>
+
+ <pre>window.addEventListener('message', receiver, false);
+function receiver(e) {
+ if (e.origin == 'http://example.com') {
+ if (e.data == 'Hello world') {
+ e.source.postMessage('Hello', e.origin);
+ } else {
+ alert(e.data);
+ }
+ }
+}</pre>
+
+ <p>This script first checks the domain is the expected domain, and
+ then looks at the message, which it either displays to the user, or
+ responds to by sending a message back to the document which sent
+ the message in the first place.</p>
+
+ </div>
+
+
+ <h4 id=security-postmsg><span class=secno>9.2.2 </span>Security</h4>
+
+ <div class=impl>
+
+ <h5 id=authors><span class=secno>9.2.2.1 </span>Authors</h5>
+
+ </div>
+
+ <p class=warning id=security-4>Use of this API requires extra
+ care to protect users from hostile entities abusing a site for their
+ own purposes.</p>
+
+ <p>Authors should check the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute to ensure
+ that messages are only accepted from domains that they expect to
+ receive messages from. Otherwise, bugs in the author's message
+ handling code could be exploited by hostile sites.</p>
+
+ <p>Furthermore, even after checking the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute, authors
+ should also check that the data in question is of the expected
+ format. Otherwise, if the source of the event has been attacked
+ using a cross-site scripting flaw, further unchecked processing of
+ information sent using the <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method could
+ result in the attack being propagated into the receiver.</p>
+
+ <p>Authors should not use the wildcard keyword (*) in the <var title="">targetOrigin</var> argument in messages that contain any
+ confidential information, as otherwise there is no way to guarantee
+ that the message is only delivered to the recipient to which it was
+ intended.</p>
+
+
+ <div class=impl>
+
+ <h5 id=user-agents><span class=secno>9.2.2.2 </span>User agents</h5>
+
+ <p>The integrity of this API is based on the inability for scripts
+ of one <a href=#origin>origin</a> to post arbitrary events (using <code title="">dispatchEvent()</code> or otherwise) to objects in other
+ origins (those that are not the <a href=#same-origin title="same
+ origin">same</a>).</p>
+
+ <p class=note>Implementors are urged to take extra care in the
+ implementation of this feature. It allows authors to transmit
+ information from one domain to another domain, which is normally
+ disallowed for security reasons. It also requires that UAs be
+ careful to allow access to certain properties but not others.</p>
+
+ </div>
+
+
+ <h4 id=posting-messages><span class=secno>9.2.3 </span>Posting messages</h4>
+
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">ports</var> ])</dt>
+
+ <dd>
+
+ <p>Posts a message, optionally with an array of ports, to the
+ given window.</p>
+
+ <p>If the origin of the target window doesn't match the given
+ origin, the message is discarded, to avoid information leakage. To
+ send the message to the target regardless of origin, set the
+ target origin to "<code title="">*</code>". To restrict the
+ message to same-origin targets only, without needing to explicitly
+ state the origin, set the target origin to "<code title="">/</code>".</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array is not null and it contains either null
+ entries or duplicate ports.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">ports</var>)</code></dfn> method (with two or three
+ arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
+ follow these steps:
+
+ <ol><li>
+
+ <p>If the value of the <var title="">targetOrigin</var> argument
+ is neither a single U+002A ASTERISK character (*), a single U+002F
+ SOLIDUS character (/), nor an <a href=#absolute-url>absolute URL</a> with a
+ <code title=url-host-specific><a href=#url-host-specific>&lt;host-specific&gt;</a></code>
+ component that is either empty or a single U+002F SOLIDUS
+ character (/), then throw a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and
+ abort the overall set of steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">message clone</var> be the result of
+ obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument. If this throws an exception, then
+ throw that exception and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <var title="">ports</var> argument is present but either
+ any of the entries in <var title="">ports</var> are null, or any
+ <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, or any of the
+ <code><a href=#messageport>MessagePort</a></code> objects listed in <var title="">ports</var> have already been cloned once before, then
+ throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception and abort these
+ steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">new ports</var> be an empty array.</p>
+
+ <p>If the <var title="">ports</var> argument is present, then for
+ each port in <var title="">ports</var> in turn, obtain a new port
+ by <a href=#clone-a-port title="clone a port">cloning</a> the port with the
+ <code><a href=#window>Window</a></code> object on which the method was invoked as the
+ owner of the clone, and append the clone to the <var title="">new
+ ports</var> array.</p>
+
+ <p class=note>If the original <var title="">ports</var> argument
+ was omitted or empty, then the <var title="">new ports</var> array
+ will be empty.</p>
+
+ </li>
+
+ <li>
+
+ <p>Return from the <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, but
+ asynchronously continue running these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <var title="">targetOrigin</var> argument is a single
+ literal U+002F SOLIDUS character (/), and the
+ <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which
+ the method was invoked does not have the <a href=#same-origin>same origin</a>
+ as the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
+ document">document</a>, then abort these steps silently.</p>
+
+ <p>Otherwise, if the <var title="">targetOrigin</var> argument is
+ an <a href=#absolute-url>absolute URL</a>, and the <code><a href=#document>Document</a></code> of the
+ <code><a href=#window>Window</a></code> object on which the method was invoked does
+ not have the <a href=#same-origin>same origin</a> as <var title="">targetOrigin</var>, then abort these steps silently.</p>
+
+ <p>Otherwise, the <var title="">targetOrigin</var> argument is a
+ single literal U+002A ASTERISK character (*), and no origin check
+ is made.</p>
+
+ </li>
+
+ <li>
+
+ <p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
+ interface, with the event name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is
+ not cancelable, and has no default action. The <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute must be set to
+ the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be
+ set to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an
+ origin">Unicode serialization</a> of the <a href=#origin>origin</a> of
+ the script that invoked the method, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
+ set to the <a href="#script's-global-object">script's global object</a>'s
+ <code><a href=#windowproxy>WindowProxy</a></code> object, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be set
+ to the <var title="">new ports</var> array.</p> <!-- invariant:
+ the global object is always a Window if the script can see this
+ method -->
+
+ </li>
+
+ <li>
+
+ <p><a href=#queue-a-task>Queue a task</a> to dispatch the event created in the
+ previous step at the <code><a href=#window>Window</a></code> object on which the
+ method was invoked. The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#posted-message-task-source>posted message task
+ source</a>.</p>
+
+ </li>
+
+ </ol></div>
+
+
+
+ <h3 id=channel-messaging><span class=secno>9.3 </span><dfn>Channel messaging</dfn></h3>
+
+ <h4 id=introduction-7><span class=secno>9.3.1 </span>Introduction</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>To enable independent pieces of code (e.g. running in different
+ <a href=#browsing-context title="browsing context">browsing contexts</a>) to
+ communicate directly, authors can use <a href=#channel-messaging>channel
+ messaging</a>.</p>
+
+ <p>Communication channels in this mechanisms are implemented as
+ two-ways pipes, with a port at each end. Messages sent in one port
+ are delivered at the other port, and vice-versa. Messages are
+ asynchronous, and delivered as DOM events.</p>
+
+ <p>To create a connection (two "entangled" ports), the <code title="">MessageChannel()</code> constructor is called:</p>
+
+ <pre>var channel = new MessageChannel();</pre>
+
+ <p>One of the ports is kept as the local port, and the other port is
+ sent to the remote code, e.g. using <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code>:</p>
+
+ <pre>otherWindow.postMessage('hello', 'http://example.com', [channel.port2]);</pre>
+
+ <p>To send messages, the <code title=dom-MessagePort-postMessage><a href=#dom-messageport-postmessage>postMessage()</a></code> method on
+ the port is used:</p>
+
+ <pre>channel.port1.postMessage('hello');</pre>
+
+ <p>To receive messages, one listens to <code title=event-message><a href=#event-message>message</a></code> events:</p>
+
+ <pre>channel.port1.onmessage = handleMessage;
+function handleMessage(event) {
+ // message is in event.data
+ // ...
+}</pre>
+
+
+ <h4 id=message-channels><span class=secno>9.3.2 </span>Message channels</h4>
+
+ <pre class=idl>[<a href=#dom-messagechannel title=dom-MessageChannel>Constructor</a>]
+interface <dfn id=messagechannel>MessageChannel</dfn> {
+ readonly attribute <a href=#messageport>MessagePort</a> <a href=#dom-channel-port1 title=dom-channel-port1>port1</a>;
+ readonly attribute <a href=#messageport>MessagePort</a> <a href=#dom-channel-port2 title=dom-channel-port2>port2</a>;
+};</pre>
+
+ <dl class=domintro><dt><var title="">channel</var> = new <code title=dom-MessageChannel><a href=#dom-messagechannel>MessageChannel</a></code>()</dt>
+
+ <dd>
+
+ <p>Returns a new <code><a href=#messagechannel>MessageChannel</a></code> object with two new <code><a href=#messageport>MessagePort</a></code> objects.</p>
+
+ </dd>
+
+ <dt><var title="">channel</var> . <code title=dom-MessageChannel-port1>port1</code></dt>
+
+ <dd>
+
+ <p>Returns the first <code><a href=#messageport>MessagePort</a></code> object.</p>
+
+ </dd>
+
+ <dt><var title="">channel</var> . <code title=dom-MessageChannel-port2>port2</code></dt>
+
+ <dd>
+
+ <p>Returns the second <code><a href=#messageport>MessagePort</a></code> object.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>When the <dfn id=dom-messagechannel title=dom-MessageChannel><code>MessageChannel()</code></dfn>
+ constructor is called, it must run the following algorithm:</p>
+
+ <ol><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
+ owned by the <a href="#script's-global-object">script's global object</a>, and let <var title="">port1</var> be that object.</li>
+
+ <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
+ owned by the <a href="#script's-global-object">script's global object</a>, and let <var title="">port2</var> be that object.</li>
+
+ <li><p><a href=#entangle>Entangle</a> the <var title="">port1</var> and <var title="">port2</var> objects.</li>
+
+ <li><p>Instantiate a new <code><a href=#messagechannel>MessageChannel</a></code> object, and
+ let <var title="">channel</var> be that object.</li>
+
+ <li><p>Let the <code title=dom-channel-port1><a href=#dom-channel-port1>port1</a></code>
+ attribute of the <var title="">channel</var> object be <var title="">port1</var>.</p>
+
+ <li><p>Let the <code title=dom-channel-port2><a href=#dom-channel-port2>port2</a></code>
+ attribute of the <var title="">channel</var> object be <var title="">port2</var>.</p>
+
+ <li><p>Return <var title="">channel</var>.</li>
+
+ </ol><p>This constructor must be visible when the <a href="#script's-global-object">script's global
+ object</a> is either a <code><a href=#window>Window</a></code> object or an object
+ implementing the <code>WorkerUtils</code> interface.</p>
+
+ <p>The <dfn id=dom-channel-port1 title=dom-channel-port1><code>port1</code></dfn> and
+ <dfn id=dom-channel-port2 title=dom-channel-port2><code>port2</code></dfn> attributes
+ must return the values they were assigned when the
+ <code><a href=#messagechannel>MessageChannel</a></code> object was created.</p>
+
+ </div>
+
+
+
+ <h4 id=message-ports><span class=secno>9.3.3 </span>Message ports</h4>
+
+ <p>Each channel has two message ports. Data sent through one port is
+ received by the other port, and vice versa.</p>
+
+ <pre class=idl>typedef sequence&lt;MessagePort&gt; <dfn id=messageportarray>MessagePortArray</dfn>;
+
+interface <dfn id=messageport>MessagePort</dfn> {
+<!-- v2-onclose readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
+--> void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, in optional <a href=#messageportarray>MessagePortArray</a> ports);<!--
+ <span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(in any message);-->
+ void <a href=#dom-messageport-start title=dom-MessagePort-start>start</a>();
+ void <a href=#dom-messageport-close title=dom-MessagePort-close>close</a>();
+
+ // event handlers
+ attribute <a href=#function>Function</a> <a href=#handler-messageport-onmessage title=handler-MessagePort-onmessage>onmessage</a>;
+};
+<a href=#messageport>MessagePort</a> implements <a href=#eventtarget>EventTarget</a>;</pre>
+
+ <dl class=domintro><!-- v2-onclose
+ <dt><var title="">port</var> . <code title="dom-MessagePort-active">active</code></dt>
+
+ <dd>
+
+ <p>Returns true if the port is still active; otherwise, returns false.</p>
+
+ </dd>
+--><dt><var title="">port</var> . <code title=dom-MessagePort-poseMessage>postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
+
+ <dd>
+
+ <p>Posts a message through the channel, optionally with the given
+ ports.</p>
+
+ <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array is not null and it contains either null
+ entries, duplicate ports, or the source or target port.</p>
+
+ </dd>
+
+ <dt><var title="">port</var> . <code title=dom-MessagePort-start><a href=#dom-messageport-start>start</a></code>()</dt>
+
+ <dd>
+
+ <p>Begins dispatching messages received on the port.</p>
+
+ </dd>
+
+ <dt><var title="">port</var> . <code title=dom-MessagePort-close><a href=#dom-messageport-close>close</a></code>()</dt>
+
+ <dd>
+
+ <p>Disconnects the port, so that it is no longer active.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>Each <code><a href=#messageport>MessagePort</a></code> object can be entangled with
+ another (a symmetric relationship). Each <code><a href=#messageport>MessagePort</a></code>
+ object also has a <a href=#task-source>task source</a> called the <dfn id=port-message-queue>port
+ message queue</dfn>, initial empty. A <a href=#port-message-queue>port message
+ queue</a> can be enabled or disabled, and is initially
+ disabled. Once enabled, a port can never be disabled again (though
+ messages in the queue can get moved to another queue or removed
+ altogether, which has much the same effect).</p>
+
+ <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new
+ <code>MessagePort</code> object</dfn> owned by a <a href="#script's-global-object">script's
+ global object</a> object <var title="">owner</var>, it must
+ instantiate a new <code><a href=#messageport>MessagePort</a></code> object, and let its owner
+ be <var title="">owner</var>.</p>
+
+ <hr><p>When the user agent is to <dfn id=entangle>entangle</dfn> two
+ <code><a href=#messageport>MessagePort</a></code> objects, it must run the following
+ steps:</p>
+
+ <ol><li>
+
+ <p>If one of the ports is already entangled, then disentangle it
+ and the port that it was entangled with.</p>
+
+ <p class=note>If those two previously entangled ports were the
+ two ports of a <code><a href=#messagechannel>MessageChannel</a></code> object, then that
+ <code><a href=#messagechannel>MessageChannel</a></code> object no longer represents an actual
+ channel: the two ports in that object are no longer entangled.</p>
+
+ </li>
+
+ <li><p>Associate the two ports to be entangled, so that they form
+ the two parts of a new channel. (There is no
+ <code><a href=#messagechannel>MessageChannel</a></code> object that represents this
+ channel.)</li>
+
+ </ol><hr><p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var title="">original port</var>, with the clone being owned by <var title="">owner</var>, it must run the following steps, which return
+ a new <code><a href=#messageport>MessagePort</a></code> object. These steps must be run
+ atomically.</p>
+
+ <ol><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
+ owned by <var title="">owner</var>, and let <var title="">new
+ port</var> be that object.</li>
+
+ <li><p>Move all the events in the <a href=#port-message-queue>port message queue</a>
+ of <var title="">original port</var> to the <a href=#port-message-queue>port message
+ queue</a> of <var title="">new port</var>, if any, leaving the
+ <var title="">new port</var>'s <a href=#port-message-queue>port message queue</a> in
+ its initial disabled state.</li>
+
+ <li>
+
+ <p>If the <var title="">original port</var> is entangled with
+ another port, then run these substeps:</p>
+
+ <ol><li><p>Let the <var title="">remote port</var> be the port with
+ which the <var title="">original port</var> is entangled.</li>
+
+ <li><p><a href=#entangle>Entangle</a> the <var title="">remote port</var>
+ and <var title="">new port</var> objects. The <var title="">original port</var> object will be disentangled by this
+ process.</li>
+
+ </ol></li>
+
+ <li><p>Return <var title="">new port</var>. It is the
+ clone.</li>
+
+ </ol><hr><!-- v2-onclose
+ <p>The <dfn title="dom-MessagePort-active"><code>active</code></dfn>
+ attribute must return true if the port is entangled, and false
+ otherwise.</p>
+
+ <hr>
+--><p>The <dfn id=dom-messageport-postmessage title=dom-MessagePort-postMessage><code>postMessage()</code></dfn>
+ method, when called on a port <var title="">source port</var>, must
+ cause the user agent to run the following steps:</p>
+
+ <ol><li><p>Let <var title="">target port</var> be the port with which
+ <var title="">source port</var> is entangled, if any.</li>
+
+ <li><p>If the method was called with a second argument <var title="">ports</var> and that argument isn't null, then, if any of
+ the entries in <var title="">ports</var> are null, if any
+ <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, if any of the
+ <code><a href=#messageport>MessagePort</a></code> objects listed in <var title="">ports</var> have already been cloned once before, or if
+ any of the entries in <var title="">ports</var> are either the <var title="">source port</var> or the <var title="">target port</var>
+ (if any), then throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code>
+ exception.</li>
+
+ <li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
+ steps.</li>
+ <!-- we don't raise an exception if there is no target port because
+ this can happen at a moment's notice. we don't return false because
+ if the port is _about_ to be closed, the message might not be
+ listened for anyway. -->
+
+ <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
+ interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
+ cancelable, and has no default action.</li>
+
+ <li><p>Let <var title="">message</var> be the method's first
+ argument.</li>
+
+ <li><p>Let <var title="">message clone</var> be the result of
+ obtaining a <a href=#structured-clone>structured clone</a> of <var title="">message</var>. If this throws an exception, then throw
+ that exception and abort these steps.</li>
+
+ <li><p>Let the <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code>
+ attribute of the event have the value of <var title="">message
+ clone</var>.</li>
+
+ <li><p>If the method was called with a second argument <var title="">ports</var> and that argument isn't null, then run the
+ following substeps:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">new ports</var> be an empty array.</p>
+
+ <p>For each port in <var title="">ports</var> in turn,
+ obtain a new port by <a href=#clone-a-port title="clone a port">cloning</a>
+ the port with the owner of the <var title="">target port</var>
+ as the owner of the clone, and append the clone to the <var title="">new ports</var> array.</p>
+
+ <p class=note>If the original <var title="">ports</var>
+ array was empty, then the <var title="">new ports</var> array will
+ also be empty.</p>
+
+ </li>
+
+ <li><p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
+ attribute of the event be the <var title="">new ports</var>
+ array.</li>
+
+ </ol></li>
+
+ <li><p>Add the event to the <a href=#port-message-queue>port message queue</a> of <var title="">target port</var>.</li>
+
+ </ol><!--
+ <hr>
+
+ <p>The <dfn
+ title="dom-MessagePort-startConversation"><code>startConversation(<var
+ title="">message</var>)</code></dfn> method is a convenience method
+ that simplifies create a new <code>MessageChannel</code> and
+ invoking <code
+ title="dom-MessagePort-postMessage">postMessage()</code> with one of
+ the new ports. When invoked on a port <var title="">source
+ port</var>, it must run the following steps:</p>
+
+ <ol>
+
+ <li><p>Let <var title="">message</var> be the method's first
+ argument.</p></li>
+
+ <li><p><span>Create a new <code>MessagePort</code> object</span>
+ owned by the <span>script's global object</span>, and let <var
+ title="">port1</var> be that object.</p></li>
+
+ <li><p>If the <var title="">source port</var> is not entangled with
+ another port, then return <var title="">port1</var> and abort these
+ steps.</p></li>
+ <!- - we don't raise an exception because this can happen moment's
+ notice. we don't return null because then we'd end up with
+ null derefs. better to just let the likely next postMessage call
+ fall on the floor. - ->
+
+ <li><p>Let <var title="">target port</var> be the port with which
+ <var title="">source port</var> is entangled.</p></li>
+
+ <li><p><span>Create a new <code>MessagePort</code> object</span>
+ owned by the owner of the <var title="">target port</var>, and let
+ <var title="">port2</var> be that object.</p></li>
+
+ <li><p><span>Entangle</span> the <var title="">port1</var> and <var
+ title="">port2</var> objects.</p></li>
+
+ <li><p>Create an event that uses the <code>MessageEvent</code>
+ interface, with the name <code
+ title="event-message">message</code>, which does not bubble, is not
+ cancelable, and has no default action.</p></li>
+
+ <li><p>Let the <code title="dom-MessageEvent-data">data</code>
+ attribute of the event have the value of <var
+ title="">message</var>, the method's first argument.</p></li>
+
+ <li><p>Let the <code
+ title="dom-MessageEvent-ports">ports</code> attribute
+ of the event be an array containing only <var
+ title="">port2</var>.</p></li>
+
+ <li><p>Return <var title="">port1</var> from the method, but
+ continue with these steps.</p></li>
+
+ <li><p>Add the event to the <span>port message queue</span> of <var
+ title="">target port</var>.</p></li>
+
+ </ol>
+--><hr><p>The <dfn id=dom-messageport-start title=dom-MessagePort-start><code>start()</code></dfn>
+ method must enable its port's <a href=#port-message-queue>port message queue</a>, if it
+ is not already enabled.</p>
+
+ <p>When a port's <a href=#port-message-queue>port message queue</a> is enabled, the
+ <a href=#event-loop>event loop</a> must use it as one of its <a href=#task-source title="task
+ source">task sources</a>.</p>
+
+ <p class=note>If the <code><a href=#document>Document</a></code> of the port's event
+ listeners' <a href="#script's-global-object" title="script's global object">global object</a>
+ is not <a href=#fully-active>fully active</a>, then the messages are lost.</p>
+ <!-- because of the jump-to-entry-point algorithm first step -->
+
+ <hr><p>The <dfn id=dom-messageport-close title=dom-MessagePort-close><code>close()</code></dfn>
+ method, when called on a port <var title="">local port</var> that is
+ entangled with another port, must cause the user agents to
+ disentangle the two ports. If the method is called on a port that is
+ not entangled, then the method must do nothing.</p>
+
+ <hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported, as IDL attributes, by
+ all objects implementing the <code><a href=#messageport>MessagePort</a></code> interface:</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-messageport-onmessage title=handler-MessagePort-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code>
+ </table><p>The first time a <code><a href=#messageport>MessagePort</a></code> object's <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> IDL attribute
+ is set, the port's <a href=#port-message-queue>port message queue</a> must be enabled,
+ as if the <code title=dom-MessagePort-start><a href=#dom-messageport-start>start()</a></code> method
+ had been called.</p>
+
+ </div>
+
+
+ <h5 id=ports-and-garbage-collection><span class=secno>9.3.3.1 </span>Ports and garbage collection</h5>
+
+ <div class=impl>
+
+ <p>When a <code><a href=#messageport>MessagePort</a></code> object <var title="">o</var> is
+ entangled, user agents must either act as if <var title="">o</var>'s
+ entangled <code><a href=#messageport>MessagePort</a></code> object has a strong reference to
+ <var title="">o</var>, or as if <var title="">o</var>'s owner has a
+ strong reference to <var title="">o</var>.</p>
+
+ <div class=note>
+
+ <p>Thus, a message port can be received, given an event listener,
+ and then forgotten, and so long as that event listener could
+ receive a message, the channel will be maintained.</p>
+
+ <p>Of course, if this was to occur on both sides of the channel,
+ then both ports could be garbage collected, since they would not be
+ reachable from live code, despite having a strong reference to each
+ other.</p>
+
+ </div>
+
+ <p>Furthermore, a <code><a href=#messageport>MessagePort</a></code> object must not be
+ garbage collected while there exists a message in a <a href=#task-queue>task
+ queue</a> that is to be dispatched on that
+ <code><a href=#messageport>MessagePort</a></code> object, or while the
+ <code><a href=#messageport>MessagePort</a></code> object's <a href=#port-message-queue>port message queue</a> is
+ open and there exists a <code title=event-message><a href=#event-message>message</a></code>
+ event in that queue.</p>
+ <!-- we might not need to explicitly say the first part if DOM
+ Events is fixed to say that events on a task queue prevent GC -->
+
+ <!-- ports in the ports attribute of a MessageEvent that isn't
+ dispatched yet are safe because the MessageEvent is safe -->
+
+ </div>
+
+ <p class=note>Authors are strongly encouraged to explicitly close
+ <code><a href=#messageport>MessagePort</a></code> objects to disentangle them, so that their
+ resources can be recollected. Creating many <code><a href=#messageport>MessagePort</a></code>
+ objects and discarding them without closing them can lead to high
+ memory usage.</p>
+
+
+
+ </div><!--data-component-->
+
+
+
+
+ <h2 id=syntax><span class=secno>10 </span><dfn>The HTML syntax</dfn></h2>
+
+ <p class=note>This section only describes the rules for resources
+ labeled with an <a href=#html-mime-type>HTML MIME type</a>. Rules for XML resources
+ are discussed in the section below entitled "<a href=#the-xhtml-syntax>The XHTML
+ syntax</a>".</p>
+
+
+ <h3 id=writing><span class=secno>10.1 </span>Writing HTML documents</h3>
+
+ <div class=impl>
+
+ <p><i>This section only applies to documents, authoring tools, and
+ markup generators. In particular, it does not apply to conformance
+ checkers; conformance checkers must use the requirements given in
+ the next section ("parsing HTML documents").</i></p>
+
+ </div>
+
+ <p>Documents must consist of the following parts, in the given
+ order:</p>
+
+ <ol><li>Optionally, a single U+FEFF BYTE ORDER MARK (BOM) character.</li>
+
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li>A <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>.
+
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li>The root element, in the form of an <code><a href=#the-html-element-0>html</a></code> <a href=#syntax-elements title=syntax-elements>element</a>.</li>
+
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ </ol><p>The various types of content mentioned above are described in the
+ next few sections.</p>
+
+ <p>In addition, there are some restrictions on how <a href=#character-encoding-declaration title="character encoding declaration">character encoding
+ declarations</a> are to be serialized, as discussed in the
+ section on that topic.</p>
+
+ <div class=note>
+
+ <p>Space characters before the root <code><a href=#the-html-element-0>html</a></code> element, and
+ space characters at the start of the <code><a href=#the-html-element-0>html</a></code> element and
+ before the <code><a href=#the-head-element-0>head</a></code> element, will be dropped when the
+ document is parsed; space characters <em>after</em> the root
+ <code><a href=#the-html-element-0>html</a></code> element will be parsed as if they were at the end
+ of the <code><a href=#the-body-element-0>body</a></code> element. Thus, space characters around the
+ root element do not round-trip.</p>
+
+ <p>It is suggested that newlines be inserted after the DOCTYPE,
+ after any comments that are before the root element, after the
+ <code><a href=#the-html-element-0>html</a></code> element's start tag (if it is not <a href=#syntax-tag-omission title=syntax-tag-omission>omitted</a>), and after any comments
+ that are inside the <code><a href=#the-html-element-0>html</a></code> element but before the
+ <code><a href=#the-head-element-0>head</a></code> element.</p>
+
+ </div>
+
+ <p>Many strings in the HTML syntax (e.g. the names of elements and
+ their attributes) are case-insensitive, but only for characters in
+ the ranges U+0041 to U+005A (LATIN CAPITAL LETTER A to LATIN CAPITAL
+ LETTER Z) and U+0061 to U+007A (LATIN SMALL LETTER A to LATIN SMALL
+ LETTER Z). For convenience, in this section this is just referred to
+ as "case-insensitive".</p>
+
+
+ <h4 id=the-doctype><span class=secno>10.1.1 </span>The DOCTYPE</h4>
+
+ <p>A <dfn id=syntax-doctype title=syntax-doctype>DOCTYPE</dfn> is a <!-- mostly
+ useless but nonetheless --> required preamble.</p>
+
+ <p class=note>DOCTYPEs are required for legacy reasons. When
+ omitted, browsers tend to use a different rendering mode that is
+ incompatible with some specifications. Including the DOCTYPE in a
+ document ensures that the browser makes a best-effort attempt at
+ following the relevant specifications.</p>
+
+ <p>A DOCTYPE must consist of the following characters, in this
+ order:</p>
+
+ <ol class=brief><li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">&lt;!DOCTYPE</code>".</li>
+ <li>One or more <a href=#space-character title="space character">space characters</a>.</li>
+ <li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">HTML</code>".</li>
+ <li>Optionally, a <a href=#doctype-legacy-string>DOCTYPE legacy string</a> or an <a href=#obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</a> (defined below).</li>
+ <li>Zero or more <a href=#space-character title="space character">space characters</a>.</li>
+ <li>A U+003E GREATER-THAN SIGN character (&gt;).</li>
+ </ol><p class=note>In other words, <code>&lt;!DOCTYPE HTML&gt;</code>,
+ case-insensitively.</p>
+
+ <hr><p>For the purposes of HTML generators that cannot output HTML
+ markup with the short DOCTYPE "<code title="">&lt;!DOCTYPE
+ HTML&gt;</code>", a <dfn id=doctype-legacy-string>DOCTYPE legacy string</dfn> may be inserted
+ into the DOCTYPE (in the position defined above). This string must
+ consist of:</p>
+
+ <ol class=brief><li>One or more <a href=#space-character title="space character">space characters</a>.</li>
+ <li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">SYSTEM</code>".</li>
+ <li>One or more <a href=#space-character title="space character">space characters</a>.</li>
+ <li>A U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>quote mark</i>).</li>
+ <li>The literal string "<code><a href=#about:legacy-compat>about:legacy-compat</a></code>".</li>
+ <li>A matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>quote mark</i>).</li>
+ </ol><p class=note>In other words, <code>&lt;!DOCTYPE HTML SYSTEM
+ "about:legacy-compat"&gt;</code> or <code>&lt;!DOCTYPE HTML SYSTEM
+ 'about:legacy-compat'&gt;</code>, case-insensitively except for the bit
+ in single or double quotes.</p>
+
+ <p>The <a href=#doctype-legacy-string>DOCTYPE legacy string</a> should not be used unless
+ the document is generated from a system that cannot output the
+ shorter string.</p>
+
+ <hr><!-- see the parser section before changing this bit --><p>To help authors transition from HTML4 and XHTML1, an
+ <dfn id=obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</dfn> can be inserted into
+ the DOCTYPE (in the position defined above). This string must
+ consist of:</p>
+
+ <ol class=brief><li>One or more <a href=#space-character title="space character">space characters</a>.</li>
+ <li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">PUBLIC</code>".</li>
+ <li>One or more <a href=#space-character title="space character">space characters</a>.</li>
+ <li>A U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>first quote mark</i>).</li>
+ <li>The string from one of the cells in the first column of the table below. The row to which this cell belongs is the <i>selected row</i>.</li>
+ <li>A matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>first quote mark</i>).</li>
+ <li>If the cell in the second column of the <i>selected row</i> is not blank, one or more <a href=#space-character title="space character">space characters</a>.</li>
+ <li>If the cell in the second column of the <i>selected row</i> is not blank, a U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>third quote mark</i>).</li>
+ <li>If the cell in the second column of the <i>selected row</i> is not blank, the string from the cell in the second column of the <i>selected row</i>.</li>
+ <li>If the cell in the second column of the <i>selected row</i> is not blank, a matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>third quote mark</i>).</li>
+ </ol><table><caption>
+ Allowed values for public and system identifiers in an <a href=#obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</a>.
+ </caption>
+ <thead><tr><th> Public identifier
+ <th> System identifier
+ <tbody><tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.0//EN</code>
+ <td>
+ <tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.0//EN</code>
+ <td> <code title="">http://www.w3.org/TR/REC-html40/strict.dtd</code>
+ <tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN</code>
+ <td>
+ <tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN</code>
+ <td> <code title="">http://www.w3.org/TR/html4/strict.dtd</code>
+ <tr><td> <code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Strict//EN</code>
+ <td> <code title="">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>
+ <tr><td> <code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1//EN</code>
+ <td> <code title="">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>
+ </table><p>A <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a> containing an
+ <a href=#obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</a> is an <dfn id=obsolete-permitted-doctype>obsolete
+ permitted DOCTYPE</dfn>. Authors should not use <a href=#obsolete-permitted-doctype title="obsolete permitted DOCTYPE">obsolete permitted
+ DOCTYPEs</a>, as they are unnecessarily long.</p>
+
+
+
+
+ <h4 id=elements-0><span class=secno>10.1.2 </span>Elements</h4>
+
+ <p>There are five different kinds of <dfn id=syntax-elements title=syntax-elements>elements</dfn>: <a href=#void-elements>void elements</a>,
+ <a href=#raw-text-elements>raw text elements</a>, <a href=#rcdata-elements>RCDATA elements</a>,
+ <a href=#foreign-elements>foreign elements</a>, and <a href=#normal-elements>normal elements</a>.</p>
+
+ <dl><dt><dfn id=void-elements>Void elements</dfn></dt>
+
+ <dd><code><a href=#the-area-element>area</a></code>, <code><a href=#the-base-element>base</a></code>, <code><a href=#the-br-element>br</a></code>,
+ <code><a href=#the-col-element>col</a></code>, <code><a href=#the-command>command</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>,
+ <code><a href=#the-keygen-element>keygen</a></code>, <code><a href=#the-link-element>link</a></code>, <code><a href=#meta>meta</a></code>,
+ <code><a href=#the-param-element>param</a></code>, <code><a href=#the-source-element>source</a></code>, <code><a href=#the-track-element>track</a></code>,
+ <code><a href=#the-wbr-element>wbr</a></code></dd>
+
+ <dt><dfn id=raw-text-elements>Raw text elements</dfn></dt>
+
+ <dd><code><a href=#script>script</a></code>, <code><a href=#the-style-element>style</a></code></dd> <!-- iframe and
+ noscript don't count as raw text for syntax purposes -->
+
+ <dt><dfn id=rcdata-elements>RCDATA elements</dfn></dt>
+
+ <dd><code><a href=#the-textarea-element>textarea</a></code>, <code><a href=#the-title-element-0>title</a></code></dd>
+
+ <dt><dfn id=foreign-elements>Foreign elements</dfn></dt>
+
+ <dd>Elements from the <a href=#mathml-namespace>MathML namespace</a>
+ and the <a href=#svg-namespace>SVG namespace</a>.</dd>
+
+ <dt><dfn id=normal-elements>Normal elements</dfn></dt>
+
+ <dd>All other allowed <a href=#html-elements>HTML elements</a> are normal
+ elements.</dd>
+
+ </dl><p><dfn id=syntax-tags title=syntax-tags>Tags</dfn> are used to delimit the start
+ and end of elements in the markup. <a href=#raw-text-elements title="raw text
+ elements">Raw text</a>, <a href=#rcdata-elements title="RCDATA
+ elements">RCDATA</a>, and <a href=#normal-elements title="normal
+ elements">normal</a> elements have a <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> to indicate where they
+ begin, and an <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> to
+ indicate where they end. The start and end tags of certain
+ <a href=#normal-elements>normal elements</a> can be <a href=#syntax-tag-omission title=syntax-tag-omission>omitted</a>, as described
+ later. Those that cannot be omitted must not be omitted. <a href=#void-elements>Void
+ elements</a> only have a start tag; end tags must not be
+ specified for <a href=#void-elements>void elements</a>. <a href=#foreign-elements>Foreign
+ elements</a> must either have a start tag and an end tag, or a
+ start tag that is marked as self-closing, in which case they must
+ not have an end tag.</p>
+
+ <p>The contents of the element must be placed between just after the
+ start tag (which <a href=#syntax-tag-omission title=syntax-tag-omission>might be implied,
+ in certain cases</a>) and just before the end tag (which again,
+ <a href=#syntax-tag-omission title=syntax-tag-omission>might be implied in certain
+ cases</a>). The exact allowed contents of each individual element
+ depends on the content model of that element, as described earlier
+ in this specification. Elements must not contain content that their
+ content model disallows. In addition to the restrictions placed on
+ the contents by those content models, however, the five types of
+ elements have additional <em>syntactic</em> requirements.</p>
+
+ <p><a href=#void-elements>Void elements</a> can't have any contents (since there's
+ no end tag, no content can be put between the start tag and the end
+ tag).</p>
+
+ <p><a href=#raw-text-elements>Raw text elements</a> can have <a href=#syntax-text title=syntax-text>text</a>, though it has <a href=#cdata-rcdata-restrictions>restrictions</a> described
+ below.</p>
+
+ <p><a href=#rcdata-elements>RCDATA elements</a> can have <a href=#syntax-text title=syntax-text>text</a> and <a href=#syntax-charref title=syntax-charref>character references</a>, but the text
+ must not contain an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>.
+ There are also <a href=#cdata-rcdata-restrictions>further
+ restrictions</a> described below.</p>
+
+ <p><a href=#foreign-elements>Foreign elements</a> whose start tag is marked as
+ self-closing can't have any contents (since, again, as there's no
+ end tag, no content can be put between the start tag and the end
+ tag). <a href=#foreign-elements>Foreign elements</a> whose start tag is <em>not</em>
+ marked as self-closing can have <a href=#syntax-text title=syntax-text>text</a>, <a href=#syntax-charref title=syntax-charref>character references</a>, <a href=#syntax-cdata title=syntax-cdata>CDATA sections</a>, other <a href=#syntax-elements title=syntax-elements>elements</a>, and <a href=#syntax-comments title=syntax-comments>comments</a>, but the text must not
+ contain the character U+003C LESS-THAN SIGN (&lt;) or an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>.</p>
+
+ <div class=note>
+
+ <p>The HTML syntax does not support namespace
+ declarations, even in <a href=#foreign-elements>foreign elements</a>.</p>
+
+ <p>For instance, consider the following HTML fragment:</p>
+
+ <pre>&lt;p&gt;
+ &lt;svg&gt;
+ &lt;metadata&gt;
+ &lt;!-- this is invalid --&gt;
+ &lt;cdr:license xmlns:cdr="http://www.example.com/cdr/metadata" name="MIT"/&gt;
+ &lt;/metadata&gt;
+ &lt;/svg&gt;
+&lt;/p&gt;</pre>
+
+ <p>The innermost element, <code title="">cdr:license</code>, is
+ actually in the SVG namespace, as the "<code title="">xmlns:cdr</code>" attribute has no effect (unlike in
+ XML). In fact, as the comment in the fragment above says, the
+ fragment is actually non-conforming. This is because the SVG
+ specification does not define any elements called "<code title="">cdr:license</code>" in the SVG namespace.</p>
+
+ </div>
+
+ <p><a href=#normal-elements>Normal elements</a> can have <a href=#syntax-text title=syntax-text>text</a>, <a href=#syntax-charref title=syntax-charref>character references</a>, other <a href=#syntax-elements title=syntax-elements>elements</a>, and <a href=#syntax-comments title=syntax-comments>comments</a>, but the text must not
+ contain the character U+003C LESS-THAN SIGN (&lt;) or an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>. Some
+ <a href=#normal-elements>normal elements</a> also have <a href=#element-restrictions>yet more restrictions</a> on what
+ content they are allowed to hold, beyond the restrictions imposed by
+ the content model and those described in this paragraph. Those
+ restrictions are described below.</p>
+
+ <p>Tags contain a <dfn id=syntax-tag-name title=syntax-tag-name>tag name</dfn>,
+ giving the element's name. HTML elements all have names that only
+ use characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9), U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER
+ Z, and U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER
+ Z. In the HTML syntax, tag names, even those for <a href=#foreign-elements>foreign
+ elements</a>, may be written with any mix of lower- and uppercase
+ letters that, when converted to all-lowercase, matches the element's
+ tag name; tag names are case-insensitive.</p>
+
+
+ <h5 id=start-tags><span class=secno>10.1.2.1 </span>Start tags</h5>
+
+ <p><dfn id=syntax-start-tag title=syntax-start-tag>Start tags</dfn> must have the
+ following format:</p>
+
+ <ol><li>The first character of a start tag must be a U+003C LESS-THAN
+ SIGN character (&lt;).</li>
+
+ <li>The next few characters of a start tag must be the element's
+ <a href=#syntax-tag-name title=syntax-tag-name>tag name</a>.</li>
+
+ <li>If there are to be any attributes in the next step, there must
+ first be one or more <a href=#space-character title="space character">space
+ characters</a>.</li>
+
+ <li>Then, the start tag may have a number of attributes, the <a href=#syntax-attributes title=syntax-attributes>syntax for which</a> is described
+ below. Attributes may be separated from each other by one or more
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li>After the attributes, or after the <a href=#syntax-tag-name title=syntax-tag-name>tag name</a> if there are no attributes,
+ there may be one or more <a href=#space-character title="space character">space
+ characters</a>. (Some attributes are required to be followed by
+ a space. See the <a href=#syntax-attributes title=syntax-attributes>attributes
+ section</a> below.)</li>
+
+ <li>Then, if the element is one of the <a href=#void-elements>void elements</a>,
+ or if the element is a <a href=#foreign-elements title="foreign elements">foreign
+ element</a>, then there may be a single U+002F SOLIDUS character
+ (/). This character has no effect on <a href=#void-elements>void elements</a>,
+ but on <a href=#foreign-elements>foreign elements</a> it marks the start tag as
+ self-closing.</li>
+
+ <li>Finally, start tags must be closed by a U+003E GREATER-THAN
+ SIGN character (&gt;).</li>
+
+ </ol><h5 id=end-tags><span class=secno>10.1.2.2 </span>End tags</h5>
+
+ <p><dfn id=syntax-end-tag title=syntax-end-tag>End tags</dfn> must have the
+ following format:</p>
+
+ <ol><li>The first character of an end tag must be a U+003C LESS-THAN
+ SIGN character (&lt;).</li>
+
+ <li>The second character of an end tag must be a U+002F SOLIDUS
+ character (/).</li>
+
+ <li>The next few characters of an end tag must be the element's
+ <a href=#syntax-tag-name title=syntax-tag-name>tag name</a>.</li>
+
+ <li>After the tag name, there may be one or more <a href=#space-character title="space
+ character">space characters</a>.</li>
+
+ <li>Finally, end tags must be closed by a U+003E GREATER-THAN SIGN
+ character (&gt;).</li>
+
+ </ol><h5 id=attributes-0><span class=secno>10.1.2.3 </span>Attributes</h5>
+
+ <p><dfn id=syntax-attributes title=syntax-attributes>Attributes</dfn> for an element
+ are expressed inside the element's start tag.</p>
+
+ <p>Attributes have a name and a value. <dfn id=syntax-attribute-name title=syntax-attribute-name>Attribute names</dfn> must consist of
+ one or more characters other than the <a href=#space-character title="space
+ character">space characters</a>, U+0000 NULL, U+0022 QUOTATION
+ MARK ("), U+0027 APOSTROPHE ('), U+003E GREATER-THAN SIGN
+ (&gt;), U+002F SOLIDUS (/), and U+003D EQUALS SIGN (=) characters,
+ the control characters, and any characters that are not defined by
+ Unicode. In the HTML syntax, attribute names, even those for
+ <a href=#foreign-elements>foreign elements</a>, may be written with any mix of lower-
+ and uppercase letters that are an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the attribute's name.</p>
+
+ <p><dfn id=syntax-attribute-value title=syntax-attribute-value>Attribute values</dfn> are a
+ mixture of <a href=#syntax-text title=syntax-text>text</a> and <a href=#syntax-charref title=syntax-charref>character references</a>, except with the
+ additional restriction that the text cannot contain an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>.</p>
+
+ <p>Attributes can be specified in four different ways:</p>
+
+ <dl><dt>Empty attribute syntax</dt>
+
+ <dd>
+
+ <p>Just the <a href=#syntax-attribute-name title=syntax-attribute-name>attribute
+ name</a>. The value is implicitly the empty string.</p>
+
+ <div class=example>
+
+ <p>In the following example, the <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is given with
+ the empty attribute syntax:</p>
+
+ <pre>&lt;input <em>disabled</em>&gt;</pre>
+
+ </div>
+
+ <p>If an attribute using the empty attribute syntax is to be
+ followed by another attribute, then there must be a <a href=#space-character>space
+ character</a> separating the two.</p>
+
+ </dd>
+
+ <dt id=unquoted>Unquoted attribute value syntax</dt>
+
+ <dd>
+
+ <p>The <a href=#syntax-attribute-name title=syntax-attribute-name>attribute name</a>,
+ followed by zero or more <a href=#space-character title="space character">space
+ characters</a>, followed by a single U+003D EQUALS SIGN
+ character, followed by zero or more <a href=#space-character title="space
+ character">space characters</a>, followed by the <a href=#syntax-attribute-value title=syntax-attribute-value>attribute value</a>, which, in
+ addition to the requirements given above for attribute values,
+ must not contain any literal <a href=#space-character title="space character">space
+ characters</a>, any U+0022 QUOTATION MARK characters ("),
+ U+0027 APOSTROPHE characters ('), U+003D EQUALS SIGN
+ characters (=), U+003C LESS-THAN SIGN characters (&lt;), U+003E
+ GREATER-THAN SIGN characters (&gt;), or U+0060 GRAVE ACCENT
+ characters (`), and must not be the empty string.</p>
+
+ <!-- The ` character is in this list on a temporary basis, waiting
+ for IE to fix it's parsing bug whereby it treats ` as an
+ attribute value delimiter. Otherwise, escaping software that
+ tries to be clever and not use quotes when it doesn't need to
+ could be tricked by an attacker.
+
+ Posit a site that allows the user to input text that is used
+ verbatim in two attributes, such that the user can set the
+ first attribute's value to:
+
+ `
+
+ ...and the second to:
+
+ ` onload='...payload...' end=x
+
+ ...with the assumption that the site is going to not quote
+ the first one, and quote the second one with double quotes:
+
+ <body title=` class="` onload='...payload...' end=x">
+
+ In IE, this is treated as:
+
+ <body title=' class="'
+ onload='...payload...'
+ end='x"'>
+
+ -->
+
+
+ <div class=example>
+
+ <p>In the following example, the <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute is given
+ with the unquoted attribute value syntax:</p>
+
+ <pre>&lt;input <em>value=yes</em>&gt;</pre>
+
+ </div>
+
+ <p>If an attribute using the unquoted attribute syntax is to be
+ followed by another attribute or by the optional U+002F SOLIDUS
+ character (/) allowed in step 6 of the <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> syntax above, then there
+ must be a <a href=#space-character>space character</a> separating the two.</p>
+
+ </dd>
+
+ <dt>Single-quoted attribute value syntax</dt>
+
+ <dd>
+
+ <p>The <a href=#syntax-attribute-name title=syntax-attribute-name>attribute name</a>,
+ followed by zero or more <a href=#space-character title="space character">space
+ characters</a>, followed by a single U+003D EQUALS SIGN
+ character, followed by zero or more <a href=#space-character title="space
+ character">space characters</a>, followed by a single U+0027
+ APOSTROPHE character ('), followed by the <a href=#syntax-attribute-value title=syntax-attribute-value>attribute value</a>, which, in
+ addition to the requirements given above for attribute values,
+ must not contain any literal U+0027 APOSTROPHE characters ('), and
+ finally followed by a second single U+0027 APOSTROPHE character
+ (').</p>
+
+ <div class=example>
+
+ <p>In the following example, the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is given with the
+ single-quoted attribute value syntax:</p>
+
+ <pre>&lt;input <em>type='checkbox'</em>&gt;</pre>
+
+ </div>
+
+ <p>If an attribute using the single-quoted attribute syntax is to
+ be followed by another attribute, then there must be a <a href=#space-character>space
+ character</a> separating the two.</p>
+
+ </dd>
+
+ <dt>Double-quoted attribute value syntax</dt>
+
+ <dd>
+
+ <p>The <a href=#syntax-attribute-name title=syntax-attribute-name>attribute name</a>,
+ followed by zero or more <a href=#space-character title="space character">space
+ characters</a>, followed by a single U+003D EQUALS SIGN
+ character, followed by zero or more <a href=#space-character title="space
+ character">space characters</a>, followed by a single U+0022
+ QUOTATION MARK character ("), followed by the <a href=#syntax-attribute-value title=syntax-attribute-value>attribute value</a>, which, in
+ addition to the requirements given above for attribute values,
+ must not contain any literal U+0022 QUOTATION MARK characters ("),
+ and finally followed by a second single U+0022 QUOTATION MARK
+ character (").</p>
+
+ <div class=example>
+
+ <p>In the following example, the <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is given with the
+ double-quoted attribute value syntax:</p>
+
+ <pre>&lt;input <em>name="be evil"</em>&gt;</pre>
+
+ </div>
+
+ <p>If an attribute using the double-quoted attribute syntax is to
+ be followed by another attribute, then there must be a <a href=#space-character>space
+ character</a> separating the two.</p>
+
+ </dd>
+
+ </dl><p>There must never be two or more attributes on the same start tag
+ whose names are an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
+ each other.</p>
+
+ <hr><p>When a <a href=#foreign-elements title="foreign elements">foreign element</a> has
+ one of the namespaced attributes given by the local name and
+ namespace of the first and second cells of a row from the following
+ table, it must be written using the name given by the third cell
+ from the same row.</p>
+
+ <table><thead><tr><th> Local name <th> Namespace <th> Attribute name
+ <tbody><tr><td> <code title="">actuate</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:actuate</code>
+ <tr><td> <code title="">arcrole</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:arcrole</code>
+ <tr><td> <code title="">href</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:href</code>
+ <tr><td> <code title="">role</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:role</code>
+ <tr><td> <code title="">show</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:show</code>
+ <tr><td> <code title="">title</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:title</code>
+ <tr><td> <code title="">type</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:type</code>
+ <tr><td> <code title="">base</code> <td> <a href=#xml-namespace>XML namespace</a> <!-- attr-xml-base --> <td> <code title="">xml:base</code>
+ <tr><td> <code title="">lang</code> <td> <a href=#xml-namespace>XML namespace</a> <td> <code title="">xml:lang</code>
+ <tr><td> <code title="">space</code> <td> <a href=#xml-namespace>XML namespace</a> <td> <code title="">xml:space</code>
+ <tr><td> <code title="">xmlns</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a> <td> <code title="">xmlns</code>
+ <tr><td> <code title="">xlink</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a> <td> <code title="">xmlns:xlink</code>
+ </table><p>No other namespaced attribute can be expressed in <a href=#syntax>the
+ HTML syntax</a>.</p>
+
+
+ <h5 id=optional-tags><span class=secno>10.1.2.4 </span>Optional tags</h5>
+
+ <p>Certain tags can be <dfn id=syntax-tag-omission title=syntax-tag-omission>omitted</dfn>.</p>
+
+ <p class=note>Omitting an element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> does not mean the element
+ is not present; it is implied, but it is still there. An HTML
+ document always has a root <code><a href=#the-html-element-0>html</a></code> element, even if the
+ string <code title="">&lt;html&gt;</code> doesn't appear anywhere in
+ the markup.</p>
+
+ <!-- <html> -->
+ <p>An <code><a href=#the-html-element-0>html</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted if the
+ first thing inside the <code><a href=#the-html-element-0>html</a></code> element is not a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>
+
+ <!-- </html> -->
+ <p>An <code><a href=#the-html-element-0>html</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-html-element-0>html</a></code> element is not
+ immediately followed by a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>
+
+ <!-- <head> -->
+ <p>A <code><a href=#the-head-element-0>head</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted if the
+ element is empty, or if the first thing inside the
+ <code><a href=#the-head-element-0>head</a></code> element is an element.</p>
+
+ <!-- </head> -->
+ <p>A <code><a href=#the-head-element-0>head</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-head-element-0>head</a></code> element is not
+ immediately followed by a <a href=#space-character>space character</a> or a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>
+
+ <!-- <body> -->
+ <p>A <code><a href=#the-body-element-0>body</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted if the
+ element is empty, or if the first thing inside the <code><a href=#the-body-element-0>body</a></code>
+ element is not a <a href=#space-character>space character</a> or a <a href=#syntax-comments title=syntax-comments>comment</a>, except if the first thing
+ inside the <code><a href=#the-body-element-0>body</a></code> element is a <code><a href=#script>script</a></code> or
+ <code><a href=#the-style-element>style</a></code> element. <!-- Note that even if the </head> end
+ tag is present, the parser makes <style> and <script> elements
+ between </head> and <body> end up in the <head> instead of implying
+ the <body> --></p>
+
+ <!-- </body> -->
+ <p>A <code><a href=#the-body-element-0>body</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-body-element-0>body</a></code> element is not
+ immediately followed by a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>
+
+ <!-- </li> -->
+ <p>A <code><a href=#the-li-element>li</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-li-element>li</a></code> element is
+ immediately followed by another <code><a href=#the-li-element>li</a></code> element or if there
+ is no more content in the parent element.</p>
+
+ <!-- </dt> -->
+ <p>A <code><a href=#the-dt-element>dt</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-dt-element>dt</a></code> element is
+ immediately followed by another <code><a href=#the-dt-element>dt</a></code> element or a
+ <code><a href=#the-dd-element>dd</a></code> element.</p>
+
+ <!-- </dd> -->
+ <p>A <code><a href=#the-dd-element>dd</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-dd-element>dd</a></code> element is
+ immediately followed by another <code><a href=#the-dd-element>dd</a></code> element or a
+ <code><a href=#the-dt-element>dt</a></code> element, or if there is no more content in the
+ parent element.</p>
+
+ <!-- </p> -->
+ <p>A <code><a href=#the-p-element>p</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-p-element>p</a></code> element is
+ immediately followed by an <code><a href=#the-address-element>address</a></code>,
+ <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-blockquote-element>blockquote</a></code>,
+ <!--v2DATAGRID <code>datagrid</code>,--> <code><a href=#dir>dir</a></code>,
+ <code><a href=#the-div-element>div</a></code>, <code><a href=#the-dl-element>dl</a></code>, <code><a href=#the-fieldset-element>fieldset</a></code>,
+ <code><a href=#the-footer-element>footer</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>,
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>,
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code><a href=#the-header-element>header</a></code>, <code><a href=#the-hgroup-element>hgroup</a></code>,
+ <code><a href=#the-hr-element>hr</a></code>, <code><a href=#menus>menu</a></code>, <code><a href=#the-nav-element>nav</a></code>,
+ <code><a href=#the-ol-element>ol</a></code>, <code><a href=#the-p-element>p</a></code>, <code><a href=#the-pre-element>pre</a></code>,
+ <code><a href=#the-section-element>section</a></code>, <code><a href=#the-table-element>table</a></code>, or <code><a href=#the-ul-element>ul</a></code>,
+ element, or if there is no more content in the parent element and
+ the parent element is not an <code><a href=#the-a-element>a</a></code> element.</p>
+
+ <!-- </rt> -->
+ <p>An <code><a href=#the-rt-element>rt</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-rt-element>rt</a></code> element is
+ immediately followed by an <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code>
+ element, or if there is no more content in the parent element.</p>
+
+ <!-- </rp> -->
+ <p>An <code><a href=#the-rp-element>rp</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-rp-element>rp</a></code> element is
+ immediately followed by an <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code>
+ element, or if there is no more content in the parent element.</p>
+
+ <!-- </optgroup> (the text assumes <optgroup> can only be inside a
+ <select>; commented out text below can handle the non-<select> case
+ if we ever allow it) -->
+ <p>An <code><a href=#the-optgroup-element>optgroup</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
+ <code><a href=#the-optgroup-element>optgroup</a></code> element <!--has an ancestor
+ <code>select</code> element and--> is immediately followed by
+ another <code><a href=#the-optgroup-element>optgroup</a></code> element, or if <!--all of the elements
+ that are ancestors of the <code>optgroup</code> element, up to and
+ including the first ancestor element that is not an
+ <code>optgroup</code> element, have no more content--> there is no
+ more content in the parent element.</p>
+ <!-- so e.g. the max number of </optgroup>s are omitted here:
+ <select><optgroup></select>
+ <p id=x><optgroup></optgroup>x</p>
+ <p id=x><optgroup><optgroup></optgroup></optgroup>x</p>
+ <p><optgroup id=x><optgroup></optgroup>x</p>
+ <p><optgroup><optgroup id=x>x</p>
+ -->
+
+ <!-- </option> -->
+ <p>An <code><a href=#the-option-element>option</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-option-element>option</a></code> element is
+ immediately followed by another <code><a href=#the-option-element>option</a></code> element, or if
+ it is immediately followed by an <code><a href=#the-optgroup-element>optgroup</a></code> element, or
+ if there is no more content in the parent element.</p>
+
+ <!-- <colgroup> -->
+ <p>A <code><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted if the
+ first thing inside the <code><a href=#the-colgroup-element>colgroup</a></code> element is a
+ <code><a href=#the-col-element>col</a></code> element, and if the element is not immediately
+ preceded by another <code><a href=#the-colgroup-element>colgroup</a></code> element whose <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> has been omitted. (It can't be
+ omitted if the element is empty.)</p>
+
+ <!-- </colgroup> -->
+ <p>A <code><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
+ <code><a href=#the-colgroup-element>colgroup</a></code> element is not immediately followed by a
+ <a href=#space-character>space character</a> or a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>
+
+ <!-- </thead> -->
+ <p>A <code><a href=#the-thead-element>thead</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-thead-element>thead</a></code> element is
+ immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> or <code><a href=#the-tfoot-element>tfoot</a></code>
+ element.</p>
+
+ <!-- <tbody> -->
+ <p>A <code><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted if the
+ first thing inside the <code><a href=#the-tbody-element>tbody</a></code> element is a
+ <code><a href=#the-tr-element>tr</a></code> element, and if the element is not immediately
+ preceded by a <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, or
+ <code><a href=#the-tfoot-element>tfoot</a></code> element whose <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> has been omitted. (It can't be omitted if the element is
+ empty.)</p>
+
+ <!-- </tbody> -->
+ <p>A <code><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-tbody-element>tbody</a></code> element is
+ immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> or <code><a href=#the-tfoot-element>tfoot</a></code>
+ element, or if there is no more content in the parent element.</p>
+
+ <!-- </tfoot> -->
+ <p>A <code><a href=#the-tfoot-element>tfoot</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-tfoot-element>tfoot</a></code> element is
+ immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> element, or if there is
+ no more content in the parent element.</p>
+
+ <!-- </tr> -->
+ <p>A <code><a href=#the-tr-element>tr</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-tr-element>tr</a></code> element is
+ immediately followed by another <code><a href=#the-tr-element>tr</a></code> element, or if there
+ is no more content in the parent element.</p>
+
+ <!-- </td> -->
+ <p>A <code><a href=#the-td-element>td</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-td-element>td</a></code> element is
+ immediately followed by a <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code>
+ element, or if there is no more content in the parent element.</p>
+
+ <!-- </th> -->
+ <p>A <code><a href=#the-th-element>th</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end
+ tag</a> may be omitted if the <code><a href=#the-th-element>th</a></code> element is
+ immediately followed by a <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code>
+ element, or if there is no more content in the parent element.</p>
+
+ <p><strong>However</strong>, a <a href=#syntax-start-tag title=syntax-start-tag>start
+ tag</a> must never be omitted if it has any attributes.</p>
+
+
+ <h5 id=element-restrictions><span class=secno>10.1.2.5 </span>Restrictions on content models</h5>
+
+ <p>For historical reasons, certain elements have extra restrictions
+ beyond even the restrictions given by their content model.</p>
+
+ <p>A <code><a href=#the-table-element>table</a></code> element must not contain <code><a href=#the-tr-element>tr</a></code>
+ elements, even though these elements are technically allowed inside
+ <code><a href=#the-table-element>table</a></code> elements according to the content models
+ described in this specification. (If a <code><a href=#the-tr-element>tr</a></code> element is
+ put inside a <code><a href=#the-table-element>table</a></code> in the markup, it will in fact imply
+ a <code><a href=#the-tbody-element>tbody</a></code> start tag before it.)</p>
+
+ <p>A single <a href=#syntax-newlines title=syntax-newlines>newline</a> may be
+ placed immediately after the <a href=#syntax-start-tag title=syntax-start-tag>start
+ tag</a> of <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-textarea-element>textarea</a></code>
+ elements. This does not affect the processing of the element. The
+ otherwise optional <a href=#syntax-newlines title=syntax-newlines>newline</a>
+ <em>must</em> be included if the element's contents themselves start
+ with a <a href=#syntax-newlines title=syntax-newlines>newline</a> (because
+ otherwise the leading newline in the contents would be treated like
+ the optional newline, and ignored).</p>
+
+ <div class=example>
+ <p>The following two <code><a href=#the-pre-element>pre</a></code> blocks are equivalent:</p>
+ <pre>&lt;pre&gt;Hello&lt;/pre&gt;</pre>
+ <pre>&lt;pre&gt;<br>Hello&lt;/pre&gt;</pre>
+ </div>
+
+
+ <h5 id=cdata-rcdata-restrictions><span class=secno>10.1.2.6 </span>Restrictions on the contents of raw text and RCDATA elements</h5>
+
+ <p>The text in <a href=#raw-text-elements title="raw text elements">raw text</a> and
+ <a href=#rcdata-elements>RCDATA elements</a> must not contain any occurrences of the
+ string "<code title="">&lt;/</code>" (U+003C LESS-THAN SIGN, U+002F
+ SOLIDUS) followed by characters that case-insensitively match the
+ tag name of the element followed by one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D
+ CARRIAGE RETURN (CR), U+0020 SPACE, U+003E GREATER-THAN SIGN (&gt;), or
+ U+002F SOLIDUS (/).</p>
+
+
+ <h4 id=text-1><span class=secno>10.1.3 </span>Text</h4>
+
+ <p><dfn id=syntax-text title=syntax-text>Text</dfn> is allowed inside elements,
+ attributes, and comments. Text must consist of Unicode characters.
+ Text must not contain U+0000 characters. Text must not contain
+ permanently undefined Unicode characters (noncharacters). Text must
+ not contain control characters other than <a href=#space-character title="space
+ character">space characters</a>. Extra constraints are placed on
+ what is and what is not allowed in text based on where the text is
+ to be put, as described in the other sections.</p>
+
+
+ <h5 id=newlines><span class=secno>10.1.3.1 </span>Newlines</h5>
+
+ <p><dfn id=syntax-newlines title=syntax-newlines>Newlines</dfn> in HTML may be
+ represented either as U+000D CARRIAGE RETURN (CR) characters, U+000A
+ LINE FEED (LF) characters, or pairs of U+000D CARRIAGE RETURN (CR),
+ U+000A LINE FEED (LF) characters in that order.</p>
+
+ <p>Where <a href=#syntax-charref title=syntax-charref>character references</a>
+ are allowed, a character reference of a U+000A LINE FEED (LF)
+ character (but not a U+000D CARRIAGE RETURN (CR) character) also
+ represents a <a href=#syntax-newlines title=syntax-newlines>newline</a>.</p>
+
+
+ <h4 id=character-references><span class=secno>10.1.4 </span>Character references</h4>
+
+ <p>In certain cases described in other sections, <a href=#syntax-text title=syntax-text>text</a> may be mixed with <dfn id=syntax-charref title=syntax-charref>character references</dfn>. These can be used
+ to escape characters that couldn't otherwise legally be included in
+ <a href=#syntax-text title=syntax-text>text</a>.</p>
+
+ <p>Character references must start with a U+0026 AMPERSAND character
+ (&amp;). Following this, there are three possible kinds of character
+ references:</p>
+
+ <dl><dt>Named character references</dt>
+
+ <dd>The ampersand must be followed by one of the names given in the
+ <a href=#named-character-references>named character references</a> section, using the same
+ case. <span class=impl>The name must be one that is terminated by
+ a U+003B SEMICOLON character (;).</span></dd>
+
+
+ <dt>Decimal numeric character reference</dt>
+
+ <dd>The ampersand must be followed by a U+0023 NUMBER SIGN
+ character (#), followed by one or more digits in the range U+0030
+ DIGIT ZERO (0) to U+0039 DIGIT NINE (9), representing a base-ten
+ integer that corresponds to a Unicode code point that is allowed
+ according to the definition below. The digits must then be followed
+ by a U+003B SEMICOLON character (;).</dd>
+
+
+ <dt>Hexadecimal numeric character reference</dt>
+
+ <dd>The ampersand must be followed by a U+0023 NUMBER SIGN
+ character (#), which must be followed by either a U+0078 LATIN
+ SMALL LETTER X character (x) or a U+0058 LATIN CAPITAL LETTER X
+ character (X), which must then be followed by one or more digits in
+ the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0061
+ LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F, and U+0041
+ LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F,
+ representing a base-sixteen integer that corresponds to a Unicode
+ code point that is allowed according to the definition below. The
+ digits must then be followed by a U+003B SEMICOLON character
+ (;).</dd>
+
+ </dl><p>The numeric character reference forms described above are allowed
+ to reference any Unicode code point other than U+0000, U+000D,
+ permanently undefined Unicode characters (noncharacters), and
+ control characters other than <a href=#space-character title="space character">space
+ characters</a>.</p>
+
+ <p>An <dfn id=syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous
+ ampersand</dfn> is a U+0026 AMPERSAND character (&amp;) that is
+ followed by one or more characters in the range U+0030 DIGIT ZERO
+ (0) to U+0039 DIGIT NINE (9), U+0061 LATIN SMALL LETTER A to U+007A
+ LATIN SMALL LETTER Z, and U+0041 LATIN CAPITAL LETTER A to U+005A
+ LATIN CAPITAL LETTER Z, followed by a U+003B SEMICOLON character
+ (;), where these characters do not match any of the names given in
+ the <a href=#named-character-references>named character references</a> section.</p>
+
+
+ <h4 id=cdata-sections><span class=secno>10.1.5 </span>CDATA sections</h4>
+
+ <p><dfn id=syntax-cdata title=syntax-cdata>CDATA sections</dfn> must start with
+ the character sequence U+003C LESS-THAN SIGN, U+0021 EXCLAMATION
+ MARK, U+005B LEFT SQUARE BRACKET, U+0043 LATIN CAPITAL LETTER C,
+ U+0044 LATIN CAPITAL LETTER D, U+0041 LATIN CAPITAL LETTER A, U+0054
+ LATIN CAPITAL LETTER T, U+0041 LATIN CAPITAL LETTER A, U+005B LEFT
+ SQUARE BRACKET (<code title="">&lt;![CDATA[</code>). Following this
+ sequence, the CDATA section may have <a href=#syntax-text title=syntax-text>text</a>, with the additional restriction
+ that the text must not contain the three character sequence U+005D
+ RIGHT SQUARE BRACKET, U+005D RIGHT SQUARE BRACKET, U+003E
+ GREATER-THAN SIGN (<code title="">]]&gt;</code>). Finally, the CDATA
+ section must be ended by the three character sequence U+005D RIGHT
+ SQUARE BRACKET, U+005D RIGHT SQUARE BRACKET, U+003E GREATER-THAN
+ SIGN (<code title="">]]&gt;</code>).</p>
+
+ <div class=example>
+
+ <p>CDATA sections can only be used in foreign content (MathML or
+ SVG). In this example, a CDATA section is used to escape the
+ contents of an <code>ms</code> element:</p>
+
+ <pre>&lt;p&gt;You can add a string to a number, but this stringifies the number:&lt;/p&gt;
+&lt;math&gt;
+ &lt;ms&gt;&lt;![CDATA[x&lt;y]]&gt;&lt;/ms&gt;
+ &lt;mo&gt;+&lt;/mo&gt;
+ &lt;mn&gt;3&lt;/mn&gt;
+ &lt;mo&gt;=&lt;/mo&gt;
+ &lt;ms&gt;&lt;![CDATA[x&lt;y3]]&gt;&lt;/ms&gt;
+&lt;/math&gt;</pre>
+
+ </div>
+
+
+ <h4 id=comments><span class=secno>10.1.6 </span>Comments</h4>
+
+ <p><dfn id=syntax-comments title=syntax-comments>Comments</dfn> must start with the
+ four character sequence U+003C LESS-THAN SIGN, U+0021 EXCLAMATION
+ MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS (<code title="">&lt;!--</code>). Following this sequence, the comment may
+ have <a href=#syntax-text title=syntax-text>text</a>, with the additional
+ restriction that the text must not start with a single U+003E
+ GREATER-THAN SIGN character (&gt;), nor start with a U+002D
+ HYPHEN-MINUS character (-) followed by a U+003E GREATER-THAN SIGN
+ (&gt;) character, nor contain two consecutive U+002D HYPHEN-MINUS
+ characters (<code title="">--</code>), nor end with a U+002D
+ HYPHEN-MINUS character (-). Finally, the comment must be ended by
+ the three character sequence U+002D HYPHEN-MINUS, U+002D
+ HYPHEN-MINUS, U+003E GREATER-THAN SIGN (<code title="">--&gt;</code>).</p>
+
+
+ <div class=impl>
+
+ <h3 id=parsing><span class=secno>10.2 </span>Parsing HTML documents</h3>
+
+ <p><i>This section only applies to user agents, data mining tools,
+ and conformance checkers.</i></p>
+
+ <p class=note>The rules for parsing XML documents into DOM trees
+ are covered by the next section, entitled "<a href=#the-xhtml-syntax>The XHTML
+ syntax</a>".</p>
+
+ <p>For <a href=#html-documents>HTML documents</a>, user agents must use the parsing
+ rules described in this section to generate the DOM trees. Together,
+ these rules define what is referred to as the <dfn id=html-parser>HTML
+ parser</dfn>.</p>
+
+ <div class=note>
+
+ <p>While the HTML syntax described in this specification bears a
+ close resemblance to SGML and XML, it is a separate language with
+ its own parsing rules.</p>
+
+ <p>Some earlier versions of HTML (in particular from HTML2 to
+ HTML4) were based on SGML and used SGML parsing rules. However, few
+ (if any) web browsers ever implemented true SGML parsing for HTML
+ documents; the only user agents to strictly handle HTML as an SGML
+ application have historically been validators. The resulting
+ confusion &mdash; with validators claiming documents to have one
+ representation while widely deployed Web browsers interoperably
+ implemented a different representation &mdash; has wasted decades
+ of productivity. This version of HTML thus returns to a non-SGML
+ basis.</p>
+
+ <p>Authors interested in using SGML tools in their authoring
+ pipeline are encouraged to use XML tools and the XML serialization
+ of HTML.</p>
+
+ </div>
+
+ <p>This specification defines the parsing rules for HTML documents,
+ whether they are syntactically correct or not. Certain points in the
+ parsing algorithm are said to be <dfn id=parse-error title="parse error">parse
+ errors</dfn>. The error handling for parse errors is well-defined:
+ user agents must either act as described below when encountering
+ such problems, or must abort processing at the first error that they
+ encounter for which they do not wish to apply the rules described
+ below.</p>
+
+ <p>Conformance checkers must report at least one parse error
+ condition to the user if one or more parse error conditions exist in
+ the document and must not report parse error conditions if none
+ exist in the document. Conformance checkers may report more than one
+ parse error condition if more than one parse error condition exists
+ in the document. Conformance checkers are not required to recover
+ from parse errors.</p>
+
+ <p class=note>Parse errors are only errors with the
+ <em>syntax</em> of HTML. In addition to checking for parse errors,
+ conformance checkers will also verify that the document obeys all
+ the other conformance requirements described in this
+ specification.</p>
+
+ <p>For the purposes of conformance checkers, if a resource is
+ determined to be in <a href=#syntax>the HTML syntax</a>, then it is an
+ <a href=#html-documents title="HTML documents">HTML document</a>.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=overview-of-the-parsing-model><span class=secno>10.2.1 </span>Overview of the parsing model</h4>
+
+ <p>The input to the HTML parsing process consists of a stream of
+ Unicode characters, which is passed through a
+ <a href=#tokenization>tokenization</a> stage followed by a <a href=#tree-construction>tree
+ construction</a> stage. The output is a <code><a href=#document>Document</a></code>
+ object.</p>
+
+ <p class=note>Implementations that <a href=#non-scripted>do not
+ support scripting</a> do not have to actually create a DOM
+ <code><a href=#document>Document</a></code> object, but the DOM tree in such cases is
+ still used as the model for the rest of the specification.</p>
+
+ <p>In the common case, the data handled by the tokenization stage
+ comes from the network, but <a href=#dynamic-markup-insertion title="dynamic markup
+ insertion">it can also come from script</a>, e.g. using the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> API.</p>
+
+ <p><img alt="" src=images/parsing-model-overview.png></p>
+
+ <p id=nestedParsing>There is only one set of states for the
+ tokenizer stage and the tree construction stage, but the tree
+ construction stage is reentrant, meaning that while the tree
+ construction stage is handling one token, the tokenizer might be
+ resumed, causing further tokens to be emitted and processed before
+ the first token's processing is complete.</p>
+
+ <div class=example>
+
+ <p>In the following example, the tree construction stage will be
+ called upon to handle a "p" start tag token while handling the
+ "script" start tag token:</p>
+
+ <pre>...
+&lt;script&gt;
+ document.write('&lt;p&gt;');
+&lt;/script&gt;
+...</pre>
+
+ </div>
+
+ <p>To handle these cases, parsers have a <dfn id=script-nesting-level>script nesting
+ level</dfn>, which must be initially set to zero, and a <dfn id=parser-pause-flag>parser
+ pause flag</dfn>, which must be initially set to false.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-input-stream><span class=secno>10.2.2 </span>The <dfn>input stream</dfn></h4>
+
+ <p>The stream of Unicode characters that comprises the input to the
+ tokenization stage will be initially seen by the user agent as a
+ stream of bytes (typically coming over the network or from the local
+ file system). The bytes encode the actual characters according to a
+ particular <em>character encoding</em>, which the user agent must
+ use to decode the bytes into characters.</p>
+
+ <p class=note>For XML documents, the algorithm user agents must
+ use to determine the character encoding is given by the XML
+ specification. This section does not apply to XML documents. <a href=#refsXML>[XML]</a></p>
+
+
+ <h5 id=determining-the-character-encoding><span class=secno>10.2.2.1 </span>Determining the character encoding</h5>
+
+ <p>In some cases, it might be impractical to unambiguously determine
+ the encoding before parsing the document. Because of this, this
+ specification provides for a two-pass mechanism with an optional
+ pre-scan. Implementations are allowed, as described below, to apply
+ a simplified parsing algorithm to whatever bytes they have available
+ before beginning to parse the document. Then, the real parser is
+ started, using a tentative encoding derived from this pre-parse and
+ other out-of-band metadata. If, while the document is being loaded,
+ the user agent discovers an encoding declaration that conflicts with
+ this information, then the parser can get reinvoked to perform a
+ parse of the document with the real encoding.</p>
+
+ <p id=documentEncoding>User agents must use the following
+ algorithm (the <dfn id=encoding-sniffing-algorithm>encoding sniffing algorithm</dfn>) to determine
+ the character encoding to use when decoding a document in the first
+ pass. This algorithm takes as input any out-of-band metadata
+ available to the user agent (e.g. the <a href=#content-type title=Content-Type>Content-Type metadata</a> of the document)
+ and all the bytes available so far, and returns an encoding and a
+ <dfn id=concept-encoding-confidence title=concept-encoding-confidence>confidence</dfn>. The
+ confidence is either <i>tentative</i>, <i>certain</i>, or
+ <i>irrelevant</i>. The encoding used, and whether the confidence in
+ that encoding is <i>tentative</i> or <i>certain</i>, is <a href=#meta-charset-during-parse>used during the parsing</a> to
+ determine whether to <a href=#change-the-encoding>change the encoding</a>. If no
+ encoding is necessary, e.g. because the parser is operating on a
+ stream of Unicode characters and doesn't have to use an encoding at
+ all, then the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
+ <i>irrelevant</i>.</p>
+
+ <ol><li><p>If the transport layer specifies an encoding, and it is
+ supported, return that encoding with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a>
+ <i>certain</i>, and abort these steps.</li>
+
+ <li><p>The user agent may wait for more bytes of the resource to be
+ available, either in this step or at any later step in this
+ algorithm. For instance, a user agent might wait 500ms or 512
+ bytes, whichever came first. In general preparsing the source to
+ find the encoding improves performance, as it reduces the need to
+ throw away the data structures used when parsing upon finding the
+ encoding information. However, if the user agent delays too long to
+ obtain data to determine the encoding, then the cost of the delay
+ could outweigh any performance improvements from the
+ preparse.</li>
+
+ <li><p>For each of the rows in the following table, starting with
+ the first one and going down, if there are as many or more bytes
+ available than the number of bytes in the first column, and the
+ first bytes of the file match the bytes given in the first column,
+ then return the encoding given in the cell in the second column of
+ that row, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a>
+ <i>certain</i>, and abort these steps:</p>
+
+ <!-- this table is present in several forms in this file; keep them in sync -->
+ <table><thead><tr><th>Bytes in Hexadecimal
+ <th>Encoding
+ <tbody><!-- nobody uses this
+ <tr>
+ <td>00 00 FE FF
+ <td>UTF-32BE
+ <tr>
+ <td>FF FE 00 00
+ <td>UTF-32LE
+--><tr><td>FE FF
+ <td>UTF-16BE
+ <tr><td>FF FE
+ <td>UTF-16LE
+ <tr><td>EF BB BF
+ <td>UTF-8
+<!-- nobody uses this
+ <tr>
+ <td>DD 73 66 73
+ <td>UTF-EBCDIC
+-->
+ </table><p class=note>This step looks for Unicode Byte Order Marks
+ (BOMs).</li>
+
+ <li><p>Otherwise, the user agent will have to search for explicit
+ character encoding information in the file itself. This should
+ proceed as follows:
+
+ <p>Let <var title="">position</var> be a pointer to a byte in the
+ input stream, initially pointing at the first byte. If at any
+ point during these substeps the user agent either runs out of
+ bytes or decides that scanning further bytes would not be
+ efficient, then skip to the next step of the overall character
+ encoding detection algorithm. User agents may decide that scanning
+ <em>any</em> bytes is not efficient, in which case these substeps
+ are entirely skipped.</p>
+
+ <p>Now, repeat the following "two" steps until the algorithm
+ aborts (either because user agent aborts, as described above, or
+ because a character encoding is found):</p>
+
+ <ol><li><p>If <var title="">position</var> points to:</p>
+
+ <dl class=switch><dt>A sequence of bytes starting with: 0x3C 0x21 0x2D 0x2D (ASCII '&lt;!--')</dt>
+ <dd>
+
+ <p>Advance the <var title="">position</var> pointer so that it
+ points at the first 0x3E byte which is preceded by two 0x2D
+ bytes (i.e. at the end of an ASCII '--&gt;' sequence) and comes
+ after the 0x3C byte that was found. (The two 0x2D bytes can be
+ the same as the those in the '&lt;!--' sequence.)</p>
+
+ </dd>
+
+ <dt>A sequence of bytes starting with: 0x3C, 0x4D or 0x6D, 0x45 or 0x65, 0x54 or 0x74, 0x41 or 0x61, and finally one of 0x09, 0x0A, 0x0C, 0x0D, 0x20, 0x2F (case-insensitive ASCII '&lt;meta' followed by a space or slash)</dt>
+ <dd>
+
+ <ol><li><p>Advance the <var title="">position</var> pointer so
+ that it points at the next 0x09, 0x0A, 0x0C, 0x0D, 0x20, or
+ 0x2F byte (the one in sequence of characters matched
+ above).</li>
+
+ <li><p>Let <var title="">attribute list</var> be an empty
+ list of strings.</li> <!-- so long as we only care about
+ http-equiv, content, and charset, this can be a 3-bit
+ bitfield -->
+
+ <li><p>Let <var title="">got pragma</var> be false.</li>
+
+ <li><p>Let <var title="">mode</var> be null.</li>
+
+ <li><p>Let <var title="">charset</var> be the null value
+ (which, for the purposes of this algorithm, is distinct from
+ an unrecognised encoding or the empty string).</li>
+
+ <li><p><i>Attributes</i>: <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>Get an
+ attribute</a> and its value. If no attribute was sniffed,
+ then jump to the <i>processing</i> step below.</li>
+
+ <li><p>If the attribute's name is already in <var title="">attribute list</var>, then return to the step
+ labeled <i>attributes</i>.</p>
+
+ <li>
+
+ <p>Run the appropriate step from the following list, if one
+ applies:</p>
+
+ <dl class=switch><dt>If the attribute's name is "<code title="">http-equiv</code>"</dt>
+
+ <dd><p>If the attribute's value is "<code title="">content-type</code>", then set <var title="">got
+ pragma</var> to true.</dd>
+
+ <dt>If the attribute's name is "<code title="">charset</code>"</dt>
+
+ <dd><p>If <var title="">charset</var> is still set to null,
+ let <var title="">charset</var> be the encoding
+ corresponding to the attribute's value, and set <var title="">mode</var> to "charset".</dd>
+
+ <dt>If the attribute's name is "<code title="">content</code>"</dt>
+
+ <dd><p>Apply the <a href=#algorithm-for-extracting-an-encoding-from-a-content-type>algorithm for extracting an encoding
+ from a Content-Type</a>, giving the attribute's value as
+ the string to parse. If an encoding is returned, and if
+ <var title="">charset</var> is still set to null, let <var title="">charset</var> be the encoding returned, and set
+ <var title="">mode</var> to "pragma".</dd>
+
+ </dl></li>
+
+ <li><p>Return to the step labeled <i>attributes</i>.</li>
+
+ <li><p><i>Processing</i>: If <var title="">mode</var> is
+ null, then jump to the second step of the overall "two step"
+ algorithm.</li>
+
+ <li><p>If <var title="">mode</var> is "pragma" but <var title="">got pragma</var> is false, then jump to the second
+ step of the overall "two step" algorithm.</li>
+
+ <li><p>If <var title="">charset</var> is a UTF-16 encoding,
+ change the value of <var title="">charset</var> to
+ UTF-8.</li>
+
+ <li><p>If <var title="">charset</var> is not a supported
+ character encoding, then jump to the second step of the
+ overall "two step" algorithm.</li>
+
+ <li><p>Return the encoding given by <var title="">charset</var>, with <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a>
+ <i>tentative</i>, and abort all these steps.</li>
+
+ </ol></dd>
+
+ <dt>A sequence of bytes starting with a 0x3C byte (ASCII &lt;), optionally a 0x2F byte (ASCII /), and finally a byte in the range 0x41-0x5A or 0x61-0x7A (an ASCII letter)</dt>
+ <dd>
+
+ <ol><li><p>Advance the <var title="">position</var> pointer so
+ that it points at the next 0x09 (ASCII TAB), 0x0A (ASCII LF),
+ 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x3E
+ (ASCII &gt;) byte.</li>
+
+ <li><p>Repeatedly <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an
+ attribute</a> until no further attributes can be found,
+ then jump to the second step in the overall "two step"
+ algorithm.</li>
+
+ </ol></dd>
+
+ <dt>A sequence of bytes starting with: 0x3C 0x21 (ASCII '&lt;!')</dt>
+ <dt>A sequence of bytes starting with: 0x3C 0x2F (ASCII '&lt;/')</dt>
+ <dt>A sequence of bytes starting with: 0x3C 0x3F (ASCII '&lt;?')</dt>
+ <dd>
+
+ <p>Advance the <var title="">position</var> pointer so that it
+ points at the first 0x3E byte (ASCII &gt;) that comes after the
+ 0x3C byte that was found.</p>
+
+ </dd>
+
+ <dt>Any other byte</dt>
+ <dd>
+
+ <p>Do nothing with that byte.</p>
+
+ </dd>
+
+ </dl></li>
+
+ <li>Move <var title="">position</var> so it points at the next
+ byte in the input stream, and return to the first step of this
+ "two step" algorithm.</li>
+
+ </ol><p>When the above "two step" algorithm says to <dfn id=concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an
+ attribute</dfn>, it means doing this:</p>
+
+ <ol><li><p>If the byte at <var title="">position</var> is one of 0x09
+ (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR),
+ 0x20 (ASCII space), or 0x2F (ASCII /) then advance <var title="">position</var> to the next byte and redo this
+ substep.</li>
+
+ <li><p>If the byte at <var title="">position</var> is 0x3E (ASCII
+ &gt;), then abort the "get an attribute" algorithm. There isn't
+ one.</li>
+
+ <li><p>Otherwise, the byte at <var title="">position</var> is the
+ start of the attribute name. Let <var title="">attribute
+ name</var> and <var title="">attribute value</var> be the empty
+ string.</li>
+
+ <li><p><i>Attribute name</i>: Process the byte at <var title="">position</var> as follows:</p>
+
+ <dl class=switch><dt>If it is 0x3D (ASCII =), and the <var title="">attribute
+ name</var> is longer than the empty string</dt>
+
+ <dd>Advance <var title="">position</var> to the next byte and
+ jump to the step below labeled <i>value</i>.</dd>
+
+ <dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII
+ FF), 0x0D (ASCII CR), or 0x20 (ASCII space)</dt>
+
+ <dd>Jump to the step below labeled <i>spaces</i>.</dd>
+
+ <dt>If it is 0x2F (ASCII /) or 0x3E (ASCII &gt;)</dt>
+
+ <dd>Abort the "get an attribute" algorithm. The attribute's
+ name is the value of <var title="">attribute name</var>, its
+ value is the empty string.</dd>
+
+ <dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII
+ Z)</dt>
+
+ <dd>Append the Unicode character with code point <span title=""><var title="">b</var>+0x20</span> to <var title="">attribute
+ name</var> (where <var title="">b</var> is the value of the
+ byte at <var title="">position</var>).</dd>
+
+ <dt>Anything else</dt>
+
+ <dd>Append the Unicode character with the same code point as the
+ value of the byte at <var title="">position</var>) to <var title="">attribute name</var>. (It doesn't actually matter how
+ bytes outside the ASCII range are handled here, since only
+ ASCII characters can contribute to the detection of a character
+ encoding.)</dd>
+
+ </dl></li>
+
+ <li><p>Advance <var title="">position</var> to the next byte and
+ return to the previous step.</li>
+
+ <li><p><i>Spaces</i>: If the byte at <var title="">position</var> is one of 0x09 (ASCII TAB), 0x0A (ASCII
+ LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then
+ advance <var title="">position</var> to the next byte, then,
+ repeat this step.</li>
+
+ <li><p>If the byte at <var title="">position</var> is
+ <em>not</em> 0x3D (ASCII =), abort the "get an attribute"
+ algorithm. The attribute's name is the value of <var title="">attribute name</var>, its value is the empty
+ string.</li>
+
+ <li><p>Advance <var title="">position</var> past the 0x3D (ASCII
+ =) byte.</li>
+
+ <li><p><i>Value</i>: If the byte at <var title="">position</var> is one of 0x09 (ASCII TAB), 0x0A (ASCII
+ LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then
+ advance <var title="">position</var> to the next byte, then,
+ repeat this step.</li>
+
+ <li><p>Process the byte at <var title="">position</var> as
+ follows:</p>
+
+ <dl class=switch><dt>If it is 0x22 (ASCII ") or 0x27 (ASCII ')</dt>
+
+ <dd>
+
+ <ol><li>Let <var title="">b</var> be the value of the byte at
+ <var title="">position</var>.</li>
+
+ <li>Advance <var title="">position</var> to the next
+ byte.</li>
+
+ <li>If the value of the byte at <var title="">position</var>
+ is the value of <var title="">b</var>, then advance <var title="">position</var> to the next byte and abort the "get
+ an attribute" algorithm. The attribute's name is the value of
+ <var title="">attribute name</var>, and its value is the
+ value of <var title="">attribute value</var>.</li>
+
+ <li>Otherwise, if the value of the byte at <var title="">position</var> is in the range 0x41 (ASCII A) to
+ 0x5A (ASCII Z), then append a Unicode character to <var title="">attribute value</var> whose code point is 0x20 more
+ than the value of the byte at <var title="">position</var>.</li>
+
+ <li>Otherwise, append a Unicode character to <var title="">attribute value</var> whose code point is the same as
+ the value of the byte at <var title="">position</var>.</li>
+
+ <li>Return to the second step in these substeps.</li>
+
+ </ol></dd>
+
+ <dt>If it is 0x3E (ASCII &gt;)</dt>
+
+ <dd>Abort the "get an attribute" algorithm. The attribute's
+ name is the value of <var title="">attribute name</var>, its
+ value is the empty string.</dd>
+
+
+ <dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII
+ Z)</dt>
+
+ <dd>Append the Unicode character with code point <span title=""><var title="">b</var>+0x20</span> to <var title="">attribute
+ value</var> (where <var title="">b</var> is the value of the
+ byte at <var title="">position</var>). Advance <var title="">position</var> to the next byte.</dd>
+
+ <dt>Anything else</dt>
+
+ <dd>Append the Unicode character with the same code point as the
+ value of the byte at <var title="">position</var>) to <var title="">attribute value</var>. Advance <var title="">position</var> to the next byte.</dd>
+
+ </dl></li>
+
+ <li><p>Process the byte at <var title="">position</var> as
+ follows:</p>
+
+ <dl class=switch><dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII
+ FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x3E (ASCII
+ &gt;)</dt>
+
+ <dd>Abort the "get an attribute" algorithm. The attribute's
+ name is the value of <var title="">attribute name</var> and its
+ value is the value of <var title="">attribute value</var>.</dd>
+
+ <dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII
+ Z)</dt>
+
+ <dd>Append the Unicode character with code point <span title=""><var title="">b</var>+0x20</span> to <var title="">attribute
+ value</var> (where <var title="">b</var> is the value of the
+ byte at <var title="">position</var>).</dd>
+
+ <dt>Anything else</dt>
+
+ <dd>Append the Unicode character with the same code point as the
+ value of the byte at <var title="">position</var>) to <var title="">attribute value</var>.</dd>
+
+ </dl></li>
+
+ <li><p>Advance <var title="">position</var> to the next byte and
+ return to the previous step.</li>
+
+ </ol><p>For the sake of interoperability, user agents should not use a
+ pre-scan algorithm that returns different results than the one
+ described above. (But, if you do, please at least let us know, so
+ that we can improve this algorithm and benefit everyone...)</p>
+
+ </li>
+
+ <li><p>If the user agent has information on the likely encoding for
+ this page, e.g. based on the encoding of the page when it was last
+ visited, then return that encoding, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a>
+ <i>tentative</i>, and abort these steps.</li>
+
+ <li>
+
+ <p>The user agent may attempt to autodetect the character encoding
+ from applying frequency analysis or other algorithms to the data
+ stream. Such algorithms may use information about the resource
+ other than the resource's contents, including the address of the
+ resource. If autodetection succeeds in determining a character
+ encoding, then return that encoding, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a>
+ <i>tentative</i>, and abort these steps. <a href=#refsUNIVCHARDET>[UNIVCHARDET]</a></p>
+
+ <p class=note>The UTF-8 encoding has a highly detectable bit
+ pattern. Documents that contain bytes with values greater than
+ 0x7F which match the UTF-8 pattern are very likely to be UTF-8,
+ while documents with byte sequences that do not match it are very
+ likely not. User-agents are therefore encouraged to search for
+ this common encoding. <a href=#refsPPUTF8>[PPUTF8]</a> <a href=#refsUTF8DET>[UTF8DET]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>Otherwise, return an implementation-defined or user-specified
+ default character encoding, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a>
+ <i>tentative</i>.</p>
+
+ <p>In controlled environments or in environments where the
+ encoding of documents can be prescribed (for example, for user
+ agents intended for dedicated use in new networks), the
+ comprehensive <code title="">UTF-8</code> encoding is
+ suggested.</p>
+
+ <p>In other environments, the default encoding is typically
+ dependent on the user's locale (an approximation of the languages,
+ and thus often encodings, of the pages that the user is likely to
+ frequent). The following table gives suggested defaults based on
+ the user's locale, for compatibility with legacy content. Locales
+ are identified by BCP 47 language tags. <a href=#refsBCP47>[BCP47]</a></p>
+
+ <!-- based on mozilla 1.9.1 localizations:
+ http://mxr.mozilla.org/l10n-mozilla1.9.1/find?string=global%2Fintl.properties&tree=l10n-mozilla1.9.1&hint= -->
+
+ <table><thead><tr><th>Locale language
+ <th>Suggested default encoding
+ <tbody><tr><td>ar
+ <td>UTF-8
+
+ <tr><td>be
+ <td>ISO-8859-5
+
+ <tr><td>bg
+ <td>windows-1251
+
+ <tr><td>cs<!-- -CZ -->
+ <td>ISO-8859-2
+
+ <tr><td>cy
+ <td>UTF-8
+
+ <tr><td>fa<!-- -IR -->
+ <td>UTF-8
+
+ <tr><td>he<!-- -IL -->
+ <td>windows-1255
+
+ <tr><td>hr
+ <td>UTF-8
+
+ <tr><td>hu<!-- -HU -->
+ <td>ISO-8859-2
+
+ <tr><td>ja <!-- and ja-JP-mac -->
+ <td>Windows-31J <!-- Shift_JIS -->
+
+ <tr><td>kk
+ <td>UTF-8
+
+ <tr><td>ko<!-- -KR -->
+ <td>windows-949 <!-- EUC-KR -->
+
+ <tr><td>ku
+ <td>windows-1254 <!-- ISO-8859-9 -->
+
+ <tr><td>lt
+ <td>windows-1257
+
+ <tr><td>lv<!-- -LV -->
+ <td>ISO-8859-13
+
+ <tr><td>mk<!-- -MK -->
+ <td>UTF-8
+
+ <tr><td>or
+ <td>UTF-8
+
+ <tr><td>pl<!-- -PL -->
+ <td>ISO-8859-2
+
+ <tr><td>ro
+ <td>UTF-8
+
+ <tr><td>ru
+ <td>windows-1251
+
+ <tr><td>sk
+ <td>windows-1250
+
+ <tr><td>sl
+ <td>ISO-8859-2
+
+ <tr><td>sr
+ <td>UTF-8
+
+ <tr><td>th
+ <td>windows-874 <!-- TIS-620 -->
+
+ <tr><td>tr<!-- -TR -->
+ <td>windows-1254 <!-- ISO-8859-9 -->
+
+ <tr><td>uk
+ <td>windows-1251
+
+ <tr><td>vi
+ <td>UTF-8
+
+ <tr><td>zh-CN
+ <td>GB18030
+
+ <tr><td>zh-TW
+ <td>Big5
+
+ <tr><td>All other locales
+ <td>windows-1252
+
+ </table></li>
+
+ </ol><p>The <a href="#document's-character-encoding">document's character encoding</a> must immediately
+ be set to the value returned from this algorithm, at the same time
+ as the user agent uses the returned value to select the decoder to
+ use for the input stream.</p>
+
+ <p class=note>This algorithm is a <a href=#willful-violation>willful violation</a>
+ of the HTTP specification, which requires that the encoding be
+ assumed to be ISO-8859-1 in the absence of a <a href=#character-encoding-declaration>character
+ encoding declaration</a> to the contrary, and of RFC 2046,
+ which requires that the encoding be assumed to be US-ASCII in the
+ absence of a <a href=#character-encoding-declaration>character encoding declaration</a> to the
+ contrary. This specification's third approach is motivated by a
+ desire to be maximally compatible with legacy content. <a href=#refsHTTP>[HTTP]</a> <a href=#refsRFC2046>[RFC2046]</a></p>
+
+
+ <h5 id=character-encodings-0><span class=secno>10.2.2.2 </span>Character encodings</h5>
+
+ <p>User agents must at a minimum support the UTF-8 and Windows-1252
+ encodings, but may support more.</p>
+
+ <p class=note>It is not unusual for Web browsers to support dozens
+ if not upwards of a hundred distinct character encodings.</p>
+
+ <p>User agents must support the <a href=#preferred-mime-name>preferred MIME name</a> of
+ every character encoding they support, and should support all the
+ IANA-registered names and aliases of every character encoding they
+ support. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>
+
+ <p>When comparing a string specifying a character encoding with the
+ name or alias of a character encoding to determine if they are
+ equal, user agents must remove any leading or trailing <a href=#space-character title="space character">space characters</a> in both names, and
+ then perform the comparison in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner.</p>
+
+ <hr><p>When a user agent would otherwise use an encoding given in the
+ first column of the following table to either convert content to
+ Unicode characters or convert Unicode characters to bytes, it must
+ instead use the encoding given in the cell in the second column of
+ the same row. When a byte or sequence of bytes is treated
+ differently due to this encoding aliasing, it is said to have been
+ <dfn id=misinterpreted-for-compatibility>misinterpreted for compatibility</dfn>.</p>
+
+ <table><caption>Character encoding overrides</caption>
+ <thead><tr><th> Input encoding <th> Replacement encoding <th> References
+ <tbody><!-- how about EUC-JP? --><tr><td> EUC-KR <td> windows-949 <td>
+ <a href=#refsEUCKR>[EUCKR]</a>
+ <a href=#refsWIN949>[WIN949]</a>
+ <tr><td> GB2312 <td> GBK <td>
+ <a href=#refsRFC1345>[RFC1345]</a>
+ <a href=#refsGBK>[GBK]</a>
+ <tr><td> GB_2312-80 <td> GBK <td>
+ <a href=#refsRFC1345>[RFC1345]</a>
+ <a href=#refsGBK>[GBK]</a>
+ <tr><td> ISO-8859-1 <td> windows-1252 <td>
+ <a href=#refsRFC1345>[RFC1345]</a>
+ <a href=#refsWIN1252>[WIN1252]</a>
+ <tr><td> ISO-8859-9 <td> windows-1254 <td>
+ <a href=#refsRFC1345>[RFC1345]</a>
+ <a href=#refsWIN1254>[WIN1254]</a>
+ <tr><td> ISO-8859-11 <td> windows-874 <td>
+ <a href=#refsISO885911>[ISO885911]</a>
+ <a href=#refsWIN874>[WIN874]</a>
+ <tr><td> KS_C_5601-1987 <td> windows-949 <td>
+ <a href=#refsRFC1345>[RFC1345]</a>
+ <a href=#refsWIN949>[WIN949]</a>
+ <tr><td> Shift_JIS <td> Windows-31J <td>
+ <a href=#refsSHIFTJIS>[SHIFTJIS]</a>
+ <a href=#refsWIN31J>[WIN31J]</a>
+ <tr><td> TIS-620 <td> windows-874 <td>
+ <a href=#refsTIS620>[TIS620]</a>
+ <a href=#refsWIN874>[WIN874]</a>
+ <tr><td> US-ASCII <td> windows-1252 <td>
+ <a href=#refsRFC1345>[RFC1345]</a>
+ <a href=#refsWIN1252>[WIN1252]</a>
+ </table><p class=note>The requirement to treat certain encodings as other
+ encodings according to the table above is a <a href=#willful-violation>willful
+ violation</a> of the W3C Character Model specification, motivated
+ by a desire for compatibility with legacy content. <a href=#refsCHARMOD>[CHARMOD]</a></p>
+
+ <p>When a user agent is to use the UTF-16 encoding but no BOM has
+ been found, user agents must default to UTF-16LE.</p>
+
+ <p class=note>The requirement to default UTF-16 to LE rather than
+ BE is a <a href=#willful-violation>willful violation</a> of RFC 2781, motivated by a
+ desire for compatibility with legacy content. <a href=#refsRFC2781>[RFC2781]</a></p>
+
+ <hr><p>User agents must not support the CESU-8, UTF-7, BOCU-1 and SCSU
+ encodings. <a href=#refsCESU8>[CESU8]</a> <a href=#refsUTF7>[UTF7]</a> <a href=#refsBOCU1>[BOCU1]</a> <a href=#refsSCSU>[SCSU]</a></p>
+
+ <p>Support for encodings based on EBCDIC is not recommended. This
+ encoding is rarely used for publicly-facing Web content.</p>
+
+ <p>Support for UTF-32 is not recommended. This encoding is rarely
+ used, and frequently implemented incorrectly.</p>
+
+ <p class=note>This specification does not make any attempt to
+ support EBCDIC-based encodings and UTF-32 in its algorithms; support
+ and use of these encodings can thus lead to unexpected behavior in
+ implementations of this specification.</p>
+
+
+
+ <h5 id=preprocessing-the-input-stream><span class=secno>10.2.2.3 </span>Preprocessing the input stream</h5>
+
+ <p>Given an encoding, the bytes in the input stream must be
+ converted to Unicode characters for the tokenizer, as described by
+ the rules for that encoding, except that the leading U+FEFF BYTE
+ ORDER MARK character, if any, must not be stripped by the encoding
+ layer (it is stripped by the rule below).</p> <!-- this is to
+ prevent two leading BOMs from being both stripped, once by the
+ decoder, and once by the parser -->
+
+ <p>Bytes or sequences of bytes in the original byte stream that
+ could not be converted to Unicode code points must be converted to
+ U+FFFD REPLACEMENT CHARACTERs.</p>
+
+ <p class=note>Bytes or sequences of bytes in the original byte
+ stream that did not conform to the encoding specification
+ (e.g. invalid UTF-8 byte sequences in a UTF-8 input stream) are
+ errors that conformance checkers are expected to report.</p>
+
+ <p>Any byte or sequence of bytes in the original byte stream that is
+ <a href=#misinterpreted-for-compatibility>misinterpreted for compatibility</a> is a <a href=#parse-error>parse
+ error</a>.</p>
+
+ <p>One leading U+FEFF BYTE ORDER MARK character must be ignored if
+ any are present.</p>
+
+ <p class=note>The requirement to strip a U+FEFF BYTE ORDER MARK
+ character regardless of whether that character was used to determine
+ the byte order is a <a href=#willful-violation>willful violation</a> of Unicode,
+ motivated by a desire to increase the resilience of user agents in
+ the face of na&iuml;ve transcoders.</p>
+
+ <p>All U+0000 NULL characters and code points in the range U+D800 to
+ U+DFFF<!-- surrogates not allowed e.g. in UTF-8, and we don't want
+ them to suddenly turn into codepoints when they go through a UTF-16
+ pipe --> in the input must be replaced by U+FFFD REPLACEMENT
+ CHARACTERs. Any occurrences of such characters and code points are
+ <a href=#parse-error title="parse error">parse errors</a>.</p>
+
+ <p>Any occurrences of any characters in the ranges U+0001 to U+0008,
+ <!-- HT, LF allowed --> <!-- U+000B is in the next list --> <!-- FF,
+ CR allowed --> U+000E to U+001F, <!-- ASCII allowed --> U+007F
+ <!--to U+0084, (U+0085 NEL not allowed), U+0086--> to U+009F, U+FDD0
+ to U+FDEF, and characters U+000B, U+FFFE, U+FFFF, U+1FFFE, U+1FFFF,
+ U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE,
+ U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF,
+ U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE,
+ U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, U+FFFFF,
+ U+10FFFE, and U+10FFFF are <a href=#parse-error title="parse error">parse
+ errors</a>. These are all control characters or permanently
+ undefined Unicode characters (noncharacters).</p>
+
+ <p>U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF)
+ characters are treated specially. Any CR characters that are
+ followed by LF characters must be removed, and any CR characters not
+ followed by LF characters must be converted to LF characters. Thus,
+ newlines in HTML DOMs are represented by LF characters, and there
+ are never any CR characters in the input to the
+ <a href=#tokenization>tokenization</a> stage.</p>
+
+ <p>The <dfn id=next-input-character>next input character</dfn> is the first character in the
+ input stream that has not yet been <dfn id=consumed>consumed</dfn>. Initially,
+ the <i><a href=#next-input-character>next input character</a></i> is the first character in the
+ input. The <dfn id=current-input-character>current input character</dfn> is the last character
+ to have been <i><a href=#consumed>consumed</a></i>.</p>
+
+ <p>The <dfn id=insertion-point>insertion point</dfn> is the position (just before a
+ character or just before the end of the input stream) where content
+ inserted using <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> is actually
+ inserted. The insertion point is relative to the position of the
+ character immediately after it, it is not an absolute offset into
+ the input stream. Initially, the insertion point is
+ undefined.</p>
+
+ <p>The "EOF" character in the tables below is a conceptual character
+ representing the end of the <a href=#the-input-stream>input stream</a>. If the parser
+ is a <a href=#script-created-parser>script-created parser</a>, then the end of the
+ <a href=#the-input-stream>input stream</a> is reached when an <dfn id=explicit-eof-character>explicit "EOF"
+ character</dfn> (inserted by the <code title=dom-document-close><a href=#dom-document-close>document.close()</a></code> method) is
+ consumed. Otherwise, the "EOF" character is not a real character in
+ the stream, but rather the lack of any further characters.</p>
+
+
+ <h5 id=changing-the-encoding-while-parsing><span class=secno>10.2.2.4 </span>Changing the encoding while parsing</h5>
+
+ <p>When the parser requires the user agent to <dfn id=change-the-encoding>change the
+ encoding</dfn>, it must run the following steps. This might happen
+ if the <a href=#encoding-sniffing-algorithm>encoding sniffing algorithm</a> described above
+ failed to find an encoding, or if it found an encoding that was not
+ the actual encoding of the file.</p>
+
+ <ol><li>If the new encoding is identical or equivalent to the encoding
+ that is already being used to interpret the input stream, then set
+ the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> to
+ <i>certain</i> and abort these steps. This happens when the
+ encoding information found in the file matches what the
+ <a href=#encoding-sniffing-algorithm>encoding sniffing algorithm</a> determined to be the
+ encoding, and in the second pass through the parser if the first
+ pass found that the encoding sniffing algorithm described in the
+ earlier section failed to find the right encoding.</li>
+
+ <li>If the encoding that is already being used to interpret the
+ input stream is a UTF-16 encoding, then set the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> to
+ <i>certain</i> and abort these steps. The new encoding is ignored;
+ if it was anything but the same encoding, then it would be clearly
+ incorrect.</li>
+
+ <li>If the new encoding is a UTF-16 encoding, change it to
+ UTF-8.</li>
+
+ <li>If all the bytes up to the last byte converted by the current
+ decoder have the same Unicode interpretations in both the current
+ encoding and the new encoding, and if the user agent supports
+ changing the converter on the fly, then the user agent may change
+ to the new converter for the encoding on the fly. Set the
+ <a href="#document's-character-encoding">document's character encoding</a> and the encoding used to
+ convert the input stream to the new encoding, set the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> to
+ <i>certain</i>, and abort these steps.</li>
+
+ <li>Otherwise, <a href=#navigate>navigate</a> to the document again, with
+ <a href=#replacement-enabled>replacement enabled</a>, and using the same <a href=#source-browsing-context>source
+ browsing context</a>, but this time skip the <a href=#encoding-sniffing-algorithm>encoding
+ sniffing algorithm</a> and instead just set the encoding to the
+ new encoding and the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> to
+ <i>certain</i>. Whenever possible, this should be done without
+ actually contacting the network layer (the bytes should be
+ re-parsed from memory), even if, e.g., the document is marked as
+ not being cacheable. If this is not possible and contacting the
+ network layer would involve repeating a request that uses a method
+ other than HTTP GET (<a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
+ equivalent</a> for non-HTTP URLs), then instead set the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> to
+ <i>certain</i> and ignore the new encoding. The resource will be
+ misinterpreted. User agents may notify the user of the situation,
+ to aid in application development.</li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h4 id=parse-state><span class=secno>10.2.3 </span>Parse state</h4>
+
+ <h5 id=the-insertion-mode><span class=secno>10.2.3.1 </span>The insertion mode</h5>
+
+ <p>The <dfn id=insertion-mode>insertion mode</dfn> is a state variable that controls
+ the primary operation of the tree construction stage.</p>
+
+ <p>Initially, the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-initial-insertion-mode title="insertion mode: initial">initial</a>". It can change to
+ "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>",
+ "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before head</a>",
+ "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>", "<a href=#parsing-main-inheadnoscript title="insertion mode: in head noscript">in head noscript</a>",
+ "<a href=#the-after-head-insertion-mode title="insertion mode: after head">after head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>", "<a href=#parsing-main-incdata title="insertion mode: text">text</a>",
+ "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>", "<a href=#parsing-main-intabletext title="insertion mode: in table text">in table text</a>", "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>", "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column group</a>",
+ "<a href=#parsing-main-intbody title="insertion mode: in table body">in table body</a>",
+ "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>", "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>", "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>", "<a href=#parsing-main-inselectintable title="insertion mode: in select in table">in select in
+ table</a>", "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in
+ foreign content</a>", "<a href=#parsing-main-afterbody title="insertion mode: after
+ body">after body</a>", "<a href=#parsing-main-inframeset title="insertion mode: in
+ frameset">in frameset</a>", "<a href=#parsing-main-afterframeset title="insertion mode: after
+ frameset">after frameset</a>", "<a href=#the-after-after-body-insertion-mode title="insertion mode:
+ after after body">after after body</a>", and "<a href=#the-after-after-frameset-insertion-mode title="insertion mode: after after frameset">after after
+ frameset</a>" during the course of the parsing, as described in
+ the <a href=#tree-construction>tree construction</a> stage. The insertion mode affects
+ how tokens are processed and whether CDATA sections are
+ supported.</p>
+
+ <p>Seven of these modes, namely "<a href=#parsing-main-inhead title="insertion mode: in
+ head">in head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in
+ body</a>", "<a href=#parsing-main-intable title="insertion mode: in table">in
+ table</a>", "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
+ body</a>", "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>",
+ "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>", and "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>", are special, in
+ that the other modes defer to them at various times. When the
+ algorithm below says that the user agent is to do something
+ "<dfn id=using-the-rules-for>using the rules for</dfn> the <var title="">m</var> insertion
+ mode", where <var title="">m</var> is one of these modes, the user
+ agent must use the rules described under the <var title="">m</var>
+ <a href=#insertion-mode>insertion mode</a>'s section, but must leave the
+ <a href=#insertion-mode>insertion mode</a> unchanged unless the rules in <var title="">m</var> themselves switch the <a href=#insertion-mode>insertion mode</a>
+ to a new value.</p>
+
+ <p>When the insertion mode is switched to "<a href=#parsing-main-incdata title="insertion
+ mode: text">text</a>" or "<a href=#parsing-main-intabletext title="insertion mode: in table
+ text">in table text</a>", the <dfn id=original-insertion-mode>original insertion mode</dfn>
+ is also set. This is the insertion mode to which the tree
+ construction stage will return.</p>
+
+ <p>When the insertion mode is switched to "<a href=#parsing-main-inforeign title="insertion
+ mode: in foreign content">in foreign content</a>", the
+ <dfn id=secondary-insertion-mode>secondary insertion mode</dfn> is also set. This secondary mode
+ is used within the rules for the "<a href=#parsing-main-inforeign title="insertion mode: in
+ foreign content">in foreign content</a>" mode to handle HTML
+ (i.e. not foreign) content.</p>
+
+ <hr><p>When the steps below require the UA to <dfn id=reset-the-insertion-mode-appropriately>reset the insertion
+ mode appropriately</dfn>, it means the UA must follow these
+ steps:</p>
+
+ <ol><li>Let <var title="">last</var> be false.</li>
+
+ <li>Let <var title="">foreign</var> be false.</li>
+
+ <li>Let <var title="">node</var> be the last node in the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</li>
+
+ <li><i>Loop</i>: If <var title="">node</var> is the first node in
+ the stack of open elements, then set <var title="">last</var> to
+ true and set <var title="">node</var> to the <var title="">context</var> element. (<a href=#fragment-case>fragment case</a>)</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-select-element>select</a></code> element,
+ then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>" and jump to the
+ step labeled <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-td-element>td</a></code> or
+ <code><a href=#the-th-element>th</a></code> element and <var title="">last</var> is false, then
+ switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intd title="insertion
+ mode: in cell">in cell</a>" and jump to the step labeled <i title="">end</i>.</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-tr-element>tr</a></code> element, then
+ switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion
+ mode: in row">in row</a>" and jump to the step labeled <i title="">end</i>.</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-tbody-element>tbody</a></code>,
+ <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-tfoot-element>tfoot</a></code> element, then switch the
+ <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intbody title="insertion mode: in
+ table body">in table body</a>" and jump to the step labeled <i title="">end</i>.</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-caption-element>caption</a></code> element,
+ then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>" and jump to
+ the step labeled <i title="">end</i>.</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-colgroup-element>colgroup</a></code> element,
+ then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column group</a>" and
+ jump to the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment
+ case</a>)</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-table-element>table</a></code> element,
+ then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" and jump to the
+ step labeled <i title="">end</i>.</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#the-head-element-0>head</a></code> element,
+ then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" ("<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>"! <em> not "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>"</em>!) and jump to
+ the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment
+ case</a>)</li> <!-- This is only here for now in case people
+ think that the spec accidentally omitted it and try to "fix"
+ it. Note that noscript-in-head is also handled this way. This is
+ all intentional. The only thing it doesn't handle is the
+ scripting-disabled fragment parsing case for a <head> element
+ containing a <noscript> which itself contains something other than
+ a <link> or a <style> element; you'd expect that to break out of
+ the <noscript> but it doesn't. This is an edge case that doesn't
+ affect the spec, since the algorithm for fragment parsing is only
+ used for innerHTML/outerHTML/insertAdjacentHTML(), where we know
+ scripting is enabled. -->
+
+ <li>If <var title="">node</var> is a <code><a href=#the-body-element-0>body</a></code> element,
+ then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" and jump to the
+ step labeled <i title="">end</i>.</li>
+
+ <li>If <var title="">node</var> is a <code><a href=#frameset>frameset</a></code> element,
+ then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>" and jump to
+ the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment
+ case</a>)</li>
+
+ <li>If <var title="">node</var> is an <code><a href=#the-html-element-0>html</a></code> element,
+ then <!--: if the <span><code title="">head</code> element
+ pointer</span> is null,--> switch the <a href=#insertion-mode>insertion mode</a>
+ to "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before
+ head</a>"<!--, otherwise, switch the <span>insertion mode</span>
+ to "<span title="insertion mode: after head">after head</span>".-->
+ Then, <!-- in either case, --> jump to the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li> <!-- if the
+ head element pointer can ever be non-null when we're going through
+ these steps, we'll need to uncomment out the commented-out bits -->
+
+ <li>If <var title="">node</var> is an element from the <a href=#mathml-namespace>MathML
+ namespace</a> or the <a href=#svg-namespace>SVG namespace</a>, then set the
+ <var title="">foreign</var> flag to true.</li>
+
+ <li>If <var title="">last</var> is true, then switch the
+ <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in
+ body">in body</a>" and jump to the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li>
+
+ <li>Let <var title="">node</var> now be the node before <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</li>
+
+ <li>Return to the step labeled <i>loop</i>.</li>
+
+ <li><i>End</i>: If <var title="">foreign</var> is true, switch the
+ <a href=#secondary-insertion-mode>secondary insertion mode</a> to whatever the
+ <a href=#insertion-mode>insertion mode</a> is set to, and switch the
+ <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inforeign title="insertion mode: in
+ foreign content">in foreign content</a>".</li>
+
+ </ol><h5 id=the-stack-of-open-elements><span class=secno>10.2.3.2 </span>The stack of open elements</h5>
+
+ <p>Initially, the <dfn id=stack-of-open-elements>stack of open elements</dfn> is empty. The
+ stack grows downwards; the topmost node on the stack is the first
+ one added to the stack, and the bottommost node of the stack is the
+ most recently added node in the stack (notwithstanding when the
+ stack is manipulated in a random access fashion as part of <a href=#adoptionAgency>the handling for misnested tags</a>).</p>
+
+ <p>The "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before
+ html</a>" <a href=#insertion-mode>insertion mode</a> creates the
+ <code><a href=#the-html-element-0>html</a></code> root element node, which is then added to the
+ stack.</p>
+
+ <p>In the <a href=#fragment-case>fragment case</a>, the <a href=#stack-of-open-elements>stack of open
+ elements</a> is initialized to contain an <code><a href=#the-html-element-0>html</a></code>
+ element that is created as part of <a href=#html-fragment-parsing-algorithm title="html fragment
+ parsing algorithm">that algorithm</a>. (The <a href=#fragment-case>fragment
+ case</a> skips the "<a href=#the-before-html-insertion-mode title="insertion mode: before
+ html">before html</a>" <a href=#insertion-mode>insertion mode</a>.)</p>
+
+ <p>The <code><a href=#the-html-element-0>html</a></code> node, however it is created, is the topmost
+ node of the stack. It only gets popped off the stack when the parser
+ <a href=#stop-parsing title="stop parsing">finishes</a>.</p>
+
+ <p>The <dfn id=current-node>current node</dfn> is the bottommost node in this
+ stack.</p>
+
+ <p>The <dfn id=current-table>current table</dfn> is the last <code><a href=#the-table-element>table</a></code>
+ element in the <a href=#stack-of-open-elements>stack of open elements</a>, if there is
+ one. If there is no <code><a href=#the-table-element>table</a></code> element in the <a href=#stack-of-open-elements>stack of
+ open elements</a> (<a href=#fragment-case>fragment case</a>), then the
+ <a href=#current-table>current table</a> is the first element in the <a href=#stack-of-open-elements>stack
+ of open elements</a> (the <code><a href=#the-html-element-0>html</a></code> element).</p>
+
+ <p>Elements in the stack fall into the following categories:</p>
+
+ <dl><dt><dfn id=special>Special</dfn></dt>
+ <dd><p>The following HTML elements have varying levels of special
+ parsing rules: <code><a href=#the-address-element>address</a></code>, <code><a href=#the-area-element>area</a></code>,
+ <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-base-element>base</a></code>,
+ <code><a href=#basefont>basefont</a></code>, <code><a href=#bgsound>bgsound</a></code>,
+ <code><a href=#the-blockquote-element>blockquote</a></code>, <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-br-element>br</a></code>,
+ <code><a href=#the-button-element>button</a></code>, <code><a href=#center>center</a></code>, <code><a href=#the-col-element>col</a></code>,
+ <code><a href=#the-colgroup-element>colgroup</a></code>, <code><a href=#the-command>command</a></code>, <!--v2DDATAGRID
+ <code>datagrid</code>-->, <code><a href=#the-dd-element>dd</a></code>, <code><a href=#the-details-element>details</a></code>,
+ <code><a href=#dir>dir</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-dl-element>dl</a></code>,
+ <code><a href=#the-dt-element>dt</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-fieldset-element>fieldset</a></code>,
+ <code><a href=#the-figure-element>figure</a></code>, <code><a href=#the-footer-element>footer</a></code>, <code><a href=#the-form-element>form</a></code>,
+ <code><a href=#frame>frame</a></code>, <code><a href=#frameset>frameset</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>,
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>,
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code><a href=#the-head-element-0>head</a></code>, <code><a href=#the-header-element>header</a></code>,
+ <code><a href=#the-hgroup-element>hgroup</a></code>, <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <!--
+ <code>image</code>, (commented out because this isn't an element
+ that can end up on the stack, so it doesn't matter) -->
+ <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#isindex-0>isindex</a></code>,
+ <code><a href=#the-li-element>li</a></code>, <code><a href=#the-link-element>link</a></code>, <code><a href=#listing>listing</a></code>,
+ <code><a href=#menus>menu</a></code>, <code><a href=#meta>meta</a></code>, <code><a href=#the-nav-element>nav</a></code>,
+ <code><a href=#noembed>noembed</a></code>, <code><a href=#noframes>noframes</a></code>, <code><a href=#the-noscript-element>noscript</a></code>,
+ <code><a href=#the-ol-element>ol</a></code>, <code><a href=#the-p-element>p</a></code>, <code><a href=#the-param-element>param</a></code>,
+ <code><a href=#plaintext>plaintext</a></code>, <code><a href=#the-pre-element>pre</a></code>, <code><a href=#script>script</a></code>,
+ <code><a href=#the-section-element>section</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-style-element>style</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-textarea-element>textarea</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>,
+ <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-title-element-0>title</a></code>, <code><a href=#the-tr-element>tr</a></code>,
+ <code><a href=#the-ul-element>ul</a></code>, <code><a href=#the-wbr-element>wbr</a></code>, and <code><a href=#xmp>xmp</a></code>.</dd>
+
+ <dt><dfn id=scoping>Scoping</dfn></dt>
+ <dd><p>The following HTML elements introduce new <a href=#has-an-element-in-scope title="has
+ an element in scope">scopes</a> for various parts of the
+ parsing: <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-caption-element>caption</a></code>,
+ <code><a href=#the-html-element-0>html</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-object-element>object</a></code>,
+ <code><a href=#the-table-element>table</a></code>, <code><a href=#the-td-element>td</a></code>, <code><a href=#the-th-element>th</a></code>, and SVG's
+ <code>foreignObject</code>.</dd>
+
+ <dt><dfn id=formatting>Formatting</dfn></dt>
+ <dd><p>The following HTML elements are those that end up in the
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a>: <code><a href=#the-a-element>a</a></code>,
+ <code><a href=#the-b-element>b</a></code>, <code><a href=#big>big</a></code>, <code><a href=#the-code-element>code</a></code>,
+ <code><a href=#the-em-element>em</a></code>, <code><a href=#font>font</a></code>, <code><a href=#the-i-element>i</a></code>,
+ <code><a href=#nobr>nobr</a></code>, <code><a href=#s>s</a></code>, <code><a href=#the-small-element>small</a></code>,
+ <code><a href=#strike>strike</a></code>, <code><a href=#the-strong-element>strong</a></code>, <code><a href=#tt>tt</a></code>, and
+ <code><a href=#u>u</a></code>.</dd>
+
+ <dt><dfn id=phrasing>Phrasing</dfn></dt>
+ <dd><p>All other elements found while parsing an HTML
+ document.</dd>
+
+ </dl><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-the-specific-scope title="has an element in the specific scope">have an element in a
+ specific scope</dfn> consisting of a list of element types <var title="">list</var> when the following algorithm terminates in a
+ match state:</p>
+
+ <ol><li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current
+ node</a> (the bottommost node of the stack).</li>
+
+ <li><p>If <var title="">node</var> is the target node, terminate in
+ a match state.</li>
+
+ <li><p>Otherwise, if <var title="">node</var> is one of the element
+ types in <var title="">list</var>, terminate in a failure
+ state.</li>
+
+ <li><p>Otherwise, set <var title="">node</var> to the previous
+ entry in the <a href=#stack-of-open-elements>stack of open elements</a> and return to step
+ 2. (This will never fail, since the loop will always terminate in
+ the previous step if the top of the stack &mdash; an
+ <code><a href=#the-html-element-0>html</a></code> element &mdash; is reached.)</li>
+
+ </ol><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-scope title="has an element in scope">have an element in scope</dfn> when
+ it <a href=#has-an-element-in-the-specific-scope>has an element in the specific scope</a> consisting
+ of the following element types:</p>
+
+ <ul class=brief><li><code><a href=#the-applet-element>applet</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-caption-element>caption</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-html-element-0>html</a></code> in the HTML namespace</li> <!-- (This can only happen if the <var title="">node</var> is the topmost node of the <span>stack of open elements</span>, and prevents the next step from being invoked if there are no more elements in the stack.) -->
+ <li><code><a href=#the-table-element>table</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-td-element>td</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-th-element>th</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-button-element>button</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-marquee-element>marquee</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-object-element>object</a></code> in the HTML namespace</li>
+ <li><code title="">foreignObject</code> in the SVG namespace</li>
+ </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-list-item-scope title="has an element in list item scope">have an element in list
+ item scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
+ scope</a> consisting of the following element types:</p>
+
+ <ul class=brief><li>All the element types listed above for the <i><a href=#has-an-element-in-scope>has an element
+ in scope</a></i> algorithm.</li>
+ <li><code><a href=#the-ol-element>ol</a></code> in the HTML namespace</li>
+ <li><code><a href=#the-ul-element>ul</a></code> in the HTML namespace</li>
+ </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-table-scope title="has an element in table scope">have an element in <em>table
+ scope</em></dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
+ scope</a> consisting of the following element types:</p>
+
+ <ul class=brief><li><code><a href=#the-html-element-0>html</a></code> in the HTML namespace</li> <!-- (This can only happen if the <var title="">node</var> is the topmost node of the <span>stack of open elements</span>, and prevents the next step from being invoked if there are no more elements in the stack.) -->
+ <li><code><a href=#the-table-element>table</a></code> in the HTML namespace</li>
+ </ul><p>Nothing happens if at any time any of the elements in the
+ <a href=#stack-of-open-elements>stack of open elements</a> are moved to a new location in,
+ or removed from, the <code><a href=#document>Document</a></code> tree. In particular, the
+ stack is not changed in this situation. This can cause, amongst
+ other strange effects, content to be appended to nodes that are no
+ longer in the DOM.</p>
+
+ <p class=note>In some cases (namely, when <a href=#adoptionAgency>closing misnested formatting elements</a>),
+ the stack is manipulated in a random-access fashion.</p>
+
+
+ <h5 id=the-list-of-active-formatting-elements><span class=secno>10.2.3.3 </span>The list of active formatting elements</h5>
+
+ <p>Initially, the <dfn id=list-of-active-formatting-elements>list of active formatting elements</dfn> is
+ empty. It is used to handle mis-nested <a href=#formatting title=formatting>formatting element tags</a>.</p>
+
+ <p>The list contains elements in the <a href=#formatting>formatting</a>
+ category, and scope markers. The scope markers are inserted when
+ entering <code><a href=#the-applet-element>applet</a></code> elements, buttons, <code><a href=#the-object-element>object</a></code>
+ elements, marquees, table cells, and table captions, and are used to
+ prevent formatting from "leaking" <em>into</em> <code><a href=#the-applet-element>applet</a></code>
+ elements, buttons, <code><a href=#the-object-element>object</a></code> elements, marquees, and
+ tables.</p>
+
+ <p class=note>The scope markers are unrelated to the concept of an
+ element being <a href=#has-an-element-in-scope title="has an element in scope">in
+ scope</a>.</p>
+
+ <p>In addition, each element in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a> is associated with the token for which it was
+ created, so that further elements can be created for that token if
+ necessary.</p>
+
+ <p>When the steps below require the UA to <dfn id=reconstruct-the-active-formatting-elements>reconstruct the
+ active formatting elements</dfn>, the UA must perform the following
+ steps:</p>
+
+ <ol><li>If there are no entries in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>, then there is nothing to reconstruct; stop this
+ algorithm.</li>
+
+ <li>If the last (most recently added) entry in the <a href=#list-of-active-formatting-elements>list of
+ active formatting elements</a> is a marker, or if it is an
+ element that is in the <a href=#stack-of-open-elements>stack of open elements</a>, then
+ there is nothing to reconstruct; stop this algorithm.</li>
+
+ <li>Let <var title="">entry</var> be the last (most recently added)
+ element in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>.</li>
+
+ <li>If there are no entries before <var title="">entry</var> in the
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, then jump to step
+ 8.</li>
+
+ <li>Let <var title="">entry</var> be the entry one earlier than
+ <var title="">entry</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>.</li>
+
+ <li>If <var title="">entry</var> is neither a marker nor an element
+ that is also in the <a href=#stack-of-open-elements>stack of open elements</a>, go to step
+ 4.</li>
+
+ <li>Let <var title="">entry</var> be the element one later than
+ <var title="">entry</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>.</li>
+
+ <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
+ element <var title="">entry</var> was created, to obtain <var title="">new element</var>.</li>
+
+ <li>Append <var title="">new element</var> to the <a href=#current-node>current
+ node</a> and push it onto the <a href=#stack-of-open-elements>stack of open
+ elements</a> so that it is the new <a href=#current-node>current
+ node</a>.</li>
+
+ <li>Replace the entry for <var title="">entry</var> in the list
+ with an entry for <var title="">new element</var>.</li>
+
+ <li>If the entry for <var title="">new element</var> in the
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a> is not the last
+ entry in the list, return to step 7.</li>
+
+ </ol><p>This has the effect of reopening all the formatting elements that
+ were opened in the current body, cell, or caption (whichever is
+ youngest) that haven't been explicitly closed.</p>
+
+ <p class=note>The way this specification is written, the
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a> always consists of
+ elements in chronological order with the least recently added
+ element first and the most recently added element last (except for
+ while steps 8 to 11 of the above algorithm are being executed, of
+ course).</p>
+
+ <p>When the steps below require the UA to <dfn id=clear-the-list-of-active-formatting-elements-up-to-the-last-marker>clear the list of
+ active formatting elements up to the last marker</dfn>, the UA must
+ perform the following steps:</p>
+
+ <ol><li>Let <var title="">entry</var> be the last (most recently added)
+ entry in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</li>
+
+ <li>Remove <var title="">entry</var> from the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a>.</li>
+
+ <li>If <var title="">entry</var> was a marker, then stop the
+ algorithm at this point. The list has been cleared up to the last
+ marker.</li>
+
+ <li>Go to step 1.</li>
+
+ </ol><h5 id=the-element-pointers><span class=secno>10.2.3.4 </span>The element pointers</h5>
+
+ <p>Initially, the <dfn id=head-element-pointer><code title="">head</code> element
+ pointer</dfn> and the <dfn id=form-element-pointer><code title="">form</code> element
+ pointer</dfn> are both null.</p>
+
+ <p>Once a <code><a href=#the-head-element-0>head</a></code> element has been parsed (whether
+ implicitly or explicitly) the <a href=#head-element-pointer><code title="">head</code>
+ element pointer</a> gets set to point to this node.</p>
+
+ <p>The <a href=#form-element-pointer><code title="">form</code> element pointer</a>
+ points to the last <code><a href=#the-form-element>form</a></code> element that was opened and
+ whose end tag has not yet been seen. It is used to make form
+ controls associate with forms in the face of dramatically bad
+ markup, for historical reasons.</p>
+
+
+ <h5 id=other-parsing-state-flags><span class=secno>10.2.3.5 </span>Other parsing state flags</h5>
+
+ <p>The <dfn id=scripting-flag>scripting flag</dfn> is set to "enabled" if <a href=#concept-n-script title=concept-n-script>scripting was enabled</a> for the
+ <code><a href=#document>Document</a></code> with which the parser is associated when the
+ parser was created, and "disabled" otherwise.</p>
+
+ <p class=note>The <a href=#scripting-flag>scripting flag</a> can be enabled even
+ when the parser was originally created for the <a href=#html-fragment-parsing-algorithm>HTML fragment
+ parsing algorithm</a>, even though <code><a href=#script>script</a></code> elements
+ don't execute in that case.</p>
+
+ <p>The <dfn id=frameset-ok-flag>frameset-ok flag</dfn> is set to "ok" when the parser is
+ created. It is set to "not ok" after certain tokens are seen.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=tokenization><span class=secno>10.2.4 </span><dfn>Tokenization</dfn></h4>
+
+ <p>Implementations must act as if they used the following state
+ machine to tokenize HTML. The state machine must start in the
+ <a href=#data-state>data state</a>. Most states consume a single character,
+ which may have various side-effects, and either switches the state
+ machine to a new state to <em>reconsume</em> the same character, or
+ switches it to a new state (to consume the next character), or
+ repeats the same state (to consume the next character). Some states
+ have more complicated behavior and can consume several characters
+ before switching to another state. In some cases, the tokenizer
+ state is also changed by the tree construction stage.</p>
+
+ <p>The exact behavior of certain states depends on the
+ <a href=#insertion-mode>insertion mode</a> and the <a href=#stack-of-open-elements>stack of open
+ elements</a>. Certain states also use a <dfn id=temporary-buffer><var>temporary
+ buffer</var></dfn> to track progress.</p>
+
+ <p>The output of the tokenization step is a series of zero or more
+ of the following tokens: DOCTYPE, start tag, end tag, comment,
+ character, end-of-file. DOCTYPE tokens have a name, a public
+ identifier, a system identifier, and a <i>force-quirks
+ flag</i>. When a DOCTYPE token is created, its name, public
+ identifier, and system identifier must be marked as missing (which
+ is a distinct state from the empty string), and the <i>force-quirks
+ flag</i> must be set to <i>off</i> (its other state is
+ <i>on</i>). Start and end tag tokens have a tag name, a
+ <i>self-closing flag</i>, and a list of attributes, each of which
+ has a name and a value. When a start or end tag token is created,
+ its <i>self-closing flag</i> must be unset (its other state is that
+ it be set), and its attributes list must be empty. Comment and
+ character tokens have data.</p>
+
+ <p>When a token is emitted, it must immediately be handled by the
+ <a href=#tree-construction>tree construction</a> stage. The tree construction stage
+ can affect the state of the tokenization stage, and can insert
+ additional characters into the stream. (For example, the
+ <code><a href=#script>script</a></code> element can result in scripts executing and
+ using the <a href=#dynamic-markup-insertion>dynamic markup insertion</a> APIs to insert
+ characters into the stream being tokenized.)</p>
+
+ <p>When a start tag token is emitted with its <i>self-closing
+ flag</i> set, if the flag is not <dfn id=acknowledge-self-closing-flag title="acknowledge
+ self-closing flag">acknowledged</dfn> when it is processed by the
+ tree construction stage, that is a <a href=#parse-error>parse error</a>.</p>
+
+ <p>When an end tag token is emitted with attributes, that is a
+ <a href=#parse-error>parse error</a>.</p>
+
+ <p>When an end tag token is emitted with its <i>self-closing
+ flag</i> set, that is a <a href=#parse-error>parse error</a>.</p>
+
+ <p>An <dfn id=appropriate-end-tag-token>appropriate end tag token</dfn> is an end tag token whose
+ tag name matches the tag name of the last start tag to have been
+ emitted from this tokenizer, if any. If no start tag has been
+ emitted from this tokenizer, then no end tag token is
+ appropriate.</p>
+
+ <p>Before each step of the tokenizer, the user agent must first
+ check the <a href=#parser-pause-flag>parser pause flag</a>. If it is true, then the
+ tokenizer must abort the processing of any nested invocations of the
+ tokenizer, yielding control back to the caller.</p>
+
+ <p>The tokenizer state machine consists of the states defined in the
+ following subsections.</p>
+
+
+ <!-- Order of the lists below is supposed to be non-error then
+ error, by unicode, then EOF, ending with "anything else" -->
+
+
+ <h5 id=data-state><span class=secno>10.2.4.1 </span><dfn>Data state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0026 AMPERSAND (&amp;)</dt>
+ <dd>Switch to the <a href=#character-reference-in-data-state>character reference in data
+ state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd>Switch to the <a href=#tag-open-state>tag open state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd>Emit an end-of-file token.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Stay in the <a href=#data-state>data state</a>.</dd>
+
+ </dl><h5 id=character-reference-in-data-state><span class=secno>10.2.4.2 </span><dfn>Character reference in data state</dfn></h5>
+
+ <p>Attempt to <a href=#consume-a-character-reference>consume a character reference</a>, with no
+ <a href=#additional-allowed-character>additional allowed character</a>.</p>
+
+ <p>If nothing is returned, emit a U+0026 AMPERSAND character
+ token.</p>
+
+ <p>Otherwise, emit the character token that was returned.</p>
+
+ <p>Finally, switch to the <a href=#data-state>data state</a>.</p>
+
+
+ <h5 id=rcdata-state><span class=secno>10.2.4.3 </span><dfn>RCDATA state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0026 AMPERSAND (&amp;)</dt>
+ <dd>Switch to the <a href=#character-reference-in-rcdata-state>character reference in RCDATA
+ state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd>Switch to the <a href=#rcdata-less-than-sign-state>RCDATA less-than sign state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd>Emit an end-of-file token.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Stay in the <a href=#rcdata-state>RCDATA state</a>.</dd>
+
+ </dl><h5 id=character-reference-in-rcdata-state><span class=secno>10.2.4.4 </span><dfn>Character reference in RCDATA state</dfn></h5>
+
+ <p>Attempt to <a href=#consume-a-character-reference>consume a character reference</a>, with no
+ <a href=#additional-allowed-character>additional allowed character</a>.</p>
+
+ <p>If nothing is returned, emit a U+0026 AMPERSAND character
+ token.</p>
+
+ <p>Otherwise, emit the character token that was returned.</p>
+
+ <p>Finally, switch to the <a href=#rcdata-state>RCDATA state</a>.</p>
+
+
+ <h5 id=rawtext-state><span class=secno>10.2.4.5 </span><dfn>RAWTEXT state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd>Switch to the <a href=#rawtext-less-than-sign-state>RAWTEXT less-than sign state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd>Emit an end-of-file token.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Stay in the <a href=#rawtext-state>RAWTEXT state</a>.</dd>
+
+ </dl><h5 id=script-data-state><span class=secno>10.2.4.6 </span><dfn>Script data state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd>Switch to the <a href=#script-data-less-than-sign-state>script data less-than sign state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd>Emit an end-of-file token.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Stay in the <a href=#script-data-state>script data state</a>.</dd>
+
+ </dl><h5 id=plaintext-state><span class=secno>10.2.4.7 </span><dfn>PLAINTEXT state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>EOF</dt>
+ <dd>Emit an end-of-file token.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Stay in the <a href=#plaintext-state>PLAINTEXT state</a>.</dd>
+
+ </dl><h5 id=tag-open-state><span class=secno>10.2.4.8 </span><dfn>Tag open state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0021 EXCLAMATION MARK (!)</dt>
+ <dd>Switch to the <a href=#markup-declaration-open-state>markup declaration open state</a>.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>Switch to the <a href=#end-tag-open-state>end tag open state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Create a new start tag token, set its tag name to the
+ lowercase version of the <a href=#current-input-character>current input character</a> (add 0x0020 to the
+ character's code point), then switch to the <a href=#tag-name-state>tag name
+ state</a>. (Don't emit the token yet; further details will
+ be filled in before it is emitted.)</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Create a new start tag token, set its tag name to the
+ <a href=#current-input-character>current input character</a>, then switch to the <a href=#tag-name-state>tag
+ name state</a>. (Don't emit the token yet; further details will
+ be filled in before it is emitted.)</dd>
+
+ <dt>U+003F QUESTION MARK (?)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#bogus-comment-state>bogus
+ comment state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit a U+003C LESS-THAN SIGN
+ character token and reconsume the <a href=#current-input-character>current input
+ character</a> in the <a href=#data-state>data state</a>.</dd>
+
+ </dl><h5 id=end-tag-open-state><span class=secno>10.2.4.9 </span><dfn>End tag open state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Create a new end tag token, set its tag name to the lowercase
+ version of the <a href=#current-input-character>current input character</a> (add 0x0020 to
+ the character's code point), then switch to the <a href=#tag-name-state>tag name
+ state</a>. (Don't emit the token yet; further details will be
+ filled in before it is emitted.)</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Create a new end tag token, set its tag name to the
+ <a href=#current-input-character>current input character</a>, then switch to the <a href=#tag-name-state>tag
+ name state</a>. (Don't emit the token yet; further details will
+ be filled in before it is emitted.)</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit a U+003C LESS-THAN SIGN
+ character token and a U+002F SOLIDUS character token. Reconsume
+ the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#bogus-comment-state>bogus
+ comment state</a>.</dd>
+
+ </dl><h5 id=tag-name-state><span class=secno>10.2.4.10 </span><dfn>Tag name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current tag token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ current tag token's tag name. Stay in the <a href=#tag-name-state>tag name
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ tag token's tag name. Stay in the <a href=#tag-name-state>tag name state</a>.</dd>
+
+ </dl><h5 id=rcdata-less-than-sign-state><span class=secno>10.2.4.11 </span><dfn>RCDATA less-than sign state</dfn></h5>
+ <!-- identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
+ <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
+ to the <a href=#rcdata-end-tag-open-state>RCDATA end tag open state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
+ <a href=#current-input-character>current input character</a> in the <a href=#rcdata-state>RCDATA
+ state</a>.</dd>
+
+ </dl><h5 id=rcdata-end-tag-open-state><span class=secno>10.2.4.12 </span><dfn>RCDATA end tag open state</dfn></h5>
+ <!-- identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ lowercase version of the <a href=#current-input-character>current input character</a> (add
+ 0x0020 to the character's code point). Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#rcdata-end-tag-name-state>RCDATA end tag name state</a>. (Don't emit
+ the token yet; further details will be filled in before it is
+ emitted.)</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#rcdata-end-tag-name-state>RCDATA end tag name state</a>. (Don't emit
+ the token yet; further details will be filled in before it is
+ emitted.)</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, and reconsume the <a href=#current-input-character>current input
+ character</a> in the <a href=#rcdata-state>RCDATA state</a>.</dd>
+
+ </dl><h5 id=rcdata-end-tag-name-state><span class=secno>10.2.4.13 </span><dfn>RCDATA end tag name state</dfn></h5>
+ <!-- identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then emit the current tag token and switch to the
+ <a href=#data-state>data state</a>. Otherwise, treat it as per the "anything
+ else" entry below.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ current tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#rcdata-end-tag-name-state>RCDATA end tag name state</a>.</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#rcdata-end-tag-name-state>RCDATA end tag name state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, a character token for each of the characters in
+ the <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to
+ the buffer), and reconsume the <a href=#current-input-character>current input character</a>
+ in the <a href=#rcdata-state>RCDATA state</a>.</dd>
+
+ </dl><h5 id=rawtext-less-than-sign-state><span class=secno>10.2.4.14 </span><dfn>RAWTEXT less-than sign state</dfn></h5>
+ <!-- identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
+ <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
+ to the <a href=#rawtext-end-tag-open-state>RAWTEXT end tag open state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
+ <a href=#current-input-character>current input character</a> in the <a href=#rawtext-state>RAWTEXT
+ state</a>.</dd>
+
+ </dl><h5 id=rawtext-end-tag-open-state><span class=secno>10.2.4.15 </span><dfn>RAWTEXT end tag open state</dfn></h5>
+ <!-- identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ lowercase version of the <a href=#current-input-character>current input character</a> (add
+ 0x0020 to the character's code point). Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#rawtext-end-tag-name-state>RAWTEXT end tag name state</a>. (Don't emit
+ the token yet; further details will be filled in before it is
+ emitted.)</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#rawtext-end-tag-name-state>RAWTEXT end tag name state</a>. (Don't emit
+ the token yet; further details will be filled in before it is
+ emitted.)</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, and reconsume the <a href=#current-input-character>current input
+ character</a> in the <a href=#rawtext-state>RAWTEXT state</a>.</dd>
+
+ </dl><h5 id=rawtext-end-tag-name-state><span class=secno>10.2.4.16 </span><dfn>RAWTEXT end tag name state</dfn></h5>
+ <!-- identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then emit the current tag token and switch to the
+ <a href=#data-state>data state</a>. Otherwise, treat it as per the "anything
+ else" entry below.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ current tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#rawtext-end-tag-name-state>RAWTEXT end tag name state</a>.</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#rawtext-end-tag-name-state>RAWTEXT end tag name state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, a character token for each of the characters in
+ the <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to
+ the buffer), and reconsume the <a href=#current-input-character>current input character</a>
+ in the <a href=#rawtext-state>RAWTEXT state</a>.</dd>
+
+ </dl><h5 id=script-data-less-than-sign-state><span class=secno>10.2.4.17 </span><dfn>Script data less-than sign state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
+ <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
+ to the <a href=#script-data-end-tag-open-state>script data end tag open state</a>.</dd>
+
+ <dt>U+0021 EXCLAMATION MARK (!)</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token and a U+0021
+ EXCLAMATION MARK character token. Switch to the <a href=#script-data-escape-start-state>script data
+ escape start state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
+ <a href=#current-input-character>current input character</a> in the <a href=#script-data-state>script data
+ state</a>.</dd>
+
+ </dl><h5 id=script-data-end-tag-open-state><span class=secno>10.2.4.18 </span><dfn>Script data end tag open state</dfn></h5>
+ <!-- identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ lowercase version of the <a href=#current-input-character>current input character</a> (add
+ 0x0020 to the character's code point). Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#script-data-end-tag-name-state>script data end tag name state</a>. (Don't emit
+ the token yet; further details will be filled in before it is
+ emitted.)</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#script-data-end-tag-name-state>script data end tag name state</a>. (Don't emit
+ the token yet; further details will be filled in before it is
+ emitted.)</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, and reconsume the <a href=#current-input-character>current input
+ character</a> in the <a href=#script-data-state>script data state</a>.</dd>
+
+ </dl><h5 id=script-data-end-tag-name-state><span class=secno>10.2.4.19 </span><dfn>Script data end tag name state</dfn></h5>
+ <!-- identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g -->
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then emit the current tag token and switch to the
+ <a href=#data-state>data state</a>. Otherwise, treat it as per the "anything
+ else" entry below.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ current tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#script-data-end-tag-name-state>script data end tag name state</a>.</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#script-data-end-tag-name-state>script data end tag name state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, a character token for each of the characters in
+ the <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to
+ the buffer), and reconsume the <a href=#current-input-character>current input character</a>
+ in the <a href=#script-data-state>script data state</a>.</dd>
+
+ </dl><h5 id=script-data-escape-start-state><span class=secno>10.2.4.20 </span><dfn>Script data escape start state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Switch to the
+ <a href=#script-data-escape-start-dash-state>script data escape start dash state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Reconsume the <a href=#current-input-character>current input character</a> in the
+ <a href=#script-data-state>script data state</a>.</dd>
+
+ </dl><h5 id=script-data-escape-start-dash-state><span class=secno>10.2.4.21 </span><dfn>Script data escape start dash state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Switch to the
+ <a href=#script-data-escaped-dash-dash-state>script data escaped dash dash state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Reconsume the <a href=#current-input-character>current input character</a> in the
+ <a href=#script-data-state>script data state</a>.</dd>
+
+ </dl><h5 id=script-data-escaped-state><span class=secno>10.2.4.22 </span><dfn>Script data escaped state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Switch to the
+ <a href=#script-data-escaped-dash-state>script data escaped dash state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><p>Switch to the <a href=#script-data-escaped-less-than-sign-state>script data escaped less-than sign
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Stay in the <a href=#script-data-escaped-state>script data escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-escaped-dash-state><span class=secno>10.2.4.23 </span><dfn>Script data escaped dash state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Switch to the
+ <a href=#script-data-escaped-dash-dash-state>script data escaped dash dash state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><p>Switch to the <a href=#script-data-escaped-less-than-sign-state>script data escaped less-than sign
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Switch to the <a href=#script-data-escaped-state>script data escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-escaped-dash-dash-state><span class=secno>10.2.4.24 </span><dfn>Script data escaped dash dash state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Stay in the
+ <a href=#script-data-escaped-dash-dash-state>script data escaped dash dash state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><p>Switch to the <a href=#script-data-escaped-less-than-sign-state>script data escaped less-than sign
+ state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit a U+003E GREATER-THAN SIGN character token. Switch to the
+ <a href=#script-data-state>script data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Switch to the <a href=#script-data-escaped-state>script data escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-escaped-less-than-sign-state><span class=secno>10.2.4.25 </span><dfn>Script data escaped less-than sign state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
+ <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
+ to the <a href=#script-data-escaped-end-tag-open-state>script data escaped end tag open state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token and the
+ <a href=#current-input-character>current input character</a> as a character token. Set the
+ <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Append the
+ lowercase version of the <a href=#current-input-character>current input character</a> (add
+ 0x0020 to the character's code point) to the <var><a href=#temporary-buffer>temporary
+ buffer</a></var>. Switch to the <a href=#script-data-double-escape-start-state>script data double escape start
+ state</a>.</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token and the
+ <a href=#current-input-character>current input character</a> as a character token. Set the
+ <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Append the
+ <a href=#current-input-character>current input character</a> to the <var><a href=#temporary-buffer>temporary
+ buffer</a></var>. Switch to the <a href=#script-data-double-escape-start-state>script data double escape start
+ state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
+ <a href=#current-input-character>current input character</a> in the <a href=#script-data-escaped-state>script data
+ escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-escaped-end-tag-open-state><span class=secno>10.2.4.26 </span><dfn>Script data escaped end tag open state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ lowercase version of the <a href=#current-input-character>current input character</a> (add
+ 0x0020 to the character's code point). Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#script-data-escaped-end-tag-name-state>script data escaped end tag name
+ state</a>. (Don't emit the token yet; further details will be
+ filled in before it is emitted.)</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Create a new end tag token, and set its tag name to the
+ <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
+ input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
+ switch to the <a href=#script-data-escaped-end-tag-name-state>script data escaped end tag name
+ state</a>. (Don't emit the token yet; further details will be
+ filled in before it is emitted.)</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, and reconsume the <a href=#current-input-character>current input
+ character</a> in the <a href=#script-data-escaped-state>script data escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-escaped-end-tag-name-state><span class=secno>10.2.4.27 </span><dfn>Script data escaped end tag name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
+ state</a>. Otherwise, treat it as per the "anything else" entry
+ below.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
+ token</a>, then emit the current tag token and switch to the
+ <a href=#data-state>data state</a>. Otherwise, treat it as per the "anything
+ else" entry below.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ current tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#script-data-escaped-end-tag-name-state>script data escaped end tag name state</a>.</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ tag token's tag name. Append the <a href=#current-input-character>current input
+ character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the
+ <a href=#script-data-escaped-end-tag-name-state>script data escaped end tag name state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
+ character token, a character token for each of the characters in
+ the <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to
+ the buffer), and reconsume the <a href=#current-input-character>current input character</a>
+ in the <a href=#script-data-escaped-state>script data escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-double-escape-start-state><span class=secno>10.2.4.28 </span><dfn>Script data double escape start state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. If the <var><a href=#temporary-buffer>temporary buffer</a></var> is the string "<code title="">script</code>", then switch to the <a href=#script-data-double-escaped-state>script data
+ double escaped state</a>. Otherwise, switch to the <a href=#script-data-escaped-state>script
+ data escaped state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the <a href=#script-data-double-escape-start-state>script data double
+ escape start state</a>.</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Append the <a href=#current-input-character>current input character</a> to the
+ <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the <a href=#script-data-double-escape-start-state>script data double
+ escape start state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Reconsume the <a href=#current-input-character>current input character</a> in the
+ <a href=#script-data-escaped-state>script data escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-double-escaped-state><span class=secno>10.2.4.29 </span><dfn>Script data double escaped state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Switch to the
+ <a href=#script-data-double-escaped-dash-state>script data double escaped dash state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><p>Emit a U+003C LESS-THAN SIGN character token. Switch to the
+ <a href=#script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Stay in the <a href=#script-data-double-escaped-state>script data double escaped
+ state</a>.</dd>
+
+ </dl><h5 id=script-data-double-escaped-dash-state><span class=secno>10.2.4.30 </span><dfn>Script data double escaped dash state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Switch to the
+ <a href=#script-data-double-escaped-dash-dash-state>script data double escaped dash dash state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><p>Emit a U+003C LESS-THAN SIGN character token. Switch to the
+ <a href=#script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Switch to the <a href=#script-data-double-escaped-state>script data double escaped
+ state</a>.</dd>
+
+ </dl><h5 id=script-data-double-escaped-dash-dash-state><span class=secno>10.2.4.31 </span><dfn>Script data double escaped dash dash state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Emit a U+002D HYPHEN-MINUS character token. Stay in the
+ <a href=#script-data-double-escaped-dash-dash-state>script data double escaped dash dash state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><p>Emit a U+003C LESS-THAN SIGN character token. Switch to the
+ <a href=#script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign
+ state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit a U+003E GREATER-THAN SIGN character token. Switch to the
+ <a href=#script-data-state>script data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Switch to the <a href=#script-data-double-escaped-state>script data double escaped
+ state</a>.</dd>
+
+ </dl><h5 id=script-data-double-escaped-less-than-sign-state><span class=secno>10.2.4.32 </span><dfn>Script data double escaped less-than sign state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
+ <dd>Emit a U+002F SOLIDUS character token. Set the <var><a href=#temporary-buffer>temporary
+ buffer</a></var> to the empty string. Switch to the <a href=#script-data-double-escape-end-state>script data
+ double escape end state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Reconsume the <a href=#current-input-character>current input character</a> in the
+ <a href=#script-data-double-escaped-state>script data double escaped state</a>.</dd>
+
+ </dl><h5 id=script-data-double-escape-end-state><span class=secno>10.2.4.33 </span><dfn>Script data double escape end state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. If the <var><a href=#temporary-buffer>temporary buffer</a></var> is the string "<code title="">script</code>", then switch to the <a href=#script-data-escaped-state>script data
+ escaped state</a>. Otherwise, switch to the <a href=#script-data-double-escaped-state>script data
+ double escaped state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the <a href=#script-data-double-escape-end-state>script data double
+ escape end state</a>.</dd>
+
+ <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
+ <dd>Emit the <a href=#current-input-character>current input character</a> as a character
+ token. Append the <a href=#current-input-character>current input character</a> to the
+ <var><a href=#temporary-buffer>temporary buffer</a></var>. Stay in the <a href=#script-data-double-escape-end-state>script data double
+ escape end state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Reconsume the <a href=#current-input-character>current input character</a> in the
+ <a href=#script-data-double-escaped-state>script data double escaped state</a>.</dd>
+
+ </dl><h5 id=before-attribute-name-state><span class=secno>10.2.4.34 </span><dfn>Before attribute name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current tag token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Start a new attribute in the current tag token. Set that
+ attribute's name to the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point), and its
+ value to the empty string. Switch to the <a href=#attribute-name-state>attribute name
+ state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dt>U+003D EQUALS SIGN (=)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
+ entry below.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Start a new attribute in the current tag token. Set that
+ attribute's name to the <a href=#current-input-character>current input character</a>, and its value to
+ the empty string. Switch to the <a href=#attribute-name-state>attribute name
+ state</a>.</dd>
+
+ </dl><h5 id=attribute-name-state><span class=secno>10.2.4.35 </span><dfn>Attribute name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#after-attribute-name-state>after attribute name state</a>.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>
+
+ <dt>U+003D EQUALS SIGN (=)</dt>
+ <dd>Switch to the <a href=#before-attribute-value-state>before attribute value state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current tag token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ current attribute's name. Stay in the <a href=#attribute-name-state>attribute name
+ state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
+ entry below.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ attribute's name. Stay in the <a href=#attribute-name-state>attribute name
+ state</a>.</dd>
+
+ </dl><p>When the user agent leaves the attribute name state (and before
+ emitting the tag token, if appropriate), the complete attribute's
+ name must be compared to the other attributes on the same token;
+ if there is already an attribute on the token with the exact same
+ name, then this is a <a href=#parse-error>parse error</a> and the new
+ attribute must be dropped, along with the value that gets
+ associated with it (if any).</p>
+
+
+ <h5 id=after-attribute-name-state><span class=secno>10.2.4.36 </span><dfn>After attribute name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#after-attribute-name-state>after attribute name state</a>.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>
+
+ <dt>U+003D EQUALS SIGN (=)</dt>
+ <dd>Switch to the <a href=#before-attribute-value-state>before attribute value state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current tag token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Start a new attribute in the current tag token. Set that
+ attribute's name to the lowercase version of the <a href=#current-input-character>current
+ input character</a> (add 0x0020 to the character's code point),
+ and its value to the empty string. Switch to the <a href=#attribute-name-state>attribute
+ name state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
+ entry below.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Start a new attribute in the current tag token. Set that
+ attribute's name to the <a href=#current-input-character>current input character</a>, and
+ its value to the empty string. Switch to the <a href=#attribute-name-state>attribute name
+ state</a>.</dd>
+
+ </dl><h5 id=before-attribute-value-state><span class=secno>10.2.4.37 </span><dfn>Before attribute value state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#before-attribute-value-state>before attribute value state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dd>Switch to the <a href=#attribute-value-(double-quoted)-state>attribute value (double-quoted) state</a>.</dd>
+
+ <dt>U+0026 AMPERSAND (&amp;)</dt>
+ <dd>Switch to the <a href=#attribute-value-(unquoted)-state>attribute value (unquoted) state</a>
+ and reconsume this <a href=#current-input-character>current input character</a>.</dd>
+
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dd>Switch to the <a href=#attribute-value-(single-quoted)-state>attribute value (single-quoted) state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the current tag token. Switch to
+ the <a href=#data-state>data state</a>.</dd>
+
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dt>U+003D EQUALS SIGN (=)</dt>
+ <dt>U+0060 GRAVE ACCENT (`)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
+ entry below.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ attribute's value. Switch to the <a href=#attribute-value-(unquoted)-state>attribute value (unquoted)
+ state</a>.</dd>
+
+ </dl><h5 id=attribute-value-(double-quoted)-state><span class=secno>10.2.4.38 </span><dfn>Attribute value (double-quoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0022 QUOTATION MARK (")</dt>
+ <dd>Switch to the <a href=#after-attribute-value-(quoted)-state>after attribute value (quoted)
+ state</a>.</dd>
+
+ <dt>U+0026 AMPERSAND (&amp;)</dt>
+ <dd>Switch to the <a href=#character-reference-in-attribute-value-state>character reference in attribute value
+ state</a>, with the <a href=#additional-allowed-character>additional allowed character</a>
+ being U+0022 QUOTATION MARK (").</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ attribute's value. Stay in the <a href=#attribute-value-(double-quoted)-state>attribute value
+ (double-quoted) state</a>.</dd>
+
+ </dl><h5 id=attribute-value-(single-quoted)-state><span class=secno>10.2.4.39 </span><dfn>Attribute value (single-quoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0027 APOSTROPHE (')</dt>
+ <dd>Switch to the <a href=#after-attribute-value-(quoted)-state>after attribute value (quoted)
+ state</a>.</dd>
+
+ <dt>U+0026 AMPERSAND (&amp;)</dt>
+ <dd>Switch to the <a href=#character-reference-in-attribute-value-state>character reference in attribute value
+ state</a>, with the <a href=#additional-allowed-character>additional allowed character</a>
+ being U+0027 APOSTROPHE (').</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ attribute's value. Stay in the <a href=#attribute-value-(single-quoted)-state>attribute value
+ (single-quoted) state</a>.</dd>
+
+ </dl><h5 id=attribute-value-(unquoted)-state><span class=secno>10.2.4.40 </span><dfn>Attribute value (unquoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>
+
+ <dt>U+0026 AMPERSAND (&amp;)</dt>
+ <dd>Switch to the <a href=#character-reference-in-attribute-value-state>character reference in attribute value
+ state</a>, with the <a href=#additional-allowed-character>additional allowed character</a>
+ being U+003E GREATER-THAN SIGN (&gt;).</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current tag token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
+ <dt>U+003D EQUALS SIGN (=)</dt>
+ <dt>U+0060 GRAVE ACCENT (`)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
+ entry below.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ attribute's value. Stay in the <a href=#attribute-value-(unquoted)-state>attribute value (unquoted)
+ state</a>.</dd>
+
+ </dl><h5 id=character-reference-in-attribute-value-state><span class=secno>10.2.4.41 </span><dfn>Character reference in attribute value state</dfn></h5>
+
+ <p>Attempt to <a href=#consume-a-character-reference>consume a character reference</a>.</p>
+
+ <p>If nothing is returned, append a U+0026 AMPERSAND character to
+ the current attribute's value.</p>
+
+ <p>Otherwise, append the returned character token to the current
+ attribute's value.</p>
+
+ <p>Finally, switch back to the attribute value state that you were
+ in when were switched into this state.</p>
+
+
+ <h5 id=after-attribute-value-(quoted)-state><span class=secno>10.2.4.42 </span><dfn>After attribute value (quoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>
+
+ <dt>U+002F SOLIDUS (/)</dt>
+ <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current tag token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the character in
+ the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>
+
+ </dl><h5 id=self-closing-start-tag-state><span class=secno>10.2.4.43 </span><dfn>Self-closing start tag state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Set the <i>self-closing flag</i> of the current tag
+ token. Emit the current tag token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the character in
+ the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>
+
+ </dl><h5 id=bogus-comment-state><span class=secno>10.2.4.44 </span><dfn>Bogus comment state</dfn></h5>
+
+ <p>Consume every character up to and including the first U+003E
+ GREATER-THAN SIGN character (&gt;) or the end of the file (EOF),
+ whichever comes first. Emit a comment token whose data is the
+ concatenation of all the characters starting from and including
+ the character that caused the state machine to switch into the
+ bogus comment state, up to and including the character immediately
+ before the last consumed character (i.e. up to the character just
+ before the U+003E or EOF character). (If the comment was started
+ by the end of the file (EOF), the token is empty.)</p>
+
+ <p>Switch to the <a href=#data-state>data state</a>.</p>
+
+ <p>If the end of the file was reached, reconsume the EOF
+ character.</p>
+
+
+ <h5 id=markup-declaration-open-state><span class=secno>10.2.4.45 </span><dfn>Markup declaration open state</dfn></h5>
+
+ <p>If the next two characters are both U+002D HYPHEN-MINUS
+ characters (-), consume those two characters, create a comment token
+ whose data is the empty string, and switch to the <a href=#comment-start-state>comment
+ start state</a>.</p>
+
+ <p>Otherwise, if the next seven characters are an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the word "DOCTYPE", then consume
+ those characters and switch to the <a href=#doctype-state>DOCTYPE state</a>.</p>
+
+ <p>Otherwise, if the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
+ content</a>" and the <a href=#current-node>current node</a> is not an element
+ in the <a href=#html-namespace-0>HTML namespace</a> and the next seven characters are
+ an <a href=#case-sensitive>case-sensitive</a> match for the string "[CDATA[" (the
+ five uppercase letters "CDATA" with a U+005B LEFT SQUARE BRACKET
+ character before and after), then consume those characters and
+ switch to the <a href=#cdata-section-state>CDATA section state</a>.</p>
+
+ <p>Otherwise, this is a <a href=#parse-error>parse error</a>. Switch to the
+ <a href=#bogus-comment-state>bogus comment state</a>. The next character that is
+ consumed, if any, is the first character that will be in the
+ comment.</p>
+
+
+ <h5 id=comment-start-state><span class=secno>10.2.4.46 </span><dfn>Comment start state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Switch to the <a href=#comment-start-dash-state>comment start dash state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Switch to the
+ <a href=#data-state>data state</a>.</dd> <!-- see comment in comment end state
+ -->
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Reconsume
+ the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the comment
+ token's data. Switch to the <a href=#comment-state>comment state</a>.</dd>
+
+ </dl><h5 id=comment-start-dash-state><span class=secno>10.2.4.47 </span><dfn>Comment start dash state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Switch to the <a href=#comment-end-state>comment end state</a></dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Switch to
+ the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Reconsume the
+ EOF character in the <a href=#data-state>data state</a>.</dd> <!-- see comment
+ in comment end state -->
+
+ <dt>Anything else</dt>
+ <dd>Append a U+002D HYPHEN-MINUS character (-) and the
+ <a href=#current-input-character>current input character</a> to the comment token's
+ data. Switch to the <a href=#comment-state>comment state</a>.</dd>
+
+ </dl><h5 id=comment-state><span class=secno>10.2.4.48 </span><dfn id=comment>Comment state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Switch to the <a href=#comment-end-dash-state>comment end dash state</a></dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Reconsume the
+ EOF character in the <a href=#data-state>data state</a>.</dd> <!-- see comment
+ in comment end state -->
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the comment
+ token's data. Stay in the <a href=#comment-state>comment state</a>.</dd>
+
+ </dl><h5 id=comment-end-dash-state><span class=secno>10.2.4.49 </span><dfn>Comment end dash state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Switch to the <a href=#comment-end-state>comment end state</a></dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Reconsume the
+ EOF character in the <a href=#data-state>data state</a>.</dd> <!-- see comment
+ in comment end state -->
+
+ <dt>Anything else</dt>
+ <dd>Append a U+002D HYPHEN-MINUS character (-) and the
+ <a href=#current-input-character>current input character</a> to the comment token's
+ data. Switch to the <a href=#comment-state>comment state</a>.</dd>
+
+ </dl><h5 id=comment-end-state><span class=secno>10.2.4.50 </span><dfn>Comment end state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the comment token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd><a href=#parse-error>Parse error</a>. Append two U+002D HYPHEN-MINUS
+ characters (-) and the <a href=#current-input-character>current input character</a> to the
+ comment token's data. Switch to the <a href=#comment-end-space-state>comment end space
+ state</a>.</dd>
+
+ <dt>U+0021 EXCLAMATION MARK (!)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#comment-end-bang-state>comment end bang
+ state</a>.</dd>
+
+ <dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Append a U+002D HYPHEN-MINUS
+ character (-) to the comment token's data. Stay in the
+ <a href=#comment-end-state>comment end state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Reconsume
+ the EOF character in the <a href=#data-state>data state</a>.</dd> <!-- For
+ security reasons: otherwise, hostile user could put a <script> in
+ a comment e.g. in a blog comment and then DOS the server so that
+ the end tag isn't read, and then the commented <script> tag would
+ be treated as live code -->
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Append two U+002D HYPHEN-MINUS
+ characters (-) and the <a href=#current-input-character>current input character</a> to the
+ comment token's data. Switch to the <a href=#comment-state>comment
+ state</a>.</dd>
+
+ </dl><h5 id=comment-end-bang-state><span class=secno>10.2.4.51 </span><dfn>Comment end bang state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Append two U+002D HYPHEN-MINUS characters (-) and a U+0021
+ EXCLAMATION MARK character (!) to the comment token's data. Switch
+ to the <a href=#comment-end-dash-state>comment end dash state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the comment token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Reconsume
+ the EOF character in the <a href=#data-state>data state</a>.</dd> <!-- see
+ comment in comment end state -->
+
+ <dt>Anything else</dt>
+ <dd>Append two U+002D HYPHEN-MINUS characters (-), a U+0021
+ EXCLAMATION MARK character (!), and the <a href=#current-input-character>current input
+ character</a> to the comment token's data. Switch to the
+ <a href=#comment-state>comment state</a>.</dd>
+
+ </dl><h5 id=comment-end-space-state><span class=secno>10.2.4.52 </span><dfn>Comment end space state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the comment token's data. Stay in
+ the <a href=#comment-end-space-state>comment end space state</a>.</dd>
+
+ <dt>U+002D HYPHEN-MINUS (-)</dt>
+ <dd>Switch to the <a href=#comment-end-dash-state>comment end dash state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the comment token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Emit the comment token. Reconsume
+ the EOF character in the <a href=#data-state>data state</a>.</dd> <!-- see
+ comment in comment end state -->
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the comment token's data. Switch
+ to the <a href=#comment-state>comment state</a>.</dd>
+
+ </dl><h5 id=doctype-state><span class=secno>10.2.4.53 </span><dfn>DOCTYPE state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#before-doctype-name-state>before DOCTYPE name state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Create a new DOCTYPE token. Set its
+ <i>force-quirks flag</i> to <i>on</i>. Emit the token. Reconsume
+ the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Reconsume the character in the
+ <a href=#before-doctype-name-state>before DOCTYPE name state</a>.</dd>
+
+ </dl><h5 id=before-doctype-name-state><span class=secno>10.2.4.54 </span><dfn>Before DOCTYPE name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#before-doctype-name-state>before DOCTYPE name state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Create a new DOCTYPE token. Set the token's name to the
+ lowercase version of the <a href=#current-input-character>current input character</a> (add 0x0020 to the
+ character's code point). Switch to the <a href=#doctype-name-state>DOCTYPE name
+ state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Create a new DOCTYPE token. Set its
+ <i>force-quirks flag</i> to <i>on</i>. Emit the token. Switch to
+ the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Create a new DOCTYPE token. Set its
+ <i>force-quirks flag</i> to <i>on</i>. Emit the token. Reconsume
+ the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Create a new DOCTYPE token. Set the token's name to the
+ <a href=#current-input-character>current input character</a>. Switch to the <a href=#doctype-name-state>DOCTYPE name
+ state</a>.</dd>
+
+ </dl><h5 id=doctype-name-state><span class=secno>10.2.4.55 </span><dfn>DOCTYPE name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#after-doctype-name-state>after DOCTYPE name state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current DOCTYPE token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
+ <dd>Append the lowercase version of the <a href=#current-input-character>current input
+ character</a> (add 0x0020 to the character's code point) to the
+ current DOCTYPE token's name. Stay in the <a href=#doctype-name-state>DOCTYPE name
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ DOCTYPE token's name. Stay in the <a href=#doctype-name-state>DOCTYPE name
+ state</a>.</dd>
+
+ </dl><h5 id=after-doctype-name-state><span class=secno>10.2.4.56 </span><dfn>After DOCTYPE name state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#after-doctype-name-state>after DOCTYPE name state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current DOCTYPE token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p>If the six characters starting from the <a href=#current-input-character>current input
+ character</a> are an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match
+ for the word "PUBLIC", then consume those characters and switch to
+ the <a href=#after-doctype-public-keyword-state>after DOCTYPE public keyword state</a>.</p>
+
+ <p>Otherwise, if the six characters starting from the
+ <a href=#current-input-character>current input character</a> are an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the word "SYSTEM", then consume
+ those characters and switch to the <a href=#after-doctype-system-keyword-state>after DOCTYPE system
+ keyword state</a>.</p>
+
+ <p>Otherwise, this is the <a href=#parse-error>parse error</a>. Set the
+ DOCTYPE token's <i>force-quirks flag</i> to <i>on</i>. Switch to
+ the <a href=#bogus-doctype-state>bogus DOCTYPE state</a>.</p>
+
+ </dd>
+
+ </dl><h5 id=after-doctype-public-keyword-state><span class=secno>10.2.4.57 </span><dfn>After DOCTYPE public keyword state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#before-doctype-public-identifier-state>before DOCTYPE public identifier
+ state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's public
+ identifier to the empty string (not missing), then switch to the
+ <a href=#doctype-public-identifier-(double-quoted)-state>DOCTYPE public identifier (double-quoted) state</a>.</dd>
+
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's public
+ identifier to the empty string (not missing), then switch to the
+ <a href=#doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier (single-quoted) state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
+ DOCTYPE state</a>.</dd>
+
+ </dl><h5 id=before-doctype-public-identifier-state><span class=secno>10.2.4.58 </span><dfn>Before DOCTYPE public identifier state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#before-doctype-public-identifier-state>before DOCTYPE public identifier state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dd>Set the DOCTYPE token's public identifier to the empty string
+ (not missing), then switch to the <a href=#doctype-public-identifier-(double-quoted)-state>DOCTYPE public identifier
+ (double-quoted) state</a>.</dd>
+
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dd>Set the DOCTYPE token's public identifier to the empty string
+ (not missing), then switch to the <a href=#doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier
+ (single-quoted) state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
+ DOCTYPE state</a>.</dd>
+
+ </dl><h5 id=doctype-public-identifier-(double-quoted)-state><span class=secno>10.2.4.59 </span><dfn>DOCTYPE public identifier (double-quoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0022 QUOTATION MARK (")</dt>
+ <dd>Switch to the <a href=#after-doctype-public-identifier-state>after DOCTYPE public identifier state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current DOCTYPE
+ token's public identifier. Stay in the <a href=#doctype-public-identifier-(double-quoted)-state>DOCTYPE public
+ identifier (double-quoted) state</a>.</dd>
+
+ </dl><h5 id=doctype-public-identifier-(single-quoted)-state><span class=secno>10.2.4.60 </span><dfn>DOCTYPE public identifier (single-quoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0027 APOSTROPHE (')</dt>
+ <dd>Switch to the <a href=#after-doctype-public-identifier-state>after DOCTYPE public identifier state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current DOCTYPE
+ token's public identifier. Stay in the <a href=#doctype-public-identifier-(single-quoted)-state>DOCTYPE public
+ identifier (single-quoted) state</a>.</dd>
+
+ </dl><h5 id=after-doctype-public-identifier-state><span class=secno>10.2.4.61 </span><dfn>After DOCTYPE public identifier state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#between-doctype-public-and-system-identifiers-state>between DOCTYPE public and system
+ identifiers state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current DOCTYPE token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
+ identifier to the empty string (not missing), then switch to the
+ <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.</dd>
+
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
+ identifier to the empty string (not missing), then switch to the
+ <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
+ DOCTYPE state</a>.</dd>
+
+ </dl><h5 id=between-doctype-public-and-system-identifiers-state><span class=secno>10.2.4.62 </span><dfn>Between DOCTYPE public and system identifiers state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#between-doctype-public-and-system-identifiers-state>between DOCTYPE public and system identifiers
+ state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current DOCTYPE token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dd>Set the DOCTYPE token's system identifier to the empty string
+ (not missing), then switch to the <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier
+ (double-quoted) state</a>.</dd>
+
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dd>Set the DOCTYPE token's system identifier to the empty string
+ (not missing), then switch to the <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier
+ (single-quoted) state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
+ DOCTYPE state</a>.</dd>
+
+ </dl><h5 id=after-doctype-system-keyword-state><span class=secno>10.2.4.63 </span><dfn>After DOCTYPE system keyword state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Switch to the <a href=#before-doctype-system-identifier-state>before DOCTYPE system identifier
+ state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
+ identifier to the empty string (not missing), then switch to the
+ <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.</dd>
+
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
+ identifier to the empty string (not missing), then switch to the
+ <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
+ DOCTYPE state</a>.</dd>
+
+ </dl><h5 id=before-doctype-system-identifier-state><span class=secno>10.2.4.64 </span><dfn>Before DOCTYPE system identifier state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#before-doctype-system-identifier-state>before DOCTYPE system identifier state</a>.</dd>
+
+ <dt>U+0022 QUOTATION MARK (")</dt>
+ <dd>Set the DOCTYPE token's system identifier to the empty string
+ (not missing), then switch to the <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier
+ (double-quoted) state</a>.</dd>
+
+ <dt>U+0027 APOSTROPHE (')</dt>
+ <dd>Set the DOCTYPE token's system identifier to the empty string
+ (not missing), then switch to the <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier
+ (single-quoted) state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
+ DOCTYPE state</a>.</dd>
+
+ </dl><h5 id=doctype-system-identifier-(double-quoted)-state><span class=secno>10.2.4.65 </span><dfn>DOCTYPE system identifier (double-quoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0022 QUOTATION MARK (")</dt>
+ <dd>Switch to the <a href=#after-doctype-system-identifier-state>after DOCTYPE system identifier
+ state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ DOCTYPE token's system identifier. Stay in the <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system
+ identifier (double-quoted) state</a>.</dd>
+
+ </dl><h5 id=doctype-system-identifier-(single-quoted)-state><span class=secno>10.2.4.66 </span><dfn>DOCTYPE system identifier (single-quoted) state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0027 APOSTROPHE (')</dt>
+ <dd>Switch to the <a href=#after-doctype-system-identifier-state>after DOCTYPE system identifier
+ state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE
+ token. Switch to the <a href=#data-state>data state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Append the <a href=#current-input-character>current input character</a> to the current
+ DOCTYPE token's system identifier. Stay in the <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system
+ identifier (single-quoted) state</a>.</dd>
+
+ </dl><h5 id=after-doctype-system-identifier-state><span class=secno>10.2.4.67 </span><dfn>After DOCTYPE system identifier state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dd>Stay in the <a href=#after-doctype-system-identifier-state>after DOCTYPE system identifier
+ state</a>.</dd>
+
+ <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the current DOCTYPE token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
+ Reconsume the EOF character in the <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#bogus-doctype-state>bogus DOCTYPE
+ state</a>. (This does <em>not</em> set the DOCTYPE token's
+ <i>force-quirks flag</i> to <i>on</i>.)</dd>
+
+ </dl><h5 id=bogus-doctype-state><span class=secno>10.2.4.68 </span><dfn>Bogus DOCTYPE state</dfn></h5>
+
+ <p>Consume the <a href=#next-input-character>next input character</a>:</p>
+
+ <dl class=switch><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
+ <dd>Emit the DOCTYPE token. Switch to the <a href=#data-state>data
+ state</a>.</dd>
+
+ <dt>EOF</dt>
+ <dd>Emit the DOCTYPE token. Reconsume the EOF character in the
+ <a href=#data-state>data state</a>.</dd>
+
+ <dt>Anything else</dt>
+ <dd>Stay in the <a href=#bogus-doctype-state>bogus DOCTYPE state</a>.</dd>
+
+ </dl><h5 id=cdata-section-state><span class=secno>10.2.4.69 </span><dfn>CDATA section state</dfn></h5>
+
+ <p>Consume every character up to the next occurrence of the three
+ character sequence U+005D RIGHT SQUARE BRACKET U+005D RIGHT SQUARE
+ BRACKET U+003E GREATER-THAN SIGN (<code title="">]]&gt;</code>), or the
+ end of the file (EOF), whichever comes first. Emit a series of
+ character tokens consisting of all the characters consumed except
+ the matching three character sequence at the end (if one was found
+ before the end of the file).</p>
+
+ <p>Switch to the <a href=#data-state>data state</a>.</p>
+
+ <p>If the end of the file was reached, reconsume the EOF
+ character.</p>
+
+
+
+ <h5 id=tokenizing-character-references><span class=secno>10.2.4.70 </span>Tokenizing character references</h5>
+
+ <p>This section defines how to <dfn id=consume-a-character-reference>consume a character
+ reference</dfn>. This definition is used when parsing character
+ references <a href=#character-reference-in-data-state title="character reference in data state">in
+ text</a> and <a href=#character-reference-in-attribute-value-state title="character reference in attribute value
+ state">in attributes</a>.</p>
+
+ <p>The behavior depends on the identity of the next character (the
+ one immediately after the U+0026 AMPERSAND character):</p>
+
+ <dl class=switch><dt>U+0009 CHARACTER TABULATION</dt>
+ <dt>U+000A LINE FEED (LF)</dt>
+ <dt>U+000C FORM FEED (FF)</dt>
+ <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
+ <dt>U+0020 SPACE</dt>
+ <dt>U+003C LESS-THAN SIGN</dt>
+ <dt>U+0026 AMPERSAND</dt>
+ <dt>EOF</dt>
+ <dt>The <dfn id=additional-allowed-character>additional allowed character</dfn>, if there is one</dt>
+
+ <dd>Not a character reference. No characters are consumed, and
+ nothing is returned. (This is not an error, either.)</dd>
+
+
+ <dt>U+0023 NUMBER SIGN (#)</dt>
+
+ <dd>
+
+ <p>Consume the U+0023 NUMBER SIGN.</p>
+
+ <p>The behavior further depends on the character after the U+0023
+ NUMBER SIGN:</p>
+
+ <dl class=switch><dt>U+0078 LATIN SMALL LETTER X</dt>
+ <dt>U+0058 LATIN CAPITAL LETTER X</dt>
+
+ <dd>
+
+ <p>Consume the X.</p>
+
+ <p>Follow the steps below, but using the range of characters
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0061 LATIN
+ SMALL LETTER A to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN
+ CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F (in other
+ words, 0-9, A-F, a-f).</p>
+
+ <p>When it comes to interpreting the number, interpret it as a
+ hexadecimal number.</p>
+
+ </dd>
+
+
+ <dt>Anything else</dt>
+
+ <dd>
+
+ <p>Follow the steps below, but using the range of characters
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).</p>
+
+ <p>When it comes to interpreting the number, interpret it as a
+ decimal number.</p>
+
+ </dd>
+
+ </dl><p>Consume as many characters as match the range of characters
+ given above.</p>
+
+ <p>If no characters match the range, then don't consume any
+ characters (and unconsume the U+0023 NUMBER SIGN character and, if
+ appropriate, the X character). This is a <a href=#parse-error>parse
+ error</a>; nothing is returned.</p>
+
+ <p>Otherwise, if the next character is a U+003B SEMICOLON, consume
+ that too. If it isn't, there is a <a href=#parse-error>parse
+ error</a>.</p>
+
+ <p>If one or more characters match the range, then take them all
+ and interpret the string of characters as a number (either
+ hexadecimal or decimal as appropriate).</p>
+
+ <p>If that number is one of the numbers in the first column of the
+ following table, then this is a <a href=#parse-error>parse error</a>. Find the
+ row with that number in the first column, and return a character
+ token for the Unicode character given in the second column of that
+ row.</p>
+
+ <table><thead><tr><th>Number <th colspan=2>Unicode character
+ <tbody><tr><td>0x00 <td>U+FFFD <td>REPLACEMENT CHARACTER
+ <tr><td>0x0D <td>U+000D <td>CARRIAGE RETURN (CR)
+ <tr><td>0x80 <td>U+20AC <td>EURO SIGN (&euro;)
+ <tr><td>0x81 <td>U+0081 <td>&lt;control&gt;
+ <tr><td>0x82 <td>U+201A <td>SINGLE LOW-9 QUOTATION MARK (&sbquo;)
+ <tr><td>0x83 <td>U+0192 <td>LATIN SMALL LETTER F WITH HOOK (&fnof;)
+ <tr><td>0x84 <td>U+201E <td>DOUBLE LOW-9 QUOTATION MARK (&bdquo;)
+ <tr><td>0x85 <td>U+2026 <td>HORIZONTAL ELLIPSIS (&hellip;)
+ <tr><td>0x86 <td>U+2020 <td>DAGGER (&dagger;)
+ <tr><td>0x87 <td>U+2021 <td>DOUBLE DAGGER (&Dagger;)
+ <tr><td>0x88 <td>U+02C6 <td>MODIFIER LETTER CIRCUMFLEX ACCENT (&circ;)
+ <tr><td>0x89 <td>U+2030 <td>PER MILLE SIGN (&permil;)
+ <tr><td>0x8A <td>U+0160 <td>LATIN CAPITAL LETTER S WITH CARON (&Scaron;)
+ <tr><td>0x8B <td>U+2039 <td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (&lsaquo;)
+ <tr><td>0x8C <td>U+0152 <td>LATIN CAPITAL LIGATURE OE (&OElig;)
+ <tr><td>0x8D <td>U+008D <td>&lt;control&gt;
+ <tr><td>0x8E <td>U+017D <td>LATIN CAPITAL LETTER Z WITH CARON (&#381;)
+ <tr><td>0x8F <td>U+008F <td>&lt;control&gt;
+ <tr><td>0x90 <td>U+0090 <td>&lt;control&gt;
+ <tr><td>0x91 <td>U+2018 <td>LEFT SINGLE QUOTATION MARK (&lsquo;)
+ <tr><td>0x92 <td>U+2019 <td>RIGHT SINGLE QUOTATION MARK (&rsquo;)
+ <tr><td>0x93 <td>U+201C <td>LEFT DOUBLE QUOTATION MARK (&ldquo;)
+ <tr><td>0x94 <td>U+201D <td>RIGHT DOUBLE QUOTATION MARK (&rdquo;)
+ <tr><td>0x95 <td>U+2022 <td>BULLET (&bull;)
+ <tr><td>0x96 <td>U+2013 <td>EN DASH (&ndash;)
+ <tr><td>0x97 <td>U+2014 <td>EM DASH (&mdash;)
+ <tr><td>0x98 <td>U+02DC <td>SMALL TILDE (&tilde;)
+ <tr><td>0x99 <td>U+2122 <td>TRADE MARK SIGN (&trade;)
+ <tr><td>0x9A <td>U+0161 <td>LATIN SMALL LETTER S WITH CARON (&scaron;)
+ <tr><td>0x9B <td>U+203A <td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (&rsaquo;)
+ <tr><td>0x9C <td>U+0153 <td>LATIN SMALL LIGATURE OE (&oelig;)
+ <tr><td>0x9D <td>U+009D <td>&lt;control&gt;
+ <tr><td>0x9E <td>U+017E <td>LATIN SMALL LETTER Z WITH CARON (&#382;)
+ <tr><td>0x9F <td>U+0178 <td>LATIN CAPITAL LETTER Y WITH DIAERESIS (&Yuml;)
+ </table><p>Otherwise, if the number is in the range 0xD800 to 0xDFFF<!--
+ surrogates not allowed; see the comment in the "preprocessing the
+ input stream" section for details --> or is greater than 0x10FFFF,
+ then this is a <a href=#parse-error>parse error</a>. Return a U+FFFD
+ REPLACEMENT CHARACTER.</p>
+
+ <p>Otherwise, return a character token for the Unicode character
+ whose code point is that number.
+
+ <!-- this is the same as the equivalent list in the input stream
+ section -->
+ If the number is in the range 0x0001 to 0x0008, <!-- HT, LF
+ allowed --> <!-- U+000B is in the next list --> <!-- FF, CR
+ allowed --> 0x000E to 0x001F, <!-- ASCII allowed --> 0x007F <!--to
+ 0x0084, (0x0085 NEL not allowed), 0x0086--> to 0x009F, 0xFDD0 to
+ 0xFDEF, or is one of 0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF,
+ 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE,
+ 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF,
+ 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE,
+ 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF,
+ 0x10FFFE, or 0x10FFFF, then this is a <a href=#parse-error>parse
+ error</a>.</p>
+
+ </dd>
+
+
+ <dt>Anything else</dt>
+
+ <dd>
+
+ <p>Consume the maximum number of characters possible, with the
+ consumed characters matching one of the identifiers in the first
+ column of the <a href=#named-character-references>named character references</a> table (in a
+ <a href=#case-sensitive>case-sensitive</a> manner).</p>
+
+ <p>If no match can be made, then no characters are consumed, and
+ nothing is returned. In this case, if the characters after the
+ U+0026 AMPERSAND character (&amp;) consist of a sequence of one or
+ more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9), U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER
+ Z, and U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL
+ LETTER Z, followed by a U+003B SEMICOLON character (;), then this
+ is a <a href=#parse-error>parse error</a>.</p>
+
+ <p>If the character reference is being consumed <a href=#character-reference-in-attribute-value-state title="character reference in attribute value state">as part of an
+ attribute</a>, and the last character matched is not a U+003B
+ SEMICOLON character (;), and the next character is either a U+003D
+ EQUALS SIGN character (=) or in the range U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+005A
+ LATIN CAPITAL LETTER Z, or U+0061 LATIN SMALL LETTER A to U+007A
+ LATIN SMALL LETTER Z, then, for historical reasons, all the
+ characters that were matched after the U+0026 AMPERSAND character
+ (&amp;) must be unconsumed, and nothing is returned.</p>
+ <!-- "=" added because of http://www.w3.org/Bugs/Public/show_bug.cgi?id=9207#c5 -->
+
+ <p>Otherwise, a character reference is parsed. If the last
+ character matched is not a U+003B SEMICOLON character (;), there
+ is a <a href=#parse-error>parse error</a>.</p>
+
+ <p>Return a character token for the character corresponding to the
+ character reference name (as given by the second column of the
+ <a href=#named-character-references>named character references</a> table).</p>
+
+ <div class=example>
+
+ <p>If the markup contains (not in an attribute) the string <code title="">I'm &amp;notit; I tell you</code>, the character
+ reference is parsed as "not", as in, <code title="">I'm &not;it;
+ I tell you</code> (and this is a parse error). But if the markup
+ was <code title="">I'm &amp;notin; I tell you</code>, the
+ character reference would be parsed as "notin;", resulting in
+ <code title="">I'm &notin; I tell you</code> (and no parse
+ error).</p>
+
+ </div>
+
+ </dd>
+
+ </dl></div>
+
+
+ <div class=impl>
+
+ <!-- v2: One thing that this doesn't define is handling deeply
+ nested documents. There are compatibility requirements around that:
+ you can't throw away the elements altogether, consider Tux made only
+ with opening <font> elements, one per character. Seems that the best
+ thing to do is to close some formatting elements from the middle of
+ the stack when you hit a limit, or something. -->
+
+ <h4 id=tree-construction><span class=secno>10.2.5 </span><dfn>Tree construction</dfn></h4>
+
+ <p>The input to the tree construction stage is a sequence of tokens
+ from the <a href=#tokenization>tokenization</a> stage. The tree construction
+ stage is associated with a DOM <code><a href=#document>Document</a></code> object when a
+ parser is created. The "output" of this stage consists of
+ dynamically modifying or extending that document's DOM tree.</p>
+
+ <p>This specification does not define when an interactive user agent
+ has to render the <code><a href=#document>Document</a></code> so that it is available to
+ the user, or when it has to begin accepting user input.</p>
+
+ <p>As each token is emitted from the tokenizer, the user agent must
+ process the token according to the rules given in the section
+ corresponding to the current <a href=#insertion-mode>insertion mode</a>.</p>
+
+ <p>When the steps below require the UA to <dfn id=insert-a-character>insert a
+ character</dfn> into a node, if that node has a child immediately
+ before where the character is to be inserted, and that child is a
+ <code><a href=#text>Text</a></code> node, and that <code><a href=#text>Text</a></code> node was the last
+ node that the parser inserted into the document, then the character
+ must be appended to that <code><a href=#text>Text</a></code> node; otherwise, a new
+ <code><a href=#text>Text</a></code> node whose data is just that character must be
+ inserted in the appropriate place.</p>
+
+ <div class=example>
+
+ <p>Here are some sample inputs to the parser and the corresponding
+ number of text nodes that they result in, assuming a user agent
+ that executes scripts.</p>
+
+ <table><thead><tr><th>Input <th>Number of text nodes
+ <tbody><tr><td><pre>A&lt;script&gt;
+var&nbsp;script&nbsp;=&nbsp;document.getElementsByTagName('script')[0];
+document.body.removeChild(script);
+&lt;/script&gt;B</pre>
+ <td>Two adjacent text nodes in the document, containing "A" and "B".
+ <tr><td><pre>A&lt;script&gt;
+var&nbsp;text&nbsp;=&nbsp;document.createTextNode('B');
+document.body.appendChild(text);
+&lt;/script&gt;C</pre>
+ <td>Four text nodes; "A" before the script, the script's contents, "B" after the script, and then, immediately after that, "C".
+ <tr><td><pre>A&lt;script&gt;
+var&nbsp;text&nbsp;=&nbsp;document.getElementsByTagName('script')[0].firstChild;
+text.data&nbsp;=&nbsp;'B';
+document.body.appendChild(text);
+&lt;/script&gt;B</pre>
+ <td>Two adjacent text nodes in the document, containing "A" and "BB".
+ <tr><td><pre>A&lt;table&gt;B&lt;tr&gt;C&lt;/tr&gt;C&lt;/table&gt;</pre>
+ <td>Three adjacent text nodes before the table, containing "A", "B", and "CC" respectively. (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a>.)
+ <tr><td><pre>A&lt;table&gt;&lt;tr&gt;&nbsp;B&lt;/tr&gt;&nbsp;B&lt;/table&gt;</pre>
+ <td>Two adjacent text nodes before the table, containing "A" and "&nbsp;B&nbsp;B" (space-B-space-B) respectively. (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a>.)
+ <tr><td><pre>A&lt;table&gt;&lt;tr&gt;&nbsp;B&lt;/tr&gt;&nbsp;&lt;/em&gt;C&lt;/table&gt;</pre>
+ <td>Three adjacent text nodes before the table, containing "A", "&nbsp;B" (space-B), and "C" respectively, and one text node inside the table (as a child of a <code><a href=#the-tbody-element>tbody</a></code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <a href=#foster-parent title="foster parent">foster parenting</a>, even if those other tokens then get ignored.)
+ </table></div>
+
+ <p id=mutation-during-parsing>DOM mutation events must not fire
+ for changes caused by the UA parsing the document. (Conceptually,
+ the parser is not mutating the DOM, it is constructing it.) This
+ includes the parsing of any content inserted using <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> and <code title=dom-document-writeln><a href=#dom-document-writeln>document.writeln()</a></code> calls. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p class=note>Not all of the tag names mentioned below are
+ conformant tag names in this specification; many are included to
+ handle legacy content. They still form part of the algorithm that
+ implementations are required to implement to claim conformance.</p>
+
+ <p class=note>The algorithm described below places no limit on the
+ depth of the DOM tree generated, or on the length of tag names,
+ attribute names, attribute values, text nodes, etc. While
+ implementors are encouraged to avoid arbitrary limits, it is
+ recognized that <a href=#hardwareLimitations>practical
+ concerns</a> will likely force user agents to impose nesting depth
+ constraints.</p>
+
+
+ <h5 id=creating-and-inserting-elements><span class=secno>10.2.5.1 </span>Creating and inserting elements</h5>
+
+ <p>When the steps below require the UA to <dfn id=create-an-element-for-the-token title="create an
+ element for the token">create an element for a token</dfn> in a
+ particular namespace, the UA must create a node implementing the
+ interface appropriate for the element type corresponding to the tag
+ name of the token in the given namespace (as given in the
+ specification that defines that element, e.g. for an <code><a href=#the-a-element>a</a></code>
+ element in the <a href=#html-namespace-0>HTML namespace</a>, this specification
+ defines it to be the <code><a href=#htmlanchorelement>HTMLAnchorElement</a></code> interface), with
+ the tag name being the name of that element, with the node being in
+ the given namespace, and with the attributes on the node being those
+ given in the given token.</p>
+
+ <p>The interface appropriate for an element in the <a href=#html-namespace-0>HTML
+ namespace</a> that is not defined in this specification (or
+ <a href=#other-applicable-specifications>other applicable specifications</a>) is
+ <code><a href=#htmlunknownelement>HTMLUnknownElement</a></code>. Element in other namespaces whose
+ interface is not defined by that namespace's specification must use
+ the interface <code><a href=#element>Element</a></code>.</p>
+
+ <p>When a <a href=#category-reset title=category-reset>resettable element</a> is
+ created in this manner, its <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> must be
+ invoked once the attributes are set. (This initializes the element's
+ <a href=#concept-fe-value title=concept-fe-value>value</a> and <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> based on the element's
+ attributes.)</p>
+
+ <hr><p>When the steps below require the UA to <dfn id=insert-an-html-element>insert an HTML
+ element</dfn> for a token, the UA must first <a href=#create-an-element-for-the-token>create an element
+ for the token</a> in the <a href=#html-namespace-0>HTML namespace</a>, and then
+ append this node to the <a href=#current-node>current node</a>, and push it onto
+ the <a href=#stack-of-open-elements>stack of open elements</a> so that it is the new
+ <a href=#current-node>current node</a>.</p>
+
+ <p>The steps below may also require that the UA insert an HTML
+ element in a particular place, in which case the UA must follow the
+ same steps except that it must insert or append the new node in the
+ location specified instead of appending it to the <a href=#current-node>current
+ node</a>. (This happens in particular during the parsing of
+ tables with invalid content.)</p>
+
+ <p>If an element created by the <a href=#insert-an-html-element>insert an HTML element</a>
+ algorithm is a <a href=#form-associated-element>form-associated element</a>, and the
+ <a href=#form-element-pointer><code title="">form</code> element pointer</a> is not null,
+ and the newly created element doesn't have a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute, the user agent must
+ <a href=#concept-form-association title=concept-form-association>associate</a> the newly
+ created element with the <code><a href=#the-form-element>form</a></code> element pointed to by the
+ <a href=#form-element-pointer><code title="">form</code> element pointer</a> before
+ inserting it wherever it is to be inserted.</p>
+
+ <hr><p>When the steps below require the UA to <dfn id=insert-a-foreign-element>insert a foreign
+ element</dfn> for a token, the UA must first <a href=#create-an-element-for-the-token>create an element
+ for the token</a> in the given namespace, and then append this
+ node to the <a href=#current-node>current node</a>, and push it onto the
+ <a href=#stack-of-open-elements>stack of open elements</a> so that it is the new
+ <a href=#current-node>current node</a>. If the newly created element has an <code title="">xmlns</code> attribute in the <a href=#xmlns-namespace>XMLNS namespace</a>
+ whose value is not exactly the same as the element's namespace, that
+ is a <a href=#parse-error>parse error</a>. Similarly, if the newly created
+ element has an <code title="">xmlns:xlink</code> attribute in the
+ <a href=#xmlns-namespace>XMLNS namespace</a> whose value is not the <a href=#xlink-namespace>XLink
+ Namespace</a>, that is a <a href=#parse-error>parse error</a>.</p>
+
+ <p>When the steps below require the user agent to <dfn id=adjust-mathml-attributes>adjust MathML
+ attributes</dfn> for a token, then, if the token has an attribute
+ named <code title="">definitionurl</code>, change its name to <code title="">definitionURL</code> (note the case difference).</p>
+
+ <p>When the steps below require the user agent to <dfn id=adjust-svg-attributes>adjust SVG
+ attributes</dfn> for a token, then, for each attribute on the token
+ whose attribute name is one of the ones in the first column of the
+ following table, change the attribute's name to the name given in
+ the corresponding cell in the second column. (This fixes the case of
+ SVG attributes that are not all lowercase.)</p>
+
+ <table><thead><tr><th> Attribute name on token <th> Attribute name on element
+ <tbody><tr><td> <code title="">attributename</code> <td> <code title="">attributeName</code>
+ <tr><td> <code title="">attributetype</code> <td> <code title="">attributeType</code>
+ <tr><td> <code title="">basefrequency</code> <td> <code title="">baseFrequency</code>
+ <tr><td> <code title="">baseprofile</code> <td> <code title="">baseProfile</code>
+ <tr><td> <code title="">calcmode</code> <td> <code title="">calcMode</code>
+ <tr><td> <code title="">clippathunits</code> <td> <code title="">clipPathUnits</code>
+ <tr><td> <code title="">contentscripttype</code> <td> <code title="">contentScriptType</code>
+ <tr><td> <code title="">contentstyletype</code> <td> <code title="">contentStyleType</code>
+ <tr><td> <code title="">diffuseconstant</code> <td> <code title="">diffuseConstant</code>
+ <tr><td> <code title="">edgemode</code> <td> <code title="">edgeMode</code>
+ <tr><td> <code title="">externalresourcesrequired</code> <td> <code title="">externalResourcesRequired</code>
+ <tr><td> <code title="">filterres</code> <td> <code title="">filterRes</code>
+ <tr><td> <code title="">filterunits</code> <td> <code title="">filterUnits</code>
+ <tr><td> <code title="">glyphref</code> <td> <code title="">glyphRef</code>
+ <tr><td> <code title="">gradienttransform</code> <td> <code title="">gradientTransform</code>
+ <tr><td> <code title="">gradientunits</code> <td> <code title="">gradientUnits</code>
+ <tr><td> <code title="">kernelmatrix</code> <td> <code title="">kernelMatrix</code>
+ <tr><td> <code title="">kernelunitlength</code> <td> <code title="">kernelUnitLength</code>
+ <tr><td> <code title="">keypoints</code> <td> <code title="">keyPoints</code>
+ <tr><td> <code title="">keysplines</code> <td> <code title="">keySplines</code>
+ <tr><td> <code title="">keytimes</code> <td> <code title="">keyTimes</code>
+ <tr><td> <code title="">lengthadjust</code> <td> <code title="">lengthAdjust</code>
+ <tr><td> <code title="">limitingconeangle</code> <td> <code title="">limitingConeAngle</code>
+ <tr><td> <code title="">markerheight</code> <td> <code title="">markerHeight</code>
+ <tr><td> <code title="">markerunits</code> <td> <code title="">markerUnits</code>
+ <tr><td> <code title="">markerwidth</code> <td> <code title="">markerWidth</code>
+ <tr><td> <code title="">maskcontentunits</code> <td> <code title="">maskContentUnits</code>
+ <tr><td> <code title="">maskunits</code> <td> <code title="">maskUnits</code>
+ <tr><td> <code title="">numoctaves</code> <td> <code title="">numOctaves</code>
+ <tr><td> <code title="">pathlength</code> <td> <code title="">pathLength</code>
+ <tr><td> <code title="">patterncontentunits</code> <td> <code title="">patternContentUnits</code>
+ <tr><td> <code title="">patterntransform</code> <td> <code title="">patternTransform</code>
+ <tr><td> <code title="">patternunits</code> <td> <code title="">patternUnits</code>
+ <tr><td> <code title="">pointsatx</code> <td> <code title="">pointsAtX</code>
+ <tr><td> <code title="">pointsaty</code> <td> <code title="">pointsAtY</code>
+ <tr><td> <code title="">pointsatz</code> <td> <code title="">pointsAtZ</code>
+ <tr><td> <code title="">preservealpha</code> <td> <code title="">preserveAlpha</code>
+ <tr><td> <code title="">preserveaspectratio</code> <td> <code title="">preserveAspectRatio</code>
+ <tr><td> <code title="">primitiveunits</code> <td> <code title="">primitiveUnits</code>
+ <tr><td> <code title="">refx</code> <td> <code title="">refX</code>
+ <tr><td> <code title="">refy</code> <td> <code title="">refY</code>
+ <tr><td> <code title="">repeatcount</code> <td> <code title="">repeatCount</code>
+ <tr><td> <code title="">repeatdur</code> <td> <code title="">repeatDur</code>
+ <tr><td> <code title="">requiredextensions</code> <td> <code title="">requiredExtensions</code>
+ <tr><td> <code title="">requiredfeatures</code> <td> <code title="">requiredFeatures</code>
+ <tr><td> <code title="">specularconstant</code> <td> <code title="">specularConstant</code>
+ <tr><td> <code title="">specularexponent</code> <td> <code title="">specularExponent</code>
+ <tr><td> <code title="">spreadmethod</code> <td> <code title="">spreadMethod</code>
+ <tr><td> <code title="">startoffset</code> <td> <code title="">startOffset</code>
+ <tr><td> <code title="">stddeviation</code> <td> <code title="">stdDeviation</code>
+ <tr><td> <code title="">stitchtiles</code> <td> <code title="">stitchTiles</code>
+ <tr><td> <code title="">surfacescale</code> <td> <code title="">surfaceScale</code>
+ <tr><td> <code title="">systemlanguage</code> <td> <code title="">systemLanguage</code>
+ <tr><td> <code title="">tablevalues</code> <td> <code title="">tableValues</code>
+ <tr><td> <code title="">targetx</code> <td> <code title="">targetX</code>
+ <tr><td> <code title="">targety</code> <td> <code title="">targetY</code>
+ <tr><td> <code title="">textlength</code> <td> <code title="">textLength</code>
+ <tr><td> <code title="">viewbox</code> <td> <code title="">viewBox</code>
+ <tr><td> <code title="">viewtarget</code> <td> <code title="">viewTarget</code>
+ <tr><td> <code title="">xchannelselector</code> <td> <code title="">xChannelSelector</code>
+ <tr><td> <code title="">ychannelselector</code> <td> <code title="">yChannelSelector</code>
+ <tr><td> <code title="">zoomandpan</code> <td> <code title="">zoomAndPan</code>
+ </table><p>When the steps below require the user agent to <dfn id=adjust-foreign-attributes>adjust
+ foreign attributes</dfn> for a token, then, if any of the attributes
+ on the token match the strings given in the first column of the
+ following table, let the attribute be a namespaced attribute, with
+ the prefix being the string given in the corresponding cell in the
+ second column, the local name being the string given in the
+ corresponding cell in the third column, and the namespace being the
+ namespace given in the corresponding cell in the fourth
+ column. (This fixes the use of namespaced attributes, in particular
+ <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attributes in
+ the <span>XML namespace</span></a>.)</p>
+
+ <table><thead><tr><th> Attribute name <th> Prefix <th> Local name <th> Namespace
+ <tbody><tr><td> <code title="">xlink:actuate</code> <td> <code title="">xlink</code> <td> <code title="">actuate</code> <td> <a href=#xlink-namespace>XLink namespace</a>
+ <tr><td> <code title="">xlink:arcrole</code> <td> <code title="">xlink</code> <td> <code title="">arcrole</code> <td> <a href=#xlink-namespace>XLink namespace</a>
+ <tr><td> <code title="">xlink:href</code> <td> <code title="">xlink</code> <td> <code title="">href</code> <td> <a href=#xlink-namespace>XLink namespace</a>
+ <tr><td> <code title="">xlink:role</code> <td> <code title="">xlink</code> <td> <code title="">role</code> <td> <a href=#xlink-namespace>XLink namespace</a>
+ <tr><td> <code title="">xlink:show</code> <td> <code title="">xlink</code> <td> <code title="">show</code> <td> <a href=#xlink-namespace>XLink namespace</a>
+ <tr><td> <code title="">xlink:title</code> <td> <code title="">xlink</code> <td> <code title="">title</code> <td> <a href=#xlink-namespace>XLink namespace</a>
+ <tr><td> <code title="">xlink:type</code> <td> <code title="">xlink</code> <td> <code title="">type</code> <td> <a href=#xlink-namespace>XLink namespace</a>
+ <tr><td> <code title="">xml:base</code> <td> <code title="">xml</code> <td> <code title="">base</code> <td> <a href=#xml-namespace>XML namespace</a> <!-- attr-xml-base -->
+ <tr><td> <code title="">xml:lang</code> <td> <code title="">xml</code> <td> <code title="">lang</code> <td> <a href=#xml-namespace>XML namespace</a>
+ <tr><td> <code title="">xml:space</code> <td> <code title="">xml</code> <td> <code title="">space</code> <td> <a href=#xml-namespace>XML namespace</a>
+ <tr><td> <code title="">xmlns</code> <td> (none) <td> <code title="">xmlns</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a>
+ <tr><td> <code title="">xmlns:xlink</code> <td> <code title="">xmlns</code> <td> <code title="">xlink</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a>
+ </table><hr><p>The <dfn id=generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</dfn> and the
+ <dfn id=generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm</dfn> consist of the
+ following steps. These algorithms are always invoked in response to
+ a start tag token.</p>
+
+ <ol><li><p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</li>
+
+ <li><p>If the algorithm that was invoked is the <a href=#generic-raw-text-element-parsing-algorithm>generic raw
+ text element parsing algorithm</a>, switch the tokenizer to the
+ <a href=#rawtext-state>RAWTEXT state</a>; otherwise the algorithm invoked
+ was the <a href=#generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm</a>,
+ switch the tokenizer to the <a href=#rcdata-state>RCDATA state</a>.</li>
+
+ <li><p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the current
+ <a href=#insertion-mode>insertion mode</a>.</p>
+
+ <li><p>Then, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incdata title="insertion mode: text">text</a>".</li>
+
+ </ol><h5 id=closing-elements-that-have-implied-end-tags><span class=secno>10.2.5.2 </span>Closing elements that have implied end tags</h5>
+
+ <p>When the steps below require the UA to <dfn id=generate-implied-end-tags>generate implied end
+ tags</dfn>, then, while the <a href=#current-node>current node</a> is a
+ <code><a href=#the-dd-element>dd</a></code> element, a <code><a href=#the-dt-element>dt</a></code> element, an
+ <code><a href=#the-li-element>li</a></code> element, an <code><a href=#the-option-element>option</a></code> element, an
+ <code><a href=#the-optgroup-element>optgroup</a></code> element, a <code><a href=#the-p-element>p</a></code> element, an
+ <code><a href=#the-rp-element>rp</a></code> element, or an <code><a href=#the-rt-element>rt</a></code> element, the UA must
+ pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p>If a step requires the UA to generate implied end tags but lists
+ an element to exclude from the process, then the UA must perform the
+ above steps as if that element was not in the above list.</p>
+
+
+ <h5 id=foster-parenting><span class=secno>10.2.5.3 </span>Foster parenting</h5>
+
+ <p>Foster parenting happens when content is misnested in tables.</p>
+
+ <p>When a node <var title="">node</var> is to be <dfn id=foster-parent title="foster
+ parent">foster parented</dfn>, the node <var title="">node</var>
+ must be inserted into the <i><a href=#foster-parent-element>foster parent element</a></i>.</p>
+
+ <p>The <dfn id=foster-parent-element>foster parent element</dfn> is the parent element of the
+ last <code><a href=#the-table-element>table</a></code> element in the <a href=#stack-of-open-elements>stack of open
+ elements</a>, if there is a <code><a href=#the-table-element>table</a></code> element and it has
+ such a parent element. If there is no <code><a href=#the-table-element>table</a></code> element in
+ the <a href=#stack-of-open-elements>stack of open elements</a> (<a href=#fragment-case>fragment
+ case</a>), then the <i><a href=#foster-parent-element>foster parent element</a></i> is the first
+ element in the <a href=#stack-of-open-elements>stack of open elements</a> (the
+ <code><a href=#the-html-element-0>html</a></code> element). Otherwise, if there is a
+ <code><a href=#the-table-element>table</a></code> element in the <a href=#stack-of-open-elements>stack of open
+ elements</a>, but the last <code><a href=#the-table-element>table</a></code> element in the
+ <a href=#stack-of-open-elements>stack of open elements</a> has no parent, or its parent
+ node is not an element, then the <i><a href=#foster-parent-element>foster parent element</a></i> is
+ the element before the last <code><a href=#the-table-element>table</a></code> element in the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+
+ <p>If the <i><a href=#foster-parent-element>foster parent element</a></i> is the parent element of the
+ last <code><a href=#the-table-element>table</a></code> element in the <a href=#stack-of-open-elements>stack of open
+ elements</a>, then <var title="">node</var> must be inserted
+ immediately <em>before</em> the last <code><a href=#the-table-element>table</a></code> element in
+ the <a href=#stack-of-open-elements>stack of open elements</a> in the <i><a href=#foster-parent-element>foster parent
+ element</a></i>; otherwise, <var title="">node</var> must be
+ <em>appended</em> to the <i><a href=#foster-parent-element>foster parent element</a></i>.</p>
+
+
+
+ <h5 id=the-initial-insertion-mode><span class=secno>10.2.5.4 </span>The "<dfn title="insertion mode: initial">initial</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-initial-insertion-mode title="insertion
+ mode: initial">initial</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p>Ignore the token.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <code><a href=#document>Document</a></code>
+ object with the <code title="">data</code> attribute set to the
+ data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+
+ <p>If the DOCTYPE token's name is not a
+ <a href=#case-sensitive>case-sensitive</a> match for the string "<code title="">html</code>", or the token's public identifier is not
+ missing, or the token's system identifier is neither missing nor a
+ <a href=#case-sensitive>case-sensitive</a> match for the string
+ "<code><a href=#about:legacy-compat>about:legacy-compat</a></code>", and none of the sets of
+ conditions in the following list are matched, then there is a
+ <a href=#parse-error>parse error</a>.</p>
+
+ <ul><!-- only things that trigger no-quirks mode and were valid in
+ some other spec are allowed in this list --><li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
+ match for the string "<code title="">html</code>", the token's
+ public identifier is the <a href=#case-sensitive>case-sensitive</a> string
+ "<code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.0//EN</code>", and
+ the token's system identifier is either missing or the
+ <a href=#case-sensitive>case-sensitive</a> string "<code title="">http://www.w3.org/TR/REC-html40/strict.dtd</code>".</li>
+
+ <li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
+ match for the string "<code title="">html</code>", the token's
+ public identifier is the <a href=#case-sensitive>case-sensitive</a> string
+ "<code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN</code>", and
+ the token's system identifier is either missing or the
+ <a href=#case-sensitive>case-sensitive</a> string "<code title="">http://www.w3.org/TR/html4/strict.dtd</code>".</li>
+
+ <li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
+ match for the string "<code title="">html</code>", the token's
+ public identifier is the <a href=#case-sensitive>case-sensitive</a> string
+ "<code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Strict//EN</code>",
+ and the token's system identifier is the
+ <a href=#case-sensitive>case-sensitive</a> string "<code title="">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>".</li>
+
+ <li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
+ match for the string "<code title="">html</code>", the token's
+ public identifier is the <a href=#case-sensitive>case-sensitive</a> string
+ "<code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1//EN</code>", and
+ the token's system identifier is the <a href=#case-sensitive>case-sensitive</a>
+ string "<code title="">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>".</li>
+
+ </ul><p>Conformance checkers may, based on the values (including
+ presence or lack thereof) of the DOCTYPE token's name, public
+ identifier, or system identifier, switch to a conformance checking
+ mode for another language (e.g. based on the DOCTYPE token a
+ conformance checker could recognize that the document is an
+ HTML4-era document, and defer to an HTML4 conformance
+ checker.)</p>
+
+ <p>Append a <code><a href=#documenttype>DocumentType</a></code> node to the
+ <code><a href=#document>Document</a></code> node, with the <code title="">name</code>
+ attribute set to the name given in the DOCTYPE token, or the empty
+ string if the name was missing; the <code title="">publicId</code>
+ attribute set to the public identifier given in the DOCTYPE token,
+ or the empty string if the public identifier was missing; the
+ <code title="">systemId</code> attribute set to the system
+ identifier given in the DOCTYPE token, or the empty string if the
+ system identifier was missing; and the other attributes specific
+ to <code><a href=#documenttype>DocumentType</a></code> objects set to null and empty lists
+ as appropriate. Associate the <code><a href=#documenttype>DocumentType</a></code> node with
+ the <code><a href=#document>Document</a></code> object so that it is returned as the
+ value of the <code title="">doctype</code> attribute of the
+ <code><a href=#document>Document</a></code> object.</p>
+
+ <p id=quirks-mode-doctypes>Then, if the DOCTYPE token matches
+ one of the conditions in the following list, then set the
+ <code><a href=#document>Document</a></code> to <a href=#quirks-mode>quirks mode</a>:</p>
+
+ <ul class=brief><li> The <i>force-quirks flag</i> is set to <i>on</i>. </li>
+ <li> The name is set to anything other than "<code title="">html</code>" (compared <a href=#case-sensitive title=case-sensitive>case-sensitively</a>). </li>
+ <li> The public identifier starts with: "<code title="">+//Silmaril//dtd html Pro v0r11 19970101//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//AS//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 1//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 2//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 1//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 2//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.1E//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.0//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML 3.0//EN//</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2 Final//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 0//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 0//EN//2.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 1//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 1//EN//2.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 2//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 2//EN//2.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 3//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 3//EN//3.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 0//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 0//EN//2.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 1//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 1//EN//2.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 2//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 2//EN//2.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 3//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 3//EN//3.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//2.0</code>" </li>-->
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//3.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//2.0</code>" </li>-->
+ <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//3.0</code>" </li>-->
+ <li> The public identifier starts with: "<code title="">-//Metrius//DTD Metrius Presentational//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 Tables//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 Tables//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD HTML//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD Strict HTML//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML 2.0//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended 1.0//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Spyglass//DTD HTML 2.0 Extended//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//SQ//DTD HTML 2.0 HoTMetaL + extensions//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava HTML//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava Strict HTML//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3 1995-03-24//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Draft//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Final//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2S Draft//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Frameset//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Transitional//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 19960712//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 970421//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD W3 HTML//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3O//DTD W3 HTML 3.0//<!--EN--></code>" </li>
+ <!--<li> The public identifier is set to: "<code title="">-//W3O//DTD W3 HTML 3.0//EN//</code>" </li>-->
+ <li> The public identifier is set to: "<code title="">-//W3O//DTD W3 HTML Strict 3.0//EN//</code>" </li>
+ <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML 2.0//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML//<!--EN--></code>" </li>
+ <li> The public identifier is set to: "<code title="">-/W3C/DTD HTML 4.0 Transitional/EN</code>" </li>
+ <li> The public identifier is set to: "<code title="">HTML</code>" </li>
+ <li> The system identifier is set to: "<code title="">http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd</code>" </li>
+ <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
+ <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
+ </ul><p>Otherwise, if the DOCTYPE token matches one of the conditions
+ in the following list, then set the <code><a href=#document>Document</a></code> to
+ <a href=#limited-quirks-mode>limited-quirks mode</a>:</p>
+
+ <ul class=brief><li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Frameset//<!--EN--></code>" </li>
+ <li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Transitional//<!--EN--></code>" </li>
+ <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
+ <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
+ </ul><p>The system identifier and public identifier strings must be
+ compared to the values given in the lists above in an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> manner. A system identifier whose value is
+ the empty string is not considered missing for the purposes of the
+ conditions above.</p>
+
+ <p>Then, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>".</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p>If the document is <em>not</em> <a href=#an-iframe-srcdoc-document>an <code>iframe</code>
+ <code title=attr-iframe-srcdoc>srcdoc</code> document</a>,
+ then this is a <a href=#parse-error>parse error</a>; set the
+ <code><a href=#document>Document</a></code> to <a href=#quirks-mode>quirks mode</a>.</p>
+
+ <p>In any case, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>", then
+ reprocess the current token.</p>
+
+ </dd>
+
+ </dl><h5 id=the-before-html-insertion-mode><span class=secno>10.2.5.5 </span>The "<dfn title="insertion mode: before html">before html</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-before-html-insertion-mode title="insertion
+ mode: before html">before html</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <code><a href=#document>Document</a></code>
+ object with the <code title="">data</code> attribute set to the
+ data given in the comment token.</p>
+ </dd>
+
+ <dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p>Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+
+ <p><a href=#create-an-element-for-the-token>Create an element for the token</a> in the <a href=#html-namespace-0>HTML
+ namespace</a>. Append it to the <code><a href=#document>Document</a></code>
+ object. Put this element in the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p id=parser-appcache>If the <code><a href=#document>Document</a></code> is being
+ loaded as part of <a href=#navigate title=navigate>navigation</a> of a
+ <a href=#browsing-context>browsing context</a>, then: if the newly created element
+ has a <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute
+ whose value is not the empty string, then <a href=#resolve-a-url title="resolve a
+ url">resolve</a> the value of that attribute to an
+ <a href=#absolute-url>absolute URL</a>, relative to the newly created element,
+ and if that is successful, run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
+ algorithm</a> with the resulting <a href=#absolute-url>absolute URL</a> with
+ any <a href=#url-fragment title=url-fragment>&lt;fragment&gt;</a> component
+ removed; otherwise, if there is no such attribute, or its value is
+ the empty string, or resolving its value fails, run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
+ algorithm</a> with no manifest. The algorithm must be passed
+ the <code><a href=#document>Document</a></code> object.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before head</a>".</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
+ <dd>
+ <p>Act as described in the "anything else" entry below.</p>
+ </dd>
+
+ <dt>Any other end tag</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p>Create an <code><a href=#the-html-element-0>html</a></code> element. Append it to the
+ <code><a href=#document>Document</a></code> object. Put this element in the <a href=#stack-of-open-elements>stack
+ of open elements</a>.</p>
+
+ <p>If the <code><a href=#document>Document</a></code> is being loaded as part of <a href=#navigate title=navigate>navigation</a> of a <a href=#browsing-context>browsing
+ context</a>, then: run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
+ algorithm</a> with no manifest, passing it the
+ <code><a href=#document>Document</a></code> object.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before head</a>", then
+ reprocess the current token.</p>
+
+ </dd>
+
+ </dl><p>The root element can end up being removed from the
+ <code><a href=#document>Document</a></code> object, e.g. by scripts; nothing in particular
+ happens in such cases, content continues being appended to the nodes
+ as described in the next section.</p>
+
+
+ <h5 id=the-before-head-insertion-mode><span class=secno>10.2.5.6 </span>The "<dfn title="insertion mode: before head">before head</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-before-head-insertion-mode title="insertion
+ mode: before head">before head</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p>Ignore the token.</p> <!-- :-( -->
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "head"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Set the <a href=#head-element-pointer><code title="">head</code> element pointer</a>
+ to the newly created <code><a href=#the-head-element-0>head</a></code> element.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>".</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
+ <dd>
+
+ <p>Act as if a start tag token with the tag name "head" and no
+ attributes had been seen, then reprocess the current token.</p>
+
+ </dd>
+
+ <dt>Any other end tag</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p>Act as if a start tag token with the tag name "head" and no
+ attributes had been seen, then reprocess the current
+ token.</p>
+
+ </dd>
+
+ </dl><h5 id=parsing-main-inhead><span class=secno>10.2.5.7 </span>The "<dfn title="insertion mode: in head">in head</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inhead title="insertion
+ mode: in head">in head</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p><a href=#insert-a-character title="insert a character">Insert the character</a> into
+ the <a href=#current-node>current node</a>.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "base", "command",
+ "link"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately
+ pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "meta"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately
+ pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p>
+
+ <p id=meta-charset-during-parse>If the element has a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute, and its
+ value is a supported encoding, and the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
+ currently <i>tentative</i>, then <a href=#change-the-encoding>change the
+ encoding</a> to the encoding given by the value of the
+ <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute.</p>
+
+ <p>Otherwise, if the element has an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute whose
+ value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
+ string "<code title="">Content-Type</code>", and the element has a
+ <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, and
+ applying the <a href=#algorithm-for-extracting-an-encoding-from-a-content-type>algorithm for extracting an encoding from a
+ Content-Type</a> to that attribute's value returns a supported
+ encoding <var title="">encoding</var>, and the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is currently
+ <i>tentative</i>, then <a href=#change-the-encoding>change the encoding</a> to the
+ encoding <var title="">encoding</var>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "title"</dt>
+ <dd>
+ <p>Follow the <a href=#generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag>scripting flag</a> is enabled</dt>
+ <dt>A start tag whose tag name is one of: "noframes", "style"</dt>
+ <dd>
+ <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag>scripting flag</a> is disabled</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inheadnoscript title="insertion mode: in head noscript">in head
+ noscript</a>".</p>
+
+ </dd>
+
+ <dt id=scriptTag>A start tag whose tag name is "script"</dt>
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> in the
+ <a href=#html-namespace-0>HTML namespace</a>.</li>
+
+ <li>
+
+ <p>Mark the element as being <a href=#parser-inserted>"parser-inserted"</a>.</p>
+
+ <p class=note>This ensures that, if the script is external,
+ any <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code>
+ calls in the script will execute in-line, instead of blowing the
+ document away, as would happen in most other cases. It also
+ prevents the script from executing until the end tag is
+ seen.</p>
+
+ </li>
+
+ <li><p>If the parser was originally created for the <a href=#html-fragment-parsing-algorithm>HTML
+ fragment parsing algorithm</a>, then mark the
+ <code><a href=#script>script</a></code> element as <a href=#already-started>"already
+ started"</a>. (<a href=#fragment-case>fragment case</a>)</li>
+
+ <li><p>Append the new element to the <a href=#current-node>current node</a>
+ and push it onto the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</li>
+
+ <li><p>Switch the tokenizer to the <a href=#script-data-state>script data
+ state</a>.</li>
+
+ <li><p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the current
+ <a href=#insertion-mode>insertion mode</a>.</p>
+
+ <li><p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incdata title="insertion mode: text">text</a>".</li>
+
+ </ol></dd>
+
+ <dt>An end tag whose tag name is "head"</dt>
+ <dd>
+
+ <p>Pop the <a href=#current-node>current node</a> (which will be the
+ <code><a href=#the-head-element-0>head</a></code> element) off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-after-head-insertion-mode title="insertion mode: after head">after head</a>".</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
+ <dd>
+ <p>Act as described in the "anything else" entry below.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "head"</dt>
+ <dt>Any other end tag</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <!-- can't get here with an EOF and a fragment case -->
+
+ <p>Act as if an end tag token with the tag name "head" had
+ been seen, and reprocess the current token.</p>
+
+ </dd>
+
+ </dl><h5 id=parsing-main-inheadnoscript><span class=secno>10.2.5.8 </span>The "<dfn title="insertion mode: in head noscript">in head noscript</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inheadnoscript title="insertion
+ mode: in head noscript">in head noscript</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is "noscript"</dt>
+ <dd>
+
+ <p>Pop the <a href=#current-node>current node</a> (which will be a
+ <code><a href=#the-noscript-element>noscript</a></code> element) from the <a href=#stack-of-open-elements>stack of open
+ elements</a>; the new <a href=#current-node>current node</a> will be a
+ <code><a href=#the-head-element-0>head</a></code> element.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>".</p>
+
+ </dd>
+
+ <dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dt>A comment token</dt>
+ <dt>A start tag whose tag name is one of: "link", "meta", "noframes", "style"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is "br"</dt>
+ <dd>
+ <p>Act as described in the "anything else" entry below.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "head", "noscript"</dt>
+ <dt>Any other end tag</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <!-- can't get here with an EOF and a fragment case -->
+
+ <p><a href=#parse-error>Parse error</a>. Act as if an end tag with the tag
+ name "noscript" had been seen and reprocess the current
+ token.</p>
+
+ </dd>
+
+ </dl><h5 id=the-after-head-insertion-mode><span class=secno>10.2.5.9 </span>The "<dfn title="insertion mode: after head">after head</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-after-head-insertion-mode title="insertion
+ mode: after head">after head</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p><a href=#insert-a-character title="insert a character">Insert the character</a> into
+ the <a href=#current-node>current node</a>.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "body"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "frameset"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>".</p>
+
+ </dd>
+
+ <dt>A start tag token whose tag name is one of: "base", "link",
+ "meta", "noframes", "script", "style", "title"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>Push the node pointed to by the <a href=#head-element-pointer><code title="">head</code> element pointer</a> onto the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+
+ <p>Remove the node pointed to by the <a href=#head-element-pointer><code title="">head</code> element pointer</a> from the <a href=#stack-of-open-elements>stack
+ of open elements</a>.</p>
+
+ <p class=note>The <a href=#head-element-pointer><code title="">head</code> element
+ pointer</a> cannot be null at this point.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
+ <dd>
+ <p>Act as described in the "anything else" entry below.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "head"</dt>
+ <dt>Any other end tag</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p>Act as if a start tag token with the tag name "body" and no
+ attributes had been seen, then set the <a href=#frameset-ok-flag>frameset-ok
+ flag</a> back to "ok", and then reprocess the current
+ token.</p>
+ </dd>
+
+ </dl><h5 id=parsing-main-inbody><span class=secno>10.2.5.10 </span>The "<dfn title="insertion mode: in body">in body</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inbody title="insertion
+ mode: in body">in body</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-a-character title="insert a character">Insert the token's
+ character</a> into the <a href=#current-node>current node</a>.</p>
+
+ <p>If the token is not one of U+0009 CHARACTER TABULATION, U+000A
+ LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN
+ (CR), or U+0020 SPACE, then set the <a href=#frameset-ok-flag>frameset-ok
+ flag</a> to "not ok".</p>
+
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. For each attribute on the token,
+ check to see if the attribute is already present on the top
+ element of the <a href=#stack-of-open-elements>stack of open elements</a>. If it is not,
+ add the attribute and its corresponding value to that element.</p>
+ </dd>
+
+ <dt>A start tag token whose tag name is one of: "base", "command",
+ "link", "meta", "noframes", "script", "style", "title"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "body"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>If the second element on the <a href=#stack-of-open-elements>stack of open
+ elements</a> is not a <code><a href=#the-body-element-0>body</a></code> element, or, if the
+ <a href=#stack-of-open-elements>stack of open elements</a> has only one node on it,
+ then ignore the token. (<a href=#fragment-case>fragment case</a>)</p>
+
+ <p>Otherwise, for each attribute on the token, check to see if
+ the attribute is already present on the <code><a href=#the-body-element-0>body</a></code>
+ element (the second element) on the <a href=#stack-of-open-elements>stack of open
+ elements</a>. If it is not, add the attribute and its
+ corresponding value to that element.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "frameset"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>If the second element on the <a href=#stack-of-open-elements>stack of open
+ elements</a> is not a <code><a href=#the-body-element-0>body</a></code> element, or, if the
+ <a href=#stack-of-open-elements>stack of open elements</a> has only one node on it,
+ then ignore the token. (<a href=#fragment-case>fragment case</a>)</p>
+
+ <p>If the <a href=#frameset-ok-flag>frameset-ok flag</a> is set to "not ok", ignore
+ the token.</p>
+
+ <p>Otherwise, run the following steps:</p>
+
+ <ol><li><p>Remove the second element on the <a href=#stack-of-open-elements>stack of open
+ elements</a> from its parent node, if it has one.</li>
+
+ <li><p>Pop all the nodes from the bottom of the <a href=#stack-of-open-elements>stack of
+ open elements</a>, from the <a href=#current-node>current node</a> up to,
+ but not including, the root <code><a href=#the-html-element-0>html</a></code> element.</p>
+
+ <li><p><a href=#insert-an-html-element>Insert an HTML element</a> for the
+ token.</li>
+
+ <li><p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>".</p>
+
+ </ol></dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+
+ <p>If there is a node in the <a href=#stack-of-open-elements>stack of open elements</a>
+ that is not either a <code><a href=#the-dd-element>dd</a></code> element, a <code><a href=#the-dt-element>dt</a></code>
+ element, an <code><a href=#the-li-element>li</a></code> element, a <code><a href=#the-p-element>p</a></code> element, a
+ <code><a href=#the-tbody-element>tbody</a></code> element, a <code><a href=#the-td-element>td</a></code> element, a
+ <code><a href=#the-tfoot-element>tfoot</a></code> element, a <code><a href=#the-th-element>th</a></code> element, a
+ <code><a href=#the-thead-element>thead</a></code> element, a <code><a href=#the-tr-element>tr</a></code> element, the
+ <code><a href=#the-body-element-0>body</a></code> element, or the <code><a href=#the-html-element-0>html</a></code> element, then
+ this is a <a href=#parse-error>parse error</a>.</p> <!-- (some of those are
+ fragment cases) -->
+
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "body"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have a <code>body</code> element
+ in scope</a>, this is a <a href=#parse-error>parse error</a>; ignore the
+ token.</p>
+
+ <!-- if we get here, the insertion mode here is forcibly "in
+ body". -->
+
+ <p>Otherwise, if there is a node in the <a href=#stack-of-open-elements>stack of open
+ elements</a> that is not either a <code><a href=#the-dd-element>dd</a></code> element, a
+ <code><a href=#the-dt-element>dt</a></code> element, an <code><a href=#the-li-element>li</a></code> element, an
+ <code><a href=#the-optgroup-element>optgroup</a></code> element, an <code><a href=#the-option-element>option</a></code> element, a
+ <code><a href=#the-p-element>p</a></code> element, an <code><a href=#the-rp-element>rp</a></code> element, an
+ <code><a href=#the-rt-element>rt</a></code> element, a <code><a href=#the-tbody-element>tbody</a></code> element, a
+ <code><a href=#the-td-element>td</a></code> element, a <code><a href=#the-tfoot-element>tfoot</a></code> element, a
+ <code><a href=#the-th-element>th</a></code> element, a <code><a href=#the-thead-element>thead</a></code> element, a
+ <code><a href=#the-tr-element>tr</a></code> element, the <code><a href=#the-body-element-0>body</a></code> element, or the
+ <code><a href=#the-html-element-0>html</a></code> element, then this is a <a href=#parse-error>parse
+ error</a>.</p> <!-- (some of those are fragment cases, e.g. for
+ <tbody> you'd have hit the first paragraph since the <body>
+ wouldn't be in scope, unless it was a fragment case) -->
+
+ <!-- If we ever change the frameset-ok flag to an insertion mode,
+ then we'd have to somehow keep track of its state when we switch
+ to after-body. -->
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-afterbody title="insertion mode: after body">after body</a>".</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "html"</dt>
+ <dd>
+
+ <p>Act as if an end tag with tag name "body" had been seen,
+ then, if that token wasn't ignored, reprocess the current
+ token.</p>
+
+ </dd>
+
+ <!-- start tags for non-phrasing flow content elements -->
+
+ <!-- the normal ones -->
+ <dt>A start tag whose tag name is one of: "address", "article",
+ "aside", "blockquote", "center", <!--v2DATAGRID"datagrid",-->
+ "details", "dir", "div", "dl", "fieldset", "figure", "footer",
+ "header", "hgroup", "menu", "nav", "ol", "p", "section", "ul"</dt>
+ <dd>
+
+ <!-- As of May 2008 this doesn't match any browser exactly, but is
+ as close to what IE does as I can get without doing the non-tree
+ DOM nonsense, and thus should actually afford better compatibility
+ when implemented by the other browsers. -->
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ </dd>
+
+ <!-- as normal, but close h1-h6 if it's the current node -->
+ <dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
+ "h5", "h6"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p>If the <a href=#current-node>current node</a> is an element whose tag name
+ is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a
+ <a href=#parse-error>parse error</a>; pop the <a href=#current-node>current node</a> off
+ the <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+ <!-- See https://bugs.webkit.org/show_bug.cgi?id=12646 -->
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ </dd>
+
+ <!-- as normal, but drops leading newline -->
+ <dt>A start tag whose tag name is one of: "pre", "listing"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>If the next token is a U+000A LINE FEED (LF) character
+ token, then ignore that token and move on to the next
+ one. (Newlines at the start of <code><a href=#the-pre-element>pre</a></code> blocks are
+ ignored as an authoring convenience.)</p>
+
+ <!-- <pre>[CR]X will eat the [CR], <pre>&#x10;X will eat the
+ &#x10;, but <pre>&#x13;X will not eat the &#x13;. -->
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ </dd>
+
+ <!-- as normal, but interacts with the form element pointer -->
+ <dt>A start tag whose tag name is "form"</dt>
+ <dd>
+
+ <p>If the <a href=#form-element-pointer><code title=form>form</code> element
+ pointer</a> is not null, then this is a <a href=#parse-error>parse
+ error</a>; ignore the token.</p>
+
+ <p>Otherwise:</p>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, and set the
+ <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to
+ point to the element created.</p>
+
+ </dd>
+
+ <!-- as normal, but imply </li> when there's another <li> open in weird cases -->
+ <dt>A start tag whose tag name is "li"</dt>
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</li>
+
+ <li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current
+ node</a> (the bottommost node of the stack).</li>
+
+ <li><p><i>Loop</i>: If <var title="">node</var> is an
+ <code><a href=#the-li-element>li</a></code> element, then act as if an end tag with the tag
+ name "li" had been seen, then jump to the last step.</li>
+
+ <li><p>If <var title="">node</var> is not in the
+ <a href=#formatting>formatting</a> category, and is not in the
+ <a href=#phrasing>phrasing</a> category, and is not an
+ <code><a href=#the-address-element>address</a></code>, <code><a href=#the-div-element>div</a></code>, or <code><a href=#the-p-element>p</a></code>
+ element, then jump to the last step.</li> <!-- an element
+ <foo> is in this list if the following markup:
+
+ <!DOCTYPE html><body><ol><li><foo><li>
+
+ ...results in the second <li> not being (in any way) a descendant
+ of the first <li>, or if <foo> is a formatting element that gets
+ reopened later. -->
+
+ <li><p>Otherwise, set <var title="">node</var> to the previous
+ entry in the <a href=#stack-of-open-elements>stack of open elements</a> and return to
+ the step labeled <i>loop</i>.</li>
+
+ <li>
+
+ <p>This is the last step.</p>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p>Finally, <a href=#insert-an-html-element>insert an HTML element</a> for the
+ token.</p>
+
+ </li>
+
+ </ol></dd>
+
+ <!-- as normal, but imply </dt> or </dd> when there's another <dt> or <dd> open in weird cases -->
+ <dt>A start tag whose tag name is one of: "dd", "dt"</dt>
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</li>
+
+ <li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current
+ node</a> (the bottommost node of the stack).</li>
+
+ <li><p><i>Loop</i>: If <var title="">node</var> is a
+ <code><a href=#the-dd-element>dd</a></code> or <code><a href=#the-dt-element>dt</a></code> element, then act as if an end
+ tag with the same tag name as <var title="">node</var> had been
+ seen, then jump to the last step.</li>
+
+ <li><p>If <var title="">node</var> is not in the
+ <a href=#formatting>formatting</a> category, and is not in the
+ <a href=#phrasing>phrasing</a> category, and is not an
+ <code><a href=#the-address-element>address</a></code>, <code><a href=#the-div-element>div</a></code>, or <code><a href=#the-p-element>p</a></code>
+ element, then jump to the last step.</li> <!-- an element
+ <foo> is in this list if the following markup:
+
+ <!DOCTYPE html><body><dl><dt><foo><dt>
+
+ ...results in the second <dt> not being (in any way) a descendant
+ of the first <dt>, or if <foo> is a formatting element that gets
+ reopened later. -->
+
+ <li><p>Otherwise, set <var title="">node</var> to the previous
+ entry in the <a href=#stack-of-open-elements>stack of open elements</a> and return to
+ the step labeled <i>loop</i>.</li>
+
+ <li>
+
+ <p>This is the last step.</p>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p>Finally, <a href=#insert-an-html-element>insert an HTML element</a> for the
+ token.</p>
+
+ </li>
+
+ </ol></dd>
+
+ <!-- same as normal, but effectively ends parsing -->
+ <dt>A start tag whose tag name is "plaintext"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Switch the tokenizer to the <a href=#plaintext-state>PLAINTEXT state</a>.</p>
+
+ <p class=note>Once a start tag with the tag name "plaintext" has
+ been seen, that will be the last token ever seen other than
+ character tokens (and the end-of-file token), because there is no
+ way to switch out of the <a href=#plaintext-state>PLAINTEXT state</a>.</p>
+
+ </dd>
+
+ <!-- button is a hybrid -->
+ <dt>A start tag whose tag name is "button"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>button</code> element in
+ scope</a>, then this is a <a href=#parse-error>parse error</a>;
+ act as if an end tag with the tag name "button" had been seen,
+ then reprocess the token.</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ </dd>
+
+ <!-- end tags for non-phrasing flow content elements (and button) -->
+
+ <!-- the normal ones -->
+ <dt>An end tag whose tag name is one of: "address", "article",
+ "aside", "blockquote", "button", "center",
+ <!--v2DATAGRID"datagrid",--> "details", "dir", "div", "dl",
+ "fieldset", "figure", "footer", "header", "hgroup", "listing",
+ "menu", "nav", "ol", "pre", "section", "ul"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
+ with the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>; ignore the token.</p>
+
+ <p>Otherwise, run these steps:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+
+ <li><p>If the <a href=#current-node>current node</a> is not an element with
+ the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>.</li>
+
+ <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
+ until an element with the same tag name as the token has been
+ popped from the stack.</li>
+
+ </ol></dd>
+
+ <!-- removes the form element pointer instead of the matching node -->
+ <dt>An end tag whose tag name is "form"</dt>
+ <dd>
+
+ <p>Let <var title="">node</var> be the element that the
+ <a href=#form-element-pointer><code title="">form</code> element pointer</a> is set
+ to.</p>
+
+ <p>Set the <a href=#form-element-pointer><code title="">form</code> element pointer</a>
+ to null.</p>
+
+ <p>If <var title="">node</var> is null or the <a href=#stack-of-open-elements>stack of open
+ elements</a> does not <a href=#has-an-element-in-scope title="has an element in
+ scope">have <var title="">node</var> in scope</a>, then this is
+ a <a href=#parse-error>parse error</a>; ignore the token.</p>
+
+ <p>Otherwise, run these steps:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+
+ <li><p>If the <a href=#current-node>current node</a> is not <var title="">node</var>, then this is a <a href=#parse-error>parse
+ error</a>.</li>
+
+ <li><p>Remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of
+ open elements</a>.</li>
+
+ </ol></dd>
+
+ <!-- as normal, except </p> implies <p> if there's no <p> in scope, and needs care as the elements have optional tags -->
+ <dt>An end tag whose tag name is "p"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
+ with the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>; act as if a start tag with the tag name
+ "p" had been seen, then reprocess the current token.</p>
+
+ <p>Otherwise, run these steps:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except
+ for elements with the same tag name as the token.</li>
+
+ <li><p>If the <a href=#current-node>current node</a> is not an element with
+ the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>.</li>
+
+ <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
+ until an element with the same tag name as the token has been
+ popped from the stack.</li>
+
+ </ol></dd>
+
+ <!-- as normal, but needs care as the elements have optional tags, and are further scoped by <ol>/<ul> -->
+ <dt>An end tag whose tag name is "li"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-list-item-scope title="has an element in list item scope">have an element in list
+ item scope</a> with the same tag name as that of the token,
+ then this is a <a href=#parse-error>parse error</a>; ignore the token.</p>
+
+ <p>Otherwise, run these steps:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except
+ for elements with the same tag name as the token.</li>
+
+ <li><p>If the <a href=#current-node>current node</a> is not an element with
+ the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>.</li>
+
+ <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
+ until an element with the same tag name as the token has been
+ popped from the stack.</li>
+
+ </ol></dd>
+
+ <!-- as normal, but needs care as the elements have optional tags -->
+ <dt>An end tag whose tag name is one of: "dd", "dt"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
+ with the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>; ignore the token.</p>
+
+ <p>Otherwise, run these steps:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except
+ for elements with the same tag name as the token.</li>
+
+ <li><p>If the <a href=#current-node>current node</a> is not an element with
+ the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>.</li>
+
+ <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
+ until an element with the same tag name as the token has been
+ popped from the stack.</li>
+
+ </ol></dd>
+
+ <!-- as normal, except acts as a closer for any of the h1-h6 elements -->
+ <dt>An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
+ whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6",
+ then this is a <a href=#parse-error>parse error</a>; ignore the token.</p>
+
+ <p>Otherwise, run these steps:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+
+ <li><p>If the <a href=#current-node>current node</a> is not an element with
+ the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>.</li>
+
+ <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
+ until an element whose tag name is one of "h1", "h2", "h3", "h4",
+ "h5", or "h6" has been popped from the stack.</li>
+
+ </ol></dd>
+
+ <!-- see also applet/marquee/object lower down -->
+
+ <dt>An end tag whose tag name is "sarcasm"</dt>
+ <dd>
+ <p>Take a deep breath, then act as described in the "any other end
+ tag" entry below.</p>
+ </dd>
+
+ <!-- ADOPTION AGENCY ELEMENTS
+ Mozilla-only: bdo blink del ins sub sup q
+ Safari-only: code dfn kbd nobr samp var wbr
+ Both: a b big em font i s small strike strong tt u -->
+
+ <dt>A start tag whose tag name is "a"</dt>
+ <dd>
+
+ <p>If the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>
+ contains an element whose tag name is "a" between the end of
+ the list and the last marker on the list (or the start of the
+ list if there is no marker on the list), then this is a
+ <a href=#parse-error>parse error</a>; act as if an end tag with the tag
+ name "a" had been seen, then remove that element from the
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a> and the
+ <a href=#stack-of-open-elements>stack of open elements</a> if the end tag didn't
+ already remove it (it might not have if the element is not
+ <a href=#has-an-element-in-table-scope title="has an element in table scope">in table
+ scope</a>).</p>
+
+ <p class=example>In the non-conforming stream
+ <code>&lt;a&nbsp;href="a"&gt;a&lt;table&gt;&lt;a&nbsp;href="b"&gt;b&lt;/table&gt;x</code>,
+ the first <code><a href=#the-a-element>a</a></code> element would be closed upon seeing the
+ second one, and the "x" character would be inside a link to "b",
+ not to "a". This is despite the fact that the outer <code><a href=#the-a-element>a</a></code>
+ element is not in table scope (meaning that a regular
+ <code>&lt;/a&gt;</code> end tag at the start of the table wouldn't
+ close the outer <code><a href=#the-a-element>a</a></code> element). The result is that the
+ two <code><a href=#the-a-element>a</a></code> elements are indirectly nested inside each
+ other &mdash; non-conforming markup will often result in
+ non-conforming DOMs when parsed.</p>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Add that
+ element to the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "b", "big", "code", "em",
+ "font", "i", "s", "small", "strike", "strong", "tt", "u"</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Add that
+ element to the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "nobr"</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an
+ element in scope">has a <code>nobr</code> element in scope</a>,
+ then this is a <a href=#parse-error>parse error</a>; act as if an end tag with
+ the tag name "nobr" had been seen, then once again
+ <a href=#reconstruct-the-active-formatting-elements>reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Add that
+ element to the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>.</p>
+
+ </dd>
+
+ <dt id=adoptionAgency>An end tag whose tag name is one of: "a",
+ "b", "big", "code", "em", "font", "i", "nobr", "s", "small",
+ "strike", "strong", "tt", "u"</dt>
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li>
+
+ <p>Let the <var title="">formatting element</var> be the
+ last element in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a> that:</p>
+
+ <ul><li>is between the end of the list and the last scope
+ marker in the list, if any, or the start of the list
+ otherwise, and</li>
+
+ <li>has the same tag name as the token.</li>
+
+ </ul><p>If there is no such node, or, if that node is also in the
+ <a href=#stack-of-open-elements>stack of open elements</a> but the element is not <a href=#has-an-element-in-scope title="has an element in scope">in scope</a>, then this is a
+ <a href=#parse-error>parse error</a>; ignore the token, and abort these
+ steps.</p>
+
+ <p>Otherwise, if there is such a node, but that node is not
+ in the <a href=#stack-of-open-elements>stack of open elements</a>, then this is a
+ <a href=#parse-error>parse error</a>; remove the element from the list,
+ and abort these steps.</p>
+
+ <p>Otherwise, there is a <var title="">formatting
+ element</var> and that element is in <a href=#stack-of-open-elements title="stack of
+ open elements">the stack</a> and is <a href=#has-an-element-in-scope title="has an
+ element in scope">in scope</a>. If the element is not the
+ <a href=#current-node>current node</a>, this is a <a href=#parse-error>parse
+ error</a>. In any case, proceed with the algorithm as
+ written in the following steps.</p>
+
+ </li>
+
+ <li><p>Let the <var title="">furthest block</var> be the
+ topmost node in the <a href=#stack-of-open-elements>stack of open elements</a> that
+ is lower in the stack than the <var title="">formatting
+ element</var>, and is not an element in the
+ <a href=#phrasing>phrasing</a> or <a href=#formatting>formatting</a>
+ categories. There might not be one.</li>
+
+ <li><p>If there is no <var title="">furthest block</var>,
+ then the UA must skip the subsequent steps and instead just
+ pop all the nodes from the bottom of the <a href=#stack-of-open-elements>stack of open
+ elements</a>, from the <a href=#current-node>current node</a> up to and
+ including the <var title="">formatting element</var>, and
+ remove the <var title="">formatting element</var> from the
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</li>
+
+ <li><p>Let the <var title="">common ancestor</var> be the element
+ immediately above the <var title="">formatting element</var> in the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</li>
+
+ <li><p>Let a bookmark note the position of the <var title="">formatting element</var> in the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a> relative to the elements on either
+ side of it in the list.</li>
+
+ <li>
+
+ <p>Let <var title="">node</var> and <var title="">last node</var> be the
+ <var title="">furthest block</var>. Follow these steps:</p>
+
+ <ol><li>Let <var title="">node</var> be the element immediately
+ above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
+ elements</a>, or if <var title="">node</var> is no longer in
+ the <a href=#stack-of-open-elements>stack of open elements</a> (e.g. because it got
+ removed by the next step), the element that was immediately
+ above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
+ elements</a> before <var title="">node</var> was
+ removed.</li>
+
+ <li>If <var title="">node</var> is not in the <a href=#list-of-active-formatting-elements>list of
+ active formatting elements</a>, then remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open
+ elements</a> and then go back to step 1.</li>
+
+ <li>Otherwise, if <var title="">node</var> is the <var title="">formatting element</var>, then go to the next step
+ in the overall algorithm.</li>
+
+ <li>Otherwise, if <var title="">last node</var> is the <var title="">furthest block</var>, then move the aforementioned
+ bookmark to be immediately after the <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>.</li>
+
+ <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
+ element <var title="">node</var> was created, replace the entry
+ for <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a> with an entry for the new element,
+ replace the entry for <var title="">node</var> in the
+ <a href=#stack-of-open-elements>stack of open elements</a> with an entry for the new
+ element, and let <var title="">node</var> be the new
+ element.</li>
+
+ <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous
+ parent node if any.</li>
+
+ <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
+
+ <li>Return to step 1 of this inner set of steps.</li>
+
+ </ol></li>
+
+ <li>
+
+ <p>If the <var title="">common ancestor</var> node is a
+ <code><a href=#the-table-element>table</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>,
+ <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-tr-element>tr</a></code> element, then,
+ <a href=#foster-parent>foster parent</a> whatever <var title="">last
+ node</var> ended up being in the previous step, first removing
+ it from its previous parent node if any.</p>
+
+ <p>Otherwise, append whatever <var title="">last node</var>
+ ended up being in the previous step to the <var title="">common
+ ancestor</var> node, first removing it from its previous parent
+ node if any.</p>
+
+ </li>
+
+ <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
+ <var title="">formatting element</var> was created.</li>
+
+ <li><p>Take all of the child nodes of the <var title="">furthest
+ block</var> and append them to the element created in the last
+ step.</li>
+
+ <li><p>Append that new element to the <var title="">furthest
+ block</var>.</li>
+
+ <li><p>Remove the <var title="">formatting element</var> from the
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and insert the
+ new element into the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a> at the position of the aforementioned
+ bookmark.</li>
+
+ <li><p>Remove the <var title="">formatting element</var> from the
+ <a href=#stack-of-open-elements>stack of open elements</a>, and insert the new element
+ into the <a href=#stack-of-open-elements>stack of open elements</a> immediately below
+ the position of the <var title="">furthest block</var> in that
+ stack.</li>
+
+ <li><p>Jump back to step 1 in this series of steps.</li>
+
+ </ol><p class=note>Because of the way this algorithm causes elements
+ to change parents, it has been dubbed the "adoption agency
+ algorithm" (in contrast with other possible algorithms for dealing
+ with misnested content, which included the "incest algorithm", the
+ "secret affair algorithm", and the "Heisenberg algorithm").</p>
+
+ </dd>
+
+ <dt>A start tag token whose tag name is one of: "applet",
+ "marquee", "object"</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Insert a marker at the end of the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a>.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ </dd>
+
+ <dt>An end tag token whose tag name is one of: "applet",
+ "marquee", "object"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
+ with the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>; ignore the token.</p>
+
+ <p>Otherwise, run these steps:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+
+ <li><p>If the <a href=#current-node>current node</a> is not an element with
+ the same tag name as that of the token, then this is a
+ <a href=#parse-error>parse error</a>.</li>
+
+ <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
+ until an element with the same tag name as the token has been
+ popped from the stack.</li>
+
+ <li><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the
+ last marker</a>.</li>
+
+ </ol></dd>
+
+ <dt>A start tag whose tag name is "table"</dt>
+ <dd>
+
+ <p>If the <code><a href=#document>Document</a></code> is <em>not</em> set to
+ <a href=#quirks-mode>quirks mode</a>, and the <a href=#stack-of-open-elements>stack of open
+ elements</a> <a href=#has-an-element-in-scope title="has an element in scope">has a
+ <code>p</code> element in scope</a>, then act as if an end tag
+ with the tag name "p" had been seen.</p> <!-- i hate myself (this
+ quirk was basically caused by acid2; if i'd realised we could
+ change the specs when i wrote acid2, we could have avoided having
+ any parsing-mode quirks) -Hixie -->
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "area", "basefont",
+ "bgsound", "br", "embed", "img", "input", "keygen", "wbr"</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately
+ pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p> <!--
+ shouldn't really do it for <area>, <basefont>, and <bgsound> -->
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "param", "source", "track"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately
+ pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "hr"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately
+ pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "image"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Change the token's tag name
+ to "img" and reprocess it. (Don't ask.)</p> <!-- As of
+ 2005-12, studies showed that around 0.2% of pages used the
+ <image> element. -->
+ </dd>
+
+ <dt id=isindex>A start tag whose tag name is "isindex"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>If the <a href=#form-element-pointer><code title="">form</code> element
+ pointer</a> is not null, then ignore the token.</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p> <!--
+ purely to reduce the number of errors (we don't care if they
+ included the /, they're not supposed to be including the tag at
+ all! -->
+
+ <p>Act as if a start tag token with the tag name "form" had been seen.</p>
+
+ <p>If the token has an attribute called "action", set the
+ <code title=attr-form-action>action</code> attribute on the
+ resulting <code><a href=#the-form-element>form</a></code> element to the value of the
+ "action" attribute of the token.</p>
+
+ <p>Act as if a start tag token with the tag name "hr" had been
+ seen.</p>
+
+ <p>Act as if a start tag token with the tag name "label" had been
+ seen.</p>
+
+ <p>Act as if a stream of character tokens had been seen (see below
+ for what they should say).</p>
+
+ <p>Act as if a start tag token with the tag name "input" had been
+ seen, with all the attributes from the "isindex" token except
+ "name", "action", and "prompt". Set the <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute of the resulting
+ <code><a href=#the-input-element>input</a></code> element to the value "<code title="">isindex</code>".</p>
+
+ <p>Act as if a stream of character tokens had been seen (see
+ below for what they should say).</p>
+
+ <p>Act as if an end tag token with the tag name "label" had been
+ seen.</p>
+
+ <p>Act as if a start tag token with the tag name "hr" had been
+ seen.</p>
+
+ <p>Act as if an end tag token with the tag name "form" had been
+ seen.</p>
+
+ <p>If the token has an attribute with the name "prompt", then the
+ first stream of characters must be the same string as given in
+ that attribute, and the second stream of characters must be
+ empty. Otherwise, the two streams of character tokens together
+ should, together with the <code><a href=#the-input-element>input</a></code> element, express the
+ equivalent of "This is a searchable index. Enter search keywords:
+ (input field)" in the user's preferred language.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "textarea"</dt>
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p><a href=#insert-an-html-element>Insert an HTML element</a> for the
+ token.</li>
+
+ <li><p>If the next token is a U+000A LINE FEED (LF) character
+ token, then ignore that token and move on to the next
+ one. (Newlines at the start of <code><a href=#the-textarea-element>textarea</a></code> elements are
+ ignored as an authoring convenience.)</li>
+
+ <!-- see comment in <pre> start tag bit -->
+
+ <li><p>Switch the tokenizer to the <a href=#rcdata-state>RCDATA
+ state</a>.</li>
+
+ <li><p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the
+ current <a href=#insertion-mode>insertion mode</a>.</p>
+
+ <li><p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not
+ ok".</li>
+
+ <li><p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incdata title="insertion mode: text">text</a>".</li>
+
+ </ol></dd>
+
+ <dt>A start tag whose tag name is "xmp"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has
+ an element in scope">has a <code>p</code> element in
+ scope</a>, then act as if an end tag with the tag name
+ "p" had been seen.</p>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "iframe"</dt>
+ <dd>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "noembed"</dt>
+ <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag>scripting flag</a> is enabled</dt>
+ <dd>
+
+ <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "select"</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
+
+ <p>If the <a href=#insertion-mode>insertion mode</a> is one of <a href=#parsing-main-intable title="insertion mode: in table">in table</a>", "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>", "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column group</a>",
+ "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
+ body</a>", "<a href=#parsing-main-intr title="insertion mode: in row">in
+ row</a>", or "<a href=#parsing-main-intd title="insertion mode: in cell">in
+ cell</a>", then switch the <a href=#insertion-mode>insertion mode</a> to
+ "<a href=#parsing-main-inselectintable title="insertion mode: in select in table">in select in
+ table</a>". Otherwise, switch the <a href=#insertion-mode>insertion mode</a>
+ to "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "optgroup", "option"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an
+ element in scope">has an <code>option</code> element in
+ scope</a>, then act as if an end tag with the tag name "option"
+ had been seen.</p>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "rp", "rt"</dt>
+ <dd>
+
+ <!-- the parsing rules for ruby really don't match IE much at all,
+ but in practice the markup used is very simple and so strict
+ compatibility with IE isn't required. For example, as defined
+ here we get very, very different behaviour than IE for
+ pathological cases like:
+
+ <ruby><ol><li><p>a<rt>b
+ <ruby>a<rt>b<p>c
+
+ But in practice most ruby markup falls into these cases:
+
+ <ruby>a<rt>b</ruby>
+ <ruby>a<rp>b<rt>c<rp>d</ruby>
+ <ruby>a<rt>b</rt></ruby>
+ <ruby>a<rp>b</rp><rt>c</rt><rp>d</rp></ruby>
+
+ -->
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an
+ element in scope">has a <code>ruby</code> element in scope</a>,
+ then <a href=#generate-implied-end-tags>generate implied end tags</a>. If the <a href=#current-node>current
+ node</a> is not then a <code><a href=#the-ruby-element>ruby</a></code> element, this is a
+ <a href=#parse-error>parse error</a>; pop all the nodes from the <a href=#current-node>current
+ node</a> up to the node immediately before the bottommost
+ <code><a href=#the-ruby-element>ruby</a></code> element on the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "br"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Act as if a start tag token with
+ the tag name "br" had been seen. Ignore the end tag token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "math"</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#adjust-mathml-attributes>Adjust MathML attributes</a> for the token. (This
+ fixes the case of MathML attributes that are not all
+ lowercase.)</p>
+
+ <p><a href=#adjust-foreign-attributes>Adjust foreign attributes</a> for the token. (This
+ fixes the use of namespaced attributes, in particular XLink.)</p>
+
+ <p><a href=#insert-a-foreign-element>Insert a foreign element</a> for the token, in the
+ <a href=#mathml-namespace>MathML namespace</a>.</p>
+
+ <!-- If we ever change the frameset-ok flag to an insertion mode,
+ the following change would be implied, except we'd have to do it
+ even in the face of a self-closed tag:
+ <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
+ -->
+
+ <p>If the token has its <i>self-closing flag</i> set, pop the
+ <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a> and <a href=#acknowledge-self-closing-flag title="acknowledge self-closing
+ flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
+
+ <p>Otherwise, if the <a href=#insertion-mode>insertion mode</a> is not already
+ "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
+ content</a>", let the <a href=#secondary-insertion-mode>secondary insertion mode</a> be
+ the current <a href=#insertion-mode>insertion mode</a>, and then switch the
+ <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inforeign title="insertion mode: in
+ foreign content">in foreign content</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "svg"</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#adjust-svg-attributes>Adjust SVG attributes</a> for the token. (This fixes
+ the case of SVG attributes that are not all lowercase.)</p>
+
+ <p><a href=#adjust-foreign-attributes>Adjust foreign attributes</a> for the token. (This
+ fixes the use of namespaced attributes, in particular XLink in
+ SVG.)</p>
+
+ <p><a href=#insert-a-foreign-element>Insert a foreign element</a> for the token, in the
+ <a href=#svg-namespace>SVG namespace</a>.</p>
+
+ <!-- If we ever change the frameset-ok flag to an insertion mode,
+ the following change would be implied, except we'd have to do it
+ even in the face of a self-closed tag:
+ <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
+ -->
+
+ <p>If the token has its <i>self-closing flag</i> set, pop the
+ <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a> and <a href=#acknowledge-self-closing-flag title="acknowledge self-closing
+ flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
+
+ <p>Otherwise, if the <a href=#insertion-mode>insertion mode</a> is not already
+ "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
+ content</a>", let the <a href=#secondary-insertion-mode>secondary insertion mode</a> be
+ the current <a href=#insertion-mode>insertion mode</a>, and then switch the
+ <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inforeign title="insertion mode: in
+ foreign content">in foreign content</a>".</p>
+
+ </dd>
+
+ <dt>A start <!--or end--> tag whose tag name is one of: "caption",
+ "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th",
+ "thead", "tr"</dt>
+ <!--<dt>An end tag whose tag name is one of: "area", "base",
+ "basefont", "bgsound", "command", "embed", "hr", "iframe", "image",
+ "img", "input", "isindex", "keygen", "link", "meta", "noembed",
+ "noframes", "param", "script", "select", "source", "style",
+ "table", "textarea", "title", "track", "wbr"</dt>-->
+ <!--<dt>An end tag whose tag name is "noscript", if the
+ <span>scripting flag</span> is enabled</dt>-->
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ <!-- end tags are commented out because since they can never end
+ up on the stack anyway, the default end tag clause will
+ automatically handle them. we don't want to have text in the spec
+ that is just an optimisation, as that detracts from the spec
+ itself -->
+ </dd>
+
+ <dt>Any other start tag</dt>
+ <dd>
+
+ <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
+ any.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p class=note>This element will be a <a href=#phrasing>phrasing</a>
+ element.</p>
+
+ </dd>
+
+ <dt>Any other end tag</dt>
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current
+ node</a> (the bottommost node of the stack).</li>
+
+ <li><p>If <var title="">node</var> has the same tag name as
+ the token, then:</p>
+
+ <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+
+ <li><p>If the tag name of the end tag token does not match
+ the tag name of the <a href=#current-node>current node</a>, this is a
+ <a href=#parse-error>parse error</a>.</li>
+
+ <li><p>Pop all the nodes from the <a href=#current-node>current node</a> up
+ to <var title="">node</var>, including <var title="">node</var>, then stop these steps.</li>
+
+ </ol></li>
+
+ <li><p>Otherwise, if <var title="">node</var> is in neither the
+ <a href=#formatting>formatting</a> category nor the <a href=#phrasing>phrasing</a>
+ category, then this is a <a href=#parse-error>parse error</a>; ignore the
+ token, and abort these steps.</li>
+
+ <li><p>Set <var title="">node</var> to the previous entry in the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</li>
+
+ <li><p>Return to step 2.</li>
+
+ </ol></dd>
+
+ </dl><h5 id=parsing-main-incdata><span class=secno>10.2.5.11 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-incdata title="insertion
+ mode: text">text</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token</dt>
+ <dd>
+
+ <p><a href=#insert-a-character title="insert a character">Insert the token's
+ character</a> into the <a href=#current-node>current node</a>.</p>
+
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+
+ <!-- can't be the fragment case -->
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>If the <a href=#current-node>current node</a> is a <code><a href=#script>script</a></code>
+ element, mark the <code><a href=#script>script</a></code> element as <a href=#already-started>"already
+ started"</a>.</p>
+
+ <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original
+ insertion mode</a> and reprocess the current token.</p>
+
+ </dd>
+
+ <dt id=scriptEndTag>An end tag whose tag name is "script"</dt>
+ <dd>
+
+ <p>Let <var title="">script</var> be the <a href=#current-node>current node</a>
+ (which will be a <code><a href=#script>script</a></code> element).</p>
+
+ <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original
+ insertion mode</a>.</p>
+
+ <p>Let the <var title="">old insertion point</var> have the
+ same value as the current <a href=#insertion-point>insertion point</a>. Let
+ the <a href=#insertion-point>insertion point</a> be just before the <a href=#next-input-character>next
+ input character</a>.</p>
+
+ <p>Increment the parser's <a href=#script-nesting-level>script nesting level</a> by
+ one.</p>
+
+ <p><a href=#running-a-script title="running a script">Run</a> the <var title="">script</var>. This might cause some script to execute,
+ which might cause <a href=#dom-document-write title=dom-document-write>new characters
+ to be inserted into the tokenizer</a>, and might cause the
+ tokenizer to output more tokens, resulting in a <a href=#nestedParsing>reentrant invocation of the parser</a>.</p>
+
+ <p>Decrement the parser's <a href=#script-nesting-level>script nesting level</a> by
+ one. If the parser's <a href=#script-nesting-level>script nesting level</a> is zero,
+ then set the <a href=#parser-pause-flag>parser pause flag</a> to false.</p>
+
+ <p>Let the <a href=#insertion-point>insertion point</a> have the value of the <var title="">old insertion point</var>. (In other words, restore the
+ <a href=#insertion-point>insertion point</a> to its previous value. This value
+ might be the "undefined" value.)</p>
+
+ <p id=scriptTagParserResumes>At this stage, if there is a
+ <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>, then:</p>
+
+ <dl class=switch><dt>If the <a href=#script-nesting-level>script nesting level</a> is not zero:</dt>
+
+ <dd>
+
+ <p>Set the <a href=#parser-pause-flag>parser pause flag</a> to true, and abort the
+ processing of any nested invocations of the tokenizer, yielding
+ control back to the caller. (Tokenization will resume when the
+ caller returns to the "outer" tree construction stage.)</p>
+
+ <p class=note>The tree construction stage of this particular
+ parser is <a href=#nestedParsing>being called reentrantly</a>,
+ say from a call to <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code>.</p>
+
+ </dd>
+
+
+ <dt>Otherwise:</dt>
+
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p>Let <var title="">the script</var> be the <a href=#pending-parsing-blocking-script>pending
+ parsing-blocking script</a>. There is no longer a <a href=#pending-parsing-blocking-script>pending
+ parsing-blocking script</a>.</li>
+
+ <li><p>Block the <a href=#tokenization title=tokenization>tokenizer</a>
+ for this instance of the <a href=#html-parser>HTML parser</a>, such that
+ the <a href=#event-loop>event loop</a> will not run <a href=#concept-task title=concept-task>tasks</a> that invoke the <a href=#tokenization title=tokenization>tokenizer</a>.</li>
+
+ <li><p><a href=#spin-the-event-loop>Spin the event loop</a> until there is no <a href=#a-style-sheet-blocking-scripts title="a style sheet blocking scripts">style sheet blocking
+ scripts</a> and <var title="">the script</var>'s
+ <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag is set.</li>
+
+ <li><p>Unblock the <a href=#tokenization title=tokenization>tokenizer</a>
+ for this instance of the <a href=#html-parser>HTML parser</a>, such that
+ <a href=#concept-task title=concept-task>tasks</a> that invoke the <a href=#tokenization title=tokenization>tokenizer</a> can again be
+ run.</li>
+
+ <li><p>Let the <a href=#insertion-point>insertion point</a> be just before the
+ <a href=#next-input-character>next input character</a>.</li>
+
+ <li><p>Increment the parser's <a href=#script-nesting-level>script nesting level</a>
+ by one (it should be zero before this step, so this sets it to
+ one).</li>
+
+ <li><p><a href=#executing-a-script-block title="executing a script block">Execute</a>
+ <var title="">the script</var>.</li>
+
+ <li><p>Decrement the parser's <a href=#script-nesting-level>script nesting level</a>
+ by one. If the parser's <a href=#script-nesting-level>script nesting level</a> is
+ zero (which it always should be at this point), then set the
+ <a href=#parser-pause-flag>parser pause flag</a> to false.</p>
+
+ <li><p>Let the <a href=#insertion-point>insertion point</a> be undefined
+ again.</li>
+
+ <li><p>If there is once again a <a href=#pending-parsing-blocking-script>pending parsing-blocking
+ script</a>, then repeat these steps from step 1.</li>
+
+ </ol></dd>
+
+ </dl></dd>
+
+ <dt>Any other end tag</dt>
+ <dd>
+
+ <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original
+ insertion mode</a>.</p>
+
+ </dd>
+
+ </dl><h5 id=parsing-main-intable><span class=secno>10.2.5.12 </span>The "<dfn title="insertion mode: in table">in table</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intable title="insertion
+ mode: in table">in table</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token</dt>
+ <dd>
+
+ <p>Let the <dfn id=pending-table-character-tokens><var>pending table character tokens</var></dfn>
+ be an empty list of tokens.</p>
+
+ <p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the current
+ <a href=#insertion-mode>insertion mode</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intabletext title="insertion mode: in table text">in table text</a>" and
+ reprocess the token.</p>
+
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "caption"</dt>
+ <dd>
+
+ <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
+ below.)</p>
+
+ <p>Insert a marker at the end of the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a>.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then
+ switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "colgroup"</dt>
+ <dd>
+
+ <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
+ below.)</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then
+ switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column
+ group</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "col"</dt>
+ <dd>
+ <p>Act as if a start tag token with the tag name "colgroup"
+ had been seen, then reprocess the current token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "tbody", "tfoot", "thead"</dt>
+ <dd>
+
+ <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
+ below.)</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then
+ switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
+ body</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "td", "th", "tr"</dt>
+ <dd>
+ <p>Act as if a start tag token with the tag name "tbody" had
+ been seen, then reprocess the current token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "table"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>. Act as if an end tag token with
+ the tag name "table" had been seen, then, if that token wasn't
+ ignored, reprocess the current token.</p>
+
+ <p class=note>The fake end tag token here can only be
+ ignored in the <a href=#fragment-case>fragment case</a>.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "table"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as the token, this is a
+ <a href=#parse-error>parse error</a>. Ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise:</p>
+
+ <p>Pop elements from this stack until a <code><a href=#the-table-element>table</a></code>
+ element has been popped from the stack.</p>
+
+ <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "body", "caption",
+ "col", "colgroup", "html", "tbody", "td", "tfoot", "th",
+ "thead", "tr"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "style", "script"</dt>
+ <dd>
+
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "input"</dt>
+ <dd>
+
+ <p>If the token does not have an attribute with the name "type",
+ or if it does, but that attribute's value is not an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">hidden</code>", then: act as described in the "anything
+ else" entry below.</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Pop that <code><a href=#the-input-element>input</a></code> element off the <a href=#stack-of-open-elements>stack of
+ open elements</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "form"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>If the <a href=#form-element-pointer><code title=form>form</code> element
+ pointer</a> is not null, ignore the token.</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ <p>Pop that <code><a href=#the-form-element>form</a></code> element off the <a href=#stack-of-open-elements>stack of
+ open elements</a>.</p>
+
+ </dd>
+
+ <!-- "form" end tag falls through to in-body, which does the right thing -->
+
+ <dt>An end-of-file token</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is not the root
+ <code><a href=#the-html-element-0>html</a></code> element, then this is a <a href=#parse-error>parse
+ error</a>.</p>
+
+ <p class=note>It can only be the <a href=#current-node>current node</a> in
+ the <a href=#fragment-case>fragment case</a>.</p>
+
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>. Process the token <a href=#using-the-rules-for>using the
+ rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in
+ body</a>" <a href=#insertion-mode>insertion mode</a>, except that if the
+ <a href=#current-node>current node</a> is a <code><a href=#the-table-element>table</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-thead-element>thead</a></code>, or
+ <code><a href=#the-tr-element>tr</a></code> element, then, whenever a node would be inserted
+ into the <a href=#current-node>current node</a>, it must instead be <a href=#foster-parent title="foster parent">foster parented</a>.</p>
+
+ </dd>
+
+ </dl><p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-context>clear the stack
+ back to a table context</dfn>, it means that the UA must, while
+ the <a href=#current-node>current node</a> is not a <code><a href=#the-table-element>table</a></code>
+ element or an <code><a href=#the-html-element-0>html</a></code> element, pop elements from the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+
+ <p class=note>The <a href=#current-node>current node</a> being an
+ <code><a href=#the-html-element-0>html</a></code> element after this process is a <a href=#fragment-case>fragment
+ case</a>.</p>
+
+
+
+ <h5 id=parsing-main-intabletext><span class=secno>10.2.5.13 </span>The "<dfn title="insertion mode: in table text">in table text</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intabletext title="insertion
+ mode: in table text">in table text</a>", tokens must be handled
+ as follows:</p>
+
+ <dl class=switch><dt>A character token</dt>
+ <dd>
+
+ <p>Append the character token to the <var><a href=#pending-table-character-tokens>pending table character
+ tokens</a></var> list.</p>
+
+ </dd>
+
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p>If any of the tokens in the <var><a href=#pending-table-character-tokens>pending table character
+ tokens</a></var> list are character tokens that are not one of U+0009
+ CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED
+ (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE, then
+ reprocess those character tokens using the rules given in the
+ "anything else" entry in the <a href=#parsing-main-intable title="insertion mode: in
+ table">in table</a>" insertion mode.</p>
+
+ <p>Otherwise, <a href=#insert-a-character title="insert a character">insert the
+ characters</a> given by the <var><a href=#pending-table-character-tokens>pending table character
+ tokens</a></var> list into the <a href=#current-node>current node</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original
+ insertion mode</a> and reprocess the token.</p>
+
+ </dd>
+
+ </dl><h5 id=parsing-main-incaption><span class=secno>10.2.5.14 </span>The "<dfn title="insertion mode: in caption">in caption</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-incaption title="insertion
+ mode: in caption">in caption</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>An end tag whose tag name is "caption"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as the token, this is a
+ <a href=#parse-error>parse error</a>. Ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</p>
+
+ <p>Now, if the <a href=#current-node>current node</a> is not a
+ <code><a href=#the-caption-element>caption</a></code> element, then this is a <a href=#parse-error>parse
+ error</a>.</p>
+
+ <p>Pop elements from this stack until a <code><a href=#the-caption-element>caption</a></code>
+ element has been popped from the stack.</p>
+
+ <p><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to
+ the last marker</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "caption", "col",
+ "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
+ <dt>An end tag whose tag name is "table"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>. Act as if an end tag with the tag
+ name "caption" had been seen, then, if that token wasn't
+ ignored, reprocess the current token.</p>
+
+ <p class=note>The fake end tag token here can only be
+ ignored in the <a href=#fragment-case>fragment case</a>.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "body", "col",
+ "colgroup", "html", "tbody", "td", "tfoot", "th", "thead",
+ "tr"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ </dl><h5 id=parsing-main-incolgroup><span class=secno>10.2.5.15 </span>The "<dfn title="insertion mode: in column group">in column group</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-incolgroup title="insertion
+ mode: in column group">in column group</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p><a href=#insert-a-character title="insert a character">Insert the character</a> into
+ the <a href=#current-node>current node</a>.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "col"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately
+ pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "colgroup"</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is the root
+ <code><a href=#the-html-element-0>html</a></code> element, then this is a <a href=#parse-error>parse
+ error</a>; ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise, pop the <a href=#current-node>current node</a> (which will be
+ a <code><a href=#the-colgroup-element>colgroup</a></code> element) from the <a href=#stack-of-open-elements>stack of open
+ elements</a>. Switch the <a href=#insertion-mode>insertion mode</a> to
+ "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "col"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is the root <code><a href=#the-html-element-0>html</a></code>
+ element, then <a href=#stop-parsing>stop parsing</a>. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise, act as described in the "anything else" entry
+ below.</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p>Act as if an end tag with the tag name "colgroup" had been
+ seen, and then, if that token wasn't ignored, reprocess the
+ current token.</p>
+
+ <p class=note>The fake end tag token here can only be
+ ignored in the <a href=#fragment-case>fragment case</a>.</p>
+
+ </dd>
+
+ </dl><h5 id=parsing-main-intbody><span class=secno>10.2.5.16 </span>The "<dfn title="insertion mode: in table body">in table body</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intbody title="insertion
+ mode: in table body">in table body</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A start tag whose tag name is "tr"</dt>
+ <dd>
+
+ <p><a href=#clear-the-stack-back-to-a-table-body-context>Clear the stack back to a table body
+ context</a>. (See below.)</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then switch
+ the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion mode:
+ in row">in row</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "th", "td"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Act as if a start tag with
+ the tag name "tr" had been seen, then reprocess the current
+ token.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "tbody", "tfoot",
+ "thead"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as the token, this is a
+ <a href=#parse-error>parse error</a>. Ignore the token.</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#clear-the-stack-back-to-a-table-body-context>Clear the stack back to a table body
+ context</a>. (See below.)</p>
+
+ <p>Pop the <a href=#current-node>current node</a> from the <a href=#stack-of-open-elements>stack of
+ open elements</a>. Switch the <a href=#insertion-mode>insertion mode</a>
+ to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "caption", "col",
+ "colgroup", "tbody", "tfoot", "thead"</dt>
+ <dt>An end tag whose tag name is "table"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a
+ <code>tbody</code>, <code>thead</code>, or <code>tfoot</code>
+ element in table scope</a>, this is a <a href=#parse-error>parse
+ error</a>. Ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#clear-the-stack-back-to-a-table-body-context>Clear the stack back to a table body
+ context</a>. (See below.)</p>
+
+ <p>Act as if an end tag with the same tag name as the
+ <a href=#current-node>current node</a> ("tbody", "tfoot", or "thead") had
+ been seen, then reprocess the current token.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "body", "caption",
+ "col", "colgroup", "html", "td", "th", "tr"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ </dl><p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-body-context>clear the stack
+ back to a table body context</dfn>, it means that the UA must,
+ while the <a href=#current-node>current node</a> is not a <code><a href=#the-tbody-element>tbody</a></code>,
+ <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-html-element-0>html</a></code>
+ element, pop elements from the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p class=note>The <a href=#current-node>current node</a> being an
+ <code><a href=#the-html-element-0>html</a></code> element after this process is a <a href=#fragment-case>fragment
+ case</a>.</p>
+
+
+ <h5 id=parsing-main-intr><span class=secno>10.2.5.17 </span>The "<dfn title="insertion mode: in row">in row</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intr title="insertion
+ mode: in row">in row</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A start tag whose tag name is one of: "th", "td"</dt>
+ <dd>
+
+ <p><a href=#clear-the-stack-back-to-a-table-row-context>Clear the stack back to a table row
+ context</a>. (See below.)</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then switch
+ the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intd title="insertion mode:
+ in cell">in cell</a>".</p>
+
+ <p>Insert a marker at the end of the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a>.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "tr"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as the token, this is a
+ <a href=#parse-error>parse error</a>. Ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#clear-the-stack-back-to-a-table-row-context>Clear the stack back to a table row
+ context</a>. (See below.)</p>
+
+ <p>Pop the <a href=#current-node>current node</a> (which will be a
+ <code><a href=#the-tr-element>tr</a></code> element) from the <a href=#stack-of-open-elements>stack of open
+ elements</a>. Switch the <a href=#insertion-mode>insertion mode</a> to
+ "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
+ body</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "caption", "col",
+ "colgroup", "tbody", "tfoot", "thead", "tr"</dt>
+ <dt>An end tag whose tag name is "table"</dt>
+ <dd>
+
+ <p>Act as if an end tag with the tag name "tr" had been seen,
+ then, if that token wasn't ignored, reprocess the current
+ token.</p>
+
+ <p class=note>The fake end tag token here can only be
+ ignored in the <a href=#fragment-case>fragment case</a>.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "tbody", "tfoot",
+ "thead"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as the token, this is a
+ <a href=#parse-error>parse error</a>. Ignore the token.</p>
+
+ <p>Otherwise, act as if an end tag with the tag name "tr" had
+ been seen, then reprocess the current token.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "body", "caption",
+ "col", "colgroup", "html", "td", "th"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ </dl><p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-row-context>clear the stack
+ back to a table row context</dfn>, it means that the UA must,
+ while the <a href=#current-node>current node</a> is not a <code><a href=#the-tr-element>tr</a></code>
+ element or an <code><a href=#the-html-element-0>html</a></code> element, pop elements from the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+
+ <p class=note>The <a href=#current-node>current node</a> being an
+ <code><a href=#the-html-element-0>html</a></code> element after this process is a <a href=#fragment-case>fragment
+ case</a>.</p>
+
+
+ <h5 id=parsing-main-intd><span class=secno>10.2.5.18 </span>The "<dfn title="insertion mode: in cell">in cell</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intd title="insertion
+ mode: in cell">in cell</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>An end tag whose tag name is one of: "td", "th"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as that of the token, then
+ this is a <a href=#parse-error>parse error</a> and the token must be
+ ignored.</p>
+
+ <p>Otherwise:</p>
+
+ <p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</p>
+
+ <p>Now, if the <a href=#current-node>current node</a> is not an element
+ with the same tag name as the token, then this is a
+ <a href=#parse-error>parse error</a>.</p>
+
+ <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> stack
+ until an element with the same tag name as the token has been
+ popped from the stack.</p>
+
+ <p><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to
+ the last marker</a>.</p>
+
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>". (The
+ <a href=#current-node>current node</a> will be a <code><a href=#the-tr-element>tr</a></code> element at
+ this point.)</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "caption", "col",
+ "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does
+ <em>not</em> <a href=#has-an-element-in-table-scope title="has an element in table scope">have
+ a <code>td</code> or <code>th</code> element in table
+ scope</a>, then this is a <a href=#parse-error>parse error</a>; ignore
+ the token. (<a href=#fragment-case>fragment case</a>)</p>
+
+ <p>Otherwise, <a href=#close-the-cell>close the cell</a> (see below) and
+ reprocess the current token.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "body", "caption",
+ "col", "colgroup", "html"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "table", "tbody",
+ "tfoot", "thead", "tr"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as that of the token
+ (which can only happen for "tbody", "tfoot" and "thead", or,
+ in the <a href=#fragment-case>fragment case</a>), then this is a <a href=#parse-error>parse
+ error</a> and the token must be ignored.</p>
+
+ <p>Otherwise, <a href=#close-the-cell>close the cell</a> (see below) and
+ reprocess the current token.</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ </dl><p>Where the steps above say to <dfn id=close-the-cell>close the cell</dfn>, they
+ mean to run the following algorithm:</p>
+
+ <ol><li><p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-table-scope title="has an element in table scope">has a <code>td</code>
+ element in table scope</a>, then act as if an end tag token
+ with the tag name "td" had been seen.</li>
+
+ <li><p>Otherwise, the <a href=#stack-of-open-elements>stack of open elements</a> will
+ <a href=#has-an-element-in-table-scope title="has an element in table scope">have a
+ <code>th</code> element in table scope</a>; act as if an end
+ tag token with the tag name "th" had been seen.</li>
+
+ </ol><p class=note>The <a href=#stack-of-open-elements>stack of open elements</a> cannot
+ have both a <code><a href=#the-td-element>td</a></code> and a <code><a href=#the-th-element>th</a></code> element <a href=#has-an-element-in-table-scope title="has an element in table scope">in table scope</a> at
+ the same time, nor can it have neither when the <a href=#insertion-mode>insertion
+ mode</a> is "<a href=#parsing-main-intd title="insertion mode: in cell">in
+ cell</a>".</p>
+
+
+ <h5 id=parsing-main-inselect><span class=secno>10.2.5.19 </span>The "<dfn title="insertion mode: in select">in select</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inselect title="insertion
+ mode: in select">in select</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token</dt>
+ <dd>
+ <p><a href=#insert-a-character title="insert a character">Insert the token's
+ character</a> into the <a href=#current-node>current node</a>.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "option"</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-option-element>option</a></code>
+ element, act as if an end tag with the tag name "option" had
+ been seen.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "optgroup"</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-option-element>option</a></code>
+ element, act as if an end tag with the tag name "option" had
+ been seen.</p>
+
+ <p>If the <a href=#current-node>current node</a> is an
+ <code><a href=#the-optgroup-element>optgroup</a></code> element, act as if an end tag with the
+ tag name "optgroup" had been seen.</p>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "optgroup"</dt>
+ <dd>
+
+ <p>First, if the <a href=#current-node>current node</a> is an
+ <code><a href=#the-option-element>option</a></code> element, and the node immediately before
+ it in the <a href=#stack-of-open-elements>stack of open elements</a> is an
+ <code><a href=#the-optgroup-element>optgroup</a></code> element, then act as if an end tag with
+ the tag name "option" had been seen.</p>
+
+ <p>If the <a href=#current-node>current node</a> is an
+ <code><a href=#the-optgroup-element>optgroup</a></code> element, then pop that node from the
+ <a href=#stack-of-open-elements>stack of open elements</a>. Otherwise, this is a
+ <a href=#parse-error>parse error</a>; ignore the token.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "option"</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-option-element>option</a></code>
+ element, then pop that node from the <a href=#stack-of-open-elements>stack of open
+ elements</a>. Otherwise, this is a <a href=#parse-error>parse
+ error</a>; ignore the token.</p>
+
+ </dd>
+
+ <dt>An end tag whose tag name is "select"</dt>
+ <dd>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+ scope</a> with the same tag name as the token, this is a
+ <a href=#parse-error>parse error</a>. Ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise:</p>
+
+ <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
+ until a <code><a href=#the-select-element>select</a></code> element has been popped from the
+ stack.</p>
+
+ <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "select"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>. Act as if the token had been
+ an end tag with the tag name "select" instead.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: "input", "keygen", "textarea"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>select</code>
+ element in table scope</a>, ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise, act as if an end tag with the tag name "select" had
+ been seen, and reprocess the token.</p>
+
+ </dd>
+
+ <dt>A start tag token whose tag name is "script"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is not the root
+ <code><a href=#the-html-element-0>html</a></code> element, then this is a <a href=#parse-error>parse
+ error</a>.</p>
+
+ <p class=note>It can only be the <a href=#current-node>current node</a> in
+ the <a href=#fragment-case>fragment case</a>.</p>
+
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ </dl><h5 id=parsing-main-inselectintable><span class=secno>10.2.5.20 </span>The "<dfn title="insertion mode: in select in table">in select in table</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inselectintable title="insertion
+ mode: in select in table">in select in table</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A start tag whose tag name is one of: "caption", "table",
+ "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Act as if an end tag with the tag
+ name "select" had been seen, and reprocess the token.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is one of: "caption", "table",
+ "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-table-scope>has an
+ element in table scope</a> with the same tag name as that
+ of the token, then act as if an end tag with the tag name
+ "select" had been seen, and reprocess the token. Otherwise,
+ ignore the token.</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ </dl><h5 id=parsing-main-inforeign><span class=secno>10.2.5.21 </span>The "<dfn title="insertion mode: in foreign content">in foreign content</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inforeign title="insertion
+ mode: in foreign content">in foreign content</a>", tokens must be
+ handled as follows:</p>
+
+ <dl class=switch><dt>A character token</dt>
+ <dd>
+
+ <p><a href=#insert-a-character title="insert a character">Insert the token's
+ character</a> into the <a href=#current-node>current node</a>.</p>
+
+ <p>If the token is not one of U+0009 CHARACTER TABULATION, U+000A
+ LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN
+ (CR), or U+0020 SPACE, then set the <a href=#frameset-ok-flag>frameset-ok
+ flag</a> to "not ok".</p>
+
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt id=scriptForeignEndTag>An end tag whose tag name is "script", if the <a href=#current-node>current node</a> is a <code title="">script</code> element in the <a href=#svg-namespace>SVG namespace</a>.</dt>
+ <dd>
+
+ <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</p>
+
+ <p>Let the <var title="">old insertion point</var> have the
+ same value as the current <a href=#insertion-point>insertion point</a>. Let
+ the <a href=#insertion-point>insertion point</a> be just before the <a href=#next-input-character>next
+ input character</a>.</p>
+
+ <p>Increment the parser's <a href=#script-nesting-level>script nesting level</a> by
+ one. Set the <a href=#parser-pause-flag>parser pause flag</a> to true.</p>
+
+ <p><a href=http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing>Process
+ the <code title="">script</code> element</a> according to the SVG
+ rules, if the user agent supports SVG. <a href=#refsSVG>[SVG]</a></p>
+
+ <p class=note>Even if this causes <a href=#dom-document-write title=dom-document-write>new characters to be inserted into the
+ tokenizer</a>, the parser will not be executed reentrantly,
+ since the <a href=#parser-pause-flag>parser pause flag</a> is true.</p>
+
+ <p>Decrement the parser's <a href=#script-nesting-level>script nesting level</a> by
+ one. If the parser's <a href=#script-nesting-level>script nesting level</a> is zero,
+ then set the <a href=#parser-pause-flag>parser pause flag</a> to false.</p>
+
+ <p>Let the <a href=#insertion-point>insertion point</a> have the value of the <var title="">old insertion point</var>. (In other words, restore the
+ <a href=#insertion-point>insertion point</a> to its previous value. This value
+ might be the "undefined" value.)</p>
+
+ </dd>
+
+ <dt>An end tag, if the <a href=#current-node>current node</a> is not an element in the <a href=#html-namespace-0>HTML namespace</a>.</dt>
+
+ <dd>
+
+ <p>Run these steps:</p>
+
+ <ol><li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current
+ node</a> (the bottommost node of the stack).</li>
+
+ <li><p>If <var title="">node</var> is not an element with the
+ same tag name as the token, then this is a <a href=#parse-error>parse
+ error</a>.</li>
+
+ <li><p><i>Loop</i>: If <var title="">node</var> has the same tag
+ name as the token, pop elements from the <a href=#stack-of-open-elements>stack of
+ open elements</a> until <var title="">node</var> has been
+ popped from the stack, and then abort these steps.</li>
+
+ <li><p>Set <var title="">node</var> to the previous entry in the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</li>
+
+ <li>
+
+ <p>If <var title="">node</var> is an element in the <a href=#html-namespace-0>HTML
+ namespace</a>, process the token <a href=#using-the-rules-for>using the rules
+ for</a> the <a href=#secondary-insertion-mode>secondary insertion mode</a>. If, after
+ doing so, the <a href=#insertion-mode>insertion mode</a> is still "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
+ content</a>", but there is no element <a href=#has-an-element-in-scope title="has an
+ element in scope">in scope</a> that has a namespace other
+ than the <a href=#html-namespace-0>HTML namespace</a>, switch the <a href=#insertion-mode>insertion
+ mode</a> to the <a href=#secondary-insertion-mode>secondary insertion mode</a>.</p>
+
+ </li>
+
+ <li><p>Return to the step labeled <i>loop</i>.</li>
+
+ </ol></dd>
+
+ <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">mi</code> element in the <a href=#mathml-namespace>MathML namespace</a>.</dt>
+ <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">mo</code> element in the <a href=#mathml-namespace>MathML namespace</a>.</dt>
+ <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">mn</code> element in the <a href=#mathml-namespace>MathML namespace</a>.</dt>
+ <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">ms</code> element in the <a href=#mathml-namespace>MathML namespace</a>.</dt>
+ <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">mtext</code> element in the <a href=#mathml-namespace>MathML namespace</a>.</dt>
+ <dt>A start tag whose tag name is "svg", if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a>.</dt>
+ <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">foreignObject</code> element in the <a href=#svg-namespace>SVG namespace</a>.</dt>
+ <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">desc</code> element in the <a href=#svg-namespace>SVG namespace</a>.</dt>
+ <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">title</code> element in the <a href=#svg-namespace>SVG namespace</a>.</dt>
+ <dt>A start tag, if the <a href=#current-node>current node</a> is an element in the <a href=#html-namespace-0>HTML namespace</a>.</dt>
+ <dt>Any other end tag</dt>
+ <dd>
+
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the
+ <a href=#secondary-insertion-mode>secondary insertion mode</a>.</p>
+
+ <p>If, after doing so, the <a href=#insertion-mode>insertion mode</a> is still
+ "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
+ content</a>", but there is no element <a href=#has-an-element-in-scope title="has an
+ element in scope">in scope</a> that has a namespace other than
+ the <a href=#html-namespace-0>HTML namespace</a>, switch the <a href=#insertion-mode>insertion
+ mode</a> to the <a href=#secondary-insertion-mode>secondary insertion mode</a>.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",
+ "blockquote", "body"<!--by inspection-->, "br", "center", "code",
+ "dd", "div", "dl", "dt"<!-- so that dd and dt can be handled
+ uniformly throughout the parser -->, "em", "embed", "h1", "h2",
+ "h3", "h4"<!--for completeness-->, "h5", "h6"<!--for
+ completeness-->, "head"<!--by inspection-->, "hr", "i", "img",
+ "li", "listing"<!-- so that pre and listing can be handled
+ uniformly throughout the parser -->, "menu", "meta", "nobr",
+ "ol"<!-- so that dl, ul, and ol can be handled uniformly throughout
+ the parser -->, "p", "pre", "ruby", "s", <!--"script",--> "small",
+ "span", "strong", "strike"<!-- so that s and strike can be handled
+ uniformly throughout the parser -->, <!--"style",--> "sub", "sup",
+ "table"<!--by inspection-->, "tt", "u", "ul", "var"</dt> <!-- this
+ list was determined empirically by studying over 6,000,000,000
+ pages that were specifically not XML pages -->
+ <dt>A start tag whose tag name is "font", if the token has any
+ attributes named "color", "face", or "size"</dt> <!-- the
+ attributes here are required so that SVG <font> will go through as
+ SVG but legacy <font>s won't -->
+ <dt>An end-of-file token</dt> <dd>
+
+ <p><a href=#parse-error>Parse error</a>.</p>
+
+ <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until
+ either a <code><a href=#math>math</a></code> element or an <code><a href=#svg>svg</a></code> element
+ has been popped from the stack, and reprocess the token.</p>
+
+ </dd>
+
+ <dt>Any other start tag</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is an element in the
+ <a href=#mathml-namespace>MathML namespace</a>, <a href=#adjust-mathml-attributes>adjust MathML
+ attributes</a> for the token. (This fixes the case of MathML
+ attributes that are not all lowercase.)</p>
+
+ <p>If the <a href=#current-node>current node</a> is an element in the <a href=#svg-namespace>SVG
+ namespace</a>, and the token's tag name is one of the ones in
+ the first column of the following table, change the tag name to
+ the name given in the corresponding cell in the second
+ column. (This fixes the case of SVG elements that are not all
+ lowercase.)</p>
+
+ <table><thead><tr><th> Tag name <th> Element name
+ <tbody><tr><td> <code title="">altglyph</code> <td> <code title="">altGlyph</code>
+ <tr><td> <code title="">altglyphdef</code> <td> <code title="">altGlyphDef</code>
+ <tr><td> <code title="">altglyphitem</code> <td> <code title="">altGlyphItem</code>
+ <tr><td> <code title="">animatecolor</code> <td> <code title="">animateColor</code>
+ <tr><td> <code title="">animatemotion</code> <td> <code title="">animateMotion</code>
+ <tr><td> <code title="">animatetransform</code> <td> <code title="">animateTransform</code>
+ <tr><td> <code title="">clippath</code> <td> <code title="">clipPath</code>
+ <tr><td> <code title="">feblend</code> <td> <code title="">feBlend</code>
+ <tr><td> <code title="">fecolormatrix</code> <td> <code title="">feColorMatrix</code>
+ <tr><td> <code title="">fecomponenttransfer</code> <td> <code title="">feComponentTransfer</code>
+ <tr><td> <code title="">fecomposite</code> <td> <code title="">feComposite</code>
+ <tr><td> <code title="">feconvolvematrix</code> <td> <code title="">feConvolveMatrix</code>
+ <tr><td> <code title="">fediffuselighting</code> <td> <code title="">feDiffuseLighting</code>
+ <tr><td> <code title="">fedisplacementmap</code> <td> <code title="">feDisplacementMap</code>
+ <tr><td> <code title="">fedistantlight</code> <td> <code title="">feDistantLight</code>
+ <tr><td> <code title="">feflood</code> <td> <code title="">feFlood</code>
+ <tr><td> <code title="">fefunca</code> <td> <code title="">feFuncA</code>
+ <tr><td> <code title="">fefuncb</code> <td> <code title="">feFuncB</code>
+ <tr><td> <code title="">fefuncg</code> <td> <code title="">feFuncG</code>
+ <tr><td> <code title="">fefuncr</code> <td> <code title="">feFuncR</code>
+ <tr><td> <code title="">fegaussianblur</code> <td> <code title="">feGaussianBlur</code>
+ <tr><td> <code title="">feimage</code> <td> <code title="">feImage</code>
+ <tr><td> <code title="">femerge</code> <td> <code title="">feMerge</code>
+ <tr><td> <code title="">femergenode</code> <td> <code title="">feMergeNode</code>
+ <tr><td> <code title="">femorphology</code> <td> <code title="">feMorphology</code>
+ <tr><td> <code title="">feoffset</code> <td> <code title="">feOffset</code>
+ <tr><td> <code title="">fepointlight</code> <td> <code title="">fePointLight</code>
+ <tr><td> <code title="">fespecularlighting</code> <td> <code title="">feSpecularLighting</code>
+ <tr><td> <code title="">fespotlight</code> <td> <code title="">feSpotLight</code>
+ <tr><td> <code title="">fetile</code> <td> <code title="">feTile</code>
+ <tr><td> <code title="">feturbulence</code> <td> <code title="">feTurbulence</code>
+ <tr><td> <code title="">foreignobject</code> <td> <code title="">foreignObject</code>
+ <tr><td> <code title="">glyphref</code> <td> <code title="">glyphRef</code>
+ <tr><td> <code title="">lineargradient</code> <td> <code title="">linearGradient</code>
+ <tr><td> <code title="">radialgradient</code> <td> <code title="">radialGradient</code>
+ <!--<tr> <td> <code title="">solidcolor</code> <td> <code title="">solidColor</code> (SVG 1.2)-->
+ <tr><td> <code title="">textpath</code> <td> <code title="">textPath</code>
+ </table><p>If the <a href=#current-node>current node</a> is an element in the <a href=#svg-namespace>SVG
+ namespace</a>, <a href=#adjust-svg-attributes>adjust SVG attributes</a> for the
+ token. (This fixes the case of SVG attributes that are not all
+ lowercase.)</p>
+
+ <p><a href=#adjust-foreign-attributes>Adjust foreign attributes</a> for the token. (This
+ fixes the use of namespaced attributes, in particular XLink in
+ SVG.)</p>
+
+ <p><a href=#insert-a-foreign-element>Insert a foreign element</a> for the token, in the
+ same namespace as the <a href=#current-node>current node</a>.</p>
+
+ <p>If the token has its <i>self-closing flag</i> set, pop the
+ <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
+ elements</a> and <a href=#acknowledge-self-closing-flag title="acknowledge self-closing
+ flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
+
+ </dd>
+
+ </dl><h5 id=parsing-main-afterbody><span class=secno>10.2.5.22 </span>The "<dfn title="insertion mode: after body">after body</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-afterbody title="insertion
+ mode: after body">after body</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the first element in
+ the <a href=#stack-of-open-elements>stack of open elements</a> (the <code><a href=#the-html-element-0>html</a></code>
+ element), with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is "html"</dt>
+ <dd>
+
+ <p>If the parser was originally created as part of the <a href=#html-fragment-parsing-algorithm>HTML
+ fragment parsing algorithm</a>, this is a <a href=#parse-error>parse
+ error</a>; ignore the token. (<a href=#fragment-case>fragment case</a>)</p>
+
+ <p>Otherwise, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-after-after-body-insertion-mode title="insertion mode: after after body">after after
+ body</a>".</p>
+
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+
+ <p><a href=#parse-error>Parse error</a>. Switch the <a href=#insertion-mode>insertion
+ mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in
+ body</a>" and reprocess the token.</p>
+
+ </dd>
+
+ </dl><h5 id=parsing-main-inframeset><span class=secno>10.2.5.23 </span>The "<dfn title="insertion mode: in frameset">in frameset</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inframeset title="insertion
+ mode: in frameset">in frameset</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p><a href=#insert-a-character title="insert a character">Insert the character</a> into
+ the <a href=#current-node>current node</a>.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "frameset"</dt>
+ <dd>
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is "frameset"</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is the root
+ <code><a href=#the-html-element-0>html</a></code> element, then this is a <a href=#parse-error>parse
+ error</a>; ignore the token. (<a href=#fragment-case>fragment
+ case</a>)</p>
+
+ <p>Otherwise, pop the <a href=#current-node>current node</a> from the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+
+ <p>If the parser was <em>not</em> originally created as part
+ of the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a>
+ (<a href=#fragment-case>fragment case</a>), and the <a href=#current-node>current
+ node</a> is no longer a <code><a href=#frameset>frameset</a></code> element, then
+ switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-afterframeset title="insertion mode: after frameset">after
+ frameset</a>".</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "frame"</dt>
+ <dd>
+
+ <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.
+ Immediately pop the <a href=#current-node>current node</a> off the
+ <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+
+ <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
+ token's <i>self-closing flag</i></a>, if it is set.</p>
+
+ </dd>
+
+ <dt>A start tag whose tag name is "noframes"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+
+ <p>If the <a href=#current-node>current node</a> is not the root
+ <code><a href=#the-html-element-0>html</a></code> element, then this is a <a href=#parse-error>parse
+ error</a>.</p>
+
+ <p class=note>It can only be the <a href=#current-node>current node</a> in
+ the <a href=#fragment-case>fragment case</a>.</p>
+
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ </dl><h5 id=parsing-main-afterframeset><span class=secno>10.2.5.24 </span>The "<dfn title="insertion mode: after frameset">after frameset</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-afterframeset title="insertion
+ mode: after frameset">after frameset</a>", tokens must be handled as follows:</p>
+
+ <!-- due to rules in the "in frameset" mode, this can't be entered in the fragment case -->
+ <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dd>
+ <p><a href=#insert-a-character title="insert a character">Insert the character</a> into
+ the <a href=#current-node>current node</a>.</p>
+ </dd>
+
+ <dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <a href=#current-node>current
+ node</a> with the <code title="">data</code> attribute set to
+ the data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end tag whose tag name is "html"</dt>
+ <dd>
+ <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-after-after-frameset-insertion-mode title="insertion mode: after after frameset">after after
+ frameset</a>".</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "noframes"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ </dl><h5 id=the-after-after-body-insertion-mode><span class=secno>10.2.5.25 </span>The "<dfn title="insertion mode: after after body">after after body</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-after-after-body-insertion-mode title="insertion
+ mode: after after body">after after body</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <code><a href=#document>Document</a></code>
+ object with the <code title="">data</code> attribute set to the
+ data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Switch the <a href=#insertion-mode>insertion mode</a>
+ to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" and
+ reprocess the token.</p>
+ </dd>
+
+ </dl><h5 id=the-after-after-frameset-insertion-mode><span class=secno>10.2.5.26 </span>The "<dfn title="insertion mode: after after frameset">after after frameset</dfn>" insertion mode</h5>
+
+ <p>When the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-after-after-frameset-insertion-mode title="insertion
+ mode: after after frameset">after after frameset</a>", tokens must be handled as follows:</p>
+
+ <dl class=switch><dt>A comment token</dt>
+ <dd>
+ <p>Append a <code><a href=#comment-0>Comment</a></code> node to the <code><a href=#document>Document</a></code>
+ object with the <code title="">data</code> attribute set to the
+ data given in the comment token.</p>
+ </dd>
+
+ <dt>A DOCTYPE token</dt>
+ <dt>A character token that is one of U+0009 CHARACTER
+ TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
+ U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
+ <dt>A start tag whose tag name is "html"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>An end-of-file token</dt>
+ <dd>
+ <p><a href=#stop-parsing>Stop parsing</a>.</p>
+ </dd>
+
+ <dt>A start tag whose tag name is "noframes"</dt>
+ <dd>
+ <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
+ mode</a>.</p>
+ </dd>
+
+ <dt>Anything else</dt>
+ <dd>
+ <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
+ </dd>
+
+ </dl></div>
+
+
+ <div class=impl>
+
+ <h4 id=the-end><span class=secno>10.2.6 </span>The end</h4>
+
+ <p>Once the user agent <dfn id=stop-parsing title="stop parsing">stops parsing</dfn>
+ the document, the user agent must run the following steps:</p>
+
+ <ol><!-- this happens as part of one of the tasks that runs the parser --><li><p>Set the <a href=#current-document-readiness>current document readiness</a> to
+ "interactive" <!-- this also synchronously fires an event --> and
+ the <a href=#insertion-point>insertion point</a> to undefined.</li>
+
+ <li><p>Pop <em>all</em> the nodes off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</li>
+
+ <li><p>If the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the
+ document has finished parsing</a> is not empty, run these
+ substeps:</p>
+
+ <ol><li><p><a href=#spin-the-event-loop>Spin the event loop</a> until the first
+ <code><a href=#script>script</a></code> in the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will
+ execute when the document has finished parsing</a> has its
+ <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag set <em>and</em> there
+ is no <a href=#a-style-sheet-blocking-scripts title="a style sheet blocking scripts">style sheet
+ blocking scripts</a>.</li>
+
+ <li><p><a href=#executing-a-script-block title="executing a script block">Execute</a> the
+ first <code><a href=#script>script</a></code> in the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will
+ execute when the document has finished parsing</a>.</li>
+
+ <li><p>Remove the first <code><a href=#script>script</a></code> element from the
+ <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the document has
+ finished parsing</a> (i.e. shift out the first entry in the
+ list).</li>
+
+ <li><p>If the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the
+ document has finished parsing</a> is still not empty, repeat
+ these substeps again from substep 1.</p>
+
+ </ol></li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-DOMContentLoaded>DOMContentLoaded</code> at the
+ <code><a href=#document>Document</a></code>.</li>
+
+ <li><p><a href=#spin-the-event-loop>Spin the event loop</a> until the <a href=#set-of-scripts-that-will-execute-as-soon-as-possible>set of
+ scripts that will execute as soon as possible</a> is
+ empty.</li> <!-- this step is redundant with the next one,
+ really, since all those scripts also delay the load event. It's
+ here in case we add an event between this step and the next or if
+ we move the previous step (DOMContentLoaded) down again. -->
+
+ <li><p><a href=#spin-the-event-loop>Spin the event loop</a> until there is nothing that
+ <dfn id=delay-the-load-event title="delay the load event">delays the load event</dfn> in
+ the <code><a href=#document>Document</a></code>.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to set the <a href=#current-document-readiness>current document
+ readiness</a> to "complete". <!-- this also fires an event
+ synchronously during the task --></li>
+
+ <li><p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
+ context</a>, then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
+ simple event</a> named <code title=event-load>load</code> at
+ the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object, but with
+ its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
+ <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
+ <code><a href=#window>Window</a></code> object).</li>
+
+ <li><p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
+ context</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event at the
+ <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, but with
+ its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
+ <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
+ <code><a href=#window>Window</a></code> object), using the
+ <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code>
+ attribute set to false. This event must not bubble, must not be
+ cancelable, and has no default action.</li>
+
+ <li><p>If the <code><a href=#document>Document</a></code> has a <a href=#pending-state-object>pending state
+ object</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
+ <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object using the
+ <code><a href=#popstateevent>PopStateEvent</a></code> interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute set to the
+ current value of the <a href=#pending-state-object>pending state object</a>. This event
+ must bubble but not be cancelable and has no default
+ action.</li>
+
+ <li><p>If the <code><a href=#document>Document</a></code> has any <a href=#pending-application-cache-download-process-tasks>pending
+ application cache download process tasks</a>, then <a href=#queue-a-task title="queue a task">queue</a> each such <a href=#concept-task title=concept-task>task</a> in the order they were added to
+ the list of <a href=#pending-application-cache-download-process-tasks>pending application cache download process
+ tasks</a>, and then empty the list of <a href=#pending-application-cache-download-process-tasks>pending application
+ cache download process tasks</a>. The <a href=#task-source>task source</a>
+ for these <a href=#concept-task title=concept-task>tasks</a> is the
+ <a href=#networking-task-source>networking task source</a>.</li>
+
+ <li><p>The <code><a href=#document>Document</a></code> is now <dfn id=completely-loaded>completely
+ loaded</dfn>.</li>
+
+ </ol><p>When the user agent is to <dfn id=abort-an-html-parser>abort an HTML parser</dfn>, it
+ must run the following steps:</p>
+
+ <ol><li><p>Throw away any pending content in the <a href=#the-input-stream>input
+ stream</a>, and discard any future content that would have been
+ added to it.</li>
+
+ <li><p>Pop <em>all</em> the nodes off the <a href=#stack-of-open-elements>stack of open
+ elements</a>.</li>
+
+ <!-- anything else? this is things that happen when you call
+ document.open() on a document that's still being parsed. Should the
+ pending scripts be blown away or anything? -->
+
+ </ol><p>Except where otherwise specified, the <a href=#task-source>task source</a>
+ for the <a href=#concept-task title=concept-task>tasks</a> mentioned in this
+ section is the <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=coercing-an-html-dom-into-an-infoset><span class=secno>10.2.7 </span>Coercing an HTML DOM into an infoset</h4>
+
+ <p>When an application uses an <a href=#html-parser>HTML parser</a> in
+ conjunction with an XML pipeline, it is possible that the
+ constructed DOM is not compatible with the XML tool chain in certain
+ subtle ways. For example, an XML toolchain might not be able to
+ represent attributes with the name <code title="">xmlns</code>,
+ since they conflict with the Namespaces in XML syntax. There is also
+ some data that the <a href=#html-parser>HTML parser</a> generates that isn't
+ included in the DOM itself. This section specifies some rules for
+ handling these issues.</p>
+
+ <p>If the XML API being used doesn't support DOCTYPEs, the tool may
+ drop DOCTYPEs altogether.</p>
+
+ <p>If the XML API doesn't support attributes in no namespace that
+ are named "<code title="">xmlns</code>", attributes whose names
+ start with "<code title="">xmlns:</code>", or attributes in the
+ <a href=#xmlns-namespace>XMLNS namespace</a>, then the tool may drop such
+ attributes.</p>
+
+ <p>The tool may annotate the output with any namespace declarations
+ required for proper operation.</p>
+
+ <p>If the XML API being used restricts the allowable characters in
+ the local names of elements and attributes, then the tool may map
+ all element and attribute local names that the API wouldn't support
+ to a set of names that <em>are</em> allowed, by replacing any
+ character that isn't supported with the uppercase letter U and the
+ six digits of the character's Unicode code point when expressed in
+ hexadecimal, using digits 0-9 and capital letters A-F as the
+ symbols, in increasing numeric order.</p>
+
+ <p class=example>For example, the element name <code title="">foo&lt;bar</code>, which can be output by the <a href=#html-parser>HTML
+ parser</a>, though it is neither a legal HTML element name nor a
+ well-formed XML element name, would be converted into <code title="">fooU00003Cbar</code>, which <em>is</em> a well-formed XML
+ element name (though it's still not legal in HTML by any means).</p>
+
+ <p class=example>As another example, consider the attribute
+ <code>xlink:href</code>. Used on a MathML element, it becomes, after
+ being <a href=#adjust-foreign-attributes title="adjust foreign attributes">adjusted</a>, an
+ attribute with a prefix "<code title="">xlink</code>" and a local
+ name "<code title="">href</code>". However, used on an HTML element,
+ it becomes an attribute with no prefix and the local name "<code title="">xlink:href</code>", which is not a valid NCName, and thus
+ might not be accepted by an XML API. It could thus get converted,
+ becoming "<code title="">xlinkU00003Ahref</code>".</p>
+
+ <p class=note>The resulting names from this conversion
+ conveniently can't clash with any attribute generated by the
+ <a href=#html-parser>HTML parser</a>, since those are all either lowercase or
+ those listed in the <a href=#adjust-foreign-attributes>adjust foreign attributes</a>
+ algorithm's table.</p>
+
+ <p>If the XML API restricts comments from having two consecutive
+ U+002D HYPHEN-MINUS characters (--), the tool may insert a single
+ U+0020 SPACE character between any such offending characters.</p>
+
+ <p>If the XML API restricts comments from ending in a
+ U+002D HYPHEN-MINUS character (-), the tool may insert a single
+ U+0020 SPACE character at the end of such comments.</p>
+
+ <p>If the XML API restricts allowed characters in character data,
+ attribute values, or comments, the tool may replace any U+000C FORM
+ FEED (FF) character with a U+0020 SPACE character, and any other
+ literal non-XML character with a U+FFFD REPLACEMENT CHARACTER.</p>
+
+ <p>If the tool has no way to convey out-of-band information, then
+ the tool may drop the following information:</p>
+
+ <ul><li>Whether the document is set to <i><a href=#no-quirks-mode>no-quirks mode</a></i>,
+ <i><a href=#limited-quirks-mode>limited-quirks mode</a></i>, or <i><a href=#quirks-mode>quirks mode</a></i></li>
+
+ <li>The association between form controls and forms that aren't
+ their nearest <code><a href=#the-form-element>form</a></code> element ancestor (use of the
+ <a href=#form-element-pointer><code>form</code> element pointer</a> in the parser)</li>
+
+ </ul><p class=note>The mutations allowed by this section apply
+ <em>after</em> the <a href=#html-parser>HTML parser</a>'s rules have been
+ applied. For example, a <code title="">&lt;a::&gt;</code> start tag
+ will be closed by a <code title="">&lt;/a::&gt;</code> end tag, and
+ never by a <code title="">&lt;/aU00003AU00003A&gt;</code> end tag, even
+ if the user agent is using the rules above to then generate an
+ actual element in the DOM with the name <code title="">aU00003AU00003A</code> for that start tag.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=an-introduction-to-error-handling-and-strange-cases-in-the-parser><span class=secno>10.2.8 </span>An introduction to error handling and strange cases in the parser</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>This section examines some erroneous markup and discusses how
+ the <a href=#html-parser>HTML parser</a> handles these cases.</p>
+
+
+ <h5 id=misnested-tags:-b-i-/b-/i><span class=secno>10.2.8.1 </span>Misnested tags: &lt;b&gt;&lt;i&gt;&lt;/b&gt;&lt;/i&gt;</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The most-often discussed example of erroneous markup is as
+ follows:</p>
+
+ <pre>&lt;p&gt;1&lt;b&gt;2&lt;i&gt;3&lt;/b&gt;4&lt;/i&gt;5&lt;/p&gt;</pre>
+
+ <p>The parsing of this markup is straightforward up to the "3". At
+ this point, the DOM looks like this:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">3</span></ul></ul></ul></ul></ul></ul><p>Here, the <a href=#stack-of-open-elements>stack of open elements</a> has five elements
+ on it: <code><a href=#the-html-element-0>html</a></code>, <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-p-element>p</a></code>,
+ <code><a href=#the-b-element>b</a></code>, and <code><a href=#the-i-element>i</a></code>. The <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a> just has two: <code><a href=#the-b-element>b</a></code> and
+ <code><a href=#the-i-element>i</a></code>. The <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>".</p>
+
+ <p>Upon receiving the end tag token with the tag name "b", the "<a href=#adoptionAgency>adoption agency algorithm</a>" is
+ invoked. This is a simple case, in that the <var title="">formatting
+ element</var> is the <code><a href=#the-b-element>b</a></code> element, and there is no
+ <var title="">furthest block</var>. Thus, the <a href=#stack-of-open-elements>stack of open
+ elements</a> ends up with just three elements: <code><a href=#the-html-element-0>html</a></code>,
+ <code><a href=#the-body-element-0>body</a></code>, and <code><a href=#the-p-element>p</a></code>, while the <a href=#list-of-active-formatting-elements>list of
+ active formatting elements</a> has just one: <code><a href=#the-i-element>i</a></code>. The
+ DOM tree is unmodified at this point.</p>
+
+ <p>The next token is a character ("4"), triggers the <a href=#reconstruct-the-active-formatting-elements title="reconstruct the active formatting elements">reconstruction of
+ the active formatting elements</a>, in this case just the
+ <code><a href=#the-i-element>i</a></code> element. A new <code><a href=#the-i-element>i</a></code> element is thus created
+ for the "4" text node. After the end tag token for the "i" is also
+ received, and the "5" text node is inserted, the DOM looks as
+ follows:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">3</span></ul></ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">4</span></ul><li class=t3><code>#text</code>: <span title="">5</span></ul></ul></ul></ul><h5 id=misnested-tags:-b-p-/b-/p><span class=secno>10.2.8.2 </span>Misnested tags: &lt;b&gt;&lt;p&gt;&lt;/b&gt;&lt;/p&gt;</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>A case similar to the previous one is the following:</p>
+
+ <pre>&lt;b&gt;1&lt;p&gt;2&lt;/b&gt;3&lt;/p&gt;</pre>
+
+ <p>Up to the "2" the parsing here is straightforward:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul></ul></ul></ul></ul><p>The interesting part is when the end tag token with the tag name
+ "b" is parsed.</p>
+
+ <p>Before that token is seen, the <a href=#stack-of-open-elements>stack of open
+ elements</a> has four elements on it: <code><a href=#the-html-element-0>html</a></code>,
+ <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-b-element>b</a></code>, and <code><a href=#the-p-element>p</a></code>. The
+ <a href=#list-of-active-formatting-elements>list of active formatting elements</a> just has the one:
+ <code><a href=#the-b-element>b</a></code>. The <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>".</p>
+
+ <p>Upon receiving the end tag token with the tag name "b", the "<a href=#adoptionAgency>adoption agency algorithm</a>" is invoked, as
+ in the previous example. However, in this case, there <em>is</em> a
+ <var title="">furthest block</var>, namely the <code><a href=#the-p-element>p</a></code> element. Thus,
+ this time the adoption agency algorithm isn't skipped over.</p>
+
+ <p>The <var title="">common ancestor</var> is the <code><a href=#the-body-element-0>body</a></code>
+ element. A conceptual "bookmark" marks the position of the
+ <code><a href=#the-b-element>b</a></code> in the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>, but since that list has only one element in it,
+ it won't have much effect.</p>
+
+ <p>As the algorithm progresses, <var title="">node</var> ends up set
+ to the formatting element (<code><a href=#the-b-element>b</a></code>), and <var title="">last
+ node</var> ends up set to the <var title="">furthest block</var>
+ (<code><a href=#the-p-element>p</a></code>).</p>
+
+ <p>The <var title="">last node</var> gets appended (moved) to the
+ <var title="">common ancestor</var>, so that the DOM looks like:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul></ul></ul></ul><p>A new <code><a href=#the-b-element>b</a></code> element is created, and the children of the
+ <code><a href=#the-p-element>p</a></code> element are moved to it:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code></ul></ul></ul><ul class=domTree><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul></ul><p>Finally, the new <code><a href=#the-b-element>b</a></code> element is appended to the
+ <code><a href=#the-p-element>p</a></code> element, so that the DOM looks like:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul></ul></ul></ul></ul><p>The <code><a href=#the-b-element>b</a></code> element is removed from the <a href=#list-of-active-formatting-elements>list of
+ active formatting elements</a> and the <a href=#stack-of-open-elements>stack of open
+ elements</a>, so that when the "3" is parsed, it is appended to
+ the <code><a href=#the-p-element>p</a></code> element:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul><li class=t3><code>#text</code>: <span title="">3</span></ul></ul></ul></ul><h5 id=unexpected-markup-in-tables><span class=secno>10.2.8.3 </span>Unexpected markup in tables</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Error handling in tables is, for historical reasons, especially
+ strange. For example, consider the following markup:</p>
+
+ <pre>&lt;table&gt;<strong>&lt;b&gt;</strong>&lt;tr&gt;&lt;td&gt;aaa&lt;/td&gt;&lt;/tr&gt;<strong>bbb</strong>&lt;/table&gt;ccc</pre>
+
+ <p>The highlighted <code><a href=#the-b-element>b</a></code> element start tag is not allowed
+ directly inside a table like that, and the parser handles this case
+ by placing the element <em>before</em> the table. (This is called <i title="foster parent"><a href=#foster-parent>foster parenting</a></i>.) This can be seen by
+ examining the DOM tree as it stands just after the
+ <code><a href=#the-table-element>table</a></code> element's start tag has been seen:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-table-element>table</a></code></ul></ul></ul><p>...and then immediately after the <code><a href=#the-b-element>b</a></code> element start
+ tag has been seen:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code></ul></ul></ul><p>At this point, the <a href=#stack-of-open-elements>stack of open elements</a> has on it
+ the elements <code><a href=#the-html-element-0>html</a></code>, <code><a href=#the-body-element-0>body</a></code>,
+ <code><a href=#the-table-element>table</a></code>, and <code><a href=#the-b-element>b</a></code> (in that order, despite the
+ resulting DOM tree); the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a> just has the <code><a href=#the-b-element>b</a></code> element in it; and the
+ <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intable title="insertion mode: in
+ table">in table</a>".</p>
+
+ <p>The <code><a href=#the-tr-element>tr</a></code> start tag causes the <code><a href=#the-b-element>b</a></code> element
+ to be popped off the stack and a <code><a href=#the-tbody-element>tbody</a></code> start tag to be
+ implied; the <code><a href=#the-tbody-element>tbody</a></code> and <code><a href=#the-tr-element>tr</a></code> elements are
+ then handled in a rather straight-forward manner, taking the parser
+ through the "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
+ body</a>" and "<a href=#parsing-main-intr title="insertion mode: in row">in
+ row</a>" insertion modes, after which the DOM looks as
+ follows:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code></ul></ul></ul></ul></ul><p>Here, the <a href=#stack-of-open-elements>stack of open elements</a> has on it the
+ elements <code><a href=#the-html-element-0>html</a></code>, <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-table-element>table</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, and <code><a href=#the-tr-element>tr</a></code>; the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a> still has the <code><a href=#the-b-element>b</a></code> element in
+ it; and the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intr title="insertion
+ mode: in row">in row</a>".</p>
+
+ <p>The <code><a href=#the-td-element>td</a></code> element start tag token, after putting a
+ <code><a href=#the-td-element>td</a></code> element on the tree, puts a marker on the <a href=#list-of-active-formatting-elements>list
+ of active formatting elements</a> (it also switches to the "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>" <a href=#insertion-mode>insertion
+ mode</a>).</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code></ul></ul></ul></ul></ul></ul><p>The marker means that when the "aaa" character tokens are seen,
+ no <code><a href=#the-b-element>b</a></code> element is created to hold the resulting text
+ node:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code><ul><li class=t3><code>#text</code>: <span title="">aaa</span></ul></ul></ul></ul></ul></ul></ul><p>The end tags are handled in a straight-forward manner; after
+ handling them, the <a href=#stack-of-open-elements>stack of open elements</a> has on it the
+ elements <code><a href=#the-html-element-0>html</a></code>, <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-table-element>table</a></code>,
+ and <code><a href=#the-tbody-element>tbody</a></code>; the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a> still has the <code><a href=#the-b-element>b</a></code> element in it (the
+ marker having been removed by the "td" end tag token); and the
+ <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intbody title="insertion mode: in
+ table body">in table body</a>".</p>
+
+ <p>Thus it is that the "bbb" character tokens are found. These
+ trigger the "<a href=#parsing-main-intabletext title="insertion mode: in table text">in table
+ text</a>" insertion mode to be used (with the <a href=#original-insertion-mode>original
+ insertion mode</a> set to "<a href=#parsing-main-intbody title="insertion mode: in table
+ body">in table body</a>"). The character tokens are collected,
+ and when the next token (the <code><a href=#the-table-element>table</a></code> element end tag) is
+ seen, they are processed as a group. Since they are not all spaces,
+ they are handled as per the "anything else" rules in the "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" insertion mode,
+ which defer to the "<a href=#parsing-main-inbody title="insertion mode: in body">in
+ body</a>" insertion mode but with <a href=#foster-parent title="foster
+ parent">foster parenting</a>.</p>
+
+ <p>When <a href=#reconstruct-the-active-formatting-elements title="reconstruct the active formatting elements">the
+ active formatting elements are reconstructed</a>, a
+ <code><a href=#the-b-element>b</a></code> element is created and <a href=#foster-parent title="foster
+ parent">foster parented</a>, and then the "bbb" text node is
+ appended to it:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">bbb</span></ul><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code><ul><li class=t3><code>#text</code>: <span title="">aaa</span></ul></ul></ul></ul></ul></ul></ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> has on it the elements
+ <code><a href=#the-html-element-0>html</a></code>, <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-table-element>table</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, and the new <code><a href=#the-b-element>b</a></code> (again, note that
+ this doesn't match the resulting tree!); the <a href=#list-of-active-formatting-elements>list of active
+ formatting elements</a> has the new <code><a href=#the-b-element>b</a></code> element in it;
+ and the <a href=#insertion-mode>insertion mode</a> is still "<a href=#parsing-main-intbody title="insertion
+ mode: in table body">in table body</a>".</p>
+
+ <p>Had the character tokens been only <a href=#space-character title="space
+ character">space characters</a> instead of "bbb", then those
+ <a href=#space-character title="space character">space characters</a> would just be
+ appended to the <code><a href=#the-tbody-element>tbody</a></code> element.</p>
+
+ <p>Finally, the <code><a href=#the-table-element>table</a></code> is closed by a "table" end
+ tag. This pops all the nodes from the <a href=#stack-of-open-elements>stack of open
+ elements</a> up to and including the <code><a href=#the-table-element>table</a></code> element,
+ but it doesn't affect the <a href=#list-of-active-formatting-elements>list of active formatting
+ elements</a>, so the "ccc" character tokens after the table
+ result in yet another <code><a href=#the-b-element>b</a></code> element being created, this
+ time after the table:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">bbb</span></ul><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code><ul><li class=t3><code>#text</code>: <span title="">aaa</span></ul></ul></ul></ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">ccc</span></ul></ul></ul></ul><h5 id=scripts-that-modify-the-page-as-it-is-being-parsed><span class=secno>10.2.8.4 </span>Scripts that modify the page as it is being parsed</h5>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Consider the following markup, which for this example we will
+ assume is the document with <a href=#url>URL</a> <code title="">http://example.com/inner</code>, being rendered as the
+ content of an <code><a href=#the-iframe-element>iframe</a></code> in another document with the
+ <a href=#url>URL</a> <code title="">http://example.com/outer</code>:</p>
+
+ <pre>&lt;div id=a&gt;
+ &lt;script&gt;
+ var div = document.getElementById('a');
+ parent.document.body.appendChild(div);
+ &lt;/script&gt;
+ &lt;script&gt;
+ alert(document.URL);
+ &lt;/script&gt;
+&lt;/div&gt;
+&lt;script&gt;
+ alert(document.URL);
+&lt;/script&gt;</pre>
+
+ <p>Up to the first "script" end tag, before the script is parsed,
+ the result is relatively straightforward:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#the-div-element>div</a></code> <span class=t2 title=""><code class="attribute name">id</code>="<code class="attribute value"><a href=#the-a-element>a</a></code>"</span><ul><li class=t3><code>#text</code>: <span title="">
+ </span><li class=t1><code><a href=#script>script</a></code><ul><li class=t3><code>#text</code>: <span title="">var div = document.getElementById('a'); &#9166; parent.document.body.appendChild(div);</span></ul></ul></ul></ul></ul><p>After the script is parsed, though, the <code><a href=#the-div-element>div</a></code> element
+ and its child <code><a href=#script>script</a></code> element are gone:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code></ul></ul><p>They are, at this point, in the <code><a href=#document>Document</a></code> of the
+ aforementioned outer <a href=#browsing-context>browsing context</a>. However, the
+ <a href=#stack-of-open-elements>stack of open elements</a> <em>still contains the
+ <code><a href=#the-div-element>div</a></code> element</em>.</p>
+
+ <p>Thus, when the second <code><a href=#script>script</a></code> element is parsed, it
+ is inserted <em>into the outer <code><a href=#document>Document</a></code>
+ object</em>.</p>
+
+ <p>This also means that the <a href="#script's-global-object">script's global object</a> is
+ the outer <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code>
+ object, <em>not</em> the <code><a href=#window>Window</a></code> object inside the
+ <code><a href=#the-iframe-element>iframe</a></code>.</p>
+
+ <p class=note>This isn't a security problem since the script that
+ moves the <code><a href=#the-div-element>div</a></code> into the outer <code><a href=#document>Document</a></code> can
+ only do so because the two <code><a href=#document>Document</a></code> object have the
+ same <a href=#origin>origin</a>.</p>
+
+ <p>Thus, the first alert says "http://example.com/outer".</p>
+
+ <p>Once the <code><a href=#the-div-element>div</a></code> element's end tag is parsed, the
+ <code><a href=#the-div-element>div</a></code> element is popped off the stack, and so the next
+ <code><a href=#script>script</a></code> element is in the inner <code><a href=#document>Document</a></code>:</p>
+
+ <ul class=domTree><li class=t1><code><a href=#the-html-element-0>html</a></code><ul><li class=t1><code><a href=#the-head-element-0>head</a></code><li class=t1><code><a href=#the-body-element-0>body</a></code><ul><li class=t1><code><a href=#script>script</a></code><ul><li class=t3><code>#text</code>: <span title="">alert(document.URL);</span></ul></ul></ul></ul><p>This second alert will say "http://example.com/inner".</p>
+
+
+
+
+ <h3 id=serializing-html-fragments><span class=secno>10.3 </span>Serializing HTML fragments</h3>
+
+ <p>The following steps form the <dfn id=html-fragment-serialization-algorithm>HTML fragment serialization
+ algorithm</dfn>. The algorithm takes as input a DOM
+ <code><a href=#element>Element</a></code> or <code><a href=#document>Document</a></code>, referred to as <var title="">the node</var>, and either returns a string or raises an
+ exception.</p>
+
+ <p class=note>This algorithm serializes the <em>children</em> of
+ the node being serialized, not the node itself.</p>
+
+ <ol><li><p>Let <var title="">s</var> be a string, and initialize it to
+ the empty string.</li>
+
+ <li>
+
+ <p>For each child node of <var title="">the node</var>, in
+ <a href=#tree-order>tree order</a>, run the following steps:
+
+ <ol><li><p>Let <var title="">current node</var> be the child node
+ being processed.</li>
+
+ <li>
+
+ <p>Append the appropriate string from the following list to
+ <var title="">s</var>:</p>
+
+ <dl class=switch><dt>If <var title="">current node</var> is an <code title="">Element</code></dt>
+
+ <dd>
+
+ <p>Append a U+003C LESS-THAN SIGN character character (&lt;),
+ followed by the element's tag name. (For nodes created by the
+ <a href=#html-parser>HTML parser</a> or <code title="">Document.createElement()</code>, the tag name will be
+ lowercase.)</p>
+
+ <p>For each attribute that the element has, append a U+0020
+ SPACE character, the attribute's name (which, for attributes
+ set by the <a href=#html-parser>HTML parser</a> or by <code title="">Element.setAttributeNode()</code> or <code title="">Element.setAttribute()</code>, will be lowercase), a
+ U+003D EQUALS SIGN character (=), a U+0022 QUOTATION MARK
+ character ("), the attribute's value, <a href=#escapingString title="escaping a string">escaped as described below</a> in
+ <i>attribute mode</i>, and a second U+0022 QUOTATION MARK
+ character (").</p>
+
+ <p>While the exact order of attributes is UA-defined, and may
+ depend on factors such as the order that the attributes were
+ given in the original markup, the sort order must be stable,
+ such that consecutive invocations of this algorithm serialize an
+ element's attributes in the same order.</p>
+
+ <p>Append a U+003E GREATER-THAN SIGN character (&gt;).</p>
+
+ <p>If <var title="">current node</var> is an
+ <code><a href=#the-area-element>area</a></code>, <code><a href=#the-base-element>base</a></code>, <code><a href=#basefont>basefont</a></code>,
+ <code><a href=#bgsound>bgsound</a></code>, <code><a href=#the-br-element>br</a></code>, <code><a href=#the-col-element>col</a></code>,
+ <code><a href=#the-embed-element>embed</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#the-hr-element>hr</a></code>,
+ <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-keygen-element>keygen</a></code>,
+ <code><a href=#the-link-element>link</a></code>, <code><a href=#meta>meta</a></code>, <code><a href=#the-param-element>param</a></code>, or
+ <code><a href=#the-wbr-element>wbr</a></code> element, then continue on to the next child
+ node at this point.</p> <!-- also, i guess: image and isindex,
+ but we don't list those because we don't consider those
+ "elements", more "macros", and thus we should never serialize
+ them -->
+
+ <p>If <var title="">current node</var> is a <code><a href=#the-pre-element>pre</a></code>,
+ <code><a href=#the-textarea-element>textarea</a></code>, or <code><a href=#listing>listing</a></code> element, append
+ a U+000A LINE FEED (LF) character.</p>
+
+ <p>Append the value of running the <a href=#html-fragment-serialization-algorithm>HTML fragment
+ serialization algorithm</a> on the <var title="">current
+ node</var> element (thus recursing into this algorithm for
+ that element), followed by a U+003C LESS-THAN SIGN character
+ (&lt;), a U+002F SOLIDUS character (/), the element's tag name
+ again, and finally a U+003E GREATER-THAN SIGN character
+ (&gt;).</p>
+
+ </dd>
+
+
+ <dt>If <var title="">current node</var> is a <code title="">Text</code> or <code title="">CDATASection</code>
+ node</dt>
+
+ <dd>
+
+ <p>If the parent of <var title="">current node</var> is a
+ <code><a href=#the-style-element>style</a></code>, <code><a href=#script>script</a></code>, <code><a href=#xmp>xmp</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#noembed>noembed</a></code>,
+ <code><a href=#noframes>noframes</a></code>, or <code><a href=#plaintext>plaintext</a></code> element, or
+ if the parent of <var title="">current node</var> is
+ <code><a href=#the-noscript-element>noscript</a></code> element and <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the
+ node, then append the value of <var title="">current
+ node</var>'s <code title="">data</code> IDL attribute
+ literally.</p>
+
+ <p>Otherwise, append the value of <var title="">current
+ node</var>'s <code title="">data</code> IDL attribute, <a href=#escapingString title="escaping a string">escaped as described
+ below</a>.</p>
+
+ </dd>
+
+
+ <dt>If <var title="">current node</var> is a <code title="">Comment</code></dt>
+
+ <dd>
+
+ <p>Append the literal string <code>&lt;!--</code> (U+003C
+ LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS,
+ U+002D HYPHEN-MINUS), followed by the value of <var title="">current node</var>'s <code title="">data</code> IDL
+ attribute, followed by the literal string <code>--&gt;</code>
+ (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN
+ SIGN).</p>
+
+ </dd>
+
+
+ <dt>If <var title="">current node</var> is a <code title="">ProcessingInstruction</code></dt>
+
+ <dd>
+
+ <p>Append the literal string <code>&lt;?</code> (U+003C
+ LESS-THAN SIGN, U+003F QUESTION MARK), followed by the value
+ of <var title="">current node</var>'s <code title="">target</code> IDL attribute, followed by a single
+ U+0020 SPACE character, followed by the value of <var title="">current node</var>'s <code title="">data</code> IDL
+ attribute, followed by a single U+003E GREATER-THAN SIGN
+ character (&gt;).</p>
+
+ </dd>
+
+
+ <dt>If <var title="">current node</var> is a <code title="">DocumentType</code></dt>
+
+ <dd>
+
+ <p>Append the literal string <code>&lt;!DOCTYPE</code> (U+003C
+ LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+0044 LATIN CAPITAL
+ LETTER D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN CAPITAL
+ LETTER C, U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL
+ LETTER Y, U+0050 LATIN CAPITAL LETTER P, U+0045 LATIN CAPITAL
+ LETTER E), followed by a space (U+0020 SPACE), followed by the
+ value of <var title="">current node</var>'s <code title="">name</code> IDL attribute, followed by the literal
+ string <code>&gt;</code> (U+003E GREATER-THAN SIGN).</p>
+
+ </dd>
+
+
+ </dl><p>Other node types (e.g. <code title="">Attr</code>) cannot
+ occur as children of elements. If, despite this, they somehow do
+ occur, this algorithm must raise an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li><p>The result of the algorithm is the string <var title="">s</var>.</li>
+
+ </ol><p><dfn id=escapingString>Escaping a string</dfn> (for the
+ purposes of the algorithm above) consists of replacing any
+ occurrences of the "<code title="">&amp;</code>" character by the
+ string "<code title="">&amp;amp;</code>", any occurrences of the
+ U+00A0 NO-BREAK SPACE character by the string "<code title="">&amp;nbsp;</code>", and, if the algorithm was invoked in
+ the <i>attribute mode</i>, any occurrences of the "<code title="">"</code>" character by the string "<code title="">&amp;quot;</code>", or if it was not, any occurrences of
+ the "<code title="">&lt;</code>" character by the string "<code title="">&amp;lt;</code>", any occurrences of the "<code title="">&gt;</code>" character by the string "<code title="">&amp;gt;</code>".</p>
+
+ <p class=note>Entity reference nodes are <a href=#entity-references>assumed to be expanded</a> by the user
+ agent, and are therefore not covered in the algorithm above.</p>
+
+ <p class=note>It is possible that the output of this algorithm, if
+ parsed with an <a href=#html-parser>HTML parser</a>, will not return the
+ original tree structure. For instance, if a <code><a href=#the-textarea-element>textarea</a></code>
+ element to which a <code title="">Comment</code> node has been
+ appended is serialized and the output is then reparsed, the comment
+ will end up being displayed in the text field. Similarly, if, as a
+ result of DOM manipulation, an element contains a comment that
+ contains the literal string "<code title="">--&gt;</code>", then
+ when the result of serializing the element is parsed, the comment
+ will be truncated at that point and the rest of the comment will be
+ interpreted as markup. More examples would be making a
+ <code><a href=#script>script</a></code> element contain a text node with the text string
+ "<code>&lt;/script&gt;</code>", or having a <code><a href=#the-p-element>p</a></code> element that
+ contains a <code><a href=#the-ul-element>ul</a></code> element (as the <code><a href=#the-ul-element>ul</a></code> element's
+ <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> would imply the end
+ tag for the <code><a href=#the-p-element>p</a></code>).</p>
+
+
+ <h3 id=parsing-html-fragments><span class=secno>10.4 </span>Parsing HTML fragments</h3>
+
+ <p>The following steps form the <dfn id=html-fragment-parsing-algorithm>HTML fragment parsing
+ algorithm</dfn>. The algorithm optionally takes as input an
+ <code><a href=#element>Element</a></code> node, referred to as the <var title="">context</var> element, which gives the context for the
+ parser, as well as <var title="">input</var>, a string to parse, and
+ returns a list of zero or more nodes.</p>
+
+ <p class=note>Parts marked <dfn id=fragment-case>fragment case</dfn> in algorithms
+ in the parser section are parts that only occur if the parser was
+ created for the purposes of this algorithm (and with a <var title="">context</var> element). The algorithms have been annotated
+ with such markings for informational purposes only; such markings
+ have no normative weight. If it is possible for a condition
+ described as a <a href=#fragment-case>fragment case</a> to occur even when the
+ parser wasn't created for the purposes of handling this algorithm,
+ then that is an error in the specification.</p>
+
+ <ol><li>
+
+ <p>Create a new <code><a href=#document>Document</a></code> node, and mark it as being
+ an <a href=#html-documents title="HTML documents">HTML document</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <var title="">context</var> element, and the
+ <code><a href=#document>Document</a></code> of the <var title="">context</var> element
+ is in <a href=#quirks-mode>quirks mode</a>, then let the <code><a href=#document>Document</a></code>
+ be in <a href=#quirks-mode>quirks mode</a>. Otherwise, if there is a <var title="">context</var> element, and the <code><a href=#document>Document</a></code> of
+ the <var title="">context</var> element is in <a href=#limited-quirks-mode>limited-quirks
+ mode</a>, then let the <code><a href=#document>Document</a></code> be in
+ <a href=#limited-quirks-mode>limited-quirks mode</a>. Otherwise, leave the
+ <code><a href=#document>Document</a></code> in <a href=#no-quirks-mode>no-quirks mode</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Create a new <a href=#html-parser>HTML parser</a>, and associate it with
+ the just created <code><a href=#document>Document</a></code> node.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <var title="">context</var> element, run these
+ substeps:</p>
+
+ <ol><li>
+
+ <p>Set the state of the <a href=#html-parser>HTML parser</a>'s
+ <a href=#tokenization>tokenization</a> stage as follows:</p>
+
+ <dl class=switch><dt>If it is a <code><a href=#the-title-element-0>title</a></code> or <code><a href=#the-textarea-element>textarea</a></code>
+ element</dt>
+
+ <dd>Switch the tokenizer to the <a href=#rcdata-state>RCDATA state</a>.</dd>
+
+
+ <dt>If it is a <code><a href=#the-style-element>style</a></code>, <code><a href=#xmp>xmp</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#noembed>noembed</a></code>, or
+ <code><a href=#noframes>noframes</a></code> element</dt>
+
+ <dd>Switch the tokenizer to the <a href=#rawtext-state>RAWTEXT state</a>.</dd>
+
+
+ <dt>If it is a <code><a href=#script>script</a></code> element</dt>
+
+ <dd>Switch the tokenizer to the <a href=#script-data-state>script data state</a>.</dd>
+
+
+ <dt>If it is a <code><a href=#the-noscript-element>noscript</a></code> element</dt>
+
+ <dd>If the <a href=#scripting-flag>scripting flag</a> is enabled, switch the
+ tokenizer to the <a href=#rawtext-state>RAWTEXT state</a>. Otherwise,
+ leave the tokenizer in the <a href=#data-state>data state</a>.</dd>
+
+
+ <dt>If it is a <code><a href=#plaintext>plaintext</a></code> element</dt>
+
+ <dd>Switch the tokenizer to the <a href=#plaintext-state>PLAINTEXT
+ state</a>.</dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd>Leave the tokenizer in the <a href=#data-state>data state</a>.</dd>
+
+ </dl><p class=note>For performance reasons, an implementation that
+ does not report errors and that uses the actual state machine
+ described in this specification directly could use the PLAINTEXT
+ state instead of the RAWTEXT and script data states where those
+ are mentioned in the list above. Except for rules regarding
+ parse errors, they are equivalent, since there is no
+ <a href=#appropriate-end-tag-token>appropriate end tag token</a> in the fragment case, yet
+ they involve far fewer state transitions.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">root</var> be a new <code><a href=#the-html-element-0>html</a></code> element
+ with no attributes.</p>
+
+ </li>
+
+ <li>
+
+ <p>Append the element <var title="">root</var> to the
+ <code><a href=#document>Document</a></code> node created above.</p>
+
+ </li>
+
+ <li>
+
+ <p>Set up the parser's <a href=#stack-of-open-elements>stack of open elements</a> so that
+ it contains just the single element <var title="">root</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p><a href=#reset-the-insertion-mode-appropriately title="reset the insertion mode appropriately">Reset the
+ parser's insertion mode appropriately</a>.</p>
+
+ <p class=note>The parser will reference the <var title="">context</var> element as part of that algorithm.</p>
+
+ </li>
+
+ <li>
+
+ <p>Set the parser's <a href=#form-element-pointer><code>form</code> element pointer</a>
+ to the nearest node to the <var title="">context</var> element
+ that is a <code><a href=#the-form-element>form</a></code> element (going straight up the
+ ancestor chain, and including the element itself, if it is a
+ <code><a href=#the-form-element>form</a></code> element), or, if there is no such
+ <code><a href=#the-form-element>form</a></code> element, to null.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li>
+
+ <p>Place into the <a href=#the-input-stream>input stream</a> for the <a href=#html-parser>HTML
+ parser</a> just created the <var title="">input</var>. The
+ encoding <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
+ <i>irrelevant</i>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Start the parser and let it run until it has consumed all the
+ characters just inserted into the input stream.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <var title="">context</var> element, return the
+ child nodes of <var title="">root</var>, in <a href=#tree-order>tree
+ order</a>.</p>
+
+ <p>Otherwise, return the children of the <code><a href=#document>Document</a></code>
+ object, in <a href=#tree-order>tree order</a>.</p>
+
+ </li>
+
+ </ol></div>
+
+
+
+ <h3 id=named-character-references><span class=secno>10.5 </span><dfn>Named character references</dfn></h3>
+
+ <p>This table lists the character reference names that are supported
+ by HTML, and the code points to which they refer. It is referenced
+ by the previous sections.</p>
+
+ <div id=named-character-references-table>
+ <table><thead><tr><th> Name </th> <th> Character </th> <th> Glyph </th> <tbody><tr><td> <code title="">AElig;</code> </td> <td> U+000C6 </td> <td> <span>&AElig;</span> </td> <tr class=impl><td> <code title="">AElig</code> </td> <td> U+000C6 </td> <td> <span title="">&AElig;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">AMP;</code> </td> <td> U+00026 </td> <td> <span>&amp;</span> </td> <tr class=impl><td> <code title="">AMP</code> </td> <td> U+00026 </td> <td> <span title="">&amp;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Aacute;</code> </td> <td> U+000C1 </td> <td> <span>&Aacute;</span> </td> <tr class=impl><td> <code title="">Aacute</code> </td> <td> U+000C1 </td> <td> <span title="">&Aacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Abreve;</code> </td> <td> U+00102 </td> <td> <span>&#258;</span> </td> <tr><td> <code title="">Acirc;</code> </td> <td> U+000C2 </td> <td> <span>&Acirc;</span> </td> <tr class=impl><td> <code title="">Acirc</code> </td> <td> U+000C2 </td> <td> <span title="">&Acirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Acy;</code> </td> <td> U+00410 </td> <td> <span>&#1040;</span> </td> <tr><td> <code title="">Afr;</code> </td> <td> U+1D504 </td> <td> <span>&#120068;</span> </td> <tr><td> <code title="">Agrave;</code> </td> <td> U+000C0 </td> <td> <span>&Agrave;</span> </td> <tr class=impl><td> <code title="">Agrave</code> </td> <td> U+000C0 </td> <td> <span title="">&Agrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Alpha;</code> </td> <td> U+00391 </td> <td> <span>&Alpha;</span> </td> <tr><td> <code title="">Amacr;</code> </td> <td> U+00100 </td> <td> <span>&#256;</span> </td> <tr><td> <code title="">And;</code> </td> <td> U+02A53 </td> <td> <span>&#10835;</span> </td> <tr><td> <code title="">Aogon;</code> </td> <td> U+00104 </td> <td> <span>&#260;</span> </td> <tr><td> <code title="">Aopf;</code> </td> <td> U+1D538 </td> <td> <span>&#120120;</span> </td> <tr><td> <code title="">ApplyFunction;</code> </td> <td> U+02061 </td> <td> <span>&#8289;</span> </td> <tr><td> <code title="">Aring;</code> </td> <td> U+000C5 </td> <td> <span>&Aring;</span> </td> <tr class=impl><td> <code title="">Aring</code> </td> <td> U+000C5 </td> <td> <span title="">&Aring;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ascr;</code> </td> <td> U+1D49C </td> <td> <span>&#119964;</span> </td> <tr><td> <code title="">Assign;</code> </td> <td> U+02254 </td> <td> <span>&#8788;</span> </td> <tr><td> <code title="">Atilde;</code> </td> <td> U+000C3 </td> <td> <span>&Atilde;</span> </td> <tr class=impl><td> <code title="">Atilde</code> </td> <td> U+000C3 </td> <td> <span title="">&Atilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Auml;</code> </td> <td> U+000C4 </td> <td> <span>&Auml;</span> </td> <tr class=impl><td> <code title="">Auml</code> </td> <td> U+000C4 </td> <td> <span title="">&Auml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Backslash;</code> </td> <td> U+02216 </td> <td> <span>&#8726;</span> </td> <tr><td> <code title="">Barv;</code> </td> <td> U+02AE7 </td> <td> <span>&#10983;</span> </td> <tr><td> <code title="">Barwed;</code> </td> <td> U+02306 </td> <td> <span>&#8966;</span> </td> <tr><td> <code title="">Bcy;</code> </td> <td> U+00411 </td> <td> <span>&#1041;</span> </td> <tr><td> <code title="">Because;</code> </td> <td> U+02235 </td> <td> <span>&#8757;</span> </td> <tr><td> <code title="">Bernoullis;</code> </td> <td> U+0212C </td> <td> <span>&#8492;</span> </td> <tr><td> <code title="">Beta;</code> </td> <td> U+00392 </td> <td> <span>&Beta;</span> </td> <tr><td> <code title="">Bfr;</code> </td> <td> U+1D505 </td> <td> <span>&#120069;</span> </td> <tr><td> <code title="">Bopf;</code> </td> <td> U+1D539 </td> <td> <span>&#120121;</span> </td> <tr><td> <code title="">Breve;</code> </td> <td> U+002D8 </td> <td> <span>&#728;</span> </td> <tr><td> <code title="">Bscr;</code> </td> <td> U+0212C </td> <td> <span>&#8492;</span> </td> <tr><td> <code title="">Bumpeq;</code> </td> <td> U+0224E </td> <td> <span>&#8782;</span> </td> <tr><td> <code title="">CHcy;</code> </td> <td> U+00427 </td> <td> <span>&#1063;</span> </td> <tr><td> <code title="">COPY;</code> </td> <td> U+000A9 </td> <td> <span>&copy;</span> </td> <tr class=impl><td> <code title="">COPY</code> </td> <td> U+000A9 </td> <td> <span title="">&copy;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Cacute;</code> </td> <td> U+00106 </td> <td> <span>&#262;</span> </td> <tr><td> <code title="">Cap;</code> </td> <td> U+022D2 </td> <td> <span>&#8914;</span> </td> <tr><td> <code title="">CapitalDifferentialD;</code> </td> <td> U+02145 </td> <td> <span>&#8517;</span> </td> <tr><td> <code title="">Cayleys;</code> </td> <td> U+0212D </td> <td> <span>&#8493;</span> </td> <tr><td> <code title="">Ccaron;</code> </td> <td> U+0010C </td> <td> <span>&#268;</span> </td> <tr><td> <code title="">Ccedil;</code> </td> <td> U+000C7 </td> <td> <span>&Ccedil;</span> </td> <tr class=impl><td> <code title="">Ccedil</code> </td> <td> U+000C7 </td> <td> <span title="">&Ccedil;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ccirc;</code> </td> <td> U+00108 </td> <td> <span>&#264;</span> </td> <tr><td> <code title="">Cconint;</code> </td> <td> U+02230 </td> <td> <span>&#8752;</span> </td> <tr><td> <code title="">Cdot;</code> </td> <td> U+0010A </td> <td> <span>&#266;</span> </td> <tr><td> <code title="">Cedilla;</code> </td> <td> U+000B8 </td> <td> <span>&cedil;</span> </td> <tr><td> <code title="">CenterDot;</code> </td> <td> U+000B7 </td> <td> <span>&middot;</span> </td> <tr><td> <code title="">Cfr;</code> </td> <td> U+0212D </td> <td> <span>&#8493;</span> </td> <tr><td> <code title="">Chi;</code> </td> <td> U+003A7 </td> <td> <span>&Chi;</span> </td> <tr><td> <code title="">CircleDot;</code> </td> <td> U+02299 </td> <td> <span>&#8857;</span> </td> <tr><td> <code title="">CircleMinus;</code> </td> <td> U+02296 </td> <td> <span>&#8854;</span> </td> <tr><td> <code title="">CirclePlus;</code> </td> <td> U+02295 </td> <td> <span>&oplus;</span> </td> <tr><td> <code title="">CircleTimes;</code> </td> <td> U+02297 </td> <td> <span>&otimes;</span> </td> <tr><td> <code title="">ClockwiseContourIntegral;</code> </td> <td> U+02232 </td> <td> <span>&#8754;</span> </td> <tr><td> <code title="">CloseCurlyDoubleQuote;</code> </td> <td> U+0201D </td> <td> <span>&rdquo;</span> </td> <tr><td> <code title="">CloseCurlyQuote;</code> </td> <td> U+02019 </td> <td> <span>&rsquo;</span> </td> <tr><td> <code title="">Colon;</code> </td> <td> U+02237 </td> <td> <span>&#8759;</span> </td> <tr><td> <code title="">Colone;</code> </td> <td> U+02A74 </td> <td> <span>&#10868;</span> </td> <tr><td> <code title="">Congruent;</code> </td> <td> U+02261 </td> <td> <span>&equiv;</span> </td> <tr><td> <code title="">Conint;</code> </td> <td> U+0222F </td> <td> <span>&#8751;</span> </td> <tr><td> <code title="">ContourIntegral;</code> </td> <td> U+0222E </td> <td> <span>&#8750;</span> </td> <tr><td> <code title="">Copf;</code> </td> <td> U+02102 </td> <td> <span>&#8450;</span> </td> <tr><td> <code title="">Coproduct;</code> </td> <td> U+02210 </td> <td> <span>&#8720;</span> </td> <tr><td> <code title="">CounterClockwiseContourIntegral;</code> </td> <td> U+02233 </td> <td> <span>&#8755;</span> </td> <tr><td> <code title="">Cross;</code> </td> <td> U+02A2F </td> <td> <span>&#10799;</span> </td> <tr><td> <code title="">Cscr;</code> </td> <td> U+1D49E </td> <td> <span>&#119966;</span> </td> <tr><td> <code title="">Cup;</code> </td> <td> U+022D3 </td> <td> <span>&#8915;</span> </td> <tr><td> <code title="">CupCap;</code> </td> <td> U+0224D </td> <td> <span>&#8781;</span> </td> <tr><td> <code title="">DD;</code> </td> <td> U+02145 </td> <td> <span>&#8517;</span> </td> <tr><td> <code title="">DDotrahd;</code> </td> <td> U+02911 </td> <td> <span>&#10513;</span> </td> <tr><td> <code title="">DJcy;</code> </td> <td> U+00402 </td> <td> <span>&#1026;</span> </td> <tr><td> <code title="">DScy;</code> </td> <td> U+00405 </td> <td> <span>&#1029;</span> </td> <tr><td> <code title="">DZcy;</code> </td> <td> U+0040F </td> <td> <span>&#1039;</span> </td> <tr><td> <code title="">Dagger;</code> </td> <td> U+02021 </td> <td> <span>&Dagger;</span> </td> <tr><td> <code title="">Darr;</code> </td> <td> U+021A1 </td> <td> <span>&#8609;</span> </td> <tr><td> <code title="">Dashv;</code> </td> <td> U+02AE4 </td> <td> <span>&#10980;</span> </td> <tr><td> <code title="">Dcaron;</code> </td> <td> U+0010E </td> <td> <span>&#270;</span> </td> <tr><td> <code title="">Dcy;</code> </td> <td> U+00414 </td> <td> <span>&#1044;</span> </td> <tr><td> <code title="">Del;</code> </td> <td> U+02207 </td> <td> <span>&nabla;</span> </td> <tr><td> <code title="">Delta;</code> </td> <td> U+00394 </td> <td> <span>&Delta;</span> </td> <tr><td> <code title="">Dfr;</code> </td> <td> U+1D507 </td> <td> <span>&#120071;</span> </td> <tr><td> <code title="">DiacriticalAcute;</code> </td> <td> U+000B4 </td> <td> <span>&acute;</span> </td> <tr><td> <code title="">DiacriticalDot;</code> </td> <td> U+002D9 </td> <td> <span>&#729;</span> </td> <tr><td> <code title="">DiacriticalDoubleAcute;</code> </td> <td> U+002DD </td> <td> <span>&#733;</span> </td> <tr><td> <code title="">DiacriticalGrave;</code> </td> <td> U+00060 </td> <td> <span>`</span> </td> <tr><td> <code title="">DiacriticalTilde;</code> </td> <td> U+002DC </td> <td> <span>&tilde;</span> </td> <tr><td> <code title="">Diamond;</code> </td> <td> U+022C4 </td> <td> <span>&#8900;</span> </td> <tr><td> <code title="">DifferentialD;</code> </td> <td> U+02146 </td> <td> <span>&#8518;</span> </td> <tr><td> <code title="">Dopf;</code> </td> <td> U+1D53B </td> <td> <span>&#120123;</span> </td> <tr><td> <code title="">Dot;</code> </td> <td> U+000A8 </td> <td> <span>&uml;</span> </td> <tr><td> <code title="">DotDot;</code> </td> <td> U+020DC </td> <td> <span>&#9676;&#8412;</span> </td> <tr><td> <code title="">DotEqual;</code> </td> <td> U+02250 </td> <td> <span>&#8784;</span> </td> <tr><td> <code title="">DoubleContourIntegral;</code> </td> <td> U+0222F </td> <td> <span>&#8751;</span> </td> <tr><td> <code title="">DoubleDot;</code> </td> <td> U+000A8 </td> <td> <span>&uml;</span> </td> <tr><td> <code title="">DoubleDownArrow;</code> </td> <td> U+021D3 </td> <td> <span>&dArr;</span> </td> <tr><td> <code title="">DoubleLeftArrow;</code> </td> <td> U+021D0 </td> <td> <span>&lArr;</span> </td> <tr><td> <code title="">DoubleLeftRightArrow;</code> </td> <td> U+021D4 </td> <td> <span>&hArr;</span> </td> <tr><td> <code title="">DoubleLeftTee;</code> </td> <td> U+02AE4 </td> <td> <span>&#10980;</span> </td> <tr><td> <code title="">DoubleLongLeftArrow;</code> </td> <td> U+027F8 </td> <td> <span>&#10232;</span> </td> <tr><td> <code title="">DoubleLongLeftRightArrow;</code> </td> <td> U+027FA </td> <td> <span>&#10234;</span> </td> <tr><td> <code title="">DoubleLongRightArrow;</code> </td> <td> U+027F9 </td> <td> <span>&#10233;</span> </td> <tr><td> <code title="">DoubleRightArrow;</code> </td> <td> U+021D2 </td> <td> <span>&rArr;</span> </td> <tr><td> <code title="">DoubleRightTee;</code> </td> <td> U+022A8 </td> <td> <span>&#8872;</span> </td> <tr><td> <code title="">DoubleUpArrow;</code> </td> <td> U+021D1 </td> <td> <span>&uArr;</span> </td> <tr><td> <code title="">DoubleUpDownArrow;</code> </td> <td> U+021D5 </td> <td> <span>&#8661;</span> </td> <tr><td> <code title="">DoubleVerticalBar;</code> </td> <td> U+02225 </td> <td> <span>&#8741;</span> </td> <tr><td> <code title="">DownArrow;</code> </td> <td> U+02193 </td> <td> <span>&darr;</span> </td> <tr><td> <code title="">DownArrowBar;</code> </td> <td> U+02913 </td> <td> <span>&#10515;</span> </td> <tr><td> <code title="">DownArrowUpArrow;</code> </td> <td> U+021F5 </td> <td> <span>&#8693;</span> </td> <tr><td> <code title="">DownBreve;</code> </td> <td> U+00311 </td> <td> <span>&#9676;&#785;</span> </td> <tr><td> <code title="">DownLeftRightVector;</code> </td> <td> U+02950 </td> <td> <span>&#10576;</span> </td> <tr><td> <code title="">DownLeftTeeVector;</code> </td> <td> U+0295E </td> <td> <span>&#10590;</span> </td> <tr><td> <code title="">DownLeftVector;</code> </td> <td> U+021BD </td> <td> <span>&#8637;</span> </td> <tr><td> <code title="">DownLeftVectorBar;</code> </td> <td> U+02956 </td> <td> <span>&#10582;</span> </td> <tr><td> <code title="">DownRightTeeVector;</code> </td> <td> U+0295F </td> <td> <span>&#10591;</span> </td> <tr><td> <code title="">DownRightVector;</code> </td> <td> U+021C1 </td> <td> <span>&#8641;</span> </td> <tr><td> <code title="">DownRightVectorBar;</code> </td> <td> U+02957 </td> <td> <span>&#10583;</span> </td> <tr><td> <code title="">DownTee;</code> </td> <td> U+022A4 </td> <td> <span>&#8868;</span> </td> <tr><td> <code title="">DownTeeArrow;</code> </td> <td> U+021A7 </td> <td> <span>&#8615;</span> </td> <tr><td> <code title="">Downarrow;</code> </td> <td> U+021D3 </td> <td> <span>&dArr;</span> </td> <tr><td> <code title="">Dscr;</code> </td> <td> U+1D49F </td> <td> <span>&#119967;</span> </td> <tr><td> <code title="">Dstrok;</code> </td> <td> U+00110 </td> <td> <span>&#272;</span> </td> <tr><td> <code title="">ENG;</code> </td> <td> U+0014A </td> <td> <span>&#330;</span> </td> <tr><td> <code title="">ETH;</code> </td> <td> U+000D0 </td> <td> <span>&ETH;</span> </td> <tr class=impl><td> <code title="">ETH</code> </td> <td> U+000D0 </td> <td> <span title="">&ETH;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Eacute;</code> </td> <td> U+000C9 </td> <td> <span>&Eacute;</span> </td> <tr class=impl><td> <code title="">Eacute</code> </td> <td> U+000C9 </td> <td> <span title="">&Eacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ecaron;</code> </td> <td> U+0011A </td> <td> <span>&#282;</span> </td> <tr><td> <code title="">Ecirc;</code> </td> <td> U+000CA </td> <td> <span>&Ecirc;</span> </td> <tr class=impl><td> <code title="">Ecirc</code> </td> <td> U+000CA </td> <td> <span title="">&Ecirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ecy;</code> </td> <td> U+0042D </td> <td> <span>&#1069;</span> </td> <tr><td> <code title="">Edot;</code> </td> <td> U+00116 </td> <td> <span>&#278;</span> </td> <tr><td> <code title="">Efr;</code> </td> <td> U+1D508 </td> <td> <span>&#120072;</span> </td> <tr><td> <code title="">Egrave;</code> </td> <td> U+000C8 </td> <td> <span>&Egrave;</span> </td> <tr class=impl><td> <code title="">Egrave</code> </td> <td> U+000C8 </td> <td> <span title="">&Egrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Element;</code> </td> <td> U+02208 </td> <td> <span>&isin;</span> </td> <tr><td> <code title="">Emacr;</code> </td> <td> U+00112 </td> <td> <span>&#274;</span> </td> <tr><td> <code title="">EmptySmallSquare;</code> </td> <td> U+025FB </td> <td> <span>&#9723;</span> </td> <tr><td> <code title="">EmptyVerySmallSquare;</code> </td> <td> U+025AB </td> <td> <span>&#9643;</span> </td> <tr><td> <code title="">Eogon;</code> </td> <td> U+00118 </td> <td> <span>&#280;</span> </td> <tr><td> <code title="">Eopf;</code> </td> <td> U+1D53C </td> <td> <span>&#120124;</span> </td> <tr><td> <code title="">Epsilon;</code> </td> <td> U+00395 </td> <td> <span>&Epsilon;</span> </td> <tr><td> <code title="">Equal;</code> </td> <td> U+02A75 </td> <td> <span>&#10869;</span> </td> <tr><td> <code title="">EqualTilde;</code> </td> <td> U+02242 </td> <td> <span>&#8770;</span> </td> <tr><td> <code title="">Equilibrium;</code> </td> <td> U+021CC </td> <td> <span>&#8652;</span> </td> <tr><td> <code title="">Escr;</code> </td> <td> U+02130 </td> <td> <span>&#8496;</span> </td> <tr><td> <code title="">Esim;</code> </td> <td> U+02A73 </td> <td> <span>&#10867;</span> </td> <tr><td> <code title="">Eta;</code> </td> <td> U+00397 </td> <td> <span>&Eta;</span> </td> <tr><td> <code title="">Euml;</code> </td> <td> U+000CB </td> <td> <span>&Euml;</span> </td> <tr class=impl><td> <code title="">Euml</code> </td> <td> U+000CB </td> <td> <span title="">&Euml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Exists;</code> </td> <td> U+02203 </td> <td> <span>&exist;</span> </td> <tr><td> <code title="">ExponentialE;</code> </td> <td> U+02147 </td> <td> <span>&#8519;</span> </td> <tr><td> <code title="">Fcy;</code> </td> <td> U+00424 </td> <td> <span>&#1060;</span> </td> <tr><td> <code title="">Ffr;</code> </td> <td> U+1D509 </td> <td> <span>&#120073;</span> </td> <tr><td> <code title="">FilledSmallSquare;</code> </td> <td> U+025FC </td> <td> <span>&#9724;</span> </td> <tr><td> <code title="">FilledVerySmallSquare;</code> </td> <td> U+025AA </td> <td> <span>&#9642;</span> </td> <tr><td> <code title="">Fopf;</code> </td> <td> U+1D53D </td> <td> <span>&#120125;</span> </td> <tr><td> <code title="">ForAll;</code> </td> <td> U+02200 </td> <td> <span>&forall;</span> </td> <tr><td> <code title="">Fouriertrf;</code> </td> <td> U+02131 </td> <td> <span>&#8497;</span> </td> <tr><td> <code title="">Fscr;</code> </td> <td> U+02131 </td> <td> <span>&#8497;</span> </td> <tr><td> <code title="">GJcy;</code> </td> <td> U+00403 </td> <td> <span>&#1027;</span> </td> <tr><td> <code title="">GT;</code> </td> <td> U+0003E </td> <td> <span>&gt;</span> </td> <tr class=impl><td> <code title="">GT</code> </td> <td> U+0003E </td> <td> <span title="">&gt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Gamma;</code> </td> <td> U+00393 </td> <td> <span>&Gamma;</span> </td> <tr><td> <code title="">Gammad;</code> </td> <td> U+003DC </td> <td> <span>&#988;</span> </td> <tr><td> <code title="">Gbreve;</code> </td> <td> U+0011E </td> <td> <span>&#286;</span> </td> <tr><td> <code title="">Gcedil;</code> </td> <td> U+00122 </td> <td> <span>&#290;</span> </td> <tr><td> <code title="">Gcirc;</code> </td> <td> U+0011C </td> <td> <span>&#284;</span> </td> <tr><td> <code title="">Gcy;</code> </td> <td> U+00413 </td> <td> <span>&#1043;</span> </td> <tr><td> <code title="">Gdot;</code> </td> <td> U+00120 </td> <td> <span>&#288;</span> </td> <tr><td> <code title="">Gfr;</code> </td> <td> U+1D50A </td> <td> <span>&#120074;</span> </td> <tr><td> <code title="">Gg;</code> </td> <td> U+022D9 </td> <td> <span>&#8921;</span> </td> <tr><td> <code title="">Gopf;</code> </td> <td> U+1D53E </td> <td> <span>&#120126;</span> </td> <tr><td> <code title="">GreaterEqual;</code> </td> <td> U+02265 </td> <td> <span>&ge;</span> </td> <tr><td> <code title="">GreaterEqualLess;</code> </td> <td> U+022DB </td> <td> <span>&#8923;</span> </td> <tr><td> <code title="">GreaterFullEqual;</code> </td> <td> U+02267 </td> <td> <span>&#8807;</span> </td> <tr><td> <code title="">GreaterGreater;</code> </td> <td> U+02AA2 </td> <td> <span>&#10914;</span> </td> <tr><td> <code title="">GreaterLess;</code> </td> <td> U+02277 </td> <td> <span>&#8823;</span> </td> <tr><td> <code title="">GreaterSlantEqual;</code> </td> <td> U+02A7E </td> <td> <span>&#10878;</span> </td> <tr><td> <code title="">GreaterTilde;</code> </td> <td> U+02273 </td> <td> <span>&#8819;</span> </td> <tr><td> <code title="">Gscr;</code> </td> <td> U+1D4A2 </td> <td> <span>&#119970;</span> </td> <tr><td> <code title="">Gt;</code> </td> <td> U+0226B </td> <td> <span>&#8811;</span> </td> <tr><td> <code title="">HARDcy;</code> </td> <td> U+0042A </td> <td> <span>&#1066;</span> </td> <tr><td> <code title="">Hacek;</code> </td> <td> U+002C7 </td> <td> <span>&#711;</span> </td> <tr><td> <code title="">Hat;</code> </td> <td> U+0005E </td> <td> <span>^</span> </td> <tr><td> <code title="">Hcirc;</code> </td> <td> U+00124 </td> <td> <span>&#292;</span> </td> <tr><td> <code title="">Hfr;</code> </td> <td> U+0210C </td> <td> <span>&#8460;</span> </td> <tr><td> <code title="">HilbertSpace;</code> </td> <td> U+0210B </td> <td> <span>&#8459;</span> </td> <tr><td> <code title="">Hopf;</code> </td> <td> U+0210D </td> <td> <span>&#8461;</span> </td> <tr><td> <code title="">HorizontalLine;</code> </td> <td> U+02500 </td> <td> <span>&#9472;</span> </td> <tr><td> <code title="">Hscr;</code> </td> <td> U+0210B </td> <td> <span>&#8459;</span> </td> <tr><td> <code title="">Hstrok;</code> </td> <td> U+00126 </td> <td> <span>&#294;</span> </td> <tr><td> <code title="">HumpDownHump;</code> </td> <td> U+0224E </td> <td> <span>&#8782;</span> </td> <tr><td> <code title="">HumpEqual;</code> </td> <td> U+0224F </td> <td> <span>&#8783;</span> </td> <tr><td> <code title="">IEcy;</code> </td> <td> U+00415 </td> <td> <span>&#1045;</span> </td> <tr><td> <code title="">IJlig;</code> </td> <td> U+00132 </td> <td> <span>&#306;</span> </td> <tr><td> <code title="">IOcy;</code> </td> <td> U+00401 </td> <td> <span>&#1025;</span> </td> <tr><td> <code title="">Iacute;</code> </td> <td> U+000CD </td> <td> <span>&Iacute;</span> </td> <tr class=impl><td> <code title="">Iacute</code> </td> <td> U+000CD </td> <td> <span title="">&Iacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Icirc;</code> </td> <td> U+000CE </td> <td> <span>&Icirc;</span> </td> <tr class=impl><td> <code title="">Icirc</code> </td> <td> U+000CE </td> <td> <span title="">&Icirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Icy;</code> </td> <td> U+00418 </td> <td> <span>&#1048;</span> </td> <tr><td> <code title="">Idot;</code> </td> <td> U+00130 </td> <td> <a href=#the-i-element>&#304;</a> </td> <tr><td> <code title="">Ifr;</code> </td> <td> U+02111 </td> <td> <span>&image;</span> </td> <tr><td> <code title="">Igrave;</code> </td> <td> U+000CC </td> <td> <span>&Igrave;</span> </td> <tr class=impl><td> <code title="">Igrave</code> </td> <td> U+000CC </td> <td> <span title="">&Igrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Im;</code> </td> <td> U+02111 </td> <td> <span>&image;</span> </td> <tr><td> <code title="">Imacr;</code> </td> <td> U+0012A </td> <td> <span>&#298;</span> </td> <tr><td> <code title="">ImaginaryI;</code> </td> <td> U+02148 </td> <td> <span>&#8520;</span> </td> <tr><td> <code title="">Implies;</code> </td> <td> U+021D2 </td> <td> <span>&rArr;</span> </td> <tr><td> <code title="">Int;</code> </td> <td> U+0222C </td> <td> <span>&#8748;</span> </td> <tr><td> <code title="">Integral;</code> </td> <td> U+0222B </td> <td> <span>&int;</span> </td> <tr><td> <code title="">Intersection;</code> </td> <td> U+022C2 </td> <td> <span>&#8898;</span> </td> <tr><td> <code title="">InvisibleComma;</code> </td> <td> U+02063 </td> <td> <span>&#8291;</span> </td> <tr><td> <code title="">InvisibleTimes;</code> </td> <td> U+02062 </td> <td> <span>&#8290;</span> </td> <tr><td> <code title="">Iogon;</code> </td> <td> U+0012E </td> <td> <span>&#302;</span> </td> <tr><td> <code title="">Iopf;</code> </td> <td> U+1D540 </td> <td> <span>&#120128;</span> </td> <tr><td> <code title="">Iota;</code> </td> <td> U+00399 </td> <td> <span>&Iota;</span> </td> <tr><td> <code title="">Iscr;</code> </td> <td> U+02110 </td> <td> <span>&#8464;</span> </td> <tr><td> <code title="">Itilde;</code> </td> <td> U+00128 </td> <td> <span>&#296;</span> </td> <tr><td> <code title="">Iukcy;</code> </td> <td> U+00406 </td> <td> <span>&#1030;</span> </td> <tr><td> <code title="">Iuml;</code> </td> <td> U+000CF </td> <td> <span>&Iuml;</span> </td> <tr class=impl><td> <code title="">Iuml</code> </td> <td> U+000CF </td> <td> <span title="">&Iuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Jcirc;</code> </td> <td> U+00134 </td> <td> <span>&#308;</span> </td> <tr><td> <code title="">Jcy;</code> </td> <td> U+00419 </td> <td> <span>&#1049;</span> </td> <tr><td> <code title="">Jfr;</code> </td> <td> U+1D50D </td> <td> <span>&#120077;</span> </td> <tr><td> <code title="">Jopf;</code> </td> <td> U+1D541 </td> <td> <span>&#120129;</span> </td> <tr><td> <code title="">Jscr;</code> </td> <td> U+1D4A5 </td> <td> <span>&#119973;</span> </td> <tr><td> <code title="">Jsercy;</code> </td> <td> U+00408 </td> <td> <span>&#1032;</span> </td> <tr><td> <code title="">Jukcy;</code> </td> <td> U+00404 </td> <td> <span>&#1028;</span> </td> <tr><td> <code title="">KHcy;</code> </td> <td> U+00425 </td> <td> <span>&#1061;</span> </td> <tr><td> <code title="">KJcy;</code> </td> <td> U+0040C </td> <td> <span>&#1036;</span> </td> <tr><td> <code title="">Kappa;</code> </td> <td> U+0039A </td> <td> <span>&Kappa;</span> </td> <tr><td> <code title="">Kcedil;</code> </td> <td> U+00136 </td> <td> <span>&#310;</span> </td> <tr><td> <code title="">Kcy;</code> </td> <td> U+0041A </td> <td> <span>&#1050;</span> </td> <tr><td> <code title="">Kfr;</code> </td> <td> U+1D50E </td> <td> <span>&#120078;</span> </td> <tr><td> <code title="">Kopf;</code> </td> <td> U+1D542 </td> <td> <span>&#120130;</span> </td> <tr><td> <code title="">Kscr;</code> </td> <td> U+1D4A6 </td> <td> <span>&#119974;</span> </td> <tr><td> <code title="">LJcy;</code> </td> <td> U+00409 </td> <td> <span>&#1033;</span> </td> <tr><td> <code title="">LT;</code> </td> <td> U+0003C </td> <td> <span>&lt;</span> </td> <tr class=impl><td> <code title="">LT</code> </td> <td> U+0003C </td> <td> <span title="">&lt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Lacute;</code> </td> <td> U+00139 </td> <td> <span>&#313;</span> </td> <tr><td> <code title="">Lambda;</code> </td> <td> U+0039B </td> <td> <span>&Lambda;</span> </td> <tr><td> <code title="">Lang;</code> </td> <td> U+027EA </td> <td> <span>&#10218;</span> </td> <tr><td> <code title="">Laplacetrf;</code> </td> <td> U+02112 </td> <td> <span>&#8466;</span> </td> <tr><td> <code title="">Larr;</code> </td> <td> U+0219E </td> <td> <span>&#8606;</span> </td> <tr><td> <code title="">Lcaron;</code> </td> <td> U+0013D </td> <td> <span>&#317;</span> </td> <tr><td> <code title="">Lcedil;</code> </td> <td> U+0013B </td> <td> <span>&#315;</span> </td> <tr><td> <code title="">Lcy;</code> </td> <td> U+0041B </td> <td> <span>&#1051;</span> </td> <tr><td> <code title="">LeftAngleBracket;</code> </td> <td> U+027E8 </td> <td> <span>&lang;</span> </td> <tr><td> <code title="">LeftArrow;</code> </td> <td> U+02190 </td> <td> <span>&larr;</span> </td> <tr><td> <code title="">LeftArrowBar;</code> </td> <td> U+021E4 </td> <td> <span>&#8676;</span> </td> <tr><td> <code title="">LeftArrowRightArrow;</code> </td> <td> U+021C6 </td> <td> <span>&#8646;</span> </td> <tr><td> <code title="">LeftCeiling;</code> </td> <td> U+02308 </td> <td> <span>&lceil;</span> </td> <tr><td> <code title="">LeftDoubleBracket;</code> </td> <td> U+027E6 </td> <td> <span>&#10214;</span> </td> <tr><td> <code title="">LeftDownTeeVector;</code> </td> <td> U+02961 </td> <td> <span>&#10593;</span> </td> <tr><td> <code title="">LeftDownVector;</code> </td> <td> U+021C3 </td> <td> <span>&#8643;</span> </td> <tr><td> <code title="">LeftDownVectorBar;</code> </td> <td> U+02959 </td> <td> <span>&#10585;</span> </td> <tr><td> <code title="">LeftFloor;</code> </td> <td> U+0230A </td> <td> <span>&lfloor;</span> </td> <tr><td> <code title="">LeftRightArrow;</code> </td> <td> U+02194 </td> <td> <span>&harr;</span> </td> <tr><td> <code title="">LeftRightVector;</code> </td> <td> U+0294E </td> <td> <span>&#10574;</span> </td> <tr><td> <code title="">LeftTee;</code> </td> <td> U+022A3 </td> <td> <span>&#8867;</span> </td> <tr><td> <code title="">LeftTeeArrow;</code> </td> <td> U+021A4 </td> <td> <span>&#8612;</span> </td> <tr><td> <code title="">LeftTeeVector;</code> </td> <td> U+0295A </td> <td> <span>&#10586;</span> </td> <tr><td> <code title="">LeftTriangle;</code> </td> <td> U+022B2 </td> <td> <span>&#8882;</span> </td> <tr><td> <code title="">LeftTriangleBar;</code> </td> <td> U+029CF </td> <td> <span>&#10703;</span> </td> <tr><td> <code title="">LeftTriangleEqual;</code> </td> <td> U+022B4 </td> <td> <span>&#8884;</span> </td> <tr><td> <code title="">LeftUpDownVector;</code> </td> <td> U+02951 </td> <td> <span>&#10577;</span> </td> <tr><td> <code title="">LeftUpTeeVector;</code> </td> <td> U+02960 </td> <td> <span>&#10592;</span> </td> <tr><td> <code title="">LeftUpVector;</code> </td> <td> U+021BF </td> <td> <span>&#8639;</span> </td> <tr><td> <code title="">LeftUpVectorBar;</code> </td> <td> U+02958 </td> <td> <span>&#10584;</span> </td> <tr><td> <code title="">LeftVector;</code> </td> <td> U+021BC </td> <td> <span>&#8636;</span> </td> <tr><td> <code title="">LeftVectorBar;</code> </td> <td> U+02952 </td> <td> <span>&#10578;</span> </td> <tr><td> <code title="">Leftarrow;</code> </td> <td> U+021D0 </td> <td> <span>&lArr;</span> </td> <tr><td> <code title="">Leftrightarrow;</code> </td> <td> U+021D4 </td> <td> <span>&hArr;</span> </td> <tr><td> <code title="">LessEqualGreater;</code> </td> <td> U+022DA </td> <td> <span>&#8922;</span> </td> <tr><td> <code title="">LessFullEqual;</code> </td> <td> U+02266 </td> <td> <span>&#8806;</span> </td> <tr><td> <code title="">LessGreater;</code> </td> <td> U+02276 </td> <td> <span>&#8822;</span> </td> <tr><td> <code title="">LessLess;</code> </td> <td> U+02AA1 </td> <td> <span>&#10913;</span> </td> <tr><td> <code title="">LessSlantEqual;</code> </td> <td> U+02A7D </td> <td> <span>&#10877;</span> </td> <tr><td> <code title="">LessTilde;</code> </td> <td> U+02272 </td> <td> <span>&#8818;</span> </td> <tr><td> <code title="">Lfr;</code> </td> <td> U+1D50F </td> <td> <span>&#120079;</span> </td> <tr><td> <code title="">Ll;</code> </td> <td> U+022D8 </td> <td> <span>&#8920;</span> </td> <tr><td> <code title="">Lleftarrow;</code> </td> <td> U+021DA </td> <td> <span>&#8666;</span> </td> <tr><td> <code title="">Lmidot;</code> </td> <td> U+0013F </td> <td> <span>&#319;</span> </td> <tr><td> <code title="">LongLeftArrow;</code> </td> <td> U+027F5 </td> <td> <span>&#10229;</span> </td> <tr><td> <code title="">LongLeftRightArrow;</code> </td> <td> U+027F7 </td> <td> <span>&#10231;</span> </td> <tr><td> <code title="">LongRightArrow;</code> </td> <td> U+027F6 </td> <td> <span>&#10230;</span> </td> <tr><td> <code title="">Longleftarrow;</code> </td> <td> U+027F8 </td> <td> <span>&#10232;</span> </td> <tr><td> <code title="">Longleftrightarrow;</code> </td> <td> U+027FA </td> <td> <span>&#10234;</span> </td> <tr><td> <code title="">Longrightarrow;</code> </td> <td> U+027F9 </td> <td> <span>&#10233;</span> </td> <tr><td> <code title="">Lopf;</code> </td> <td> U+1D543 </td> <td> <span>&#120131;</span> </td> <tr><td> <code title="">LowerLeftArrow;</code> </td> <td> U+02199 </td> <td> <span>&#8601;</span> </td> <tr><td> <code title="">LowerRightArrow;</code> </td> <td> U+02198 </td> <td> <span>&#8600;</span> </td> <tr><td> <code title="">Lscr;</code> </td> <td> U+02112 </td> <td> <span>&#8466;</span> </td> <tr><td> <code title="">Lsh;</code> </td> <td> U+021B0 </td> <td> <span>&#8624;</span> </td> <tr><td> <code title="">Lstrok;</code> </td> <td> U+00141 </td> <td> <span>&#321;</span> </td> <tr><td> <code title="">Lt;</code> </td> <td> U+0226A </td> <td> <span>&#8810;</span> </td> <tr><td> <code title="">Map;</code> </td> <td> U+02905 </td> <td> <span>&#10501;</span> </td> <tr><td> <code title="">Mcy;</code> </td> <td> U+0041C </td> <td> <span>&#1052;</span> </td> <tr><td> <code title="">MediumSpace;</code> </td> <td> U+0205F </td> <td> <span>&#8287;</span> </td> <tr><td> <code title="">Mellintrf;</code> </td> <td> U+02133 </td> <td> <span>&#8499;</span> </td> <tr><td> <code title="">Mfr;</code> </td> <td> U+1D510 </td> <td> <span>&#120080;</span> </td> <tr><td> <code title="">MinusPlus;</code> </td> <td> U+02213 </td> <td> <span>&#8723;</span> </td> <tr><td> <code title="">Mopf;</code> </td> <td> U+1D544 </td> <td> <span>&#120132;</span> </td> <tr><td> <code title="">Mscr;</code> </td> <td> U+02133 </td> <td> <span>&#8499;</span> </td> <tr><td> <code title="">Mu;</code> </td> <td> U+0039C </td> <td> <span>&Mu;</span> </td> <tr><td> <code title="">NJcy;</code> </td> <td> U+0040A </td> <td> <span>&#1034;</span> </td> <tr><td> <code title="">Nacute;</code> </td> <td> U+00143 </td> <td> <span>&#323;</span> </td> <tr><td> <code title="">Ncaron;</code> </td> <td> U+00147 </td> <td> <span>&#327;</span> </td> <tr><td> <code title="">Ncedil;</code> </td> <td> U+00145 </td> <td> <span>&#325;</span> </td> <tr><td> <code title="">Ncy;</code> </td> <td> U+0041D </td> <td> <span>&#1053;</span> </td> <tr><td> <code title="">NegativeMediumSpace;</code> </td> <td> U+0200B </td> <td> <span>&#8203;</span> </td> <tr><td> <code title="">NegativeThickSpace;</code> </td> <td> U+0200B </td> <td> <span>&#8203;</span> </td> <tr><td> <code title="">NegativeThinSpace;</code> </td> <td> U+0200B </td> <td> <span>&#8203;</span> </td> <tr><td> <code title="">NegativeVeryThinSpace;</code> </td> <td> U+0200B </td> <td> <span>&#8203;</span> </td> <tr><td> <code title="">NestedGreaterGreater;</code> </td> <td> U+0226B </td> <td> <span>&#8811;</span> </td> <tr><td> <code title="">NestedLessLess;</code> </td> <td> U+0226A </td> <td> <span>&#8810;</span> </td> <tr><td> <code title="">NewLine;</code> </td> <td> U+0000A </td> <td> <span>
+</span> </td> <tr><td> <code title="">Nfr;</code> </td> <td> U+1D511 </td> <td> <span>&#120081;</span> </td> <tr><td> <code title="">NoBreak;</code> </td> <td> U+02060 </td> <td> <span>&#8288;</span> </td> <tr><td> <code title="">NonBreakingSpace;</code> </td> <td> U+000A0 </td> <td> <span>&nbsp;</span> </td> <tr><td> <code title="">Nopf;</code> </td> <td> U+02115 </td> <td> <span>&#8469;</span> </td> <tr><td> <code title="">Not;</code> </td> <td> U+02AEC </td> <td> <span>&#10988;</span> </td> <tr><td> <code title="">NotCongruent;</code> </td> <td> U+02262 </td> <td> <span>&#8802;</span> </td> <tr><td> <code title="">NotCupCap;</code> </td> <td> U+0226D </td> <td> <span>&#8813;</span> </td> <tr><td> <code title="">NotDoubleVerticalBar;</code> </td> <td> U+02226 </td> <td> <span>&#8742;</span> </td> <tr><td> <code title="">NotElement;</code> </td> <td> U+02209 </td> <td> <span>&notin;</span> </td> <tr><td> <code title="">NotEqual;</code> </td> <td> U+02260 </td> <td> <span>&ne;</span> </td> <tr><td> <code title="">NotExists;</code> </td> <td> U+02204 </td> <td> <span>&#8708;</span> </td> <tr><td> <code title="">NotGreater;</code> </td> <td> U+0226F </td> <td> <span>&#8815;</span> </td> <tr><td> <code title="">NotGreaterEqual;</code> </td> <td> U+02271 </td> <td> <span>&#8817;</span> </td> <tr><td> <code title="">NotGreaterLess;</code> </td> <td> U+02279 </td> <td> <span>&#8825;</span> </td> <tr><td> <code title="">NotGreaterTilde;</code> </td> <td> U+02275 </td> <td> <span>&#8821;</span> </td> <tr><td> <code title="">NotLeftTriangle;</code> </td> <td> U+022EA </td> <td> <span>&#8938;</span> </td> <tr><td> <code title="">NotLeftTriangleEqual;</code> </td> <td> U+022EC </td> <td> <span>&#8940;</span> </td> <tr><td> <code title="">NotLess;</code> </td> <td> U+0226E </td> <td> <span>&#8814;</span> </td> <tr><td> <code title="">NotLessEqual;</code> </td> <td> U+02270 </td> <td> <span>&#8816;</span> </td> <tr><td> <code title="">NotLessGreater;</code> </td> <td> U+02278 </td> <td> <span>&#8824;</span> </td> <tr><td> <code title="">NotLessTilde;</code> </td> <td> U+02274 </td> <td> <span>&#8820;</span> </td> <tr><td> <code title="">NotPrecedes;</code> </td> <td> U+02280 </td> <td> <span>&#8832;</span> </td> <tr><td> <code title="">NotPrecedesSlantEqual;</code> </td> <td> U+022E0 </td> <td> <span>&#8928;</span> </td> <tr><td> <code title="">NotReverseElement;</code> </td> <td> U+0220C </td> <td> <span>&#8716;</span> </td> <tr><td> <code title="">NotRightTriangle;</code> </td> <td> U+022EB </td> <td> <span>&#8939;</span> </td> <tr><td> <code title="">NotRightTriangleEqual;</code> </td> <td> U+022ED </td> <td> <span>&#8941;</span> </td> <tr><td> <code title="">NotSquareSubsetEqual;</code> </td> <td> U+022E2 </td> <td> <span>&#8930;</span> </td> <tr><td> <code title="">NotSquareSupersetEqual;</code> </td> <td> U+022E3 </td> <td> <span>&#8931;</span> </td> <tr><td> <code title="">NotSubsetEqual;</code> </td> <td> U+02288 </td> <td> <span>&#8840;</span> </td> <tr><td> <code title="">NotSucceeds;</code> </td> <td> U+02281 </td> <td> <span>&#8833;</span> </td> <tr><td> <code title="">NotSucceedsSlantEqual;</code> </td> <td> U+022E1 </td> <td> <span>&#8929;</span> </td> <tr><td> <code title="">NotSupersetEqual;</code> </td> <td> U+02289 </td> <td> <span>&#8841;</span> </td> <tr><td> <code title="">NotTilde;</code> </td> <td> U+02241 </td> <td> <span>&#8769;</span> </td> <tr><td> <code title="">NotTildeEqual;</code> </td> <td> U+02244 </td> <td> <span>&#8772;</span> </td> <tr><td> <code title="">NotTildeFullEqual;</code> </td> <td> U+02247 </td> <td> <span>&#8775;</span> </td> <tr><td> <code title="">NotTildeTilde;</code> </td> <td> U+02249 </td> <td> <span>&#8777;</span> </td> <tr><td> <code title="">NotVerticalBar;</code> </td> <td> U+02224 </td> <td> <span>&#8740;</span> </td> <tr><td> <code title="">Nscr;</code> </td> <td> U+1D4A9 </td> <td> <span>&#119977;</span> </td> <tr><td> <code title="">Ntilde;</code> </td> <td> U+000D1 </td> <td> <span>&Ntilde;</span> </td> <tr class=impl><td> <code title="">Ntilde</code> </td> <td> U+000D1 </td> <td> <span title="">&Ntilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Nu;</code> </td> <td> U+0039D </td> <td> <span>&Nu;</span> </td> <tr><td> <code title="">OElig;</code> </td> <td> U+00152 </td> <td> <span>&OElig;</span> </td> <tr><td> <code title="">Oacute;</code> </td> <td> U+000D3 </td> <td> <span>&Oacute;</span> </td> <tr class=impl><td> <code title="">Oacute</code> </td> <td> U+000D3 </td> <td> <span title="">&Oacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ocirc;</code> </td> <td> U+000D4 </td> <td> <span>&Ocirc;</span> </td> <tr class=impl><td> <code title="">Ocirc</code> </td> <td> U+000D4 </td> <td> <span title="">&Ocirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ocy;</code> </td> <td> U+0041E </td> <td> <span>&#1054;</span> </td> <tr><td> <code title="">Odblac;</code> </td> <td> U+00150 </td> <td> <span>&#336;</span> </td> <tr><td> <code title="">Ofr;</code> </td> <td> U+1D512 </td> <td> <span>&#120082;</span> </td> <tr><td> <code title="">Ograve;</code> </td> <td> U+000D2 </td> <td> <span>&Ograve;</span> </td> <tr class=impl><td> <code title="">Ograve</code> </td> <td> U+000D2 </td> <td> <span title="">&Ograve;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Omacr;</code> </td> <td> U+0014C </td> <td> <span>&#332;</span> </td> <tr><td> <code title="">Omega;</code> </td> <td> U+003A9 </td> <td> <span>&Omega;</span> </td> <tr><td> <code title="">Omicron;</code> </td> <td> U+0039F </td> <td> <span>&Omicron;</span> </td> <tr><td> <code title="">Oopf;</code> </td> <td> U+1D546 </td> <td> <span>&#120134;</span> </td> <tr><td> <code title="">OpenCurlyDoubleQuote;</code> </td> <td> U+0201C </td> <td> <span>&ldquo;</span> </td> <tr><td> <code title="">OpenCurlyQuote;</code> </td> <td> U+02018 </td> <td> <span>&lsquo;</span> </td> <tr><td> <code title="">Or;</code> </td> <td> U+02A54 </td> <td> <span>&#10836;</span> </td> <tr><td> <code title="">Oscr;</code> </td> <td> U+1D4AA </td> <td> <span>&#119978;</span> </td> <tr><td> <code title="">Oslash;</code> </td> <td> U+000D8 </td> <td> <span>&Oslash;</span> </td> <tr class=impl><td> <code title="">Oslash</code> </td> <td> U+000D8 </td> <td> <span title="">&Oslash;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Otilde;</code> </td> <td> U+000D5 </td> <td> <span>&Otilde;</span> </td> <tr class=impl><td> <code title="">Otilde</code> </td> <td> U+000D5 </td> <td> <span title="">&Otilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Otimes;</code> </td> <td> U+02A37 </td> <td> <span>&#10807;</span> </td> <tr><td> <code title="">Ouml;</code> </td> <td> U+000D6 </td> <td> <span>&Ouml;</span> </td> <tr class=impl><td> <code title="">Ouml</code> </td> <td> U+000D6 </td> <td> <span title="">&Ouml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">OverBar;</code> </td> <td> U+0203E </td> <td> <span>&oline;</span> </td> <tr><td> <code title="">OverBrace;</code> </td> <td> U+023DE </td> <td> <span>&#9182;</span> </td> <tr><td> <code title="">OverBracket;</code> </td> <td> U+023B4 </td> <td> <span>&#9140;</span> </td> <tr><td> <code title="">OverParenthesis;</code> </td> <td> U+023DC </td> <td> <span>&#9180;</span> </td> <tr><td> <code title="">PartialD;</code> </td> <td> U+02202 </td> <td> <span>&part;</span> </td> <tr><td> <code title="">Pcy;</code> </td> <td> U+0041F </td> <td> <span>&#1055;</span> </td> <tr><td> <code title="">Pfr;</code> </td> <td> U+1D513 </td> <td> <span>&#120083;</span> </td> <tr><td> <code title="">Phi;</code> </td> <td> U+003A6 </td> <td> <span>&Phi;</span> </td> <tr><td> <code title="">Pi;</code> </td> <td> U+003A0 </td> <td> <span>&Pi;</span> </td> <tr><td> <code title="">PlusMinus;</code> </td> <td> U+000B1 </td> <td> <span>&plusmn;</span> </td> <tr><td> <code title="">Poincareplane;</code> </td> <td> U+0210C </td> <td> <span>&#8460;</span> </td> <tr><td> <code title="">Popf;</code> </td> <td> U+02119 </td> <td> <span>&#8473;</span> </td> <tr><td> <code title="">Pr;</code> </td> <td> U+02ABB </td> <td> <span>&#10939;</span> </td> <tr><td> <code title="">Precedes;</code> </td> <td> U+0227A </td> <td> <span>&#8826;</span> </td> <tr><td> <code title="">PrecedesEqual;</code> </td> <td> U+02AAF </td> <td> <span>&#10927;</span> </td> <tr><td> <code title="">PrecedesSlantEqual;</code> </td> <td> U+0227C </td> <td> <span>&#8828;</span> </td> <tr><td> <code title="">PrecedesTilde;</code> </td> <td> U+0227E </td> <td> <span>&#8830;</span> </td> <tr><td> <code title="">Prime;</code> </td> <td> U+02033 </td> <td> <span>&Prime;</span> </td> <tr><td> <code title="">Product;</code> </td> <td> U+0220F </td> <td> <span>&prod;</span> </td> <tr><td> <code title="">Proportion;</code> </td> <td> U+02237 </td> <td> <span>&#8759;</span> </td> <tr><td> <code title="">Proportional;</code> </td> <td> U+0221D </td> <td> <span>&prop;</span> </td> <tr><td> <code title="">Pscr;</code> </td> <td> U+1D4AB </td> <td> <span>&#119979;</span> </td> <tr><td> <code title="">Psi;</code> </td> <td> U+003A8 </td> <td> <span>&Psi;</span> </td> <tr><td> <code title="">QUOT;</code> </td> <td> U+00022 </td> <td> <span>"</span> </td> <tr class=impl><td> <code title="">QUOT</code> </td> <td> U+00022 </td> <td> <span title="">"</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Qfr;</code> </td> <td> U+1D514 </td> <td> <span>&#120084;</span> </td> <tr><td> <code title="">Qopf;</code> </td> <td> U+0211A </td> <td> <span>&#8474;</span> </td> <tr><td> <code title="">Qscr;</code> </td> <td> U+1D4AC </td> <td> <span>&#119980;</span> </td> <tr><td> <code title="">RBarr;</code> </td> <td> U+02910 </td> <td> <span>&#10512;</span> </td> <tr><td> <code title="">REG;</code> </td> <td> U+000AE </td> <td> <span>&reg;</span> </td> <tr class=impl><td> <code title="">REG</code> </td> <td> U+000AE </td> <td> <span title="">&reg;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Racute;</code> </td> <td> U+00154 </td> <td> <span>&#340;</span> </td> <tr><td> <code title="">Rang;</code> </td> <td> U+027EB </td> <td> <span>&#10219;</span> </td> <tr><td> <code title="">Rarr;</code> </td> <td> U+021A0 </td> <td> <span>&#8608;</span> </td> <tr><td> <code title="">Rarrtl;</code> </td> <td> U+02916 </td> <td> <span>&#10518;</span> </td> <tr><td> <code title="">Rcaron;</code> </td> <td> U+00158 </td> <td> <span>&#344;</span> </td> <tr><td> <code title="">Rcedil;</code> </td> <td> U+00156 </td> <td> <span>&#342;</span> </td> <tr><td> <code title="">Rcy;</code> </td> <td> U+00420 </td> <td> <span>&#1056;</span> </td> <tr><td> <code title="">Re;</code> </td> <td> U+0211C </td> <td> <span>&real;</span> </td> <tr><td> <code title="">ReverseElement;</code> </td> <td> U+0220B </td> <td> <span>&ni;</span> </td> <tr><td> <code title="">ReverseEquilibrium;</code> </td> <td> U+021CB </td> <td> <span>&#8651;</span> </td> <tr><td> <code title="">ReverseUpEquilibrium;</code> </td> <td> U+0296F </td> <td> <span>&#10607;</span> </td> <tr><td> <code title="">Rfr;</code> </td> <td> U+0211C </td> <td> <span>&real;</span> </td> <tr><td> <code title="">Rho;</code> </td> <td> U+003A1 </td> <td> <span>&Rho;</span> </td> <tr><td> <code title="">RightAngleBracket;</code> </td> <td> U+027E9 </td> <td> <span>&rang;</span> </td> <tr><td> <code title="">RightArrow;</code> </td> <td> U+02192 </td> <td> <span>&rarr;</span> </td> <tr><td> <code title="">RightArrowBar;</code> </td> <td> U+021E5 </td> <td> <span>&#8677;</span> </td> <tr><td> <code title="">RightArrowLeftArrow;</code> </td> <td> U+021C4 </td> <td> <span>&#8644;</span> </td> <tr><td> <code title="">RightCeiling;</code> </td> <td> U+02309 </td> <td> <span>&rceil;</span> </td> <tr><td> <code title="">RightDoubleBracket;</code> </td> <td> U+027E7 </td> <td> <span>&#10215;</span> </td> <tr><td> <code title="">RightDownTeeVector;</code> </td> <td> U+0295D </td> <td> <span>&#10589;</span> </td> <tr><td> <code title="">RightDownVector;</code> </td> <td> U+021C2 </td> <td> <span>&#8642;</span> </td> <tr><td> <code title="">RightDownVectorBar;</code> </td> <td> U+02955 </td> <td> <span>&#10581;</span> </td> <tr><td> <code title="">RightFloor;</code> </td> <td> U+0230B </td> <td> <span>&rfloor;</span> </td> <tr><td> <code title="">RightTee;</code> </td> <td> U+022A2 </td> <td> <span>&#8866;</span> </td> <tr><td> <code title="">RightTeeArrow;</code> </td> <td> U+021A6 </td> <td> <span>&#8614;</span> </td> <tr><td> <code title="">RightTeeVector;</code> </td> <td> U+0295B </td> <td> <span>&#10587;</span> </td> <tr><td> <code title="">RightTriangle;</code> </td> <td> U+022B3 </td> <td> <span>&#8883;</span> </td> <tr><td> <code title="">RightTriangleBar;</code> </td> <td> U+029D0 </td> <td> <span>&#10704;</span> </td> <tr><td> <code title="">RightTriangleEqual;</code> </td> <td> U+022B5 </td> <td> <span>&#8885;</span> </td> <tr><td> <code title="">RightUpDownVector;</code> </td> <td> U+0294F </td> <td> <span>&#10575;</span> </td> <tr><td> <code title="">RightUpTeeVector;</code> </td> <td> U+0295C </td> <td> <span>&#10588;</span> </td> <tr><td> <code title="">RightUpVector;</code> </td> <td> U+021BE </td> <td> <span>&#8638;</span> </td> <tr><td> <code title="">RightUpVectorBar;</code> </td> <td> U+02954 </td> <td> <span>&#10580;</span> </td> <tr><td> <code title="">RightVector;</code> </td> <td> U+021C0 </td> <td> <span>&#8640;</span> </td> <tr><td> <code title="">RightVectorBar;</code> </td> <td> U+02953 </td> <td> <span>&#10579;</span> </td> <tr><td> <code title="">Rightarrow;</code> </td> <td> U+021D2 </td> <td> <span>&rArr;</span> </td> <tr><td> <code title="">Ropf;</code> </td> <td> U+0211D </td> <td> <span>&#8477;</span> </td> <tr><td> <code title="">RoundImplies;</code> </td> <td> U+02970 </td> <td> <span>&#10608;</span> </td> <tr><td> <code title="">Rrightarrow;</code> </td> <td> U+021DB </td> <td> <span>&#8667;</span> </td> <tr><td> <code title="">Rscr;</code> </td> <td> U+0211B </td> <td> <span>&#8475;</span> </td> <tr><td> <code title="">Rsh;</code> </td> <td> U+021B1 </td> <td> <span>&#8625;</span> </td> <tr><td> <code title="">RuleDelayed;</code> </td> <td> U+029F4 </td> <td> <span>&#10740;</span> </td> <tr><td> <code title="">SHCHcy;</code> </td> <td> U+00429 </td> <td> <span>&#1065;</span> </td> <tr><td> <code title="">SHcy;</code> </td> <td> U+00428 </td> <td> <span>&#1064;</span> </td> <tr><td> <code title="">SOFTcy;</code> </td> <td> U+0042C </td> <td> <span>&#1068;</span> </td> <tr><td> <code title="">Sacute;</code> </td> <td> U+0015A </td> <td> <span>&#346;</span> </td> <tr><td> <code title="">Sc;</code> </td> <td> U+02ABC </td> <td> <span>&#10940;</span> </td> <tr><td> <code title="">Scaron;</code> </td> <td> U+00160 </td> <td> <span>&Scaron;</span> </td> <tr><td> <code title="">Scedil;</code> </td> <td> U+0015E </td> <td> <span>&#350;</span> </td> <tr><td> <code title="">Scirc;</code> </td> <td> U+0015C </td> <td> <span>&#348;</span> </td> <tr><td> <code title="">Scy;</code> </td> <td> U+00421 </td> <td> <span>&#1057;</span> </td> <tr><td> <code title="">Sfr;</code> </td> <td> U+1D516 </td> <td> <span>&#120086;</span> </td> <tr><td> <code title="">ShortDownArrow;</code> </td> <td> U+02193 </td> <td> <span>&darr;</span> </td> <tr><td> <code title="">ShortLeftArrow;</code> </td> <td> U+02190 </td> <td> <span>&larr;</span> </td> <tr><td> <code title="">ShortRightArrow;</code> </td> <td> U+02192 </td> <td> <span>&rarr;</span> </td> <tr><td> <code title="">ShortUpArrow;</code> </td> <td> U+02191 </td> <td> <span>&uarr;</span> </td> <tr><td> <code title="">Sigma;</code> </td> <td> U+003A3 </td> <td> <span>&Sigma;</span> </td> <tr><td> <code title="">SmallCircle;</code> </td> <td> U+02218 </td> <td> <span>&#8728;</span> </td> <tr><td> <code title="">Sopf;</code> </td> <td> U+1D54A </td> <td> <span>&#120138;</span> </td> <tr><td> <code title="">Sqrt;</code> </td> <td> U+0221A </td> <td> <span>&radic;</span> </td> <tr><td> <code title="">Square;</code> </td> <td> U+025A1 </td> <td> <span>&#9633;</span> </td> <tr><td> <code title="">SquareIntersection;</code> </td> <td> U+02293 </td> <td> <span>&#8851;</span> </td> <tr><td> <code title="">SquareSubset;</code> </td> <td> U+0228F </td> <td> <span>&#8847;</span> </td> <tr><td> <code title="">SquareSubsetEqual;</code> </td> <td> U+02291 </td> <td> <span>&#8849;</span> </td> <tr><td> <code title="">SquareSuperset;</code> </td> <td> U+02290 </td> <td> <span>&#8848;</span> </td> <tr><td> <code title="">SquareSupersetEqual;</code> </td> <td> U+02292 </td> <td> <span>&#8850;</span> </td> <tr><td> <code title="">SquareUnion;</code> </td> <td> U+02294 </td> <td> <span>&#8852;</span> </td> <tr><td> <code title="">Sscr;</code> </td> <td> U+1D4AE </td> <td> <span>&#119982;</span> </td> <tr><td> <code title="">Star;</code> </td> <td> U+022C6 </td> <td> <span>&#8902;</span> </td> <tr><td> <code title="">Sub;</code> </td> <td> U+022D0 </td> <td> <span>&#8912;</span> </td> <tr><td> <code title="">Subset;</code> </td> <td> U+022D0 </td> <td> <span>&#8912;</span> </td> <tr><td> <code title="">SubsetEqual;</code> </td> <td> U+02286 </td> <td> <span>&sube;</span> </td> <tr><td> <code title="">Succeeds;</code> </td> <td> U+0227B </td> <td> <span>&#8827;</span> </td> <tr><td> <code title="">SucceedsEqual;</code> </td> <td> U+02AB0 </td> <td> <span>&#10928;</span> </td> <tr><td> <code title="">SucceedsSlantEqual;</code> </td> <td> U+0227D </td> <td> <span>&#8829;</span> </td> <tr><td> <code title="">SucceedsTilde;</code> </td> <td> U+0227F </td> <td> <span>&#8831;</span> </td> <tr><td> <code title="">SuchThat;</code> </td> <td> U+0220B </td> <td> <span>&ni;</span> </td> <tr><td> <code title="">Sum;</code> </td> <td> U+02211 </td> <td> <span>&sum;</span> </td> <tr><td> <code title="">Sup;</code> </td> <td> U+022D1 </td> <td> <span>&#8913;</span> </td> <tr><td> <code title="">Superset;</code> </td> <td> U+02283 </td> <td> <span>&sup;</span> </td> <tr><td> <code title="">SupersetEqual;</code> </td> <td> U+02287 </td> <td> <span>&supe;</span> </td> <tr><td> <code title="">Supset;</code> </td> <td> U+022D1 </td> <td> <span>&#8913;</span> </td> <tr><td> <code title="">THORN;</code> </td> <td> U+000DE </td> <td> <span>&THORN;</span> </td> <tr class=impl><td> <code title="">THORN</code> </td> <td> U+000DE </td> <td> <span title="">&THORN;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">TRADE;</code> </td> <td> U+02122 </td> <td> <span>&trade;</span> </td> <tr><td> <code title="">TSHcy;</code> </td> <td> U+0040B </td> <td> <span>&#1035;</span> </td> <tr><td> <code title="">TScy;</code> </td> <td> U+00426 </td> <td> <span>&#1062;</span> </td> <tr><td> <code title="">Tab;</code> </td> <td> U+00009 </td> <td> <span> </span> </td> <tr><td> <code title="">Tau;</code> </td> <td> U+003A4 </td> <td> <span>&Tau;</span> </td> <tr><td> <code title="">Tcaron;</code> </td> <td> U+00164 </td> <td> <span>&#356;</span> </td> <tr><td> <code title="">Tcedil;</code> </td> <td> U+00162 </td> <td> <span>&#354;</span> </td> <tr><td> <code title="">Tcy;</code> </td> <td> U+00422 </td> <td> <span>&#1058;</span> </td> <tr><td> <code title="">Tfr;</code> </td> <td> U+1D517 </td> <td> <span>&#120087;</span> </td> <tr><td> <code title="">Therefore;</code> </td> <td> U+02234 </td> <td> <span>&there4;</span> </td> <tr><td> <code title="">Theta;</code> </td> <td> U+00398 </td> <td> <span>&Theta;</span> </td> <tr><td> <code title="">ThinSpace;</code> </td> <td> U+02009 </td> <td> <span>&thinsp;</span> </td> <tr><td> <code title="">Tilde;</code> </td> <td> U+0223C </td> <td> <span>&sim;</span> </td> <tr><td> <code title="">TildeEqual;</code> </td> <td> U+02243 </td> <td> <span>&#8771;</span> </td> <tr><td> <code title="">TildeFullEqual;</code> </td> <td> U+02245 </td> <td> <span>&cong;</span> </td> <tr><td> <code title="">TildeTilde;</code> </td> <td> U+02248 </td> <td> <span>&asymp;</span> </td> <tr><td> <code title="">Topf;</code> </td> <td> U+1D54B </td> <td> <span>&#120139;</span> </td> <tr><td> <code title="">TripleDot;</code> </td> <td> U+020DB </td> <td> <span>&#9676;&#8411;</span> </td> <tr><td> <code title="">Tscr;</code> </td> <td> U+1D4AF </td> <td> <span>&#119983;</span> </td> <tr><td> <code title="">Tstrok;</code> </td> <td> U+00166 </td> <td> <span>&#358;</span> </td> <tr><td> <code title="">Uacute;</code> </td> <td> U+000DA </td> <td> <span>&Uacute;</span> </td> <tr class=impl><td> <code title="">Uacute</code> </td> <td> U+000DA </td> <td> <span title="">&Uacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Uarr;</code> </td> <td> U+0219F </td> <td> <span>&#8607;</span> </td> <tr><td> <code title="">Uarrocir;</code> </td> <td> U+02949 </td> <td> <span>&#10569;</span> </td> <tr><td> <code title="">Ubrcy;</code> </td> <td> U+0040E </td> <td> <span>&#1038;</span> </td> <tr><td> <code title="">Ubreve;</code> </td> <td> U+0016C </td> <td> <span>&#364;</span> </td> <tr><td> <code title="">Ucirc;</code> </td> <td> U+000DB </td> <td> <span>&Ucirc;</span> </td> <tr class=impl><td> <code title="">Ucirc</code> </td> <td> U+000DB </td> <td> <span title="">&Ucirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ucy;</code> </td> <td> U+00423 </td> <td> <span>&#1059;</span> </td> <tr><td> <code title="">Udblac;</code> </td> <td> U+00170 </td> <td> <span>&#368;</span> </td> <tr><td> <code title="">Ufr;</code> </td> <td> U+1D518 </td> <td> <span>&#120088;</span> </td> <tr><td> <code title="">Ugrave;</code> </td> <td> U+000D9 </td> <td> <span>&Ugrave;</span> </td> <tr class=impl><td> <code title="">Ugrave</code> </td> <td> U+000D9 </td> <td> <span title="">&Ugrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Umacr;</code> </td> <td> U+0016A </td> <td> <span>&#362;</span> </td> <tr><td> <code title="">UnderBar;</code> </td> <td> U+0005F </td> <td> <span>_</span> </td> <tr><td> <code title="">UnderBrace;</code> </td> <td> U+023DF </td> <td> <span>&#9183;</span> </td> <tr><td> <code title="">UnderBracket;</code> </td> <td> U+023B5 </td> <td> <span>&#9141;</span> </td> <tr><td> <code title="">UnderParenthesis;</code> </td> <td> U+023DD </td> <td> <span>&#9181;</span> </td> <tr><td> <code title="">Union;</code> </td> <td> U+022C3 </td> <td> <span>&#8899;</span> </td> <tr><td> <code title="">UnionPlus;</code> </td> <td> U+0228E </td> <td> <span>&#8846;</span> </td> <tr><td> <code title="">Uogon;</code> </td> <td> U+00172 </td> <td> <span>&#370;</span> </td> <tr><td> <code title="">Uopf;</code> </td> <td> U+1D54C </td> <td> <span>&#120140;</span> </td> <tr><td> <code title="">UpArrow;</code> </td> <td> U+02191 </td> <td> <span>&uarr;</span> </td> <tr><td> <code title="">UpArrowBar;</code> </td> <td> U+02912 </td> <td> <span>&#10514;</span> </td> <tr><td> <code title="">UpArrowDownArrow;</code> </td> <td> U+021C5 </td> <td> <span>&#8645;</span> </td> <tr><td> <code title="">UpDownArrow;</code> </td> <td> U+02195 </td> <td> <span>&#8597;</span> </td> <tr><td> <code title="">UpEquilibrium;</code> </td> <td> U+0296E </td> <td> <span>&#10606;</span> </td> <tr><td> <code title="">UpTee;</code> </td> <td> U+022A5 </td> <td> <span>&perp;</span> </td> <tr><td> <code title="">UpTeeArrow;</code> </td> <td> U+021A5 </td> <td> <span>&#8613;</span> </td> <tr><td> <code title="">Uparrow;</code> </td> <td> U+021D1 </td> <td> <span>&uArr;</span> </td> <tr><td> <code title="">Updownarrow;</code> </td> <td> U+021D5 </td> <td> <span>&#8661;</span> </td> <tr><td> <code title="">UpperLeftArrow;</code> </td> <td> U+02196 </td> <td> <span>&#8598;</span> </td> <tr><td> <code title="">UpperRightArrow;</code> </td> <td> U+02197 </td> <td> <span>&#8599;</span> </td> <tr><td> <code title="">Upsi;</code> </td> <td> U+003D2 </td> <td> <span>&upsih;</span> </td> <tr><td> <code title="">Upsilon;</code> </td> <td> U+003A5 </td> <td> <span>&Upsilon;</span> </td> <tr><td> <code title="">Uring;</code> </td> <td> U+0016E </td> <td> <span>&#366;</span> </td> <tr><td> <code title="">Uscr;</code> </td> <td> U+1D4B0 </td> <td> <span>&#119984;</span> </td> <tr><td> <code title="">Utilde;</code> </td> <td> U+00168 </td> <td> <span>&#360;</span> </td> <tr><td> <code title="">Uuml;</code> </td> <td> U+000DC </td> <td> <span>&Uuml;</span> </td> <tr class=impl><td> <code title="">Uuml</code> </td> <td> U+000DC </td> <td> <span title="">&Uuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">VDash;</code> </td> <td> U+022AB </td> <td> <span>&#8875;</span> </td> <tr><td> <code title="">Vbar;</code> </td> <td> U+02AEB </td> <td> <span>&#10987;</span> </td> <tr><td> <code title="">Vcy;</code> </td> <td> U+00412 </td> <td> <span>&#1042;</span> </td> <tr><td> <code title="">Vdash;</code> </td> <td> U+022A9 </td> <td> <span>&#8873;</span> </td> <tr><td> <code title="">Vdashl;</code> </td> <td> U+02AE6 </td> <td> <span>&#10982;</span> </td> <tr><td> <code title="">Vee;</code> </td> <td> U+022C1 </td> <td> <span>&#8897;</span> </td> <tr><td> <code title="">Verbar;</code> </td> <td> U+02016 </td> <td> <span>&#8214;</span> </td> <tr><td> <code title="">Vert;</code> </td> <td> U+02016 </td> <td> <span>&#8214;</span> </td> <tr><td> <code title="">VerticalBar;</code> </td> <td> U+02223 </td> <td> <span>&#8739;</span> </td> <tr><td> <code title="">VerticalLine;</code> </td> <td> U+0007C </td> <td> <span>|</span> </td> <tr><td> <code title="">VerticalSeparator;</code> </td> <td> U+02758 </td> <td> <span>&#10072;</span> </td> <tr><td> <code title="">VerticalTilde;</code> </td> <td> U+02240 </td> <td> <span>&#8768;</span> </td> <tr><td> <code title="">VeryThinSpace;</code> </td> <td> U+0200A </td> <td> <span>&#8202;</span> </td> <tr><td> <code title="">Vfr;</code> </td> <td> U+1D519 </td> <td> <span>&#120089;</span> </td> <tr><td> <code title="">Vopf;</code> </td> <td> U+1D54D </td> <td> <span>&#120141;</span> </td> <tr><td> <code title="">Vscr;</code> </td> <td> U+1D4B1 </td> <td> <span>&#119985;</span> </td> <tr><td> <code title="">Vvdash;</code> </td> <td> U+022AA </td> <td> <span>&#8874;</span> </td> <tr><td> <code title="">Wcirc;</code> </td> <td> U+00174 </td> <td> <span>&#372;</span> </td> <tr><td> <code title="">Wedge;</code> </td> <td> U+022C0 </td> <td> <span>&#8896;</span> </td> <tr><td> <code title="">Wfr;</code> </td> <td> U+1D51A </td> <td> <span>&#120090;</span> </td> <tr><td> <code title="">Wopf;</code> </td> <td> U+1D54E </td> <td> <span>&#120142;</span> </td> <tr><td> <code title="">Wscr;</code> </td> <td> U+1D4B2 </td> <td> <span>&#119986;</span> </td> <tr><td> <code title="">Xfr;</code> </td> <td> U+1D51B </td> <td> <span>&#120091;</span> </td> <tr><td> <code title="">Xi;</code> </td> <td> U+0039E </td> <td> <span>&Xi;</span> </td> <tr><td> <code title="">Xopf;</code> </td> <td> U+1D54F </td> <td> <span>&#120143;</span> </td> <tr><td> <code title="">Xscr;</code> </td> <td> U+1D4B3 </td> <td> <span>&#119987;</span> </td> <tr><td> <code title="">YAcy;</code> </td> <td> U+0042F </td> <td> <span>&#1071;</span> </td> <tr><td> <code title="">YIcy;</code> </td> <td> U+00407 </td> <td> <span>&#1031;</span> </td> <tr><td> <code title="">YUcy;</code> </td> <td> U+0042E </td> <td> <span>&#1070;</span> </td> <tr><td> <code title="">Yacute;</code> </td> <td> U+000DD </td> <td> <span>&Yacute;</span> </td> <tr class=impl><td> <code title="">Yacute</code> </td> <td> U+000DD </td> <td> <span title="">&Yacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ycirc;</code> </td> <td> U+00176 </td> <td> <span>&#374;</span> </td> <tr><td> <code title="">Ycy;</code> </td> <td> U+0042B </td> <td> <span>&#1067;</span> </td> <tr><td> <code title="">Yfr;</code> </td> <td> U+1D51C </td> <td> <span>&#120092;</span> </td> <tr><td> <code title="">Yopf;</code> </td> <td> U+1D550 </td> <td> <span>&#120144;</span> </td> <tr><td> <code title="">Yscr;</code> </td> <td> U+1D4B4 </td> <td> <span>&#119988;</span> </td> <tr><td> <code title="">Yuml;</code> </td> <td> U+00178 </td> <td> <span>&Yuml;</span> </td> <tr><td> <code title="">ZHcy;</code> </td> <td> U+00416 </td> <td> <span>&#1046;</span> </td> <tr><td> <code title="">Zacute;</code> </td> <td> U+00179 </td> <td> <span>&#377;</span> </td> <tr><td> <code title="">Zcaron;</code> </td> <td> U+0017D </td> <td> <span>&#381;</span> </td> <tr><td> <code title="">Zcy;</code> </td> <td> U+00417 </td> <td> <span>&#1047;</span> </td> <tr><td> <code title="">Zdot;</code> </td> <td> U+0017B </td> <td> <span>&#379;</span> </td> <tr><td> <code title="">ZeroWidthSpace;</code> </td> <td> U+0200B </td> <td> <span>&#8203;</span> </td> <tr><td> <code title="">Zeta;</code> </td> <td> U+00396 </td> <td> <span>&Zeta;</span> </td> <tr><td> <code title="">Zfr;</code> </td> <td> U+02128 </td> <td> <span>&#8488;</span> </td> <tr><td> <code title="">Zopf;</code> </td> <td> U+02124 </td> <td> <span>&#8484;</span> </td> <tr><td> <code title="">Zscr;</code> </td> <td> U+1D4B5 </td> <td> <span>&#119989;</span> </td> <tr><td> <code title="">aacute;</code> </td> <td> U+000E1 </td> <td> <span>&aacute;</span> </td> <tr class=impl><td> <code title="">aacute</code> </td> <td> U+000E1 </td> <td> <span title="">&aacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">abreve;</code> </td> <td> U+00103 </td> <td> <span>&#259;</span> </td> <tr><td> <code title="">ac;</code> </td> <td> U+0223E </td> <td> <span>&#8766;</span> </td> <tr><td> <code title="">acd;</code> </td> <td> U+0223F </td> <td> <span>&#8767;</span> </td> <tr><td> <code title="">acirc;</code> </td> <td> U+000E2 </td> <td> <span>&acirc;</span> </td> <tr class=impl><td> <code title="">acirc</code> </td> <td> U+000E2 </td> <td> <span title="">&acirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">acute;</code> </td> <td> U+000B4 </td> <td> <span>&acute;</span> </td> <tr class=impl><td> <code title="">acute</code> </td> <td> U+000B4 </td> <td> <span title="">&acute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">acy;</code> </td> <td> U+00430 </td> <td> <span>&#1072;</span> </td> <tr><td> <code title="">aelig;</code> </td> <td> U+000E6 </td> <td> <span>&aelig;</span> </td> <tr class=impl><td> <code title="">aelig</code> </td> <td> U+000E6 </td> <td> <span title="">&aelig;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">af;</code> </td> <td> U+02061 </td> <td> <span>&#8289;</span> </td> <tr><td> <code title="">afr;</code> </td> <td> U+1D51E </td> <td> <span>&#120094;</span> </td> <tr><td> <code title="">agrave;</code> </td> <td> U+000E0 </td> <td> <span>&agrave;</span> </td> <tr class=impl><td> <code title="">agrave</code> </td> <td> U+000E0 </td> <td> <span title="">&agrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">alefsym;</code> </td> <td> U+02135 </td> <td> <span>&alefsym;</span> </td> <tr><td> <code title="">aleph;</code> </td> <td> U+02135 </td> <td> <span>&alefsym;</span> </td> <tr><td> <code title="">alpha;</code> </td> <td> U+003B1 </td> <td> <span>&alpha;</span> </td> <tr><td> <code title="">amacr;</code> </td> <td> U+00101 </td> <td> <span>&#257;</span> </td> <tr><td> <code title="">amalg;</code> </td> <td> U+02A3F </td> <td> <span>&#10815;</span> </td> <tr><td> <code title="">amp;</code> </td> <td> U+00026 </td> <td> <span>&amp;</span> </td> <tr class=impl><td> <code title="">amp</code> </td> <td> U+00026 </td> <td> <span title="">&amp;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">and;</code> </td> <td> U+02227 </td> <td> <span>&and;</span> </td> <tr><td> <code title="">andand;</code> </td> <td> U+02A55 </td> <td> <span>&#10837;</span> </td> <tr><td> <code title="">andd;</code> </td> <td> U+02A5C </td> <td> <span>&#10844;</span> </td> <tr><td> <code title="">andslope;</code> </td> <td> U+02A58 </td> <td> <span>&#10840;</span> </td> <tr><td> <code title="">andv;</code> </td> <td> U+02A5A </td> <td> <span>&#10842;</span> </td> <tr><td> <code title="">ang;</code> </td> <td> U+02220 </td> <td> <span>&ang;</span> </td> <tr><td> <code title="">ange;</code> </td> <td> U+029A4 </td> <td> <span>&#10660;</span> </td> <tr><td> <code title="">angle;</code> </td> <td> U+02220 </td> <td> <span>&ang;</span> </td> <tr><td> <code title="">angmsd;</code> </td> <td> U+02221 </td> <td> <span>&#8737;</span> </td> <tr><td> <code title="">angmsdaa;</code> </td> <td> U+029A8 </td> <td> <span>&#10664;</span> </td> <tr><td> <code title="">angmsdab;</code> </td> <td> U+029A9 </td> <td> <span>&#10665;</span> </td> <tr><td> <code title="">angmsdac;</code> </td> <td> U+029AA </td> <td> <span>&#10666;</span> </td> <tr><td> <code title="">angmsdad;</code> </td> <td> U+029AB </td> <td> <span>&#10667;</span> </td> <tr><td> <code title="">angmsdae;</code> </td> <td> U+029AC </td> <td> <span>&#10668;</span> </td> <tr><td> <code title="">angmsdaf;</code> </td> <td> U+029AD </td> <td> <span>&#10669;</span> </td> <tr><td> <code title="">angmsdag;</code> </td> <td> U+029AE </td> <td> <span>&#10670;</span> </td> <tr><td> <code title="">angmsdah;</code> </td> <td> U+029AF </td> <td> <span>&#10671;</span> </td> <tr><td> <code title="">angrt;</code> </td> <td> U+0221F </td> <td> <span>&#8735;</span> </td> <tr><td> <code title="">angrtvb;</code> </td> <td> U+022BE </td> <td> <span>&#8894;</span> </td> <tr><td> <code title="">angrtvbd;</code> </td> <td> U+0299D </td> <td> <span>&#10653;</span> </td> <tr><td> <code title="">angsph;</code> </td> <td> U+02222 </td> <td> <span>&#8738;</span> </td> <tr><td> <code title="">angst;</code> </td> <td> U+000C5 </td> <td> <span>&Aring;</span> </td> <tr><td> <code title="">angzarr;</code> </td> <td> U+0237C </td> <td> <span>&#9084;</span> </td> <tr><td> <code title="">aogon;</code> </td> <td> U+00105 </td> <td> <span>&#261;</span> </td> <tr><td> <code title="">aopf;</code> </td> <td> U+1D552 </td> <td> <span>&#120146;</span> </td> <tr><td> <code title="">ap;</code> </td> <td> U+02248 </td> <td> <span>&asymp;</span> </td> <tr><td> <code title="">apE;</code> </td> <td> U+02A70 </td> <td> <span>&#10864;</span> </td> <tr><td> <code title="">apacir;</code> </td> <td> U+02A6F </td> <td> <span>&#10863;</span> </td> <tr><td> <code title="">ape;</code> </td> <td> U+0224A </td> <td> <span>&#8778;</span> </td> <tr><td> <code title="">apid;</code> </td> <td> U+0224B </td> <td> <span>&#8779;</span> </td> <tr><td> <code title="">apos;</code> </td> <td> U+00027 </td> <td> <span>'</span> </td> <tr><td> <code title="">approx;</code> </td> <td> U+02248 </td> <td> <span>&asymp;</span> </td> <tr><td> <code title="">approxeq;</code> </td> <td> U+0224A </td> <td> <span>&#8778;</span> </td> <tr><td> <code title="">aring;</code> </td> <td> U+000E5 </td> <td> <span>&aring;</span> </td> <tr class=impl><td> <code title="">aring</code> </td> <td> U+000E5 </td> <td> <span title="">&aring;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ascr;</code> </td> <td> U+1D4B6 </td> <td> <span>&#119990;</span> </td> <tr><td> <code title="">ast;</code> </td> <td> U+0002A </td> <td> <span>*</span> </td> <tr><td> <code title="">asymp;</code> </td> <td> U+02248 </td> <td> <span>&asymp;</span> </td> <tr><td> <code title="">asympeq;</code> </td> <td> U+0224D </td> <td> <span>&#8781;</span> </td> <tr><td> <code title="">atilde;</code> </td> <td> U+000E3 </td> <td> <span>&atilde;</span> </td> <tr class=impl><td> <code title="">atilde</code> </td> <td> U+000E3 </td> <td> <span title="">&atilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">auml;</code> </td> <td> U+000E4 </td> <td> <span>&auml;</span> </td> <tr class=impl><td> <code title="">auml</code> </td> <td> U+000E4 </td> <td> <span title="">&auml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">awconint;</code> </td> <td> U+02233 </td> <td> <span>&#8755;</span> </td> <tr><td> <code title="">awint;</code> </td> <td> U+02A11 </td> <td> <span>&#10769;</span> </td> <tr><td> <code title="">bNot;</code> </td> <td> U+02AED </td> <td> <span>&#10989;</span> </td> <tr><td> <code title="">backcong;</code> </td> <td> U+0224C </td> <td> <span>&#8780;</span> </td> <tr><td> <code title="">backepsilon;</code> </td> <td> U+003F6 </td> <td> <span>&#1014;</span> </td> <tr><td> <code title="">backprime;</code> </td> <td> U+02035 </td> <td> <span>&#8245;</span> </td> <tr><td> <code title="">backsim;</code> </td> <td> U+0223D </td> <td> <span>&#8765;</span> </td> <tr><td> <code title="">backsimeq;</code> </td> <td> U+022CD </td> <td> <span>&#8909;</span> </td> <tr><td> <code title="">barvee;</code> </td> <td> U+022BD </td> <td> <span>&#8893;</span> </td> <tr><td> <code title="">barwed;</code> </td> <td> U+02305 </td> <td> <span>&#8965;</span> </td> <tr><td> <code title="">barwedge;</code> </td> <td> U+02305 </td> <td> <span>&#8965;</span> </td> <tr><td> <code title="">bbrk;</code> </td> <td> U+023B5 </td> <td> <span>&#9141;</span> </td> <tr><td> <code title="">bbrktbrk;</code> </td> <td> U+023B6 </td> <td> <span>&#9142;</span> </td> <tr><td> <code title="">bcong;</code> </td> <td> U+0224C </td> <td> <span>&#8780;</span> </td> <tr><td> <code title="">bcy;</code> </td> <td> U+00431 </td> <td> <span>&#1073;</span> </td> <tr><td> <code title="">bdquo;</code> </td> <td> U+0201E </td> <td> <span>&bdquo;</span> </td> <tr><td> <code title="">becaus;</code> </td> <td> U+02235 </td> <td> <span>&#8757;</span> </td> <tr><td> <code title="">because;</code> </td> <td> U+02235 </td> <td> <span>&#8757;</span> </td> <tr><td> <code title="">bemptyv;</code> </td> <td> U+029B0 </td> <td> <span>&#10672;</span> </td> <tr><td> <code title="">bepsi;</code> </td> <td> U+003F6 </td> <td> <span>&#1014;</span> </td> <tr><td> <code title="">bernou;</code> </td> <td> U+0212C </td> <td> <span>&#8492;</span> </td> <tr><td> <code title="">beta;</code> </td> <td> U+003B2 </td> <td> <span>&beta;</span> </td> <tr><td> <code title="">beth;</code> </td> <td> U+02136 </td> <td> <span>&#8502;</span> </td> <tr><td> <code title="">between;</code> </td> <td> U+0226C </td> <td> <span>&#8812;</span> </td> <tr><td> <code title="">bfr;</code> </td> <td> U+1D51F </td> <td> <span>&#120095;</span> </td> <tr><td> <code title="">bigcap;</code> </td> <td> U+022C2 </td> <td> <span>&#8898;</span> </td> <tr><td> <code title="">bigcirc;</code> </td> <td> U+025EF </td> <td> <span>&#9711;</span> </td> <tr><td> <code title="">bigcup;</code> </td> <td> U+022C3 </td> <td> <span>&#8899;</span> </td> <tr><td> <code title="">bigodot;</code> </td> <td> U+02A00 </td> <td> <span>&#10752;</span> </td> <tr><td> <code title="">bigoplus;</code> </td> <td> U+02A01 </td> <td> <span>&#10753;</span> </td> <tr><td> <code title="">bigotimes;</code> </td> <td> U+02A02 </td> <td> <span>&#10754;</span> </td> <tr><td> <code title="">bigsqcup;</code> </td> <td> U+02A06 </td> <td> <span>&#10758;</span> </td> <tr><td> <code title="">bigstar;</code> </td> <td> U+02605 </td> <td> <span>&#9733;</span> </td> <tr><td> <code title="">bigtriangledown;</code> </td> <td> U+025BD </td> <td> <span>&#9661;</span> </td> <tr><td> <code title="">bigtriangleup;</code> </td> <td> U+025B3 </td> <td> <span>&#9651;</span> </td> <tr><td> <code title="">biguplus;</code> </td> <td> U+02A04 </td> <td> <span>&#10756;</span> </td> <tr><td> <code title="">bigvee;</code> </td> <td> U+022C1 </td> <td> <span>&#8897;</span> </td> <tr><td> <code title="">bigwedge;</code> </td> <td> U+022C0 </td> <td> <span>&#8896;</span> </td> <tr><td> <code title="">bkarow;</code> </td> <td> U+0290D </td> <td> <span>&#10509;</span> </td> <tr><td> <code title="">blacklozenge;</code> </td> <td> U+029EB </td> <td> <span>&#10731;</span> </td> <tr><td> <code title="">blacksquare;</code> </td> <td> U+025AA </td> <td> <span>&#9642;</span> </td> <tr><td> <code title="">blacktriangle;</code> </td> <td> U+025B4 </td> <td> <span>&#9652;</span> </td> <tr><td> <code title="">blacktriangledown;</code> </td> <td> U+025BE </td> <td> <span>&#9662;</span> </td> <tr><td> <code title="">blacktriangleleft;</code> </td> <td> U+025C2 </td> <td> <span>&#9666;</span> </td> <tr><td> <code title="">blacktriangleright;</code> </td> <td> U+025B8 </td> <td> <span>&#9656;</span> </td> <tr><td> <code title="">blank;</code> </td> <td> U+02423 </td> <td> <span>&#9251;</span> </td> <tr><td> <code title="">blk12;</code> </td> <td> U+02592 </td> <td> <span>&#9618;</span> </td> <tr><td> <code title="">blk14;</code> </td> <td> U+02591 </td> <td> <span>&#9617;</span> </td> <tr><td> <code title="">blk34;</code> </td> <td> U+02593 </td> <td> <span>&#9619;</span> </td> <tr><td> <code title="">block;</code> </td> <td> U+02588 </td> <td> <span>&#9608;</span> </td> <tr><td> <code title="">bnot;</code> </td> <td> U+02310 </td> <td> <span>&#8976;</span> </td> <tr><td> <code title="">bopf;</code> </td> <td> U+1D553 </td> <td> <span>&#120147;</span> </td> <tr><td> <code title="">bot;</code> </td> <td> U+022A5 </td> <td> <span>&perp;</span> </td> <tr><td> <code title="">bottom;</code> </td> <td> U+022A5 </td> <td> <span>&perp;</span> </td> <tr><td> <code title="">bowtie;</code> </td> <td> U+022C8 </td> <td> <span>&#8904;</span> </td> <tr><td> <code title="">boxDL;</code> </td> <td> U+02557 </td> <td> <span>&#9559;</span> </td> <tr><td> <code title="">boxDR;</code> </td> <td> U+02554 </td> <td> <span>&#9556;</span> </td> <tr><td> <code title="">boxDl;</code> </td> <td> U+02556 </td> <td> <span>&#9558;</span> </td> <tr><td> <code title="">boxDr;</code> </td> <td> U+02553 </td> <td> <span>&#9555;</span> </td> <tr><td> <code title="">boxH;</code> </td> <td> U+02550 </td> <td> <span>&#9552;</span> </td> <tr><td> <code title="">boxHD;</code> </td> <td> U+02566 </td> <td> <span>&#9574;</span> </td> <tr><td> <code title="">boxHU;</code> </td> <td> U+02569 </td> <td> <span>&#9577;</span> </td> <tr><td> <code title="">boxHd;</code> </td> <td> U+02564 </td> <td> <span>&#9572;</span> </td> <tr><td> <code title="">boxHu;</code> </td> <td> U+02567 </td> <td> <span>&#9575;</span> </td> <tr><td> <code title="">boxUL;</code> </td> <td> U+0255D </td> <td> <span>&#9565;</span> </td> <tr><td> <code title="">boxUR;</code> </td> <td> U+0255A </td> <td> <span>&#9562;</span> </td> <tr><td> <code title="">boxUl;</code> </td> <td> U+0255C </td> <td> <span>&#9564;</span> </td> <tr><td> <code title="">boxUr;</code> </td> <td> U+02559 </td> <td> <span>&#9561;</span> </td> <tr><td> <code title="">boxV;</code> </td> <td> U+02551 </td> <td> <span>&#9553;</span> </td> <tr><td> <code title="">boxVH;</code> </td> <td> U+0256C </td> <td> <span>&#9580;</span> </td> <tr><td> <code title="">boxVL;</code> </td> <td> U+02563 </td> <td> <span>&#9571;</span> </td> <tr><td> <code title="">boxVR;</code> </td> <td> U+02560 </td> <td> <span>&#9568;</span> </td> <tr><td> <code title="">boxVh;</code> </td> <td> U+0256B </td> <td> <span>&#9579;</span> </td> <tr><td> <code title="">boxVl;</code> </td> <td> U+02562 </td> <td> <span>&#9570;</span> </td> <tr><td> <code title="">boxVr;</code> </td> <td> U+0255F </td> <td> <span>&#9567;</span> </td> <tr><td> <code title="">boxbox;</code> </td> <td> U+029C9 </td> <td> <span>&#10697;</span> </td> <tr><td> <code title="">boxdL;</code> </td> <td> U+02555 </td> <td> <span>&#9557;</span> </td> <tr><td> <code title="">boxdR;</code> </td> <td> U+02552 </td> <td> <span>&#9554;</span> </td> <tr><td> <code title="">boxdl;</code> </td> <td> U+02510 </td> <td> <span>&#9488;</span> </td> <tr><td> <code title="">boxdr;</code> </td> <td> U+0250C </td> <td> <span>&#9484;</span> </td> <tr><td> <code title="">boxh;</code> </td> <td> U+02500 </td> <td> <span>&#9472;</span> </td> <tr><td> <code title="">boxhD;</code> </td> <td> U+02565 </td> <td> <span>&#9573;</span> </td> <tr><td> <code title="">boxhU;</code> </td> <td> U+02568 </td> <td> <span>&#9576;</span> </td> <tr><td> <code title="">boxhd;</code> </td> <td> U+0252C </td> <td> <span>&#9516;</span> </td> <tr><td> <code title="">boxhu;</code> </td> <td> U+02534 </td> <td> <span>&#9524;</span> </td> <tr><td> <code title="">boxminus;</code> </td> <td> U+0229F </td> <td> <span>&#8863;</span> </td> <tr><td> <code title="">boxplus;</code> </td> <td> U+0229E </td> <td> <span>&#8862;</span> </td> <tr><td> <code title="">boxtimes;</code> </td> <td> U+022A0 </td> <td> <span>&#8864;</span> </td> <tr><td> <code title="">boxuL;</code> </td> <td> U+0255B </td> <td> <span>&#9563;</span> </td> <tr><td> <code title="">boxuR;</code> </td> <td> U+02558 </td> <td> <span>&#9560;</span> </td> <tr><td> <code title="">boxul;</code> </td> <td> U+02518 </td> <td> <span>&#9496;</span> </td> <tr><td> <code title="">boxur;</code> </td> <td> U+02514 </td> <td> <span>&#9492;</span> </td> <tr><td> <code title="">boxv;</code> </td> <td> U+02502 </td> <td> <span>&#9474;</span> </td> <tr><td> <code title="">boxvH;</code> </td> <td> U+0256A </td> <td> <span>&#9578;</span> </td> <tr><td> <code title="">boxvL;</code> </td> <td> U+02561 </td> <td> <span>&#9569;</span> </td> <tr><td> <code title="">boxvR;</code> </td> <td> U+0255E </td> <td> <span>&#9566;</span> </td> <tr><td> <code title="">boxvh;</code> </td> <td> U+0253C </td> <td> <span>&#9532;</span> </td> <tr><td> <code title="">boxvl;</code> </td> <td> U+02524 </td> <td> <span>&#9508;</span> </td> <tr><td> <code title="">boxvr;</code> </td> <td> U+0251C </td> <td> <span>&#9500;</span> </td> <tr><td> <code title="">bprime;</code> </td> <td> U+02035 </td> <td> <span>&#8245;</span> </td> <tr><td> <code title="">breve;</code> </td> <td> U+002D8 </td> <td> <span>&#728;</span> </td> <tr><td> <code title="">brvbar;</code> </td> <td> U+000A6 </td> <td> <span>&brvbar;</span> </td> <tr class=impl><td> <code title="">brvbar</code> </td> <td> U+000A6 </td> <td> <span title="">&brvbar;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">bscr;</code> </td> <td> U+1D4B7 </td> <td> <span>&#119991;</span> </td> <tr><td> <code title="">bsemi;</code> </td> <td> U+0204F </td> <td> <span>&#8271;</span> </td> <tr><td> <code title="">bsim;</code> </td> <td> U+0223D </td> <td> <span>&#8765;</span> </td> <tr><td> <code title="">bsime;</code> </td> <td> U+022CD </td> <td> <span>&#8909;</span> </td> <tr><td> <code title="">bsol;</code> </td> <td> U+0005C </td> <td> <span>\</span> </td> <tr><td> <code title="">bsolb;</code> </td> <td> U+029C5 </td> <td> <span>&#10693;</span> </td> <tr><td> <code title="">bsolhsub;</code> </td> <td> U+027C8 </td> <td> <span>&#10184;</span> </td> <tr><td> <code title="">bull;</code> </td> <td> U+02022 </td> <td> <span>&bull;</span> </td> <tr><td> <code title="">bullet;</code> </td> <td> U+02022 </td> <td> <span>&bull;</span> </td> <tr><td> <code title="">bump;</code> </td> <td> U+0224E </td> <td> <span>&#8782;</span> </td> <tr><td> <code title="">bumpE;</code> </td> <td> U+02AAE </td> <td> <span>&#10926;</span> </td> <tr><td> <code title="">bumpe;</code> </td> <td> U+0224F </td> <td> <span>&#8783;</span> </td> <tr><td> <code title="">bumpeq;</code> </td> <td> U+0224F </td> <td> <span>&#8783;</span> </td> <tr><td> <code title="">cacute;</code> </td> <td> U+00107 </td> <td> <span>&#263;</span> </td> <tr><td> <code title="">cap;</code> </td> <td> U+02229 </td> <td> <span>&cap;</span> </td> <tr><td> <code title="">capand;</code> </td> <td> U+02A44 </td> <td> <span>&#10820;</span> </td> <tr><td> <code title="">capbrcup;</code> </td> <td> U+02A49 </td> <td> <span>&#10825;</span> </td> <tr><td> <code title="">capcap;</code> </td> <td> U+02A4B </td> <td> <span>&#10827;</span> </td> <tr><td> <code title="">capcup;</code> </td> <td> U+02A47 </td> <td> <span>&#10823;</span> </td> <tr><td> <code title="">capdot;</code> </td> <td> U+02A40 </td> <td> <span>&#10816;</span> </td> <tr><td> <code title="">caret;</code> </td> <td> U+02041 </td> <td> <span>&#8257;</span> </td> <tr><td> <code title="">caron;</code> </td> <td> U+002C7 </td> <td> <span>&#711;</span> </td> <tr><td> <code title="">ccaps;</code> </td> <td> U+02A4D </td> <td> <span>&#10829;</span> </td> <tr><td> <code title="">ccaron;</code> </td> <td> U+0010D </td> <td> <span>&#269;</span> </td> <tr><td> <code title="">ccedil;</code> </td> <td> U+000E7 </td> <td> <span>&ccedil;</span> </td> <tr class=impl><td> <code title="">ccedil</code> </td> <td> U+000E7 </td> <td> <span title="">&ccedil;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ccirc;</code> </td> <td> U+00109 </td> <td> <span>&#265;</span> </td> <tr><td> <code title="">ccups;</code> </td> <td> U+02A4C </td> <td> <span>&#10828;</span> </td> <tr><td> <code title="">ccupssm;</code> </td> <td> U+02A50 </td> <td> <span>&#10832;</span> </td> <tr><td> <code title="">cdot;</code> </td> <td> U+0010B </td> <td> <span>&#267;</span> </td> <tr><td> <code title="">cedil;</code> </td> <td> U+000B8 </td> <td> <span>&cedil;</span> </td> <tr class=impl><td> <code title="">cedil</code> </td> <td> U+000B8 </td> <td> <span title="">&cedil;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">cemptyv;</code> </td> <td> U+029B2 </td> <td> <span>&#10674;</span> </td> <tr><td> <code title="">cent;</code> </td> <td> U+000A2 </td> <td> <span>&cent;</span> </td> <tr class=impl><td> <code title="">cent</code> </td> <td> U+000A2 </td> <td> <span title="">&cent;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">centerdot;</code> </td> <td> U+000B7 </td> <td> <span>&middot;</span> </td> <tr><td> <code title="">cfr;</code> </td> <td> U+1D520 </td> <td> <span>&#120096;</span> </td> <tr><td> <code title="">chcy;</code> </td> <td> U+00447 </td> <td> <span>&#1095;</span> </td> <tr><td> <code title="">check;</code> </td> <td> U+02713 </td> <td> <span>&#10003;</span> </td> <tr><td> <code title="">checkmark;</code> </td> <td> U+02713 </td> <td> <span>&#10003;</span> </td> <tr><td> <code title="">chi;</code> </td> <td> U+003C7 </td> <td> <span>&chi;</span> </td> <tr><td> <code title="">cir;</code> </td> <td> U+025CB </td> <td> <span>&#9675;</span> </td> <tr><td> <code title="">cirE;</code> </td> <td> U+029C3 </td> <td> <span>&#10691;</span> </td> <tr><td> <code title="">circ;</code> </td> <td> U+002C6 </td> <td> <span>&circ;</span> </td> <tr><td> <code title="">circeq;</code> </td> <td> U+02257 </td> <td> <span>&#8791;</span> </td> <tr><td> <code title="">circlearrowleft;</code> </td> <td> U+021BA </td> <td> <span>&#8634;</span> </td> <tr><td> <code title="">circlearrowright;</code> </td> <td> U+021BB </td> <td> <span>&#8635;</span> </td> <tr><td> <code title="">circledR;</code> </td> <td> U+000AE </td> <td> <span>&reg;</span> </td> <tr><td> <code title="">circledS;</code> </td> <td> U+024C8 </td> <td> <span>&#9416;</span> </td> <tr><td> <code title="">circledast;</code> </td> <td> U+0229B </td> <td> <span>&#8859;</span> </td> <tr><td> <code title="">circledcirc;</code> </td> <td> U+0229A </td> <td> <span>&#8858;</span> </td> <tr><td> <code title="">circleddash;</code> </td> <td> U+0229D </td> <td> <span>&#8861;</span> </td> <tr><td> <code title="">cire;</code> </td> <td> U+02257 </td> <td> <span>&#8791;</span> </td> <tr><td> <code title="">cirfnint;</code> </td> <td> U+02A10 </td> <td> <span>&#10768;</span> </td> <tr><td> <code title="">cirmid;</code> </td> <td> U+02AEF </td> <td> <span>&#10991;</span> </td> <tr><td> <code title="">cirscir;</code> </td> <td> U+029C2 </td> <td> <span>&#10690;</span> </td> <tr><td> <code title="">clubs;</code> </td> <td> U+02663 </td> <td> <span>&clubs;</span> </td> <tr><td> <code title="">clubsuit;</code> </td> <td> U+02663 </td> <td> <span>&clubs;</span> </td> <tr><td> <code title="">colon;</code> </td> <td> U+0003A </td> <td> <span>:</span> </td> <tr><td> <code title="">colone;</code> </td> <td> U+02254 </td> <td> <span>&#8788;</span> </td> <tr><td> <code title="">coloneq;</code> </td> <td> U+02254 </td> <td> <span>&#8788;</span> </td> <tr><td> <code title="">comma;</code> </td> <td> U+0002C </td> <td> <span>,</span> </td> <tr><td> <code title="">commat;</code> </td> <td> U+00040 </td> <td> <span>@</span> </td> <tr><td> <code title="">comp;</code> </td> <td> U+02201 </td> <td> <span>&#8705;</span> </td> <tr><td> <code title="">compfn;</code> </td> <td> U+02218 </td> <td> <span>&#8728;</span> </td> <tr><td> <code title="">complement;</code> </td> <td> U+02201 </td> <td> <span>&#8705;</span> </td> <tr><td> <code title="">complexes;</code> </td> <td> U+02102 </td> <td> <span>&#8450;</span> </td> <tr><td> <code title="">cong;</code> </td> <td> U+02245 </td> <td> <span>&cong;</span> </td> <tr><td> <code title="">congdot;</code> </td> <td> U+02A6D </td> <td> <span>&#10861;</span> </td> <tr><td> <code title="">conint;</code> </td> <td> U+0222E </td> <td> <span>&#8750;</span> </td> <tr><td> <code title="">copf;</code> </td> <td> U+1D554 </td> <td> <span>&#120148;</span> </td> <tr><td> <code title="">coprod;</code> </td> <td> U+02210 </td> <td> <span>&#8720;</span> </td> <tr><td> <code title="">copy;</code> </td> <td> U+000A9 </td> <td> <span>&copy;</span> </td> <tr class=impl><td> <code title="">copy</code> </td> <td> U+000A9 </td> <td> <span title="">&copy;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">copysr;</code> </td> <td> U+02117 </td> <td> <span>&#8471;</span> </td> <tr><td> <code title="">crarr;</code> </td> <td> U+021B5 </td> <td> <span>&crarr;</span> </td> <tr><td> <code title="">cross;</code> </td> <td> U+02717 </td> <td> <span>&#10007;</span> </td> <tr><td> <code title="">cscr;</code> </td> <td> U+1D4B8 </td> <td> <span>&#119992;</span> </td> <tr><td> <code title="">csub;</code> </td> <td> U+02ACF </td> <td> <span>&#10959;</span> </td> <tr><td> <code title="">csube;</code> </td> <td> U+02AD1 </td> <td> <span>&#10961;</span> </td> <tr><td> <code title="">csup;</code> </td> <td> U+02AD0 </td> <td> <span>&#10960;</span> </td> <tr><td> <code title="">csupe;</code> </td> <td> U+02AD2 </td> <td> <span>&#10962;</span> </td> <tr><td> <code title="">ctdot;</code> </td> <td> U+022EF </td> <td> <span>&#8943;</span> </td> <tr><td> <code title="">cudarrl;</code> </td> <td> U+02938 </td> <td> <span>&#10552;</span> </td> <tr><td> <code title="">cudarrr;</code> </td> <td> U+02935 </td> <td> <span>&#10549;</span> </td> <tr><td> <code title="">cuepr;</code> </td> <td> U+022DE </td> <td> <span>&#8926;</span> </td> <tr><td> <code title="">cuesc;</code> </td> <td> U+022DF </td> <td> <span>&#8927;</span> </td> <tr><td> <code title="">cularr;</code> </td> <td> U+021B6 </td> <td> <span>&#8630;</span> </td> <tr><td> <code title="">cularrp;</code> </td> <td> U+0293D </td> <td> <span>&#10557;</span> </td> <tr><td> <code title="">cup;</code> </td> <td> U+0222A </td> <td> <span>&cup;</span> </td> <tr><td> <code title="">cupbrcap;</code> </td> <td> U+02A48 </td> <td> <span>&#10824;</span> </td> <tr><td> <code title="">cupcap;</code> </td> <td> U+02A46 </td> <td> <span>&#10822;</span> </td> <tr><td> <code title="">cupcup;</code> </td> <td> U+02A4A </td> <td> <span>&#10826;</span> </td> <tr><td> <code title="">cupdot;</code> </td> <td> U+0228D </td> <td> <span>&#8845;</span> </td> <tr><td> <code title="">cupor;</code> </td> <td> U+02A45 </td> <td> <span>&#10821;</span> </td> <tr><td> <code title="">curarr;</code> </td> <td> U+021B7 </td> <td> <span>&#8631;</span> </td> <tr><td> <code title="">curarrm;</code> </td> <td> U+0293C </td> <td> <span>&#10556;</span> </td> <tr><td> <code title="">curlyeqprec;</code> </td> <td> U+022DE </td> <td> <span>&#8926;</span> </td> <tr><td> <code title="">curlyeqsucc;</code> </td> <td> U+022DF </td> <td> <span>&#8927;</span> </td> <tr><td> <code title="">curlyvee;</code> </td> <td> U+022CE </td> <td> <span>&#8910;</span> </td> <tr><td> <code title="">curlywedge;</code> </td> <td> U+022CF </td> <td> <span>&#8911;</span> </td> <tr><td> <code title="">curren;</code> </td> <td> U+000A4 </td> <td> <span>&curren;</span> </td> <tr class=impl><td> <code title="">curren</code> </td> <td> U+000A4 </td> <td> <span title="">&curren;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">curvearrowleft;</code> </td> <td> U+021B6 </td> <td> <span>&#8630;</span> </td> <tr><td> <code title="">curvearrowright;</code> </td> <td> U+021B7 </td> <td> <span>&#8631;</span> </td> <tr><td> <code title="">cuvee;</code> </td> <td> U+022CE </td> <td> <span>&#8910;</span> </td> <tr><td> <code title="">cuwed;</code> </td> <td> U+022CF </td> <td> <span>&#8911;</span> </td> <tr><td> <code title="">cwconint;</code> </td> <td> U+02232 </td> <td> <span>&#8754;</span> </td> <tr><td> <code title="">cwint;</code> </td> <td> U+02231 </td> <td> <span>&#8753;</span> </td> <tr><td> <code title="">cylcty;</code> </td> <td> U+0232D </td> <td> <span>&#9005;</span> </td> <tr><td> <code title="">dArr;</code> </td> <td> U+021D3 </td> <td> <span>&dArr;</span> </td> <tr><td> <code title="">dHar;</code> </td> <td> U+02965 </td> <td> <span>&#10597;</span> </td> <tr><td> <code title="">dagger;</code> </td> <td> U+02020 </td> <td> <span>&dagger;</span> </td> <tr><td> <code title="">daleth;</code> </td> <td> U+02138 </td> <td> <span>&#8504;</span> </td> <tr><td> <code title="">darr;</code> </td> <td> U+02193 </td> <td> <span>&darr;</span> </td> <tr><td> <code title="">dash;</code> </td> <td> U+02010 </td> <td> <span>&#8208;</span> </td> <tr><td> <code title="">dashv;</code> </td> <td> U+022A3 </td> <td> <span>&#8867;</span> </td> <tr><td> <code title="">dbkarow;</code> </td> <td> U+0290F </td> <td> <span>&#10511;</span> </td> <tr><td> <code title="">dblac;</code> </td> <td> U+002DD </td> <td> <span>&#733;</span> </td> <tr><td> <code title="">dcaron;</code> </td> <td> U+0010F </td> <td> <span>&#271;</span> </td> <tr><td> <code title="">dcy;</code> </td> <td> U+00434 </td> <td> <span>&#1076;</span> </td> <tr><td> <code title="">dd;</code> </td> <td> U+02146 </td> <td> <span>&#8518;</span> </td> <tr><td> <code title="">ddagger;</code> </td> <td> U+02021 </td> <td> <span>&Dagger;</span> </td> <tr><td> <code title="">ddarr;</code> </td> <td> U+021CA </td> <td> <span>&#8650;</span> </td> <tr><td> <code title="">ddotseq;</code> </td> <td> U+02A77 </td> <td> <span>&#10871;</span> </td> <tr><td> <code title="">deg;</code> </td> <td> U+000B0 </td> <td> <span>&deg;</span> </td> <tr class=impl><td> <code title="">deg</code> </td> <td> U+000B0 </td> <td> <span title="">&deg;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">delta;</code> </td> <td> U+003B4 </td> <td> <span>&delta;</span> </td> <tr><td> <code title="">demptyv;</code> </td> <td> U+029B1 </td> <td> <span>&#10673;</span> </td> <tr><td> <code title="">dfisht;</code> </td> <td> U+0297F </td> <td> <span>&#10623;</span> </td> <tr><td> <code title="">dfr;</code> </td> <td> U+1D521 </td> <td> <span>&#120097;</span> </td> <tr><td> <code title="">dharl;</code> </td> <td> U+021C3 </td> <td> <span>&#8643;</span> </td> <tr><td> <code title="">dharr;</code> </td> <td> U+021C2 </td> <td> <span>&#8642;</span> </td> <tr><td> <code title="">diam;</code> </td> <td> U+022C4 </td> <td> <span>&#8900;</span> </td> <tr><td> <code title="">diamond;</code> </td> <td> U+022C4 </td> <td> <span>&#8900;</span> </td> <tr><td> <code title="">diamondsuit;</code> </td> <td> U+02666 </td> <td> <span>&diams;</span> </td> <tr><td> <code title="">diams;</code> </td> <td> U+02666 </td> <td> <span>&diams;</span> </td> <tr><td> <code title="">die;</code> </td> <td> U+000A8 </td> <td> <span>&uml;</span> </td> <tr><td> <code title="">digamma;</code> </td> <td> U+003DD </td> <td> <span>&#989;</span> </td> <tr><td> <code title="">disin;</code> </td> <td> U+022F2 </td> <td> <span>&#8946;</span> </td> <tr><td> <code title="">div;</code> </td> <td> U+000F7 </td> <td> <span>&divide;</span> </td> <tr><td> <code title="">divide;</code> </td> <td> U+000F7 </td> <td> <span>&divide;</span> </td> <tr class=impl><td> <code title="">divide</code> </td> <td> U+000F7 </td> <td> <span title="">&divide;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">divideontimes;</code> </td> <td> U+022C7 </td> <td> <span>&#8903;</span> </td> <tr><td> <code title="">divonx;</code> </td> <td> U+022C7 </td> <td> <span>&#8903;</span> </td> <tr><td> <code title="">djcy;</code> </td> <td> U+00452 </td> <td> <span>&#1106;</span> </td> <tr><td> <code title="">dlcorn;</code> </td> <td> U+0231E </td> <td> <span>&#8990;</span> </td> <tr><td> <code title="">dlcrop;</code> </td> <td> U+0230D </td> <td> <span>&#8973;</span> </td> <tr><td> <code title="">dollar;</code> </td> <td> U+00024 </td> <td> <span>$</span> </td> <tr><td> <code title="">dopf;</code> </td> <td> U+1D555 </td> <td> <span>&#120149;</span> </td> <tr><td> <code title="">dot;</code> </td> <td> U+002D9 </td> <td> <span>&#729;</span> </td> <tr><td> <code title="">doteq;</code> </td> <td> U+02250 </td> <td> <span>&#8784;</span> </td> <tr><td> <code title="">doteqdot;</code> </td> <td> U+02251 </td> <td> <span>&#8785;</span> </td> <tr><td> <code title="">dotminus;</code> </td> <td> U+02238 </td> <td> <span>&#8760;</span> </td> <tr><td> <code title="">dotplus;</code> </td> <td> U+02214 </td> <td> <span>&#8724;</span> </td> <tr><td> <code title="">dotsquare;</code> </td> <td> U+022A1 </td> <td> <span>&#8865;</span> </td> <tr><td> <code title="">doublebarwedge;</code> </td> <td> U+02306 </td> <td> <span>&#8966;</span> </td> <tr><td> <code title="">downarrow;</code> </td> <td> U+02193 </td> <td> <span>&darr;</span> </td> <tr><td> <code title="">downdownarrows;</code> </td> <td> U+021CA </td> <td> <span>&#8650;</span> </td> <tr><td> <code title="">downharpoonleft;</code> </td> <td> U+021C3 </td> <td> <span>&#8643;</span> </td> <tr><td> <code title="">downharpoonright;</code> </td> <td> U+021C2 </td> <td> <span>&#8642;</span> </td> <tr><td> <code title="">drbkarow;</code> </td> <td> U+02910 </td> <td> <span>&#10512;</span> </td> <tr><td> <code title="">drcorn;</code> </td> <td> U+0231F </td> <td> <span>&#8991;</span> </td> <tr><td> <code title="">drcrop;</code> </td> <td> U+0230C </td> <td> <span>&#8972;</span> </td> <tr><td> <code title="">dscr;</code> </td> <td> U+1D4B9 </td> <td> <span>&#119993;</span> </td> <tr><td> <code title="">dscy;</code> </td> <td> U+00455 </td> <td> <span>&#1109;</span> </td> <tr><td> <code title="">dsol;</code> </td> <td> U+029F6 </td> <td> <span>&#10742;</span> </td> <tr><td> <code title="">dstrok;</code> </td> <td> U+00111 </td> <td> <span>&#273;</span> </td> <tr><td> <code title="">dtdot;</code> </td> <td> U+022F1 </td> <td> <span>&#8945;</span> </td> <tr><td> <code title="">dtri;</code> </td> <td> U+025BF </td> <td> <span>&#9663;</span> </td> <tr><td> <code title="">dtrif;</code> </td> <td> U+025BE </td> <td> <span>&#9662;</span> </td> <tr><td> <code title="">duarr;</code> </td> <td> U+021F5 </td> <td> <span>&#8693;</span> </td> <tr><td> <code title="">duhar;</code> </td> <td> U+0296F </td> <td> <span>&#10607;</span> </td> <tr><td> <code title="">dwangle;</code> </td> <td> U+029A6 </td> <td> <span>&#10662;</span> </td> <tr><td> <code title="">dzcy;</code> </td> <td> U+0045F </td> <td> <span>&#1119;</span> </td> <tr><td> <code title="">dzigrarr;</code> </td> <td> U+027FF </td> <td> <span>&#10239;</span> </td> <tr><td> <code title="">eDDot;</code> </td> <td> U+02A77 </td> <td> <span>&#10871;</span> </td> <tr><td> <code title="">eDot;</code> </td> <td> U+02251 </td> <td> <span>&#8785;</span> </td> <tr><td> <code title="">eacute;</code> </td> <td> U+000E9 </td> <td> <span>&eacute;</span> </td> <tr class=impl><td> <code title="">eacute</code> </td> <td> U+000E9 </td> <td> <span title="">&eacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">easter;</code> </td> <td> U+02A6E </td> <td> <span>&#10862;</span> </td> <tr><td> <code title="">ecaron;</code> </td> <td> U+0011B </td> <td> <span>&#283;</span> </td> <tr><td> <code title="">ecir;</code> </td> <td> U+02256 </td> <td> <span>&#8790;</span> </td> <tr><td> <code title="">ecirc;</code> </td> <td> U+000EA </td> <td> <span>&ecirc;</span> </td> <tr class=impl><td> <code title="">ecirc</code> </td> <td> U+000EA </td> <td> <span title="">&ecirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ecolon;</code> </td> <td> U+02255 </td> <td> <span>&#8789;</span> </td> <tr><td> <code title="">ecy;</code> </td> <td> U+0044D </td> <td> <span>&#1101;</span> </td> <tr><td> <code title="">edot;</code> </td> <td> U+00117 </td> <td> <span>&#279;</span> </td> <tr><td> <code title="">ee;</code> </td> <td> U+02147 </td> <td> <span>&#8519;</span> </td> <tr><td> <code title="">efDot;</code> </td> <td> U+02252 </td> <td> <span>&#8786;</span> </td> <tr><td> <code title="">efr;</code> </td> <td> U+1D522 </td> <td> <span>&#120098;</span> </td> <tr><td> <code title="">eg;</code> </td> <td> U+02A9A </td> <td> <span>&#10906;</span> </td> <tr><td> <code title="">egrave;</code> </td> <td> U+000E8 </td> <td> <span>&egrave;</span> </td> <tr class=impl><td> <code title="">egrave</code> </td> <td> U+000E8 </td> <td> <span title="">&egrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">egs;</code> </td> <td> U+02A96 </td> <td> <span>&#10902;</span> </td> <tr><td> <code title="">egsdot;</code> </td> <td> U+02A98 </td> <td> <span>&#10904;</span> </td> <tr><td> <code title="">el;</code> </td> <td> U+02A99 </td> <td> <span>&#10905;</span> </td> <tr><td> <code title="">elinters;</code> </td> <td> U+023E7 </td> <td> <span>&#9191;</span> </td> <tr><td> <code title="">ell;</code> </td> <td> U+02113 </td> <td> <span>&#8467;</span> </td> <tr><td> <code title="">els;</code> </td> <td> U+02A95 </td> <td> <span>&#10901;</span> </td> <tr><td> <code title="">elsdot;</code> </td> <td> U+02A97 </td> <td> <span>&#10903;</span> </td> <tr><td> <code title="">emacr;</code> </td> <td> U+00113 </td> <td> <span>&#275;</span> </td> <tr><td> <code title="">empty;</code> </td> <td> U+02205 </td> <td> <span>&empty;</span> </td> <tr><td> <code title="">emptyset;</code> </td> <td> U+02205 </td> <td> <span>&empty;</span> </td> <tr><td> <code title="">emptyv;</code> </td> <td> U+02205 </td> <td> <span>&empty;</span> </td> <tr><td> <code title="">emsp13;</code> </td> <td> U+02004 </td> <td> <span>&#8196;</span> </td> <tr><td> <code title="">emsp14;</code> </td> <td> U+02005 </td> <td> <span>&#8197;</span> </td> <tr><td> <code title="">emsp;</code> </td> <td> U+02003 </td> <td> <span>&emsp;</span> </td> <tr><td> <code title="">eng;</code> </td> <td> U+0014B </td> <td> <span>&#331;</span> </td> <tr><td> <code title="">ensp;</code> </td> <td> U+02002 </td> <td> <span>&ensp;</span> </td> <tr><td> <code title="">eogon;</code> </td> <td> U+00119 </td> <td> <span>&#281;</span> </td> <tr><td> <code title="">eopf;</code> </td> <td> U+1D556 </td> <td> <span>&#120150;</span> </td> <tr><td> <code title="">epar;</code> </td> <td> U+022D5 </td> <td> <span>&#8917;</span> </td> <tr><td> <code title="">eparsl;</code> </td> <td> U+029E3 </td> <td> <span>&#10723;</span> </td> <tr><td> <code title="">eplus;</code> </td> <td> U+02A71 </td> <td> <span>&#10865;</span> </td> <tr><td> <code title="">epsi;</code> </td> <td> U+003B5 </td> <td> <span>&epsilon;</span> </td> <tr><td> <code title="">epsilon;</code> </td> <td> U+003B5 </td> <td> <span>&epsilon;</span> </td> <tr><td> <code title="">epsiv;</code> </td> <td> U+003F5 </td> <td> <span>&#1013;</span> </td> <tr><td> <code title="">eqcirc;</code> </td> <td> U+02256 </td> <td> <span>&#8790;</span> </td> <tr><td> <code title="">eqcolon;</code> </td> <td> U+02255 </td> <td> <span>&#8789;</span> </td> <tr><td> <code title="">eqsim;</code> </td> <td> U+02242 </td> <td> <span>&#8770;</span> </td> <tr><td> <code title="">eqslantgtr;</code> </td> <td> U+02A96 </td> <td> <span>&#10902;</span> </td> <tr><td> <code title="">eqslantless;</code> </td> <td> U+02A95 </td> <td> <span>&#10901;</span> </td> <tr><td> <code title="">equals;</code> </td> <td> U+0003D </td> <td> <span>=</span> </td> <tr><td> <code title="">equest;</code> </td> <td> U+0225F </td> <td> <span>&#8799;</span> </td> <tr><td> <code title="">equiv;</code> </td> <td> U+02261 </td> <td> <span>&equiv;</span> </td> <tr><td> <code title="">equivDD;</code> </td> <td> U+02A78 </td> <td> <span>&#10872;</span> </td> <tr><td> <code title="">eqvparsl;</code> </td> <td> U+029E5 </td> <td> <span>&#10725;</span> </td> <tr><td> <code title="">erDot;</code> </td> <td> U+02253 </td> <td> <span>&#8787;</span> </td> <tr><td> <code title="">erarr;</code> </td> <td> U+02971 </td> <td> <span>&#10609;</span> </td> <tr><td> <code title="">escr;</code> </td> <td> U+0212F </td> <td> <span>&#8495;</span> </td> <tr><td> <code title="">esdot;</code> </td> <td> U+02250 </td> <td> <span>&#8784;</span> </td> <tr><td> <code title="">esim;</code> </td> <td> U+02242 </td> <td> <span>&#8770;</span> </td> <tr><td> <code title="">eta;</code> </td> <td> U+003B7 </td> <td> <span>&eta;</span> </td> <tr><td> <code title="">eth;</code> </td> <td> U+000F0 </td> <td> <span>&eth;</span> </td> <tr class=impl><td> <code title="">eth</code> </td> <td> U+000F0 </td> <td> <span title="">&eth;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">euml;</code> </td> <td> U+000EB </td> <td> <span>&euml;</span> </td> <tr class=impl><td> <code title="">euml</code> </td> <td> U+000EB </td> <td> <span title="">&euml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">euro;</code> </td> <td> U+020AC </td> <td> <span>&euro;</span> </td> <tr><td> <code title="">excl;</code> </td> <td> U+00021 </td> <td> <span>!</span> </td> <tr><td> <code title="">exist;</code> </td> <td> U+02203 </td> <td> <span>&exist;</span> </td> <tr><td> <code title="">expectation;</code> </td> <td> U+02130 </td> <td> <span>&#8496;</span> </td> <tr><td> <code title="">exponentiale;</code> </td> <td> U+02147 </td> <td> <span>&#8519;</span> </td> <tr><td> <code title="">fallingdotseq;</code> </td> <td> U+02252 </td> <td> <span>&#8786;</span> </td> <tr><td> <code title="">fcy;</code> </td> <td> U+00444 </td> <td> <span>&#1092;</span> </td> <tr><td> <code title="">female;</code> </td> <td> U+02640 </td> <td> <span>&#9792;</span> </td> <tr><td> <code title="">ffilig;</code> </td> <td> U+0FB03 </td> <td> <span>&#64259;</span> </td> <tr><td> <code title="">fflig;</code> </td> <td> U+0FB00 </td> <td> <span>&#64256;</span> </td> <tr><td> <code title="">ffllig;</code> </td> <td> U+0FB04 </td> <td> <span>&#64260;</span> </td> <tr><td> <code title="">ffr;</code> </td> <td> U+1D523 </td> <td> <span>&#120099;</span> </td> <tr><td> <code title="">filig;</code> </td> <td> U+0FB01 </td> <td> <span>&#64257;</span> </td> <tr><td> <code title="">flat;</code> </td> <td> U+0266D </td> <td> <span>&#9837;</span> </td> <tr><td> <code title="">fllig;</code> </td> <td> U+0FB02 </td> <td> <span>&#64258;</span> </td> <tr><td> <code title="">fltns;</code> </td> <td> U+025B1 </td> <td> <span>&#9649;</span> </td> <tr><td> <code title="">fnof;</code> </td> <td> U+00192 </td> <td> <span>&fnof;</span> </td> <tr><td> <code title="">fopf;</code> </td> <td> U+1D557 </td> <td> <span>&#120151;</span> </td> <tr><td> <code title="">forall;</code> </td> <td> U+02200 </td> <td> <span>&forall;</span> </td> <tr><td> <code title="">fork;</code> </td> <td> U+022D4 </td> <td> <span>&#8916;</span> </td> <tr><td> <code title="">forkv;</code> </td> <td> U+02AD9 </td> <td> <span>&#10969;</span> </td> <tr><td> <code title="">fpartint;</code> </td> <td> U+02A0D </td> <td> <span>&#10765;</span> </td> <tr><td> <code title="">frac12;</code> </td> <td> U+000BD </td> <td> <span>&frac12;</span> </td> <tr class=impl><td> <code title="">frac12</code> </td> <td> U+000BD </td> <td> <span title="">&frac12;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">frac13;</code> </td> <td> U+02153 </td> <td> <span>&#8531;</span> </td> <tr><td> <code title="">frac14;</code> </td> <td> U+000BC </td> <td> <span>&frac14;</span> </td> <tr class=impl><td> <code title="">frac14</code> </td> <td> U+000BC </td> <td> <span title="">&frac14;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">frac15;</code> </td> <td> U+02155 </td> <td> <span>&#8533;</span> </td> <tr><td> <code title="">frac16;</code> </td> <td> U+02159 </td> <td> <span>&#8537;</span> </td> <tr><td> <code title="">frac18;</code> </td> <td> U+0215B </td> <td> <span>&#8539;</span> </td> <tr><td> <code title="">frac23;</code> </td> <td> U+02154 </td> <td> <span>&#8532;</span> </td> <tr><td> <code title="">frac25;</code> </td> <td> U+02156 </td> <td> <span>&#8534;</span> </td> <tr><td> <code title="">frac34;</code> </td> <td> U+000BE </td> <td> <span>&frac34;</span> </td> <tr class=impl><td> <code title="">frac34</code> </td> <td> U+000BE </td> <td> <span title="">&frac34;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">frac35;</code> </td> <td> U+02157 </td> <td> <span>&#8535;</span> </td> <tr><td> <code title="">frac38;</code> </td> <td> U+0215C </td> <td> <span>&#8540;</span> </td> <tr><td> <code title="">frac45;</code> </td> <td> U+02158 </td> <td> <span>&#8536;</span> </td> <tr><td> <code title="">frac56;</code> </td> <td> U+0215A </td> <td> <span>&#8538;</span> </td> <tr><td> <code title="">frac58;</code> </td> <td> U+0215D </td> <td> <span>&#8541;</span> </td> <tr><td> <code title="">frac78;</code> </td> <td> U+0215E </td> <td> <span>&#8542;</span> </td> <tr><td> <code title="">frasl;</code> </td> <td> U+02044 </td> <td> <span>&frasl;</span> </td> <tr><td> <code title="">frown;</code> </td> <td> U+02322 </td> <td> <span>&#8994;</span> </td> <tr><td> <code title="">fscr;</code> </td> <td> U+1D4BB </td> <td> <span>&#119995;</span> </td> <tr><td> <code title="">gE;</code> </td> <td> U+02267 </td> <td> <span>&#8807;</span> </td> <tr><td> <code title="">gEl;</code> </td> <td> U+02A8C </td> <td> <span>&#10892;</span> </td> <tr><td> <code title="">gacute;</code> </td> <td> U+001F5 </td> <td> <span>&#501;</span> </td> <tr><td> <code title="">gamma;</code> </td> <td> U+003B3 </td> <td> <span>&gamma;</span> </td> <tr><td> <code title="">gammad;</code> </td> <td> U+003DD </td> <td> <span>&#989;</span> </td> <tr><td> <code title="">gap;</code> </td> <td> U+02A86 </td> <td> <span>&#10886;</span> </td> <tr><td> <code title="">gbreve;</code> </td> <td> U+0011F </td> <td> <span>&#287;</span> </td> <tr><td> <code title="">gcirc;</code> </td> <td> U+0011D </td> <td> <span>&#285;</span> </td> <tr><td> <code title="">gcy;</code> </td> <td> U+00433 </td> <td> <span>&#1075;</span> </td> <tr><td> <code title="">gdot;</code> </td> <td> U+00121 </td> <td> <span>&#289;</span> </td> <tr><td> <code title="">ge;</code> </td> <td> U+02265 </td> <td> <span>&ge;</span> </td> <tr><td> <code title="">gel;</code> </td> <td> U+022DB </td> <td> <span>&#8923;</span> </td> <tr><td> <code title="">geq;</code> </td> <td> U+02265 </td> <td> <span>&ge;</span> </td> <tr><td> <code title="">geqq;</code> </td> <td> U+02267 </td> <td> <span>&#8807;</span> </td> <tr><td> <code title="">geqslant;</code> </td> <td> U+02A7E </td> <td> <span>&#10878;</span> </td> <tr><td> <code title="">ges;</code> </td> <td> U+02A7E </td> <td> <span>&#10878;</span> </td> <tr><td> <code title="">gescc;</code> </td> <td> U+02AA9 </td> <td> <span>&#10921;</span> </td> <tr><td> <code title="">gesdot;</code> </td> <td> U+02A80 </td> <td> <span>&#10880;</span> </td> <tr><td> <code title="">gesdoto;</code> </td> <td> U+02A82 </td> <td> <span>&#10882;</span> </td> <tr><td> <code title="">gesdotol;</code> </td> <td> U+02A84 </td> <td> <span>&#10884;</span> </td> <tr><td> <code title="">gesles;</code> </td> <td> U+02A94 </td> <td> <span>&#10900;</span> </td> <tr><td> <code title="">gfr;</code> </td> <td> U+1D524 </td> <td> <span>&#120100;</span> </td> <tr><td> <code title="">gg;</code> </td> <td> U+0226B </td> <td> <span>&#8811;</span> </td> <tr><td> <code title="">ggg;</code> </td> <td> U+022D9 </td> <td> <span>&#8921;</span> </td> <tr><td> <code title="">gimel;</code> </td> <td> U+02137 </td> <td> <span>&#8503;</span> </td> <tr><td> <code title="">gjcy;</code> </td> <td> U+00453 </td> <td> <span>&#1107;</span> </td> <tr><td> <code title="">gl;</code> </td> <td> U+02277 </td> <td> <span>&#8823;</span> </td> <tr><td> <code title="">glE;</code> </td> <td> U+02A92 </td> <td> <span>&#10898;</span> </td> <tr><td> <code title="">gla;</code> </td> <td> U+02AA5 </td> <td> <span>&#10917;</span> </td> <tr><td> <code title="">glj;</code> </td> <td> U+02AA4 </td> <td> <span>&#10916;</span> </td> <tr><td> <code title="">gnE;</code> </td> <td> U+02269 </td> <td> <span>&#8809;</span> </td> <tr><td> <code title="">gnap;</code> </td> <td> U+02A8A </td> <td> <span>&#10890;</span> </td> <tr><td> <code title="">gnapprox;</code> </td> <td> U+02A8A </td> <td> <span>&#10890;</span> </td> <tr><td> <code title="">gne;</code> </td> <td> U+02A88 </td> <td> <span>&#10888;</span> </td> <tr><td> <code title="">gneq;</code> </td> <td> U+02A88 </td> <td> <span>&#10888;</span> </td> <tr><td> <code title="">gneqq;</code> </td> <td> U+02269 </td> <td> <span>&#8809;</span> </td> <tr><td> <code title="">gnsim;</code> </td> <td> U+022E7 </td> <td> <span>&#8935;</span> </td> <tr><td> <code title="">gopf;</code> </td> <td> U+1D558 </td> <td> <span>&#120152;</span> </td> <tr><td> <code title="">grave;</code> </td> <td> U+00060 </td> <td> <span>`</span> </td> <tr><td> <code title="">gscr;</code> </td> <td> U+0210A </td> <td> <span>&#8458;</span> </td> <tr><td> <code title="">gsim;</code> </td> <td> U+02273 </td> <td> <span>&#8819;</span> </td> <tr><td> <code title="">gsime;</code> </td> <td> U+02A8E </td> <td> <span>&#10894;</span> </td> <tr><td> <code title="">gsiml;</code> </td> <td> U+02A90 </td> <td> <span>&#10896;</span> </td> <tr><td> <code title="">gt;</code> </td> <td> U+0003E </td> <td> <span>&gt;</span> </td> <tr class=impl><td> <code title="">gt</code> </td> <td> U+0003E </td> <td> <span title="">&gt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">gtcc;</code> </td> <td> U+02AA7 </td> <td> <span>&#10919;</span> </td> <tr><td> <code title="">gtcir;</code> </td> <td> U+02A7A </td> <td> <span>&#10874;</span> </td> <tr><td> <code title="">gtdot;</code> </td> <td> U+022D7 </td> <td> <span>&#8919;</span> </td> <tr><td> <code title="">gtlPar;</code> </td> <td> U+02995 </td> <td> <span>&#10645;</span> </td> <tr><td> <code title="">gtquest;</code> </td> <td> U+02A7C </td> <td> <span>&#10876;</span> </td> <tr><td> <code title="">gtrapprox;</code> </td> <td> U+02A86 </td> <td> <span>&#10886;</span> </td> <tr><td> <code title="">gtrarr;</code> </td> <td> U+02978 </td> <td> <span>&#10616;</span> </td> <tr><td> <code title="">gtrdot;</code> </td> <td> U+022D7 </td> <td> <span>&#8919;</span> </td> <tr><td> <code title="">gtreqless;</code> </td> <td> U+022DB </td> <td> <span>&#8923;</span> </td> <tr><td> <code title="">gtreqqless;</code> </td> <td> U+02A8C </td> <td> <span>&#10892;</span> </td> <tr><td> <code title="">gtrless;</code> </td> <td> U+02277 </td> <td> <span>&#8823;</span> </td> <tr><td> <code title="">gtrsim;</code> </td> <td> U+02273 </td> <td> <span>&#8819;</span> </td> <tr><td> <code title="">hArr;</code> </td> <td> U+021D4 </td> <td> <span>&hArr;</span> </td> <tr><td> <code title="">hairsp;</code> </td> <td> U+0200A </td> <td> <span>&#8202;</span> </td> <tr><td> <code title="">half;</code> </td> <td> U+000BD </td> <td> <span>&frac12;</span> </td> <tr><td> <code title="">hamilt;</code> </td> <td> U+0210B </td> <td> <span>&#8459;</span> </td> <tr><td> <code title="">hardcy;</code> </td> <td> U+0044A </td> <td> <span>&#1098;</span> </td> <tr><td> <code title="">harr;</code> </td> <td> U+02194 </td> <td> <span>&harr;</span> </td> <tr><td> <code title="">harrcir;</code> </td> <td> U+02948 </td> <td> <span>&#10568;</span> </td> <tr><td> <code title="">harrw;</code> </td> <td> U+021AD </td> <td> <span>&#8621;</span> </td> <tr><td> <code title="">hbar;</code> </td> <td> U+0210F </td> <td> <span>&#8463;</span> </td> <tr><td> <code title="">hcirc;</code> </td> <td> U+00125 </td> <td> <span>&#293;</span> </td> <tr><td> <code title="">hearts;</code> </td> <td> U+02665 </td> <td> <span>&hearts;</span> </td> <tr><td> <code title="">heartsuit;</code> </td> <td> U+02665 </td> <td> <span>&hearts;</span> </td> <tr><td> <code title="">hellip;</code> </td> <td> U+02026 </td> <td> <span>&hellip;</span> </td> <tr><td> <code title="">hercon;</code> </td> <td> U+022B9 </td> <td> <span>&#8889;</span> </td> <tr><td> <code title="">hfr;</code> </td> <td> U+1D525 </td> <td> <span>&#120101;</span> </td> <tr><td> <code title="">hksearow;</code> </td> <td> U+02925 </td> <td> <span>&#10533;</span> </td> <tr><td> <code title="">hkswarow;</code> </td> <td> U+02926 </td> <td> <span>&#10534;</span> </td> <tr><td> <code title="">hoarr;</code> </td> <td> U+021FF </td> <td> <span>&#8703;</span> </td> <tr><td> <code title="">homtht;</code> </td> <td> U+0223B </td> <td> <span>&#8763;</span> </td> <tr><td> <code title="">hookleftarrow;</code> </td> <td> U+021A9 </td> <td> <span>&#8617;</span> </td> <tr><td> <code title="">hookrightarrow;</code> </td> <td> U+021AA </td> <td> <span>&#8618;</span> </td> <tr><td> <code title="">hopf;</code> </td> <td> U+1D559 </td> <td> <span>&#120153;</span> </td> <tr><td> <code title="">horbar;</code> </td> <td> U+02015 </td> <td> <span>&#8213;</span> </td> <tr><td> <code title="">hscr;</code> </td> <td> U+1D4BD </td> <td> <span>&#119997;</span> </td> <tr><td> <code title="">hslash;</code> </td> <td> U+0210F </td> <td> <span>&#8463;</span> </td> <tr><td> <code title="">hstrok;</code> </td> <td> U+00127 </td> <td> <span>&#295;</span> </td> <tr><td> <code title="">hybull;</code> </td> <td> U+02043 </td> <td> <span>&#8259;</span> </td> <tr><td> <code title="">hyphen;</code> </td> <td> U+02010 </td> <td> <span>&#8208;</span> </td> <tr><td> <code title="">iacute;</code> </td> <td> U+000ED </td> <td> <span>&iacute;</span> </td> <tr class=impl><td> <code title="">iacute</code> </td> <td> U+000ED </td> <td> <span title="">&iacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ic;</code> </td> <td> U+02063 </td> <td> <span>&#8291;</span> </td> <tr><td> <code title="">icirc;</code> </td> <td> U+000EE </td> <td> <span>&icirc;</span> </td> <tr class=impl><td> <code title="">icirc</code> </td> <td> U+000EE </td> <td> <span title="">&icirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">icy;</code> </td> <td> U+00438 </td> <td> <span>&#1080;</span> </td> <tr><td> <code title="">iecy;</code> </td> <td> U+00435 </td> <td> <span>&#1077;</span> </td> <tr><td> <code title="">iexcl;</code> </td> <td> U+000A1 </td> <td> <span>&iexcl;</span> </td> <tr class=impl><td> <code title="">iexcl</code> </td> <td> U+000A1 </td> <td> <span title="">&iexcl;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">iff;</code> </td> <td> U+021D4 </td> <td> <span>&hArr;</span> </td> <tr><td> <code title="">ifr;</code> </td> <td> U+1D526 </td> <td> <span>&#120102;</span> </td> <tr><td> <code title="">igrave;</code> </td> <td> U+000EC </td> <td> <span>&igrave;</span> </td> <tr class=impl><td> <code title="">igrave</code> </td> <td> U+000EC </td> <td> <span title="">&igrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ii;</code> </td> <td> U+02148 </td> <td> <span>&#8520;</span> </td> <tr><td> <code title="">iiiint;</code> </td> <td> U+02A0C </td> <td> <span>&#10764;</span> </td> <tr><td> <code title="">iiint;</code> </td> <td> U+0222D </td> <td> <span>&#8749;</span> </td> <tr><td> <code title="">iinfin;</code> </td> <td> U+029DC </td> <td> <span>&#10716;</span> </td> <tr><td> <code title="">iiota;</code> </td> <td> U+02129 </td> <td> <span>&#8489;</span> </td> <tr><td> <code title="">ijlig;</code> </td> <td> U+00133 </td> <td> <span>&#307;</span> </td> <tr><td> <code title="">imacr;</code> </td> <td> U+0012B </td> <td> <span>&#299;</span> </td> <tr><td> <code title="">image;</code> </td> <td> U+02111 </td> <td> <span>&image;</span> </td> <tr><td> <code title="">imagline;</code> </td> <td> U+02110 </td> <td> <span>&#8464;</span> </td> <tr><td> <code title="">imagpart;</code> </td> <td> U+02111 </td> <td> <span>&image;</span> </td> <tr><td> <code title="">imath;</code> </td> <td> U+00131 </td> <td> <span>&#305;</span> </td> <tr><td> <code title="">imof;</code> </td> <td> U+022B7 </td> <td> <span>&#8887;</span> </td> <tr><td> <code title="">imped;</code> </td> <td> U+001B5 </td> <td> <span>&#437;</span> </td> <tr><td> <code title="">in;</code> </td> <td> U+02208 </td> <td> <span>&isin;</span> </td> <tr><td> <code title="">incare;</code> </td> <td> U+02105 </td> <td> <span>&#8453;</span> </td> <tr><td> <code title="">infin;</code> </td> <td> U+0221E </td> <td> <span>&infin;</span> </td> <tr><td> <code title="">infintie;</code> </td> <td> U+029DD </td> <td> <span>&#10717;</span> </td> <tr><td> <code title="">inodot;</code> </td> <td> U+00131 </td> <td> <span>&#305;</span> </td> <tr><td> <code title="">int;</code> </td> <td> U+0222B </td> <td> <span>&int;</span> </td> <tr><td> <code title="">intcal;</code> </td> <td> U+022BA </td> <td> <span>&#8890;</span> </td> <tr><td> <code title="">integers;</code> </td> <td> U+02124 </td> <td> <span>&#8484;</span> </td> <tr><td> <code title="">intercal;</code> </td> <td> U+022BA </td> <td> <span>&#8890;</span> </td> <tr><td> <code title="">intlarhk;</code> </td> <td> U+02A17 </td> <td> <span>&#10775;</span> </td> <tr><td> <code title="">intprod;</code> </td> <td> U+02A3C </td> <td> <span>&#10812;</span> </td> <tr><td> <code title="">iocy;</code> </td> <td> U+00451 </td> <td> <span>&#1105;</span> </td> <tr><td> <code title="">iogon;</code> </td> <td> U+0012F </td> <td> <span>&#303;</span> </td> <tr><td> <code title="">iopf;</code> </td> <td> U+1D55A </td> <td> <span>&#120154;</span> </td> <tr><td> <code title="">iota;</code> </td> <td> U+003B9 </td> <td> <span>&iota;</span> </td> <tr><td> <code title="">iprod;</code> </td> <td> U+02A3C </td> <td> <span>&#10812;</span> </td> <tr><td> <code title="">iquest;</code> </td> <td> U+000BF </td> <td> <span>&iquest;</span> </td> <tr class=impl><td> <code title="">iquest</code> </td> <td> U+000BF </td> <td> <span title="">&iquest;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">iscr;</code> </td> <td> U+1D4BE </td> <td> <span>&#119998;</span> </td> <tr><td> <code title="">isin;</code> </td> <td> U+02208 </td> <td> <span>&isin;</span> </td> <tr><td> <code title="">isinE;</code> </td> <td> U+022F9 </td> <td> <span>&#8953;</span> </td> <tr><td> <code title="">isindot;</code> </td> <td> U+022F5 </td> <td> <span>&#8949;</span> </td> <tr><td> <code title="">isins;</code> </td> <td> U+022F4 </td> <td> <span>&#8948;</span> </td> <tr><td> <code title="">isinsv;</code> </td> <td> U+022F3 </td> <td> <span>&#8947;</span> </td> <tr><td> <code title="">isinv;</code> </td> <td> U+02208 </td> <td> <span>&isin;</span> </td> <tr><td> <code title="">it;</code> </td> <td> U+02062 </td> <td> <span>&#8290;</span> </td> <tr><td> <code title="">itilde;</code> </td> <td> U+00129 </td> <td> <span>&#297;</span> </td> <tr><td> <code title="">iukcy;</code> </td> <td> U+00456 </td> <td> <span>&#1110;</span> </td> <tr><td> <code title="">iuml;</code> </td> <td> U+000EF </td> <td> <span>&iuml;</span> </td> <tr class=impl><td> <code title="">iuml</code> </td> <td> U+000EF </td> <td> <span title="">&iuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">jcirc;</code> </td> <td> U+00135 </td> <td> <span>&#309;</span> </td> <tr><td> <code title="">jcy;</code> </td> <td> U+00439 </td> <td> <span>&#1081;</span> </td> <tr><td> <code title="">jfr;</code> </td> <td> U+1D527 </td> <td> <span>&#120103;</span> </td> <tr><td> <code title="">jmath;</code> </td> <td> U+00237 </td> <td> <span>&#567;</span> </td> <tr><td> <code title="">jopf;</code> </td> <td> U+1D55B </td> <td> <span>&#120155;</span> </td> <tr><td> <code title="">jscr;</code> </td> <td> U+1D4BF </td> <td> <span>&#119999;</span> </td> <tr><td> <code title="">jsercy;</code> </td> <td> U+00458 </td> <td> <span>&#1112;</span> </td> <tr><td> <code title="">jukcy;</code> </td> <td> U+00454 </td> <td> <span>&#1108;</span> </td> <tr><td> <code title="">kappa;</code> </td> <td> U+003BA </td> <td> <span>&kappa;</span> </td> <tr><td> <code title="">kappav;</code> </td> <td> U+003F0 </td> <td> <span>&#1008;</span> </td> <tr><td> <code title="">kcedil;</code> </td> <td> U+00137 </td> <td> <span>&#311;</span> </td> <tr><td> <code title="">kcy;</code> </td> <td> U+0043A </td> <td> <span>&#1082;</span> </td> <tr><td> <code title="">kfr;</code> </td> <td> U+1D528 </td> <td> <span>&#120104;</span> </td> <tr><td> <code title="">kgreen;</code> </td> <td> U+00138 </td> <td> <span>&#312;</span> </td> <tr><td> <code title="">khcy;</code> </td> <td> U+00445 </td> <td> <span>&#1093;</span> </td> <tr><td> <code title="">kjcy;</code> </td> <td> U+0045C </td> <td> <span>&#1116;</span> </td> <tr><td> <code title="">kopf;</code> </td> <td> U+1D55C </td> <td> <span>&#120156;</span> </td> <tr><td> <code title="">kscr;</code> </td> <td> U+1D4C0 </td> <td> <span>&#120000;</span> </td> <tr><td> <code title="">lAarr;</code> </td> <td> U+021DA </td> <td> <span>&#8666;</span> </td> <tr><td> <code title="">lArr;</code> </td> <td> U+021D0 </td> <td> <span>&lArr;</span> </td> <tr><td> <code title="">lAtail;</code> </td> <td> U+0291B </td> <td> <span>&#10523;</span> </td> <tr><td> <code title="">lBarr;</code> </td> <td> U+0290E </td> <td> <span>&#10510;</span> </td> <tr><td> <code title="">lE;</code> </td> <td> U+02266 </td> <td> <span>&#8806;</span> </td> <tr><td> <code title="">lEg;</code> </td> <td> U+02A8B </td> <td> <span>&#10891;</span> </td> <tr><td> <code title="">lHar;</code> </td> <td> U+02962 </td> <td> <span>&#10594;</span> </td> <tr><td> <code title="">lacute;</code> </td> <td> U+0013A </td> <td> <span>&#314;</span> </td> <tr><td> <code title="">laemptyv;</code> </td> <td> U+029B4 </td> <td> <span>&#10676;</span> </td> <tr><td> <code title="">lagran;</code> </td> <td> U+02112 </td> <td> <span>&#8466;</span> </td> <tr><td> <code title="">lambda;</code> </td> <td> U+003BB </td> <td> <span>&lambda;</span> </td> <tr><td> <code title="">lang;</code> </td> <td> U+027E8 </td> <td> <span>&lang;</span> </td> <tr><td> <code title="">langd;</code> </td> <td> U+02991 </td> <td> <span>&#10641;</span> </td> <tr><td> <code title="">langle;</code> </td> <td> U+027E8 </td> <td> <span>&lang;</span> </td> <tr><td> <code title="">lap;</code> </td> <td> U+02A85 </td> <td> <span>&#10885;</span> </td> <tr><td> <code title="">laquo;</code> </td> <td> U+000AB </td> <td> <span>&laquo;</span> </td> <tr class=impl><td> <code title="">laquo</code> </td> <td> U+000AB </td> <td> <span title="">&laquo;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">larr;</code> </td> <td> U+02190 </td> <td> <span>&larr;</span> </td> <tr><td> <code title="">larrb;</code> </td> <td> U+021E4 </td> <td> <span>&#8676;</span> </td> <tr><td> <code title="">larrbfs;</code> </td> <td> U+0291F </td> <td> <span>&#10527;</span> </td> <tr><td> <code title="">larrfs;</code> </td> <td> U+0291D </td> <td> <span>&#10525;</span> </td> <tr><td> <code title="">larrhk;</code> </td> <td> U+021A9 </td> <td> <span>&#8617;</span> </td> <tr><td> <code title="">larrlp;</code> </td> <td> U+021AB </td> <td> <span>&#8619;</span> </td> <tr><td> <code title="">larrpl;</code> </td> <td> U+02939 </td> <td> <span>&#10553;</span> </td> <tr><td> <code title="">larrsim;</code> </td> <td> U+02973 </td> <td> <span>&#10611;</span> </td> <tr><td> <code title="">larrtl;</code> </td> <td> U+021A2 </td> <td> <span>&#8610;</span> </td> <tr><td> <code title="">lat;</code> </td> <td> U+02AAB </td> <td> <span>&#10923;</span> </td> <tr><td> <code title="">latail;</code> </td> <td> U+02919 </td> <td> <span>&#10521;</span> </td> <tr><td> <code title="">late;</code> </td> <td> U+02AAD </td> <td> <span>&#10925;</span> </td> <tr><td> <code title="">lbarr;</code> </td> <td> U+0290C </td> <td> <span>&#10508;</span> </td> <tr><td> <code title="">lbbrk;</code> </td> <td> U+02772 </td> <td> <span>&#10098;</span> </td> <tr><td> <code title="">lbrace;</code> </td> <td> U+0007B </td> <td> <span>{</span> </td> <tr><td> <code title="">lbrack;</code> </td> <td> U+0005B </td> <td> <span>[</span> </td> <tr><td> <code title="">lbrke;</code> </td> <td> U+0298B </td> <td> <span>&#10635;</span> </td> <tr><td> <code title="">lbrksld;</code> </td> <td> U+0298F </td> <td> <span>&#10639;</span> </td> <tr><td> <code title="">lbrkslu;</code> </td> <td> U+0298D </td> <td> <span>&#10637;</span> </td> <tr><td> <code title="">lcaron;</code> </td> <td> U+0013E </td> <td> <span>&#318;</span> </td> <tr><td> <code title="">lcedil;</code> </td> <td> U+0013C </td> <td> <span>&#316;</span> </td> <tr><td> <code title="">lceil;</code> </td> <td> U+02308 </td> <td> <span>&lceil;</span> </td> <tr><td> <code title="">lcub;</code> </td> <td> U+0007B </td> <td> <span>{</span> </td> <tr><td> <code title="">lcy;</code> </td> <td> U+0043B </td> <td> <span>&#1083;</span> </td> <tr><td> <code title="">ldca;</code> </td> <td> U+02936 </td> <td> <span>&#10550;</span> </td> <tr><td> <code title="">ldquo;</code> </td> <td> U+0201C </td> <td> <span>&ldquo;</span> </td> <tr><td> <code title="">ldquor;</code> </td> <td> U+0201E </td> <td> <span>&bdquo;</span> </td> <tr><td> <code title="">ldrdhar;</code> </td> <td> U+02967 </td> <td> <span>&#10599;</span> </td> <tr><td> <code title="">ldrushar;</code> </td> <td> U+0294B </td> <td> <span>&#10571;</span> </td> <tr><td> <code title="">ldsh;</code> </td> <td> U+021B2 </td> <td> <span>&#8626;</span> </td> <tr><td> <code title="">le;</code> </td> <td> U+02264 </td> <td> <span>&le;</span> </td> <tr><td> <code title="">leftarrow;</code> </td> <td> U+02190 </td> <td> <span>&larr;</span> </td> <tr><td> <code title="">leftarrowtail;</code> </td> <td> U+021A2 </td> <td> <span>&#8610;</span> </td> <tr><td> <code title="">leftharpoondown;</code> </td> <td> U+021BD </td> <td> <span>&#8637;</span> </td> <tr><td> <code title="">leftharpoonup;</code> </td> <td> U+021BC </td> <td> <span>&#8636;</span> </td> <tr><td> <code title="">leftleftarrows;</code> </td> <td> U+021C7 </td> <td> <span>&#8647;</span> </td> <tr><td> <code title="">leftrightarrow;</code> </td> <td> U+02194 </td> <td> <span>&harr;</span> </td> <tr><td> <code title="">leftrightarrows;</code> </td> <td> U+021C6 </td> <td> <span>&#8646;</span> </td> <tr><td> <code title="">leftrightharpoons;</code> </td> <td> U+021CB </td> <td> <span>&#8651;</span> </td> <tr><td> <code title="">leftrightsquigarrow;</code> </td> <td> U+021AD </td> <td> <span>&#8621;</span> </td> <tr><td> <code title="">leftthreetimes;</code> </td> <td> U+022CB </td> <td> <span>&#8907;</span> </td> <tr><td> <code title="">leg;</code> </td> <td> U+022DA </td> <td> <span>&#8922;</span> </td> <tr><td> <code title="">leq;</code> </td> <td> U+02264 </td> <td> <span>&le;</span> </td> <tr><td> <code title="">leqq;</code> </td> <td> U+02266 </td> <td> <span>&#8806;</span> </td> <tr><td> <code title="">leqslant;</code> </td> <td> U+02A7D </td> <td> <span>&#10877;</span> </td> <tr><td> <code title="">les;</code> </td> <td> U+02A7D </td> <td> <span>&#10877;</span> </td> <tr><td> <code title="">lescc;</code> </td> <td> U+02AA8 </td> <td> <span>&#10920;</span> </td> <tr><td> <code title="">lesdot;</code> </td> <td> U+02A7F </td> <td> <span>&#10879;</span> </td> <tr><td> <code title="">lesdoto;</code> </td> <td> U+02A81 </td> <td> <span>&#10881;</span> </td> <tr><td> <code title="">lesdotor;</code> </td> <td> U+02A83 </td> <td> <span>&#10883;</span> </td> <tr><td> <code title="">lesges;</code> </td> <td> U+02A93 </td> <td> <span>&#10899;</span> </td> <tr><td> <code title="">lessapprox;</code> </td> <td> U+02A85 </td> <td> <span>&#10885;</span> </td> <tr><td> <code title="">lessdot;</code> </td> <td> U+022D6 </td> <td> <span>&#8918;</span> </td> <tr><td> <code title="">lesseqgtr;</code> </td> <td> U+022DA </td> <td> <span>&#8922;</span> </td> <tr><td> <code title="">lesseqqgtr;</code> </td> <td> U+02A8B </td> <td> <span>&#10891;</span> </td> <tr><td> <code title="">lessgtr;</code> </td> <td> U+02276 </td> <td> <span>&#8822;</span> </td> <tr><td> <code title="">lesssim;</code> </td> <td> U+02272 </td> <td> <span>&#8818;</span> </td> <tr><td> <code title="">lfisht;</code> </td> <td> U+0297C </td> <td> <span>&#10620;</span> </td> <tr><td> <code title="">lfloor;</code> </td> <td> U+0230A </td> <td> <span>&lfloor;</span> </td> <tr><td> <code title="">lfr;</code> </td> <td> U+1D529 </td> <td> <span>&#120105;</span> </td> <tr><td> <code title="">lg;</code> </td> <td> U+02276 </td> <td> <span>&#8822;</span> </td> <tr><td> <code title="">lgE;</code> </td> <td> U+02A91 </td> <td> <span>&#10897;</span> </td> <tr><td> <code title="">lhard;</code> </td> <td> U+021BD </td> <td> <span>&#8637;</span> </td> <tr><td> <code title="">lharu;</code> </td> <td> U+021BC </td> <td> <span>&#8636;</span> </td> <tr><td> <code title="">lharul;</code> </td> <td> U+0296A </td> <td> <span>&#10602;</span> </td> <tr><td> <code title="">lhblk;</code> </td> <td> U+02584 </td> <td> <span>&#9604;</span> </td> <tr><td> <code title="">ljcy;</code> </td> <td> U+00459 </td> <td> <span>&#1113;</span> </td> <tr><td> <code title="">ll;</code> </td> <td> U+0226A </td> <td> <span>&#8810;</span> </td> <tr><td> <code title="">llarr;</code> </td> <td> U+021C7 </td> <td> <span>&#8647;</span> </td> <tr><td> <code title="">llcorner;</code> </td> <td> U+0231E </td> <td> <span>&#8990;</span> </td> <tr><td> <code title="">llhard;</code> </td> <td> U+0296B </td> <td> <span>&#10603;</span> </td> <tr><td> <code title="">lltri;</code> </td> <td> U+025FA </td> <td> <span>&#9722;</span> </td> <tr><td> <code title="">lmidot;</code> </td> <td> U+00140 </td> <td> <span>&#320;</span> </td> <tr><td> <code title="">lmoust;</code> </td> <td> U+023B0 </td> <td> <span>&#9136;</span> </td> <tr><td> <code title="">lmoustache;</code> </td> <td> U+023B0 </td> <td> <span>&#9136;</span> </td> <tr><td> <code title="">lnE;</code> </td> <td> U+02268 </td> <td> <span>&#8808;</span> </td> <tr><td> <code title="">lnap;</code> </td> <td> U+02A89 </td> <td> <span>&#10889;</span> </td> <tr><td> <code title="">lnapprox;</code> </td> <td> U+02A89 </td> <td> <span>&#10889;</span> </td> <tr><td> <code title="">lne;</code> </td> <td> U+02A87 </td> <td> <span>&#10887;</span> </td> <tr><td> <code title="">lneq;</code> </td> <td> U+02A87 </td> <td> <span>&#10887;</span> </td> <tr><td> <code title="">lneqq;</code> </td> <td> U+02268 </td> <td> <span>&#8808;</span> </td> <tr><td> <code title="">lnsim;</code> </td> <td> U+022E6 </td> <td> <span>&#8934;</span> </td> <tr><td> <code title="">loang;</code> </td> <td> U+027EC </td> <td> <span>&#10220;</span> </td> <tr><td> <code title="">loarr;</code> </td> <td> U+021FD </td> <td> <span>&#8701;</span> </td> <tr><td> <code title="">lobrk;</code> </td> <td> U+027E6 </td> <td> <span>&#10214;</span> </td> <tr><td> <code title="">longleftarrow;</code> </td> <td> U+027F5 </td> <td> <span>&#10229;</span> </td> <tr><td> <code title="">longleftrightarrow;</code> </td> <td> U+027F7 </td> <td> <span>&#10231;</span> </td> <tr><td> <code title="">longmapsto;</code> </td> <td> U+027FC </td> <td> <span>&#10236;</span> </td> <tr><td> <code title="">longrightarrow;</code> </td> <td> U+027F6 </td> <td> <span>&#10230;</span> </td> <tr><td> <code title="">looparrowleft;</code> </td> <td> U+021AB </td> <td> <span>&#8619;</span> </td> <tr><td> <code title="">looparrowright;</code> </td> <td> U+021AC </td> <td> <span>&#8620;</span> </td> <tr><td> <code title="">lopar;</code> </td> <td> U+02985 </td> <td> <span>&#10629;</span> </td> <tr><td> <code title="">lopf;</code> </td> <td> U+1D55D </td> <td> <span>&#120157;</span> </td> <tr><td> <code title="">loplus;</code> </td> <td> U+02A2D </td> <td> <span>&#10797;</span> </td> <tr><td> <code title="">lotimes;</code> </td> <td> U+02A34 </td> <td> <span>&#10804;</span> </td> <tr><td> <code title="">lowast;</code> </td> <td> U+02217 </td> <td> <span>&lowast;</span> </td> <tr><td> <code title="">lowbar;</code> </td> <td> U+0005F </td> <td> <span>_</span> </td> <tr><td> <code title="">loz;</code> </td> <td> U+025CA </td> <td> <span>&loz;</span> </td> <tr><td> <code title="">lozenge;</code> </td> <td> U+025CA </td> <td> <span>&loz;</span> </td> <tr><td> <code title="">lozf;</code> </td> <td> U+029EB </td> <td> <span>&#10731;</span> </td> <tr><td> <code title="">lpar;</code> </td> <td> U+00028 </td> <td> <span>(</span> </td> <tr><td> <code title="">lparlt;</code> </td> <td> U+02993 </td> <td> <span>&#10643;</span> </td> <tr><td> <code title="">lrarr;</code> </td> <td> U+021C6 </td> <td> <span>&#8646;</span> </td> <tr><td> <code title="">lrcorner;</code> </td> <td> U+0231F </td> <td> <span>&#8991;</span> </td> <tr><td> <code title="">lrhar;</code> </td> <td> U+021CB </td> <td> <span>&#8651;</span> </td> <tr><td> <code title="">lrhard;</code> </td> <td> U+0296D </td> <td> <span>&#10605;</span> </td> <tr><td> <code title="">lrm;</code> </td> <td> U+0200E </td> <td> <span>&lrm;</span> </td> <tr><td> <code title="">lrtri;</code> </td> <td> U+022BF </td> <td> <span>&#8895;</span> </td> <tr><td> <code title="">lsaquo;</code> </td> <td> U+02039 </td> <td> <span>&lsaquo;</span> </td> <tr><td> <code title="">lscr;</code> </td> <td> U+1D4C1 </td> <td> <span>&#120001;</span> </td> <tr><td> <code title="">lsh;</code> </td> <td> U+021B0 </td> <td> <span>&#8624;</span> </td> <tr><td> <code title="">lsim;</code> </td> <td> U+02272 </td> <td> <span>&#8818;</span> </td> <tr><td> <code title="">lsime;</code> </td> <td> U+02A8D </td> <td> <span>&#10893;</span> </td> <tr><td> <code title="">lsimg;</code> </td> <td> U+02A8F </td> <td> <span>&#10895;</span> </td> <tr><td> <code title="">lsqb;</code> </td> <td> U+0005B </td> <td> <span>[</span> </td> <tr><td> <code title="">lsquo;</code> </td> <td> U+02018 </td> <td> <span>&lsquo;</span> </td> <tr><td> <code title="">lsquor;</code> </td> <td> U+0201A </td> <td> <span>&sbquo;</span> </td> <tr><td> <code title="">lstrok;</code> </td> <td> U+00142 </td> <td> <span>&#322;</span> </td> <tr><td> <code title="">lt;</code> </td> <td> U+0003C </td> <td> <span>&lt;</span> </td> <tr class=impl><td> <code title="">lt</code> </td> <td> U+0003C </td> <td> <span title="">&lt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ltcc;</code> </td> <td> U+02AA6 </td> <td> <span>&#10918;</span> </td> <tr><td> <code title="">ltcir;</code> </td> <td> U+02A79 </td> <td> <span>&#10873;</span> </td> <tr><td> <code title="">ltdot;</code> </td> <td> U+022D6 </td> <td> <span>&#8918;</span> </td> <tr><td> <code title="">lthree;</code> </td> <td> U+022CB </td> <td> <span>&#8907;</span> </td> <tr><td> <code title="">ltimes;</code> </td> <td> U+022C9 </td> <td> <span>&#8905;</span> </td> <tr><td> <code title="">ltlarr;</code> </td> <td> U+02976 </td> <td> <span>&#10614;</span> </td> <tr><td> <code title="">ltquest;</code> </td> <td> U+02A7B </td> <td> <span>&#10875;</span> </td> <tr><td> <code title="">ltrPar;</code> </td> <td> U+02996 </td> <td> <span>&#10646;</span> </td> <tr><td> <code title="">ltri;</code> </td> <td> U+025C3 </td> <td> <span>&#9667;</span> </td> <tr><td> <code title="">ltrie;</code> </td> <td> U+022B4 </td> <td> <span>&#8884;</span> </td> <tr><td> <code title="">ltrif;</code> </td> <td> U+025C2 </td> <td> <span>&#9666;</span> </td> <tr><td> <code title="">lurdshar;</code> </td> <td> U+0294A </td> <td> <span>&#10570;</span> </td> <tr><td> <code title="">luruhar;</code> </td> <td> U+02966 </td> <td> <span>&#10598;</span> </td> <tr><td> <code title="">mDDot;</code> </td> <td> U+0223A </td> <td> <span>&#8762;</span> </td> <tr><td> <code title="">macr;</code> </td> <td> U+000AF </td> <td> <span>&macr;</span> </td> <tr class=impl><td> <code title="">macr</code> </td> <td> U+000AF </td> <td> <span title="">&macr;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">male;</code> </td> <td> U+02642 </td> <td> <span>&#9794;</span> </td> <tr><td> <code title="">malt;</code> </td> <td> U+02720 </td> <td> <span>&#10016;</span> </td> <tr><td> <code title="">maltese;</code> </td> <td> U+02720 </td> <td> <span>&#10016;</span> </td> <tr><td> <code title="">map;</code> </td> <td> U+021A6 </td> <td> <span>&#8614;</span> </td> <tr><td> <code title="">mapsto;</code> </td> <td> U+021A6 </td> <td> <span>&#8614;</span> </td> <tr><td> <code title="">mapstodown;</code> </td> <td> U+021A7 </td> <td> <span>&#8615;</span> </td> <tr><td> <code title="">mapstoleft;</code> </td> <td> U+021A4 </td> <td> <span>&#8612;</span> </td> <tr><td> <code title="">mapstoup;</code> </td> <td> U+021A5 </td> <td> <span>&#8613;</span> </td> <tr><td> <code title="">marker;</code> </td> <td> U+025AE </td> <td> <span>&#9646;</span> </td> <tr><td> <code title="">mcomma;</code> </td> <td> U+02A29 </td> <td> <span>&#10793;</span> </td> <tr><td> <code title="">mcy;</code> </td> <td> U+0043C </td> <td> <span>&#1084;</span> </td> <tr><td> <code title="">mdash;</code> </td> <td> U+02014 </td> <td> <span>&mdash;</span> </td> <tr><td> <code title="">measuredangle;</code> </td> <td> U+02221 </td> <td> <span>&#8737;</span> </td> <tr><td> <code title="">mfr;</code> </td> <td> U+1D52A </td> <td> <span>&#120106;</span> </td> <tr><td> <code title="">mho;</code> </td> <td> U+02127 </td> <td> <span>&#8487;</span> </td> <tr><td> <code title="">micro;</code> </td> <td> U+000B5 </td> <td> <span>&micro;</span> </td> <tr class=impl><td> <code title="">micro</code> </td> <td> U+000B5 </td> <td> <span title="">&micro;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">mid;</code> </td> <td> U+02223 </td> <td> <span>&#8739;</span> </td> <tr><td> <code title="">midast;</code> </td> <td> U+0002A </td> <td> <span>*</span> </td> <tr><td> <code title="">midcir;</code> </td> <td> U+02AF0 </td> <td> <span>&#10992;</span> </td> <tr><td> <code title="">middot;</code> </td> <td> U+000B7 </td> <td> <span>&middot;</span> </td> <tr class=impl><td> <code title="">middot</code> </td> <td> U+000B7 </td> <td> <span title="">&middot;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">minus;</code> </td> <td> U+02212 </td> <td> <span>&minus;</span> </td> <tr><td> <code title="">minusb;</code> </td> <td> U+0229F </td> <td> <span>&#8863;</span> </td> <tr><td> <code title="">minusd;</code> </td> <td> U+02238 </td> <td> <span>&#8760;</span> </td> <tr><td> <code title="">minusdu;</code> </td> <td> U+02A2A </td> <td> <span>&#10794;</span> </td> <tr><td> <code title="">mlcp;</code> </td> <td> U+02ADB </td> <td> <span>&#10971;</span> </td> <tr><td> <code title="">mldr;</code> </td> <td> U+02026 </td> <td> <span>&hellip;</span> </td> <tr><td> <code title="">mnplus;</code> </td> <td> U+02213 </td> <td> <span>&#8723;</span> </td> <tr><td> <code title="">models;</code> </td> <td> U+022A7 </td> <td> <span>&#8871;</span> </td> <tr><td> <code title="">mopf;</code> </td> <td> U+1D55E </td> <td> <span>&#120158;</span> </td> <tr><td> <code title="">mp;</code> </td> <td> U+02213 </td> <td> <span>&#8723;</span> </td> <tr><td> <code title="">mscr;</code> </td> <td> U+1D4C2 </td> <td> <span>&#120002;</span> </td> <tr><td> <code title="">mstpos;</code> </td> <td> U+0223E </td> <td> <span>&#8766;</span> </td> <tr><td> <code title="">mu;</code> </td> <td> U+003BC </td> <td> <span>&mu;</span> </td> <tr><td> <code title="">multimap;</code> </td> <td> U+022B8 </td> <td> <span>&#8888;</span> </td> <tr><td> <code title="">mumap;</code> </td> <td> U+022B8 </td> <td> <span>&#8888;</span> </td> <tr><td> <code title="">nLeftarrow;</code> </td> <td> U+021CD </td> <td> <span>&#8653;</span> </td> <tr><td> <code title="">nLeftrightarrow;</code> </td> <td> U+021CE </td> <td> <span>&#8654;</span> </td> <tr><td> <code title="">nRightarrow;</code> </td> <td> U+021CF </td> <td> <span>&#8655;</span> </td> <tr><td> <code title="">nVDash;</code> </td> <td> U+022AF </td> <td> <span>&#8879;</span> </td> <tr><td> <code title="">nVdash;</code> </td> <td> U+022AE </td> <td> <span>&#8878;</span> </td> <tr><td> <code title="">nabla;</code> </td> <td> U+02207 </td> <td> <span>&nabla;</span> </td> <tr><td> <code title="">nacute;</code> </td> <td> U+00144 </td> <td> <span>&#324;</span> </td> <tr><td> <code title="">nap;</code> </td> <td> U+02249 </td> <td> <span>&#8777;</span> </td> <tr><td> <code title="">napos;</code> </td> <td> U+00149 </td> <td> <span>&#329;</span> </td> <tr><td> <code title="">napprox;</code> </td> <td> U+02249 </td> <td> <span>&#8777;</span> </td> <tr><td> <code title="">natur;</code> </td> <td> U+0266E </td> <td> <span>&#9838;</span> </td> <tr><td> <code title="">natural;</code> </td> <td> U+0266E </td> <td> <span>&#9838;</span> </td> <tr><td> <code title="">naturals;</code> </td> <td> U+02115 </td> <td> <span>&#8469;</span> </td> <tr><td> <code title="">nbsp;</code> </td> <td> U+000A0 </td> <td> <span>&nbsp;</span> </td> <tr class=impl><td> <code title="">nbsp</code> </td> <td> U+000A0 </td> <td> <span title="">&nbsp;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ncap;</code> </td> <td> U+02A43 </td> <td> <span>&#10819;</span> </td> <tr><td> <code title="">ncaron;</code> </td> <td> U+00148 </td> <td> <span>&#328;</span> </td> <tr><td> <code title="">ncedil;</code> </td> <td> U+00146 </td> <td> <span>&#326;</span> </td> <tr><td> <code title="">ncong;</code> </td> <td> U+02247 </td> <td> <span>&#8775;</span> </td> <tr><td> <code title="">ncup;</code> </td> <td> U+02A42 </td> <td> <span>&#10818;</span> </td> <tr><td> <code title="">ncy;</code> </td> <td> U+0043D </td> <td> <span>&#1085;</span> </td> <tr><td> <code title="">ndash;</code> </td> <td> U+02013 </td> <td> <span>&ndash;</span> </td> <tr><td> <code title="">ne;</code> </td> <td> U+02260 </td> <td> <span>&ne;</span> </td> <tr><td> <code title="">neArr;</code> </td> <td> U+021D7 </td> <td> <span>&#8663;</span> </td> <tr><td> <code title="">nearhk;</code> </td> <td> U+02924 </td> <td> <span>&#10532;</span> </td> <tr><td> <code title="">nearr;</code> </td> <td> U+02197 </td> <td> <span>&#8599;</span> </td> <tr><td> <code title="">nearrow;</code> </td> <td> U+02197 </td> <td> <span>&#8599;</span> </td> <tr><td> <code title="">nequiv;</code> </td> <td> U+02262 </td> <td> <span>&#8802;</span> </td> <tr><td> <code title="">nesear;</code> </td> <td> U+02928 </td> <td> <span>&#10536;</span> </td> <tr><td> <code title="">nexist;</code> </td> <td> U+02204 </td> <td> <span>&#8708;</span> </td> <tr><td> <code title="">nexists;</code> </td> <td> U+02204 </td> <td> <span>&#8708;</span> </td> <tr><td> <code title="">nfr;</code> </td> <td> U+1D52B </td> <td> <span>&#120107;</span> </td> <tr><td> <code title="">nge;</code> </td> <td> U+02271 </td> <td> <span>&#8817;</span> </td> <tr><td> <code title="">ngeq;</code> </td> <td> U+02271 </td> <td> <span>&#8817;</span> </td> <tr><td> <code title="">ngsim;</code> </td> <td> U+02275 </td> <td> <span>&#8821;</span> </td> <tr><td> <code title="">ngt;</code> </td> <td> U+0226F </td> <td> <span>&#8815;</span> </td> <tr><td> <code title="">ngtr;</code> </td> <td> U+0226F </td> <td> <span>&#8815;</span> </td> <tr><td> <code title="">nhArr;</code> </td> <td> U+021CE </td> <td> <span>&#8654;</span> </td> <tr><td> <code title="">nharr;</code> </td> <td> U+021AE </td> <td> <span>&#8622;</span> </td> <tr><td> <code title="">nhpar;</code> </td> <td> U+02AF2 </td> <td> <span>&#10994;</span> </td> <tr><td> <code title="">ni;</code> </td> <td> U+0220B </td> <td> <span>&ni;</span> </td> <tr><td> <code title="">nis;</code> </td> <td> U+022FC </td> <td> <span>&#8956;</span> </td> <tr><td> <code title="">nisd;</code> </td> <td> U+022FA </td> <td> <span>&#8954;</span> </td> <tr><td> <code title="">niv;</code> </td> <td> U+0220B </td> <td> <span>&ni;</span> </td> <tr><td> <code title="">njcy;</code> </td> <td> U+0045A </td> <td> <span>&#1114;</span> </td> <tr><td> <code title="">nlArr;</code> </td> <td> U+021CD </td> <td> <span>&#8653;</span> </td> <tr><td> <code title="">nlarr;</code> </td> <td> U+0219A </td> <td> <span>&#8602;</span> </td> <tr><td> <code title="">nldr;</code> </td> <td> U+02025 </td> <td> <span>&#8229;</span> </td> <tr><td> <code title="">nle;</code> </td> <td> U+02270 </td> <td> <span>&#8816;</span> </td> <tr><td> <code title="">nleftarrow;</code> </td> <td> U+0219A </td> <td> <span>&#8602;</span> </td> <tr><td> <code title="">nleftrightarrow;</code> </td> <td> U+021AE </td> <td> <span>&#8622;</span> </td> <tr><td> <code title="">nleq;</code> </td> <td> U+02270 </td> <td> <span>&#8816;</span> </td> <tr><td> <code title="">nless;</code> </td> <td> U+0226E </td> <td> <span>&#8814;</span> </td> <tr><td> <code title="">nlsim;</code> </td> <td> U+02274 </td> <td> <span>&#8820;</span> </td> <tr><td> <code title="">nlt;</code> </td> <td> U+0226E </td> <td> <span>&#8814;</span> </td> <tr><td> <code title="">nltri;</code> </td> <td> U+022EA </td> <td> <span>&#8938;</span> </td> <tr><td> <code title="">nltrie;</code> </td> <td> U+022EC </td> <td> <span>&#8940;</span> </td> <tr><td> <code title="">nmid;</code> </td> <td> U+02224 </td> <td> <span>&#8740;</span> </td> <tr><td> <code title="">nopf;</code> </td> <td> U+1D55F </td> <td> <span>&#120159;</span> </td> <tr><td> <code title="">not;</code> </td> <td> U+000AC </td> <td> <span>&not;</span> </td> <tr class=impl><td> <code title="">not</code> </td> <td> U+000AC </td> <td> <span title="">&not;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">notin;</code> </td> <td> U+02209 </td> <td> <span>&notin;</span> </td> <tr><td> <code title="">notinva;</code> </td> <td> U+02209 </td> <td> <span>&notin;</span> </td> <tr><td> <code title="">notinvb;</code> </td> <td> U+022F7 </td> <td> <span>&#8951;</span> </td> <tr><td> <code title="">notinvc;</code> </td> <td> U+022F6 </td> <td> <span>&#8950;</span> </td> <tr><td> <code title="">notni;</code> </td> <td> U+0220C </td> <td> <span>&#8716;</span> </td> <tr><td> <code title="">notniva;</code> </td> <td> U+0220C </td> <td> <span>&#8716;</span> </td> <tr><td> <code title="">notnivb;</code> </td> <td> U+022FE </td> <td> <span>&#8958;</span> </td> <tr><td> <code title="">notnivc;</code> </td> <td> U+022FD </td> <td> <span>&#8957;</span> </td> <tr><td> <code title="">npar;</code> </td> <td> U+02226 </td> <td> <span>&#8742;</span> </td> <tr><td> <code title="">nparallel;</code> </td> <td> U+02226 </td> <td> <span>&#8742;</span> </td> <tr><td> <code title="">npolint;</code> </td> <td> U+02A14 </td> <td> <span>&#10772;</span> </td> <tr><td> <code title="">npr;</code> </td> <td> U+02280 </td> <td> <span>&#8832;</span> </td> <tr><td> <code title="">nprcue;</code> </td> <td> U+022E0 </td> <td> <span>&#8928;</span> </td> <tr><td> <code title="">nprec;</code> </td> <td> U+02280 </td> <td> <span>&#8832;</span> </td> <tr><td> <code title="">nrArr;</code> </td> <td> U+021CF </td> <td> <span>&#8655;</span> </td> <tr><td> <code title="">nrarr;</code> </td> <td> U+0219B </td> <td> <span>&#8603;</span> </td> <tr><td> <code title="">nrightarrow;</code> </td> <td> U+0219B </td> <td> <span>&#8603;</span> </td> <tr><td> <code title="">nrtri;</code> </td> <td> U+022EB </td> <td> <span>&#8939;</span> </td> <tr><td> <code title="">nrtrie;</code> </td> <td> U+022ED </td> <td> <span>&#8941;</span> </td> <tr><td> <code title="">nsc;</code> </td> <td> U+02281 </td> <td> <span>&#8833;</span> </td> <tr><td> <code title="">nsccue;</code> </td> <td> U+022E1 </td> <td> <span>&#8929;</span> </td> <tr><td> <code title="">nscr;</code> </td> <td> U+1D4C3 </td> <td> <span>&#120003;</span> </td> <tr><td> <code title="">nshortmid;</code> </td> <td> U+02224 </td> <td> <span>&#8740;</span> </td> <tr><td> <code title="">nshortparallel;</code> </td> <td> U+02226 </td> <td> <span>&#8742;</span> </td> <tr><td> <code title="">nsim;</code> </td> <td> U+02241 </td> <td> <span>&#8769;</span> </td> <tr><td> <code title="">nsime;</code> </td> <td> U+02244 </td> <td> <span>&#8772;</span> </td> <tr><td> <code title="">nsimeq;</code> </td> <td> U+02244 </td> <td> <span>&#8772;</span> </td> <tr><td> <code title="">nsmid;</code> </td> <td> U+02224 </td> <td> <span>&#8740;</span> </td> <tr><td> <code title="">nspar;</code> </td> <td> U+02226 </td> <td> <span>&#8742;</span> </td> <tr><td> <code title="">nsqsube;</code> </td> <td> U+022E2 </td> <td> <span>&#8930;</span> </td> <tr><td> <code title="">nsqsupe;</code> </td> <td> U+022E3 </td> <td> <span>&#8931;</span> </td> <tr><td> <code title="">nsub;</code> </td> <td> U+02284 </td> <td> <span>&nsub;</span> </td> <tr><td> <code title="">nsube;</code> </td> <td> U+02288 </td> <td> <span>&#8840;</span> </td> <tr><td> <code title="">nsubseteq;</code> </td> <td> U+02288 </td> <td> <span>&#8840;</span> </td> <tr><td> <code title="">nsucc;</code> </td> <td> U+02281 </td> <td> <span>&#8833;</span> </td> <tr><td> <code title="">nsup;</code> </td> <td> U+02285 </td> <td> <span>&#8837;</span> </td> <tr><td> <code title="">nsupe;</code> </td> <td> U+02289 </td> <td> <span>&#8841;</span> </td> <tr><td> <code title="">nsupseteq;</code> </td> <td> U+02289 </td> <td> <span>&#8841;</span> </td> <tr><td> <code title="">ntgl;</code> </td> <td> U+02279 </td> <td> <span>&#8825;</span> </td> <tr><td> <code title="">ntilde;</code> </td> <td> U+000F1 </td> <td> <span>&ntilde;</span> </td> <tr class=impl><td> <code title="">ntilde</code> </td> <td> U+000F1 </td> <td> <span title="">&ntilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ntlg;</code> </td> <td> U+02278 </td> <td> <span>&#8824;</span> </td> <tr><td> <code title="">ntriangleleft;</code> </td> <td> U+022EA </td> <td> <span>&#8938;</span> </td> <tr><td> <code title="">ntrianglelefteq;</code> </td> <td> U+022EC </td> <td> <span>&#8940;</span> </td> <tr><td> <code title="">ntriangleright;</code> </td> <td> U+022EB </td> <td> <span>&#8939;</span> </td> <tr><td> <code title="">ntrianglerighteq;</code> </td> <td> U+022ED </td> <td> <span>&#8941;</span> </td> <tr><td> <code title="">nu;</code> </td> <td> U+003BD </td> <td> <span>&nu;</span> </td> <tr><td> <code title="">num;</code> </td> <td> U+00023 </td> <td> <span>#</span> </td> <tr><td> <code title="">numero;</code> </td> <td> U+02116 </td> <td> <span>&#8470;</span> </td> <tr><td> <code title="">numsp;</code> </td> <td> U+02007 </td> <td> <span>&#8199;</span> </td> <tr><td> <code title="">nvDash;</code> </td> <td> U+022AD </td> <td> <span>&#8877;</span> </td> <tr><td> <code title="">nvHarr;</code> </td> <td> U+02904 </td> <td> <span>&#10500;</span> </td> <tr><td> <code title="">nvdash;</code> </td> <td> U+022AC </td> <td> <span>&#8876;</span> </td> <tr><td> <code title="">nvinfin;</code> </td> <td> U+029DE </td> <td> <span>&#10718;</span> </td> <tr><td> <code title="">nvlArr;</code> </td> <td> U+02902 </td> <td> <span>&#10498;</span> </td> <tr><td> <code title="">nvrArr;</code> </td> <td> U+02903 </td> <td> <span>&#10499;</span> </td> <tr><td> <code title="">nwArr;</code> </td> <td> U+021D6 </td> <td> <span>&#8662;</span> </td> <tr><td> <code title="">nwarhk;</code> </td> <td> U+02923 </td> <td> <span>&#10531;</span> </td> <tr><td> <code title="">nwarr;</code> </td> <td> U+02196 </td> <td> <span>&#8598;</span> </td> <tr><td> <code title="">nwarrow;</code> </td> <td> U+02196 </td> <td> <span>&#8598;</span> </td> <tr><td> <code title="">nwnear;</code> </td> <td> U+02927 </td> <td> <span>&#10535;</span> </td> <tr><td> <code title="">oS;</code> </td> <td> U+024C8 </td> <td> <span>&#9416;</span> </td> <tr><td> <code title="">oacute;</code> </td> <td> U+000F3 </td> <td> <span>&oacute;</span> </td> <tr class=impl><td> <code title="">oacute</code> </td> <td> U+000F3 </td> <td> <span title="">&oacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">oast;</code> </td> <td> U+0229B </td> <td> <span>&#8859;</span> </td> <tr><td> <code title="">ocir;</code> </td> <td> U+0229A </td> <td> <span>&#8858;</span> </td> <tr><td> <code title="">ocirc;</code> </td> <td> U+000F4 </td> <td> <span>&ocirc;</span> </td> <tr class=impl><td> <code title="">ocirc</code> </td> <td> U+000F4 </td> <td> <span title="">&ocirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ocy;</code> </td> <td> U+0043E </td> <td> <span>&#1086;</span> </td> <tr><td> <code title="">odash;</code> </td> <td> U+0229D </td> <td> <span>&#8861;</span> </td> <tr><td> <code title="">odblac;</code> </td> <td> U+00151 </td> <td> <span>&#337;</span> </td> <tr><td> <code title="">odiv;</code> </td> <td> U+02A38 </td> <td> <span>&#10808;</span> </td> <tr><td> <code title="">odot;</code> </td> <td> U+02299 </td> <td> <span>&#8857;</span> </td> <tr><td> <code title="">odsold;</code> </td> <td> U+029BC </td> <td> <span>&#10684;</span> </td> <tr><td> <code title="">oelig;</code> </td> <td> U+00153 </td> <td> <span>&oelig;</span> </td> <tr><td> <code title="">ofcir;</code> </td> <td> U+029BF </td> <td> <span>&#10687;</span> </td> <tr><td> <code title="">ofr;</code> </td> <td> U+1D52C </td> <td> <span>&#120108;</span> </td> <tr><td> <code title="">ogon;</code> </td> <td> U+002DB </td> <td> <span>&#731;</span> </td> <tr><td> <code title="">ograve;</code> </td> <td> U+000F2 </td> <td> <span>&ograve;</span> </td> <tr class=impl><td> <code title="">ograve</code> </td> <td> U+000F2 </td> <td> <span title="">&ograve;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ogt;</code> </td> <td> U+029C1 </td> <td> <span>&#10689;</span> </td> <tr><td> <code title="">ohbar;</code> </td> <td> U+029B5 </td> <td> <span>&#10677;</span> </td> <tr><td> <code title="">ohm;</code> </td> <td> U+003A9 </td> <td> <span>&Omega;</span> </td> <tr><td> <code title="">oint;</code> </td> <td> U+0222E </td> <td> <span>&#8750;</span> </td> <tr><td> <code title="">olarr;</code> </td> <td> U+021BA </td> <td> <span>&#8634;</span> </td> <tr><td> <code title="">olcir;</code> </td> <td> U+029BE </td> <td> <span>&#10686;</span> </td> <tr><td> <code title="">olcross;</code> </td> <td> U+029BB </td> <td> <span>&#10683;</span> </td> <tr><td> <code title="">oline;</code> </td> <td> U+0203E </td> <td> <span>&oline;</span> </td> <tr><td> <code title="">olt;</code> </td> <td> U+029C0 </td> <td> <span>&#10688;</span> </td> <tr><td> <code title="">omacr;</code> </td> <td> U+0014D </td> <td> <span>&#333;</span> </td> <tr><td> <code title="">omega;</code> </td> <td> U+003C9 </td> <td> <span>&omega;</span> </td> <tr><td> <code title="">omicron;</code> </td> <td> U+003BF </td> <td> <span>&omicron;</span> </td> <tr><td> <code title="">omid;</code> </td> <td> U+029B6 </td> <td> <span>&#10678;</span> </td> <tr><td> <code title="">ominus;</code> </td> <td> U+02296 </td> <td> <span>&#8854;</span> </td> <tr><td> <code title="">oopf;</code> </td> <td> U+1D560 </td> <td> <span>&#120160;</span> </td> <tr><td> <code title="">opar;</code> </td> <td> U+029B7 </td> <td> <span>&#10679;</span> </td> <tr><td> <code title="">operp;</code> </td> <td> U+029B9 </td> <td> <span>&#10681;</span> </td> <tr><td> <code title="">oplus;</code> </td> <td> U+02295 </td> <td> <span>&oplus;</span> </td> <tr><td> <code title="">or;</code> </td> <td> U+02228 </td> <td> <span>&or;</span> </td> <tr><td> <code title="">orarr;</code> </td> <td> U+021BB </td> <td> <span>&#8635;</span> </td> <tr><td> <code title="">ord;</code> </td> <td> U+02A5D </td> <td> <span>&#10845;</span> </td> <tr><td> <code title="">order;</code> </td> <td> U+02134 </td> <td> <span>&#8500;</span> </td> <tr><td> <code title="">orderof;</code> </td> <td> U+02134 </td> <td> <span>&#8500;</span> </td> <tr><td> <code title="">ordf;</code> </td> <td> U+000AA </td> <td> <span>&ordf;</span> </td> <tr class=impl><td> <code title="">ordf</code> </td> <td> U+000AA </td> <td> <span title="">&ordf;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ordm;</code> </td> <td> U+000BA </td> <td> <span>&ordm;</span> </td> <tr class=impl><td> <code title="">ordm</code> </td> <td> U+000BA </td> <td> <span title="">&ordm;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">origof;</code> </td> <td> U+022B6 </td> <td> <span>&#8886;</span> </td> <tr><td> <code title="">oror;</code> </td> <td> U+02A56 </td> <td> <span>&#10838;</span> </td> <tr><td> <code title="">orslope;</code> </td> <td> U+02A57 </td> <td> <span>&#10839;</span> </td> <tr><td> <code title="">orv;</code> </td> <td> U+02A5B </td> <td> <span>&#10843;</span> </td> <tr><td> <code title="">oscr;</code> </td> <td> U+02134 </td> <td> <span>&#8500;</span> </td> <tr><td> <code title="">oslash;</code> </td> <td> U+000F8 </td> <td> <span>&oslash;</span> </td> <tr class=impl><td> <code title="">oslash</code> </td> <td> U+000F8 </td> <td> <span title="">&oslash;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">osol;</code> </td> <td> U+02298 </td> <td> <span>&#8856;</span> </td> <tr><td> <code title="">otilde;</code> </td> <td> U+000F5 </td> <td> <span>&otilde;</span> </td> <tr class=impl><td> <code title="">otilde</code> </td> <td> U+000F5 </td> <td> <span title="">&otilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">otimes;</code> </td> <td> U+02297 </td> <td> <span>&otimes;</span> </td> <tr><td> <code title="">otimesas;</code> </td> <td> U+02A36 </td> <td> <span>&#10806;</span> </td> <tr><td> <code title="">ouml;</code> </td> <td> U+000F6 </td> <td> <span>&ouml;</span> </td> <tr class=impl><td> <code title="">ouml</code> </td> <td> U+000F6 </td> <td> <span title="">&ouml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ovbar;</code> </td> <td> U+0233D </td> <td> <span>&#9021;</span> </td> <tr><td> <code title="">par;</code> </td> <td> U+02225 </td> <td> <span>&#8741;</span> </td> <tr><td> <code title="">para;</code> </td> <td> U+000B6 </td> <td> <span>&para;</span> </td> <tr class=impl><td> <code title="">para</code> </td> <td> U+000B6 </td> <td> <span title="">&para;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">parallel;</code> </td> <td> U+02225 </td> <td> <span>&#8741;</span> </td> <tr><td> <code title="">parsim;</code> </td> <td> U+02AF3 </td> <td> <span>&#10995;</span> </td> <tr><td> <code title="">parsl;</code> </td> <td> U+02AFD </td> <td> <span>&#11005;</span> </td> <tr><td> <code title="">part;</code> </td> <td> U+02202 </td> <td> <span>&part;</span> </td> <tr><td> <code title="">pcy;</code> </td> <td> U+0043F </td> <td> <span>&#1087;</span> </td> <tr><td> <code title="">percnt;</code> </td> <td> U+00025 </td> <td> <span>%</span> </td> <tr><td> <code title="">period;</code> </td> <td> U+0002E </td> <td> <span>.</span> </td> <tr><td> <code title="">permil;</code> </td> <td> U+02030 </td> <td> <span>&permil;</span> </td> <tr><td> <code title="">perp;</code> </td> <td> U+022A5 </td> <td> <span>&perp;</span> </td> <tr><td> <code title="">pertenk;</code> </td> <td> U+02031 </td> <td> <span>&#8241;</span> </td> <tr><td> <code title="">pfr;</code> </td> <td> U+1D52D </td> <td> <span>&#120109;</span> </td> <tr><td> <code title="">phi;</code> </td> <td> U+003C6 </td> <td> <span>&phi;</span> </td> <tr><td> <code title="">phiv;</code> </td> <td> U+003D5 </td> <td> <span>&#981;</span> </td> <tr><td> <code title="">phmmat;</code> </td> <td> U+02133 </td> <td> <span>&#8499;</span> </td> <tr><td> <code title="">phone;</code> </td> <td> U+0260E </td> <td> <span>&#9742;</span> </td> <tr><td> <code title="">pi;</code> </td> <td> U+003C0 </td> <td> <span>&pi;</span> </td> <tr><td> <code title="">pitchfork;</code> </td> <td> U+022D4 </td> <td> <span>&#8916;</span> </td> <tr><td> <code title="">piv;</code> </td> <td> U+003D6 </td> <td> <span>&piv;</span> </td> <tr><td> <code title="">planck;</code> </td> <td> U+0210F </td> <td> <span>&#8463;</span> </td> <tr><td> <code title="">planckh;</code> </td> <td> U+0210E </td> <td> <span>&#8462;</span> </td> <tr><td> <code title="">plankv;</code> </td> <td> U+0210F </td> <td> <span>&#8463;</span> </td> <tr><td> <code title="">plus;</code> </td> <td> U+0002B </td> <td> <span>+</span> </td> <tr><td> <code title="">plusacir;</code> </td> <td> U+02A23 </td> <td> <span>&#10787;</span> </td> <tr><td> <code title="">plusb;</code> </td> <td> U+0229E </td> <td> <span>&#8862;</span> </td> <tr><td> <code title="">pluscir;</code> </td> <td> U+02A22 </td> <td> <span>&#10786;</span> </td> <tr><td> <code title="">plusdo;</code> </td> <td> U+02214 </td> <td> <span>&#8724;</span> </td> <tr><td> <code title="">plusdu;</code> </td> <td> U+02A25 </td> <td> <span>&#10789;</span> </td> <tr><td> <code title="">pluse;</code> </td> <td> U+02A72 </td> <td> <span>&#10866;</span> </td> <tr><td> <code title="">plusmn;</code> </td> <td> U+000B1 </td> <td> <span>&plusmn;</span> </td> <tr class=impl><td> <code title="">plusmn</code> </td> <td> U+000B1 </td> <td> <span title="">&plusmn;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">plussim;</code> </td> <td> U+02A26 </td> <td> <span>&#10790;</span> </td> <tr><td> <code title="">plustwo;</code> </td> <td> U+02A27 </td> <td> <span>&#10791;</span> </td> <tr><td> <code title="">pm;</code> </td> <td> U+000B1 </td> <td> <span>&plusmn;</span> </td> <tr><td> <code title="">pointint;</code> </td> <td> U+02A15 </td> <td> <span>&#10773;</span> </td> <tr><td> <code title="">popf;</code> </td> <td> U+1D561 </td> <td> <span>&#120161;</span> </td> <tr><td> <code title="">pound;</code> </td> <td> U+000A3 </td> <td> <span>&pound;</span> </td> <tr class=impl><td> <code title="">pound</code> </td> <td> U+000A3 </td> <td> <span title="">&pound;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">pr;</code> </td> <td> U+0227A </td> <td> <span>&#8826;</span> </td> <tr><td> <code title="">prE;</code> </td> <td> U+02AB3 </td> <td> <span>&#10931;</span> </td> <tr><td> <code title="">prap;</code> </td> <td> U+02AB7 </td> <td> <span>&#10935;</span> </td> <tr><td> <code title="">prcue;</code> </td> <td> U+0227C </td> <td> <span>&#8828;</span> </td> <tr><td> <code title="">pre;</code> </td> <td> U+02AAF </td> <td> <span>&#10927;</span> </td> <tr><td> <code title="">prec;</code> </td> <td> U+0227A </td> <td> <span>&#8826;</span> </td> <tr><td> <code title="">precapprox;</code> </td> <td> U+02AB7 </td> <td> <span>&#10935;</span> </td> <tr><td> <code title="">preccurlyeq;</code> </td> <td> U+0227C </td> <td> <span>&#8828;</span> </td> <tr><td> <code title="">preceq;</code> </td> <td> U+02AAF </td> <td> <span>&#10927;</span> </td> <tr><td> <code title="">precnapprox;</code> </td> <td> U+02AB9 </td> <td> <span>&#10937;</span> </td> <tr><td> <code title="">precneqq;</code> </td> <td> U+02AB5 </td> <td> <span>&#10933;</span> </td> <tr><td> <code title="">precnsim;</code> </td> <td> U+022E8 </td> <td> <span>&#8936;</span> </td> <tr><td> <code title="">precsim;</code> </td> <td> U+0227E </td> <td> <span>&#8830;</span> </td> <tr><td> <code title="">prime;</code> </td> <td> U+02032 </td> <td> <span>&prime;</span> </td> <tr><td> <code title="">primes;</code> </td> <td> U+02119 </td> <td> <span>&#8473;</span> </td> <tr><td> <code title="">prnE;</code> </td> <td> U+02AB5 </td> <td> <span>&#10933;</span> </td> <tr><td> <code title="">prnap;</code> </td> <td> U+02AB9 </td> <td> <span>&#10937;</span> </td> <tr><td> <code title="">prnsim;</code> </td> <td> U+022E8 </td> <td> <span>&#8936;</span> </td> <tr><td> <code title="">prod;</code> </td> <td> U+0220F </td> <td> <span>&prod;</span> </td> <tr><td> <code title="">profalar;</code> </td> <td> U+0232E </td> <td> <span>&#9006;</span> </td> <tr><td> <code title="">profline;</code> </td> <td> U+02312 </td> <td> <span>&#8978;</span> </td> <tr><td> <code title="">profsurf;</code> </td> <td> U+02313 </td> <td> <span>&#8979;</span> </td> <tr><td> <code title="">prop;</code> </td> <td> U+0221D </td> <td> <span>&prop;</span> </td> <tr><td> <code title="">propto;</code> </td> <td> U+0221D </td> <td> <span>&prop;</span> </td> <tr><td> <code title="">prsim;</code> </td> <td> U+0227E </td> <td> <span>&#8830;</span> </td> <tr><td> <code title="">prurel;</code> </td> <td> U+022B0 </td> <td> <span>&#8880;</span> </td> <tr><td> <code title="">pscr;</code> </td> <td> U+1D4C5 </td> <td> <span>&#120005;</span> </td> <tr><td> <code title="">psi;</code> </td> <td> U+003C8 </td> <td> <span>&psi;</span> </td> <tr><td> <code title="">puncsp;</code> </td> <td> U+02008 </td> <td> <span>&#8200;</span> </td> <tr><td> <code title="">qfr;</code> </td> <td> U+1D52E </td> <td> <span>&#120110;</span> </td> <tr><td> <code title="">qint;</code> </td> <td> U+02A0C </td> <td> <span>&#10764;</span> </td> <tr><td> <code title="">qopf;</code> </td> <td> U+1D562 </td> <td> <span>&#120162;</span> </td> <tr><td> <code title="">qprime;</code> </td> <td> U+02057 </td> <td> <span>&#8279;</span> </td> <tr><td> <code title="">qscr;</code> </td> <td> U+1D4C6 </td> <td> <span>&#120006;</span> </td> <tr><td> <code title="">quaternions;</code> </td> <td> U+0210D </td> <td> <span>&#8461;</span> </td> <tr><td> <code title="">quatint;</code> </td> <td> U+02A16 </td> <td> <span>&#10774;</span> </td> <tr><td> <code title="">quest;</code> </td> <td> U+0003F </td> <td> <span>?</span> </td> <tr><td> <code title="">questeq;</code> </td> <td> U+0225F </td> <td> <span>&#8799;</span> </td> <tr><td> <code title="">quot;</code> </td> <td> U+00022 </td> <td> <span>"</span> </td> <tr class=impl><td> <code title="">quot</code> </td> <td> U+00022 </td> <td> <span title="">"</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">rAarr;</code> </td> <td> U+021DB </td> <td> <span>&#8667;</span> </td> <tr><td> <code title="">rArr;</code> </td> <td> U+021D2 </td> <td> <span>&rArr;</span> </td> <tr><td> <code title="">rAtail;</code> </td> <td> U+0291C </td> <td> <span>&#10524;</span> </td> <tr><td> <code title="">rBarr;</code> </td> <td> U+0290F </td> <td> <span>&#10511;</span> </td> <tr><td> <code title="">rHar;</code> </td> <td> U+02964 </td> <td> <span>&#10596;</span> </td> <tr><td> <code title="">racute;</code> </td> <td> U+00155 </td> <td> <span>&#341;</span> </td> <tr><td> <code title="">radic;</code> </td> <td> U+0221A </td> <td> <span>&radic;</span> </td> <tr><td> <code title="">raemptyv;</code> </td> <td> U+029B3 </td> <td> <span>&#10675;</span> </td> <tr><td> <code title="">rang;</code> </td> <td> U+027E9 </td> <td> <span>&rang;</span> </td> <tr><td> <code title="">rangd;</code> </td> <td> U+02992 </td> <td> <span>&#10642;</span> </td> <tr><td> <code title="">range;</code> </td> <td> U+029A5 </td> <td> <span>&#10661;</span> </td> <tr><td> <code title="">rangle;</code> </td> <td> U+027E9 </td> <td> <span>&rang;</span> </td> <tr><td> <code title="">raquo;</code> </td> <td> U+000BB </td> <td> <span>&raquo;</span> </td> <tr class=impl><td> <code title="">raquo</code> </td> <td> U+000BB </td> <td> <span title="">&raquo;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">rarr;</code> </td> <td> U+02192 </td> <td> <span>&rarr;</span> </td> <tr><td> <code title="">rarrap;</code> </td> <td> U+02975 </td> <td> <span>&#10613;</span> </td> <tr><td> <code title="">rarrb;</code> </td> <td> U+021E5 </td> <td> <span>&#8677;</span> </td> <tr><td> <code title="">rarrbfs;</code> </td> <td> U+02920 </td> <td> <span>&#10528;</span> </td> <tr><td> <code title="">rarrc;</code> </td> <td> U+02933 </td> <td> <span>&#10547;</span> </td> <tr><td> <code title="">rarrfs;</code> </td> <td> U+0291E </td> <td> <span>&#10526;</span> </td> <tr><td> <code title="">rarrhk;</code> </td> <td> U+021AA </td> <td> <span>&#8618;</span> </td> <tr><td> <code title="">rarrlp;</code> </td> <td> U+021AC </td> <td> <span>&#8620;</span> </td> <tr><td> <code title="">rarrpl;</code> </td> <td> U+02945 </td> <td> <span>&#10565;</span> </td> <tr><td> <code title="">rarrsim;</code> </td> <td> U+02974 </td> <td> <span>&#10612;</span> </td> <tr><td> <code title="">rarrtl;</code> </td> <td> U+021A3 </td> <td> <span>&#8611;</span> </td> <tr><td> <code title="">rarrw;</code> </td> <td> U+0219D </td> <td> <span>&#8605;</span> </td> <tr><td> <code title="">ratail;</code> </td> <td> U+0291A </td> <td> <span>&#10522;</span> </td> <tr><td> <code title="">ratio;</code> </td> <td> U+02236 </td> <td> <span>&#8758;</span> </td> <tr><td> <code title="">rationals;</code> </td> <td> U+0211A </td> <td> <span>&#8474;</span> </td> <tr><td> <code title="">rbarr;</code> </td> <td> U+0290D </td> <td> <span>&#10509;</span> </td> <tr><td> <code title="">rbbrk;</code> </td> <td> U+02773 </td> <td> <span>&#10099;</span> </td> <tr><td> <code title="">rbrace;</code> </td> <td> U+0007D </td> <td> <span>}</span> </td> <tr><td> <code title="">rbrack;</code> </td> <td> U+0005D </td> <td> <span>]</span> </td> <tr><td> <code title="">rbrke;</code> </td> <td> U+0298C </td> <td> <span>&#10636;</span> </td> <tr><td> <code title="">rbrksld;</code> </td> <td> U+0298E </td> <td> <span>&#10638;</span> </td> <tr><td> <code title="">rbrkslu;</code> </td> <td> U+02990 </td> <td> <span>&#10640;</span> </td> <tr><td> <code title="">rcaron;</code> </td> <td> U+00159 </td> <td> <span>&#345;</span> </td> <tr><td> <code title="">rcedil;</code> </td> <td> U+00157 </td> <td> <span>&#343;</span> </td> <tr><td> <code title="">rceil;</code> </td> <td> U+02309 </td> <td> <span>&rceil;</span> </td> <tr><td> <code title="">rcub;</code> </td> <td> U+0007D </td> <td> <span>}</span> </td> <tr><td> <code title="">rcy;</code> </td> <td> U+00440 </td> <td> <span>&#1088;</span> </td> <tr><td> <code title="">rdca;</code> </td> <td> U+02937 </td> <td> <span>&#10551;</span> </td> <tr><td> <code title="">rdldhar;</code> </td> <td> U+02969 </td> <td> <span>&#10601;</span> </td> <tr><td> <code title="">rdquo;</code> </td> <td> U+0201D </td> <td> <span>&rdquo;</span> </td> <tr><td> <code title="">rdquor;</code> </td> <td> U+0201D </td> <td> <span>&rdquo;</span> </td> <tr><td> <code title="">rdsh;</code> </td> <td> U+021B3 </td> <td> <span>&#8627;</span> </td> <tr><td> <code title="">real;</code> </td> <td> U+0211C </td> <td> <span>&real;</span> </td> <tr><td> <code title="">realine;</code> </td> <td> U+0211B </td> <td> <span>&#8475;</span> </td> <tr><td> <code title="">realpart;</code> </td> <td> U+0211C </td> <td> <span>&real;</span> </td> <tr><td> <code title="">reals;</code> </td> <td> U+0211D </td> <td> <span>&#8477;</span> </td> <tr><td> <code title="">rect;</code> </td> <td> U+025AD </td> <td> <span>&#9645;</span> </td> <tr><td> <code title="">reg;</code> </td> <td> U+000AE </td> <td> <span>&reg;</span> </td> <tr class=impl><td> <code title="">reg</code> </td> <td> U+000AE </td> <td> <span title="">&reg;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">rfisht;</code> </td> <td> U+0297D </td> <td> <span>&#10621;</span> </td> <tr><td> <code title="">rfloor;</code> </td> <td> U+0230B </td> <td> <span>&rfloor;</span> </td> <tr><td> <code title="">rfr;</code> </td> <td> U+1D52F </td> <td> <span>&#120111;</span> </td> <tr><td> <code title="">rhard;</code> </td> <td> U+021C1 </td> <td> <span>&#8641;</span> </td> <tr><td> <code title="">rharu;</code> </td> <td> U+021C0 </td> <td> <span>&#8640;</span> </td> <tr><td> <code title="">rharul;</code> </td> <td> U+0296C </td> <td> <span>&#10604;</span> </td> <tr><td> <code title="">rho;</code> </td> <td> U+003C1 </td> <td> <span>&rho;</span> </td> <tr><td> <code title="">rhov;</code> </td> <td> U+003F1 </td> <td> <span>&#1009;</span> </td> <tr><td> <code title="">rightarrow;</code> </td> <td> U+02192 </td> <td> <span>&rarr;</span> </td> <tr><td> <code title="">rightarrowtail;</code> </td> <td> U+021A3 </td> <td> <span>&#8611;</span> </td> <tr><td> <code title="">rightharpoondown;</code> </td> <td> U+021C1 </td> <td> <span>&#8641;</span> </td> <tr><td> <code title="">rightharpoonup;</code> </td> <td> U+021C0 </td> <td> <span>&#8640;</span> </td> <tr><td> <code title="">rightleftarrows;</code> </td> <td> U+021C4 </td> <td> <span>&#8644;</span> </td> <tr><td> <code title="">rightleftharpoons;</code> </td> <td> U+021CC </td> <td> <span>&#8652;</span> </td> <tr><td> <code title="">rightrightarrows;</code> </td> <td> U+021C9 </td> <td> <span>&#8649;</span> </td> <tr><td> <code title="">rightsquigarrow;</code> </td> <td> U+0219D </td> <td> <span>&#8605;</span> </td> <tr><td> <code title="">rightthreetimes;</code> </td> <td> U+022CC </td> <td> <span>&#8908;</span> </td> <tr><td> <code title="">ring;</code> </td> <td> U+002DA </td> <td> <span>&#730;</span> </td> <tr><td> <code title="">risingdotseq;</code> </td> <td> U+02253 </td> <td> <span>&#8787;</span> </td> <tr><td> <code title="">rlarr;</code> </td> <td> U+021C4 </td> <td> <span>&#8644;</span> </td> <tr><td> <code title="">rlhar;</code> </td> <td> U+021CC </td> <td> <span>&#8652;</span> </td> <tr><td> <code title="">rlm;</code> </td> <td> U+0200F </td> <td> <span>&rlm;</span> </td> <tr><td> <code title="">rmoust;</code> </td> <td> U+023B1 </td> <td> <span>&#9137;</span> </td> <tr><td> <code title="">rmoustache;</code> </td> <td> U+023B1 </td> <td> <span>&#9137;</span> </td> <tr><td> <code title="">rnmid;</code> </td> <td> U+02AEE </td> <td> <span>&#10990;</span> </td> <tr><td> <code title="">roang;</code> </td> <td> U+027ED </td> <td> <span>&#10221;</span> </td> <tr><td> <code title="">roarr;</code> </td> <td> U+021FE </td> <td> <span>&#8702;</span> </td> <tr><td> <code title="">robrk;</code> </td> <td> U+027E7 </td> <td> <span>&#10215;</span> </td> <tr><td> <code title="">ropar;</code> </td> <td> U+02986 </td> <td> <span>&#10630;</span> </td> <tr><td> <code title="">ropf;</code> </td> <td> U+1D563 </td> <td> <span>&#120163;</span> </td> <tr><td> <code title="">roplus;</code> </td> <td> U+02A2E </td> <td> <span>&#10798;</span> </td> <tr><td> <code title="">rotimes;</code> </td> <td> U+02A35 </td> <td> <span>&#10805;</span> </td> <tr><td> <code title="">rpar;</code> </td> <td> U+00029 </td> <td> <span>)</span> </td> <tr><td> <code title="">rpargt;</code> </td> <td> U+02994 </td> <td> <span>&#10644;</span> </td> <tr><td> <code title="">rppolint;</code> </td> <td> U+02A12 </td> <td> <span>&#10770;</span> </td> <tr><td> <code title="">rrarr;</code> </td> <td> U+021C9 </td> <td> <span>&#8649;</span> </td> <tr><td> <code title="">rsaquo;</code> </td> <td> U+0203A </td> <td> <span>&rsaquo;</span> </td> <tr><td> <code title="">rscr;</code> </td> <td> U+1D4C7 </td> <td> <span>&#120007;</span> </td> <tr><td> <code title="">rsh;</code> </td> <td> U+021B1 </td> <td> <span>&#8625;</span> </td> <tr><td> <code title="">rsqb;</code> </td> <td> U+0005D </td> <td> <span>]</span> </td> <tr><td> <code title="">rsquo;</code> </td> <td> U+02019 </td> <td> <span>&rsquo;</span> </td> <tr><td> <code title="">rsquor;</code> </td> <td> U+02019 </td> <td> <span>&rsquo;</span> </td> <tr><td> <code title="">rthree;</code> </td> <td> U+022CC </td> <td> <span>&#8908;</span> </td> <tr><td> <code title="">rtimes;</code> </td> <td> U+022CA </td> <td> <span>&#8906;</span> </td> <tr><td> <code title="">rtri;</code> </td> <td> U+025B9 </td> <td> <span>&#9657;</span> </td> <tr><td> <code title="">rtrie;</code> </td> <td> U+022B5 </td> <td> <span>&#8885;</span> </td> <tr><td> <code title="">rtrif;</code> </td> <td> U+025B8 </td> <td> <span>&#9656;</span> </td> <tr><td> <code title="">rtriltri;</code> </td> <td> U+029CE </td> <td> <span>&#10702;</span> </td> <tr><td> <code title="">ruluhar;</code> </td> <td> U+02968 </td> <td> <span>&#10600;</span> </td> <tr><td> <code title="">rx;</code> </td> <td> U+0211E </td> <td> <span>&#8478;</span> </td> <tr><td> <code title="">sacute;</code> </td> <td> U+0015B </td> <td> <span>&#347;</span> </td> <tr><td> <code title="">sbquo;</code> </td> <td> U+0201A </td> <td> <span>&sbquo;</span> </td> <tr><td> <code title="">sc;</code> </td> <td> U+0227B </td> <td> <span>&#8827;</span> </td> <tr><td> <code title="">scE;</code> </td> <td> U+02AB4 </td> <td> <span>&#10932;</span> </td> <tr><td> <code title="">scap;</code> </td> <td> U+02AB8 </td> <td> <span>&#10936;</span> </td> <tr><td> <code title="">scaron;</code> </td> <td> U+00161 </td> <td> <span>&scaron;</span> </td> <tr><td> <code title="">sccue;</code> </td> <td> U+0227D </td> <td> <span>&#8829;</span> </td> <tr><td> <code title="">sce;</code> </td> <td> U+02AB0 </td> <td> <span>&#10928;</span> </td> <tr><td> <code title="">scedil;</code> </td> <td> U+0015F </td> <td> <span>&#351;</span> </td> <tr><td> <code title="">scirc;</code> </td> <td> U+0015D </td> <td> <span>&#349;</span> </td> <tr><td> <code title="">scnE;</code> </td> <td> U+02AB6 </td> <td> <span>&#10934;</span> </td> <tr><td> <code title="">scnap;</code> </td> <td> U+02ABA </td> <td> <span>&#10938;</span> </td> <tr><td> <code title="">scnsim;</code> </td> <td> U+022E9 </td> <td> <span>&#8937;</span> </td> <tr><td> <code title="">scpolint;</code> </td> <td> U+02A13 </td> <td> <span>&#10771;</span> </td> <tr><td> <code title="">scsim;</code> </td> <td> U+0227F </td> <td> <span>&#8831;</span> </td> <tr><td> <code title="">scy;</code> </td> <td> U+00441 </td> <td> <span>&#1089;</span> </td> <tr><td> <code title="">sdot;</code> </td> <td> U+022C5 </td> <td> <span>&sdot;</span> </td> <tr><td> <code title="">sdotb;</code> </td> <td> U+022A1 </td> <td> <span>&#8865;</span> </td> <tr><td> <code title="">sdote;</code> </td> <td> U+02A66 </td> <td> <span>&#10854;</span> </td> <tr><td> <code title="">seArr;</code> </td> <td> U+021D8 </td> <td> <span>&#8664;</span> </td> <tr><td> <code title="">searhk;</code> </td> <td> U+02925 </td> <td> <span>&#10533;</span> </td> <tr><td> <code title="">searr;</code> </td> <td> U+02198 </td> <td> <span>&#8600;</span> </td> <tr><td> <code title="">searrow;</code> </td> <td> U+02198 </td> <td> <span>&#8600;</span> </td> <tr><td> <code title="">sect;</code> </td> <td> U+000A7 </td> <td> <span>&sect;</span> </td> <tr class=impl><td> <code title="">sect</code> </td> <td> U+000A7 </td> <td> <span title="">&sect;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">semi;</code> </td> <td> U+0003B </td> <td> <span>;</span> </td> <tr><td> <code title="">seswar;</code> </td> <td> U+02929 </td> <td> <span>&#10537;</span> </td> <tr><td> <code title="">setminus;</code> </td> <td> U+02216 </td> <td> <span>&#8726;</span> </td> <tr><td> <code title="">setmn;</code> </td> <td> U+02216 </td> <td> <span>&#8726;</span> </td> <tr><td> <code title="">sext;</code> </td> <td> U+02736 </td> <td> <span>&#10038;</span> </td> <tr><td> <code title="">sfr;</code> </td> <td> U+1D530 </td> <td> <span>&#120112;</span> </td> <tr><td> <code title="">sfrown;</code> </td> <td> U+02322 </td> <td> <span>&#8994;</span> </td> <tr><td> <code title="">sharp;</code> </td> <td> U+0266F </td> <td> <span>&#9839;</span> </td> <tr><td> <code title="">shchcy;</code> </td> <td> U+00449 </td> <td> <span>&#1097;</span> </td> <tr><td> <code title="">shcy;</code> </td> <td> U+00448 </td> <td> <span>&#1096;</span> </td> <tr><td> <code title="">shortmid;</code> </td> <td> U+02223 </td> <td> <span>&#8739;</span> </td> <tr><td> <code title="">shortparallel;</code> </td> <td> U+02225 </td> <td> <span>&#8741;</span> </td> <tr><td> <code title="">shy;</code> </td> <td> U+000AD </td> <td> <span>&shy;</span> </td> <tr class=impl><td> <code title="">shy</code> </td> <td> U+000AD </td> <td> <span title="">&shy;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sigma;</code> </td> <td> U+003C3 </td> <td> <span>&sigma;</span> </td> <tr><td> <code title="">sigmaf;</code> </td> <td> U+003C2 </td> <td> <span>&sigmaf;</span> </td> <tr><td> <code title="">sigmav;</code> </td> <td> U+003C2 </td> <td> <span>&sigmaf;</span> </td> <tr><td> <code title="">sim;</code> </td> <td> U+0223C </td> <td> <span>&sim;</span> </td> <tr><td> <code title="">simdot;</code> </td> <td> U+02A6A </td> <td> <span>&#10858;</span> </td> <tr><td> <code title="">sime;</code> </td> <td> U+02243 </td> <td> <span>&#8771;</span> </td> <tr><td> <code title="">simeq;</code> </td> <td> U+02243 </td> <td> <span>&#8771;</span> </td> <tr><td> <code title="">simg;</code> </td> <td> U+02A9E </td> <td> <span>&#10910;</span> </td> <tr><td> <code title="">simgE;</code> </td> <td> U+02AA0 </td> <td> <span>&#10912;</span> </td> <tr><td> <code title="">siml;</code> </td> <td> U+02A9D </td> <td> <span>&#10909;</span> </td> <tr><td> <code title="">simlE;</code> </td> <td> U+02A9F </td> <td> <span>&#10911;</span> </td> <tr><td> <code title="">simne;</code> </td> <td> U+02246 </td> <td> <span>&#8774;</span> </td> <tr><td> <code title="">simplus;</code> </td> <td> U+02A24 </td> <td> <span>&#10788;</span> </td> <tr><td> <code title="">simrarr;</code> </td> <td> U+02972 </td> <td> <span>&#10610;</span> </td> <tr><td> <code title="">slarr;</code> </td> <td> U+02190 </td> <td> <span>&larr;</span> </td> <tr><td> <code title="">smallsetminus;</code> </td> <td> U+02216 </td> <td> <span>&#8726;</span> </td> <tr><td> <code title="">smashp;</code> </td> <td> U+02A33 </td> <td> <span>&#10803;</span> </td> <tr><td> <code title="">smeparsl;</code> </td> <td> U+029E4 </td> <td> <span>&#10724;</span> </td> <tr><td> <code title="">smid;</code> </td> <td> U+02223 </td> <td> <span>&#8739;</span> </td> <tr><td> <code title="">smile;</code> </td> <td> U+02323 </td> <td> <span>&#8995;</span> </td> <tr><td> <code title="">smt;</code> </td> <td> U+02AAA </td> <td> <span>&#10922;</span> </td> <tr><td> <code title="">smte;</code> </td> <td> U+02AAC </td> <td> <span>&#10924;</span> </td> <tr><td> <code title="">softcy;</code> </td> <td> U+0044C </td> <td> <span>&#1100;</span> </td> <tr><td> <code title="">sol;</code> </td> <td> U+0002F </td> <td> <span>/</span> </td> <tr><td> <code title="">solb;</code> </td> <td> U+029C4 </td> <td> <span>&#10692;</span> </td> <tr><td> <code title="">solbar;</code> </td> <td> U+0233F </td> <td> <span>&#9023;</span> </td> <tr><td> <code title="">sopf;</code> </td> <td> U+1D564 </td> <td> <span>&#120164;</span> </td> <tr><td> <code title="">spades;</code> </td> <td> U+02660 </td> <td> <span>&spades;</span> </td> <tr><td> <code title="">spadesuit;</code> </td> <td> U+02660 </td> <td> <span>&spades;</span> </td> <tr><td> <code title="">spar;</code> </td> <td> U+02225 </td> <td> <span>&#8741;</span> </td> <tr><td> <code title="">sqcap;</code> </td> <td> U+02293 </td> <td> <span>&#8851;</span> </td> <tr><td> <code title="">sqcup;</code> </td> <td> U+02294 </td> <td> <span>&#8852;</span> </td> <tr><td> <code title="">sqsub;</code> </td> <td> U+0228F </td> <td> <span>&#8847;</span> </td> <tr><td> <code title="">sqsube;</code> </td> <td> U+02291 </td> <td> <span>&#8849;</span> </td> <tr><td> <code title="">sqsubset;</code> </td> <td> U+0228F </td> <td> <span>&#8847;</span> </td> <tr><td> <code title="">sqsubseteq;</code> </td> <td> U+02291 </td> <td> <span>&#8849;</span> </td> <tr><td> <code title="">sqsup;</code> </td> <td> U+02290 </td> <td> <span>&#8848;</span> </td> <tr><td> <code title="">sqsupe;</code> </td> <td> U+02292 </td> <td> <span>&#8850;</span> </td> <tr><td> <code title="">sqsupset;</code> </td> <td> U+02290 </td> <td> <span>&#8848;</span> </td> <tr><td> <code title="">sqsupseteq;</code> </td> <td> U+02292 </td> <td> <span>&#8850;</span> </td> <tr><td> <code title="">squ;</code> </td> <td> U+025A1 </td> <td> <span>&#9633;</span> </td> <tr><td> <code title="">square;</code> </td> <td> U+025A1 </td> <td> <span>&#9633;</span> </td> <tr><td> <code title="">squarf;</code> </td> <td> U+025AA </td> <td> <span>&#9642;</span> </td> <tr><td> <code title="">squf;</code> </td> <td> U+025AA </td> <td> <span>&#9642;</span> </td> <tr><td> <code title="">srarr;</code> </td> <td> U+02192 </td> <td> <span>&rarr;</span> </td> <tr><td> <code title="">sscr;</code> </td> <td> U+1D4C8 </td> <td> <span>&#120008;</span> </td> <tr><td> <code title="">ssetmn;</code> </td> <td> U+02216 </td> <td> <span>&#8726;</span> </td> <tr><td> <code title="">ssmile;</code> </td> <td> U+02323 </td> <td> <span>&#8995;</span> </td> <tr><td> <code title="">sstarf;</code> </td> <td> U+022C6 </td> <td> <span>&#8902;</span> </td> <tr><td> <code title="">star;</code> </td> <td> U+02606 </td> <td> <span>&#9734;</span> </td> <tr><td> <code title="">starf;</code> </td> <td> U+02605 </td> <td> <span>&#9733;</span> </td> <tr><td> <code title="">straightepsilon;</code> </td> <td> U+003F5 </td> <td> <span>&#1013;</span> </td> <tr><td> <code title="">straightphi;</code> </td> <td> U+003D5 </td> <td> <span>&#981;</span> </td> <tr><td> <code title="">strns;</code> </td> <td> U+000AF </td> <td> <span>&macr;</span> </td> <tr><td> <code title="">sub;</code> </td> <td> U+02282 </td> <td> <span>&sub;</span> </td> <tr><td> <code title="">subE;</code> </td> <td> U+02AC5 </td> <td> <span>&#10949;</span> </td> <tr><td> <code title="">subdot;</code> </td> <td> U+02ABD </td> <td> <span>&#10941;</span> </td> <tr><td> <code title="">sube;</code> </td> <td> U+02286 </td> <td> <span>&sube;</span> </td> <tr><td> <code title="">subedot;</code> </td> <td> U+02AC3 </td> <td> <span>&#10947;</span> </td> <tr><td> <code title="">submult;</code> </td> <td> U+02AC1 </td> <td> <span>&#10945;</span> </td> <tr><td> <code title="">subnE;</code> </td> <td> U+02ACB </td> <td> <span>&#10955;</span> </td> <tr><td> <code title="">subne;</code> </td> <td> U+0228A </td> <td> <span>&#8842;</span> </td> <tr><td> <code title="">subplus;</code> </td> <td> U+02ABF </td> <td> <span>&#10943;</span> </td> <tr><td> <code title="">subrarr;</code> </td> <td> U+02979 </td> <td> <span>&#10617;</span> </td> <tr><td> <code title="">subset;</code> </td> <td> U+02282 </td> <td> <span>&sub;</span> </td> <tr><td> <code title="">subseteq;</code> </td> <td> U+02286 </td> <td> <span>&sube;</span> </td> <tr><td> <code title="">subseteqq;</code> </td> <td> U+02AC5 </td> <td> <span>&#10949;</span> </td> <tr><td> <code title="">subsetneq;</code> </td> <td> U+0228A </td> <td> <span>&#8842;</span> </td> <tr><td> <code title="">subsetneqq;</code> </td> <td> U+02ACB </td> <td> <span>&#10955;</span> </td> <tr><td> <code title="">subsim;</code> </td> <td> U+02AC7 </td> <td> <span>&#10951;</span> </td> <tr><td> <code title="">subsub;</code> </td> <td> U+02AD5 </td> <td> <span>&#10965;</span> </td> <tr><td> <code title="">subsup;</code> </td> <td> U+02AD3 </td> <td> <span>&#10963;</span> </td> <tr><td> <code title="">succ;</code> </td> <td> U+0227B </td> <td> <span>&#8827;</span> </td> <tr><td> <code title="">succapprox;</code> </td> <td> U+02AB8 </td> <td> <span>&#10936;</span> </td> <tr><td> <code title="">succcurlyeq;</code> </td> <td> U+0227D </td> <td> <span>&#8829;</span> </td> <tr><td> <code title="">succeq;</code> </td> <td> U+02AB0 </td> <td> <span>&#10928;</span> </td> <tr><td> <code title="">succnapprox;</code> </td> <td> U+02ABA </td> <td> <span>&#10938;</span> </td> <tr><td> <code title="">succneqq;</code> </td> <td> U+02AB6 </td> <td> <span>&#10934;</span> </td> <tr><td> <code title="">succnsim;</code> </td> <td> U+022E9 </td> <td> <span>&#8937;</span> </td> <tr><td> <code title="">succsim;</code> </td> <td> U+0227F </td> <td> <span>&#8831;</span> </td> <tr><td> <code title="">sum;</code> </td> <td> U+02211 </td> <td> <span>&sum;</span> </td> <tr><td> <code title="">sung;</code> </td> <td> U+0266A </td> <td> <span>&#9834;</span> </td> <tr><td> <code title="">sup1;</code> </td> <td> U+000B9 </td> <td> <span>&sup1;</span> </td> <tr class=impl><td> <code title="">sup1</code> </td> <td> U+000B9 </td> <td> <span title="">&sup1;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sup2;</code> </td> <td> U+000B2 </td> <td> <span>&sup2;</span> </td> <tr class=impl><td> <code title="">sup2</code> </td> <td> U+000B2 </td> <td> <span title="">&sup2;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sup3;</code> </td> <td> U+000B3 </td> <td> <span>&sup3;</span> </td> <tr class=impl><td> <code title="">sup3</code> </td> <td> U+000B3 </td> <td> <span title="">&sup3;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sup;</code> </td> <td> U+02283 </td> <td> <span>&sup;</span> </td> <tr><td> <code title="">supE;</code> </td> <td> U+02AC6 </td> <td> <span>&#10950;</span> </td> <tr><td> <code title="">supdot;</code> </td> <td> U+02ABE </td> <td> <span>&#10942;</span> </td> <tr><td> <code title="">supdsub;</code> </td> <td> U+02AD8 </td> <td> <span>&#10968;</span> </td> <tr><td> <code title="">supe;</code> </td> <td> U+02287 </td> <td> <span>&supe;</span> </td> <tr><td> <code title="">supedot;</code> </td> <td> U+02AC4 </td> <td> <span>&#10948;</span> </td> <tr><td> <code title="">suphsol;</code> </td> <td> U+027C9 </td> <td> <span>&#10185;</span> </td> <tr><td> <code title="">suphsub;</code> </td> <td> U+02AD7 </td> <td> <span>&#10967;</span> </td> <tr><td> <code title="">suplarr;</code> </td> <td> U+0297B </td> <td> <span>&#10619;</span> </td> <tr><td> <code title="">supmult;</code> </td> <td> U+02AC2 </td> <td> <span>&#10946;</span> </td> <tr><td> <code title="">supnE;</code> </td> <td> U+02ACC </td> <td> <span>&#10956;</span> </td> <tr><td> <code title="">supne;</code> </td> <td> U+0228B </td> <td> <span>&#8843;</span> </td> <tr><td> <code title="">supplus;</code> </td> <td> U+02AC0 </td> <td> <span>&#10944;</span> </td> <tr><td> <code title="">supset;</code> </td> <td> U+02283 </td> <td> <span>&sup;</span> </td> <tr><td> <code title="">supseteq;</code> </td> <td> U+02287 </td> <td> <span>&supe;</span> </td> <tr><td> <code title="">supseteqq;</code> </td> <td> U+02AC6 </td> <td> <span>&#10950;</span> </td> <tr><td> <code title="">supsetneq;</code> </td> <td> U+0228B </td> <td> <span>&#8843;</span> </td> <tr><td> <code title="">supsetneqq;</code> </td> <td> U+02ACC </td> <td> <span>&#10956;</span> </td> <tr><td> <code title="">supsim;</code> </td> <td> U+02AC8 </td> <td> <span>&#10952;</span> </td> <tr><td> <code title="">supsub;</code> </td> <td> U+02AD4 </td> <td> <span>&#10964;</span> </td> <tr><td> <code title="">supsup;</code> </td> <td> U+02AD6 </td> <td> <span>&#10966;</span> </td> <tr><td> <code title="">swArr;</code> </td> <td> U+021D9 </td> <td> <span>&#8665;</span> </td> <tr><td> <code title="">swarhk;</code> </td> <td> U+02926 </td> <td> <span>&#10534;</span> </td> <tr><td> <code title="">swarr;</code> </td> <td> U+02199 </td> <td> <span>&#8601;</span> </td> <tr><td> <code title="">swarrow;</code> </td> <td> U+02199 </td> <td> <span>&#8601;</span> </td> <tr><td> <code title="">swnwar;</code> </td> <td> U+0292A </td> <td> <span>&#10538;</span> </td> <tr><td> <code title="">szlig;</code> </td> <td> U+000DF </td> <td> <span>&szlig;</span> </td> <tr class=impl><td> <code title="">szlig</code> </td> <td> U+000DF </td> <td> <span title="">&szlig;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">target;</code> </td> <td> U+02316 </td> <td> <span>&#8982;</span> </td> <tr><td> <code title="">tau;</code> </td> <td> U+003C4 </td> <td> <span>&tau;</span> </td> <tr><td> <code title="">tbrk;</code> </td> <td> U+023B4 </td> <td> <span>&#9140;</span> </td> <tr><td> <code title="">tcaron;</code> </td> <td> U+00165 </td> <td> <span>&#357;</span> </td> <tr><td> <code title="">tcedil;</code> </td> <td> U+00163 </td> <td> <span>&#355;</span> </td> <tr><td> <code title="">tcy;</code> </td> <td> U+00442 </td> <td> <span>&#1090;</span> </td> <tr><td> <code title="">tdot;</code> </td> <td> U+020DB </td> <td> <span>&#9676;&#8411;</span> </td> <tr><td> <code title="">telrec;</code> </td> <td> U+02315 </td> <td> <span>&#8981;</span> </td> <tr><td> <code title="">tfr;</code> </td> <td> U+1D531 </td> <td> <span>&#120113;</span> </td> <tr><td> <code title="">there4;</code> </td> <td> U+02234 </td> <td> <span>&there4;</span> </td> <tr><td> <code title="">therefore;</code> </td> <td> U+02234 </td> <td> <span>&there4;</span> </td> <tr><td> <code title="">theta;</code> </td> <td> U+003B8 </td> <td> <span>&theta;</span> </td> <tr><td> <code title="">thetasym;</code> </td> <td> U+003D1 </td> <td> <span>&thetasym;</span> </td> <tr><td> <code title="">thetav;</code> </td> <td> U+003D1 </td> <td> <span>&thetasym;</span> </td> <tr><td> <code title="">thickapprox;</code> </td> <td> U+02248 </td> <td> <span>&asymp;</span> </td> <tr><td> <code title="">thicksim;</code> </td> <td> U+0223C </td> <td> <span>&sim;</span> </td> <tr><td> <code title="">thinsp;</code> </td> <td> U+02009 </td> <td> <span>&thinsp;</span> </td> <tr><td> <code title="">thkap;</code> </td> <td> U+02248 </td> <td> <span>&asymp;</span> </td> <tr><td> <code title="">thksim;</code> </td> <td> U+0223C </td> <td> <span>&sim;</span> </td> <tr><td> <code title="">thorn;</code> </td> <td> U+000FE </td> <td> <span>&thorn;</span> </td> <tr class=impl><td> <code title="">thorn</code> </td> <td> U+000FE </td> <td> <span title="">&thorn;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">tilde;</code> </td> <td> U+002DC </td> <td> <span>&tilde;</span> </td> <tr><td> <code title="">times;</code> </td> <td> U+000D7 </td> <td> <span>&times;</span> </td> <tr class=impl><td> <code title="">times</code> </td> <td> U+000D7 </td> <td> <span title="">&times;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">timesb;</code> </td> <td> U+022A0 </td> <td> <span>&#8864;</span> </td> <tr><td> <code title="">timesbar;</code> </td> <td> U+02A31 </td> <td> <span>&#10801;</span> </td> <tr><td> <code title="">timesd;</code> </td> <td> U+02A30 </td> <td> <span>&#10800;</span> </td> <tr><td> <code title="">tint;</code> </td> <td> U+0222D </td> <td> <span>&#8749;</span> </td> <tr><td> <code title="">toea;</code> </td> <td> U+02928 </td> <td> <span>&#10536;</span> </td> <tr><td> <code title="">top;</code> </td> <td> U+022A4 </td> <td> <span>&#8868;</span> </td> <tr><td> <code title="">topbot;</code> </td> <td> U+02336 </td> <td> <span>&#9014;</span> </td> <tr><td> <code title="">topcir;</code> </td> <td> U+02AF1 </td> <td> <span>&#10993;</span> </td> <tr><td> <code title="">topf;</code> </td> <td> U+1D565 </td> <td> <span>&#120165;</span> </td> <tr><td> <code title="">topfork;</code> </td> <td> U+02ADA </td> <td> <span>&#10970;</span> </td> <tr><td> <code title="">tosa;</code> </td> <td> U+02929 </td> <td> <span>&#10537;</span> </td> <tr><td> <code title="">tprime;</code> </td> <td> U+02034 </td> <td> <span>&#8244;</span> </td> <tr><td> <code title="">trade;</code> </td> <td> U+02122 </td> <td> <span>&trade;</span> </td> <tr><td> <code title="">triangle;</code> </td> <td> U+025B5 </td> <td> <span>&#9653;</span> </td> <tr><td> <code title="">triangledown;</code> </td> <td> U+025BF </td> <td> <span>&#9663;</span> </td> <tr><td> <code title="">triangleleft;</code> </td> <td> U+025C3 </td> <td> <span>&#9667;</span> </td> <tr><td> <code title="">trianglelefteq;</code> </td> <td> U+022B4 </td> <td> <span>&#8884;</span> </td> <tr><td> <code title="">triangleq;</code> </td> <td> U+0225C </td> <td> <span>&#8796;</span> </td> <tr><td> <code title="">triangleright;</code> </td> <td> U+025B9 </td> <td> <span>&#9657;</span> </td> <tr><td> <code title="">trianglerighteq;</code> </td> <td> U+022B5 </td> <td> <span>&#8885;</span> </td> <tr><td> <code title="">tridot;</code> </td> <td> U+025EC </td> <td> <span>&#9708;</span> </td> <tr><td> <code title="">trie;</code> </td> <td> U+0225C </td> <td> <span>&#8796;</span> </td> <tr><td> <code title="">triminus;</code> </td> <td> U+02A3A </td> <td> <span>&#10810;</span> </td> <tr><td> <code title="">triplus;</code> </td> <td> U+02A39 </td> <td> <span>&#10809;</span> </td> <tr><td> <code title="">trisb;</code> </td> <td> U+029CD </td> <td> <span>&#10701;</span> </td> <tr><td> <code title="">tritime;</code> </td> <td> U+02A3B </td> <td> <span>&#10811;</span> </td> <tr><td> <code title="">trpezium;</code> </td> <td> U+023E2 </td> <td> <span>&#9186;</span> </td> <tr><td> <code title="">tscr;</code> </td> <td> U+1D4C9 </td> <td> <span>&#120009;</span> </td> <tr><td> <code title="">tscy;</code> </td> <td> U+00446 </td> <td> <span>&#1094;</span> </td> <tr><td> <code title="">tshcy;</code> </td> <td> U+0045B </td> <td> <span>&#1115;</span> </td> <tr><td> <code title="">tstrok;</code> </td> <td> U+00167 </td> <td> <span>&#359;</span> </td> <tr><td> <code title="">twixt;</code> </td> <td> U+0226C </td> <td> <span>&#8812;</span> </td> <tr><td> <code title="">twoheadleftarrow;</code> </td> <td> U+0219E </td> <td> <span>&#8606;</span> </td> <tr><td> <code title="">twoheadrightarrow;</code> </td> <td> U+021A0 </td> <td> <span>&#8608;</span> </td> <tr><td> <code title="">uArr;</code> </td> <td> U+021D1 </td> <td> <span>&uArr;</span> </td> <tr><td> <code title="">uHar;</code> </td> <td> U+02963 </td> <td> <span>&#10595;</span> </td> <tr><td> <code title="">uacute;</code> </td> <td> U+000FA </td> <td> <span>&uacute;</span> </td> <tr class=impl><td> <code title="">uacute</code> </td> <td> U+000FA </td> <td> <span title="">&uacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uarr;</code> </td> <td> U+02191 </td> <td> <span>&uarr;</span> </td> <tr><td> <code title="">ubrcy;</code> </td> <td> U+0045E </td> <td> <span>&#1118;</span> </td> <tr><td> <code title="">ubreve;</code> </td> <td> U+0016D </td> <td> <span>&#365;</span> </td> <tr><td> <code title="">ucirc;</code> </td> <td> U+000FB </td> <td> <span>&ucirc;</span> </td> <tr class=impl><td> <code title="">ucirc</code> </td> <td> U+000FB </td> <td> <span title="">&ucirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ucy;</code> </td> <td> U+00443 </td> <td> <span>&#1091;</span> </td> <tr><td> <code title="">udarr;</code> </td> <td> U+021C5 </td> <td> <span>&#8645;</span> </td> <tr><td> <code title="">udblac;</code> </td> <td> U+00171 </td> <td> <span>&#369;</span> </td> <tr><td> <code title="">udhar;</code> </td> <td> U+0296E </td> <td> <span>&#10606;</span> </td> <tr><td> <code title="">ufisht;</code> </td> <td> U+0297E </td> <td> <span>&#10622;</span> </td> <tr><td> <code title="">ufr;</code> </td> <td> U+1D532 </td> <td> <span>&#120114;</span> </td> <tr><td> <code title="">ugrave;</code> </td> <td> U+000F9 </td> <td> <span>&ugrave;</span> </td> <tr class=impl><td> <code title="">ugrave</code> </td> <td> U+000F9 </td> <td> <span title="">&ugrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uharl;</code> </td> <td> U+021BF </td> <td> <span>&#8639;</span> </td> <tr><td> <code title="">uharr;</code> </td> <td> U+021BE </td> <td> <span>&#8638;</span> </td> <tr><td> <code title="">uhblk;</code> </td> <td> U+02580 </td> <td> <span>&#9600;</span> </td> <tr><td> <code title="">ulcorn;</code> </td> <td> U+0231C </td> <td> <span>&#8988;</span> </td> <tr><td> <code title="">ulcorner;</code> </td> <td> U+0231C </td> <td> <span>&#8988;</span> </td> <tr><td> <code title="">ulcrop;</code> </td> <td> U+0230F </td> <td> <span>&#8975;</span> </td> <tr><td> <code title="">ultri;</code> </td> <td> U+025F8 </td> <td> <span>&#9720;</span> </td> <tr><td> <code title="">umacr;</code> </td> <td> U+0016B </td> <td> <span>&#363;</span> </td> <tr><td> <code title="">uml;</code> </td> <td> U+000A8 </td> <td> <span>&uml;</span> </td> <tr class=impl><td> <code title="">uml</code> </td> <td> U+000A8 </td> <td> <span title="">&uml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uogon;</code> </td> <td> U+00173 </td> <td> <span>&#371;</span> </td> <tr><td> <code title="">uopf;</code> </td> <td> U+1D566 </td> <td> <span>&#120166;</span> </td> <tr><td> <code title="">uparrow;</code> </td> <td> U+02191 </td> <td> <span>&uarr;</span> </td> <tr><td> <code title="">updownarrow;</code> </td> <td> U+02195 </td> <td> <span>&#8597;</span> </td> <tr><td> <code title="">upharpoonleft;</code> </td> <td> U+021BF </td> <td> <span>&#8639;</span> </td> <tr><td> <code title="">upharpoonright;</code> </td> <td> U+021BE </td> <td> <span>&#8638;</span> </td> <tr><td> <code title="">uplus;</code> </td> <td> U+0228E </td> <td> <span>&#8846;</span> </td> <tr><td> <code title="">upsi;</code> </td> <td> U+003C5 </td> <td> <span>&upsilon;</span> </td> <tr><td> <code title="">upsih;</code> </td> <td> U+003D2 </td> <td> <span>&upsih;</span> </td> <tr><td> <code title="">upsilon;</code> </td> <td> U+003C5 </td> <td> <span>&upsilon;</span> </td> <tr><td> <code title="">upuparrows;</code> </td> <td> U+021C8 </td> <td> <span>&#8648;</span> </td> <tr><td> <code title="">urcorn;</code> </td> <td> U+0231D </td> <td> <span>&#8989;</span> </td> <tr><td> <code title="">urcorner;</code> </td> <td> U+0231D </td> <td> <span>&#8989;</span> </td> <tr><td> <code title="">urcrop;</code> </td> <td> U+0230E </td> <td> <span>&#8974;</span> </td> <tr><td> <code title="">uring;</code> </td> <td> U+0016F </td> <td> <span>&#367;</span> </td> <tr><td> <code title="">urtri;</code> </td> <td> U+025F9 </td> <td> <span>&#9721;</span> </td> <tr><td> <code title="">uscr;</code> </td> <td> U+1D4CA </td> <td> <span>&#120010;</span> </td> <tr><td> <code title="">utdot;</code> </td> <td> U+022F0 </td> <td> <span>&#8944;</span> </td> <tr><td> <code title="">utilde;</code> </td> <td> U+00169 </td> <td> <span>&#361;</span> </td> <tr><td> <code title="">utri;</code> </td> <td> U+025B5 </td> <td> <span>&#9653;</span> </td> <tr><td> <code title="">utrif;</code> </td> <td> U+025B4 </td> <td> <span>&#9652;</span> </td> <tr><td> <code title="">uuarr;</code> </td> <td> U+021C8 </td> <td> <span>&#8648;</span> </td> <tr><td> <code title="">uuml;</code> </td> <td> U+000FC </td> <td> <span>&uuml;</span> </td> <tr class=impl><td> <code title="">uuml</code> </td> <td> U+000FC </td> <td> <span title="">&uuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uwangle;</code> </td> <td> U+029A7 </td> <td> <span>&#10663;</span> </td> <tr><td> <code title="">vArr;</code> </td> <td> U+021D5 </td> <td> <span>&#8661;</span> </td> <tr><td> <code title="">vBar;</code> </td> <td> U+02AE8 </td> <td> <span>&#10984;</span> </td> <tr><td> <code title="">vBarv;</code> </td> <td> U+02AE9 </td> <td> <span>&#10985;</span> </td> <tr><td> <code title="">vDash;</code> </td> <td> U+022A8 </td> <td> <span>&#8872;</span> </td> <tr><td> <code title="">vangrt;</code> </td> <td> U+0299C </td> <td> <span>&#10652;</span> </td> <tr><td> <code title="">varepsilon;</code> </td> <td> U+003F5 </td> <td> <span>&#1013;</span> </td> <tr><td> <code title="">varkappa;</code> </td> <td> U+003F0 </td> <td> <span>&#1008;</span> </td> <tr><td> <code title="">varnothing;</code> </td> <td> U+02205 </td> <td> <span>&empty;</span> </td> <tr><td> <code title="">varphi;</code> </td> <td> U+003D5 </td> <td> <span>&#981;</span> </td> <tr><td> <code title="">varpi;</code> </td> <td> U+003D6 </td> <td> <span>&piv;</span> </td> <tr><td> <code title="">varpropto;</code> </td> <td> U+0221D </td> <td> <span>&prop;</span> </td> <tr><td> <code title="">varr;</code> </td> <td> U+02195 </td> <td> <span>&#8597;</span> </td> <tr><td> <code title="">varrho;</code> </td> <td> U+003F1 </td> <td> <span>&#1009;</span> </td> <tr><td> <code title="">varsigma;</code> </td> <td> U+003C2 </td> <td> <span>&sigmaf;</span> </td> <tr><td> <code title="">vartheta;</code> </td> <td> U+003D1 </td> <td> <span>&thetasym;</span> </td> <tr><td> <code title="">vartriangleleft;</code> </td> <td> U+022B2 </td> <td> <span>&#8882;</span> </td> <tr><td> <code title="">vartriangleright;</code> </td> <td> U+022B3 </td> <td> <span>&#8883;</span> </td> <tr><td> <code title="">vcy;</code> </td> <td> U+00432 </td> <td> <span>&#1074;</span> </td> <tr><td> <code title="">vdash;</code> </td> <td> U+022A2 </td> <td> <span>&#8866;</span> </td> <tr><td> <code title="">vee;</code> </td> <td> U+02228 </td> <td> <span>&or;</span> </td> <tr><td> <code title="">veebar;</code> </td> <td> U+022BB </td> <td> <span>&#8891;</span> </td> <tr><td> <code title="">veeeq;</code> </td> <td> U+0225A </td> <td> <span>&#8794;</span> </td> <tr><td> <code title="">vellip;</code> </td> <td> U+022EE </td> <td> <span>&#8942;</span> </td> <tr><td> <code title="">verbar;</code> </td> <td> U+0007C </td> <td> <span>|</span> </td> <tr><td> <code title="">vert;</code> </td> <td> U+0007C </td> <td> <span>|</span> </td> <tr><td> <code title="">vfr;</code> </td> <td> U+1D533 </td> <td> <span>&#120115;</span> </td> <tr><td> <code title="">vltri;</code> </td> <td> U+022B2 </td> <td> <span>&#8882;</span> </td> <tr><td> <code title="">vopf;</code> </td> <td> U+1D567 </td> <td> <span>&#120167;</span> </td> <tr><td> <code title="">vprop;</code> </td> <td> U+0221D </td> <td> <span>&prop;</span> </td> <tr><td> <code title="">vrtri;</code> </td> <td> U+022B3 </td> <td> <span>&#8883;</span> </td> <tr><td> <code title="">vscr;</code> </td> <td> U+1D4CB </td> <td> <span>&#120011;</span> </td> <tr><td> <code title="">vzigzag;</code> </td> <td> U+0299A </td> <td> <span>&#10650;</span> </td> <tr><td> <code title="">wcirc;</code> </td> <td> U+00175 </td> <td> <span>&#373;</span> </td> <tr><td> <code title="">wedbar;</code> </td> <td> U+02A5F </td> <td> <span>&#10847;</span> </td> <tr><td> <code title="">wedge;</code> </td> <td> U+02227 </td> <td> <span>&and;</span> </td> <tr><td> <code title="">wedgeq;</code> </td> <td> U+02259 </td> <td> <span>&#8793;</span> </td> <tr><td> <code title="">weierp;</code> </td> <td> U+02118 </td> <td> <span>&weierp;</span> </td> <tr><td> <code title="">wfr;</code> </td> <td> U+1D534 </td> <td> <span>&#120116;</span> </td> <tr><td> <code title="">wopf;</code> </td> <td> U+1D568 </td> <td> <span>&#120168;</span> </td> <tr><td> <code title="">wp;</code> </td> <td> U+02118 </td> <td> <span>&weierp;</span> </td> <tr><td> <code title="">wr;</code> </td> <td> U+02240 </td> <td> <span>&#8768;</span> </td> <tr><td> <code title="">wreath;</code> </td> <td> U+02240 </td> <td> <span>&#8768;</span> </td> <tr><td> <code title="">wscr;</code> </td> <td> U+1D4CC </td> <td> <span>&#120012;</span> </td> <tr><td> <code title="">xcap;</code> </td> <td> U+022C2 </td> <td> <span>&#8898;</span> </td> <tr><td> <code title="">xcirc;</code> </td> <td> U+025EF </td> <td> <span>&#9711;</span> </td> <tr><td> <code title="">xcup;</code> </td> <td> U+022C3 </td> <td> <span>&#8899;</span> </td> <tr><td> <code title="">xdtri;</code> </td> <td> U+025BD </td> <td> <span>&#9661;</span> </td> <tr><td> <code title="">xfr;</code> </td> <td> U+1D535 </td> <td> <span>&#120117;</span> </td> <tr><td> <code title="">xhArr;</code> </td> <td> U+027FA </td> <td> <span>&#10234;</span> </td> <tr><td> <code title="">xharr;</code> </td> <td> U+027F7 </td> <td> <span>&#10231;</span> </td> <tr><td> <code title="">xi;</code> </td> <td> U+003BE </td> <td> <span>&xi;</span> </td> <tr><td> <code title="">xlArr;</code> </td> <td> U+027F8 </td> <td> <span>&#10232;</span> </td> <tr><td> <code title="">xlarr;</code> </td> <td> U+027F5 </td> <td> <span>&#10229;</span> </td> <tr><td> <code title="">xmap;</code> </td> <td> U+027FC </td> <td> <span>&#10236;</span> </td> <tr><td> <code title="">xnis;</code> </td> <td> U+022FB </td> <td> <span>&#8955;</span> </td> <tr><td> <code title="">xodot;</code> </td> <td> U+02A00 </td> <td> <span>&#10752;</span> </td> <tr><td> <code title="">xopf;</code> </td> <td> U+1D569 </td> <td> <span>&#120169;</span> </td> <tr><td> <code title="">xoplus;</code> </td> <td> U+02A01 </td> <td> <span>&#10753;</span> </td> <tr><td> <code title="">xotime;</code> </td> <td> U+02A02 </td> <td> <span>&#10754;</span> </td> <tr><td> <code title="">xrArr;</code> </td> <td> U+027F9 </td> <td> <span>&#10233;</span> </td> <tr><td> <code title="">xrarr;</code> </td> <td> U+027F6 </td> <td> <span>&#10230;</span> </td> <tr><td> <code title="">xscr;</code> </td> <td> U+1D4CD </td> <td> <span>&#120013;</span> </td> <tr><td> <code title="">xsqcup;</code> </td> <td> U+02A06 </td> <td> <span>&#10758;</span> </td> <tr><td> <code title="">xuplus;</code> </td> <td> U+02A04 </td> <td> <span>&#10756;</span> </td> <tr><td> <code title="">xutri;</code> </td> <td> U+025B3 </td> <td> <span>&#9651;</span> </td> <tr><td> <code title="">xvee;</code> </td> <td> U+022C1 </td> <td> <span>&#8897;</span> </td> <tr><td> <code title="">xwedge;</code> </td> <td> U+022C0 </td> <td> <span>&#8896;</span> </td> <tr><td> <code title="">yacute;</code> </td> <td> U+000FD </td> <td> <span>&yacute;</span> </td> <tr class=impl><td> <code title="">yacute</code> </td> <td> U+000FD </td> <td> <span title="">&yacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">yacy;</code> </td> <td> U+0044F </td> <td> <span>&#1103;</span> </td> <tr><td> <code title="">ycirc;</code> </td> <td> U+00177 </td> <td> <span>&#375;</span> </td> <tr><td> <code title="">ycy;</code> </td> <td> U+0044B </td> <td> <span>&#1099;</span> </td> <tr><td> <code title="">yen;</code> </td> <td> U+000A5 </td> <td> <span>&yen;</span> </td> <tr class=impl><td> <code title="">yen</code> </td> <td> U+000A5 </td> <td> <span title="">&yen;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">yfr;</code> </td> <td> U+1D536 </td> <td> <span>&#120118;</span> </td> <tr><td> <code title="">yicy;</code> </td> <td> U+00457 </td> <td> <span>&#1111;</span> </td> <tr><td> <code title="">yopf;</code> </td> <td> U+1D56A </td> <td> <span>&#120170;</span> </td> <tr><td> <code title="">yscr;</code> </td> <td> U+1D4CE </td> <td> <span>&#120014;</span> </td> <tr><td> <code title="">yucy;</code> </td> <td> U+0044E </td> <td> <span>&#1102;</span> </td> <tr><td> <code title="">yuml;</code> </td> <td> U+000FF </td> <td> <span>&yuml;</span> </td> <tr class=impl><td> <code title="">yuml</code> </td> <td> U+000FF </td> <td> <span title="">&yuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">zacute;</code> </td> <td> U+0017A </td> <td> <span>&#378;</span> </td> <tr><td> <code title="">zcaron;</code> </td> <td> U+0017E </td> <td> <span>&#382;</span> </td> <tr><td> <code title="">zcy;</code> </td> <td> U+00437 </td> <td> <span>&#1079;</span> </td> <tr><td> <code title="">zdot;</code> </td> <td> U+0017C </td> <td> <span>&#380;</span> </td> <tr><td> <code title="">zeetrf;</code> </td> <td> U+02128 </td> <td> <span>&#8488;</span> </td> <tr><td> <code title="">zeta;</code> </td> <td> U+003B6 </td> <td> <span>&zeta;</span> </td> <tr><td> <code title="">zfr;</code> </td> <td> U+1D537 </td> <td> <span>&#120119;</span> </td> <tr><td> <code title="">zhcy;</code> </td> <td> U+00436 </td> <td> <span>&#1078;</span> </td> <tr><td> <code title="">zigrarr;</code> </td> <td> U+021DD </td> <td> <span>&#8669;</span> </td> <tr><td> <code title="">zopf;</code> </td> <td> U+1D56B </td> <td> <span>&#120171;</span> </td> <tr><td> <code title="">zscr;</code> </td> <td> U+1D4CF </td> <td> <span>&#120015;</span> </td> <tr><td> <code title="">zwj;</code> </td> <td> U+0200D </td> <td> <span>&zwj;</span> </td> <tr><td> <code title="">zwnj;</code> </td> <td> U+0200C </td> <td> <span>&zwnj;</span> </td> </table><!--
+ If we want to add character references, Almorca suggests:
+ > I would add &sub1; (character U+2081), &sub2;
+ > (character U+2082) and &sub3; (character U+2083). They
+ > would are the equivalent to &sup1;, &sup2;, and &sup3;.
+ See also: http://www.w3.org/2003/entities/
+ --></div>
+
+ <p><i>The glyphs displayed above are non-normative. Refer to the
+ Unicode specifications for formal definitions of the characters
+ listed above.</i></p>
+
+
+
+ <h2 id=the-xhtml-syntax><span class=secno>11 </span><dfn id=xhtml>The XHTML syntax</dfn></h2>
+
+ <p class=note>This section only describes the rules for XML
+ resources. Rules for <code><a href=#text/html>text/html</a></code> resources are discussed
+ in the section above entitled "<a href=#syntax>The HTML syntax</a>".</p>
+
+
+ <div class=impl>
+
+ <h3 id=writing-xhtml-documents><span class=secno>11.1 </span>Writing XHTML documents</h3>
+
+ </div>
+
+ <p>The syntax for using HTML with XML, whether in XHTML documents or
+ embedded in other XML documents, is defined in the XML and
+ Namespaces in XML specifications. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>
+
+ <p>This specification does not define any syntax-level requirements
+ beyond those defined for XML proper.</p>
+
+ <p>XML documents may contain a <code>DOCTYPE</code> if desired, but
+ this is not required to conform to this specification. This
+ specification does not define a public or system identifier, nor
+ provide a format DTD.</p>
+
+ <p class=note>According to the XML specification, XML processors
+ are not guaranteed to process the external DTD subset referenced in
+ the DOCTYPE. This means, for example, that using entity references
+ for characters in XHTML documents is unsafe if they are defined in
+ an external file (except for <code title="">&amp;lt;</code>, <code title="">&amp;gt;</code>, <code title="">&amp;amp;</code>, <code title="">&amp;quot;</code> and <code title="">&amp;apos;</code>).</p>
+
+
+ <div class=impl>
+
+ <h3 id=parsing-xhtml-documents><span class=secno>11.2 </span>Parsing XHTML documents</h3>
+
+ <p>This section describes the relationship between XML and the DOM,
+ with a particular emphasis on how this interacts with HTML.</p>
+
+ <p>An <dfn id=xml-parser>XML parser</dfn>, for the purposes of this specification,
+ is a construct that follows the rules given in the XML specification
+ to map a string of bytes or characters into a <code><a href=#document>Document</a></code>
+ object.</p>
+
+ <p>An <a href=#xml-parser>XML parser</a> is either associated with a
+ <code><a href=#document>Document</a></code> object when it is created, or creates one
+ implicitly.</p>
+
+ <p>This <code><a href=#document>Document</a></code> must then be populated with DOM nodes
+ that represent the tree structure of the input passed to the parser,
+ as defined by the XML specification, the Namespaces in XML
+ specification, and the DOM Core specification. DOM mutation events
+ must not fire for the operations that the <a href=#xml-parser>XML parser</a>
+ performs on the <code><a href=#document>Document</a></code>'s tree, but the user agent
+ must act as if elements and attributes were individually appended
+ and set respectively so as to trigger rules in this specification
+ regarding what happens when an element in inserted into a document
+ or has its attributes set. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsDOMCORE>[DOMCORE]</a>
+ <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+
+ <p>Between the time an element's start tag is parsed and the time
+ either the element's end tag is parsed on the parser detects a
+ well-formedness error, the user agent must act as if the element was
+ in a <a href=#stack-of-open-elements>stack of open elements</a>.</p>
+
+ <p class=note>This is used by the <code><a href=#the-object-element>object</a></code> element to
+ avoid instantiating plugins before the <code><a href=#the-param-element>param</a></code> element
+ children have been parsed.</p>
+
+ <p>This specification provides the following additional information
+ that user agents should use when retrieving an external entity: the
+ public identifiers given in the following list all correspond to <a href=data:application/xml-dtd;base64,PCFFTlRJVFkgVGFiICImI3g5OyI%2BPCFFTlRJVFkgTmV3TGluZSAiJiN4QTsiPjwhRU5USVRZIGV4Y2wgIiYjeDIxOyI%2BPCFFTlRJVFkgcXVvdCAiJiN4MjI7Ij48IUVOVElUWSBRVU9UICImI3gyMjsiPjwhRU5USVRZIG51bSAiJiN4MjM7Ij48IUVOVElUWSBkb2xsYXIgIiYjeDI0OyI%2BPCFFTlRJVFkgcGVyY250ICImI3gyNTsiPjwhRU5USVRZIGFtcCAiJiN4MjY7Ij48IUVOVElUWSBBTVAgIiYjeDI2OyI%2BPCFFTlRJVFkgYXBvcyAiJiN4Mjc7Ij48IUVOVElUWSBscGFyICImI3gyODsiPjwhRU5USVRZIHJwYXIgIiYjeDI5OyI%2BPCFFTlRJVFkgYXN0ICImI3gyQTsiPjwhRU5USVRZIG1pZGFzdCAiJiN4MkE7Ij48IUVOVElUWSBwbHVzICImI3gyQjsiPjwhRU5USVRZIGNvbW1hICImI3gyQzsiPjwhRU5USVRZIHBlcmlvZCAiJiN4MkU7Ij48IUVOVElUWSBzb2wgIiYjeDJGOyI%2BPCFFTlRJVFkgY29sb24gIiYjeDNBOyI%2BPCFFTlRJVFkgc2VtaSAiJiN4M0I7Ij48IUVOVElUWSBsdCAiJiN4M0M7Ij48IUVOVElUWSBMVCAiJiN4M0M7Ij48IUVOVElUWSBlcXVhbHMgIiYjeDNEOyI%2BPCFFTlRJVFkgZ3QgIiYjeDNFOyI%2BPCFFTlRJVFkgR1QgIiYjeDNFOyI%2BPCFFTlRJVFkgcXVlc3QgIiYjeDNGOyI%2BPCFFTlRJVFkgY29tbWF0ICImI3g0MDsiPjwhRU5USVRZIGxzcWIgIiYjeDVCOyI%2BPCFFTlRJVFkgbGJyYWNrICImI3g1QjsiPjwhRU5USVRZIGJzb2wgIiYjeDVDOyI%2BPCFFTlRJVFkgcnNxYiAiJiN4NUQ7Ij48IUVOVElUWSByYnJhY2sgIiYjeDVEOyI%2BPCFFTlRJVFkgSGF0ICImI3g1RTsiPjwhRU5USVRZIGxvd2JhciAiJiN4NUY7Ij48IUVOVElUWSBVbmRlckJhciAiJiN4NUY7Ij48IUVOVElUWSBncmF2ZSAiJiN4NjA7Ij48IUVOVElUWSBEaWFjcml0aWNhbEdyYXZlICImI3g2MDsiPjwhRU5USVRZIGxjdWIgIiYjeDdCOyI%2BPCFFTlRJVFkgbGJyYWNlICImI3g3QjsiPjwhRU5USVRZIHZlcmJhciAiJiN4N0M7Ij48IUVOVElUWSB2ZXJ0ICImI3g3QzsiPjwhRU5USVRZIFZlcnRpY2FsTGluZSAiJiN4N0M7Ij48IUVOVElUWSByY3ViICImI3g3RDsiPjwhRU5USVRZIHJicmFjZSAiJiN4N0Q7Ij48IUVOVElUWSBuYnNwICImI3hBMDsiPjwhRU5USVRZIE5vbkJyZWFraW5nU3BhY2UgIiYjeEEwOyI%2BPCFFTlRJVFkgaWV4Y2wgIiYjeEExOyI%2BPCFFTlRJVFkgY2VudCAiJiN4QTI7Ij48IUVOVElUWSBwb3VuZCAiJiN4QTM7Ij48IUVOVElUWSBjdXJyZW4gIiYjeEE0OyI%2BPCFFTlRJVFkgeWVuICImI3hBNTsiPjwhRU5USVRZIGJydmJhciAiJiN4QTY7Ij48IUVOVElUWSBzZWN0ICImI3hBNzsiPjwhRU5USVRZIERvdCAiJiN4QTg7Ij48IUVOVElUWSBkaWUgIiYjeEE4OyI%2BPCFFTlRJVFkgRG91YmxlRG90ICImI3hBODsiPjwhRU5USVRZIHVtbCAiJiN4QTg7Ij48IUVOVElUWSBjb3B5ICImI3hBOTsiPjwhRU5USVRZIENPUFkgIiYjeEE5OyI%2BPCFFTlRJVFkgb3JkZiAiJiN4QUE7Ij48IUVOVElUWSBsYXF1byAiJiN4QUI7Ij48IUVOVElUWSBub3QgIiYjeEFDOyI%2BPCFFTlRJVFkgc2h5ICImI3hBRDsiPjwhRU5USVRZIHJlZyAiJiN4QUU7Ij48IUVOVElUWSBjaXJjbGVkUiAiJiN4QUU7Ij48IUVOVElUWSBSRUcgIiYjeEFFOyI%2BPCFFTlRJVFkgbWFjciAiJiN4QUY7Ij48IUVOVElUWSBzdHJucyAiJiN4QUY7Ij48IUVOVElUWSBkZWcgIiYjeEIwOyI%2BPCFFTlRJVFkgcGx1c21uICImI3hCMTsiPjwhRU5USVRZIHBtICImI3hCMTsiPjwhRU5USVRZIFBsdXNNaW51cyAiJiN4QjE7Ij48IUVOVElUWSBzdXAyICImI3hCMjsiPjwhRU5USVRZIHN1cDMgIiYjeEIzOyI%2BPCFFTlRJVFkgYWN1dGUgIiYjeEI0OyI%2BPCFFTlRJVFkgRGlhY3JpdGljYWxBY3V0ZSAiJiN4QjQ7Ij48IUVOVElUWSBtaWNybyAiJiN4QjU7Ij48IUVOVElUWSBwYXJhICImI3hCNjsiPjwhRU5USVRZIG1pZGRvdCAiJiN4Qjc7Ij48IUVOVElUWSBjZW50ZXJkb3QgIiYjeEI3OyI%2BPCFFTlRJVFkgQ2VudGVyRG90ICImI3hCNzsiPjwhRU5USVRZIGNlZGlsICImI3hCODsiPjwhRU5USVRZIENlZGlsbGEgIiYjeEI4OyI%2BPCFFTlRJVFkgc3VwMSAiJiN4Qjk7Ij48IUVOVElUWSBvcmRtICImI3hCQTsiPjwhRU5USVRZIHJhcXVvICImI3hCQjsiPjwhRU5USVRZIGZyYWMxNCAiJiN4QkM7Ij48IUVOVElUWSBmcmFjMTIgIiYjeEJEOyI%2BPCFFTlRJVFkgaGFsZiAiJiN4QkQ7Ij48IUVOVElUWSBmcmFjMzQgIiYjeEJFOyI%2BPCFFTlRJVFkgaXF1ZXN0ICImI3hCRjsiPjwhRU5USVRZIEFncmF2ZSAiJiN4QzA7Ij48IUVOVElUWSBBYWN1dGUgIiYjeEMxOyI%2BPCFFTlRJVFkgQWNpcmMgIiYjeEMyOyI%2BPCFFTlRJVFkgQXRpbGRlICImI3hDMzsiPjwhRU5USVRZIEF1bWwgIiYjeEM0OyI%2BPCFFTlRJVFkgQXJpbmcgIiYjeEM1OyI%2BPCFFTlRJVFkgYW5nc3QgIiYjeEM1OyI%2BPCFFTlRJVFkgQUVsaWcgIiYjeEM2OyI%2BPCFFTlRJVFkgQ2NlZGlsICImI3hDNzsiPjwhRU5USVRZIEVncmF2ZSAiJiN4Qzg7Ij48IUVOVElUWSBFYWN1dGUgIiYjeEM5OyI%2BPCFFTlRJVFkgRWNpcmMgIiYjeENBOyI%2BPCFFTlRJVFkgRXVtbCAiJiN4Q0I7Ij48IUVOVElUWSBJZ3JhdmUgIiYjeENDOyI%2BPCFFTlRJVFkgSWFjdXRlICImI3hDRDsiPjwhRU5USVRZIEljaXJjICImI3hDRTsiPjwhRU5USVRZIEl1bWwgIiYjeENGOyI%2BPCFFTlRJVFkgRVRIICImI3hEMDsiPjwhRU5USVRZIE50aWxkZSAiJiN4RDE7Ij48IUVOVElUWSBPZ3JhdmUgIiYjeEQyOyI%2BPCFFTlRJVFkgT2FjdXRlICImI3hEMzsiPjwhRU5USVRZIE9jaXJjICImI3hENDsiPjwhRU5USVRZIE90aWxkZSAiJiN4RDU7Ij48IUVOVElUWSBPdW1sICImI3hENjsiPjwhRU5USVRZIHRpbWVzICImI3hENzsiPjwhRU5USVRZIE9zbGFzaCAiJiN4RDg7Ij48IUVOVElUWSBVZ3JhdmUgIiYjeEQ5OyI%2BPCFFTlRJVFkgVWFjdXRlICImI3hEQTsiPjwhRU5USVRZIFVjaXJjICImI3hEQjsiPjwhRU5USVRZIFV1bWwgIiYjeERDOyI%2BPCFFTlRJVFkgWWFjdXRlICImI3hERDsiPjwhRU5USVRZIFRIT1JOICImI3hERTsiPjwhRU5USVRZIHN6bGlnICImI3hERjsiPjwhRU5USVRZIGFncmF2ZSAiJiN4RTA7Ij48IUVOVElUWSBhYWN1dGUgIiYjeEUxOyI%2BPCFFTlRJVFkgYWNpcmMgIiYjeEUyOyI%2BPCFFTlRJVFkgYXRpbGRlICImI3hFMzsiPjwhRU5USVRZIGF1bWwgIiYjeEU0OyI%2BPCFFTlRJVFkgYXJpbmcgIiYjeEU1OyI%2BPCFFTlRJVFkgYWVsaWcgIiYjeEU2OyI%2BPCFFTlRJVFkgY2NlZGlsICImI3hFNzsiPjwhRU5USVRZIGVncmF2ZSAiJiN4RTg7Ij48IUVOVElUWSBlYWN1dGUgIiYjeEU5OyI%2BPCFFTlRJVFkgZWNpcmMgIiYjeEVBOyI%2BPCFFTlRJVFkgZXVtbCAiJiN4RUI7Ij48IUVOVElUWSBpZ3JhdmUgIiYjeEVDOyI%2BPCFFTlRJVFkgaWFjdXRlICImI3hFRDsiPjwhRU5USVRZIGljaXJjICImI3hFRTsiPjwhRU5USVRZIGl1bWwgIiYjeEVGOyI%2BPCFFTlRJVFkgZXRoICImI3hGMDsiPjwhRU5USVRZIG50aWxkZSAiJiN4RjE7Ij48IUVOVElUWSBvZ3JhdmUgIiYjeEYyOyI%2BPCFFTlRJVFkgb2FjdXRlICImI3hGMzsiPjwhRU5USVRZIG9jaXJjICImI3hGNDsiPjwhRU5USVRZIG90aWxkZSAiJiN4RjU7Ij48IUVOVElUWSBvdW1sICImI3hGNjsiPjwhRU5USVRZIGRpdmlkZSAiJiN4Rjc7Ij48IUVOVElUWSBkaXYgIiYjeEY3OyI%2BPCFFTlRJVFkgb3NsYXNoICImI3hGODsiPjwhRU5USVRZIHVncmF2ZSAiJiN4Rjk7Ij48IUVOVElUWSB1YWN1dGUgIiYjeEZBOyI%2BPCFFTlRJVFkgdWNpcmMgIiYjeEZCOyI%2BPCFFTlRJVFkgdXVtbCAiJiN4RkM7Ij48IUVOVElUWSB5YWN1dGUgIiYjeEZEOyI%2BPCFFTlRJVFkgdGhvcm4gIiYjeEZFOyI%2BPCFFTlRJVFkgeXVtbCAiJiN4RkY7Ij48IUVOVElUWSBBbWFjciAiJiN4MTAwOyI%2BPCFFTlRJVFkgYW1hY3IgIiYjeDEwMTsiPjwhRU5USVRZIEFicmV2ZSAiJiN4MTAyOyI%2BPCFFTlRJVFkgYWJyZXZlICImI3gxMDM7Ij48IUVOVElUWSBBb2dvbiAiJiN4MTA0OyI%2BPCFFTlRJVFkgYW9nb24gIiYjeDEwNTsiPjwhRU5USVRZIENhY3V0ZSAiJiN4MTA2OyI%2BPCFFTlRJVFkgY2FjdXRlICImI3gxMDc7Ij48IUVOVElUWSBDY2lyYyAiJiN4MTA4OyI%2BPCFFTlRJVFkgY2NpcmMgIiYjeDEwOTsiPjwhRU5USVRZIENkb3QgIiYjeDEwQTsiPjwhRU5USVRZIGNkb3QgIiYjeDEwQjsiPjwhRU5USVRZIENjYXJvbiAiJiN4MTBDOyI%2BPCFFTlRJVFkgY2Nhcm9uICImI3gxMEQ7Ij48IUVOVElUWSBEY2Fyb24gIiYjeDEwRTsiPjwhRU5USVRZIGRjYXJvbiAiJiN4MTBGOyI%2BPCFFTlRJVFkgRHN0cm9rICImI3gxMTA7Ij48IUVOVElUWSBkc3Ryb2sgIiYjeDExMTsiPjwhRU5USVRZIEVtYWNyICImI3gxMTI7Ij48IUVOVElUWSBlbWFjciAiJiN4MTEzOyI%2BPCFFTlRJVFkgRWRvdCAiJiN4MTE2OyI%2BPCFFTlRJVFkgZWRvdCAiJiN4MTE3OyI%2BPCFFTlRJVFkgRW9nb24gIiYjeDExODsiPjwhRU5USVRZIGVvZ29uICImI3gxMTk7Ij48IUVOVElUWSBFY2Fyb24gIiYjeDExQTsiPjwhRU5USVRZIGVjYXJvbiAiJiN4MTFCOyI%2BPCFFTlRJVFkgR2NpcmMgIiYjeDExQzsiPjwhRU5USVRZIGdjaXJjICImI3gxMUQ7Ij48IUVOVElUWSBHYnJldmUgIiYjeDExRTsiPjwhRU5USVRZIGdicmV2ZSAiJiN4MTFGOyI%2BPCFFTlRJVFkgR2RvdCAiJiN4MTIwOyI%2BPCFFTlRJVFkgZ2RvdCAiJiN4MTIxOyI%2BPCFFTlRJVFkgR2NlZGlsICImI3gxMjI7Ij48IUVOVElUWSBIY2lyYyAiJiN4MTI0OyI%2BPCFFTlRJVFkgaGNpcmMgIiYjeDEyNTsiPjwhRU5USVRZIEhzdHJvayAiJiN4MTI2OyI%2BPCFFTlRJVFkgaHN0cm9rICImI3gxMjc7Ij48IUVOVElUWSBJdGlsZGUgIiYjeDEyODsiPjwhRU5USVRZIGl0aWxkZSAiJiN4MTI5OyI%2BPCFFTlRJVFkgSW1hY3IgIiYjeDEyQTsiPjwhRU5USVRZIGltYWNyICImI3gxMkI7Ij48IUVOVElUWSBJb2dvbiAiJiN4MTJFOyI%2BPCFFTlRJVFkgaW9nb24gIiYjeDEyRjsiPjwhRU5USVRZIElkb3QgIiYjeDEzMDsiPjwhRU5USVRZIGltYXRoICImI3gxMzE7Ij48IUVOVElUWSBpbm9kb3QgIiYjeDEzMTsiPjwhRU5USVRZIElKbGlnICImI3gxMzI7Ij48IUVOVElUWSBpamxpZyAiJiN4MTMzOyI%2BPCFFTlRJVFkgSmNpcmMgIiYjeDEzNDsiPjwhRU5USVRZIGpjaXJjICImI3gxMzU7Ij48IUVOVElUWSBLY2VkaWwgIiYjeDEzNjsiPjwhRU5USVRZIGtjZWRpbCAiJiN4MTM3OyI%2BPCFFTlRJVFkga2dyZWVuICImI3gxMzg7Ij48IUVOVElUWSBMYWN1dGUgIiYjeDEzOTsiPjwhRU5USVRZIGxhY3V0ZSAiJiN4MTNBOyI%2BPCFFTlRJVFkgTGNlZGlsICImI3gxM0I7Ij48IUVOVElUWSBsY2VkaWwgIiYjeDEzQzsiPjwhRU5USVRZIExjYXJvbiAiJiN4MTNEOyI%2BPCFFTlRJVFkgbGNhcm9uICImI3gxM0U7Ij48IUVOVElUWSBMbWlkb3QgIiYjeDEzRjsiPjwhRU5USVRZIGxtaWRvdCAiJiN4MTQwOyI%2BPCFFTlRJVFkgTHN0cm9rICImI3gxNDE7Ij48IUVOVElUWSBsc3Ryb2sgIiYjeDE0MjsiPjwhRU5USVRZIE5hY3V0ZSAiJiN4MTQzOyI%2BPCFFTlRJVFkgbmFjdXRlICImI3gxNDQ7Ij48IUVOVElUWSBOY2VkaWwgIiYjeDE0NTsiPjwhRU5USVRZIG5jZWRpbCAiJiN4MTQ2OyI%2BPCFFTlRJVFkgTmNhcm9uICImI3gxNDc7Ij48IUVOVElUWSBuY2Fyb24gIiYjeDE0ODsiPjwhRU5USVRZIG5hcG9zICImI3gxNDk7Ij48IUVOVElUWSBFTkcgIiYjeDE0QTsiPjwhRU5USVRZIGVuZyAiJiN4MTRCOyI%2BPCFFTlRJVFkgT21hY3IgIiYjeDE0QzsiPjwhRU5USVRZIG9tYWNyICImI3gxNEQ7Ij48IUVOVElUWSBPZGJsYWMgIiYjeDE1MDsiPjwhRU5USVRZIG9kYmxhYyAiJiN4MTUxOyI%2BPCFFTlRJVFkgT0VsaWcgIiYjeDE1MjsiPjwhRU5USVRZIG9lbGlnICImI3gxNTM7Ij48IUVOVElUWSBSYWN1dGUgIiYjeDE1NDsiPjwhRU5USVRZIHJhY3V0ZSAiJiN4MTU1OyI%2BPCFFTlRJVFkgUmNlZGlsICImI3gxNTY7Ij48IUVOVElUWSByY2VkaWwgIiYjeDE1NzsiPjwhRU5USVRZIFJjYXJvbiAiJiN4MTU4OyI%2BPCFFTlRJVFkgcmNhcm9uICImI3gxNTk7Ij48IUVOVElUWSBTYWN1dGUgIiYjeDE1QTsiPjwhRU5USVRZIHNhY3V0ZSAiJiN4MTVCOyI%2BPCFFTlRJVFkgU2NpcmMgIiYjeDE1QzsiPjwhRU5USVRZIHNjaXJjICImI3gxNUQ7Ij48IUVOVElUWSBTY2VkaWwgIiYjeDE1RTsiPjwhRU5USVRZIHNjZWRpbCAiJiN4MTVGOyI%2BPCFFTlRJVFkgU2Nhcm9uICImI3gxNjA7Ij48IUVOVElUWSBzY2Fyb24gIiYjeDE2MTsiPjwhRU5USVRZIFRjZWRpbCAiJiN4MTYyOyI%2BPCFFTlRJVFkgdGNlZGlsICImI3gxNjM7Ij48IUVOVElUWSBUY2Fyb24gIiYjeDE2NDsiPjwhRU5USVRZIHRjYXJvbiAiJiN4MTY1OyI%2BPCFFTlRJVFkgVHN0cm9rICImI3gxNjY7Ij48IUVOVElUWSB0c3Ryb2sgIiYjeDE2NzsiPjwhRU5USVRZIFV0aWxkZSAiJiN4MTY4OyI%2BPCFFTlRJVFkgdXRpbGRlICImI3gxNjk7Ij48IUVOVElUWSBVbWFjciAiJiN4MTZBOyI%2BPCFFTlRJVFkgdW1hY3IgIiYjeDE2QjsiPjwhRU5USVRZIFVicmV2ZSAiJiN4MTZDOyI%2BPCFFTlRJVFkgdWJyZXZlICImI3gxNkQ7Ij48IUVOVElUWSBVcmluZyAiJiN4MTZFOyI%2BPCFFTlRJVFkgdXJpbmcgIiYjeDE2RjsiPjwhRU5USVRZIFVkYmxhYyAiJiN4MTcwOyI%2BPCFFTlRJVFkgdWRibGFjICImI3gxNzE7Ij48IUVOVElUWSBVb2dvbiAiJiN4MTcyOyI%2BPCFFTlRJVFkgdW9nb24gIiYjeDE3MzsiPjwhRU5USVRZIFdjaXJjICImI3gxNzQ7Ij48IUVOVElUWSB3Y2lyYyAiJiN4MTc1OyI%2BPCFFTlRJVFkgWWNpcmMgIiYjeDE3NjsiPjwhRU5USVRZIHljaXJjICImI3gxNzc7Ij48IUVOVElUWSBZdW1sICImI3gxNzg7Ij48IUVOVElUWSBaYWN1dGUgIiYjeDE3OTsiPjwhRU5USVRZIHphY3V0ZSAiJiN4MTdBOyI%2BPCFFTlRJVFkgWmRvdCAiJiN4MTdCOyI%2BPCFFTlRJVFkgemRvdCAiJiN4MTdDOyI%2BPCFFTlRJVFkgWmNhcm9uICImI3gxN0Q7Ij48IUVOVElUWSB6Y2Fyb24gIiYjeDE3RTsiPjwhRU5USVRZIGZub2YgIiYjeDE5MjsiPjwhRU5USVRZIGltcGVkICImI3gxQjU7Ij48IUVOVElUWSBnYWN1dGUgIiYjeDFGNTsiPjwhRU5USVRZIGptYXRoICImI3gyMzc7Ij48IUVOVElUWSBjaXJjICImI3gyQzY7Ij48IUVOVElUWSBjYXJvbiAiJiN4MkM3OyI%2BPCFFTlRJVFkgSGFjZWsgIiYjeDJDNzsiPjwhRU5USVRZIGJyZXZlICImI3gyRDg7Ij48IUVOVElUWSBCcmV2ZSAiJiN4MkQ4OyI%2BPCFFTlRJVFkgZG90ICImI3gyRDk7Ij48IUVOVElUWSBEaWFjcml0aWNhbERvdCAiJiN4MkQ5OyI%2BPCFFTlRJVFkgcmluZyAiJiN4MkRBOyI%2BPCFFTlRJVFkgb2dvbiAiJiN4MkRCOyI%2BPCFFTlRJVFkgdGlsZGUgIiYjeDJEQzsiPjwhRU5USVRZIERpYWNyaXRpY2FsVGlsZGUgIiYjeDJEQzsiPjwhRU5USVRZIGRibGFjICImI3gyREQ7Ij48IUVOVElUWSBEaWFjcml0aWNhbERvdWJsZUFjdXRlICImI3gyREQ7Ij48IUVOVElUWSBEb3duQnJldmUgIiYjeDMxMTsiPjwhRU5USVRZIEFscGhhICImI3gzOTE7Ij48IUVOVElUWSBCZXRhICImI3gzOTI7Ij48IUVOVElUWSBHYW1tYSAiJiN4MzkzOyI%2BPCFFTlRJVFkgRGVsdGEgIiYjeDM5NDsiPjwhRU5USVRZIEVwc2lsb24gIiYjeDM5NTsiPjwhRU5USVRZIFpldGEgIiYjeDM5NjsiPjwhRU5USVRZIEV0YSAiJiN4Mzk3OyI%2BPCFFTlRJVFkgVGhldGEgIiYjeDM5ODsiPjwhRU5USVRZIElvdGEgIiYjeDM5OTsiPjwhRU5USVRZIEthcHBhICImI3gzOUE7Ij48IUVOVElUWSBMYW1iZGEgIiYjeDM5QjsiPjwhRU5USVRZIE11ICImI3gzOUM7Ij48IUVOVElUWSBOdSAiJiN4MzlEOyI%2BPCFFTlRJVFkgWGkgIiYjeDM5RTsiPjwhRU5USVRZIE9taWNyb24gIiYjeDM5RjsiPjwhRU5USVRZIFBpICImI3gzQTA7Ij48IUVOVElUWSBSaG8gIiYjeDNBMTsiPjwhRU5USVRZIFNpZ21hICImI3gzQTM7Ij48IUVOVElUWSBUYXUgIiYjeDNBNDsiPjwhRU5USVRZIFVwc2lsb24gIiYjeDNBNTsiPjwhRU5USVRZIFBoaSAiJiN4M0E2OyI%2BPCFFTlRJVFkgQ2hpICImI3gzQTc7Ij48IUVOVElUWSBQc2kgIiYjeDNBODsiPjwhRU5USVRZIE9tZWdhICImI3gzQTk7Ij48IUVOVElUWSBvaG0gIiYjeDNBOTsiPjwhRU5USVRZIGFscGhhICImI3gzQjE7Ij48IUVOVElUWSBiZXRhICImI3gzQjI7Ij48IUVOVElUWSBnYW1tYSAiJiN4M0IzOyI%2BPCFFTlRJVFkgZGVsdGEgIiYjeDNCNDsiPjwhRU5USVRZIGVwc2kgIiYjeDNCNTsiPjwhRU5USVRZIGVwc2lsb24gIiYjeDNCNTsiPjwhRU5USVRZIHpldGEgIiYjeDNCNjsiPjwhRU5USVRZIGV0YSAiJiN4M0I3OyI%2BPCFFTlRJVFkgdGhldGEgIiYjeDNCODsiPjwhRU5USVRZIGlvdGEgIiYjeDNCOTsiPjwhRU5USVRZIGthcHBhICImI3gzQkE7Ij48IUVOVElUWSBsYW1iZGEgIiYjeDNCQjsiPjwhRU5USVRZIG11ICImI3gzQkM7Ij48IUVOVElUWSBudSAiJiN4M0JEOyI%2BPCFFTlRJVFkgeGkgIiYjeDNCRTsiPjwhRU5USVRZIG9taWNyb24gIiYjeDNCRjsiPjwhRU5USVRZIHBpICImI3gzQzA7Ij48IUVOVElUWSByaG8gIiYjeDNDMTsiPjwhRU5USVRZIHNpZ21hdiAiJiN4M0MyOyI%2BPCFFTlRJVFkgdmFyc2lnbWEgIiYjeDNDMjsiPjwhRU5USVRZIHNpZ21hZiAiJiN4M0MyOyI%2BPCFFTlRJVFkgc2lnbWEgIiYjeDNDMzsiPjwhRU5USVRZIHRhdSAiJiN4M0M0OyI%2BPCFFTlRJVFkgdXBzaSAiJiN4M0M1OyI%2BPCFFTlRJVFkgdXBzaWxvbiAiJiN4M0M1OyI%2BPCFFTlRJVFkgcGhpICImI3gzQzY7Ij48IUVOVElUWSBjaGkgIiYjeDNDNzsiPjwhRU5USVRZIHBzaSAiJiN4M0M4OyI%2BPCFFTlRJVFkgb21lZ2EgIiYjeDNDOTsiPjwhRU5USVRZIHRoZXRhdiAiJiN4M0QxOyI%2BPCFFTlRJVFkgdmFydGhldGEgIiYjeDNEMTsiPjwhRU5USVRZIHRoZXRhc3ltICImI3gzRDE7Ij48IUVOVElUWSBVcHNpICImI3gzRDI7Ij48IUVOVElUWSB1cHNpaCAiJiN4M0QyOyI%2BPCFFTlRJVFkgc3RyYWlnaHRwaGkgIiYjeDNENTsiPjwhRU5USVRZIHBoaXYgIiYjeDNENTsiPjwhRU5USVRZIHZhcnBoaSAiJiN4M0Q1OyI%2BPCFFTlRJVFkgcGl2ICImI3gzRDY7Ij48IUVOVElUWSB2YXJwaSAiJiN4M0Q2OyI%2BPCFFTlRJVFkgR2FtbWFkICImI3gzREM7Ij48IUVOVElUWSBnYW1tYWQgIiYjeDNERDsiPjwhRU5USVRZIGRpZ2FtbWEgIiYjeDNERDsiPjwhRU5USVRZIGthcHBhdiAiJiN4M0YwOyI%2BPCFFTlRJVFkgdmFya2FwcGEgIiYjeDNGMDsiPjwhRU5USVRZIHJob3YgIiYjeDNGMTsiPjwhRU5USVRZIHZhcnJobyAiJiN4M0YxOyI%2BPCFFTlRJVFkgZXBzaXYgIiYjeDNGNTsiPjwhRU5USVRZIHN0cmFpZ2h0ZXBzaWxvbiAiJiN4M0Y1OyI%2BPCFFTlRJVFkgdmFyZXBzaWxvbiAiJiN4M0Y1OyI%2BPCFFTlRJVFkgYmVwc2kgIiYjeDNGNjsiPjwhRU5USVRZIGJhY2tlcHNpbG9uICImI3gzRjY7Ij48IUVOVElUWSBJT2N5ICImI3g0MDE7Ij48IUVOVElUWSBESmN5ICImI3g0MDI7Ij48IUVOVElUWSBHSmN5ICImI3g0MDM7Ij48IUVOVElUWSBKdWtjeSAiJiN4NDA0OyI%2BPCFFTlRJVFkgRFNjeSAiJiN4NDA1OyI%2BPCFFTlRJVFkgSXVrY3kgIiYjeDQwNjsiPjwhRU5USVRZIFlJY3kgIiYjeDQwNzsiPjwhRU5USVRZIEpzZXJjeSAiJiN4NDA4OyI%2BPCFFTlRJVFkgTEpjeSAiJiN4NDA5OyI%2BPCFFTlRJVFkgTkpjeSAiJiN4NDBBOyI%2BPCFFTlRJVFkgVFNIY3kgIiYjeDQwQjsiPjwhRU5USVRZIEtKY3kgIiYjeDQwQzsiPjwhRU5USVRZIFVicmN5ICImI3g0MEU7Ij48IUVOVElUWSBEWmN5ICImI3g0MEY7Ij48IUVOVElUWSBBY3kgIiYjeDQxMDsiPjwhRU5USVRZIEJjeSAiJiN4NDExOyI%2BPCFFTlRJVFkgVmN5ICImI3g0MTI7Ij48IUVOVElUWSBHY3kgIiYjeDQxMzsiPjwhRU5USVRZIERjeSAiJiN4NDE0OyI%2BPCFFTlRJVFkgSUVjeSAiJiN4NDE1OyI%2BPCFFTlRJVFkgWkhjeSAiJiN4NDE2OyI%2BPCFFTlRJVFkgWmN5ICImI3g0MTc7Ij48IUVOVElUWSBJY3kgIiYjeDQxODsiPjwhRU5USVRZIEpjeSAiJiN4NDE5OyI%2BPCFFTlRJVFkgS2N5ICImI3g0MUE7Ij48IUVOVElUWSBMY3kgIiYjeDQxQjsiPjwhRU5USVRZIE1jeSAiJiN4NDFDOyI%2BPCFFTlRJVFkgTmN5ICImI3g0MUQ7Ij48IUVOVElUWSBPY3kgIiYjeDQxRTsiPjwhRU5USVRZIFBjeSAiJiN4NDFGOyI%2BPCFFTlRJVFkgUmN5ICImI3g0MjA7Ij48IUVOVElUWSBTY3kgIiYjeDQyMTsiPjwhRU5USVRZIFRjeSAiJiN4NDIyOyI%2BPCFFTlRJVFkgVWN5ICImI3g0MjM7Ij48IUVOVElUWSBGY3kgIiYjeDQyNDsiPjwhRU5USVRZIEtIY3kgIiYjeDQyNTsiPjwhRU5USVRZIFRTY3kgIiYjeDQyNjsiPjwhRU5USVRZIENIY3kgIiYjeDQyNzsiPjwhRU5USVRZIFNIY3kgIiYjeDQyODsiPjwhRU5USVRZIFNIQ0hjeSAiJiN4NDI5OyI%2BPCFFTlRJVFkgSEFSRGN5ICImI3g0MkE7Ij48IUVOVElUWSBZY3kgIiYjeDQyQjsiPjwhRU5USVRZIFNPRlRjeSAiJiN4NDJDOyI%2BPCFFTlRJVFkgRWN5ICImI3g0MkQ7Ij48IUVOVElUWSBZVWN5ICImI3g0MkU7Ij48IUVOVElUWSBZQWN5ICImI3g0MkY7Ij48IUVOVElUWSBhY3kgIiYjeDQzMDsiPjwhRU5USVRZIGJjeSAiJiN4NDMxOyI%2BPCFFTlRJVFkgdmN5ICImI3g0MzI7Ij48IUVOVElUWSBnY3kgIiYjeDQzMzsiPjwhRU5USVRZIGRjeSAiJiN4NDM0OyI%2BPCFFTlRJVFkgaWVjeSAiJiN4NDM1OyI%2BPCFFTlRJVFkgemhjeSAiJiN4NDM2OyI%2BPCFFTlRJVFkgemN5ICImI3g0Mzc7Ij48IUVOVElUWSBpY3kgIiYjeDQzODsiPjwhRU5USVRZIGpjeSAiJiN4NDM5OyI%2BPCFFTlRJVFkga2N5ICImI3g0M0E7Ij48IUVOVElUWSBsY3kgIiYjeDQzQjsiPjwhRU5USVRZIG1jeSAiJiN4NDNDOyI%2BPCFFTlRJVFkgbmN5ICImI3g0M0Q7Ij48IUVOVElUWSBvY3kgIiYjeDQzRTsiPjwhRU5USVRZIHBjeSAiJiN4NDNGOyI%2BPCFFTlRJVFkgcmN5ICImI3g0NDA7Ij48IUVOVElUWSBzY3kgIiYjeDQ0MTsiPjwhRU5USVRZIHRjeSAiJiN4NDQyOyI%2BPCFFTlRJVFkgdWN5ICImI3g0NDM7Ij48IUVOVElUWSBmY3kgIiYjeDQ0NDsiPjwhRU5USVRZIGtoY3kgIiYjeDQ0NTsiPjwhRU5USVRZIHRzY3kgIiYjeDQ0NjsiPjwhRU5USVRZIGNoY3kgIiYjeDQ0NzsiPjwhRU5USVRZIHNoY3kgIiYjeDQ0ODsiPjwhRU5USVRZIHNoY2hjeSAiJiN4NDQ5OyI%2BPCFFTlRJVFkgaGFyZGN5ICImI3g0NEE7Ij48IUVOVElUWSB5Y3kgIiYjeDQ0QjsiPjwhRU5USVRZIHNvZnRjeSAiJiN4NDRDOyI%2BPCFFTlRJVFkgZWN5ICImI3g0NEQ7Ij48IUVOVElUWSB5dWN5ICImI3g0NEU7Ij48IUVOVElUWSB5YWN5ICImI3g0NEY7Ij48IUVOVElUWSBpb2N5ICImI3g0NTE7Ij48IUVOVElUWSBkamN5ICImI3g0NTI7Ij48IUVOVElUWSBnamN5ICImI3g0NTM7Ij48IUVOVElUWSBqdWtjeSAiJiN4NDU0OyI%2BPCFFTlRJVFkgZHNjeSAiJiN4NDU1OyI%2BPCFFTlRJVFkgaXVrY3kgIiYjeDQ1NjsiPjwhRU5USVRZIHlpY3kgIiYjeDQ1NzsiPjwhRU5USVRZIGpzZXJjeSAiJiN4NDU4OyI%2BPCFFTlRJVFkgbGpjeSAiJiN4NDU5OyI%2BPCFFTlRJVFkgbmpjeSAiJiN4NDVBOyI%2BPCFFTlRJVFkgdHNoY3kgIiYjeDQ1QjsiPjwhRU5USVRZIGtqY3kgIiYjeDQ1QzsiPjwhRU5USVRZIHVicmN5ICImI3g0NUU7Ij48IUVOVElUWSBkemN5ICImI3g0NUY7Ij48IUVOVElUWSBlbnNwICImI3gyMDAyOyI%2BPCFFTlRJVFkgZW1zcCAiJiN4MjAwMzsiPjwhRU5USVRZIGVtc3AxMyAiJiN4MjAwNDsiPjwhRU5USVRZIGVtc3AxNCAiJiN4MjAwNTsiPjwhRU5USVRZIG51bXNwICImI3gyMDA3OyI%2BPCFFTlRJVFkgcHVuY3NwICImI3gyMDA4OyI%2BPCFFTlRJVFkgdGhpbnNwICImI3gyMDA5OyI%2BPCFFTlRJVFkgVGhpblNwYWNlICImI3gyMDA5OyI%2BPCFFTlRJVFkgaGFpcnNwICImI3gyMDBBOyI%2BPCFFTlRJVFkgVmVyeVRoaW5TcGFjZSAiJiN4MjAwQTsiPjwhRU5USVRZIFplcm9XaWR0aFNwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgTmVnYXRpdmVWZXJ5VGhpblNwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgTmVnYXRpdmVUaGluU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZU1lZGl1bVNwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgTmVnYXRpdmVUaGlja1NwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgenduaiAiJiN4MjAwQzsiPjwhRU5USVRZIHp3aiAiJiN4MjAwRDsiPjwhRU5USVRZIGxybSAiJiN4MjAwRTsiPjwhRU5USVRZIHJsbSAiJiN4MjAwRjsiPjwhRU5USVRZIGh5cGhlbiAiJiN4MjAxMDsiPjwhRU5USVRZIGRhc2ggIiYjeDIwMTA7Ij48IUVOVElUWSBuZGFzaCAiJiN4MjAxMzsiPjwhRU5USVRZIG1kYXNoICImI3gyMDE0OyI%2BPCFFTlRJVFkgaG9yYmFyICImI3gyMDE1OyI%2BPCFFTlRJVFkgVmVyYmFyICImI3gyMDE2OyI%2BPCFFTlRJVFkgVmVydCAiJiN4MjAxNjsiPjwhRU5USVRZIGxzcXVvICImI3gyMDE4OyI%2BPCFFTlRJVFkgT3BlbkN1cmx5UXVvdGUgIiYjeDIwMTg7Ij48IUVOVElUWSByc3F1byAiJiN4MjAxOTsiPjwhRU5USVRZIHJzcXVvciAiJiN4MjAxOTsiPjwhRU5USVRZIENsb3NlQ3VybHlRdW90ZSAiJiN4MjAxOTsiPjwhRU5USVRZIGxzcXVvciAiJiN4MjAxQTsiPjwhRU5USVRZIHNicXVvICImI3gyMDFBOyI%2BPCFFTlRJVFkgbGRxdW8gIiYjeDIwMUM7Ij48IUVOVElUWSBPcGVuQ3VybHlEb3VibGVRdW90ZSAiJiN4MjAxQzsiPjwhRU5USVRZIHJkcXVvICImI3gyMDFEOyI%2BPCFFTlRJVFkgcmRxdW9yICImI3gyMDFEOyI%2BPCFFTlRJVFkgQ2xvc2VDdXJseURvdWJsZVF1b3RlICImI3gyMDFEOyI%2BPCFFTlRJVFkgbGRxdW9yICImI3gyMDFFOyI%2BPCFFTlRJVFkgYmRxdW8gIiYjeDIwMUU7Ij48IUVOVElUWSBkYWdnZXIgIiYjeDIwMjA7Ij48IUVOVElUWSBEYWdnZXIgIiYjeDIwMjE7Ij48IUVOVElUWSBkZGFnZ2VyICImI3gyMDIxOyI%2BPCFFTlRJVFkgYnVsbCAiJiN4MjAyMjsiPjwhRU5USVRZIGJ1bGxldCAiJiN4MjAyMjsiPjwhRU5USVRZIG5sZHIgIiYjeDIwMjU7Ij48IUVOVElUWSBoZWxsaXAgIiYjeDIwMjY7Ij48IUVOVElUWSBtbGRyICImI3gyMDI2OyI%2BPCFFTlRJVFkgcGVybWlsICImI3gyMDMwOyI%2BPCFFTlRJVFkgcGVydGVuayAiJiN4MjAzMTsiPjwhRU5USVRZIHByaW1lICImI3gyMDMyOyI%2BPCFFTlRJVFkgUHJpbWUgIiYjeDIwMzM7Ij48IUVOVElUWSB0cHJpbWUgIiYjeDIwMzQ7Ij48IUVOVElUWSBicHJpbWUgIiYjeDIwMzU7Ij48IUVOVElUWSBiYWNrcHJpbWUgIiYjeDIwMzU7Ij48IUVOVElUWSBsc2FxdW8gIiYjeDIwMzk7Ij48IUVOVElUWSByc2FxdW8gIiYjeDIwM0E7Ij48IUVOVElUWSBvbGluZSAiJiN4MjAzRTsiPjwhRU5USVRZIE92ZXJCYXIgIiYjeDIwM0U7Ij48IUVOVElUWSBjYXJldCAiJiN4MjA0MTsiPjwhRU5USVRZIGh5YnVsbCAiJiN4MjA0MzsiPjwhRU5USVRZIGZyYXNsICImI3gyMDQ0OyI%2BPCFFTlRJVFkgYnNlbWkgIiYjeDIwNEY7Ij48IUVOVElUWSBxcHJpbWUgIiYjeDIwNTc7Ij48IUVOVElUWSBNZWRpdW1TcGFjZSAiJiN4MjA1RjsiPjwhRU5USVRZIE5vQnJlYWsgIiYjeDIwNjA7Ij48IUVOVElUWSBBcHBseUZ1bmN0aW9uICImI3gyMDYxOyI%2BPCFFTlRJVFkgYWYgIiYjeDIwNjE7Ij48IUVOVElUWSBJbnZpc2libGVUaW1lcyAiJiN4MjA2MjsiPjwhRU5USVRZIGl0ICImI3gyMDYyOyI%2BPCFFTlRJVFkgSW52aXNpYmxlQ29tbWEgIiYjeDIwNjM7Ij48IUVOVElUWSBpYyAiJiN4MjA2MzsiPjwhRU5USVRZIGV1cm8gIiYjeDIwQUM7Ij48IUVOVElUWSB0ZG90ICImI3gyMERCOyI%2BPCFFTlRJVFkgVHJpcGxlRG90ICImI3gyMERCOyI%2BPCFFTlRJVFkgRG90RG90ICImI3gyMERDOyI%2BPCFFTlRJVFkgQ29wZiAiJiN4MjEwMjsiPjwhRU5USVRZIGNvbXBsZXhlcyAiJiN4MjEwMjsiPjwhRU5USVRZIGluY2FyZSAiJiN4MjEwNTsiPjwhRU5USVRZIGdzY3IgIiYjeDIxMEE7Ij48IUVOVElUWSBoYW1pbHQgIiYjeDIxMEI7Ij48IUVOVElUWSBIaWxiZXJ0U3BhY2UgIiYjeDIxMEI7Ij48IUVOVElUWSBIc2NyICImI3gyMTBCOyI%2BPCFFTlRJVFkgSGZyICImI3gyMTBDOyI%2BPCFFTlRJVFkgUG9pbmNhcmVwbGFuZSAiJiN4MjEwQzsiPjwhRU5USVRZIHF1YXRlcm5pb25zICImI3gyMTBEOyI%2BPCFFTlRJVFkgSG9wZiAiJiN4MjEwRDsiPjwhRU5USVRZIHBsYW5ja2ggIiYjeDIxMEU7Ij48IUVOVElUWSBwbGFuY2sgIiYjeDIxMEY7Ij48IUVOVElUWSBoYmFyICImI3gyMTBGOyI%2BPCFFTlRJVFkgcGxhbmt2ICImI3gyMTBGOyI%2BPCFFTlRJVFkgaHNsYXNoICImI3gyMTBGOyI%2BPCFFTlRJVFkgSXNjciAiJiN4MjExMDsiPjwhRU5USVRZIGltYWdsaW5lICImI3gyMTEwOyI%2BPCFFTlRJVFkgaW1hZ2UgIiYjeDIxMTE7Ij48IUVOVElUWSBJbSAiJiN4MjExMTsiPjwhRU5USVRZIGltYWdwYXJ0ICImI3gyMTExOyI%2BPCFFTlRJVFkgSWZyICImI3gyMTExOyI%2BPCFFTlRJVFkgTHNjciAiJiN4MjExMjsiPjwhRU5USVRZIGxhZ3JhbiAiJiN4MjExMjsiPjwhRU5USVRZIExhcGxhY2V0cmYgIiYjeDIxMTI7Ij48IUVOVElUWSBlbGwgIiYjeDIxMTM7Ij48IUVOVElUWSBOb3BmICImI3gyMTE1OyI%2BPCFFTlRJVFkgbmF0dXJhbHMgIiYjeDIxMTU7Ij48IUVOVElUWSBudW1lcm8gIiYjeDIxMTY7Ij48IUVOVElUWSBjb3B5c3IgIiYjeDIxMTc7Ij48IUVOVElUWSB3ZWllcnAgIiYjeDIxMTg7Ij48IUVOVElUWSB3cCAiJiN4MjExODsiPjwhRU5USVRZIFBvcGYgIiYjeDIxMTk7Ij48IUVOVElUWSBwcmltZXMgIiYjeDIxMTk7Ij48IUVOVElUWSByYXRpb25hbHMgIiYjeDIxMUE7Ij48IUVOVElUWSBRb3BmICImI3gyMTFBOyI%2BPCFFTlRJVFkgUnNjciAiJiN4MjExQjsiPjwhRU5USVRZIHJlYWxpbmUgIiYjeDIxMUI7Ij48IUVOVElUWSByZWFsICImI3gyMTFDOyI%2BPCFFTlRJVFkgUmUgIiYjeDIxMUM7Ij48IUVOVElUWSByZWFscGFydCAiJiN4MjExQzsiPjwhRU5USVRZIFJmciAiJiN4MjExQzsiPjwhRU5USVRZIHJlYWxzICImI3gyMTFEOyI%2BPCFFTlRJVFkgUm9wZiAiJiN4MjExRDsiPjwhRU5USVRZIHJ4ICImI3gyMTFFOyI%2BPCFFTlRJVFkgdHJhZGUgIiYjeDIxMjI7Ij48IUVOVElUWSBUUkFERSAiJiN4MjEyMjsiPjwhRU5USVRZIGludGVnZXJzICImI3gyMTI0OyI%2BPCFFTlRJVFkgWm9wZiAiJiN4MjEyNDsiPjwhRU5USVRZIG1obyAiJiN4MjEyNzsiPjwhRU5USVRZIFpmciAiJiN4MjEyODsiPjwhRU5USVRZIHplZXRyZiAiJiN4MjEyODsiPjwhRU5USVRZIGlpb3RhICImI3gyMTI5OyI%2BPCFFTlRJVFkgYmVybm91ICImI3gyMTJDOyI%2BPCFFTlRJVFkgQmVybm91bGxpcyAiJiN4MjEyQzsiPjwhRU5USVRZIEJzY3IgIiYjeDIxMkM7Ij48IUVOVElUWSBDZnIgIiYjeDIxMkQ7Ij48IUVOVElUWSBDYXlsZXlzICImI3gyMTJEOyI%2BPCFFTlRJVFkgZXNjciAiJiN4MjEyRjsiPjwhRU5USVRZIEVzY3IgIiYjeDIxMzA7Ij48IUVOVElUWSBleHBlY3RhdGlvbiAiJiN4MjEzMDsiPjwhRU5USVRZIEZzY3IgIiYjeDIxMzE7Ij48IUVOVElUWSBGb3VyaWVydHJmICImI3gyMTMxOyI%2BPCFFTlRJVFkgcGhtbWF0ICImI3gyMTMzOyI%2BPCFFTlRJVFkgTWVsbGludHJmICImI3gyMTMzOyI%2BPCFFTlRJVFkgTXNjciAiJiN4MjEzMzsiPjwhRU5USVRZIG9yZGVyICImI3gyMTM0OyI%2BPCFFTlRJVFkgb3JkZXJvZiAiJiN4MjEzNDsiPjwhRU5USVRZIG9zY3IgIiYjeDIxMzQ7Ij48IUVOVElUWSBhbGVmc3ltICImI3gyMTM1OyI%2BPCFFTlRJVFkgYWxlcGggIiYjeDIxMzU7Ij48IUVOVElUWSBiZXRoICImI3gyMTM2OyI%2BPCFFTlRJVFkgZ2ltZWwgIiYjeDIxMzc7Ij48IUVOVElUWSBkYWxldGggIiYjeDIxMzg7Ij48IUVOVElUWSBDYXBpdGFsRGlmZmVyZW50aWFsRCAiJiN4MjE0NTsiPjwhRU5USVRZIEREICImI3gyMTQ1OyI%2BPCFFTlRJVFkgRGlmZmVyZW50aWFsRCAiJiN4MjE0NjsiPjwhRU5USVRZIGRkICImI3gyMTQ2OyI%2BPCFFTlRJVFkgRXhwb25lbnRpYWxFICImI3gyMTQ3OyI%2BPCFFTlRJVFkgZXhwb25lbnRpYWxlICImI3gyMTQ3OyI%2BPCFFTlRJVFkgZWUgIiYjeDIxNDc7Ij48IUVOVElUWSBJbWFnaW5hcnlJICImI3gyMTQ4OyI%2BPCFFTlRJVFkgaWkgIiYjeDIxNDg7Ij48IUVOVElUWSBmcmFjMTMgIiYjeDIxNTM7Ij48IUVOVElUWSBmcmFjMjMgIiYjeDIxNTQ7Ij48IUVOVElUWSBmcmFjMTUgIiYjeDIxNTU7Ij48IUVOVElUWSBmcmFjMjUgIiYjeDIxNTY7Ij48IUVOVElUWSBmcmFjMzUgIiYjeDIxNTc7Ij48IUVOVElUWSBmcmFjNDUgIiYjeDIxNTg7Ij48IUVOVElUWSBmcmFjMTYgIiYjeDIxNTk7Ij48IUVOVElUWSBmcmFjNTYgIiYjeDIxNUE7Ij48IUVOVElUWSBmcmFjMTggIiYjeDIxNUI7Ij48IUVOVElUWSBmcmFjMzggIiYjeDIxNUM7Ij48IUVOVElUWSBmcmFjNTggIiYjeDIxNUQ7Ij48IUVOVElUWSBmcmFjNzggIiYjeDIxNUU7Ij48IUVOVElUWSBsYXJyICImI3gyMTkwOyI%2BPCFFTlRJVFkgbGVmdGFycm93ICImI3gyMTkwOyI%2BPCFFTlRJVFkgTGVmdEFycm93ICImI3gyMTkwOyI%2BPCFFTlRJVFkgc2xhcnIgIiYjeDIxOTA7Ij48IUVOVElUWSBTaG9ydExlZnRBcnJvdyAiJiN4MjE5MDsiPjwhRU5USVRZIHVhcnIgIiYjeDIxOTE7Ij48IUVOVElUWSB1cGFycm93ICImI3gyMTkxOyI%2BPCFFTlRJVFkgVXBBcnJvdyAiJiN4MjE5MTsiPjwhRU5USVRZIFNob3J0VXBBcnJvdyAiJiN4MjE5MTsiPjwhRU5USVRZIHJhcnIgIiYjeDIxOTI7Ij48IUVOVElUWSByaWdodGFycm93ICImI3gyMTkyOyI%2BPCFFTlRJVFkgUmlnaHRBcnJvdyAiJiN4MjE5MjsiPjwhRU5USVRZIHNyYXJyICImI3gyMTkyOyI%2BPCFFTlRJVFkgU2hvcnRSaWdodEFycm93ICImI3gyMTkyOyI%2BPCFFTlRJVFkgZGFyciAiJiN4MjE5MzsiPjwhRU5USVRZIGRvd25hcnJvdyAiJiN4MjE5MzsiPjwhRU5USVRZIERvd25BcnJvdyAiJiN4MjE5MzsiPjwhRU5USVRZIFNob3J0RG93bkFycm93ICImI3gyMTkzOyI%2BPCFFTlRJVFkgaGFyciAiJiN4MjE5NDsiPjwhRU5USVRZIGxlZnRyaWdodGFycm93ICImI3gyMTk0OyI%2BPCFFTlRJVFkgTGVmdFJpZ2h0QXJyb3cgIiYjeDIxOTQ7Ij48IUVOVElUWSB2YXJyICImI3gyMTk1OyI%2BPCFFTlRJVFkgdXBkb3duYXJyb3cgIiYjeDIxOTU7Ij48IUVOVElUWSBVcERvd25BcnJvdyAiJiN4MjE5NTsiPjwhRU5USVRZIG53YXJyICImI3gyMTk2OyI%2BPCFFTlRJVFkgVXBwZXJMZWZ0QXJyb3cgIiYjeDIxOTY7Ij48IUVOVElUWSBud2Fycm93ICImI3gyMTk2OyI%2BPCFFTlRJVFkgbmVhcnIgIiYjeDIxOTc7Ij48IUVOVElUWSBVcHBlclJpZ2h0QXJyb3cgIiYjeDIxOTc7Ij48IUVOVElUWSBuZWFycm93ICImI3gyMTk3OyI%2BPCFFTlRJVFkgc2VhcnIgIiYjeDIxOTg7Ij48IUVOVElUWSBzZWFycm93ICImI3gyMTk4OyI%2BPCFFTlRJVFkgTG93ZXJSaWdodEFycm93ICImI3gyMTk4OyI%2BPCFFTlRJVFkgc3dhcnIgIiYjeDIxOTk7Ij48IUVOVElUWSBzd2Fycm93ICImI3gyMTk5OyI%2BPCFFTlRJVFkgTG93ZXJMZWZ0QXJyb3cgIiYjeDIxOTk7Ij48IUVOVElUWSBubGFyciAiJiN4MjE5QTsiPjwhRU5USVRZIG5sZWZ0YXJyb3cgIiYjeDIxOUE7Ij48IUVOVElUWSBucmFyciAiJiN4MjE5QjsiPjwhRU5USVRZIG5yaWdodGFycm93ICImI3gyMTlCOyI%2BPCFFTlRJVFkgcmFycncgIiYjeDIxOUQ7Ij48IUVOVElUWSByaWdodHNxdWlnYXJyb3cgIiYjeDIxOUQ7Ij48IUVOVElUWSBMYXJyICImI3gyMTlFOyI%2BPCFFTlRJVFkgdHdvaGVhZGxlZnRhcnJvdyAiJiN4MjE5RTsiPjwhRU5USVRZIFVhcnIgIiYjeDIxOUY7Ij48IUVOVElUWSBSYXJyICImI3gyMUEwOyI%2BPCFFTlRJVFkgdHdvaGVhZHJpZ2h0YXJyb3cgIiYjeDIxQTA7Ij48IUVOVElUWSBEYXJyICImI3gyMUExOyI%2BPCFFTlRJVFkgbGFycnRsICImI3gyMUEyOyI%2BPCFFTlRJVFkgbGVmdGFycm93dGFpbCAiJiN4MjFBMjsiPjwhRU5USVRZIHJhcnJ0bCAiJiN4MjFBMzsiPjwhRU5USVRZIHJpZ2h0YXJyb3d0YWlsICImI3gyMUEzOyI%2BPCFFTlRJVFkgTGVmdFRlZUFycm93ICImI3gyMUE0OyI%2BPCFFTlRJVFkgbWFwc3RvbGVmdCAiJiN4MjFBNDsiPjwhRU5USVRZIFVwVGVlQXJyb3cgIiYjeDIxQTU7Ij48IUVOVElUWSBtYXBzdG91cCAiJiN4MjFBNTsiPjwhRU5USVRZIG1hcCAiJiN4MjFBNjsiPjwhRU5USVRZIFJpZ2h0VGVlQXJyb3cgIiYjeDIxQTY7Ij48IUVOVElUWSBtYXBzdG8gIiYjeDIxQTY7Ij48IUVOVElUWSBEb3duVGVlQXJyb3cgIiYjeDIxQTc7Ij48IUVOVElUWSBtYXBzdG9kb3duICImI3gyMUE3OyI%2BPCFFTlRJVFkgbGFycmhrICImI3gyMUE5OyI%2BPCFFTlRJVFkgaG9va2xlZnRhcnJvdyAiJiN4MjFBOTsiPjwhRU5USVRZIHJhcnJoayAiJiN4MjFBQTsiPjwhRU5USVRZIGhvb2tyaWdodGFycm93ICImI3gyMUFBOyI%2BPCFFTlRJVFkgbGFycmxwICImI3gyMUFCOyI%2BPCFFTlRJVFkgbG9vcGFycm93bGVmdCAiJiN4MjFBQjsiPjwhRU5USVRZIHJhcnJscCAiJiN4MjFBQzsiPjwhRU5USVRZIGxvb3BhcnJvd3JpZ2h0ICImI3gyMUFDOyI%2BPCFFTlRJVFkgaGFycncgIiYjeDIxQUQ7Ij48IUVOVElUWSBsZWZ0cmlnaHRzcXVpZ2Fycm93ICImI3gyMUFEOyI%2BPCFFTlRJVFkgbmhhcnIgIiYjeDIxQUU7Ij48IUVOVElUWSBubGVmdHJpZ2h0YXJyb3cgIiYjeDIxQUU7Ij48IUVOVElUWSBsc2ggIiYjeDIxQjA7Ij48IUVOVElUWSBMc2ggIiYjeDIxQjA7Ij48IUVOVElUWSByc2ggIiYjeDIxQjE7Ij48IUVOVElUWSBSc2ggIiYjeDIxQjE7Ij48IUVOVElUWSBsZHNoICImI3gyMUIyOyI%2BPCFFTlRJVFkgcmRzaCAiJiN4MjFCMzsiPjwhRU5USVRZIGNyYXJyICImI3gyMUI1OyI%2BPCFFTlRJVFkgY3VsYXJyICImI3gyMUI2OyI%2BPCFFTlRJVFkgY3VydmVhcnJvd2xlZnQgIiYjeDIxQjY7Ij48IUVOVElUWSBjdXJhcnIgIiYjeDIxQjc7Ij48IUVOVElUWSBjdXJ2ZWFycm93cmlnaHQgIiYjeDIxQjc7Ij48IUVOVElUWSBvbGFyciAiJiN4MjFCQTsiPjwhRU5USVRZIGNpcmNsZWFycm93bGVmdCAiJiN4MjFCQTsiPjwhRU5USVRZIG9yYXJyICImI3gyMUJCOyI%2BPCFFTlRJVFkgY2lyY2xlYXJyb3dyaWdodCAiJiN4MjFCQjsiPjwhRU5USVRZIGxoYXJ1ICImI3gyMUJDOyI%2BPCFFTlRJVFkgTGVmdFZlY3RvciAiJiN4MjFCQzsiPjwhRU5USVRZIGxlZnRoYXJwb29udXAgIiYjeDIxQkM7Ij48IUVOVElUWSBsaGFyZCAiJiN4MjFCRDsiPjwhRU5USVRZIGxlZnRoYXJwb29uZG93biAiJiN4MjFCRDsiPjwhRU5USVRZIERvd25MZWZ0VmVjdG9yICImI3gyMUJEOyI%2BPCFFTlRJVFkgdWhhcnIgIiYjeDIxQkU7Ij48IUVOVElUWSB1cGhhcnBvb25yaWdodCAiJiN4MjFCRTsiPjwhRU5USVRZIFJpZ2h0VXBWZWN0b3IgIiYjeDIxQkU7Ij48IUVOVElUWSB1aGFybCAiJiN4MjFCRjsiPjwhRU5USVRZIHVwaGFycG9vbmxlZnQgIiYjeDIxQkY7Ij48IUVOVElUWSBMZWZ0VXBWZWN0b3IgIiYjeDIxQkY7Ij48IUVOVElUWSByaGFydSAiJiN4MjFDMDsiPjwhRU5USVRZIFJpZ2h0VmVjdG9yICImI3gyMUMwOyI%2BPCFFTlRJVFkgcmlnaHRoYXJwb29udXAgIiYjeDIxQzA7Ij48IUVOVElUWSByaGFyZCAiJiN4MjFDMTsiPjwhRU5USVRZIHJpZ2h0aGFycG9vbmRvd24gIiYjeDIxQzE7Ij48IUVOVElUWSBEb3duUmlnaHRWZWN0b3IgIiYjeDIxQzE7Ij48IUVOVElUWSBkaGFyciAiJiN4MjFDMjsiPjwhRU5USVRZIFJpZ2h0RG93blZlY3RvciAiJiN4MjFDMjsiPjwhRU5USVRZIGRvd25oYXJwb29ucmlnaHQgIiYjeDIxQzI7Ij48IUVOVElUWSBkaGFybCAiJiN4MjFDMzsiPjwhRU5USVRZIExlZnREb3duVmVjdG9yICImI3gyMUMzOyI%2BPCFFTlRJVFkgZG93bmhhcnBvb25sZWZ0ICImI3gyMUMzOyI%2BPCFFTlRJVFkgcmxhcnIgIiYjeDIxQzQ7Ij48IUVOVElUWSByaWdodGxlZnRhcnJvd3MgIiYjeDIxQzQ7Ij48IUVOVElUWSBSaWdodEFycm93TGVmdEFycm93ICImI3gyMUM0OyI%2BPCFFTlRJVFkgdWRhcnIgIiYjeDIxQzU7Ij48IUVOVElUWSBVcEFycm93RG93bkFycm93ICImI3gyMUM1OyI%2BPCFFTlRJVFkgbHJhcnIgIiYjeDIxQzY7Ij48IUVOVElUWSBsZWZ0cmlnaHRhcnJvd3MgIiYjeDIxQzY7Ij48IUVOVElUWSBMZWZ0QXJyb3dSaWdodEFycm93ICImI3gyMUM2OyI%2BPCFFTlRJVFkgbGxhcnIgIiYjeDIxQzc7Ij48IUVOVElUWSBsZWZ0bGVmdGFycm93cyAiJiN4MjFDNzsiPjwhRU5USVRZIHV1YXJyICImI3gyMUM4OyI%2BPCFFTlRJVFkgdXB1cGFycm93cyAiJiN4MjFDODsiPjwhRU5USVRZIHJyYXJyICImI3gyMUM5OyI%2BPCFFTlRJVFkgcmlnaHRyaWdodGFycm93cyAiJiN4MjFDOTsiPjwhRU5USVRZIGRkYXJyICImI3gyMUNBOyI%2BPCFFTlRJVFkgZG93bmRvd25hcnJvd3MgIiYjeDIxQ0E7Ij48IUVOVElUWSBscmhhciAiJiN4MjFDQjsiPjwhRU5USVRZIFJldmVyc2VFcXVpbGlicml1bSAiJiN4MjFDQjsiPjwhRU5USVRZIGxlZnRyaWdodGhhcnBvb25zICImI3gyMUNCOyI%2BPCFFTlRJVFkgcmxoYXIgIiYjeDIxQ0M7Ij48IUVOVElUWSByaWdodGxlZnRoYXJwb29ucyAiJiN4MjFDQzsiPjwhRU5USVRZIEVxdWlsaWJyaXVtICImI3gyMUNDOyI%2BPCFFTlRJVFkgbmxBcnIgIiYjeDIxQ0Q7Ij48IUVOVElUWSBuTGVmdGFycm93ICImI3gyMUNEOyI%2BPCFFTlRJVFkgbmhBcnIgIiYjeDIxQ0U7Ij48IUVOVElUWSBuTGVmdHJpZ2h0YXJyb3cgIiYjeDIxQ0U7Ij48IUVOVElUWSBuckFyciAiJiN4MjFDRjsiPjwhRU5USVRZIG5SaWdodGFycm93ICImI3gyMUNGOyI%2BPCFFTlRJVFkgbEFyciAiJiN4MjFEMDsiPjwhRU5USVRZIExlZnRhcnJvdyAiJiN4MjFEMDsiPjwhRU5USVRZIERvdWJsZUxlZnRBcnJvdyAiJiN4MjFEMDsiPjwhRU5USVRZIHVBcnIgIiYjeDIxRDE7Ij48IUVOVElUWSBVcGFycm93ICImI3gyMUQxOyI%2BPCFFTlRJVFkgRG91YmxlVXBBcnJvdyAiJiN4MjFEMTsiPjwhRU5USVRZIHJBcnIgIiYjeDIxRDI7Ij48IUVOVElUWSBSaWdodGFycm93ICImI3gyMUQyOyI%2BPCFFTlRJVFkgSW1wbGllcyAiJiN4MjFEMjsiPjwhRU5USVRZIERvdWJsZVJpZ2h0QXJyb3cgIiYjeDIxRDI7Ij48IUVOVElUWSBkQXJyICImI3gyMUQzOyI%2BPCFFTlRJVFkgRG93bmFycm93ICImI3gyMUQzOyI%2BPCFFTlRJVFkgRG91YmxlRG93bkFycm93ICImI3gyMUQzOyI%2BPCFFTlRJVFkgaEFyciAiJiN4MjFENDsiPjwhRU5USVRZIExlZnRyaWdodGFycm93ICImI3gyMUQ0OyI%2BPCFFTlRJVFkgRG91YmxlTGVmdFJpZ2h0QXJyb3cgIiYjeDIxRDQ7Ij48IUVOVElUWSBpZmYgIiYjeDIxRDQ7Ij48IUVOVElUWSB2QXJyICImI3gyMUQ1OyI%2BPCFFTlRJVFkgVXBkb3duYXJyb3cgIiYjeDIxRDU7Ij48IUVOVElUWSBEb3VibGVVcERvd25BcnJvdyAiJiN4MjFENTsiPjwhRU5USVRZIG53QXJyICImI3gyMUQ2OyI%2BPCFFTlRJVFkgbmVBcnIgIiYjeDIxRDc7Ij48IUVOVElUWSBzZUFyciAiJiN4MjFEODsiPjwhRU5USVRZIHN3QXJyICImI3gyMUQ5OyI%2BPCFFTlRJVFkgbEFhcnIgIiYjeDIxREE7Ij48IUVOVElUWSBMbGVmdGFycm93ICImI3gyMURBOyI%2BPCFFTlRJVFkgckFhcnIgIiYjeDIxREI7Ij48IUVOVElUWSBScmlnaHRhcnJvdyAiJiN4MjFEQjsiPjwhRU5USVRZIHppZ3JhcnIgIiYjeDIxREQ7Ij48IUVOVElUWSBsYXJyYiAiJiN4MjFFNDsiPjwhRU5USVRZIExlZnRBcnJvd0JhciAiJiN4MjFFNDsiPjwhRU5USVRZIHJhcnJiICImI3gyMUU1OyI%2BPCFFTlRJVFkgUmlnaHRBcnJvd0JhciAiJiN4MjFFNTsiPjwhRU5USVRZIGR1YXJyICImI3gyMUY1OyI%2BPCFFTlRJVFkgRG93bkFycm93VXBBcnJvdyAiJiN4MjFGNTsiPjwhRU5USVRZIGxvYXJyICImI3gyMUZEOyI%2BPCFFTlRJVFkgcm9hcnIgIiYjeDIxRkU7Ij48IUVOVElUWSBob2FyciAiJiN4MjFGRjsiPjwhRU5USVRZIGZvcmFsbCAiJiN4MjIwMDsiPjwhRU5USVRZIEZvckFsbCAiJiN4MjIwMDsiPjwhRU5USVRZIGNvbXAgIiYjeDIyMDE7Ij48IUVOVElUWSBjb21wbGVtZW50ICImI3gyMjAxOyI%2BPCFFTlRJVFkgcGFydCAiJiN4MjIwMjsiPjwhRU5USVRZIFBhcnRpYWxEICImI3gyMjAyOyI%2BPCFFTlRJVFkgZXhpc3QgIiYjeDIyMDM7Ij48IUVOVElUWSBFeGlzdHMgIiYjeDIyMDM7Ij48IUVOVElUWSBuZXhpc3QgIiYjeDIyMDQ7Ij48IUVOVElUWSBOb3RFeGlzdHMgIiYjeDIyMDQ7Ij48IUVOVElUWSBuZXhpc3RzICImI3gyMjA0OyI%2BPCFFTlRJVFkgZW1wdHkgIiYjeDIyMDU7Ij48IUVOVElUWSBlbXB0eXNldCAiJiN4MjIwNTsiPjwhRU5USVRZIGVtcHR5diAiJiN4MjIwNTsiPjwhRU5USVRZIHZhcm5vdGhpbmcgIiYjeDIyMDU7Ij48IUVOVElUWSBuYWJsYSAiJiN4MjIwNzsiPjwhRU5USVRZIERlbCAiJiN4MjIwNzsiPjwhRU5USVRZIGlzaW4gIiYjeDIyMDg7Ij48IUVOVElUWSBpc2ludiAiJiN4MjIwODsiPjwhRU5USVRZIEVsZW1lbnQgIiYjeDIyMDg7Ij48IUVOVElUWSBpbiAiJiN4MjIwODsiPjwhRU5USVRZIG5vdGluICImI3gyMjA5OyI%2BPCFFTlRJVFkgTm90RWxlbWVudCAiJiN4MjIwOTsiPjwhRU5USVRZIG5vdGludmEgIiYjeDIyMDk7Ij48IUVOVElUWSBuaXYgIiYjeDIyMEI7Ij48IUVOVElUWSBSZXZlcnNlRWxlbWVudCAiJiN4MjIwQjsiPjwhRU5USVRZIG5pICImI3gyMjBCOyI%2BPCFFTlRJVFkgU3VjaFRoYXQgIiYjeDIyMEI7Ij48IUVOVElUWSBub3RuaSAiJiN4MjIwQzsiPjwhRU5USVRZIG5vdG5pdmEgIiYjeDIyMEM7Ij48IUVOVElUWSBOb3RSZXZlcnNlRWxlbWVudCAiJiN4MjIwQzsiPjwhRU5USVRZIHByb2QgIiYjeDIyMEY7Ij48IUVOVElUWSBQcm9kdWN0ICImI3gyMjBGOyI%2BPCFFTlRJVFkgY29wcm9kICImI3gyMjEwOyI%2BPCFFTlRJVFkgQ29wcm9kdWN0ICImI3gyMjEwOyI%2BPCFFTlRJVFkgc3VtICImI3gyMjExOyI%2BPCFFTlRJVFkgU3VtICImI3gyMjExOyI%2BPCFFTlRJVFkgbWludXMgIiYjeDIyMTI7Ij48IUVOVElUWSBtbnBsdXMgIiYjeDIyMTM7Ij48IUVOVElUWSBtcCAiJiN4MjIxMzsiPjwhRU5USVRZIE1pbnVzUGx1cyAiJiN4MjIxMzsiPjwhRU5USVRZIHBsdXNkbyAiJiN4MjIxNDsiPjwhRU5USVRZIGRvdHBsdXMgIiYjeDIyMTQ7Ij48IUVOVElUWSBzZXRtbiAiJiN4MjIxNjsiPjwhRU5USVRZIHNldG1pbnVzICImI3gyMjE2OyI%2BPCFFTlRJVFkgQmFja3NsYXNoICImI3gyMjE2OyI%2BPCFFTlRJVFkgc3NldG1uICImI3gyMjE2OyI%2BPCFFTlRJVFkgc21hbGxzZXRtaW51cyAiJiN4MjIxNjsiPjwhRU5USVRZIGxvd2FzdCAiJiN4MjIxNzsiPjwhRU5USVRZIGNvbXBmbiAiJiN4MjIxODsiPjwhRU5USVRZIFNtYWxsQ2lyY2xlICImI3gyMjE4OyI%2BPCFFTlRJVFkgcmFkaWMgIiYjeDIyMUE7Ij48IUVOVElUWSBTcXJ0ICImI3gyMjFBOyI%2BPCFFTlRJVFkgcHJvcCAiJiN4MjIxRDsiPjwhRU5USVRZIHByb3B0byAiJiN4MjIxRDsiPjwhRU5USVRZIFByb3BvcnRpb25hbCAiJiN4MjIxRDsiPjwhRU5USVRZIHZwcm9wICImI3gyMjFEOyI%2BPCFFTlRJVFkgdmFycHJvcHRvICImI3gyMjFEOyI%2BPCFFTlRJVFkgaW5maW4gIiYjeDIyMUU7Ij48IUVOVElUWSBhbmdydCAiJiN4MjIxRjsiPjwhRU5USVRZIGFuZyAiJiN4MjIyMDsiPjwhRU5USVRZIGFuZ2xlICImI3gyMjIwOyI%2BPCFFTlRJVFkgYW5nbXNkICImI3gyMjIxOyI%2BPCFFTlRJVFkgbWVhc3VyZWRhbmdsZSAiJiN4MjIyMTsiPjwhRU5USVRZIGFuZ3NwaCAiJiN4MjIyMjsiPjwhRU5USVRZIG1pZCAiJiN4MjIyMzsiPjwhRU5USVRZIFZlcnRpY2FsQmFyICImI3gyMjIzOyI%2BPCFFTlRJVFkgc21pZCAiJiN4MjIyMzsiPjwhRU5USVRZIHNob3J0bWlkICImI3gyMjIzOyI%2BPCFFTlRJVFkgbm1pZCAiJiN4MjIyNDsiPjwhRU5USVRZIE5vdFZlcnRpY2FsQmFyICImI3gyMjI0OyI%2BPCFFTlRJVFkgbnNtaWQgIiYjeDIyMjQ7Ij48IUVOVElUWSBuc2hvcnRtaWQgIiYjeDIyMjQ7Ij48IUVOVElUWSBwYXIgIiYjeDIyMjU7Ij48IUVOVElUWSBwYXJhbGxlbCAiJiN4MjIyNTsiPjwhRU5USVRZIERvdWJsZVZlcnRpY2FsQmFyICImI3gyMjI1OyI%2BPCFFTlRJVFkgc3BhciAiJiN4MjIyNTsiPjwhRU5USVRZIHNob3J0cGFyYWxsZWwgIiYjeDIyMjU7Ij48IUVOVElUWSBucGFyICImI3gyMjI2OyI%2BPCFFTlRJVFkgbnBhcmFsbGVsICImI3gyMjI2OyI%2BPCFFTlRJVFkgTm90RG91YmxlVmVydGljYWxCYXIgIiYjeDIyMjY7Ij48IUVOVElUWSBuc3BhciAiJiN4MjIyNjsiPjwhRU5USVRZIG5zaG9ydHBhcmFsbGVsICImI3gyMjI2OyI%2BPCFFTlRJVFkgYW5kICImI3gyMjI3OyI%2BPCFFTlRJVFkgd2VkZ2UgIiYjeDIyMjc7Ij48IUVOVElUWSBvciAiJiN4MjIyODsiPjwhRU5USVRZIHZlZSAiJiN4MjIyODsiPjwhRU5USVRZIGNhcCAiJiN4MjIyOTsiPjwhRU5USVRZIGN1cCAiJiN4MjIyQTsiPjwhRU5USVRZIGludCAiJiN4MjIyQjsiPjwhRU5USVRZIEludGVncmFsICImI3gyMjJCOyI%2BPCFFTlRJVFkgSW50ICImI3gyMjJDOyI%2BPCFFTlRJVFkgdGludCAiJiN4MjIyRDsiPjwhRU5USVRZIGlpaW50ICImI3gyMjJEOyI%2BPCFFTlRJVFkgY29uaW50ICImI3gyMjJFOyI%2BPCFFTlRJVFkgb2ludCAiJiN4MjIyRTsiPjwhRU5USVRZIENvbnRvdXJJbnRlZ3JhbCAiJiN4MjIyRTsiPjwhRU5USVRZIENvbmludCAiJiN4MjIyRjsiPjwhRU5USVRZIERvdWJsZUNvbnRvdXJJbnRlZ3JhbCAiJiN4MjIyRjsiPjwhRU5USVRZIENjb25pbnQgIiYjeDIyMzA7Ij48IUVOVElUWSBjd2ludCAiJiN4MjIzMTsiPjwhRU5USVRZIGN3Y29uaW50ICImI3gyMjMyOyI%2BPCFFTlRJVFkgQ2xvY2t3aXNlQ29udG91ckludGVncmFsICImI3gyMjMyOyI%2BPCFFTlRJVFkgYXdjb25pbnQgIiYjeDIyMzM7Ij48IUVOVElUWSBDb3VudGVyQ2xvY2t3aXNlQ29udG91ckludGVncmFsICImI3gyMjMzOyI%2BPCFFTlRJVFkgdGhlcmU0ICImI3gyMjM0OyI%2BPCFFTlRJVFkgdGhlcmVmb3JlICImI3gyMjM0OyI%2BPCFFTlRJVFkgVGhlcmVmb3JlICImI3gyMjM0OyI%2BPCFFTlRJVFkgYmVjYXVzICImI3gyMjM1OyI%2BPCFFTlRJVFkgYmVjYXVzZSAiJiN4MjIzNTsiPjwhRU5USVRZIEJlY2F1c2UgIiYjeDIyMzU7Ij48IUVOVElUWSByYXRpbyAiJiN4MjIzNjsiPjwhRU5USVRZIENvbG9uICImI3gyMjM3OyI%2BPCFFTlRJVFkgUHJvcG9ydGlvbiAiJiN4MjIzNzsiPjwhRU5USVRZIG1pbnVzZCAiJiN4MjIzODsiPjwhRU5USVRZIGRvdG1pbnVzICImI3gyMjM4OyI%2BPCFFTlRJVFkgbUREb3QgIiYjeDIyM0E7Ij48IUVOVElUWSBob210aHQgIiYjeDIyM0I7Ij48IUVOVElUWSBzaW0gIiYjeDIyM0M7Ij48IUVOVElUWSBUaWxkZSAiJiN4MjIzQzsiPjwhRU5USVRZIHRoa3NpbSAiJiN4MjIzQzsiPjwhRU5USVRZIHRoaWNrc2ltICImI3gyMjNDOyI%2BPCFFTlRJVFkgYnNpbSAiJiN4MjIzRDsiPjwhRU5USVRZIGJhY2tzaW0gIiYjeDIyM0Q7Ij48IUVOVElUWSBhYyAiJiN4MjIzRTsiPjwhRU5USVRZIG1zdHBvcyAiJiN4MjIzRTsiPjwhRU5USVRZIGFjZCAiJiN4MjIzRjsiPjwhRU5USVRZIHdyZWF0aCAiJiN4MjI0MDsiPjwhRU5USVRZIFZlcnRpY2FsVGlsZGUgIiYjeDIyNDA7Ij48IUVOVElUWSB3ciAiJiN4MjI0MDsiPjwhRU5USVRZIG5zaW0gIiYjeDIyNDE7Ij48IUVOVElUWSBOb3RUaWxkZSAiJiN4MjI0MTsiPjwhRU5USVRZIGVzaW0gIiYjeDIyNDI7Ij48IUVOVElUWSBFcXVhbFRpbGRlICImI3gyMjQyOyI%2BPCFFTlRJVFkgZXFzaW0gIiYjeDIyNDI7Ij48IUVOVElUWSBzaW1lICImI3gyMjQzOyI%2BPCFFTlRJVFkgVGlsZGVFcXVhbCAiJiN4MjI0MzsiPjwhRU5USVRZIHNpbWVxICImI3gyMjQzOyI%2BPCFFTlRJVFkgbnNpbWUgIiYjeDIyNDQ7Ij48IUVOVElUWSBuc2ltZXEgIiYjeDIyNDQ7Ij48IUVOVElUWSBOb3RUaWxkZUVxdWFsICImI3gyMjQ0OyI%2BPCFFTlRJVFkgY29uZyAiJiN4MjI0NTsiPjwhRU5USVRZIFRpbGRlRnVsbEVxdWFsICImI3gyMjQ1OyI%2BPCFFTlRJVFkgc2ltbmUgIiYjeDIyNDY7Ij48IUVOVElUWSBuY29uZyAiJiN4MjI0NzsiPjwhRU5USVRZIE5vdFRpbGRlRnVsbEVxdWFsICImI3gyMjQ3OyI%2BPCFFTlRJVFkgYXN5bXAgIiYjeDIyNDg7Ij48IUVOVElUWSBhcCAiJiN4MjI0ODsiPjwhRU5USVRZIFRpbGRlVGlsZGUgIiYjeDIyNDg7Ij48IUVOVElUWSBhcHByb3ggIiYjeDIyNDg7Ij48IUVOVElUWSB0aGthcCAiJiN4MjI0ODsiPjwhRU5USVRZIHRoaWNrYXBwcm94ICImI3gyMjQ4OyI%2BPCFFTlRJVFkgbmFwICImI3gyMjQ5OyI%2BPCFFTlRJVFkgTm90VGlsZGVUaWxkZSAiJiN4MjI0OTsiPjwhRU5USVRZIG5hcHByb3ggIiYjeDIyNDk7Ij48IUVOVElUWSBhcGUgIiYjeDIyNEE7Ij48IUVOVElUWSBhcHByb3hlcSAiJiN4MjI0QTsiPjwhRU5USVRZIGFwaWQgIiYjeDIyNEI7Ij48IUVOVElUWSBiY29uZyAiJiN4MjI0QzsiPjwhRU5USVRZIGJhY2tjb25nICImI3gyMjRDOyI%2BPCFFTlRJVFkgYXN5bXBlcSAiJiN4MjI0RDsiPjwhRU5USVRZIEN1cENhcCAiJiN4MjI0RDsiPjwhRU5USVRZIGJ1bXAgIiYjeDIyNEU7Ij48IUVOVElUWSBIdW1wRG93bkh1bXAgIiYjeDIyNEU7Ij48IUVOVElUWSBCdW1wZXEgIiYjeDIyNEU7Ij48IUVOVElUWSBidW1wZSAiJiN4MjI0RjsiPjwhRU5USVRZIEh1bXBFcXVhbCAiJiN4MjI0RjsiPjwhRU5USVRZIGJ1bXBlcSAiJiN4MjI0RjsiPjwhRU5USVRZIGVzZG90ICImI3gyMjUwOyI%2BPCFFTlRJVFkgRG90RXF1YWwgIiYjeDIyNTA7Ij48IUVOVElUWSBkb3RlcSAiJiN4MjI1MDsiPjwhRU5USVRZIGVEb3QgIiYjeDIyNTE7Ij48IUVOVElUWSBkb3RlcWRvdCAiJiN4MjI1MTsiPjwhRU5USVRZIGVmRG90ICImI3gyMjUyOyI%2BPCFFTlRJVFkgZmFsbGluZ2RvdHNlcSAiJiN4MjI1MjsiPjwhRU5USVRZIGVyRG90ICImI3gyMjUzOyI%2BPCFFTlRJVFkgcmlzaW5nZG90c2VxICImI3gyMjUzOyI%2BPCFFTlRJVFkgY29sb25lICImI3gyMjU0OyI%2BPCFFTlRJVFkgY29sb25lcSAiJiN4MjI1NDsiPjwhRU5USVRZIEFzc2lnbiAiJiN4MjI1NDsiPjwhRU5USVRZIGVjb2xvbiAiJiN4MjI1NTsiPjwhRU5USVRZIGVxY29sb24gIiYjeDIyNTU7Ij48IUVOVElUWSBlY2lyICImI3gyMjU2OyI%2BPCFFTlRJVFkgZXFjaXJjICImI3gyMjU2OyI%2BPCFFTlRJVFkgY2lyZSAiJiN4MjI1NzsiPjwhRU5USVRZIGNpcmNlcSAiJiN4MjI1NzsiPjwhRU5USVRZIHdlZGdlcSAiJiN4MjI1OTsiPjwhRU5USVRZIHZlZWVxICImI3gyMjVBOyI%2BPCFFTlRJVFkgdHJpZSAiJiN4MjI1QzsiPjwhRU5USVRZIHRyaWFuZ2xlcSAiJiN4MjI1QzsiPjwhRU5USVRZIGVxdWVzdCAiJiN4MjI1RjsiPjwhRU5USVRZIHF1ZXN0ZXEgIiYjeDIyNUY7Ij48IUVOVElUWSBuZSAiJiN4MjI2MDsiPjwhRU5USVRZIE5vdEVxdWFsICImI3gyMjYwOyI%2BPCFFTlRJVFkgZXF1aXYgIiYjeDIyNjE7Ij48IUVOVElUWSBDb25ncnVlbnQgIiYjeDIyNjE7Ij48IUVOVElUWSBuZXF1aXYgIiYjeDIyNjI7Ij48IUVOVElUWSBOb3RDb25ncnVlbnQgIiYjeDIyNjI7Ij48IUVOVElUWSBsZSAiJiN4MjI2NDsiPjwhRU5USVRZIGxlcSAiJiN4MjI2NDsiPjwhRU5USVRZIGdlICImI3gyMjY1OyI%2BPCFFTlRJVFkgR3JlYXRlckVxdWFsICImI3gyMjY1OyI%2BPCFFTlRJVFkgZ2VxICImI3gyMjY1OyI%2BPCFFTlRJVFkgbEUgIiYjeDIyNjY7Ij48IUVOVElUWSBMZXNzRnVsbEVxdWFsICImI3gyMjY2OyI%2BPCFFTlRJVFkgbGVxcSAiJiN4MjI2NjsiPjwhRU5USVRZIGdFICImI3gyMjY3OyI%2BPCFFTlRJVFkgR3JlYXRlckZ1bGxFcXVhbCAiJiN4MjI2NzsiPjwhRU5USVRZIGdlcXEgIiYjeDIyNjc7Ij48IUVOVElUWSBsbkUgIiYjeDIyNjg7Ij48IUVOVElUWSBsbmVxcSAiJiN4MjI2ODsiPjwhRU5USVRZIGduRSAiJiN4MjI2OTsiPjwhRU5USVRZIGduZXFxICImI3gyMjY5OyI%2BPCFFTlRJVFkgTHQgIiYjeDIyNkE7Ij48IUVOVElUWSBOZXN0ZWRMZXNzTGVzcyAiJiN4MjI2QTsiPjwhRU5USVRZIGxsICImI3gyMjZBOyI%2BPCFFTlRJVFkgR3QgIiYjeDIyNkI7Ij48IUVOVElUWSBOZXN0ZWRHcmVhdGVyR3JlYXRlciAiJiN4MjI2QjsiPjwhRU5USVRZIGdnICImI3gyMjZCOyI%2BPCFFTlRJVFkgdHdpeHQgIiYjeDIyNkM7Ij48IUVOVElUWSBiZXR3ZWVuICImI3gyMjZDOyI%2BPCFFTlRJVFkgTm90Q3VwQ2FwICImI3gyMjZEOyI%2BPCFFTlRJVFkgbmx0ICImI3gyMjZFOyI%2BPCFFTlRJVFkgTm90TGVzcyAiJiN4MjI2RTsiPjwhRU5USVRZIG5sZXNzICImI3gyMjZFOyI%2BPCFFTlRJVFkgbmd0ICImI3gyMjZGOyI%2BPCFFTlRJVFkgTm90R3JlYXRlciAiJiN4MjI2RjsiPjwhRU5USVRZIG5ndHIgIiYjeDIyNkY7Ij48IUVOVElUWSBubGUgIiYjeDIyNzA7Ij48IUVOVElUWSBOb3RMZXNzRXF1YWwgIiYjeDIyNzA7Ij48IUVOVElUWSBubGVxICImI3gyMjcwOyI%2BPCFFTlRJVFkgbmdlICImI3gyMjcxOyI%2BPCFFTlRJVFkgTm90R3JlYXRlckVxdWFsICImI3gyMjcxOyI%2BPCFFTlRJVFkgbmdlcSAiJiN4MjI3MTsiPjwhRU5USVRZIGxzaW0gIiYjeDIyNzI7Ij48IUVOVElUWSBMZXNzVGlsZGUgIiYjeDIyNzI7Ij48IUVOVElUWSBsZXNzc2ltICImI3gyMjcyOyI%2BPCFFTlRJVFkgZ3NpbSAiJiN4MjI3MzsiPjwhRU5USVRZIGd0cnNpbSAiJiN4MjI3MzsiPjwhRU5USVRZIEdyZWF0ZXJUaWxkZSAiJiN4MjI3MzsiPjwhRU5USVRZIG5sc2ltICImI3gyMjc0OyI%2BPCFFTlRJVFkgTm90TGVzc1RpbGRlICImI3gyMjc0OyI%2BPCFFTlRJVFkgbmdzaW0gIiYjeDIyNzU7Ij48IUVOVElUWSBOb3RHcmVhdGVyVGlsZGUgIiYjeDIyNzU7Ij48IUVOVElUWSBsZyAiJiN4MjI3NjsiPjwhRU5USVRZIGxlc3NndHIgIiYjeDIyNzY7Ij48IUVOVElUWSBMZXNzR3JlYXRlciAiJiN4MjI3NjsiPjwhRU5USVRZIGdsICImI3gyMjc3OyI%2BPCFFTlRJVFkgZ3RybGVzcyAiJiN4MjI3NzsiPjwhRU5USVRZIEdyZWF0ZXJMZXNzICImI3gyMjc3OyI%2BPCFFTlRJVFkgbnRsZyAiJiN4MjI3ODsiPjwhRU5USVRZIE5vdExlc3NHcmVhdGVyICImI3gyMjc4OyI%2BPCFFTlRJVFkgbnRnbCAiJiN4MjI3OTsiPjwhRU5USVRZIE5vdEdyZWF0ZXJMZXNzICImI3gyMjc5OyI%2BPCFFTlRJVFkgcHIgIiYjeDIyN0E7Ij48IUVOVElUWSBQcmVjZWRlcyAiJiN4MjI3QTsiPjwhRU5USVRZIHByZWMgIiYjeDIyN0E7Ij48IUVOVElUWSBzYyAiJiN4MjI3QjsiPjwhRU5USVRZIFN1Y2NlZWRzICImI3gyMjdCOyI%2BPCFFTlRJVFkgc3VjYyAiJiN4MjI3QjsiPjwhRU5USVRZIHByY3VlICImI3gyMjdDOyI%2BPCFFTlRJVFkgUHJlY2VkZXNTbGFudEVxdWFsICImI3gyMjdDOyI%2BPCFFTlRJVFkgcHJlY2N1cmx5ZXEgIiYjeDIyN0M7Ij48IUVOVElUWSBzY2N1ZSAiJiN4MjI3RDsiPjwhRU5USVRZIFN1Y2NlZWRzU2xhbnRFcXVhbCAiJiN4MjI3RDsiPjwhRU5USVRZIHN1Y2NjdXJseWVxICImI3gyMjdEOyI%2BPCFFTlRJVFkgcHJzaW0gIiYjeDIyN0U7Ij48IUVOVElUWSBwcmVjc2ltICImI3gyMjdFOyI%2BPCFFTlRJVFkgUHJlY2VkZXNUaWxkZSAiJiN4MjI3RTsiPjwhRU5USVRZIHNjc2ltICImI3gyMjdGOyI%2BPCFFTlRJVFkgc3VjY3NpbSAiJiN4MjI3RjsiPjwhRU5USVRZIFN1Y2NlZWRzVGlsZGUgIiYjeDIyN0Y7Ij48IUVOVElUWSBucHIgIiYjeDIyODA7Ij48IUVOVElUWSBucHJlYyAiJiN4MjI4MDsiPjwhRU5USVRZIE5vdFByZWNlZGVzICImI3gyMjgwOyI%2BPCFFTlRJVFkgbnNjICImI3gyMjgxOyI%2BPCFFTlRJVFkgbnN1Y2MgIiYjeDIyODE7Ij48IUVOVElUWSBOb3RTdWNjZWVkcyAiJiN4MjI4MTsiPjwhRU5USVRZIHN1YiAiJiN4MjI4MjsiPjwhRU5USVRZIHN1YnNldCAiJiN4MjI4MjsiPjwhRU5USVRZIHN1cCAiJiN4MjI4MzsiPjwhRU5USVRZIHN1cHNldCAiJiN4MjI4MzsiPjwhRU5USVRZIFN1cGVyc2V0ICImI3gyMjgzOyI%2BPCFFTlRJVFkgbnN1YiAiJiN4MjI4NDsiPjwhRU5USVRZIG5zdXAgIiYjeDIyODU7Ij48IUVOVElUWSBzdWJlICImI3gyMjg2OyI%2BPCFFTlRJVFkgU3Vic2V0RXF1YWwgIiYjeDIyODY7Ij48IUVOVElUWSBzdWJzZXRlcSAiJiN4MjI4NjsiPjwhRU5USVRZIHN1cGUgIiYjeDIyODc7Ij48IUVOVElUWSBzdXBzZXRlcSAiJiN4MjI4NzsiPjwhRU5USVRZIFN1cGVyc2V0RXF1YWwgIiYjeDIyODc7Ij48IUVOVElUWSBuc3ViZSAiJiN4MjI4ODsiPjwhRU5USVRZIG5zdWJzZXRlcSAiJiN4MjI4ODsiPjwhRU5USVRZIE5vdFN1YnNldEVxdWFsICImI3gyMjg4OyI%2BPCFFTlRJVFkgbnN1cGUgIiYjeDIyODk7Ij48IUVOVElUWSBuc3Vwc2V0ZXEgIiYjeDIyODk7Ij48IUVOVElUWSBOb3RTdXBlcnNldEVxdWFsICImI3gyMjg5OyI%2BPCFFTlRJVFkgc3VibmUgIiYjeDIyOEE7Ij48IUVOVElUWSBzdWJzZXRuZXEgIiYjeDIyOEE7Ij48IUVOVElUWSBzdXBuZSAiJiN4MjI4QjsiPjwhRU5USVRZIHN1cHNldG5lcSAiJiN4MjI4QjsiPjwhRU5USVRZIGN1cGRvdCAiJiN4MjI4RDsiPjwhRU5USVRZIHVwbHVzICImI3gyMjhFOyI%2BPCFFTlRJVFkgVW5pb25QbHVzICImI3gyMjhFOyI%2BPCFFTlRJVFkgc3FzdWIgIiYjeDIyOEY7Ij48IUVOVElUWSBTcXVhcmVTdWJzZXQgIiYjeDIyOEY7Ij48IUVOVElUWSBzcXN1YnNldCAiJiN4MjI4RjsiPjwhRU5USVRZIHNxc3VwICImI3gyMjkwOyI%2BPCFFTlRJVFkgU3F1YXJlU3VwZXJzZXQgIiYjeDIyOTA7Ij48IUVOVElUWSBzcXN1cHNldCAiJiN4MjI5MDsiPjwhRU5USVRZIHNxc3ViZSAiJiN4MjI5MTsiPjwhRU5USVRZIFNxdWFyZVN1YnNldEVxdWFsICImI3gyMjkxOyI%2BPCFFTlRJVFkgc3FzdWJzZXRlcSAiJiN4MjI5MTsiPjwhRU5USVRZIHNxc3VwZSAiJiN4MjI5MjsiPjwhRU5USVRZIFNxdWFyZVN1cGVyc2V0RXF1YWwgIiYjeDIyOTI7Ij48IUVOVElUWSBzcXN1cHNldGVxICImI3gyMjkyOyI%2BPCFFTlRJVFkgc3FjYXAgIiYjeDIyOTM7Ij48IUVOVElUWSBTcXVhcmVJbnRlcnNlY3Rpb24gIiYjeDIyOTM7Ij48IUVOVElUWSBzcWN1cCAiJiN4MjI5NDsiPjwhRU5USVRZIFNxdWFyZVVuaW9uICImI3gyMjk0OyI%2BPCFFTlRJVFkgb3BsdXMgIiYjeDIyOTU7Ij48IUVOVElUWSBDaXJjbGVQbHVzICImI3gyMjk1OyI%2BPCFFTlRJVFkgb21pbnVzICImI3gyMjk2OyI%2BPCFFTlRJVFkgQ2lyY2xlTWludXMgIiYjeDIyOTY7Ij48IUVOVElUWSBvdGltZXMgIiYjeDIyOTc7Ij48IUVOVElUWSBDaXJjbGVUaW1lcyAiJiN4MjI5NzsiPjwhRU5USVRZIG9zb2wgIiYjeDIyOTg7Ij48IUVOVElUWSBvZG90ICImI3gyMjk5OyI%2BPCFFTlRJVFkgQ2lyY2xlRG90ICImI3gyMjk5OyI%2BPCFFTlRJVFkgb2NpciAiJiN4MjI5QTsiPjwhRU5USVRZIGNpcmNsZWRjaXJjICImI3gyMjlBOyI%2BPCFFTlRJVFkgb2FzdCAiJiN4MjI5QjsiPjwhRU5USVRZIGNpcmNsZWRhc3QgIiYjeDIyOUI7Ij48IUVOVElUWSBvZGFzaCAiJiN4MjI5RDsiPjwhRU5USVRZIGNpcmNsZWRkYXNoICImI3gyMjlEOyI%2BPCFFTlRJVFkgcGx1c2IgIiYjeDIyOUU7Ij48IUVOVElUWSBib3hwbHVzICImI3gyMjlFOyI%2BPCFFTlRJVFkgbWludXNiICImI3gyMjlGOyI%2BPCFFTlRJVFkgYm94bWludXMgIiYjeDIyOUY7Ij48IUVOVElUWSB0aW1lc2IgIiYjeDIyQTA7Ij48IUVOVElUWSBib3h0aW1lcyAiJiN4MjJBMDsiPjwhRU5USVRZIHNkb3RiICImI3gyMkExOyI%2BPCFFTlRJVFkgZG90c3F1YXJlICImI3gyMkExOyI%2BPCFFTlRJVFkgdmRhc2ggIiYjeDIyQTI7Ij48IUVOVElUWSBSaWdodFRlZSAiJiN4MjJBMjsiPjwhRU5USVRZIGRhc2h2ICImI3gyMkEzOyI%2BPCFFTlRJVFkgTGVmdFRlZSAiJiN4MjJBMzsiPjwhRU5USVRZIHRvcCAiJiN4MjJBNDsiPjwhRU5USVRZIERvd25UZWUgIiYjeDIyQTQ7Ij48IUVOVElUWSBib3R0b20gIiYjeDIyQTU7Ij48IUVOVElUWSBib3QgIiYjeDIyQTU7Ij48IUVOVElUWSBwZXJwICImI3gyMkE1OyI%2BPCFFTlRJVFkgVXBUZWUgIiYjeDIyQTU7Ij48IUVOVElUWSBtb2RlbHMgIiYjeDIyQTc7Ij48IUVOVElUWSB2RGFzaCAiJiN4MjJBODsiPjwhRU5USVRZIERvdWJsZVJpZ2h0VGVlICImI3gyMkE4OyI%2BPCFFTlRJVFkgVmRhc2ggIiYjeDIyQTk7Ij48IUVOVElUWSBWdmRhc2ggIiYjeDIyQUE7Ij48IUVOVElUWSBWRGFzaCAiJiN4MjJBQjsiPjwhRU5USVRZIG52ZGFzaCAiJiN4MjJBQzsiPjwhRU5USVRZIG52RGFzaCAiJiN4MjJBRDsiPjwhRU5USVRZIG5WZGFzaCAiJiN4MjJBRTsiPjwhRU5USVRZIG5WRGFzaCAiJiN4MjJBRjsiPjwhRU5USVRZIHBydXJlbCAiJiN4MjJCMDsiPjwhRU5USVRZIHZsdHJpICImI3gyMkIyOyI%2BPCFFTlRJVFkgdmFydHJpYW5nbGVsZWZ0ICImI3gyMkIyOyI%2BPCFFTlRJVFkgTGVmdFRyaWFuZ2xlICImI3gyMkIyOyI%2BPCFFTlRJVFkgdnJ0cmkgIiYjeDIyQjM7Ij48IUVOVElUWSB2YXJ0cmlhbmdsZXJpZ2h0ICImI3gyMkIzOyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZSAiJiN4MjJCMzsiPjwhRU5USVRZIGx0cmllICImI3gyMkI0OyI%2BPCFFTlRJVFkgdHJpYW5nbGVsZWZ0ZXEgIiYjeDIyQjQ7Ij48IUVOVElUWSBMZWZ0VHJpYW5nbGVFcXVhbCAiJiN4MjJCNDsiPjwhRU5USVRZIHJ0cmllICImI3gyMkI1OyI%2BPCFFTlRJVFkgdHJpYW5nbGVyaWdodGVxICImI3gyMkI1OyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZUVxdWFsICImI3gyMkI1OyI%2BPCFFTlRJVFkgb3JpZ29mICImI3gyMkI2OyI%2BPCFFTlRJVFkgaW1vZiAiJiN4MjJCNzsiPjwhRU5USVRZIG11bWFwICImI3gyMkI4OyI%2BPCFFTlRJVFkgbXVsdGltYXAgIiYjeDIyQjg7Ij48IUVOVElUWSBoZXJjb24gIiYjeDIyQjk7Ij48IUVOVElUWSBpbnRjYWwgIiYjeDIyQkE7Ij48IUVOVElUWSBpbnRlcmNhbCAiJiN4MjJCQTsiPjwhRU5USVRZIHZlZWJhciAiJiN4MjJCQjsiPjwhRU5USVRZIGJhcnZlZSAiJiN4MjJCRDsiPjwhRU5USVRZIGFuZ3J0dmIgIiYjeDIyQkU7Ij48IUVOVElUWSBscnRyaSAiJiN4MjJCRjsiPjwhRU5USVRZIHh3ZWRnZSAiJiN4MjJDMDsiPjwhRU5USVRZIFdlZGdlICImI3gyMkMwOyI%2BPCFFTlRJVFkgYmlnd2VkZ2UgIiYjeDIyQzA7Ij48IUVOVElUWSB4dmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgVmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgYmlndmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgeGNhcCAiJiN4MjJDMjsiPjwhRU5USVRZIEludGVyc2VjdGlvbiAiJiN4MjJDMjsiPjwhRU5USVRZIGJpZ2NhcCAiJiN4MjJDMjsiPjwhRU5USVRZIHhjdXAgIiYjeDIyQzM7Ij48IUVOVElUWSBVbmlvbiAiJiN4MjJDMzsiPjwhRU5USVRZIGJpZ2N1cCAiJiN4MjJDMzsiPjwhRU5USVRZIGRpYW0gIiYjeDIyQzQ7Ij48IUVOVElUWSBkaWFtb25kICImI3gyMkM0OyI%2BPCFFTlRJVFkgRGlhbW9uZCAiJiN4MjJDNDsiPjwhRU5USVRZIHNkb3QgIiYjeDIyQzU7Ij48IUVOVElUWSBzc3RhcmYgIiYjeDIyQzY7Ij48IUVOVElUWSBTdGFyICImI3gyMkM2OyI%2BPCFFTlRJVFkgZGl2b254ICImI3gyMkM3OyI%2BPCFFTlRJVFkgZGl2aWRlb250aW1lcyAiJiN4MjJDNzsiPjwhRU5USVRZIGJvd3RpZSAiJiN4MjJDODsiPjwhRU5USVRZIGx0aW1lcyAiJiN4MjJDOTsiPjwhRU5USVRZIHJ0aW1lcyAiJiN4MjJDQTsiPjwhRU5USVRZIGx0aHJlZSAiJiN4MjJDQjsiPjwhRU5USVRZIGxlZnR0aHJlZXRpbWVzICImI3gyMkNCOyI%2BPCFFTlRJVFkgcnRocmVlICImI3gyMkNDOyI%2BPCFFTlRJVFkgcmlnaHR0aHJlZXRpbWVzICImI3gyMkNDOyI%2BPCFFTlRJVFkgYnNpbWUgIiYjeDIyQ0Q7Ij48IUVOVElUWSBiYWNrc2ltZXEgIiYjeDIyQ0Q7Ij48IUVOVElUWSBjdXZlZSAiJiN4MjJDRTsiPjwhRU5USVRZIGN1cmx5dmVlICImI3gyMkNFOyI%2BPCFFTlRJVFkgY3V3ZWQgIiYjeDIyQ0Y7Ij48IUVOVElUWSBjdXJseXdlZGdlICImI3gyMkNGOyI%2BPCFFTlRJVFkgU3ViICImI3gyMkQwOyI%2BPCFFTlRJVFkgU3Vic2V0ICImI3gyMkQwOyI%2BPCFFTlRJVFkgU3VwICImI3gyMkQxOyI%2BPCFFTlRJVFkgU3Vwc2V0ICImI3gyMkQxOyI%2BPCFFTlRJVFkgQ2FwICImI3gyMkQyOyI%2BPCFFTlRJVFkgQ3VwICImI3gyMkQzOyI%2BPCFFTlRJVFkgZm9yayAiJiN4MjJENDsiPjwhRU5USVRZIHBpdGNoZm9yayAiJiN4MjJENDsiPjwhRU5USVRZIGVwYXIgIiYjeDIyRDU7Ij48IUVOVElUWSBsdGRvdCAiJiN4MjJENjsiPjwhRU5USVRZIGxlc3Nkb3QgIiYjeDIyRDY7Ij48IUVOVElUWSBndGRvdCAiJiN4MjJENzsiPjwhRU5USVRZIGd0cmRvdCAiJiN4MjJENzsiPjwhRU5USVRZIExsICImI3gyMkQ4OyI%2BPCFFTlRJVFkgR2cgIiYjeDIyRDk7Ij48IUVOVElUWSBnZ2cgIiYjeDIyRDk7Ij48IUVOVElUWSBsZWcgIiYjeDIyREE7Ij48IUVOVElUWSBMZXNzRXF1YWxHcmVhdGVyICImI3gyMkRBOyI%2BPCFFTlRJVFkgbGVzc2VxZ3RyICImI3gyMkRBOyI%2BPCFFTlRJVFkgZ2VsICImI3gyMkRCOyI%2BPCFFTlRJVFkgZ3RyZXFsZXNzICImI3gyMkRCOyI%2BPCFFTlRJVFkgR3JlYXRlckVxdWFsTGVzcyAiJiN4MjJEQjsiPjwhRU5USVRZIGN1ZXByICImI3gyMkRFOyI%2BPCFFTlRJVFkgY3VybHllcXByZWMgIiYjeDIyREU7Ij48IUVOVElUWSBjdWVzYyAiJiN4MjJERjsiPjwhRU5USVRZIGN1cmx5ZXFzdWNjICImI3gyMkRGOyI%2BPCFFTlRJVFkgbnByY3VlICImI3gyMkUwOyI%2BPCFFTlRJVFkgTm90UHJlY2VkZXNTbGFudEVxdWFsICImI3gyMkUwOyI%2BPCFFTlRJVFkgbnNjY3VlICImI3gyMkUxOyI%2BPCFFTlRJVFkgTm90U3VjY2VlZHNTbGFudEVxdWFsICImI3gyMkUxOyI%2BPCFFTlRJVFkgbnNxc3ViZSAiJiN4MjJFMjsiPjwhRU5USVRZIE5vdFNxdWFyZVN1YnNldEVxdWFsICImI3gyMkUyOyI%2BPCFFTlRJVFkgbnNxc3VwZSAiJiN4MjJFMzsiPjwhRU5USVRZIE5vdFNxdWFyZVN1cGVyc2V0RXF1YWwgIiYjeDIyRTM7Ij48IUVOVElUWSBsbnNpbSAiJiN4MjJFNjsiPjwhRU5USVRZIGduc2ltICImI3gyMkU3OyI%2BPCFFTlRJVFkgcHJuc2ltICImI3gyMkU4OyI%2BPCFFTlRJVFkgcHJlY25zaW0gIiYjeDIyRTg7Ij48IUVOVElUWSBzY25zaW0gIiYjeDIyRTk7Ij48IUVOVElUWSBzdWNjbnNpbSAiJiN4MjJFOTsiPjwhRU5USVRZIG5sdHJpICImI3gyMkVBOyI%2BPCFFTlRJVFkgbnRyaWFuZ2xlbGVmdCAiJiN4MjJFQTsiPjwhRU5USVRZIE5vdExlZnRUcmlhbmdsZSAiJiN4MjJFQTsiPjwhRU5USVRZIG5ydHJpICImI3gyMkVCOyI%2BPCFFTlRJVFkgbnRyaWFuZ2xlcmlnaHQgIiYjeDIyRUI7Ij48IUVOVElUWSBOb3RSaWdodFRyaWFuZ2xlICImI3gyMkVCOyI%2BPCFFTlRJVFkgbmx0cmllICImI3gyMkVDOyI%2BPCFFTlRJVFkgbnRyaWFuZ2xlbGVmdGVxICImI3gyMkVDOyI%2BPCFFTlRJVFkgTm90TGVmdFRyaWFuZ2xlRXF1YWwgIiYjeDIyRUM7Ij48IUVOVElUWSBucnRyaWUgIiYjeDIyRUQ7Ij48IUVOVElUWSBudHJpYW5nbGVyaWdodGVxICImI3gyMkVEOyI%2BPCFFTlRJVFkgTm90UmlnaHRUcmlhbmdsZUVxdWFsICImI3gyMkVEOyI%2BPCFFTlRJVFkgdmVsbGlwICImI3gyMkVFOyI%2BPCFFTlRJVFkgY3Rkb3QgIiYjeDIyRUY7Ij48IUVOVElUWSB1dGRvdCAiJiN4MjJGMDsiPjwhRU5USVRZIGR0ZG90ICImI3gyMkYxOyI%2BPCFFTlRJVFkgZGlzaW4gIiYjeDIyRjI7Ij48IUVOVElUWSBpc2luc3YgIiYjeDIyRjM7Ij48IUVOVElUWSBpc2lucyAiJiN4MjJGNDsiPjwhRU5USVRZIGlzaW5kb3QgIiYjeDIyRjU7Ij48IUVOVElUWSBub3RpbnZjICImI3gyMkY2OyI%2BPCFFTlRJVFkgbm90aW52YiAiJiN4MjJGNzsiPjwhRU5USVRZIGlzaW5FICImI3gyMkY5OyI%2BPCFFTlRJVFkgbmlzZCAiJiN4MjJGQTsiPjwhRU5USVRZIHhuaXMgIiYjeDIyRkI7Ij48IUVOVElUWSBuaXMgIiYjeDIyRkM7Ij48IUVOVElUWSBub3RuaXZjICImI3gyMkZEOyI%2BPCFFTlRJVFkgbm90bml2YiAiJiN4MjJGRTsiPjwhRU5USVRZIGJhcndlZCAiJiN4MjMwNTsiPjwhRU5USVRZIGJhcndlZGdlICImI3gyMzA1OyI%2BPCFFTlRJVFkgQmFyd2VkICImI3gyMzA2OyI%2BPCFFTlRJVFkgZG91YmxlYmFyd2VkZ2UgIiYjeDIzMDY7Ij48IUVOVElUWSBsY2VpbCAiJiN4MjMwODsiPjwhRU5USVRZIExlZnRDZWlsaW5nICImI3gyMzA4OyI%2BPCFFTlRJVFkgcmNlaWwgIiYjeDIzMDk7Ij48IUVOVElUWSBSaWdodENlaWxpbmcgIiYjeDIzMDk7Ij48IUVOVElUWSBsZmxvb3IgIiYjeDIzMEE7Ij48IUVOVElUWSBMZWZ0Rmxvb3IgIiYjeDIzMEE7Ij48IUVOVElUWSByZmxvb3IgIiYjeDIzMEI7Ij48IUVOVElUWSBSaWdodEZsb29yICImI3gyMzBCOyI%2BPCFFTlRJVFkgZHJjcm9wICImI3gyMzBDOyI%2BPCFFTlRJVFkgZGxjcm9wICImI3gyMzBEOyI%2BPCFFTlRJVFkgdXJjcm9wICImI3gyMzBFOyI%2BPCFFTlRJVFkgdWxjcm9wICImI3gyMzBGOyI%2BPCFFTlRJVFkgYm5vdCAiJiN4MjMxMDsiPjwhRU5USVRZIHByb2ZsaW5lICImI3gyMzEyOyI%2BPCFFTlRJVFkgcHJvZnN1cmYgIiYjeDIzMTM7Ij48IUVOVElUWSB0ZWxyZWMgIiYjeDIzMTU7Ij48IUVOVElUWSB0YXJnZXQgIiYjeDIzMTY7Ij48IUVOVElUWSB1bGNvcm4gIiYjeDIzMUM7Ij48IUVOVElUWSB1bGNvcm5lciAiJiN4MjMxQzsiPjwhRU5USVRZIHVyY29ybiAiJiN4MjMxRDsiPjwhRU5USVRZIHVyY29ybmVyICImI3gyMzFEOyI%2BPCFFTlRJVFkgZGxjb3JuICImI3gyMzFFOyI%2BPCFFTlRJVFkgbGxjb3JuZXIgIiYjeDIzMUU7Ij48IUVOVElUWSBkcmNvcm4gIiYjeDIzMUY7Ij48IUVOVElUWSBscmNvcm5lciAiJiN4MjMxRjsiPjwhRU5USVRZIGZyb3duICImI3gyMzIyOyI%2BPCFFTlRJVFkgc2Zyb3duICImI3gyMzIyOyI%2BPCFFTlRJVFkgc21pbGUgIiYjeDIzMjM7Ij48IUVOVElUWSBzc21pbGUgIiYjeDIzMjM7Ij48IUVOVElUWSBjeWxjdHkgIiYjeDIzMkQ7Ij48IUVOVElUWSBwcm9mYWxhciAiJiN4MjMyRTsiPjwhRU5USVRZIHRvcGJvdCAiJiN4MjMzNjsiPjwhRU5USVRZIG92YmFyICImI3gyMzNEOyI%2BPCFFTlRJVFkgc29sYmFyICImI3gyMzNGOyI%2BPCFFTlRJVFkgYW5nemFyciAiJiN4MjM3QzsiPjwhRU5USVRZIGxtb3VzdCAiJiN4MjNCMDsiPjwhRU5USVRZIGxtb3VzdGFjaGUgIiYjeDIzQjA7Ij48IUVOVElUWSBybW91c3QgIiYjeDIzQjE7Ij48IUVOVElUWSBybW91c3RhY2hlICImI3gyM0IxOyI%2BPCFFTlRJVFkgdGJyayAiJiN4MjNCNDsiPjwhRU5USVRZIE92ZXJCcmFja2V0ICImI3gyM0I0OyI%2BPCFFTlRJVFkgYmJyayAiJiN4MjNCNTsiPjwhRU5USVRZIFVuZGVyQnJhY2tldCAiJiN4MjNCNTsiPjwhRU5USVRZIGJicmt0YnJrICImI3gyM0I2OyI%2BPCFFTlRJVFkgT3ZlclBhcmVudGhlc2lzICImI3gyM0RDOyI%2BPCFFTlRJVFkgVW5kZXJQYXJlbnRoZXNpcyAiJiN4MjNERDsiPjwhRU5USVRZIE92ZXJCcmFjZSAiJiN4MjNERTsiPjwhRU5USVRZIFVuZGVyQnJhY2UgIiYjeDIzREY7Ij48IUVOVElUWSB0cnBleml1bSAiJiN4MjNFMjsiPjwhRU5USVRZIGVsaW50ZXJzICImI3gyM0U3OyI%2BPCFFTlRJVFkgYmxhbmsgIiYjeDI0MjM7Ij48IUVOVElUWSBvUyAiJiN4MjRDODsiPjwhRU5USVRZIGNpcmNsZWRTICImI3gyNEM4OyI%2BPCFFTlRJVFkgYm94aCAiJiN4MjUwMDsiPjwhRU5USVRZIEhvcml6b250YWxMaW5lICImI3gyNTAwOyI%2BPCFFTlRJVFkgYm94diAiJiN4MjUwMjsiPjwhRU5USVRZIGJveGRyICImI3gyNTBDOyI%2BPCFFTlRJVFkgYm94ZGwgIiYjeDI1MTA7Ij48IUVOVElUWSBib3h1ciAiJiN4MjUxNDsiPjwhRU5USVRZIGJveHVsICImI3gyNTE4OyI%2BPCFFTlRJVFkgYm94dnIgIiYjeDI1MUM7Ij48IUVOVElUWSBib3h2bCAiJiN4MjUyNDsiPjwhRU5USVRZIGJveGhkICImI3gyNTJDOyI%2BPCFFTlRJVFkgYm94aHUgIiYjeDI1MzQ7Ij48IUVOVElUWSBib3h2aCAiJiN4MjUzQzsiPjwhRU5USVRZIGJveEggIiYjeDI1NTA7Ij48IUVOVElUWSBib3hWICImI3gyNTUxOyI%2BPCFFTlRJVFkgYm94ZFIgIiYjeDI1NTI7Ij48IUVOVElUWSBib3hEciAiJiN4MjU1MzsiPjwhRU5USVRZIGJveERSICImI3gyNTU0OyI%2BPCFFTlRJVFkgYm94ZEwgIiYjeDI1NTU7Ij48IUVOVElUWSBib3hEbCAiJiN4MjU1NjsiPjwhRU5USVRZIGJveERMICImI3gyNTU3OyI%2BPCFFTlRJVFkgYm94dVIgIiYjeDI1NTg7Ij48IUVOVElUWSBib3hVciAiJiN4MjU1OTsiPjwhRU5USVRZIGJveFVSICImI3gyNTVBOyI%2BPCFFTlRJVFkgYm94dUwgIiYjeDI1NUI7Ij48IUVOVElUWSBib3hVbCAiJiN4MjU1QzsiPjwhRU5USVRZIGJveFVMICImI3gyNTVEOyI%2BPCFFTlRJVFkgYm94dlIgIiYjeDI1NUU7Ij48IUVOVElUWSBib3hWciAiJiN4MjU1RjsiPjwhRU5USVRZIGJveFZSICImI3gyNTYwOyI%2BPCFFTlRJVFkgYm94dkwgIiYjeDI1NjE7Ij48IUVOVElUWSBib3hWbCAiJiN4MjU2MjsiPjwhRU5USVRZIGJveFZMICImI3gyNTYzOyI%2BPCFFTlRJVFkgYm94SGQgIiYjeDI1NjQ7Ij48IUVOVElUWSBib3hoRCAiJiN4MjU2NTsiPjwhRU5USVRZIGJveEhEICImI3gyNTY2OyI%2BPCFFTlRJVFkgYm94SHUgIiYjeDI1Njc7Ij48IUVOVElUWSBib3hoVSAiJiN4MjU2ODsiPjwhRU5USVRZIGJveEhVICImI3gyNTY5OyI%2BPCFFTlRJVFkgYm94dkggIiYjeDI1NkE7Ij48IUVOVElUWSBib3hWaCAiJiN4MjU2QjsiPjwhRU5USVRZIGJveFZIICImI3gyNTZDOyI%2BPCFFTlRJVFkgdWhibGsgIiYjeDI1ODA7Ij48IUVOVElUWSBsaGJsayAiJiN4MjU4NDsiPjwhRU5USVRZIGJsb2NrICImI3gyNTg4OyI%2BPCFFTlRJVFkgYmxrMTQgIiYjeDI1OTE7Ij48IUVOVElUWSBibGsxMiAiJiN4MjU5MjsiPjwhRU5USVRZIGJsazM0ICImI3gyNTkzOyI%2BPCFFTlRJVFkgc3F1ICImI3gyNUExOyI%2BPCFFTlRJVFkgc3F1YXJlICImI3gyNUExOyI%2BPCFFTlRJVFkgU3F1YXJlICImI3gyNUExOyI%2BPCFFTlRJVFkgc3F1ZiAiJiN4MjVBQTsiPjwhRU5USVRZIHNxdWFyZiAiJiN4MjVBQTsiPjwhRU5USVRZIGJsYWNrc3F1YXJlICImI3gyNUFBOyI%2BPCFFTlRJVFkgRmlsbGVkVmVyeVNtYWxsU3F1YXJlICImI3gyNUFBOyI%2BPCFFTlRJVFkgRW1wdHlWZXJ5U21hbGxTcXVhcmUgIiYjeDI1QUI7Ij48IUVOVElUWSByZWN0ICImI3gyNUFEOyI%2BPCFFTlRJVFkgbWFya2VyICImI3gyNUFFOyI%2BPCFFTlRJVFkgZmx0bnMgIiYjeDI1QjE7Ij48IUVOVElUWSB4dXRyaSAiJiN4MjVCMzsiPjwhRU5USVRZIGJpZ3RyaWFuZ2xldXAgIiYjeDI1QjM7Ij48IUVOVElUWSB1dHJpZiAiJiN4MjVCNDsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGUgIiYjeDI1QjQ7Ij48IUVOVElUWSB1dHJpICImI3gyNUI1OyI%2BPCFFTlRJVFkgdHJpYW5nbGUgIiYjeDI1QjU7Ij48IUVOVElUWSBydHJpZiAiJiN4MjVCODsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGVyaWdodCAiJiN4MjVCODsiPjwhRU5USVRZIHJ0cmkgIiYjeDI1Qjk7Ij48IUVOVElUWSB0cmlhbmdsZXJpZ2h0ICImI3gyNUI5OyI%2BPCFFTlRJVFkgeGR0cmkgIiYjeDI1QkQ7Ij48IUVOVElUWSBiaWd0cmlhbmdsZWRvd24gIiYjeDI1QkQ7Ij48IUVOVElUWSBkdHJpZiAiJiN4MjVCRTsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGVkb3duICImI3gyNUJFOyI%2BPCFFTlRJVFkgZHRyaSAiJiN4MjVCRjsiPjwhRU5USVRZIHRyaWFuZ2xlZG93biAiJiN4MjVCRjsiPjwhRU5USVRZIGx0cmlmICImI3gyNUMyOyI%2BPCFFTlRJVFkgYmxhY2t0cmlhbmdsZWxlZnQgIiYjeDI1QzI7Ij48IUVOVElUWSBsdHJpICImI3gyNUMzOyI%2BPCFFTlRJVFkgdHJpYW5nbGVsZWZ0ICImI3gyNUMzOyI%2BPCFFTlRJVFkgbG96ICImI3gyNUNBOyI%2BPCFFTlRJVFkgbG96ZW5nZSAiJiN4MjVDQTsiPjwhRU5USVRZIGNpciAiJiN4MjVDQjsiPjwhRU5USVRZIHRyaWRvdCAiJiN4MjVFQzsiPjwhRU5USVRZIHhjaXJjICImI3gyNUVGOyI%2BPCFFTlRJVFkgYmlnY2lyYyAiJiN4MjVFRjsiPjwhRU5USVRZIHVsdHJpICImI3gyNUY4OyI%2BPCFFTlRJVFkgdXJ0cmkgIiYjeDI1Rjk7Ij48IUVOVElUWSBsbHRyaSAiJiN4MjVGQTsiPjwhRU5USVRZIEVtcHR5U21hbGxTcXVhcmUgIiYjeDI1RkI7Ij48IUVOVElUWSBGaWxsZWRTbWFsbFNxdWFyZSAiJiN4MjVGQzsiPjwhRU5USVRZIHN0YXJmICImI3gyNjA1OyI%2BPCFFTlRJVFkgYmlnc3RhciAiJiN4MjYwNTsiPjwhRU5USVRZIHN0YXIgIiYjeDI2MDY7Ij48IUVOVElUWSBwaG9uZSAiJiN4MjYwRTsiPjwhRU5USVRZIGZlbWFsZSAiJiN4MjY0MDsiPjwhRU5USVRZIG1hbGUgIiYjeDI2NDI7Ij48IUVOVElUWSBzcGFkZXMgIiYjeDI2NjA7Ij48IUVOVElUWSBzcGFkZXN1aXQgIiYjeDI2NjA7Ij48IUVOVElUWSBjbHVicyAiJiN4MjY2MzsiPjwhRU5USVRZIGNsdWJzdWl0ICImI3gyNjYzOyI%2BPCFFTlRJVFkgaGVhcnRzICImI3gyNjY1OyI%2BPCFFTlRJVFkgaGVhcnRzdWl0ICImI3gyNjY1OyI%2BPCFFTlRJVFkgZGlhbXMgIiYjeDI2NjY7Ij48IUVOVElUWSBkaWFtb25kc3VpdCAiJiN4MjY2NjsiPjwhRU5USVRZIHN1bmcgIiYjeDI2NkE7Ij48IUVOVElUWSBmbGF0ICImI3gyNjZEOyI%2BPCFFTlRJVFkgbmF0dXIgIiYjeDI2NkU7Ij48IUVOVElUWSBuYXR1cmFsICImI3gyNjZFOyI%2BPCFFTlRJVFkgc2hhcnAgIiYjeDI2NkY7Ij48IUVOVElUWSBjaGVjayAiJiN4MjcxMzsiPjwhRU5USVRZIGNoZWNrbWFyayAiJiN4MjcxMzsiPjwhRU5USVRZIGNyb3NzICImI3gyNzE3OyI%2BPCFFTlRJVFkgbWFsdCAiJiN4MjcyMDsiPjwhRU5USVRZIG1hbHRlc2UgIiYjeDI3MjA7Ij48IUVOVElUWSBzZXh0ICImI3gyNzM2OyI%2BPCFFTlRJVFkgVmVydGljYWxTZXBhcmF0b3IgIiYjeDI3NTg7Ij48IUVOVElUWSBsYmJyayAiJiN4Mjc3MjsiPjwhRU5USVRZIHJiYnJrICImI3gyNzczOyI%2BPCFFTlRJVFkgYnNvbGhzdWIgIiYjeDI3Qzg7Ij48IUVOVElUWSBzdXBoc29sICImI3gyN0M5OyI%2BPCFFTlRJVFkgbG9icmsgIiYjeDI3RTY7Ij48IUVOVElUWSBMZWZ0RG91YmxlQnJhY2tldCAiJiN4MjdFNjsiPjwhRU5USVRZIHJvYnJrICImI3gyN0U3OyI%2BPCFFTlRJVFkgUmlnaHREb3VibGVCcmFja2V0ICImI3gyN0U3OyI%2BPCFFTlRJVFkgbGFuZyAiJiN4MjdFODsiPjwhRU5USVRZIExlZnRBbmdsZUJyYWNrZXQgIiYjeDI3RTg7Ij48IUVOVElUWSBsYW5nbGUgIiYjeDI3RTg7Ij48IUVOVElUWSByYW5nICImI3gyN0U5OyI%2BPCFFTlRJVFkgUmlnaHRBbmdsZUJyYWNrZXQgIiYjeDI3RTk7Ij48IUVOVElUWSByYW5nbGUgIiYjeDI3RTk7Ij48IUVOVElUWSBMYW5nICImI3gyN0VBOyI%2BPCFFTlRJVFkgUmFuZyAiJiN4MjdFQjsiPjwhRU5USVRZIGxvYW5nICImI3gyN0VDOyI%2BPCFFTlRJVFkgcm9hbmcgIiYjeDI3RUQ7Ij48IUVOVElUWSB4bGFyciAiJiN4MjdGNTsiPjwhRU5USVRZIGxvbmdsZWZ0YXJyb3cgIiYjeDI3RjU7Ij48IUVOVElUWSBMb25nTGVmdEFycm93ICImI3gyN0Y1OyI%2BPCFFTlRJVFkgeHJhcnIgIiYjeDI3RjY7Ij48IUVOVElUWSBsb25ncmlnaHRhcnJvdyAiJiN4MjdGNjsiPjwhRU5USVRZIExvbmdSaWdodEFycm93ICImI3gyN0Y2OyI%2BPCFFTlRJVFkgeGhhcnIgIiYjeDI3Rjc7Ij48IUVOVElUWSBsb25nbGVmdHJpZ2h0YXJyb3cgIiYjeDI3Rjc7Ij48IUVOVElUWSBMb25nTGVmdFJpZ2h0QXJyb3cgIiYjeDI3Rjc7Ij48IUVOVElUWSB4bEFyciAiJiN4MjdGODsiPjwhRU5USVRZIExvbmdsZWZ0YXJyb3cgIiYjeDI3Rjg7Ij48IUVOVElUWSBEb3VibGVMb25nTGVmdEFycm93ICImI3gyN0Y4OyI%2BPCFFTlRJVFkgeHJBcnIgIiYjeDI3Rjk7Ij48IUVOVElUWSBMb25ncmlnaHRhcnJvdyAiJiN4MjdGOTsiPjwhRU5USVRZIERvdWJsZUxvbmdSaWdodEFycm93ICImI3gyN0Y5OyI%2BPCFFTlRJVFkgeGhBcnIgIiYjeDI3RkE7Ij48IUVOVElUWSBMb25nbGVmdHJpZ2h0YXJyb3cgIiYjeDI3RkE7Ij48IUVOVElUWSBEb3VibGVMb25nTGVmdFJpZ2h0QXJyb3cgIiYjeDI3RkE7Ij48IUVOVElUWSB4bWFwICImI3gyN0ZDOyI%2BPCFFTlRJVFkgbG9uZ21hcHN0byAiJiN4MjdGQzsiPjwhRU5USVRZIGR6aWdyYXJyICImI3gyN0ZGOyI%2BPCFFTlRJVFkgbnZsQXJyICImI3gyOTAyOyI%2BPCFFTlRJVFkgbnZyQXJyICImI3gyOTAzOyI%2BPCFFTlRJVFkgbnZIYXJyICImI3gyOTA0OyI%2BPCFFTlRJVFkgTWFwICImI3gyOTA1OyI%2BPCFFTlRJVFkgbGJhcnIgIiYjeDI5MEM7Ij48IUVOVElUWSByYmFyciAiJiN4MjkwRDsiPjwhRU5USVRZIGJrYXJvdyAiJiN4MjkwRDsiPjwhRU5USVRZIGxCYXJyICImI3gyOTBFOyI%2BPCFFTlRJVFkgckJhcnIgIiYjeDI5MEY7Ij48IUVOVElUWSBkYmthcm93ICImI3gyOTBGOyI%2BPCFFTlRJVFkgUkJhcnIgIiYjeDI5MTA7Ij48IUVOVElUWSBkcmJrYXJvdyAiJiN4MjkxMDsiPjwhRU5USVRZIEREb3RyYWhkICImI3gyOTExOyI%2BPCFFTlRJVFkgVXBBcnJvd0JhciAiJiN4MjkxMjsiPjwhRU5USVRZIERvd25BcnJvd0JhciAiJiN4MjkxMzsiPjwhRU5USVRZIFJhcnJ0bCAiJiN4MjkxNjsiPjwhRU5USVRZIGxhdGFpbCAiJiN4MjkxOTsiPjwhRU5USVRZIHJhdGFpbCAiJiN4MjkxQTsiPjwhRU5USVRZIGxBdGFpbCAiJiN4MjkxQjsiPjwhRU5USVRZIHJBdGFpbCAiJiN4MjkxQzsiPjwhRU5USVRZIGxhcnJmcyAiJiN4MjkxRDsiPjwhRU5USVRZIHJhcnJmcyAiJiN4MjkxRTsiPjwhRU5USVRZIGxhcnJiZnMgIiYjeDI5MUY7Ij48IUVOVElUWSByYXJyYmZzICImI3gyOTIwOyI%2BPCFFTlRJVFkgbndhcmhrICImI3gyOTIzOyI%2BPCFFTlRJVFkgbmVhcmhrICImI3gyOTI0OyI%2BPCFFTlRJVFkgc2VhcmhrICImI3gyOTI1OyI%2BPCFFTlRJVFkgaGtzZWFyb3cgIiYjeDI5MjU7Ij48IUVOVElUWSBzd2FyaGsgIiYjeDI5MjY7Ij48IUVOVElUWSBoa3N3YXJvdyAiJiN4MjkyNjsiPjwhRU5USVRZIG53bmVhciAiJiN4MjkyNzsiPjwhRU5USVRZIG5lc2VhciAiJiN4MjkyODsiPjwhRU5USVRZIHRvZWEgIiYjeDI5Mjg7Ij48IUVOVElUWSBzZXN3YXIgIiYjeDI5Mjk7Ij48IUVOVElUWSB0b3NhICImI3gyOTI5OyI%2BPCFFTlRJVFkgc3dud2FyICImI3gyOTJBOyI%2BPCFFTlRJVFkgcmFycmMgIiYjeDI5MzM7Ij48IUVOVElUWSBjdWRhcnJyICImI3gyOTM1OyI%2BPCFFTlRJVFkgbGRjYSAiJiN4MjkzNjsiPjwhRU5USVRZIHJkY2EgIiYjeDI5Mzc7Ij48IUVOVElUWSBjdWRhcnJsICImI3gyOTM4OyI%2BPCFFTlRJVFkgbGFycnBsICImI3gyOTM5OyI%2BPCFFTlRJVFkgY3VyYXJybSAiJiN4MjkzQzsiPjwhRU5USVRZIGN1bGFycnAgIiYjeDI5M0Q7Ij48IUVOVElUWSByYXJycGwgIiYjeDI5NDU7Ij48IUVOVElUWSBoYXJyY2lyICImI3gyOTQ4OyI%2BPCFFTlRJVFkgVWFycm9jaXIgIiYjeDI5NDk7Ij48IUVOVElUWSBsdXJkc2hhciAiJiN4Mjk0QTsiPjwhRU5USVRZIGxkcnVzaGFyICImI3gyOTRCOyI%2BPCFFTlRJVFkgTGVmdFJpZ2h0VmVjdG9yICImI3gyOTRFOyI%2BPCFFTlRJVFkgUmlnaHRVcERvd25WZWN0b3IgIiYjeDI5NEY7Ij48IUVOVElUWSBEb3duTGVmdFJpZ2h0VmVjdG9yICImI3gyOTUwOyI%2BPCFFTlRJVFkgTGVmdFVwRG93blZlY3RvciAiJiN4Mjk1MTsiPjwhRU5USVRZIExlZnRWZWN0b3JCYXIgIiYjeDI5NTI7Ij48IUVOVElUWSBSaWdodFZlY3RvckJhciAiJiN4Mjk1MzsiPjwhRU5USVRZIFJpZ2h0VXBWZWN0b3JCYXIgIiYjeDI5NTQ7Ij48IUVOVElUWSBSaWdodERvd25WZWN0b3JCYXIgIiYjeDI5NTU7Ij48IUVOVElUWSBEb3duTGVmdFZlY3RvckJhciAiJiN4Mjk1NjsiPjwhRU5USVRZIERvd25SaWdodFZlY3RvckJhciAiJiN4Mjk1NzsiPjwhRU5USVRZIExlZnRVcFZlY3RvckJhciAiJiN4Mjk1ODsiPjwhRU5USVRZIExlZnREb3duVmVjdG9yQmFyICImI3gyOTU5OyI%2BPCFFTlRJVFkgTGVmdFRlZVZlY3RvciAiJiN4Mjk1QTsiPjwhRU5USVRZIFJpZ2h0VGVlVmVjdG9yICImI3gyOTVCOyI%2BPCFFTlRJVFkgUmlnaHRVcFRlZVZlY3RvciAiJiN4Mjk1QzsiPjwhRU5USVRZIFJpZ2h0RG93blRlZVZlY3RvciAiJiN4Mjk1RDsiPjwhRU5USVRZIERvd25MZWZ0VGVlVmVjdG9yICImI3gyOTVFOyI%2BPCFFTlRJVFkgRG93blJpZ2h0VGVlVmVjdG9yICImI3gyOTVGOyI%2BPCFFTlRJVFkgTGVmdFVwVGVlVmVjdG9yICImI3gyOTYwOyI%2BPCFFTlRJVFkgTGVmdERvd25UZWVWZWN0b3IgIiYjeDI5NjE7Ij48IUVOVElUWSBsSGFyICImI3gyOTYyOyI%2BPCFFTlRJVFkgdUhhciAiJiN4Mjk2MzsiPjwhRU5USVRZIHJIYXIgIiYjeDI5NjQ7Ij48IUVOVElUWSBkSGFyICImI3gyOTY1OyI%2BPCFFTlRJVFkgbHVydWhhciAiJiN4Mjk2NjsiPjwhRU5USVRZIGxkcmRoYXIgIiYjeDI5Njc7Ij48IUVOVElUWSBydWx1aGFyICImI3gyOTY4OyI%2BPCFFTlRJVFkgcmRsZGhhciAiJiN4Mjk2OTsiPjwhRU5USVRZIGxoYXJ1bCAiJiN4Mjk2QTsiPjwhRU5USVRZIGxsaGFyZCAiJiN4Mjk2QjsiPjwhRU5USVRZIHJoYXJ1bCAiJiN4Mjk2QzsiPjwhRU5USVRZIGxyaGFyZCAiJiN4Mjk2RDsiPjwhRU5USVRZIHVkaGFyICImI3gyOTZFOyI%2BPCFFTlRJVFkgVXBFcXVpbGlicml1bSAiJiN4Mjk2RTsiPjwhRU5USVRZIGR1aGFyICImI3gyOTZGOyI%2BPCFFTlRJVFkgUmV2ZXJzZVVwRXF1aWxpYnJpdW0gIiYjeDI5NkY7Ij48IUVOVElUWSBSb3VuZEltcGxpZXMgIiYjeDI5NzA7Ij48IUVOVElUWSBlcmFyciAiJiN4Mjk3MTsiPjwhRU5USVRZIHNpbXJhcnIgIiYjeDI5NzI7Ij48IUVOVElUWSBsYXJyc2ltICImI3gyOTczOyI%2BPCFFTlRJVFkgcmFycnNpbSAiJiN4Mjk3NDsiPjwhRU5USVRZIHJhcnJhcCAiJiN4Mjk3NTsiPjwhRU5USVRZIGx0bGFyciAiJiN4Mjk3NjsiPjwhRU5USVRZIGd0cmFyciAiJiN4Mjk3ODsiPjwhRU5USVRZIHN1YnJhcnIgIiYjeDI5Nzk7Ij48IUVOVElUWSBzdXBsYXJyICImI3gyOTdCOyI%2BPCFFTlRJVFkgbGZpc2h0ICImI3gyOTdDOyI%2BPCFFTlRJVFkgcmZpc2h0ICImI3gyOTdEOyI%2BPCFFTlRJVFkgdWZpc2h0ICImI3gyOTdFOyI%2BPCFFTlRJVFkgZGZpc2h0ICImI3gyOTdGOyI%2BPCFFTlRJVFkgbG9wYXIgIiYjeDI5ODU7Ij48IUVOVElUWSByb3BhciAiJiN4Mjk4NjsiPjwhRU5USVRZIGxicmtlICImI3gyOThCOyI%2BPCFFTlRJVFkgcmJya2UgIiYjeDI5OEM7Ij48IUVOVElUWSBsYnJrc2x1ICImI3gyOThEOyI%2BPCFFTlRJVFkgcmJya3NsZCAiJiN4Mjk4RTsiPjwhRU5USVRZIGxicmtzbGQgIiYjeDI5OEY7Ij48IUVOVElUWSByYnJrc2x1ICImI3gyOTkwOyI%2BPCFFTlRJVFkgbGFuZ2QgIiYjeDI5OTE7Ij48IUVOVElUWSByYW5nZCAiJiN4Mjk5MjsiPjwhRU5USVRZIGxwYXJsdCAiJiN4Mjk5MzsiPjwhRU5USVRZIHJwYXJndCAiJiN4Mjk5NDsiPjwhRU5USVRZIGd0bFBhciAiJiN4Mjk5NTsiPjwhRU5USVRZIGx0clBhciAiJiN4Mjk5NjsiPjwhRU5USVRZIHZ6aWd6YWcgIiYjeDI5OUE7Ij48IUVOVElUWSB2YW5ncnQgIiYjeDI5OUM7Ij48IUVOVElUWSBhbmdydHZiZCAiJiN4Mjk5RDsiPjwhRU5USVRZIGFuZ2UgIiYjeDI5QTQ7Ij48IUVOVElUWSByYW5nZSAiJiN4MjlBNTsiPjwhRU5USVRZIGR3YW5nbGUgIiYjeDI5QTY7Ij48IUVOVElUWSB1d2FuZ2xlICImI3gyOUE3OyI%2BPCFFTlRJVFkgYW5nbXNkYWEgIiYjeDI5QTg7Ij48IUVOVElUWSBhbmdtc2RhYiAiJiN4MjlBOTsiPjwhRU5USVRZIGFuZ21zZGFjICImI3gyOUFBOyI%2BPCFFTlRJVFkgYW5nbXNkYWQgIiYjeDI5QUI7Ij48IUVOVElUWSBhbmdtc2RhZSAiJiN4MjlBQzsiPjwhRU5USVRZIGFuZ21zZGFmICImI3gyOUFEOyI%2BPCFFTlRJVFkgYW5nbXNkYWcgIiYjeDI5QUU7Ij48IUVOVElUWSBhbmdtc2RhaCAiJiN4MjlBRjsiPjwhRU5USVRZIGJlbXB0eXYgIiYjeDI5QjA7Ij48IUVOVElUWSBkZW1wdHl2ICImI3gyOUIxOyI%2BPCFFTlRJVFkgY2VtcHR5diAiJiN4MjlCMjsiPjwhRU5USVRZIHJhZW1wdHl2ICImI3gyOUIzOyI%2BPCFFTlRJVFkgbGFlbXB0eXYgIiYjeDI5QjQ7Ij48IUVOVElUWSBvaGJhciAiJiN4MjlCNTsiPjwhRU5USVRZIG9taWQgIiYjeDI5QjY7Ij48IUVOVElUWSBvcGFyICImI3gyOUI3OyI%2BPCFFTlRJVFkgb3BlcnAgIiYjeDI5Qjk7Ij48IUVOVElUWSBvbGNyb3NzICImI3gyOUJCOyI%2BPCFFTlRJVFkgb2Rzb2xkICImI3gyOUJDOyI%2BPCFFTlRJVFkgb2xjaXIgIiYjeDI5QkU7Ij48IUVOVElUWSBvZmNpciAiJiN4MjlCRjsiPjwhRU5USVRZIG9sdCAiJiN4MjlDMDsiPjwhRU5USVRZIG9ndCAiJiN4MjlDMTsiPjwhRU5USVRZIGNpcnNjaXIgIiYjeDI5QzI7Ij48IUVOVElUWSBjaXJFICImI3gyOUMzOyI%2BPCFFTlRJVFkgc29sYiAiJiN4MjlDNDsiPjwhRU5USVRZIGJzb2xiICImI3gyOUM1OyI%2BPCFFTlRJVFkgYm94Ym94ICImI3gyOUM5OyI%2BPCFFTlRJVFkgdHJpc2IgIiYjeDI5Q0Q7Ij48IUVOVElUWSBydHJpbHRyaSAiJiN4MjlDRTsiPjwhRU5USVRZIExlZnRUcmlhbmdsZUJhciAiJiN4MjlDRjsiPjwhRU5USVRZIFJpZ2h0VHJpYW5nbGVCYXIgIiYjeDI5RDA7Ij48IUVOVElUWSBpaW5maW4gIiYjeDI5REM7Ij48IUVOVElUWSBpbmZpbnRpZSAiJiN4MjlERDsiPjwhRU5USVRZIG52aW5maW4gIiYjeDI5REU7Ij48IUVOVElUWSBlcGFyc2wgIiYjeDI5RTM7Ij48IUVOVElUWSBzbWVwYXJzbCAiJiN4MjlFNDsiPjwhRU5USVRZIGVxdnBhcnNsICImI3gyOUU1OyI%2BPCFFTlRJVFkgbG96ZiAiJiN4MjlFQjsiPjwhRU5USVRZIGJsYWNrbG96ZW5nZSAiJiN4MjlFQjsiPjwhRU5USVRZIFJ1bGVEZWxheWVkICImI3gyOUY0OyI%2BPCFFTlRJVFkgZHNvbCAiJiN4MjlGNjsiPjwhRU5USVRZIHhvZG90ICImI3gyQTAwOyI%2BPCFFTlRJVFkgYmlnb2RvdCAiJiN4MkEwMDsiPjwhRU5USVRZIHhvcGx1cyAiJiN4MkEwMTsiPjwhRU5USVRZIGJpZ29wbHVzICImI3gyQTAxOyI%2BPCFFTlRJVFkgeG90aW1lICImI3gyQTAyOyI%2BPCFFTlRJVFkgYmlnb3RpbWVzICImI3gyQTAyOyI%2BPCFFTlRJVFkgeHVwbHVzICImI3gyQTA0OyI%2BPCFFTlRJVFkgYmlndXBsdXMgIiYjeDJBMDQ7Ij48IUVOVElUWSB4c3FjdXAgIiYjeDJBMDY7Ij48IUVOVElUWSBiaWdzcWN1cCAiJiN4MkEwNjsiPjwhRU5USVRZIHFpbnQgIiYjeDJBMEM7Ij48IUVOVElUWSBpaWlpbnQgIiYjeDJBMEM7Ij48IUVOVElUWSBmcGFydGludCAiJiN4MkEwRDsiPjwhRU5USVRZIGNpcmZuaW50ICImI3gyQTEwOyI%2BPCFFTlRJVFkgYXdpbnQgIiYjeDJBMTE7Ij48IUVOVElUWSBycHBvbGludCAiJiN4MkExMjsiPjwhRU5USVRZIHNjcG9saW50ICImI3gyQTEzOyI%2BPCFFTlRJVFkgbnBvbGludCAiJiN4MkExNDsiPjwhRU5USVRZIHBvaW50aW50ICImI3gyQTE1OyI%2BPCFFTlRJVFkgcXVhdGludCAiJiN4MkExNjsiPjwhRU5USVRZIGludGxhcmhrICImI3gyQTE3OyI%2BPCFFTlRJVFkgcGx1c2NpciAiJiN4MkEyMjsiPjwhRU5USVRZIHBsdXNhY2lyICImI3gyQTIzOyI%2BPCFFTlRJVFkgc2ltcGx1cyAiJiN4MkEyNDsiPjwhRU5USVRZIHBsdXNkdSAiJiN4MkEyNTsiPjwhRU5USVRZIHBsdXNzaW0gIiYjeDJBMjY7Ij48IUVOVElUWSBwbHVzdHdvICImI3gyQTI3OyI%2BPCFFTlRJVFkgbWNvbW1hICImI3gyQTI5OyI%2BPCFFTlRJVFkgbWludXNkdSAiJiN4MkEyQTsiPjwhRU5USVRZIGxvcGx1cyAiJiN4MkEyRDsiPjwhRU5USVRZIHJvcGx1cyAiJiN4MkEyRTsiPjwhRU5USVRZIENyb3NzICImI3gyQTJGOyI%2BPCFFTlRJVFkgdGltZXNkICImI3gyQTMwOyI%2BPCFFTlRJVFkgdGltZXNiYXIgIiYjeDJBMzE7Ij48IUVOVElUWSBzbWFzaHAgIiYjeDJBMzM7Ij48IUVOVElUWSBsb3RpbWVzICImI3gyQTM0OyI%2BPCFFTlRJVFkgcm90aW1lcyAiJiN4MkEzNTsiPjwhRU5USVRZIG90aW1lc2FzICImI3gyQTM2OyI%2BPCFFTlRJVFkgT3RpbWVzICImI3gyQTM3OyI%2BPCFFTlRJVFkgb2RpdiAiJiN4MkEzODsiPjwhRU5USVRZIHRyaXBsdXMgIiYjeDJBMzk7Ij48IUVOVElUWSB0cmltaW51cyAiJiN4MkEzQTsiPjwhRU5USVRZIHRyaXRpbWUgIiYjeDJBM0I7Ij48IUVOVElUWSBpcHJvZCAiJiN4MkEzQzsiPjwhRU5USVRZIGludHByb2QgIiYjeDJBM0M7Ij48IUVOVElUWSBhbWFsZyAiJiN4MkEzRjsiPjwhRU5USVRZIGNhcGRvdCAiJiN4MkE0MDsiPjwhRU5USVRZIG5jdXAgIiYjeDJBNDI7Ij48IUVOVElUWSBuY2FwICImI3gyQTQzOyI%2BPCFFTlRJVFkgY2FwYW5kICImI3gyQTQ0OyI%2BPCFFTlRJVFkgY3Vwb3IgIiYjeDJBNDU7Ij48IUVOVElUWSBjdXBjYXAgIiYjeDJBNDY7Ij48IUVOVElUWSBjYXBjdXAgIiYjeDJBNDc7Ij48IUVOVElUWSBjdXBicmNhcCAiJiN4MkE0ODsiPjwhRU5USVRZIGNhcGJyY3VwICImI3gyQTQ5OyI%2BPCFFTlRJVFkgY3VwY3VwICImI3gyQTRBOyI%2BPCFFTlRJVFkgY2FwY2FwICImI3gyQTRCOyI%2BPCFFTlRJVFkgY2N1cHMgIiYjeDJBNEM7Ij48IUVOVElUWSBjY2FwcyAiJiN4MkE0RDsiPjwhRU5USVRZIGNjdXBzc20gIiYjeDJBNTA7Ij48IUVOVElUWSBBbmQgIiYjeDJBNTM7Ij48IUVOVElUWSBPciAiJiN4MkE1NDsiPjwhRU5USVRZIGFuZGFuZCAiJiN4MkE1NTsiPjwhRU5USVRZIG9yb3IgIiYjeDJBNTY7Ij48IUVOVElUWSBvcnNsb3BlICImI3gyQTU3OyI%2BPCFFTlRJVFkgYW5kc2xvcGUgIiYjeDJBNTg7Ij48IUVOVElUWSBhbmR2ICImI3gyQTVBOyI%2BPCFFTlRJVFkgb3J2ICImI3gyQTVCOyI%2BPCFFTlRJVFkgYW5kZCAiJiN4MkE1QzsiPjwhRU5USVRZIG9yZCAiJiN4MkE1RDsiPjwhRU5USVRZIHdlZGJhciAiJiN4MkE1RjsiPjwhRU5USVRZIHNkb3RlICImI3gyQTY2OyI%2BPCFFTlRJVFkgc2ltZG90ICImI3gyQTZBOyI%2BPCFFTlRJVFkgY29uZ2RvdCAiJiN4MkE2RDsiPjwhRU5USVRZIGVhc3RlciAiJiN4MkE2RTsiPjwhRU5USVRZIGFwYWNpciAiJiN4MkE2RjsiPjwhRU5USVRZIGFwRSAiJiN4MkE3MDsiPjwhRU5USVRZIGVwbHVzICImI3gyQTcxOyI%2BPCFFTlRJVFkgcGx1c2UgIiYjeDJBNzI7Ij48IUVOVElUWSBFc2ltICImI3gyQTczOyI%2BPCFFTlRJVFkgQ29sb25lICImI3gyQTc0OyI%2BPCFFTlRJVFkgRXF1YWwgIiYjeDJBNzU7Ij48IUVOVElUWSBlRERvdCAiJiN4MkE3NzsiPjwhRU5USVRZIGRkb3RzZXEgIiYjeDJBNzc7Ij48IUVOVElUWSBlcXVpdkREICImI3gyQTc4OyI%2BPCFFTlRJVFkgbHRjaXIgIiYjeDJBNzk7Ij48IUVOVElUWSBndGNpciAiJiN4MkE3QTsiPjwhRU5USVRZIGx0cXVlc3QgIiYjeDJBN0I7Ij48IUVOVElUWSBndHF1ZXN0ICImI3gyQTdDOyI%2BPCFFTlRJVFkgbGVzICImI3gyQTdEOyI%2BPCFFTlRJVFkgTGVzc1NsYW50RXF1YWwgIiYjeDJBN0Q7Ij48IUVOVElUWSBsZXFzbGFudCAiJiN4MkE3RDsiPjwhRU5USVRZIGdlcyAiJiN4MkE3RTsiPjwhRU5USVRZIEdyZWF0ZXJTbGFudEVxdWFsICImI3gyQTdFOyI%2BPCFFTlRJVFkgZ2Vxc2xhbnQgIiYjeDJBN0U7Ij48IUVOVElUWSBsZXNkb3QgIiYjeDJBN0Y7Ij48IUVOVElUWSBnZXNkb3QgIiYjeDJBODA7Ij48IUVOVElUWSBsZXNkb3RvICImI3gyQTgxOyI%2BPCFFTlRJVFkgZ2VzZG90byAiJiN4MkE4MjsiPjwhRU5USVRZIGxlc2RvdG9yICImI3gyQTgzOyI%2BPCFFTlRJVFkgZ2VzZG90b2wgIiYjeDJBODQ7Ij48IUVOVElUWSBsYXAgIiYjeDJBODU7Ij48IUVOVElUWSBsZXNzYXBwcm94ICImI3gyQTg1OyI%2BPCFFTlRJVFkgZ2FwICImI3gyQTg2OyI%2BPCFFTlRJVFkgZ3RyYXBwcm94ICImI3gyQTg2OyI%2BPCFFTlRJVFkgbG5lICImI3gyQTg3OyI%2BPCFFTlRJVFkgbG5lcSAiJiN4MkE4NzsiPjwhRU5USVRZIGduZSAiJiN4MkE4ODsiPjwhRU5USVRZIGduZXEgIiYjeDJBODg7Ij48IUVOVElUWSBsbmFwICImI3gyQTg5OyI%2BPCFFTlRJVFkgbG5hcHByb3ggIiYjeDJBODk7Ij48IUVOVElUWSBnbmFwICImI3gyQThBOyI%2BPCFFTlRJVFkgZ25hcHByb3ggIiYjeDJBOEE7Ij48IUVOVElUWSBsRWcgIiYjeDJBOEI7Ij48IUVOVElUWSBsZXNzZXFxZ3RyICImI3gyQThCOyI%2BPCFFTlRJVFkgZ0VsICImI3gyQThDOyI%2BPCFFTlRJVFkgZ3RyZXFxbGVzcyAiJiN4MkE4QzsiPjwhRU5USVRZIGxzaW1lICImI3gyQThEOyI%2BPCFFTlRJVFkgZ3NpbWUgIiYjeDJBOEU7Ij48IUVOVElUWSBsc2ltZyAiJiN4MkE4RjsiPjwhRU5USVRZIGdzaW1sICImI3gyQTkwOyI%2BPCFFTlRJVFkgbGdFICImI3gyQTkxOyI%2BPCFFTlRJVFkgZ2xFICImI3gyQTkyOyI%2BPCFFTlRJVFkgbGVzZ2VzICImI3gyQTkzOyI%2BPCFFTlRJVFkgZ2VzbGVzICImI3gyQTk0OyI%2BPCFFTlRJVFkgZWxzICImI3gyQTk1OyI%2BPCFFTlRJVFkgZXFzbGFudGxlc3MgIiYjeDJBOTU7Ij48IUVOVElUWSBlZ3MgIiYjeDJBOTY7Ij48IUVOVElUWSBlcXNsYW50Z3RyICImI3gyQTk2OyI%2BPCFFTlRJVFkgZWxzZG90ICImI3gyQTk3OyI%2BPCFFTlRJVFkgZWdzZG90ICImI3gyQTk4OyI%2BPCFFTlRJVFkgZWwgIiYjeDJBOTk7Ij48IUVOVElUWSBlZyAiJiN4MkE5QTsiPjwhRU5USVRZIHNpbWwgIiYjeDJBOUQ7Ij48IUVOVElUWSBzaW1nICImI3gyQTlFOyI%2BPCFFTlRJVFkgc2ltbEUgIiYjeDJBOUY7Ij48IUVOVElUWSBzaW1nRSAiJiN4MkFBMDsiPjwhRU5USVRZIExlc3NMZXNzICImI3gyQUExOyI%2BPCFFTlRJVFkgR3JlYXRlckdyZWF0ZXIgIiYjeDJBQTI7Ij48IUVOVElUWSBnbGogIiYjeDJBQTQ7Ij48IUVOVElUWSBnbGEgIiYjeDJBQTU7Ij48IUVOVElUWSBsdGNjICImI3gyQUE2OyI%2BPCFFTlRJVFkgZ3RjYyAiJiN4MkFBNzsiPjwhRU5USVRZIGxlc2NjICImI3gyQUE4OyI%2BPCFFTlRJVFkgZ2VzY2MgIiYjeDJBQTk7Ij48IUVOVElUWSBzbXQgIiYjeDJBQUE7Ij48IUVOVElUWSBsYXQgIiYjeDJBQUI7Ij48IUVOVElUWSBzbXRlICImI3gyQUFDOyI%2BPCFFTlRJVFkgbGF0ZSAiJiN4MkFBRDsiPjwhRU5USVRZIGJ1bXBFICImI3gyQUFFOyI%2BPCFFTlRJVFkgcHJlICImI3gyQUFGOyI%2BPCFFTlRJVFkgcHJlY2VxICImI3gyQUFGOyI%2BPCFFTlRJVFkgUHJlY2VkZXNFcXVhbCAiJiN4MkFBRjsiPjwhRU5USVRZIHNjZSAiJiN4MkFCMDsiPjwhRU5USVRZIHN1Y2NlcSAiJiN4MkFCMDsiPjwhRU5USVRZIFN1Y2NlZWRzRXF1YWwgIiYjeDJBQjA7Ij48IUVOVElUWSBwckUgIiYjeDJBQjM7Ij48IUVOVElUWSBzY0UgIiYjeDJBQjQ7Ij48IUVOVElUWSBwcm5FICImI3gyQUI1OyI%2BPCFFTlRJVFkgcHJlY25lcXEgIiYjeDJBQjU7Ij48IUVOVElUWSBzY25FICImI3gyQUI2OyI%2BPCFFTlRJVFkgc3VjY25lcXEgIiYjeDJBQjY7Ij48IUVOVElUWSBwcmFwICImI3gyQUI3OyI%2BPCFFTlRJVFkgcHJlY2FwcHJveCAiJiN4MkFCNzsiPjwhRU5USVRZIHNjYXAgIiYjeDJBQjg7Ij48IUVOVElUWSBzdWNjYXBwcm94ICImI3gyQUI4OyI%2BPCFFTlRJVFkgcHJuYXAgIiYjeDJBQjk7Ij48IUVOVElUWSBwcmVjbmFwcHJveCAiJiN4MkFCOTsiPjwhRU5USVRZIHNjbmFwICImI3gyQUJBOyI%2BPCFFTlRJVFkgc3VjY25hcHByb3ggIiYjeDJBQkE7Ij48IUVOVElUWSBQciAiJiN4MkFCQjsiPjwhRU5USVRZIFNjICImI3gyQUJDOyI%2BPCFFTlRJVFkgc3ViZG90ICImI3gyQUJEOyI%2BPCFFTlRJVFkgc3VwZG90ICImI3gyQUJFOyI%2BPCFFTlRJVFkgc3VicGx1cyAiJiN4MkFCRjsiPjwhRU5USVRZIHN1cHBsdXMgIiYjeDJBQzA7Ij48IUVOVElUWSBzdWJtdWx0ICImI3gyQUMxOyI%2BPCFFTlRJVFkgc3VwbXVsdCAiJiN4MkFDMjsiPjwhRU5USVRZIHN1YmVkb3QgIiYjeDJBQzM7Ij48IUVOVElUWSBzdXBlZG90ICImI3gyQUM0OyI%2BPCFFTlRJVFkgc3ViRSAiJiN4MkFDNTsiPjwhRU5USVRZIHN1YnNldGVxcSAiJiN4MkFDNTsiPjwhRU5USVRZIHN1cEUgIiYjeDJBQzY7Ij48IUVOVElUWSBzdXBzZXRlcXEgIiYjeDJBQzY7Ij48IUVOVElUWSBzdWJzaW0gIiYjeDJBQzc7Ij48IUVOVElUWSBzdXBzaW0gIiYjeDJBQzg7Ij48IUVOVElUWSBzdWJuRSAiJiN4MkFDQjsiPjwhRU5USVRZIHN1YnNldG5lcXEgIiYjeDJBQ0I7Ij48IUVOVElUWSBzdXBuRSAiJiN4MkFDQzsiPjwhRU5USVRZIHN1cHNldG5lcXEgIiYjeDJBQ0M7Ij48IUVOVElUWSBjc3ViICImI3gyQUNGOyI%2BPCFFTlRJVFkgY3N1cCAiJiN4MkFEMDsiPjwhRU5USVRZIGNzdWJlICImI3gyQUQxOyI%2BPCFFTlRJVFkgY3N1cGUgIiYjeDJBRDI7Ij48IUVOVElUWSBzdWJzdXAgIiYjeDJBRDM7Ij48IUVOVElUWSBzdXBzdWIgIiYjeDJBRDQ7Ij48IUVOVElUWSBzdWJzdWIgIiYjeDJBRDU7Ij48IUVOVElUWSBzdXBzdXAgIiYjeDJBRDY7Ij48IUVOVElUWSBzdXBoc3ViICImI3gyQUQ3OyI%2BPCFFTlRJVFkgc3VwZHN1YiAiJiN4MkFEODsiPjwhRU5USVRZIGZvcmt2ICImI3gyQUQ5OyI%2BPCFFTlRJVFkgdG9wZm9yayAiJiN4MkFEQTsiPjwhRU5USVRZIG1sY3AgIiYjeDJBREI7Ij48IUVOVElUWSBEYXNodiAiJiN4MkFFNDsiPjwhRU5USVRZIERvdWJsZUxlZnRUZWUgIiYjeDJBRTQ7Ij48IUVOVElUWSBWZGFzaGwgIiYjeDJBRTY7Ij48IUVOVElUWSBCYXJ2ICImI3gyQUU3OyI%2BPCFFTlRJVFkgdkJhciAiJiN4MkFFODsiPjwhRU5USVRZIHZCYXJ2ICImI3gyQUU5OyI%2BPCFFTlRJVFkgVmJhciAiJiN4MkFFQjsiPjwhRU5USVRZIE5vdCAiJiN4MkFFQzsiPjwhRU5USVRZIGJOb3QgIiYjeDJBRUQ7Ij48IUVOVElUWSBybm1pZCAiJiN4MkFFRTsiPjwhRU5USVRZIGNpcm1pZCAiJiN4MkFFRjsiPjwhRU5USVRZIG1pZGNpciAiJiN4MkFGMDsiPjwhRU5USVRZIHRvcGNpciAiJiN4MkFGMTsiPjwhRU5USVRZIG5ocGFyICImI3gyQUYyOyI%2BPCFFTlRJVFkgcGFyc2ltICImI3gyQUYzOyI%2BPCFFTlRJVFkgcGFyc2wgIiYjeDJBRkQ7Ij48IUVOVElUWSBmZmxpZyAiJiN4RkIwMDsiPjwhRU5USVRZIGZpbGlnICImI3hGQjAxOyI%2BPCFFTlRJVFkgZmxsaWcgIiYjeEZCMDI7Ij48IUVOVElUWSBmZmlsaWcgIiYjeEZCMDM7Ij48IUVOVElUWSBmZmxsaWcgIiYjeEZCMDQ7Ij48IUVOVElUWSBBc2NyICImI3gxRDQ5QzsiPjwhRU5USVRZIENzY3IgIiYjeDFENDlFOyI%2BPCFFTlRJVFkgRHNjciAiJiN4MUQ0OUY7Ij48IUVOVElUWSBHc2NyICImI3gxRDRBMjsiPjwhRU5USVRZIEpzY3IgIiYjeDFENEE1OyI%2BPCFFTlRJVFkgS3NjciAiJiN4MUQ0QTY7Ij48IUVOVElUWSBOc2NyICImI3gxRDRBOTsiPjwhRU5USVRZIE9zY3IgIiYjeDFENEFBOyI%2BPCFFTlRJVFkgUHNjciAiJiN4MUQ0QUI7Ij48IUVOVElUWSBRc2NyICImI3gxRDRBQzsiPjwhRU5USVRZIFNzY3IgIiYjeDFENEFFOyI%2BPCFFTlRJVFkgVHNjciAiJiN4MUQ0QUY7Ij48IUVOVElUWSBVc2NyICImI3gxRDRCMDsiPjwhRU5USVRZIFZzY3IgIiYjeDFENEIxOyI%2BPCFFTlRJVFkgV3NjciAiJiN4MUQ0QjI7Ij48IUVOVElUWSBYc2NyICImI3gxRDRCMzsiPjwhRU5USVRZIFlzY3IgIiYjeDFENEI0OyI%2BPCFFTlRJVFkgWnNjciAiJiN4MUQ0QjU7Ij48IUVOVElUWSBhc2NyICImI3gxRDRCNjsiPjwhRU5USVRZIGJzY3IgIiYjeDFENEI3OyI%2BPCFFTlRJVFkgY3NjciAiJiN4MUQ0Qjg7Ij48IUVOVElUWSBkc2NyICImI3gxRDRCOTsiPjwhRU5USVRZIGZzY3IgIiYjeDFENEJCOyI%2BPCFFTlRJVFkgaHNjciAiJiN4MUQ0QkQ7Ij48IUVOVElUWSBpc2NyICImI3gxRDRCRTsiPjwhRU5USVRZIGpzY3IgIiYjeDFENEJGOyI%2BPCFFTlRJVFkga3NjciAiJiN4MUQ0QzA7Ij48IUVOVElUWSBsc2NyICImI3gxRDRDMTsiPjwhRU5USVRZIG1zY3IgIiYjeDFENEMyOyI%2BPCFFTlRJVFkgbnNjciAiJiN4MUQ0QzM7Ij48IUVOVElUWSBwc2NyICImI3gxRDRDNTsiPjwhRU5USVRZIHFzY3IgIiYjeDFENEM2OyI%2BPCFFTlRJVFkgcnNjciAiJiN4MUQ0Qzc7Ij48IUVOVElUWSBzc2NyICImI3gxRDRDODsiPjwhRU5USVRZIHRzY3IgIiYjeDFENEM5OyI%2BPCFFTlRJVFkgdXNjciAiJiN4MUQ0Q0E7Ij48IUVOVElUWSB2c2NyICImI3gxRDRDQjsiPjwhRU5USVRZIHdzY3IgIiYjeDFENENDOyI%2BPCFFTlRJVFkgeHNjciAiJiN4MUQ0Q0Q7Ij48IUVOVElUWSB5c2NyICImI3gxRDRDRTsiPjwhRU5USVRZIHpzY3IgIiYjeDFENENGOyI%2BPCFFTlRJVFkgQWZyICImI3gxRDUwNDsiPjwhRU5USVRZIEJmciAiJiN4MUQ1MDU7Ij48IUVOVElUWSBEZnIgIiYjeDFENTA3OyI%2BPCFFTlRJVFkgRWZyICImI3gxRDUwODsiPjwhRU5USVRZIEZmciAiJiN4MUQ1MDk7Ij48IUVOVElUWSBHZnIgIiYjeDFENTBBOyI%2BPCFFTlRJVFkgSmZyICImI3gxRDUwRDsiPjwhRU5USVRZIEtmciAiJiN4MUQ1MEU7Ij48IUVOVElUWSBMZnIgIiYjeDFENTBGOyI%2BPCFFTlRJVFkgTWZyICImI3gxRDUxMDsiPjwhRU5USVRZIE5mciAiJiN4MUQ1MTE7Ij48IUVOVElUWSBPZnIgIiYjeDFENTEyOyI%2BPCFFTlRJVFkgUGZyICImI3gxRDUxMzsiPjwhRU5USVRZIFFmciAiJiN4MUQ1MTQ7Ij48IUVOVElUWSBTZnIgIiYjeDFENTE2OyI%2BPCFFTlRJVFkgVGZyICImI3gxRDUxNzsiPjwhRU5USVRZIFVmciAiJiN4MUQ1MTg7Ij48IUVOVElUWSBWZnIgIiYjeDFENTE5OyI%2BPCFFTlRJVFkgV2ZyICImI3gxRDUxQTsiPjwhRU5USVRZIFhmciAiJiN4MUQ1MUI7Ij48IUVOVElUWSBZZnIgIiYjeDFENTFDOyI%2BPCFFTlRJVFkgYWZyICImI3gxRDUxRTsiPjwhRU5USVRZIGJmciAiJiN4MUQ1MUY7Ij48IUVOVElUWSBjZnIgIiYjeDFENTIwOyI%2BPCFFTlRJVFkgZGZyICImI3gxRDUyMTsiPjwhRU5USVRZIGVmciAiJiN4MUQ1MjI7Ij48IUVOVElUWSBmZnIgIiYjeDFENTIzOyI%2BPCFFTlRJVFkgZ2ZyICImI3gxRDUyNDsiPjwhRU5USVRZIGhmciAiJiN4MUQ1MjU7Ij48IUVOVElUWSBpZnIgIiYjeDFENTI2OyI%2BPCFFTlRJVFkgamZyICImI3gxRDUyNzsiPjwhRU5USVRZIGtmciAiJiN4MUQ1Mjg7Ij48IUVOVElUWSBsZnIgIiYjeDFENTI5OyI%2BPCFFTlRJVFkgbWZyICImI3gxRDUyQTsiPjwhRU5USVRZIG5mciAiJiN4MUQ1MkI7Ij48IUVOVElUWSBvZnIgIiYjeDFENTJDOyI%2BPCFFTlRJVFkgcGZyICImI3gxRDUyRDsiPjwhRU5USVRZIHFmciAiJiN4MUQ1MkU7Ij48IUVOVElUWSByZnIgIiYjeDFENTJGOyI%2BPCFFTlRJVFkgc2ZyICImI3gxRDUzMDsiPjwhRU5USVRZIHRmciAiJiN4MUQ1MzE7Ij48IUVOVElUWSB1ZnIgIiYjeDFENTMyOyI%2BPCFFTlRJVFkgdmZyICImI3gxRDUzMzsiPjwhRU5USVRZIHdmciAiJiN4MUQ1MzQ7Ij48IUVOVElUWSB4ZnIgIiYjeDFENTM1OyI%2BPCFFTlRJVFkgeWZyICImI3gxRDUzNjsiPjwhRU5USVRZIHpmciAiJiN4MUQ1Mzc7Ij48IUVOVElUWSBBb3BmICImI3gxRDUzODsiPjwhRU5USVRZIEJvcGYgIiYjeDFENTM5OyI%2BPCFFTlRJVFkgRG9wZiAiJiN4MUQ1M0I7Ij48IUVOVElUWSBFb3BmICImI3gxRDUzQzsiPjwhRU5USVRZIEZvcGYgIiYjeDFENTNEOyI%2BPCFFTlRJVFkgR29wZiAiJiN4MUQ1M0U7Ij48IUVOVElUWSBJb3BmICImI3gxRDU0MDsiPjwhRU5USVRZIEpvcGYgIiYjeDFENTQxOyI%2BPCFFTlRJVFkgS29wZiAiJiN4MUQ1NDI7Ij48IUVOVElUWSBMb3BmICImI3gxRDU0MzsiPjwhRU5USVRZIE1vcGYgIiYjeDFENTQ0OyI%2BPCFFTlRJVFkgT29wZiAiJiN4MUQ1NDY7Ij48IUVOVElUWSBTb3BmICImI3gxRDU0QTsiPjwhRU5USVRZIFRvcGYgIiYjeDFENTRCOyI%2BPCFFTlRJVFkgVW9wZiAiJiN4MUQ1NEM7Ij48IUVOVElUWSBWb3BmICImI3gxRDU0RDsiPjwhRU5USVRZIFdvcGYgIiYjeDFENTRFOyI%2BPCFFTlRJVFkgWG9wZiAiJiN4MUQ1NEY7Ij48IUVOVElUWSBZb3BmICImI3gxRDU1MDsiPjwhRU5USVRZIGFvcGYgIiYjeDFENTUyOyI%2BPCFFTlRJVFkgYm9wZiAiJiN4MUQ1NTM7Ij48IUVOVElUWSBjb3BmICImI3gxRDU1NDsiPjwhRU5USVRZIGRvcGYgIiYjeDFENTU1OyI%2BPCFFTlRJVFkgZW9wZiAiJiN4MUQ1NTY7Ij48IUVOVElUWSBmb3BmICImI3gxRDU1NzsiPjwhRU5USVRZIGdvcGYgIiYjeDFENTU4OyI%2BPCFFTlRJVFkgaG9wZiAiJiN4MUQ1NTk7Ij48IUVOVElUWSBpb3BmICImI3gxRDU1QTsiPjwhRU5USVRZIGpvcGYgIiYjeDFENTVCOyI%2BPCFFTlRJVFkga29wZiAiJiN4MUQ1NUM7Ij48IUVOVElUWSBsb3BmICImI3gxRDU1RDsiPjwhRU5USVRZIG1vcGYgIiYjeDFENTVFOyI%2BPCFFTlRJVFkgbm9wZiAiJiN4MUQ1NUY7Ij48IUVOVElUWSBvb3BmICImI3gxRDU2MDsiPjwhRU5USVRZIHBvcGYgIiYjeDFENTYxOyI%2BPCFFTlRJVFkgcW9wZiAiJiN4MUQ1NjI7Ij48IUVOVElUWSByb3BmICImI3gxRDU2MzsiPjwhRU5USVRZIHNvcGYgIiYjeDFENTY0OyI%2BPCFFTlRJVFkgdG9wZiAiJiN4MUQ1NjU7Ij48IUVOVElUWSB1b3BmICImI3gxRDU2NjsiPjwhRU5USVRZIHZvcGYgIiYjeDFENTY3OyI%2BPCFFTlRJVFkgd29wZiAiJiN4MUQ1Njg7Ij48IUVOVElUWSB4b3BmICImI3gxRDU2OTsiPjwhRU5USVRZIHlvcGYgIiYjeDFENTZBOyI%2BPCFFTlRJVFkgem9wZiAiJiN4MUQ1NkI7Ij4%3D>the URL given by this
+ link</a>.</p>
+
+ <ul class=brief><li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Transitional//EN</code></li>
+ <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1//EN</code></li>
+ <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Strict//EN</code></li>
+ <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Frameset//EN</code></li>
+ <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;Basic&nbsp;1.0//EN</code></li>
+ <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1&nbsp;plus&nbsp;MathML&nbsp;2.0//EN</code></li>
+ <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1&nbsp;plus&nbsp;MathML&nbsp;2.0&nbsp;plus&nbsp;SVG&nbsp;1.1//EN</code></li>
+ <li><code title="">-//W3C//DTD&nbsp;MathML&nbsp;2.0//EN</code></li>
+ <li><code title="">-//WAPFORUM//DTD&nbsp;XHTML&nbsp;Mobile&nbsp;1.0//EN</code></li>
+ </ul><p>Furthermore, user agents should attempt to retrieve the above
+ external entity's content when one of the above public identifiers
+ is used, and should not attempt to retrieve any other external
+ entity's content.</p>
+
+ <p class=note>This is not strictly a <a href=#willful-violation title="willful
+ violation">violation</a> of the XML specification, but it does
+ contradict the spirit of the XML specification's requirements. This
+ is motivated by a desire for user agents to all handle entities in
+ an interoperable fashion without requiring any network access for
+ handling external subsets. <a href=#refsXML>[XML]</a></p>
+
+ <p id=scriptTagXML>When an <a href=#xml-parser>XML parser</a> creates a
+ <code><a href=#script>script</a></code> element, it must be marked as being
+ <a href=#parser-inserted>"parser-inserted"</a>. If the parser was originally
+ created for the <a href=#xml-fragment-parsing-algorithm>XML fragment parsing algorithm</a>, then
+ the element must be marked as <a href=#already-started>"already started"</a>
+ also. When the element's end tag is parsed, the user agent must
+ <a href=#running-a-script title="running a script">run</a> the <code><a href=#script>script</a></code>
+ element. If this causes there to be a <a href=#pending-parsing-blocking-script>pending parsing-blocking
+ script</a>, then the user agent must run the following steps:</p>
+
+ <ol><li><p>Block this instance of the <a href=#xml-parser>XML parser</a>, such
+ that the <a href=#event-loop>event loop</a> will not run <a href=#concept-task title=concept-task>tasks</a> that invoke it.</li>
+
+ <li><p><a href=#spin-the-event-loop>Spin the event loop</a> until there is no <a href=#a-style-sheet-blocking-scripts title="a style sheet blocking scripts">style sheet blocking
+ scripts</a> and the <a href=#pending-parsing-blocking-script>pending parsing-blocking
+ script</a>'s <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag is
+ set.</li>
+
+ <li><p>Unblock this instance of the <a href=#xml-parser>XML parser</a>, such
+ that <a href=#concept-task title=concept-task>tasks</a> that invoke it can
+ again be run.</li>
+
+ <li><p><a href=#executing-a-script-block title="executing a script block">Execute</a> the
+ <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>.</li>
+
+ <li><p>There is no longer a <a href=#pending-parsing-blocking-script>pending parsing-blocking
+ script</a>.</li>
+
+ </ol><p class=note>Since the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> API is not
+ available for <a href=#xml-documents>XML documents</a>, much of the complexity in
+ the <a href=#html-parser>HTML parser</a> is not needed in the <a href=#xml-parser>XML
+ parser</a>.</p>
+
+ <p>Certain algorithms in this specification <dfn id=feed-the-parser title="feed the
+ parser">spoon-feed the parser</dfn> characters one string at a
+ time. In such cases, the <a href=#xml-parser>XML parser</a> must act as it
+ would have if faced with a single string consisting of the
+ concatenation of all those characters.</p>
+
+ <p>When an <a href=#xml-parser>XML parser</a> reaches the end of its input, it
+ must <a href=#stop-parsing>stop parsing</a>, following the same rules as the
+ <a href=#html-parser>HTML parser</a>.</p>
+
+ <p>For the purposes of conformance checkers, if a resource is
+ determined to be in <a href=#the-xhtml-syntax>the XHTML syntax</a>, then it is an
+ <a href=#xml-documents title="XML documents">XML document</a>.</p>
+
+
+
+ <h3 id=serializing-xhtml-fragments><span class=secno>11.3 </span>Serializing XHTML fragments</h3>
+
+ <p>The <dfn id=xml-fragment-serialization-algorithm>XML fragment serialization algorithm</dfn> for a
+ <code><a href=#document>Document</a></code> or <code><a href=#element>Element</a></code> node either returns a
+ fragment of XML that represents that node or raises an
+ exception.</p>
+
+ <p>For <code><a href=#document>Document</a></code>s, the algorithm must return a string in
+ the form of a <a href=http://www.w3.org/TR/xml/#sec-well-formed>document
+ entity</a>, if none of the error cases below apply.</p>
+
+ <p>For <code><a href=#element>Element</a></code>s, the algorithm must return a string in
+ the form of an <a href=http://www.w3.org/TR/xml/#wf-entities>internal general parsed
+ entity</a>, if none of the error cases below apply.</p>
+
+ <p>In both cases, the string returned must be XML
+ namespace-well-formed and must be an isomorphic serialization of all
+ of that node's child nodes, in <a href=#tree-order>tree order</a>. User agents
+ may adjust prefixes and namespace declarations in the serialization
+ (and indeed might be forced to do so in some cases to obtain
+ namespace-well-formed XML). User agents may use a combination of
+ regular text, character references, and CDATA sections to represent
+ <a href=#text-node title="text node">text nodes</a> in the DOM (and indeed
+ might be forced to use representations that don't match the DOM's,
+ e.g. if a <code><a href=#cdatasection>CDATASection</a></code> node contains the string "<code title="">]]&gt;</code>").</p>
+
+ <p>For <code><a href=#element>Element</a></code>s, if any of the elements in the
+ serialization are in no namespace, the default namespace in scope
+ for those elements must be explicitly declared as the empty
+ string.<!-- because otherwise round-tripping might break since it'll
+ pick up the surrounding default ns when setting --> (This doesn't
+ apply in the <code><a href=#document>Document</a></code> case.) <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>
+
+ <p>For the purposes of this section, an internal general parsed
+ entity is considered XML namespace-well-formed if a document
+ consisting of an element with no namespace declarations whose
+ contents are the internal general parsed entity would itself be XML
+ namespace-well-formed.</p>
+
+ <p>If any of the following error cases are found in the DOM subtree
+ being serialized, then the algorithm must raise an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception instead of returning a
+ string:</p>
+
+ <ul><li>A <code><a href=#document>Document</a></code> node with no child element nodes.</li>
+
+ <li>A <code><a href=#documenttype>DocumentType</a></code> node that has an external subset
+ public identifier that contains characters that are not matched by
+ the XML <code title="">PubidChar</code> production. <a href=#refsXML>[XML]</a></li>
+
+ <li>A <code><a href=#documenttype>DocumentType</a></code> node that has an external subset
+ system identifier that contains both a U+0022 QUOTATION MARK (")
+ and a U+0027 APOSTROPHE (') or that contains characters that are
+ not matched by the XML <code title="">Char</code> production. <a href=#refsXML>[XML]</a></li>
+
+ <li>A node with a <!--prefix or--> local name containing a U+003A
+ COLON (:).</li> <!--(prefixes can get adjusted, so this isn't an
+ excuse) -->
+
+ <li>A node with a <!--prefix or--> local name that does not match
+ the XML <code title="">Name</code> production. <a href=#refsXML>[XML]</a></li> <!--(again, prefixes can get
+ adjusted, so this isn't an excuse) -->
+
+ <li>An <code><a href=#attr>Attr</a></code> node with no namespace whose local name is
+ the lowercase string "<code title="">xmlns</code>". <a href=#refsXMLNS>[XMLNS]</a></li>
+
+ <li>An <code><a href=#element>Element</a></code> node with two or more attributes with
+ the same local name and namespace.</li>
+
+ <li>An <code><a href=#attr>Attr</a></code> node, <code><a href=#text>Text</a></code> node,
+ <code><a href=#cdatasection>CDATASection</a></code> node, <code><a href=#comment-0>Comment</a></code> node, or
+ <code><a href=#processinginstruction>ProcessingInstruction</a></code> node whose data contains
+ characters that are not matched by the XML <code title="">Char</code> production. <a href=#refsXML>[XML]</a></li>
+
+ <!--<li>A <code>CDATASection</code> node whose data contains the
+ string "<code title="">]]&gt;</code>".</li> (these can be split)-->
+
+ <li>A <code><a href=#comment-0>Comment</a></code> node whose data contains two adjacent
+ U+002D HYPHEN-MINUS characters (-) or ends with such a
+ character.</li>
+
+ <li>A <code><a href=#processinginstruction>ProcessingInstruction</a></code> node whose target name is
+ an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">xml</code>".</li>
+
+ <li>A <code><a href=#processinginstruction>ProcessingInstruction</a></code> node whose target name
+ contains a U+003A COLON (:).</li>
+
+ <li>A <code><a href=#processinginstruction>ProcessingInstruction</a></code> node whose data contains
+ the string "<code title="">?&gt;</code>".</li>
+
+ </ul><p class=note>These are the only ways to make a DOM
+ unserializable. The DOM enforces all the other XML constraints; for
+ example, trying to append two elements to a <code><a href=#document>Document</a></code>
+ node will raise a <code><a href=#hierarchy_request_err>HIERARCHY_REQUEST_ERR</a></code> exception.</p>
+
+
+
+ <h3 id=parsing-xhtml-fragments><span class=secno>11.4 </span>Parsing XHTML fragments</h3>
+
+ <p>The <dfn id=xml-fragment-parsing-algorithm>XML fragment parsing algorithm</dfn> for either returns
+ a <code><a href=#document>Document</a></code> or raises a <code><a href=#syntax_err>SYNTAX_ERR</a></code>
+ exception. Given a string <var title="">input</var> and an optional
+ context element <var title="">context</var>, the algorithm is as
+ follows:</p>
+
+ <ol><li>
+
+ <p>Create a new <a href=#xml-parser>XML parser</a>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <var title="">context</var> element, <a href=#feed-the-parser>feed
+ the parser</a> just created the string corresponding to the
+ start tag of that element, declaring all the namespace prefixes
+ that are in scope on that element in the DOM, as well as declaring
+ the default namespace (if any) that is in scope on that element in
+ the DOM.</p>
+
+ <p>A namespace prefix is in scope if the DOM Core <code title="">lookupNamespaceURI()</code> method on the element would
+ return a non-null value for that prefix.</p>
+
+ <p>The default namespace is the namespace for which the DOM Core
+ <code title="">isDefaultNamespace()</code> method on the element
+ would return true.</p>
+
+ <p class=note>If there is a <var title="">context</var> element,
+ no <code title="">DOCTYPE</code> is passed to the parser, and
+ therefore no external subset is referenced, and therefore no
+ entities will be recognized.</p>
+
+ </li>
+
+ <li>
+
+ <p><a href=#feed-the-parser>Feed the parser</a> just created the string <var title="">input</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <var title="">context</var> element, <a href=#feed-the-parser>feed
+ the parser</a> just created the string corresponding to the
+ end tag of that element.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is an XML well-formedness or XML namespace
+ well-formedness error, then raise a <code><a href=#syntax_err>SYNTAX_ERR</a></code>
+ exception and abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there is a <var title="">context</var> element, then return
+ the child nodes of the root element of the resulting
+ <code><a href=#document>Document</a></code>, in <a href=#tree-order>tree order</a>.</p>
+
+ <p>Otherwise, return the children of the <code><a href=#document>Document</a></code>
+ object, in <a href=#tree-order>tree order</a>.</p>
+
+ </li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h2 id=rendering><span class=secno>12 </span>Rendering</h2>
+
+ <p><i>User agents are not required to present HTML documents in any
+ particular way. However, this section provides a set of suggestions
+ for rendering HTML documents that, if followed, are likely to lead
+ to a user experience that closely resembles the experience intended
+ by the documents' authors. So as to avoid confusion regarding the
+ normativity of this section, RFC2119 terms have not been used.
+ Instead, the term "expected" is used to indicate behavior that will
+ lead to this experience.</i></p>
+
+
+ <h3 id=introduction-8><span class=secno>12.1 </span>Introduction</h3>
+
+ <p>In general, user agents are expected to support CSS, and many of
+ the suggestions in this section are expressed in CSS terms. User
+ agents that use other presentation mechanisms can derive their
+ expected behavior by translating from the CSS rules given in this
+ section.</p>
+
+ <p>In the absence of style-layer rules to the contrary (e.g. author
+ style sheets), user agents are expected to render an element so that
+ it conveys to the user the meaning that the element
+ <dfn id=represents>represents</dfn>, as described by this specification.</p>
+
+ <p>The suggestions in this section generally assume a visual output
+ medium with a resolution of 96dpi or greater, but HTML is intended
+ to apply to multiple media (it is a <i>media-independent</i>
+ language). User agents are encouraged to adapt the suggestions in
+ this section to their target media.</p>
+
+ <hr><p>An element is <dfn id=being-rendered>being rendered</dfn> if it is <a href=#in-a-document>in a
+ <code>Document</code></a>, either its parent node is itself
+ <a href=#being-rendered>being rendered</a> or it is the <code><a href=#document>Document</a></code> node,
+ and it is not explicitly excluded from the rendering using either:</p>
+ <ul class=brief><li>the CSS 'display' property's 'none' value, or</li>
+ <li>the 'visibility' property's 'collapse' value unless it is being treated as equivalent to the 'hidden' value, or</li>
+ <li>some equivalent in other styling languages.</li>
+ </ul><p class=note>Just being off-screen does not mean the element is
+ not <a href=#being-rendered>being rendered</a>. The presence of the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute normally means the
+ element is not <a href=#being-rendered>being rendered</a>, though this might be
+ overriden by the style sheets.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h3 id=the-css-user-agent-style-sheet-and-presentational-hints><span class=secno>12.2 </span>The CSS user agent style sheet and presentational hints</h3>
+
+ <h4 id=introduction-9><span class=secno>12.2.1 </span>Introduction</h4>
+
+ <p>The CSS rules given in these subsections are, except where
+ otherwise specified, expected to be used as part of the user-agent
+ level style sheet defaults for all documents that contain <a href=#html-elements>HTML
+ elements</a>.</p>
+
+ <p>Some rules are intended for the author-level zero-specificity
+ presentational hints part of the CSS cascade; these are explicitly
+ called out as <dfn id=presentational-hints>presentational hints</dfn>.</p>
+
+ <p>Some of the rules regarding left and right margins are given here
+ as appropriate for elements whose 'direction' property is 'ltr', and
+ are expected to be flipped around on elements whose 'direction'
+ property is 'rtl'. These are marked "<dfn id=ltr-specific>LTR-specific</dfn>".</p>
+
+ <p id=case-sensitive-selector-exception>For the purpose of the
+ rules marked "case-sensitive", user agents are expected to use
+ case-sensitive matching of attribute values rather than
+ case-insensitive matching, regardless of whether a case-insensitive
+ matching is normally required for the given attribute.</p>
+
+ <p id=case-insensitive-selector-exception>Similarly, for the
+ purpose of the rules marked "case-insensitive", user agents are
+ expected to use <a href=#ascii-case-insensitive>ASCII case-insensitive</a> matching of
+ attribute values rather than case-sensitive matching, even for
+ attributes in XHTML documents.</p>
+
+ <p class=note>These markings only affect the handling of attribute
+ <em>values</em>, not attribute names or element names.</p>
+
+ <hr><p>When the text below says that an attribute <var title="">attribute</var> on an element <var title="">element</var>
+ <dfn id=maps-to-the-pixel-length-property>maps to the pixel length property</dfn> (or properties) <var title="">properties</var>, it means that if <var title="">element</var> has an attribute <var title="">attribute</var> set, and parsing that attribute's value
+ using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>
+ doesn't generate an error, then the user agent is expected to use
+ the parsed value as a pixel length for a <a href=#presentational-hints title="presentational
+ hints">presentational hint</a> for <var title="">properties</var>.</p>
+
+ <p>When the text below says that an attribute <var title="">attribute</var> on an element <var title="">element</var>
+ <dfn id=maps-to-the-dimension-property>maps to the dimension property</dfn> (or properties) <var title="">properties</var>, it means that if <var title="">element</var> has an attribute <var title="">attribute</var> set, and parsing that attribute's value
+ using the <a href=#rules-for-parsing-dimension-values>rules for parsing dimension values</a> doesn't
+ generate an error, then the user agent is expected to use the parsed
+ dimension as the value for a <a href=#presentational-hints title="presentational
+ hints">presentational hint</a> for <var title="">properties</var>, with the value given as a pixel length if
+ the dimension was an integer, and with the value given as a
+ percentage if the dimension was a percentage.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=display-types><span class=secno>12.2.2 </span>Display types</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+[hidden], area, base, basefont, command, datalist, head,
+input[type=hidden], link, menu[type=context], meta, noembed, noframes,
+param, rp, script, source, style, track, title { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ display: none;
+}
+
+address, article, aside, blockquote, body, center, dd, dir, div, dl,
+dt, figure, figcaption, footer, form, h1, h2, h3, h4, h5, h6, header,
+hgroup, hr, html, legend, listing, menu, nav, ol, p, plaintext, pre,
+section, summary, ul, xmp { display: block; }
+
+table { display: table; }
+caption { display: table-caption; }
+colgroup { display: table-column-group; }
+col { display: table-column; }
+thead { display: table-header-group; }
+tbody { display: table-row-group; }
+tfoot { display: table-footer-group; }
+tr { display: table-row; }
+td, th { display: table-cell; }
+
+li { display: list-item; }
+
+ruby { display: ruby; }
+rt { display: ruby-text; }</pre>
+
+ <!-- del, ins, and map are inline. -->
+
+ <p>For the purposes of the CSS table model, the <code><a href=#the-col-element>col</a></code>
+ element is expected to be treated as if it was present as many times
+ as its <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative
+ integers">specifies</a>.</p>
+
+ <p>For the purposes of the CSS table model, the
+ <code><a href=#the-colgroup-element>colgroup</a></code> element, if it contains no <code><a href=#the-col-element>col</a></code>
+ element, is expected to be treated as if it had as many such
+ children as its <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code>
+ attribute <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative
+ integers">specifies</a>.</p>
+
+ <p>For the purposes of the CSS table model, the <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> and <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> attributes on
+ <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements are expected to <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">provide</a> the
+ <i>special knowledge</i> regarding cells spanning rows and
+ columns.</p>
+
+ <p>For the purposes of the CSS ruby model, runs of children of
+ <code><a href=#the-ruby-element>ruby</a></code> elements that are not <code><a href=#the-rt-element>rt</a></code> or
+ <code><a href=#the-rp-element>rp</a></code> elements are expected to be wrapped in anonymous
+ boxes whose 'display' property has the value 'ruby-base'.</p>
+
+ <p>User agents that do not support correct ruby rendering are
+ expected to render parentheses around the text of <code><a href=#the-rt-element>rt</a></code>
+ elements in the absence of <code><a href=#the-rp-element>rp</a></code> elements.</p>
+
+ <p>The <code><a href=#the-br-element>br</a></code> element is expected to render as if its
+ contents were a single U+000A LINE FEED (LF) character and its
+ 'white-space' property was 'pre'. User agents are expected to
+ support the 'clear' property on inline elements (in order to render
+ <code><a href=#the-br-element>br</a></code> elements with <code title=attr-br-clear><a href=#attr-br-clear>clear</a></code> attributes) in the manner
+ described in the non-normative note to this effect in CSS2.1.</p>
+ <!-- section 9.5.2 of CSS2.1 -->
+
+ <p>The user agent is expected to hide <code><a href=#the-noscript-element>noscript</a></code> elements
+ for whom <a href=#concept-n-script title=concept-n-script>scripting is enabled</a>,
+ irrespective of CSS rules.</p>
+
+ <p>In <a href=#html-documents>HTML documents</a>, the user agent is expected to
+ hide <code><a href=#the-form-element>form</a></code> elements that are children of
+ <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>,
+ <code><a href=#the-tfoot-element>tfoot</a></code>, or <code><a href=#the-tr-element>tr</a></code> elements, irrespective of CSS
+ rules.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=margins-and-padding><span class=secno>12.2.3 </span>Margins and padding</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+blockquote, dir, dl, figure, listing, menu, ol, p, plaintext,
+pre, ul, xmp {
+ margin-top: 1em; margin-bottom: 1em;
+}
+
+dir dir, dir dl, dir menu, dir ol, dir ul,
+dl dir, dl dl, dl menu, dl ol, dl ul,
+menu dir, menu dl, menu menu, menu ol, menu ul,
+ol dir, ol dl, ol menu, ol ol, ol ul,
+ul dir, ul dl, ul menu, ul ol, ul ul {
+ margin-top: 0; margin-bottom: 0;
+}
+
+h1 { margin-top: 0.67em; margin-bottom; 0.67em; }
+h2 { margin-top: 0.83em; margin-bottom; 0.83em; }
+h3 { margin-top: 1.00em; margin-bottom; 1.00em; }
+h4 { margin-top: 1.33em; margin-bottom; 1.33em; }
+h5 { margin-top: 1.67em; margin-bottom; 1.67em; }
+h6 { margin-top: 2.33em; margin-bottom; 2.33em; }
+
+dd { margin-left: 40px; } /* <a href=#ltr-specific>LTR-specific</a>: use 'margin-right' for rtl elements */
+dir, menu, ol, ul { padding-left: 40px; } /* <a href=#ltr-specific>LTR-specific</a>: use 'padding-right' for rtl elements */
+blockquote, figure { margin-left: 40px; margin-right: 40px; }
+
+table { border-spacing: 2px; border-collapse: separate; }
+td, th { padding: 1px; }</pre>
+
+ <p>The <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-nav-element>nav</a></code>,
+ and <code><a href=#the-section-element>section</a></code> elements are expected to affect the margins
+ of <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements, based on the nesting depth. If <var title="">x</var> is a selector that matches elements that are either
+ <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-nav-element>nav</a></code>, or
+ <code><a href=#the-section-element>section</a></code> elements, then the following rules capture what
+ is expected:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+<var title="">x</var> h1 { margin-top: 0.83em; margin-bottom: 0.83em; }
+<var title="">x</var> <var title="">x</var> h1 { margin-top: 1.00em; margin-bottom: 1.00em; }
+<var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { margin-top: 1.33em; margin-bottom: 1.33em; }
+<var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { margin-top: 1.67em; margin-bottom: 1.67em; }
+<var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { margin-top: 2.33em; margin-bottom: 2.33em; }</pre>
+
+ <hr><p>For each property in the table below, given a <code><a href=#the-body-element-0>body</a></code>
+ element, the first attribute that exists <a href=#maps-to-the-pixel-length-property>maps to the pixel
+ length property</a> on the <code><a href=#the-body-element-0>body</a></code> element. If none of
+ the attributes for a property are found, or if the value of the
+ attribute that was found cannot be parsed successfully, then a
+ default value of 8px is expected to be used for that property
+ instead.</p>
+
+ <table><thead><tr><th>Property
+ <th>Source
+ <tbody><tr><td rowspan=3>'margin-top'
+ <td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-marginheight><a href=#attr-body-marginheight>marginheight</a></code> attribute
+ <tr><td>The <code><a href=#the-body-element-0>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> attribute
+ <tr><td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-topmargin>topmargin</code> attribute
+ <tbody><tr><td rowspan=3>'margin-right'
+ <td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-marginwidth><a href=#attr-body-marginwidth>marginwidth</a></code> attribute
+ <tr><td>The <code><a href=#the-body-element-0>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> attribute
+ <tr><td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-rightmargin>rightmargin</code> attribute
+ <tbody><tr><td rowspan=3>'margin-bottom'
+ <td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-marginheight><a href=#attr-body-marginheight>marginheight</a></code> attribute
+ <tr><td>The <code><a href=#the-body-element-0>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> attribute
+ <tr><td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-bottommargin>topmargin</code> attribute
+ <tbody><tr><td rowspan=3>'margin-left'
+ <td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-marginwidth><a href=#attr-body-marginwidth>marginwidth</a></code> attribute
+ <tr><td>The <code><a href=#the-body-element-0>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> attribute
+ <tr><td><code><a href=#the-body-element-0>body</a></code> element's <code title=attr-body-leftmargin>rightmargin</code> attribute
+ </table><p>If the <code><a href=#the-body-element-0>body</a></code> element's <code><a href=#document>Document</a></code>'s
+ <a href=#browsing-context>browsing context</a> is a <a href=#nested-browsing-context>nested browsing
+ context</a>, and the <a href=#browsing-context-container>browsing context container</a> of
+ that <a href=#nested-browsing-context>nested browsing context</a> is a <code><a href=#frame>frame</a></code> or
+ <code><a href=#the-iframe-element>iframe</a></code> element, then the <dfn id=container-frame-element>container frame
+ element</dfn> of the <code><a href=#the-body-element-0>body</a></code> element is that
+ <code><a href=#frame>frame</a></code> or <code><a href=#the-iframe-element>iframe</a></code> element. Otherwise, there
+ is no <a href=#container-frame-element>container frame element</a>.</p>
+
+ <p class=warning>The above requirements imply that a page can
+ change the margins of another page (including one from another
+ <a href=#origin>origin</a>) using, for example, an
+ <code><a href=#the-iframe-element>iframe</a></code>. This is potentially a security risk, as it
+ might in some cases allow an attack to contrive a situation in which
+ a page is rendered not as the author intended, possibly for the
+ purposes of phishing or otherwise misleading the user.</p>
+
+ <hr><p>If the <code><a href=#document>Document</a></code> has a <a href=#root-element>root element</a>, and
+ the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> is a
+ <a href=#nested-browsing-context>nested browsing context</a>, and the <a href=#browsing-context-container>browsing context
+ container</a> of that <a href=#nested-browsing-context>nested browsing context</a> is a
+ <code><a href=#frame>frame</a></code> or <code><a href=#the-iframe-element>iframe</a></code> element, and that element
+ has a <code title=attr-frames-scrolling>scrolling</code>
+ attribute, then the user agent is expected to compare the value of
+ the attribute in an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> manner to
+ the values in the first column of the following table, and if one of
+ them matches, then the user agent is expected to treat that
+ attribute as a <a href=#presentational-hints title="presentational hints">presentational
+ hint</a> for the aforementioned root element's 'overflow'
+ property, setting it to the value given in the corresponding cell on
+ the same row in the second column:</p>
+
+ <table><thead><tr><th> Attribute value
+ <th> 'overflow' value
+ <tbody><tr><td><code title="">on</code>
+ <td>'scroll'
+ <tr><td><code title="">scroll</code>
+ <td>'scroll'
+ <tr><td><code title="">yes</code>
+ <td>'scroll'
+ <tr><td><code title="">off</code>
+ <td>'hidden'
+ <tr><td><code title="">noscroll</code>
+ <td>'hidden'
+ <tr><td><code title="">no</code>
+ <td>'hidden'
+ <tr><td><code title="">auto</code>
+ <td>'auto'
+ </table><hr><p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code> attribute
+ <a href=#maps-to-the-pixel-length-property>maps to the pixel length property</a> 'border-spacing' on the
+ element.</p>
+
+ <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code> attribute <a href=#maps-to-the-pixel-length-property title="maps to the pixel length property">maps to the pixel length
+ properties</a> 'padding-top', 'padding-right', 'padding-bottom',
+ and 'padding-left' of any <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code>
+ elements that have corresponding <a href=#concept-cell title=concept-cell>cells</a> in the <a href=#concept-table title=concept-table>table</a> corresponding to the
+ <code><a href=#the-table-element>table</a></code> element.</p>
+
+ <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-hspace>hspace</code> attribute <a href=#maps-to-the-dimension-property title="maps
+ to the dimension property">maps to the dimension properties</a>
+ 'margin-left' and 'margin-right' on the <code><a href=#the-table-element>table</a></code>
+ element.</p>
+
+ <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-vspace>vspace</code> attribute <a href=#maps-to-the-dimension-property title="maps
+ to the dimension property">maps to the dimension properties</a>
+ 'margin-top' and 'margin-bottom' on the <code><a href=#the-table-element>table</a></code>
+ element.</p>
+
+ <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-height>height</code> attribute <a href=#maps-to-the-dimension-property>maps to the
+ dimension property</a> 'height' on the <code><a href=#the-table-element>table</a></code>
+ element.</p>
+
+ <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-width><a href=#attr-table-width>width</a></code> attribute <a href=#maps-to-the-dimension-property>maps to the
+ dimension property</a> 'width' on the <code><a href=#the-table-element>table</a></code>
+ element.</p>
+
+ <p>The <code><a href=#the-col-element>col</a></code> element's <code title=attr-col-width><a href=#attr-col-width>width</a></code> attribute <a href=#maps-to-the-dimension-property>maps to the
+ dimension property</a> 'width' on the <code><a href=#the-col-element>col</a></code>
+ element.</p>
+
+ <p>The <code><a href=#the-tr-element>tr</a></code> element's <code title=attr-tr-height>height</code> attribute <a href=#maps-to-the-dimension-property>maps to the
+ dimension property</a> 'height' on the <code><a href=#the-tr-element>tr</a></code>
+ element.</p>
+
+ <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements' <code title=attr-tdth-height><a href=#attr-tdth-height>height</a></code> attributes <a href=#maps-to-the-dimension-property title="maps
+ to the dimension property">map to the dimension property</a> 'height'
+ on the element.</p>
+
+ <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements' <code title=attr-tdth-width><a href=#attr-tdth-width>width</a></code> attributes <a href=#maps-to-the-dimension-property title="maps
+ to the dimension property">map to the dimension property</a> 'width'
+ on the element.</p>
+
+ <hr><p>In <a href=#quirks-mode>quirks mode</a>, the following rules are also
+ expected to apply:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+form { margin-bottom: 1em; }</pre>
+
+ <p>When a <code><a href=#document>Document</a></code> is in <a href=#quirks-mode>quirks mode</a>,
+ margins on <a href=#html-elements>HTML elements</a> at the top or bottom of
+ <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-td-element>td</a></code>, or <code><a href=#the-th-element>th</a></code> elements are
+ expected to be collapsed to zero.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=alignment><span class=secno>12.2.4 </span>Alignment</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+thead, tbody, tfoot, table &gt; tr { vertical-align: middle; }
+tr, td, th { vertical-align: inherit; }
+sub { vertical-align: sub; }
+sup { vertical-align: super; }
+th { text-align: center; }</pre>
+
+ <hr><p>The following rules are also expected to apply, as
+ <a href=#presentational-hints>presentational hints</a>:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+table[align=left] { float: left; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+table[align=right] { float: right; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+table[align=center], table[align=abscenter],
+table[align=absmiddle], table[align=middle] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ margin-left: auto; margin-right: auto;
+}
+thead[align=absmiddle], tbody[align=absmiddle], tfoot[align=absmiddle],
+tr[align=absmiddle], td[align=absmiddle], th[align=absmiddle] {
+ text-align: center;
+}
+
+caption[align=bottom] { caption-side: bottom; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+p[align=left], h1[align=left], h2[align=left], h3[align=left],
+h4[align=left], h5[align=left], h6[align=left] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ text-align: left;
+}
+p[align=right], h1[align=right], h2[align=right], h3[align=right],
+h4[align=right], h5[align=right], h6[align=right] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ text-align: right;
+}
+p[align=center], h1[align=center], h2[align=center], h3[align=center],
+h4[align=center], h5[align=center], h6[align=center] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ text-align: center;
+}
+p[align=justify], h1[align=justify], h2[align=justify], h3[align=justify],
+h4[align=justify], h5[align=justify], h6[align=justify] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ text-align: justify;
+}
+col[valign=top], thead[valign=top], tbody[valign=top],
+tfoot[valign=top], tr[valign=top], td[valign=top], th[valign=top] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: top;
+}
+col[valign=middle], thead[valign=middle], tbody[valign=middle],
+tfoot[valign=middle], tr[valign=middle], td[valign=middle], th[valign=middle] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: middle;
+}
+col[valign=bottom], thead[valign=bottom], tbody[valign=bottom],
+tfoot[valign=bottom], tr[valign=bottom], td[valign=bottom], th[valign=bottom] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: bottom;
+}
+col[valign=baseline], thead[valign=baseline], tbody[valign=baseline],
+tfoot[valign=baseline], tr[valign=baseline], td[valign=baseline], th[valign=baseline] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: baseline;
+}</pre>
+
+ <p>The <code><a href=#center>center</a></code> element, the <code><a href=#the-caption-element>caption</a></code> element
+ unless specified otherwise below, and the <code><a href=#the-div-element>div</a></code>,
+ <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>,
+ <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-td-element>td</a></code>, and <code><a href=#the-th-element>th</a></code> elements when
+ they have an <code title=attr-div-align><a href=#attr-div-align>align</a></code> attribute
+ whose value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
+ either the string "<code title="">center</code>" or the string
+ "<code title="">middle</code>", are expected to center text within
+ themselves, as if they had their 'text-align' property set to
+ 'center' in a <a href=#presentational-hints title="presentational hints">presentational
+ hint</a>, and to <a href=#align-descendants>align descendants</a> to the
+ center.</p>
+
+ <p>The <code><a href=#the-div-element>div</a></code>, <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-thead-element>thead</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>,
+ <code><a href=#the-td-element>td</a></code>, and <code><a href=#the-th-element>th</a></code> elements, when they have an
+ <code title=attr-align>align</code> attribute whose value is an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">left</code>", are expected to left-align text within
+ themselves, as if they had their 'text-align' property set to 'left'
+ in a <a href=#presentational-hints title="presentational hints">presentational hint</a>,
+ and to <a href=#align-descendants>align descendants</a> to the left.</p>
+
+ <p>The <code><a href=#the-div-element>div</a></code>, <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-thead-element>thead</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>,
+ <code><a href=#the-td-element>td</a></code>, and <code><a href=#the-th-element>th</a></code> elements, when they have an
+ <code title=attr-align>align</code> attribute whose value is an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">right</code>", are expected to right-align text within
+ themselves, as if they had their 'text-align' property set to
+ 'right' in a <a href=#presentational-hints title="presentational hints">presentational
+ hint</a>, and to <a href=#align-descendants>align descendants</a> to the right.</p>
+
+ <p>The <code><a href=#the-div-element>div</a></code>, <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-thead-element>thead</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>,
+ <code><a href=#the-td-element>td</a></code>, and <code><a href=#the-th-element>th</a></code> elements, when they have an
+ <code title=attr-align>align</code> attribute whose value is an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">justify</code>", are expected to full-justify text within
+ themselves, as if they had their 'text-align' property set to
+ 'justify' in a <a href=#presentational-hints title="presentational hints">presentational
+ hint</a>, and to <a href=#align-descendants>align descendants</a> to the left.</p>
+
+ <p>When a user agent is to <dfn id=align-descendants>align descendants</dfn> of a node,
+ the user agent is expected to align only those descendants that have
+ both their 'margin-left' and 'margin-right' properties computing to
+ a value other than 'auto', that are over-constrained and that have
+ one of those two margins with a used value forced to a greater
+ value, and that do not themselves have an applicable <code title=attr-align>align</code> attribute. When multiple elements
+ are to <a href=#align-descendants title="align descendants">align</a> a particular
+ descendant, the most deeply nested such element is expected to
+ override the others.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=fonts-and-colors><span class=secno>12.2.5 </span>Fonts and colors</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+address, cite, dfn, em, i, var { font-style: italic; }
+b, strong, th { font-weight: bold; }
+code, kbd, listing, plaintext, pre, samp, tt, xmp { font-family: monospace; }
+h1 { font-size: 2.00em; font-weight: bold; }
+h2 { font-size: 1.50em; font-weight: bold; }
+h3 { font-size: 1.17em; font-weight: bold; }
+h4 { font-size: 1.00em; font-weight: bold; }
+h5 { font-size: 0.83em; font-weight: bold; }
+h6 { font-size: 0.67em; font-weight: bold; }
+big { font-size: larger; }
+small, sub, sup { font-size: smaller; }
+sub, sup { line-height: normal; }
+
+:link { color: blue; }
+:visited { color: purple; }
+mark { background: yellow; color: black; }
+
+table, td, th { border-color: gray; }
+thead, tbody, tfoot, tr { border-color: inherit; }
+table[rules=none], table[rules=groups], table[rules=rows],
+table[rules=cols], table[rules=all], table[frame=void],
+table[frame=above], table[frame=below], table[frame=hsides],
+table[frame=lhs], table[frame=rhs], table[frame=vsides],
+table[frame=box], table[frame=border],
+table[rules=none] &gt; tr &gt; td, table[rules=none] &gt; tr &gt; th,
+table[rules=groups] &gt; tr &gt; td, table[rules=groups] &gt; tr &gt; th,
+table[rules=rows] &gt; tr &gt; td, table[rules=rows] &gt; tr &gt; th,
+table[rules=cols] &gt; tr &gt; td, table[rules=cols] &gt; tr &gt; th,
+table[rules=all] &gt; tr &gt; td, table[rules=all] &gt; tr &gt; th,
+table[rules=none] &gt; thead &gt; tr &gt; td, table[rules=none] &gt; thead &gt; tr &gt; th,
+table[rules=groups] &gt; thead &gt; tr &gt; td, table[rules=groups] &gt; thead &gt; tr &gt; th,
+table[rules=rows] &gt; thead &gt; tr &gt; td, table[rules=rows] &gt; thead &gt; tr &gt; th,
+table[rules=cols] &gt; thead &gt; tr &gt; td, table[rules=cols] &gt; thead &gt; tr &gt; th,
+table[rules=all] &gt; thead &gt; tr &gt; td, table[rules=all] &gt; thead &gt; tr &gt; th,
+table[rules=none] &gt; tbody &gt; tr &gt; td, table[rules=none] &gt; tbody &gt; tr &gt; th,
+table[rules=groups] &gt; tbody &gt; tr &gt; td, table[rules=groups] &gt; tbody &gt; tr &gt; th,
+table[rules=rows] &gt; tbody &gt; tr &gt; td, table[rules=rows] &gt; tbody &gt; tr &gt; th,
+table[rules=cols] &gt; tbody &gt; tr &gt; td, table[rules=cols] &gt; tbody &gt; tr &gt; th,
+table[rules=all] &gt; tbody &gt; tr &gt; td, table[rules=all] &gt; tbody &gt; tr &gt; th,
+table[rules=none] &gt; tfoot &gt; tr &gt; td, table[rules=none] &gt; tfoot &gt; tr &gt; th,
+table[rules=groups] &gt; tfoot &gt; tr &gt; td, table[rules=groups] &gt; tfoot &gt; tr &gt; th,
+table[rules=rows] &gt; tfoot &gt; tr &gt; td, table[rules=rows] &gt; tfoot &gt; tr &gt; th,
+table[rules=cols] &gt; tfoot &gt; tr &gt; td, table[rules=cols] &gt; tfoot &gt; tr &gt; th,
+table[rules=all] &gt; tfoot &gt; tr &gt; td, table[rules=all] &gt; tfoot &gt; tr &gt; th { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ border-color: black;
+}</pre>
+
+ <hr><p>The initial value for the 'color' property is expected to be
+ black. The initial value for the 'background-color' property is
+ expected to be 'transparent'. The canvas's background is expected to
+ be white.</p>
+
+ <hr><p>The <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-nav-element>nav</a></code>,
+ and <code><a href=#the-section-element>section</a></code> elements are expected to affect the font
+ size of <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements, based on the nesting depth. If
+ <var title="">x</var> is a selector that matches elements that are
+ either <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-nav-element>nav</a></code>,
+ or <code><a href=#the-section-element>section</a></code> elements, then the following rules capture
+ what is expected:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+<var title="">x</var> h1 { font-size: 1.50em; }
+<var title="">x</var> <var title="">x</var> h1 { font-size: 1.17em; }
+<var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { font-size: 1.00em; }
+<var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { font-size: 0.83em; }
+<var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { font-size: 0.67em; }</pre>
+
+ <hr><p>When a <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>,
+ <code><a href=#the-td-element>td</a></code>, or <code><a href=#the-th-element>th</a></code> element has a <code title=attr-background><a href=#attr-background>background</a></code> attribute set to a
+ non-empty value, the new value is expected to be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element, and
+ if this is successful, the user agent is expected to treat the
+ attribute as a <a href=#presentational-hints title="presentational hints">presentational
+ hint</a> setting the element's 'background-image' property to the
+ resulting <a href=#absolute-url>absolute URL</a>.</p>
+
+ <p>When a <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>,
+ <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>,
+ <code><a href=#the-td-element>td</a></code>, or <code><a href=#the-th-element>th</a></code> element has a <code title="">bgcolor</code> attribute set, the new value is expected to
+ be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy color
+ value</a>, and if that does not return an error, the user agent
+ is expected to treat the attribute as a <a href=#presentational-hints title="presentational
+ hints">presentational hint</a> setting the element's
+ 'background-color' property to the resulting color.</p>
+
+ <p>When a <code><a href=#the-body-element-0>body</a></code> element has a <code title=attr-body-text><a href=#attr-body-text>text</a></code> attribute, its value is expected
+ to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy color
+ value</a>, and if that does not return an error, the user
+ agent is expected to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
+ element's 'color' property to the resulting color.</p>
+
+ <p>When a <code><a href=#the-body-element-0>body</a></code> element has a <code title=attr-body-link><a href=#attr-body-link>link</a></code> attribute, its value is expected
+ to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy color
+ value</a>, and if that does not return an error, the user agent
+ is expected to treat the attribute as a <a href=#presentational-hints title="presentational
+ hints">presentational hint</a> setting the 'color' property of
+ any element in the <code><a href=#document>Document</a></code> matching the ':link'
+ pseudo-class to the resulting color.</p>
+
+ <p>When a <code><a href=#the-body-element-0>body</a></code> element has a <code title=attr-body-vlink><a href=#attr-body-vlink>vlink</a></code> attribute, its value is
+ expected to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy
+ color value</a>, and if that does not return an error, the user
+ agent is expected to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
+ 'color' property of any element in the <code><a href=#document>Document</a></code>
+ matching the ':visited' pseudo-class to the resulting color.</p>
+
+ <p>When a <code><a href=#the-body-element-0>body</a></code> element has a <code title=attr-body-alink><a href=#attr-body-alink>alink</a></code> attribute, its value is
+ expected to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy
+ color value</a>, and if that does not return an error, the user
+ agent is expected to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
+ 'color' property of any element in the <code><a href=#document>Document</a></code>
+ matching the ':active' pseudo-class and either the ':link'
+ pseudo-class or the ':visited' pseudo-class to the resulting
+ color.</p>
+
+ <p>When a <code><a href=#the-table-element>table</a></code> element has a <code title=attr-table-bordercolor>bordercolor</code> attribute, its
+ value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a
+ legacy color value</a>, and if that does not return an error, the
+ user agent is expected to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
+ element's 'border-top-color', 'border-right-color',
+ 'border-bottom-color', and 'border-right-color' properties to the
+ resulting color.</p>
+
+ <hr><p>When a <code><a href=#font>font</a></code> element has a <code title=attr-font-color>color</code> attribute, its value is
+ expected to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy
+ color value</a>, and if that does not return an error, the user
+ agent is expected to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
+ element's 'color' property to the resulting color.</p>
+
+ <p>When a <code><a href=#font>font</a></code> element has a <code title=attr-font-face>face</code> attribute, the user agent is
+ expected to treat the attribute as a <a href=#presentational-hints title="presentational
+ hints">presentational hint</a> setting the element's
+ 'font-family' property to the attribute's value.</p>
+
+ <!-- (Apparently only IE supports this?) (Note: if you add this
+ back, make sure to define which of 'size' vs 'pointsize' wins.)
+
+ <p>When a <code>font</code> element has a <code
+ title="attr-font-pointsize">pointsize</code> attribute, the user
+ agent is expected to parse that attribute's value using the
+ <span>rules for parsing non-negative integers</span>, and if this
+ doesn't generate an error, then the user agent is expected to use
+ the parsed value as a <em>point</em> length for a <span
+ title="presentational hints">presentational hint</span> for the
+ 'font-size' property on the element.</p>
+ -->
+
+ <p>When a <code><a href=#font>font</a></code> element has a <code title=attr-font-size>size</code> attribute, the user agent is
+ expected to use the following steps to treat the attribute as a
+ <a href=#presentational-hints title="presentational hints">presentational hint</a>
+ setting the element's 'font-size' property:</p>
+
+ <ol><li><p>Let <var title="">input</var> be the attribute's
+ value.</li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+ string.</li>
+
+ <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+ <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, there is no <a href=#presentational-hints title="presentational
+ hints">presentational hint</a>. Abort these steps.</li>
+
+ <li><p>If the character at <var title="">position</var> is a U+002B
+ PLUS SIGN character (+), then let <var title="">mode</var> be
+ <i>relative-plus</i>, and advance <var title="">position</var> to
+ the next character. Otherwise, if the character at <var title="">position</var> is a U+002D HYPHEN-MINUS character (-),
+ then let <var title="">mode</var> be <i>relative-minus</i>, and
+ advance <var title="">position</var> to the next
+ character. Otherwise, let <var title="">mode</var> be
+ <i>absolute</i>.</li>
+
+ <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let the
+ resulting sequence be <var title="">digits</var>.</li>
+
+ <li><p>If <var title="">digits</var> is the empty string, there is
+ no <a href=#presentational-hints title="presentational hints">presentational
+ hint</a>. Abort these steps.</li>
+
+ <li><p>Interpret <var title="">digits</var> as a base-ten
+ integer. Let <var title="">value</var> be the resulting
+ number.</li>
+
+ <li>
+
+ <!-- basefont support would go here, but we removed it -->
+
+ <p>If <var title="">mode</var> is <i>relative-plus</i>, then
+ increment <var title="">value</var> by 3. If <var title="">mode</var> is <i>relative-minus</i>, then let <var title="">value</var> be the result of subtracting <var title="">value</var> from 3.</p>
+
+ </li>
+
+ <li><p>If <var title="">value</var> is greater than 7, let it be
+ 7.</li>
+
+ <li><p>If <var title="">value</var> is less than 1, let it be
+ 1.</li>
+
+ <li>
+
+ <p>Set 'font-size' to the keyword corresponding to the value of
+ <var title="">value</var> according to the following table:</p>
+
+ <table><thead><tr><th><var title="">value</var>
+ <th>'font-size' keyword
+ <th>Notes
+ <tbody><tr><td>1
+ <td>xx-small
+ <td>
+ <tr><td>2
+ <td>small
+ <td>
+ <tr><td>3
+ <td>medium
+ <td>
+ <tr><td>4
+ <td>large
+ <td>
+ <tr><td>5
+ <td>x-large
+ <td>
+ <tr><td>6
+ <td>xx-large
+ <td>
+ <tr><td>7
+ <td>x<!---->xx-large
+ <td><i>see below</i>
+ </table><p>The 'x<!---->xx-large' value is a non-CSS value used here to
+ indicate a font size one "step" larger than 'xx-large'.</p>
+
+ </li>
+
+ </ol></div>
+
+
+ <div class=impl>
+
+ <h4 id=punctuation-and-decorations><span class=secno>12.2.6 </span>Punctuation and decorations</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+:link, :visited, ins, u { text-decoration: underline; }
+abbr[title], acronym[title] { text-decoration: dotted underline; }<!-- CSS3 http://dev.w3.org/csswg/css3-text/#text-decoration-style -->
+del, s, strike { text-decoration: line-through; }
+blink { text-decoration: blink; }
+
+:focus { outline: auto; }
+
+q:before { content: open-quote; }
+q:after { content: close-quote; }
+
+nobr { white-space: nowrap; }
+listing, plaintext, pre, xmp { white-space: pre; }
+
+ol { list-style-type: decimal; }
+
+dir, menu, ul {
+ list-style-type: disc;
+}
+
+dir dl, dir menu, dir ul,
+menu dl, menu menu, menu ul,
+ol dl, ol menu, ol ul,
+ul dl, ul menu, ul ul {
+ list-style-type: circle;
+}
+
+dir dir dl, dir dir menu, dir dir ul,
+dir menu dl, dir menu menu, dir menu ul,
+dir ol dl, dir ol menu, dir ol ul,
+dir ul dl, dir ul menu, dir ul ul,
+menu dir dl, menu dir menu, menu dir ul,
+menu menu dl, menu menu menu, menu menu ul,
+menu ol dl, menu ol menu, menu ol ul,
+menu ul dl, menu ul menu, menu ul ul,
+ol dir dl, ol dir menu, ol dir ul,
+ol menu dl, ol menu menu, ol menu ul,
+ol ol dl, ol ol menu, ol ol ul,
+ol ul dl, ol ul menu, ol ul ul,
+ul dir dl, ul dir menu, ul dir ul,
+ul menu dl, ul menu menu, ul menu ul,
+ul ol dl, ul ol menu, ul ol ul,
+ul ul dl, ul ul menu, ul ul ul {
+ list-style-type: square;
+}
+
+table { border-style: outset; }
+td, th { border-style: inset; }
+
+[dir=ltr] { direction: ltr; unicode-bidi: embed; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+[dir=rtl] { direction: rtl; unicode-bidi: embed; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+bdo[dir=ltr], bdo[dir=rtl] { unicode-bidi: bidi-override; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
+
+ <p>In addition, rules setting the 'quotes' property appropriately
+ for the locales and languages understood by the user are expected to
+ be present.</p>
+
+ <hr><p>The following rules are also expected to apply, as
+ <a href=#presentational-hints>presentational hints</a>:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+td[nowrap], th[nowrap] { white-space: nowrap; }
+pre[wrap] { white-space: pre-wrap; }
+
+br[clear=left] { clear: left; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+br[clear=right] { clear: right; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+br[clear=all], br[clear=both] { clear: both; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+
+ol[type=1], li[type=1] { list-style-type: decimal; }
+ol[type=a], li[type=a] { list-style-type: lower-alpha; } /* <a href=#case-sensitive-selector-exception>case-sensitive</a> */
+ol[type=A], li[type=A] { list-style-type: upper-alpha; } /* <a href=#case-sensitive-selector-exception>case-sensitive</a> */
+ol[type=i], li[type=i] { list-style-type: lower-roman; } /* <a href=#case-sensitive-selector-exception>case-sensitive</a> */
+ol[type=I], li[type=I] { list-style-type: upper-roman; } /* <a href=#case-sensitive-selector-exception>case-sensitive</a> */
+ul[type=disc], li[type=disc] { list-style-type: disc; }
+ul[type=circle], li[type=circle] { list-style-type: circle; }
+ul[type=square], li[type=square] { list-style-type: square; }
+
+table[rules=none], table[rules=groups], table[rules=rows],
+table[rules=cols], table[rules=all] {
+ border-style: none;
+ border-collapse: collapse;
+}
+
+table[frame=void] { border-style: hidden hidden hidden hidden; }
+table[frame=above] { border-style: solid hidden hidden hidden; }
+table[frame=below] { border-style: hidden hidden solid hidden; }
+table[frame=hsides] { border-style: solid hidden solid hidden; }
+table[frame=lhs] { border-style: hidden hidden hidden solid; }
+table[frame=rhs] { border-style: hidden solid hidden hidden; }
+table[frame=vsides] { border-style: hidden solid hidden solid; }
+table[frame=box],
+table[frame=border] { border-style: solid solid solid solid; }
+
+table[rules=none] &gt; tr &gt; td, table[rules=none] &gt; tr &gt; th,
+table[rules=none] &gt; thead &gt; tr &gt; td, table[rules=none] &gt; thead &gt; tr &gt; th,
+table[rules=none] &gt; tbody &gt; tr &gt; td, table[rules=none] &gt; tbody &gt; tr &gt; th,
+table[rules=none] &gt; tfoot &gt; tr &gt; td, table[rules=none] &gt; tfoot &gt; tr &gt; th,
+table[rules=groups] &gt; tr &gt; td, table[rules=groups] &gt; tr &gt; th,
+table[rules=groups] &gt; thead &gt; tr &gt; td, table[rules=groups] &gt; thead &gt; tr &gt; th,
+table[rules=groups] &gt; tbody &gt; tr &gt; td, table[rules=groups] &gt; tbody &gt; tr &gt; th,
+table[rules=groups] &gt; tfoot &gt; tr &gt; td, table[rules=groups] &gt; tfoot &gt; tr &gt; th,
+table[rules=rows] &gt; tr &gt; td, table[rules=rows] &gt; tr &gt; th,
+table[rules=rows] &gt; thead &gt; tr &gt; td, table[rules=rows] &gt; thead &gt; tr &gt; th,
+table[rules=rows] &gt; tbody &gt; tr &gt; td, table[rules=rows] &gt; tbody &gt; tr &gt; th,
+table[rules=rows] &gt; tfoot &gt; tr &gt; td, table[rules=rows] &gt; tfoot &gt; tr &gt; th {
+ border-style: none;
+}
+
+table[rules=groups] &gt; colgroup, table[rules=groups] &gt; thead,
+table[rules=groups] &gt; tbody, table[rules=groups] &gt; tfoot {
+ border-style: solid;
+}
+
+table[rules=rows] &gt; tr, table[rules=rows] &gt; thead &gt; tr,
+table[rules=rows] &gt; tbody &gt; tr, table[rules=rows] &gt; tfoot &gt; tr {
+ border-style: solid;
+}
+
+table[rules=cols] &gt; tr &gt; td, table[rules=cols] &gt; tr &gt; th,
+table[rules=cols] &gt; thead &gt; tr &gt; td, table[rules=cols] &gt; thead &gt; tr &gt; th,
+table[rules=cols] &gt; tbody &gt; tr &gt; td, table[rules=cols] &gt; tbody &gt; tr &gt; th,
+table[rules=cols] &gt; tfoot &gt; tr &gt; td, table[rules=cols] &gt; tfoot &gt; tr &gt; th {
+ border-style: none solid none solid;
+}
+
+table[rules=all] &gt; tr &gt; td, table[rules=all] &gt; tr &gt; th,
+table[rules=all] &gt; thead &gt; tr &gt; td, table[rules=all] &gt; thead &gt; tr &gt; th,
+table[rules=all] &gt; tbody &gt; tr &gt; td, table[rules=all] &gt; tbody &gt; tr &gt; th,
+table[rules=all] &gt; tfoot &gt; tr &gt; td, table[rules=all] &gt; tfoot &gt; tr &gt; th {
+ border-style: solid;
+}
+
+table[border] &gt; tr &gt; td, table[border] &gt; tr &gt; th,
+table[border] &gt; thead &gt; tr &gt; td, table[border] &gt; thead &gt; tr &gt; th,
+table[border] &gt; tbody &gt; tr &gt; td, table[border] &gt; tbody &gt; tr &gt; th,
+table[border] &gt; tfoot &gt; tr &gt; td, table[border] &gt; tfoot &gt; tr &gt; th {
+ border-width: 1px;
+}</pre>
+
+ <p>When rendering <code><a href=#the-li-element>li</a></code> elements, user agents are expected
+ to use the ordinal value of the <code><a href=#the-li-element>li</a></code> element to render
+ the counter in the list item marker.</p>
+
+ <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-border><a href=#attr-table-border>border</a></code> attribute <a href=#maps-to-the-pixel-length-property title="maps
+ to the pixel length property">maps to the pixel length
+ properties</a> 'border-top-width', 'border-right-width',
+ 'border-bottom-width', 'border-left-width' on the element. If the
+ attribute is present but parsing the attribute's value using the
+ <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> generates an
+ error, a default value of 1px is expected to be used for that
+ property instead.</p>
+
+ <p>The <code><a href=#the-wbr-element>wbr</a></code> element is expected to override the
+ 'white-space' property and always provide a line-breaking
+ opportunity.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=resetting-rules-for-inherited-properties><span class=secno>12.2.7 </span>Resetting rules for inherited properties</h4>
+
+ <p>The following rules are also expected to be in play, resetting
+ certain properties to block inheritance by default.</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+table, input, select, option, optgroup, button, textarea, keygen {
+ text-indent: initial;
+}</pre>
+
+ <!-- arguably, the form controls' 'text-indent' lines should be in
+ the sections below instead of here, but that would be far more
+ complicated than this -->
+
+ <p>In <a href=#quirks-mode>quirks mode</a>, the following rules are also
+ expected to apply:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+table {
+ font-weight: initial;
+ font-style: initial;
+ font-variant: initial;
+ font-size: initial;
+ line-height: initial;
+ white-space: initial;
+ text-align: initial;
+}
+
+input { box-sizing: border-box; }</pre>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-hr-element-0><span class=secno>12.2.8 </span>The <code><a href=#the-hr-element>hr</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+hr { color: gray; border-style: inset; border-width: 1px; margin: 0.5em auto; }</pre>
+
+ <p>The following rules are also expected to apply, as
+ <a href=#presentational-hints>presentational hints</a>:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+hr[align=left] { margin-left: 0; margin-right: auto; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+hr[align=right] { margin-left: auto; margin-right: 0; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+hr[align=center] { margin-left: auto; margin-right: auto; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+hr[color], hr[noshade] { border-style: solid; }</pre>
+
+ <p>If an <code><a href=#the-hr-element>hr</a></code> element has either a <code title=attr-hr-color><a href=#attr-hr-color>color</a></code> attribute or a <code title=attr-hr-noshade><a href=#attr-hr-noshade>noshade</a></code> attribute, and furthermore
+ also has a <code title=attr-hr-size><a href=#attr-hr-size>size</a></code> attribute, and
+ parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing
+ non-negative integers</a> doesn't generate an error, then the
+ user agent is expected to use the parsed value divided by two as a
+ pixel length for <a href=#presentational-hints>presentational hints</a> for the properties
+ 'border-top-width', 'border-right-width', 'border-bottom-width', and
+ 'border-left-width' on the element.</p>
+
+ <p>Otherwise, if an <code><a href=#the-hr-element>hr</a></code> element has neither a <code title=attr-hr-color><a href=#attr-hr-color>color</a></code> attribute nor a <code title=attr-hr-noshade><a href=#attr-hr-noshade>noshade</a></code> attribute, but does have a
+ <code title=attr-hr-size><a href=#attr-hr-size>size</a></code> attribute, and parsing that
+ attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a> doesn't generate an error, then: if the parsed value
+ is one, then the user agent is expected to use the attribute as a
+ <a href=#presentational-hints title="presentational hints">presentational hint</a>
+ setting the element's 'border-bottom-width' to 0; otherwise, if the
+ parsed value is greater than one, then the user agent is expected to
+ use the parsed value minus two as a pixel length for
+ <a href=#presentational-hints>presentational hints</a> for the 'height' property on the
+ element.</p>
+
+ <p>The <code title=attr-hr-width><a href=#attr-hr-width>width</a></code> attribute on an
+ <code><a href=#the-hr-element>hr</a></code> element <a href=#maps-to-the-dimension-property>maps to the dimension property</a>
+ 'width' on the element.</p>
+
+ <p>When an <code><a href=#the-hr-element>hr</a></code> element has a <code title=attr-hr-color><a href=#attr-hr-color>color</a></code> attribute, its value is expected
+ to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy color
+ value</a>, and if that does not return an error, the user agent
+ is expected to treat the attribute as a <a href=#presentational-hints title="presentational
+ hints">presentational hint</a> setting the element's 'color'
+ property to the resulting color.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-fieldset-element-0><span class=secno>12.2.9 </span>The <code><a href=#the-fieldset-element>fieldset</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+fieldset {
+ margin-left: 2px; margin-right: 2px;
+ border: groove 2px ThreeDFace;
+ padding: 0.35em 0.625em 0.75em;
+}</pre>
+
+ <p>The <code><a href=#the-fieldset-element>fieldset</a></code> element is expected to establish a new
+ block formatting context.</p>
+
+ <p>The first <code><a href=#the-legend-element>legend</a></code> element child of a
+ <code><a href=#the-fieldset-element>fieldset</a></code> element, if any, is expected to be rendered
+ over the top border edge of the <code><a href=#the-fieldset-element>fieldset</a></code> element. If
+ the <code><a href=#the-legend-element>legend</a></code> element in question has an <code title=attr-legend-align><a href=#attr-legend-align>align</a></code> attribute, and its value is
+ an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the strings
+ in the first column of the following table, then the
+ <code><a href=#the-legend-element>legend</a></code> is expected to be rendered horizontally aligned
+ over the border edge in the position given in the corresponding cell
+ on the same row in the second column. If the attribute is absent or
+ has a value that doesn't match any of the cases in the table, then
+ the position is expected to be on the right if the 'direction'
+ property on this element has a computed value of 'rtl', and on the
+ left otherwise.</p>
+
+ <table><thead><tr><th>Attribute value
+ <th>Alignment position
+ <tbody><tr><td><code title="">left</code>
+ <td>On the left
+ <tr><td><code title="">right</code>
+ <td>On the right
+ <tr><td><code title="">center</code>
+ <td>In the middle
+ </table></div>
+
+
+ <div class=impl>
+
+ <h3 id=replaced-elements><span class=secno>12.3 </span>Replaced elements</h3>
+
+ <h4 id=embedded-content-2><span class=secno>12.3.1 </span>Embedded content</h4>
+
+ <p>The <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, and
+ <code><a href=#video>video</a></code> elements are expected to be treated as replaced
+ elements.</p>
+
+ <p>A <code><a href=#the-canvas-element>canvas</a></code> element that <a href=#represents>represents</a>
+ <a href=#embedded-content>embedded content</a> is expected to be treated as a
+ replaced element. Other <code><a href=#the-canvas-element>canvas</a></code> elements are expected to
+ be treated as ordinary elements in the rendering model.</p>
+
+ <p>An <code><a href=#the-object-element>object</a></code> element that <a href=#represents>represents</a> an
+ image, plugin, or <a href=#nested-browsing-context>nested browsing context</a> is expected
+ to be treated as a replaced element. Other <code><a href=#the-object-element>object</a></code>
+ elements are expected to be treated as ordinary elements in the
+ rendering model.</p>
+
+ <p>An <code><a href=#the-applet-element>applet</a></code> element that <a href=#represents>represents</a> a
+ <a href=#plugin>plugin</a> is expected to be treated as a replaced
+ element. Other <code><a href=#the-applet-element>applet</a></code> elements are expected to be
+ treated as ordinary elements in the rendering model.</p>
+
+ <p>The <code><a href=#audio>audio</a></code> element, when it is <a href=#expose-a-user-interface-to-the-user title="expose a
+ user interface to the user">exposing a user interface</a>, is
+ expected to be treated as a replaced element about one line high, as
+ wide as is necessary to expose the user agent's user interface
+ features. When an <code><a href=#audio>audio</a></code> element is not <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the user">exposing a user
+ interface</a>, the user agent is expected to hide it,
+ irrespective of CSS rules.</p>
+
+ <p>Whether a <code><a href=#video>video</a></code> element is <a href=#expose-a-user-interface-to-the-user title="expose a
+ user interface to the user">exposing a user interface</a> is not
+ expected to affect the size of the rendering; controls are expected
+ to be overlaid with the page content without causing any layout
+ changes, and are expected to disappear when the user does not need
+ them.</p>
+
+ <p>When a <code><a href=#video>video</a></code> element represents a poster frame or
+ frame of video, the poster frame or frame of video is expected to be
+ rendered at the largest size that maintains the aspect ratio of that
+ poster frame or frame of video without being taller or wider than
+ the <code><a href=#video>video</a></code> element itself, and is expected to be
+ centered in the <code><a href=#video>video</a></code> element.</p>
+
+ <p class=XXX>pointer to rendering model for timed tracks</p>
+
+ <p class=note>Resizing <code><a href=#video>video</a></code> and <code><a href=#the-canvas-element>canvas</a></code>
+ elements does not interrupt video playback or clear the canvas.</p>
+
+ <hr><p>The following CSS rules are expected to apply:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+iframe { border: 2px inset; }</pre>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=timed-tracks-0><span class=secno>12.3.2 </span>Timed tracks</h4>
+
+ <p class=XXX>rendering model for timed tracks</p>
+
+ <p class=XXX>CSS extensions</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=images-0><span class=secno>12.3.3 </span>Images</h4>
+
+ <p>When an <code><a href=#the-img-element>img</a></code> element or an <code><a href=#the-input-element>input</a></code> element
+ when its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
+ the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state
+ <a href=#represents>represents</a> an image, it is expected to be treated as a
+ replaced element.</p>
+
+ <p>When an <code><a href=#the-img-element>img</a></code> element or an <code><a href=#the-input-element>input</a></code> element
+ when its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
+ the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state
+ does not <a href=#represents title=represents>represent</a> an image, but the
+ element already has intrinsic dimensions (e.g. from the
+ <a href=#dimension-attributes>dimension attributes</a> or CSS rules), and either the user
+ agent has reason to believe that the image will become <i title=img-available><a href=#img-available>available</a></i><!--input-img-available also-->
+ and be rendered in due course or the <code><a href=#document>Document</a></code> is in
+ <a href=#quirks-mode>quirks mode</a>, the element is expected to be treated as a
+ replaced element whose content is the text that the element
+ represents, if any, optionally alongside an icon indicating that the
+ image is being obtained. For <code><a href=#the-input-element>input</a></code> elements, the text
+ is expected to appear button-like to indicate that the element is a
+ <a href=#concept-button title=concept-button>button</a>.</p>
+
+ <p>When an <code><a href=#the-img-element>img</a></code> element <a href=#represents>represents</a> some
+ text and the user agent does not expect this to change, the element
+ is expected to be treated as an inline element whose content is the
+ text, optionally with an icon indicating that an image is
+ missing.</p>
+
+ <p>When an <code><a href=#the-img-element>img</a></code> element <a href=#represents>represents</a> nothing
+ and the user agent does not expect this to change, the element is
+ expected to not be rendered at all.</p>
+
+ <p>When an <code><a href=#the-img-element>img</a></code> element might be a key part of the
+ content, but neither the image nor any kind of alternative text is
+ available, and the user agent does not expect this to change, the
+ element is expected to be treated as an inline element whose content
+ is an icon indicating that an image is missing.</p> <!-- there's
+ also a should requirement for this case in the <img> section itself
+ -->
+
+ <p>When an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state does not
+ <a href=#represents title=represents>represent</a> an image and the user
+ agent does not expect this to change, the element is expected to be
+ treated as a replaced element consisting of a button whose content
+ is the element's alternative text. The intrinsic dimensions of the
+ button are expected to be about one line in height and whatever
+ width is necessary to render the text on one line.</p>
+
+ <p>The icons mentioned above are expected to be relatively small so
+ as not to disrupt most text but be easily clickable. In a visual
+ environment, for instance, icons could be 16 pixels by 16 pixels
+ square, or 1em by 1em if the images are scalable. In an audio
+ environment, the icon could be a short bleep. The icons are intended
+ to indicate to the user that they can be used to get to whatever
+ options the UA provides for images, and, where appropriate, are
+ expected to provide access to the context menu that would have come
+ up if the user interacted with the actual image.</p>
+
+ <hr><p>The following CSS rules are expected to apply when the
+ <code><a href=#document>Document</a></code> is in <a href=#quirks-mode>quirks mode</a>:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+img[align=left] { margin-right: 3px; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+img[align=right] { margin-left: 3px; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=attributes-for-embedded-content-and-images><span class=secno>12.3.4 </span>Attributes for embedded content and images</h4>
+
+ <p>The following CSS rules are expected to apply as
+ <a href=#presentational-hints>presentational hints</a>:</p>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+iframe[frameborder=0], iframe[frameborder=no] { border: none; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+
+applet[align=left], embed[align=left], iframe[align=left],
+img[align=left], input[type=image][align=left], object[align=left] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ float: left;
+}
+
+applet[align=right], embed[align=right], iframe[align=right],
+img[align=right], input[type=image][align=right], object[align=right] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ float: right;
+}
+
+applet[align=top], embed[align=top], iframe[align=top],
+img[align=top], input[type=image][align=top], object[align=top] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: top;
+}
+
+applet[align=bottom], embed[align=bottom], iframe[align=bottom],
+img[align=bottom], input[type=image][align=bottom], object[align=bottom],
+applet[align=baseline], embed[align=baseline], iframe[align=baseline],
+img[align=baseline], input[type=image][align=baseline], object[align=baseline] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: baseline;
+}
+
+applet[align=texttop], embed[align=texttop], iframe[align=texttop],
+img[align=texttop], input[type=image][align=texttop], object[align=texttop] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: text-top;
+}
+
+applet[align=absmiddle], embed[align=absmiddle], iframe[align=absmiddle],
+img[align=absmiddle], input[type=image][align=absmiddle], object[align=absmiddle],
+applet[align=abscenter], embed[align=abscenter], iframe[align=abscenter],
+img[align=abscenter], input[type=image][align=abscenter], object[align=abscenter] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: middle;
+}
+
+applet[align=bottom], embed[align=bottom], iframe[align=bottom],
+img[align=bottom], input[type=image][align=bottom],
+object[align=bottom] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ vertical-align: bottom;
+}</pre>
+
+ <p>When an <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code>
+ element, or an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, has an
+ <code title=attr-dim-align>align</code> attribute whose value is
+ an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">center</code>" or the string "<code title="">middle</code>", the user agent is expected to act as if the
+ element's 'vertical-align' property was set to a value that aligns
+ the vertical middle of the element with the parent element's
+ baseline.</p>
+
+ <p>The <code title=attr-dim-hspace>hspace</code> attribute of
+ <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
+ <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> elements, and
+ <code><a href=#the-input-element>input</a></code> elements with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, <a href=#maps-to-the-dimension-property title="maps to the dimension property">maps to the dimension
+ properties</a> 'margin-left' and 'margin-right' on the
+ element.</p>
+
+ <p>The <code title=attr-dim-vspace>vspace</code> attribute of
+ <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
+ <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> elements, and
+ <code><a href=#the-input-element>input</a></code> elements with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, <a href=#maps-to-the-dimension-property title="maps to the dimension property">maps to the dimension
+ properties</a> 'margin-top' and 'margin-bottom' on the
+ element.</p>
+
+ <p>When an <code><a href=#the-img-element>img</a></code> element, <code><a href=#the-object-element>object</a></code> element, or
+ <code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state is contained
+ within a <a href=#hyperlink>hyperlink</a> and has a <code title=attr-dim-border>border</code> attribute whose value, when
+ parsed using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a>, is found to be a number greater than zero, the user
+ agent is expected to use the parsed value for eight
+ <a href=#presentational-hints>presentational hints</a>: four setting the parsed value as
+ a pixel length for the element's 'border-top-width',
+ 'border-right-width', 'border-bottom-width', and 'border-left-width'
+ properties, and four setting the element's 'border-top-style',
+ 'border-right-style', 'border-bottom-style', and 'border-left-style'
+ properties to the value 'solid'.</p>
+
+ <p id=dimRendering>The <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>
+ and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes on
+ <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
+ <code><a href=#the-img-element>img</a></code>, <code><a href=#the-object-element>object</a></code> or <code><a href=#video>video</a></code>
+ elements, and <code><a href=#the-input-element>input</a></code> elements with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, <a href=#maps-to-the-dimension-property title="maps to the dimension property">map to the dimension
+ properties</a> 'width' and 'height' on the element
+ respectively.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=image-maps-0><span class=secno>12.3.5 </span>Image maps</h4>
+
+ <p>Shapes on an <a href=#image-map>image map</a> are expected to act, for the
+ purpose of the CSS cascade, as elements independent of the original
+ <code><a href=#the-area-element>area</a></code> element that happen to match the same style rules
+ but inherit from the <code><a href=#the-img-element>img</a></code> or <code><a href=#the-object-element>object</a></code>
+ element.</p>
+
+ <p>For the purposes of the rendering, only the 'cursor' property is
+ expected to have any effect on the shape.</p>
+
+ <p class=example>Thus, for example, if an <code><a href=#the-area-element>area</a></code>
+ element has a <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute that
+ sets the 'cursor' property to 'help', then when the user designates
+ that shape, the cursor would change to a Help cursor.</p>
+
+ <p class=example>Similarly, if an <code><a href=#the-area-element>area</a></code> element had a
+ CSS rule that set its 'cursor' property to 'inherit' (or if no rule
+ setting the 'cursor' property matched the element at all), the
+ shape's cursor would be inherited from the <code><a href=#the-img-element>img</a></code> or
+ <code><a href=#the-object-element>object</a></code> element of the <a href=#image-map>image map</a>, not from
+ the parent of the <code><a href=#the-area-element>area</a></code> element.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=toolbars-0><span class=secno>12.3.6 </span>Toolbars</h4>
+
+ <p>When a <code><a href=#menus>menu</a></code> element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state, the element is
+ expected to be treated as a replaced element with a height about two
+ lines high and a width derived from the contents of the element.</p>
+
+ <p>The element is expected to have, by default, the appearance of a
+ toolbar on the user agent's platform. It is expected to contain the
+ menu that is <a href=#building-menus-and-toolbars title="building menus and toolbars">built</a>
+ from the element.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h3 id=bindings><span class=secno>12.4 </span>Bindings</h3>
+
+ <h4 id=introduction-10><span class=secno>12.4.1 </span>Introduction</h4>
+
+ <p>A number of elements have their rendering defined in terms of the
+ 'binding' property. <a href=#refsBECSS>[BECSS]</a></p>
+
+ <p>The CSS snippets below set the 'binding' property to a
+ user-agent-defined value, represented below by keywords like <code title=""><i title="">button</i></code>. The rules then described for
+ these bindings are only expected to apply if the element's 'binding'
+ property has not been overridden (e.g. by the author) to have
+ another value.</p>
+
+ <p>Exactly how the bindings are implemented is not specified by this
+ specification. User agents are encouraged to make their bindings set
+ the 'appearance' CSS property appropriately to achieve
+ platform-native appearances for widgets, and are expected to
+ implement any relevant animations, etc, that are appropriate for the
+ platform. <a href=#refsCSSUI>[CSSUI]</a></p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-button-element-0><span class=secno>12.4.2 </span>The <code><a href=#the-button-element>button</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+button { binding: <i title="">button</i>; }</pre>
+
+ <p>When the <i title="">button</i> binding applies to a
+ <code><a href=#the-button-element>button</a></code> element, the element is expected to render as an
+ 'inline-block' box rendered as a button whose contents are the
+ contents of the element.</p>
+
+ </div>
+
+
+<!--v2DATAGRID
+ <div class="impl">
+
+ <h4>The <code>datagrid</code> element</h4>
+
+ This section will probably include details on how to render DATAGRID
+ (including <span id="datagridPseudos">its pseudo-elements</span>),
+ drag-and-drop, etc, in a visual medium, in concert with
+ CSS. Implementation experience is desired before this section is
+ filled in.
+
+ </div>
+-->
+
+ <div class=impl>
+
+ <h4 id=the-details-element-0><span class=secno>12.4.3 </span>The <code><a href=#the-details-element>details</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+details { binding: <i title="">details</i>; }</pre>
+
+ <p>When the <i title="">details</i> binding applies to a
+ <code><a href=#the-details-element>details</a></code> element, the element is expected to render as a
+ 'block' box with its 'padding-left' property set to '40px' for
+ left-to-right elements (<a href=#ltr-specific>LTR-specific</a>) and with its
+ 'padding-right' property set to '40px' for right-to-left
+ elements. The element's shadow tree is expected to take the
+ element's first child <code><a href=#the-summary-element>summary</a></code> element, if any, and
+ place it in a first 'block' box container, and then take the
+ element's remaining descendants, if any, and place them in a second
+ 'block' box container.</p>
+
+ <p>The first container is expected to contain at least one line box,
+ and that line box is expected to contain a disclosure widget
+ (typically a triangle), horizontally positioned within the left
+ padding of the <code><a href=#the-details-element>details</a></code> element. That widget is expected
+ to allow the user to request that the details be shown or
+ hidden.</p>
+
+ <p>The second container is expected to have its 'overflow' property
+ set to 'hidden'. When the <code><a href=#the-details-element>details</a></code> element does not have
+ an <code title=attr-details-open><a href=#attr-details-open>open</a></code> attribute, this
+ second container is expected to be removed from the rendering.</p>
+
+ <!-- http://mail.gnome.org/archives/usability/2006-June/msg00015.html -->
+
+ </div>
+
+ <div class=impl>
+
+ <h4 id=the-input-element-as-a-text-entry-widget><span class=secno>12.4.4 </span>The <code><a href=#the-input-element>input</a></code> element as a text entry widget</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+input { binding: <i title="">input-textfield</i>; }
+input[type=password] { binding: <i title="">input-password</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+/* later rules override this for other values of type="" */</pre>
+
+ <p>When the <i title="">input-textfield</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a>, <a href=#text-state-and-search-state title=attr-input-type-search>Search</a>, <a href=#telephone-state title=attr-input-type-tel>Telephone</a>, <a href=#url-state title=attr-input-type-url>URL</a>, or <a href=#e-mail-state title=attr-input-type-email>E-mail</a> state, the element is
+ expected to render as an 'inline-block' box rendered as a text
+ field.</p>
+
+ <p>When the <i title="">input-password</i> binding applies, to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#password-state title=attr-input-type-password>Password</a> state, the element
+ is expected to render as an 'inline-block' box rendered as a text
+ field whose contents are obscured.</p>
+
+ <p>If an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the above
+ states has a <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute,
+ and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing
+ non-negative integers</a> doesn't generate an error, then the
+ user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
+ 'width' property on the element, with the value obtained from
+ applying the <a href=#converting-a-character-width-to-pixels>converting a character width to pixels</a>
+ algorithm to the value of the attribute.</p>
+
+ <p>If an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the above
+ states does <em>not</em> have a <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute, then the user agent
+ is expected to act as if it had a user-agent-level style sheet rule
+ setting the 'width' property on the element to the value obtained
+ from applying the <a href=#converting-a-character-width-to-pixels>converting a character width to
+ pixels</a> algorithm to the number 20.</p>
+
+ <p>The <dfn id=converting-a-character-width-to-pixels>converting a character width to pixels</dfn> algorithm
+ returns <span title="">(<var title="">size</var>-1)&times;<var title="">avg</var>&nbsp;+&nbsp;<var title="">max</var></span>, where
+ <var title="">size</var> is the character width to convert, <var title="">avg</var> is the average character width of the primary
+ font for the element for which the algorithm is being run, in
+ pixels, and <var title="">max</var> is the maximum character width
+ of that same font, also in pixels. (The element's 'letter-spacing'
+ property does not affect the result.)</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-input-element-as-domain-specific-widgets><span class=secno>12.4.5 </span>The <code><a href=#the-input-element>input</a></code> element as domain-specific widgets</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+input[type=datetime] { binding: <i title="">input-datetime</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+input[type=date] { binding: <i title="">input-date</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+input[type=month] { binding: <i title="">input-month</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+input[type=week] { binding: <i title="">input-week</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+input[type=time] { binding: <i title="">input-time</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+input[type=datetime-local] { binding: <i title="">input-datetime-local</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+input[type=number] { binding: <i title="">input-number</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
+
+ <p>When the <i title="">input-datetime</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#date-and-time-state title=attr-input-type-datetime>Date and Time</a> state, the
+ element is expected to render as an 'inline-block' box depicting a
+ Date and Time control.</p>
+
+ <p>When the <i title="">input-date</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#date-state title=attr-input-type-date>Date</a> state, the element is
+ expected to render as an 'inline-block' box depicting a Date
+ control.</p>
+
+ <p>When the <i title="">input-month</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#month-state title=attr-input-type-month>Month</a> state, the element is
+ expected to render as an 'inline-block' box depicting a Month
+ control.</p>
+
+ <p>When the <i title="">input-week</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#week-state title=attr-input-type-week>Week</a> state, the element is
+ expected to render as an 'inline-block' box depicting a Week
+ control.</p>
+
+ <p>When the <i title="">input-time</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#time-state title=attr-input-type-time>Time</a> state, the element is
+ expected to render as an 'inline-block' box depicting a Time
+ control.</p>
+
+ <p>When the <i title="">input-datetime-local</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#local-date-and-time-state title=attr-input-type-datetime-local>Local Date and Time</a>
+ state, the element is expected to render as an 'inline-block' box
+ depicting a Local Date and Time control.</p>
+
+ <p>When the <i title="">input-number</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#number-state title=attr-input-type-number>Number</a> state, the element is
+ expected to render as an 'inline-block' box depicting a Number
+ control.</p>
+
+ <p>These controls are all expected to be about one line high, and
+ about as wide as necessary to show the widest possible value.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-input-element-as-a-range-control><span class=secno>12.4.6 </span>The <code><a href=#the-input-element>input</a></code> element as a range control</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+input[type=range] { binding: <i title="">input-range</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
+
+ <p>When the <i title="">input-range</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#range-state title=attr-input-type-range>Range</a> state, the element is
+ expected to render as an 'inline-block' box depicting a slider
+ control.</p>
+
+ <p>When the control is wider than it is tall (or square), the
+ control is expected to be a horizontal slider, with the lowest value
+ on the right if the 'direction' property on this element has a
+ computed value of 'rtl', and on the left otherwise. When the control
+ is taller than it is wide, it is expected to be a vertical slider,
+ with the lowest value on the bottom.</p>
+
+ <p>Predefined suggested values (provided by the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute) are expected to be
+ shown as tick marks on the slider, which the slider can snap to.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-input-element-as-a-color-well><span class=secno>12.4.7 </span>The <code><a href=#the-input-element>input</a></code> element as a color well</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+input[type=color] { binding: <i title="">input-color</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
+
+ <p>When the <i title="">input-color</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#color-state title=attr-input-type-color>Color</a> state, the element is
+ expected to render as an 'inline-block' box depicting a color well,
+ which, when activated, provides the user with a color picker (e.g. a
+ color wheel or color palette) from which the color can be
+ changed.</p>
+
+ <p>Predefined suggested values (provided by the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute) are expected to be
+ shown in the color picker interface, not on the color well
+ itself.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-input-element-as-a-check-box-and-radio-button-widgets><span class=secno>12.4.8 </span>The <code><a href=#the-input-element>input</a></code> element as a check box and radio button widgets</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+input[type=checkbox] { binding: <i title="">input-checkbox</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+input[type=radio] { binding: <i title="">input-radio</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
+
+ <p>When the <i title="">input-checkbox</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a> state, the element
+ is expected to render as an 'inline-block' box containing a single
+ check box control, with no label.</p>
+
+ <p>When the <i title="">input-radio</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a> state, the element
+ is expected to render as an 'inline-block' box containing a single
+ radio button control, with no label.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-input-element-as-a-file-upload-control><span class=secno>12.4.9 </span>The <code><a href=#the-input-element>input</a></code> element as a file upload control</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+input[type=file] { binding: <i title="">input-file</i>; } /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */</pre>
+
+ <p>When the <i title="">input-file</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state, the element
+ is expected to render as an 'inline-block' box containing a span of
+ text giving the filename(s) of the <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>, if
+ any, followed by a button that, when activated, provides the user
+ with a file picker from which the selection can be changed.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-input-element-as-a-button><span class=secno>12.4.10 </span>The <code><a href=#the-input-element>input</a></code> element as a button</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+input[type=submit], input[type=reset], input[type=button] { /* <a href=#case-insensitive-selector-exception>case-insensitive</a> */
+ binding: <i title="">input-button</i>;
+}</pre>
+
+ <p>When the <i title="">input-button</i> binding applies to an
+ <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a>, <a href=#reset-button-state title=attr-input-type-reset>Reset Button</a>, or <a href=#button-state title=attr-input-type-button>Button</a> state, the element is
+ expected to render as an 'inline-block' box rendered as a button,
+ about one line high, containing the contents of the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if any, or text
+ derived from the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
+ attribute in a user-agent-defined (and probably locale-specific)
+ fashion, if not.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-marquee-element-0><span class=secno>12.4.11 </span>The <code><a href=#the-marquee-element>marquee</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+marquee {
+ binding: <i title="">marquee</i>;
+}</pre>
+
+ <p>When the <i title="">marquee</i> binding applies to a
+ <code><a href=#the-marquee-element>marquee</a></code> element, while the element is <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>, the element is expected
+ to render in an animated fashion according to its attributes as
+ follows:</p>
+
+ <dl><dt>If the element's <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
+ <a href=#attr-marquee-behavior-scroll title=attr-marquee-behavior-scroll>scroll</a> state</dt>
+
+ <dd>
+
+ <p>Slide the contents of the element in the direction described by
+ the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code>
+ attribute as defined below, such that it begins off the start side
+ of the <code><a href=#the-marquee-element>marquee</a></code>, and ends flush with the inner end
+ side.</p>
+
+ <p class=example>For example, if the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute is <a href=#attr-marquee-direction-left title=attr-marquee-direction-left>left</a> (the default),
+ then the contents would start such that their left edge are off
+ the side of the right edge of the <code><a href=#the-marquee-element>marquee</a></code>'s content
+ area, and the contents would then slide up to the point where the
+ left edge of the contents are flush with the left inner edge of
+ the <code><a href=#the-marquee-element>marquee</a></code>'s content area.</p>
+
+ <p>Once the animation has ended, the user agent is expected to
+ <a href=#increment-the-marquee-current-loop-index>increment the marquee current loop index</a>. If the
+ element is still <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>
+ after this, then the user agent is expected to restart the
+ animation.</p>
+
+ </dd>
+
+ <dt>If the element's <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
+ <a href=#attr-marquee-behavior-slide title=attr-marquee-behavior-slide>slide</a> state</dt>
+
+ <dd>
+
+ <p>Slide the contents of the element in the direction described by
+ the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code>
+ attribute as defined below, such that it begins off the start side
+ of the <code><a href=#the-marquee-element>marquee</a></code>, and ends off the end side of the
+ <code><a href=#the-marquee-element>marquee</a></code>.</p>
+
+ <p class=example>For example, if the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute is <a href=#attr-marquee-direction-left title=attr-marquee-direction-left>left</a> (the default),
+ then the contents would start such that their left edge are off
+ the side of the right edge of the <code><a href=#the-marquee-element>marquee</a></code>'s content
+ area, and the contents would then slide up to the point where the
+ <em>right</em> edge of the contents are flush with the left inner
+ edge of the <code><a href=#the-marquee-element>marquee</a></code>'s content area.</p>
+
+ <p>Once the animation has ended, the user agent is expected to
+ <a href=#increment-the-marquee-current-loop-index>increment the marquee current loop index</a>. If the
+ element is still <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>
+ after this, then the user agent is expected to restart the
+ animation.</p>
+
+ </dd>
+
+ <dt>If the element's <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
+ <a href=#attr-marquee-behavior-alternate title=attr-marquee-behavior-alternate>alternate</a>
+ state</dt>
+
+ <dd>
+
+ <p>When the <a href=#marquee-current-loop-index>marquee current loop index</a> is even (or
+ zero), slide the contents of the element in the direction
+ described by the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute as
+ defined below, such that it begins flush with the start side of
+ the <code><a href=#the-marquee-element>marquee</a></code>, and ends flush with the end side of the
+ <code><a href=#the-marquee-element>marquee</a></code>.</p>
+
+ <p>When the <a href=#marquee-current-loop-index>marquee current loop index</a> is odd, slide
+ the contents of the element in the opposite direction than that
+ described by the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute as
+ defined below, such that it begins flush with the end side of the
+ <code><a href=#the-marquee-element>marquee</a></code>, and ends flush with the start side of the
+ <code><a href=#the-marquee-element>marquee</a></code>.</p>
+
+ <p class=example>For example, if the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute is <a href=#attr-marquee-direction-left title=attr-marquee-direction-left>left</a> (the default),
+ then the contents would with their right edge flush with the right
+ inner edge of the <code><a href=#the-marquee-element>marquee</a></code>'s content area, and the
+ contents would then slide up to the point where the <em>left</em>
+ edge of the contents are flush with the left inner edge of the
+ <code><a href=#the-marquee-element>marquee</a></code>'s content area.</p>
+
+ <p>Once the animation has ended, the user agent is expected to
+ <a href=#increment-the-marquee-current-loop-index>increment the marquee current loop index</a>. If the
+ element is still <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>
+ after this, then the user agent is expected to continue the
+ animation.</p>
+
+ </dd>
+
+ </dl><p>The <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code>
+ attribute has the meanings described in the following table:</p>
+
+ <table><thead><tr><th><code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute state
+ <th>Direction of animation
+ <th>Start edge
+ <th>End edge
+ <th>Opposite direction
+ <tbody><tr><td><a href=#attr-marquee-direction-left title=attr-marquee-direction-left>left</a>
+ <td>&larr; Right to left
+ <td>Right
+ <td>Left
+ <td>&rarr; Left to Right
+ <tr><td><a href=#attr-marquee-direction-right title=attr-marquee-direction-right>right</a>
+ <td>&rarr; Left to Right
+ <td>Left
+ <td>Right
+ <td>&larr; Right to left
+ <tr><td><a href=#attr-marquee-direction-up title=attr-marquee-direction-up>up</a>
+ <td>&uarr; Up (Bottom to Top)
+ <td>Bottom
+ <td>Top
+ <td>&darr; Down (Top to Bottom)
+ <tr><td><a href=#attr-marquee-direction-down title=attr-marquee-direction-down>down</a>
+ <td>&darr; Down (Top to Bottom)
+ <td>Top
+ <td>Bottom
+ <td>&uarr; Up (Bottom to Top)
+ </table><p>In any case, the animation should proceed such that there is a
+ delay given by the <a href=#marquee-scroll-interval>marquee scroll interval</a> between each
+ frame, and such that the content moves at most the distance given by
+ the <a href=#marquee-scroll-distance>marquee scroll distance</a> with each frame.</p>
+
+ <p>When a <code><a href=#the-marquee-element>marquee</a></code> element has a <code title=attr-marquee-bgcolor>bgcolor</code> attribute set, the value
+ is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy
+ color value</a>, and if that does not return an error, the user
+ agent is expected to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
+ element's 'background-color' property to the resulting color.</p>
+
+ <p>The <code title=attr-marquee-width>width</code> and <code title=attr-marquee-height>height</code> attributes on a
+ <code><a href=#the-marquee-element>marquee</a></code> element <a href=#maps-to-the-dimension-property title="maps to the dimension
+ property">map to the dimension properties</a> 'width' and
+ 'height' on the element respectively.</p>
+
+ <p>The intrinsic height of a <code><a href=#the-marquee-element>marquee</a></code> element with its
+ <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute in
+ the <a href=#attr-marquee-direction-up title=attr-marquee-direction-up>up</a> or <a href=#attr-marquee-direction-down title=attr-marquee-direction-down>down</a> states is 200 CSS
+ pixels.</p>
+
+ <p>The <code title=attr-marquee-vspace>vspace</code> attribute of
+ a <code><a href=#the-marquee-element>marquee</a></code> element <a href=#maps-to-the-dimension-property title="maps to the dimension
+ property">maps to the dimension properties</a> 'margin-top' and
+ 'margin-bottom' on the element. The <code title=attr-marquee-hspace>hspace</code> attribute of a
+ <code><a href=#the-marquee-element>marquee</a></code> element <a href=#maps-to-the-dimension-property title="maps to the dimension
+ property">maps to the dimension properties</a> 'margin-left' and
+ 'margin-right' on the element.</p>
+
+ <p>The 'overflow' property on the <code><a href=#the-marquee-element>marquee</a></code> element is
+ expected to be ignored; overflow is expected to always be
+ hidden.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-meter-element-0><span class=secno>12.4.12 </span>The <code><a href=#the-meter-element>meter</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+meter {
+ binding: <i title="">meter</i>;
+}</pre>
+
+ <p>When the <i title="">meter</i> binding applies to a
+ <code><a href=#the-meter-element>meter</a></code> element, the element is expected to render as an
+ 'inline-block' box with a 'height' of '1em' and a 'width' of '5em',
+ a 'vertical-align' of '-0.2em', and with its contents depicting a
+ gauge.</p>
+
+ <p>When the element is wider than it is tall (or square), the
+ depiction is expected to be of a horizontal gauge, with the minimum
+ value on the right if the 'direction' property on this element has a
+ computed value of 'rtl', and on the left otherwise. When the element
+ is taller than it is wide, it is expected to depict a vertical
+ gauge, with the minimum value on the bottom.</p>
+
+ <p>User agents are expected to use a presentation consistent with
+ platform conventions for gauges, if any.</p>
+
+ <p class=note>Requirements for what must be depicted in the gauge
+ are included in the definition of the <code><a href=#the-meter-element>meter</a></code>
+ element.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-progress-element-0><span class=secno>12.4.13 </span>The <code><a href=#the-progress-element>progress</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+progress {
+ binding: <i title="">progress</i>;
+}</pre>
+
+ <p>When the <i title="">progress</i> binding applies to a
+ <code><a href=#the-progress-element>progress</a></code> element, the element is expected to render as
+ an 'inline-block' box with a 'height' of '1em' and a 'width' of
+ '10em', a 'vertical-align' of '-0.2em', and with its contents
+ depicting a horizontal progress bar, with the start on the right and
+ the end on the left if the 'direction' property on this element has
+ a computed value of 'rtl', and with the start on the left and the
+ end on the right otherwise.</p>
+
+ <p>User agents are expected to use a presentation consistent with
+ platform conventions for progress bars. In particular, user agents
+ are expected to use different presentations for determinate and
+ indeterminate progress bars. User agents are also expected to vary
+ the presentation based on the dimensions of the element.</p>
+
+ <p class=example>For example, on some platforms for showing
+ indeterminate progress there is an asynchronous progress indicator
+ with square dimensions, which could be used when the element is
+ square, and an indeterminate progress bar, which could be used when
+ the element is wide.</p>
+
+ <p class=note>Requirements for how to determine if the progress
+ bar is determinate or indeterminate, and what progress a determinate
+ progress bar is to show, are included in the definition of the
+ <code><a href=#the-progress-element>progress</a></code> element.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-select-element-0><span class=secno>12.4.14 </span>The <code><a href=#the-select-element>select</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+select {
+ binding: <i title="">select</i>;
+}</pre>
+
+ <p>When the <i title="">select</i> binding applies to a
+ <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is present,
+ the element is expected to render as a multi-select list box.</p>
+
+ <p>When the <i title="">select</i> binding applies to a
+ <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent,
+ and the element's <a href=#concept-select-size title=concept-select-size>display
+ size</a> is greater than 1, the element is expected to render as
+ a single-select list box.</p>
+
+ <p>When the element renders as a list box, it is expected to render
+ as an 'inline-block' box whose 'height' is the height necessary to
+ contain as many rows for items as given by the element's <a href=#concept-select-size title=concept-select-size>display size</a>, or four rows if the
+ attribute is absent, and whose 'width' is the <a href="#width-of-the-select's-labels">width of the
+ <code>select</code>'s labels</a> plus the width of a
+ scrollbar.</p>
+
+ <p>When the <i title="">select</i> binding applies to a
+ <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent,
+ and the element's <a href=#concept-select-size title=concept-select-size>display
+ size</a> is 1, the element is expected to render as a one-line
+ drop down box whose width is the <a href="#width-of-the-select's-labels">width of the
+ <code>select</code>'s labels</a>.</p>
+
+ <p>In either case (list box or drop-down box), the element's items
+ are expected to be the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, with the
+ element's <code><a href=#the-optgroup-element>optgroup</a></code> element children providing headers
+ for groups of options where applicable.</p>
+
+ <p>The <dfn id="width-of-the-select's-labels">width of the <code>select</code>'s labels</dfn> is the
+ wider of the width necessary to render the widest
+ <code><a href=#the-optgroup-element>optgroup</a></code>, and the width necessary to render the widest
+ <code><a href=#the-option-element>option</a></code> element in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> (including
+ its indent, if any).</p>
+
+ <p>An <code><a href=#the-optgroup-element>optgroup</a></code> element is expected to be rendered by
+ displaying the element's <code title=attr-optgroup-label><a href=#attr-optgroup-label>label</a></code> attribute.</p>
+
+ <p>An <code><a href=#the-option-element>option</a></code> element is expected to be rendered by
+ displaying the element's <code title=concept-option-label><a href=#concept-option-label>label</a></code>, indented under its
+ <code><a href=#the-optgroup-element>optgroup</a></code> element if it has one.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-textarea-element-0><span class=secno>12.4.15 </span>The <code><a href=#the-textarea-element>textarea</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+textarea { binding: <i title="">textarea</i>; }</pre>
+
+ <p>When the <i title="">textarea</i> binding applies to a
+ <code><a href=#the-textarea-element>textarea</a></code> element, the element is expected to render as
+ an 'inline-block' box rendered as a multiline text field.</p>
+
+ <p>If the element has a <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code>
+ attribute, and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules
+ for parsing non-negative integers</a> doesn't generate an error,
+ then the user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
+ 'width' property on the element, with the value being the
+ <a href=#textarea-effective-width>textarea effective width</a> (as defined below). Otherwise,
+ the user agent is expected to act as if it had a user-agent-level
+ style sheet rule setting the 'width' property on the element to the
+ <a href=#textarea-effective-width>textarea effective width</a>.</p>
+
+ <p>The <dfn id=textarea-effective-width>textarea effective width</dfn> of a
+ <code><a href=#the-textarea-element>textarea</a></code> element is <span><var title="">size</var>&times;<var title="">avg</var>&nbsp;+&nbsp;<var title="">sbw</var></span>, where <var title="">size</var> is the
+ element's <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character
+ width</a>, <var title="">avg</var> is the average character width
+ of the primary font of the element, in CSS pixels, and <var title="">sbw</var> is the width of a scroll bar, in CSS pixels. (The
+ element's 'letter-spacing' property does not affect the result.)</p>
+
+ <p>If the element has a <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code>
+ attribute, and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules
+ for parsing non-negative integers</a> doesn't generate an error,
+ then the user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
+ 'height' property on the element, with the value being the
+ <a href=#textarea-effective-height>textarea effective height</a> (as defined
+ below). Otherwise, the user agent is expected to act as if it had a
+ user-agent-level style sheet rule setting the 'height' property on
+ the element to the <a href=#textarea-effective-height>textarea effective height</a>.</p>
+
+ <p>The <dfn id=textarea-effective-height>textarea effective height</dfn> of a
+ <code><a href=#the-textarea-element>textarea</a></code> element is the height in CSS pixels of the
+ number of lines specified the element's <a href=#attr-textarea-rows-value title=attr-textarea-rows-value>character height</a>, plus the
+ height of a scrollbar in CSS pixels.</p>
+
+ <p>For historical reasons, if the element has a <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute whose value is an
+ <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title=attr-textarea-wrap-off>off</code>", then the user agent is
+ expected to not wrap the rendered value; otherwise, the value of the
+ control is expected to be wrapped to the width of the control.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-keygen-element-0><span class=secno>12.4.16 </span>The <code><a href=#the-keygen-element>keygen</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+keygen { binding: <i title="">keygen</i>; }</pre>
+
+ <p>When the <i title="">keygen</i> binding applies to a
+ <code><a href=#the-keygen-element>keygen</a></code> element, the element is expected to render as an
+ 'inline-block' box containing a user interface to configure the key
+ pair to be generated.</p>
+
+ </div>
+
+
+ <div class=impl>
+
+ <h4 id=the-time-element-0><span class=secno>12.4.17 </span>The <code><a href=#the-time-element>time</a></code> element</h4>
+
+ <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
+
+time[datetime] { binding: <i title="">time</i>; }</pre>
+
+ <p>When the <i title="">time</i> binding applies to a
+ <code><a href=#the-time-element>time</a></code> element, the element is expected to render as if
+ it contained text conveying the <a href=#concept-time-date title=concept-time-date>date</a> (if known), <a href=#concept-time-time title=concept-time-time>time</a> (if known), and <a href=#concept-time-timezone title=concept-time-timezone>time-zone offset</a> (if known)
+ represented by the element, in the fashion most convenient for the
+ user.</p>
+
+ <!-- If none are known then the element would appear empty. -->
+
+ </div>
+
+
+
+ <div class=impl>
+
+ <h3 id=frames-and-framesets><span class=secno>12.5 </span>Frames and framesets</h3>
+
+ <p>When an <code><a href=#the-html-element-0>html</a></code> element's second child element is a
+ <code><a href=#frameset>frameset</a></code> element, the user agent is expected to render
+ the <code><a href=#frameset>frameset</a></code> element as described below across the
+ surface of the viewport, instead of applying the usual CSS rendering
+ rules.</p>
+
+ <p>When rendering a <code><a href=#frameset>frameset</a></code> on a surface, the user
+ agent is expected to use the following layout algorithm:</p>
+
+ <ol><li>
+
+ <p>The <var title="">cols</var> and <var title="">rows</var>
+ variables are lists of zero or more pairs consisting of a number
+ and a unit, the unit being one of <i>percentage</i>,
+ <i>relative</i>, and <i>absolute</i>.</p>
+
+ <p>Use the <a href=#rules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions</a> to
+ parse the value of the element's <code title=attr-frameset-cols>cols</code> attribute, if there is
+ one. Let <var title="">cols</var> be the result, or an empty list
+ if there is no such attribute.</p>
+
+ <p>Use the <a href=#rules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions</a> to
+ parse the value of the element's <code title=attr-frameset-rows>rows</code> attribute, if there is
+ one. Let <var title="">rows</var> be the result, or an empty list
+ if there is no such attribute.</p>
+
+ </li>
+
+ <li>
+
+ <p>For any of the entries in <var title="">cols</var> or <var title="">rows</var> that have the number zero and the unit
+ <i>relative</i>, change the entry's number to one.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">cols</var> has no entries, then add a single
+ entry consisting of the value 1 and the unit <i>relative</i> to
+ <var title="">cols</var>.</p>
+
+ <p>If <var title="">rows</var> has no entries, then add a single
+ entry consisting of the value 1 and the unit <i>relative</i> to
+ <var title="">rows</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>Invoke the algorithm defined below to <a href=#convert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of
+ dimensions to a list of pixel values</a> using <var title="">cols</var> as the input list, and the width of the
+ surface that the <code><a href=#frameset>frameset</a></code> is being rendered into, in
+ CSS pixels, as the input dimension. Let <var title="">sized
+ cols</var> be the resulting list.</p>
+
+ <p>Invoke the algorithm defined below to <a href=#convert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of
+ dimensions to a list of pixel values</a> using <var title="">rows</var> as the input list, and the height of the
+ surface that the <code><a href=#frameset>frameset</a></code> is being rendered into, in
+ CSS pixels, as the input dimension. Let <var title="">sized
+ rows</var> be the resulting list.</p>
+
+ </li>
+
+ <li>
+
+ <p>Split the surface into a grid of <span title=""><var title="">w</var>&times;<var title="">h</var></span> rectangles,
+ where <var title="">w</var> is the number of entries in <var title="">sized cols</var> and <var title="">h</var> is the number
+ of entries in <var title="">sized rows</var>.</p>
+
+ <p>Size the columns so that each column in the grid is as many CSS
+ pixels wide as the corresponding entry in the <var title="">sized
+ cols</var> list.</p>
+
+ <p>Size the rows so that each row in the grid is as many CSS
+ pixels high as the corresponding entry in the <var title="">sized
+ rows</var> list.</p>
+
+ </li>
+
+ <li>
+
+ <p>Let <var title="">children</var> be the list of
+ <code><a href=#frame>frame</a></code> and <code><a href=#frameset>frameset</a></code> elements that are
+ children of the <code><a href=#frameset>frameset</a></code> element for which the
+ algorithm was invoked.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each row of the grid of rectangles created in the previous
+ step, from top to bottom, run these substeps:</p>
+
+ <ol><li>
+
+ <p>For each rectangle in the row, from left to right, run these
+ substeps:</p>
+
+ <ol><li>
+
+ <p>If there are any elements left in <var title="">children</var>, take the first element in the list,
+ and assign it to the rectangle.</p>
+
+ <p>If this is a <code><a href=#frameset>frameset</a></code> element, then recurse
+ the entire <code><a href=#frameset>frameset</a></code> layout algorithm for that
+ <code><a href=#frameset>frameset</a></code> element, with the rectangle as the
+ surface.</p>
+
+ <p>Otherwise, it is a <code><a href=#frame>frame</a></code> element; create a
+ <a href=#nested-browsing-context>nested browsing context</a> sized to fit the
+ rectangle.</p>
+
+ </li>
+
+ <li>
+
+ <p>If there are any elements left in <var title="">children</var>, remove the first element from <var title="">children</var>.</p>
+
+ </ol></li>
+
+ </ol></li>
+
+ <li>
+
+ <p>If the <code><a href=#frameset>frameset</a></code> element <a href=#has-a-border>has a border</a>,
+ draw an outer set of borders around the rectangles, using the
+ element's <a href=#frame-border-color>frame border color</a>.</p>
+
+ <p>For each rectangle, if there is an element assigned to that
+ rectangle, and that element <a href=#has-a-border>has a border</a>, draw an
+ inner set of borders around that rectangle, using the
+ element's <a href=#frame-border-color>frame border color</a>.</p>
+
+ <p>For each (visible) border that does not abut a rectangle that
+ is assigned a <code><a href=#frame>frame</a></code> element with a <code title=attr-frame-noresize>noresize</code> attribute (including
+ rectangles in further nested <code><a href=#frameset>frameset</a></code> elements), the
+ user agent is expected to allow the user to move the border,
+ resizing the rectangles within, keeping the proportions of any
+ nested <code><a href=#frameset>frameset</a></code> grids.</p>
+
+ <p>A <code><a href=#frameset>frameset</a></code> or <code><a href=#frame>frame</a></code> element <dfn id=has-a-border>has
+ a border</dfn> if the following algorithm returns true:</p>
+
+ <ol><li><p>If the element has a <code title=attr-frames-frameborder>frameborder</code> attribute
+ whose value is not the empty string and whose first character is
+ either a U+0031 DIGIT ONE (1) character, a U+0079 LATIN SMALL
+ LETTER Y character (y), or a U+0059 LATIN CAPITAL LETTER Y
+ character (Y), then return true.</li>
+
+ <li><p>Otherwise, if the element has a <code title=attr-frames-frameborder>frameborder</code> attribute,
+ return false.</li>
+
+ <li><p>Otherwise, if the element has a parent element that is a
+ <code><a href=#frameset>frameset</a></code> element, then return true if <em>that</em>
+ element <a href=#has-a-border>has a border</a>, and false if it does
+ not.</li>
+
+ <li><p>Otherwise, return true.</li>
+
+ </ol><p>The <dfn id=frame-border-color>frame border color</dfn> of a <code><a href=#frameset>frameset</a></code> or
+ <code><a href=#frame>frame</a></code> element is the color obtained from the
+ following algorithm:</p>
+
+ <ol><li><p>If the element has a <code title=attr-frames-bordercolor>bordercolor</code> attribute, and
+ applying the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy color value</a>
+ to that attribute's value does not result in an error, then
+ return the color so obtained.</li>
+
+ <li><p>Otherwise, if the element has a parent element that is a
+ <code><a href=#frameset>frameset</a></code> element, then the <a href=#frame-border-color>frame border
+ color</a> of that element.</p>
+
+ <li><p>Otherwise, return gray.</li>
+
+ </ol></li>
+
+ </ol><p>The algorithm to <dfn id=convert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of dimensions to a list of
+ pixel values</dfn> consists of the following steps:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">input list</var> be the list of numbers and
+ units passed to the algorithm.</p>
+
+ <p>Let <var title="">output list</var> be a list of numbers the
+ same length as <var title="">input list</var>, all zero.</p>
+
+ <p>Entries in <var title="">output list</var> correspond to the
+ entries in <var title="">input list</var> that have the same
+ position.</p>
+
+ </li>
+
+ <li><p>Let <var title="">input dimension</var> be the size passed
+ to the algorithm.</p>
+
+ <li>
+
+ <p>Let <var title="">count percentage</var> be the number of
+ entries in <var title="">input list</var> whose unit is
+ <i>percentage</i>.</p>
+
+ <p>Let <var title="">total percentage</var> be the sum of all the
+ numbers in <var title="">input list</var> whose unit is
+ <i>percentage</i>.</p>
+
+ <p>Let <var title="">count relative</var> be the number of
+ entries in <var title="">input list</var> whose unit is
+ <i>relative</i>.</p>
+
+ <p>Let <var title="">total relative</var> be the sum of all the
+ numbers in <var title="">input list</var> whose unit is
+ <i>relative</i>.</p>
+
+ <p>Let <var title="">count absolute</var> be the number of
+ entries in <var title="">input list</var> whose unit is
+ <i>absolute</i>.</p>
+
+ <p>Let <var title="">total absolute</var> be the sum of all the
+ numbers in <var title="">input list</var> whose unit is
+ <i>absolute</i>.</p>
+
+ <p>Let <var title="">remaining space</var> be the value of <var title="">input dimension</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">total absolute</var> is greater than <var title="">remaining space</var>, then for each entry in <var title="">input list</var> whose unit is <i>absolute</i>, set the
+ corresponding value in <var title="">output list</var> to the
+ number of the entry in <var title="">input list</var> multiplied
+ by <var title="">remaining space</var> and divided by <var title="">total absolute</var>. Then, set <var title="">remaining
+ space</var> to zero.</p>
+
+ <p>Otherwise, for each entry in <var title="">input list</var>
+ whose unit is <i>absolute</i>, set the corresponding value in <var title="">output list</var> to the number of the entry in <var title="">input list</var>. Then, decrement <var title="">remaining
+ space</var> by <var title="">total absolute</var>.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">total percentage</var> multiplied by the <var title="">input dimension</var> and divided by 100 is greater than
+ <var title="">remaining space</var>, then for each entry in <var title="">input list</var> whose unit is <i>percentage</i>, set the
+ corresponding value in <var title="">output list</var> to the
+ number of the entry in <var title="">input list</var> multiplied
+ by <var title="">remaining space</var> and divided by <var title="">total percentage</var>. Then, set <var title="">remaining
+ space</var> to zero.</p>
+
+ <p>Otherwise, for each entry in <var title="">input list</var>
+ whose unit is <i>percentage</i>, set the corresponding value in
+ <var title="">output list</var> to the number of the entry in <var title="">input list</var> multiplied by the <var title="">input
+ dimension</var> and divided by 100. Then, decrement <var title="">remaining space</var> by <var title="">total
+ percentage</var> multiplied by the <var title="">input
+ dimension</var> and divided by 100.</p>
+
+ </li>
+
+ <li>
+
+ <p>For each entry in <var title="">input list</var> whose unit is
+ <i>relative</i>, set the corresponding value in <var title="">output list</var> to the number of the entry in <var title="">input list</var> multiplied by <var title="">remaining
+ space</var> and divided by <var title="">total relative</var>.</p>
+
+ </li>
+
+ <li><p>Return <var title="">output list</var>.</li>
+
+ </ol><p>User agents working with integer values for frame widths (as
+ opposed to user agents that can lay frames out with subpixel
+ accuracy) are expected to distribute the remainder first to the last
+ entry whose unit is <i>relative</i>, then equally (not
+ proportionally) to each entry whose unit is <i>percentage</i>, then
+ equally (not proportionally) to each entry whose unit is
+ <i>absolute</i>, and finally, failing all else, to the last
+ entry.</p>
+
+
+ </div>
+
+
+ <div class=impl>
+
+ <h3 id=interactive-media><span class=secno>12.6 </span>Interactive media</h3>
+
+ <h4 id=links,-forms,-and-navigation><span class=secno>12.6.1 </span>Links, forms, and navigation</h4>
+
+ <p>User agents are expected to allow the user to control aspects of
+ <a href=#hyperlink>hyperlink</a> activation and <a href=#form-submission>form submission</a>,
+ such as which <a href=#browsing-context>browsing context</a> is to be used for the
+ subsequent <a href=#navigate title=navigate>navigation</a>.</p>
+
+ <p>User agents are expected to allow users to discover the
+ destination of <a href=#hyperlink title=hyperlink>hyperlinks</a> and of
+ <a href=#the-form-element title=form>forms</a> before triggering their <a href=#navigate title=navigate>navigation</a>.</p>
+
+<!--PING-->
+ <p>User agents are expected to inform the user of whether a
+ <a href=#hyperlink>hyperlink</a> includes <a href=#hyperlink-auditing>hyperlink auditing</a>, and
+ to let them know at a minimum which domains will be contacted as
+ part of such auditing.</p>
+<!--PING-->
+
+ <p>User agents are expected to allow users to <a href=#navigate>navigate</a>
+ <a href=#browsing-context title="browsing context">browsing contexts</a> to the
+ resources <a href=#resolve-a-url title="resolve a url">indicated</a> by the <code title="">cite</code> attributes on <code><a href=#the-q-element>q</a></code>,
+ <code><a href=#the-blockquote-element>blockquote</a></code>, <code><a href=#the-section-element>section</a></code>, <code><a href=#the-article-element>article</a></code>,
+ <code><a href=#the-ins-element>ins</a></code>, and <code><a href=#the-del-element>del</a></code> elements.</p>
+
+ <p>User agents are expected to surface <a href=#hyperlink title=hyperlink>hyperlinks</a> created by <code><a href=#the-link-element>link</a></code>
+ elements in their user interface.</p>
+
+ <p class=note>While <code><a href=#the-link-element>link</a></code> elements that create <a href=#hyperlink title=hyperlink>hyperlinks</a> will match the ':link' or
+ ':visited' pseudo-classes, will react to clicks if visible, and so
+ forth, this does not extend to any browser interface constructs that
+ expose those same links. Activating a link through the browser's
+ interface, rather than in the page itself, does not trigger <code title=event-click><a href=#event-click>click</a></code> events and the like.</p>
+
+
+
+
+ <h4 id=the-title-attribute-0><span class=secno>12.6.2 </span>The <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute</h4>
+
+ <p>Given an element (e.g. the element designated by the mouse
+ cursor), if the element, or one of its ancestors, has a <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute, and the nearest such
+ attribute has a value that is not the empty string, it is expected
+ that the user agent will expose the contents of that attribute as a
+ tooltip.</p>
+
+ <p>User agents are encouraged to make it possible to view tooltips
+ without the use of a pointing device, since not all users are able
+ to use pointing devices.</p>
+
+ <p>U+000A LINE FEED (LF) characters are expected to cause line
+ breaks in the tooltip.</p>
+
+
+ <h4 id=editing-hosts><span class=secno>12.6.3 </span>Editing hosts</h4>
+
+ <p>The current text editing caret (the one at the <a href=#caret-position>caret
+ position</a> in a focused <a href=#editing-host>editing host</a>) is expected
+ to act like an inline replaced element with the vertical dimensions
+ of the caret and with zero width for the purposes of the CSS
+ rendering model.</p>
+
+ <p class=note>This means that even an empty block can have the
+ caret inside it, and that when the caret is in such an element, it
+ prevents margins from collapsing through the element.</p>
+
+
+
+
+ <h3 id=print-media><span class=secno>12.7 </span>Print media</h3>
+
+ <p>User agents are expected to allow the user to request the
+ opportunity to <dfn id=obtain-a-physical-form>obtain a physical form</dfn> (or a
+ representation of a physical form) of a <code><a href=#document>Document</a></code>. For
+ example, selecting the option to print a page or convert it to PDF
+ format.</p>
+
+ <p>When the user actually <a href=#obtain-a-physical-form title="obtain a physical
+ form">obtains a physical form</a> (or a representation of a
+ physical form) of a <code><a href=#document>Document</a></code>, the user agent is
+ expected to create a new rendering of the <code><a href=#document>Document</a></code> for
+ the print media.</p>
+
+
+
+ </div>
+
+
+
+ <h2 id=obsolete><span class=secno>13 </span>Obsolete features</h2>
+
+ <h3 id=obsolete-but-conforming-features><span class=secno>13.1 </span>Obsolete but conforming features</h3>
+
+ <p>Features listed in this section will trigger warnings in
+ conformance checkers.</p>
+
+ <p>Authors should not specify an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content
+ Language</a> state on a <code><a href=#meta>meta</a></code> element. The <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute should be used instead.</p>
+
+ <p>Authors should not specify a <code title=attr-img-border><a href=#attr-img-border>border</a></code> attribute on an
+ <code><a href=#the-img-element>img</a></code> element. If the attribute is present, its value
+ must be the string "<code title="">0</code>". CSS should be used
+ instead.</p>
+
+ <p>Authors should not specify a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute on a
+ <code><a href=#script>script</a></code> element. If the attribute is present, its value
+ must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
+ "<code title="">JavaScript</code>" and either the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute must be omitted or
+ its value must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
+ the string "<code title="">text/javascript</code>". The attribute
+ should be entirely omitted instead (with the value "<code title="">JavaScript</code>", it has no effect), or replaced with use
+ of the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute.</p>
+
+ <p>Authors should not specify the <code title=attr-a-name><a href=#attr-a-name>name</a></code> attribute on <code><a href=#the-a-element>a</a></code>
+ elements. If the attribute is present, its value must not be the
+ empty string and must neither be equal to the value of any of the
+ <a href=#concept-id title=concept-id>IDs</a> in the element's <a href=#home-subtree>home
+ subtree</a> other than the element's own <a href=#concept-id title=concept-id>ID</a>, if any, nor be equal to the value of
+ any of the other <code title=attr-a-name><a href=#attr-a-name>name</a></code> attributes on
+ <code><a href=#the-a-element>a</a></code> elements in the element's <a href=#home-subtree>home
+ subtree</a>. If this attribute is present and the element has an
+ <a href=#concept-id title=concept-id>ID</a>, then the attribute's value must
+ be equal to the element's <a href=#concept-id title=concept-id>ID</a>. In
+ earlier versions of the language, this attribute was intended as a
+ way to specify possible targets for fragment identifiers in <a href=#url title=URL>URLs</a>. The <code title=attr-id><a href=#the-id-attribute>id</a></code>
+ attribute should be used instead.</p>
+
+ <p class=note>In <a href=#syntax>the HTML syntax</a>, specifying a <a href=#syntax-doctype title=syntax-DOCTYPE>DOCTYPE</a> that is an <a href=#obsolete-permitted-doctype>obsolete
+ permitted DOCTYPE</a> will also trigger a warning.</p>
+
+ <p class=note>The <code title=attr-table-summary><a href=#attr-table-summary>summary</a></code>
+ attribute, defined in the <code><a href=#the-table-element>table</a></code> section, will also
+ trigger a warning.</p>
+
+
+ <div class=impl>
+
+ <h4 id=warnings-for-obsolete-but-conforming-features><span class=secno>13.1.1 </span>Warnings for obsolete but conforming features</h4>
+
+ <p>To ease the transition from HTML4 Transitional documents to the
+ language defined in <em>this</em> specification, and to discourage
+ certain features that are only allowed in very few circumstances,
+ conformance checkers are required to warn the user when the
+ following features are used in a document. These are generally old
+ obsolete features that have no effect, and are allowed only to
+ distinguish between likely mistakes (regular conformance errors) and
+ mere vestigial markup or unusual and discouraged practices (these
+ warnings).</p>
+
+ <p>The following features must be categorized as described
+ above:</p>
+
+ <ul><!-- downplayed list --><li><p>The presence of an <a href=#obsolete-permitted-doctype>obsolete permitted DOCTYPE</a>
+ in an <a href=#html-documents title="HTML documents">HTML document</a>.</li>
+
+ <li><p>The presence of a <code><a href=#meta>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
+ <a href=#attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content
+ Language</a> state.</li>
+
+ <li><p>The presence of a <code title=attr-img-border><a href=#attr-img-border>border</a></code> attribute on an
+ <code><a href=#the-img-element>img</a></code> element if its value is the string "<code title="">0</code>".</li>
+
+ <li><p>The presence of a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute on a
+ <code><a href=#script>script</a></code> element if its value is an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the string "<code title="">JavaScript</code>" and if there is no <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute or there is and its
+ value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
+ string "<code title="">text/javascript</code>".</li>
+
+ <li><p>The presence of a <code title=attr-a-name><a href=#attr-a-name>name</a></code>
+ attribute on an <code><a href=#the-a-element>a</a></code> element, if its value is not the
+ empty string.</li>
+
+ <li><p>The presence of a <code title=attr-table-summary><a href=#attr-table-summary>summary</a></code> attribute on a
+ <code><a href=#the-table-element>table</a></code> element.</li> <!-- 2.65% pages -->
+
+ </ul><p>Conformance checkers must distinguish between pages that have no
+ conformance errors and have none of these obsolete features, and
+ pages that have no conformance errors but do have some of these
+ obsolete features.</p>
+
+ <p class=example>For example, a validator could report some pages
+ as "Valid HTML" and others as "Valid HTML with warnings".</p>
+
+ </div>
+
+
+ <h3 id=non-conforming-features><span class=secno>13.2 </span>Non-conforming features</h3>
+
+ <p>Elements in the following list are entirely obsolete, and must
+ not be used by authors:</p>
+
+ <dl><!-- alphabetical by first element in the group, except CSS goes last --><dt><code><a href=#the-applet-element>applet</a></code></dt>
+ <dd><p>Use <code><a href=#the-embed-element>embed</a></code> or <code><a href=#the-object-element>object</a></code> instead.</dd>
+
+ <dt><dfn id=acronym><code>acronym</code></dfn></dt>
+ <dd><p>Use <code><a href=#the-abbr-element>abbr</a></code> instead.</dd>
+
+ <dt><dfn id=bgsound><code>bgsound</code></dfn></dt>
+ <dd><p>Use <code><a href=#audio>audio</a></code> instead.</dd>
+
+ <dt><dfn id=dir><code>dir</code></dfn></dt>
+ <dd><p>Use <code><a href=#the-ul-element>ul</a></code> instead.</dd>
+
+ <dt><code><a href=#frame>frame</a></code></dt>
+ <dt><code><a href=#frameset>frameset</a></code></dt>
+ <dt><dfn id=noframes><code>noframes</code></dfn></dt>
+ <dd><p>Either use <code><a href=#the-iframe-element>iframe</a></code> and CSS instead, or use server-side includes to generate complete pages with the various invariant parts merged in.</dd>
+
+ <dt><dfn id=isindex-0><code>isindex</code></dfn></dt>
+ <dd><p>Use an explicit <code><a href=#the-form-element>form</a></code> and <a href=#text-state-and-search-state title=attr-input-type-text>text field</a> combination instead.</dd>
+
+ <dt><dfn id=listing><code>listing</code></dfn></dt>
+ <dt><dfn id=xmp><code>xmp</code></dfn></dt>
+ <dd><p>Use <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-code-element>code</a></code> instead.</dd>
+
+ <dt><dfn id=nextid><code>nextid</code></dfn></dt>
+ <dd><p>Use GUIDs instead.</dd>
+
+ <dt><dfn id=noembed><code>noembed</code></dfn></dt>
+ <dd><p>Use <code><a href=#the-object-element>object</a></code> instead of <code><a href=#the-embed-element>embed</a></code> when fallback is necessary.</dd>
+
+ <dt><dfn id=plaintext><code>plaintext</code></dfn></dt>
+ <dd><p>Use the "<code>text/plain</code>" <a href=#mime-type>MIME type</a> instead.</dd>
+
+ <dt><dfn id=rb><code>rb</code></dfn></dt>
+ <dd><p>Providing the ruby base directly inside the <code><a href=#the-ruby-element>ruby</a></code> element is sufficient; the <code><a href=#rb>rb</a></code> element is unnecessary. Omit it altogether.</dd>
+
+ <dt><dfn id=basefont><code>basefont</code></dfn></dt>
+ <dt><dfn id=big><code>big</code></dfn></dt>
+ <dt><dfn id=blink><code>blink</code></dfn></dt>
+ <dt><dfn id=center><code>center</code></dfn></dt>
+ <dt><dfn id=font><code>font</code></dfn></dt>
+ <dt><code><a href=#the-marquee-element>marquee</a></code></dt>
+ <dt><dfn id=multicol><code>multicol</code></dfn></dt>
+ <dt><dfn id=nobr><code>nobr</code></dfn></dt>
+ <dt><dfn id=s><code>s</code></dfn></dt>
+ <dt><dfn id=spacer><code>spacer</code></dfn></dt>
+ <dt><dfn id=strike><code>strike</code></dfn></dt>
+ <dt><dfn id=tt><code>tt</code></dfn></dt>
+ <dt><dfn id=u><code>u</code></dfn></dt>
+
+ <dd>
+
+ <p>Use appropriate elements and/or CSS instead.</p>
+
+ <p>For the <code><a href=#s>s</a></code> and <code><a href=#strike>strike</a></code> elements, if
+ they are marking up a removal from the element, consider using the
+ <code><a href=#the-del-element>del</a></code> element instead.</p>
+
+ <p>Where the <code><a href=#tt>tt</a></code> element would have been used for
+ marking up keyboard input, consider the <code><a href=#the-kbd-element>kbd</a></code> element;
+ for variables, consider the <code><a href=#the-var-element>var</a></code> element; for computer
+ code, consider the <code><a href=#the-code-element>code</a></code> element; and for computer
+ output, consider the <code><a href=#the-samp-element>samp</a></code> element.</p>
+
+ <p>Similarly, if the <code><a href=#u>u</a></code> element is being used to
+ indicate emphasis, consider using the <code><a href=#the-em-element>em</a></code> element; if
+ it is being used for marking up keywords, consider the
+ <code><a href=#the-b-element>b</a></code> element; and if it is being used for highlighting
+ text for reference purposes, consider the <code><a href=#the-mark-element>mark</a></code>
+ element.</p>
+
+ <p>See also the <a href=#usage-summary>text-level semantics
+ usage summary</a> for more suggestions with examples.</p>
+
+ </dd>
+
+ </dl><hr><p>The following attributes are obsolete (though the elements are
+ still part of the language), and must not be used by authors:</p>
+
+ <dl><!-- alphabetical by element then attribute of first item in group, except CSS goes last --><dt><dfn id=attr-a-charset title=attr-a-charset><code>charset</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
+ <dt><dfn id=attr-link-charset title=attr-link-charset><code>charset</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
+ <dd><p>Use an HTTP Content-Type header on the linked resource instead.</dd>
+
+ <dt><dfn id=attr-a-coords title=attr-a-coords><code>coords</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
+ <dt><dfn id=attr-a-shape title=attr-a-shape><code>shape</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
+ <dd><p>Use <code><a href=#the-area-element>area</a></code> instead of <code><a href=#the-a-element>a</a></code> for image maps.</dd>
+
+ <dt><dfn id=attr-a-methods title=attr-a-methods><code>methods</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
+ <dt><dfn id=attr-link-methods title=attr-link-methods><code>methods</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
+ <dd><p>Use the HTTP OPTIONS feature instead.</dd>
+
+ <dt><dfn id=attr-a-name title=attr-a-name><code>name</code></dfn> on <code><a href=#the-a-element>a</a></code> elements (except as noted in the previous section)</dt>
+ <dt><dfn id=attr-embed-name title=attr-embed-name><code>name</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
+ <dt><dfn id=attr-img-name title=attr-img-name><code>name</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
+ <dt><dfn id=attr-option-name title=attr-option-name><code>name</code></dfn> on <code><a href=#the-option-element>option</a></code> elements</dt>
+ <dd><p>Use the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute instead.</dd>
+
+ <dt><dfn id=attr-a-rev title=attr-a-rev><code>rev</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
+ <dt><dfn id=attr-link-rev title=attr-link-rev><code>rev</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
+ <dd><p>Use the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>
+ attribute instead, with an opposite term. (For example, instead of
+ <code title="">rev="made"</code>, use <code title="">rel="author"</code>.)</dd>
+
+ <dt><dfn id=attr-a-urn title=attr-a-urn><code>urn</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
+ <dt><dfn id=attr-link-urn title=attr-link-urn><code>urn</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
+ <dd><p>Specify the preferred persistent identifier using the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute instead.</dd>
+
+ <dt><dfn id=attr-area-nohref title=attr-area-nohref><code>nohref</code></dfn> on <code><a href=#the-area-element>area</a></code> elements</dt>
+ <dd><p>Omitting the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
+ attribute is sufficient; the <code title=attr-area-nohref><a href=#attr-area-nohref>nohref</a></code> attribute is
+ unnecessary. Omit it altogether.</dd>
+
+ <dt><dfn id=attr-head-profile title=attr-head-profile><code>profile</code></dfn> on <code><a href=#the-head-element-0>head</a></code> elements</dt>
+ <dd><p>When used for declaring which <code><a href=#meta>meta</a></code> terms are
+ used in the document, unnecessary; omit it altogether, and <a href=#concept-meta-extensions title=concept-meta-extensions>register the names</a>.</dd>
+ <dd><p>When used for triggering specific user agent behaviors: use
+ a <code><a href=#the-link-element>link</a></code> element instead.</dd>
+
+ <dt><dfn id=attr-html-version title=attr-html-version><code>version</code></dfn> on <code><a href=#the-html-element-0>html</a></code> elements</dt>
+ <dd><p>Unnecessary. Omit it altogether.</dd>
+
+ <dt><dfn id=attr-input-usemap title=attr-input-usemap><code>usemap</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
+ <dd><p>Use <code><a href=#the-img-element>img</a></code> instead of <code><a href=#the-input-element>input</a></code> for image maps.</dd>
+
+ <dt><dfn id=attr-iframe-longdesc title=attr-iframe-longdesc><code>longdesc</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-img-longdesc title=attr-img-longdesc><code>longdesc</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
+ <dd><p>Use a regular <code><a href=#the-a-element>a</a></code> element to link to the description.</dd>
+
+ <dt><dfn id=attr-link-target title=attr-link-target><code>target</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
+ <dd><p>Unnecessary. Omit it altogether.</dd>
+
+ <dt><dfn id=attr-meta-scheme title=attr-meta-scheme><code>scheme</code></dfn> on <code><a href=#meta>meta</a></code> elements</dt>
+ <dd><p>Use only one scheme per field, or make the scheme declaration part of the value.</dd>
+
+ <dt><dfn id=attr-object-archive title=attr-object-archive><code>archive</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-object-classid title=attr-object-classid><code>classid</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-object-code title=attr-object-code><code>code</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-object-codebase title=attr-object-codebase><code>codebase</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-object-codetype title=attr-object-codetype><code>codetype</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dd><p>Use the <code title=attr-object-data><a href=#attr-object-data>data</a></code> and <code title=attr-object-type><a href=#attr-object-type>type</a></code> attributes to invoke <a href=#plugin title=plugin>plugins</a>. To set parameters with these names
+ in particular, the <code><a href=#the-param-element>param</a></code> element can be used.</dd>
+
+ <dt><dfn id=attr-object-declare title=attr-object-declare><code>declare</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dd><p>Repeat the <code><a href=#the-object-element>object</a></code> element completely each time the resource is to be reused.</dd>
+
+ <dt><dfn id=attr-object-standby title=attr-object-standby><code>standby</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dd><p>Optimize the linked resource so that it loads quickly or, at least, incrementally.</dd>
+
+ <dt><dfn id=attr-param-type title=attr-param-type><code>type</code></dfn> on <code><a href=#the-param-element>param</a></code> elements</dt>
+ <dt><dfn id=attr-param-valuetype title=attr-param-valuetype><code>valuetype</code></dfn> on <code><a href=#the-param-element>param</a></code> elements</dt>
+ <dd><p>Use the <code title=attr-param-name><a href=#attr-param-name>name</a></code> and <code title=attr-param-value><a href=#attr-param-value>value</a></code> attributes without declaring
+ value types.</dd>
+
+ <dt><dfn id=attr-script-language title=attr-script-language><code>language</code></dfn> on <code><a href=#script>script</a></code> elements (except as noted in the previous section)</dt>
+ <dd><p>Use the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute
+ instead.</dd>
+
+ <dt><dfn id=attr-script-event title=attr-script-event><code>event</code></dfn> on <code><a href=#script>script</a></code> elements</dt>
+ <dt><dfn id=attr-script-for title=attr-script-for><code>for</code></dfn> on <code><a href=#script>script</a></code> elements</dt>
+ <dd><p>Use DOM Events mechanisms to register event listeners. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></dd>
+
+ <dt><dfn id=attr-table-datapagesize title=attr-table-datapagesize><code>datapagesize</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dd><p>Unnecessary. Omit it altogether.</dd>
+
+ <dt><dfn id=attr-tdth-abbr title=attr-tdth-abbr><code>abbr</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dd><p>Use text that begins in an unambiguous and terse manner, and include any more elaborate text after that. The <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute can also be useful in including more detailed text, so that the cell's contents can be made terse.</p>
+
+ <dt><dfn id=attr-tdth-axis title=attr-tdth-axis><code>axis</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dd><p>Use the <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute on the relevant <code><a href=#the-th-element>th</a></code>.</p>
+
+ <dt><dfn id=attr-datasrc title=attr-datasrc><code>datasrc</code></dfn> on <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-button-element>button</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-label-element>label</a></code>, <code><a href=#the-legend-element>legend</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-option-element>option</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-span-element>span</a></code>, <code><a href=#the-table-element>table</a></code>, and <code><a href=#the-textarea-element>textarea</a></code> elements</dt>
+ <dt><dfn id=attr-datafld title=attr-datafld><code>datafld</code></dfn> on <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-button-element>button</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-fieldset-element>fieldset</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-label-element>label</a></code>, <code><a href=#the-legend-element>legend</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-param-element>param</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-span-element>span</a></code>, and <code><a href=#the-textarea-element>textarea</a></code> elements</dt>
+ <dt><dfn id=attr-dataformatas title=attr-dataformatas><code>dataformatas</code></dfn> on <code><a href=#the-button-element>button</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-label-element>label</a></code>, <code><a href=#the-legend-element>legend</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-option-element>option</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-span-element>span</a></code>, <code><a href=#the-table-element>table</a></code></dt>
+ <dd><p>Use script and a mechanism such as <code>XMLHttpRequest</code> to populate the page dynamically. <a href=#refsXHR>[XHR]</a></dd>
+
+ <dt><dfn id=attr-body-alink title=attr-body-alink><code>alink</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-bgcolor title=attr-body-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-link title=attr-body-link><code>link</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-marginbottom title=attr-body-marginbottom><code>marginbottom</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-marginheight title=attr-body-marginheight><code>marginheight</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-marginleft title=attr-body-marginleft><code>marginleft</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-marginright title=attr-body-marginright><code>marginright</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-margintop title=attr-body-margintop><code>margintop</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-marginwidth title=attr-body-marginwidth><code>marginwidth</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-text title=attr-body-text><code>text</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-body-vlink title=attr-body-vlink><code>vlink</code></dfn> on <code><a href=#the-body-element-0>body</a></code> elements</dt>
+ <dt><dfn id=attr-br-clear title=attr-br-clear><code>clear</code></dfn> on <code><a href=#the-br-element>br</a></code> elements</dt>
+ <dt><dfn id=attr-caption-align title=attr-caption-align><code>align</code></dfn> on <code><a href=#the-caption-element>caption</a></code> elements</dt>
+ <dt><dfn id=attr-col-align title=attr-col-align><code>align</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
+ <dt><dfn id=attr-col-char title=attr-col-char><code>char</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
+ <dt><dfn id=attr-col-charoff title=attr-col-charoff><code>charoff</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
+ <dt><dfn id=attr-col-valign title=attr-col-valign><code>valign</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
+ <dt><dfn id=attr-col-width title=attr-col-width><code>width</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
+ <dt><dfn id=attr-div-align title=attr-div-align><code>align</code></dfn> on <code><a href=#the-div-element>div</a></code> elements</dt>
+ <dt><dfn id=attr-dl-compact title=attr-dl-compact><code>compact</code></dfn> on <code><a href=#the-dl-element>dl</a></code> elements</dt>
+ <dt><dfn id=attr-embed-align title=attr-embed-align><code>align</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
+ <dt><dfn id=attr-embed-hspace title=attr-embed-hspace><code>hspace</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
+ <dt><dfn id=attr-embed-vspace title=attr-embed-vspace><code>vspace</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
+ <dt><dfn id=attr-hr-align title=attr-hr-align><code>align</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
+ <dt><dfn id=attr-hr-color title=attr-hr-color><code>color</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
+ <dt><dfn id=attr-hr-noshade title=attr-hr-noshade><code>noshade</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
+ <dt><dfn id=attr-hr-size title=attr-hr-size><code>size</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
+ <dt><dfn id=attr-hr-width title=attr-hr-width><code>width</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
+ <dt><dfn id=attr-hx-align title=attr-hx-align><code>align</code></dfn> on <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&mdash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-align title=attr-iframe-align><code>align</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-allowtransparency title=attr-iframe-allowtransparency><code>allowtransparency</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-frameborder title=attr-iframe-frameborder><code>frameborder</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-hspace title=attr-iframe-hspace><code>hspace</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-marginheight title=attr-iframe-marginheight><code>marginheight</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-marginwidth title=attr-iframe-marginwidth><code>marginwidth</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-scrolling title=attr-iframe-scrolling><code>scrolling</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-iframe-vspace title=attr-iframe-vspace><code>vspace</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
+ <dt><dfn id=attr-input-align title=attr-input-align><code>align</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
+ <dt><dfn id=attr-input-hspace title=attr-input-hspace><code>hspace</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
+ <dt><dfn id=attr-input-vspace title=attr-input-vspace><code>vspace</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
+ <dt><dfn id=attr-img-align title=attr-img-align><code>align</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
+ <dt><dfn id=attr-img-border title=attr-img-border><code>border</code></dfn> on <code><a href=#the-img-element>img</a></code> elements (except as noted in the previous section)</dt>
+ <dt><dfn id=attr-img-hspace title=attr-img-hspace><code>hspace</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
+ <dt><dfn id=attr-img-vspace title=attr-img-vspace><code>vspace</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
+ <dt><dfn id=attr-legend-align title=attr-legend-align><code>align</code></dfn> on <code><a href=#the-legend-element>legend</a></code> elements</dt>
+ <dt><dfn id=attr-li-type title=attr-li-type><code>type</code></dfn> on <code><a href=#the-li-element>li</a></code> elements</dt>
+ <dt><dfn id=attr-menu-compact title=attr-menu-compact><code>compact</code></dfn> on <code><a href=#menus>menu</a></code> elements</dt>
+ <dt><dfn id=attr-object-align title=attr-object-align><code>align</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-object-border title=attr-object-border><code>border</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-object-hspace title=attr-object-hspace><code>hspace</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-object-vspace title=attr-object-vspace><code>vspace</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
+ <dt><dfn id=attr-ol-compact title=attr-ol-compact><code>compact</code></dfn> on <code><a href=#the-ol-element>ol</a></code> elements</dt>
+ <dt><dfn id=attr-ol-type title=attr-ol-type><code>type</code></dfn> on <code><a href=#the-ol-element>ol</a></code> elements</dt>
+ <dt><dfn id=attr-p-align title=attr-p-align><code>align</code></dfn> on <code><a href=#the-p-element>p</a></code> elements</dt>
+ <dt><dfn id=attr-pre-width title=attr-pre-width><code>width</code></dfn> on <code><a href=#the-pre-element>pre</a></code> elements</dt>
+ <dt><dfn id=attr-table-align title=attr-table-align><code>align</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-table-bgcolor title=attr-table-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-table-border title=attr-table-border><code>border</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-table-cellpadding title=attr-table-cellpadding><code>cellpadding</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-table-cellspacing title=attr-table-cellspacing><code>cellspacing</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-table-frame title=attr-table-frame><code>frame</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-table-rules title=attr-table-rules><code>rules</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-table-width title=attr-table-width><code>width</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
+ <dt><dfn id=attr-tbody-align title=attr-tbody-align><code>align</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
+ <dt><dfn id=attr-tbody-char title=attr-tbody-char><code>char</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
+ <dt><dfn id=attr-tbody-charoff title=attr-tbody-charoff><code>charoff</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
+ <dt><dfn id=attr-tbody-valign title=attr-tbody-vAlign><code>valign</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-align title=attr-tdth-align><code>align</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-bgcolor title=attr-tdth-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-char title=attr-tdth-char><code>char</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-charoff title=attr-tdth-charoff><code>charoff</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-height title=attr-tdth-height><code>height</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-nowrap title=attr-tdth-nowrap><code>nowrap</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-valign title=attr-tdth-valign><code>valign</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tdth-width title=attr-tdth-width><code>width</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dt><dfn id=attr-tr-align title=attr-tr-align><code>align</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
+ <dt><dfn id=attr-tr-bgcolor title=attr-tr-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
+ <dt><dfn id=attr-tr-char title=attr-tr-char><code>char</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
+ <dt><dfn id=attr-tr-charoff title=attr-tr-charoff><code>charoff</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
+ <dt><dfn id=attr-tr-valign title=attr-tr-valign><code>valign</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
+ <dt><dfn id=attr-ul-compact title=attr-ul-compact><code>compact</code></dfn> on <code><a href=#the-ul-element>ul</a></code> elements</dt>
+ <dt><dfn id=attr-ul-type title=attr-ul-type><code>type</code></dfn> on <code><a href=#the-ul-element>ul</a></code> elements</dt>
+ <dt><dfn id=attr-background title=attr-background><code>background</code></dfn> on <code><a href=#the-body-element-0>body</a></code>, <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-td-element>td</a></code>, and <code><a href=#the-th-element>th</a></code> elements</dt>
+ <dd><p>Use CSS instead.</dd>
+
+ </dl><div class=impl>
+
+ <h3 id=requirements-for-implementations><span class=secno>13.3 </span>Requirements for implementations</h3>
+
+ <h4 id=the-applet-element><span class=secno>13.3.1 </span>The <dfn><code>applet</code></dfn> element</h4>
+
+ <p>The <code><a href=#the-applet-element>applet</a></code> element is a Java-specific variant of the
+ <code><a href=#the-embed-element>embed</a></code> element. The <code><a href=#the-applet-element>applet</a></code> element is now
+ obsoleted so that all extension frameworks (Java, .NET, Flash, etc)
+ are handled in a consistent manner.</p>
+
+ <p id=sandboxPluginApplet>When the element is still in the
+ <a href=#stack-of-open-elements>stack of open elements</a> of an <a href=#html-parser>HTML parser</a>
+ or <a href=#xml-parser>XML parser</a>, and when the element is not <a href=#in-a-document>in a
+ <code>Document</code></a>, and when the element's document is not
+ <a href=#fully-active>fully active</a>, and when the element's
+ <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> had its
+ <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> when that
+ <code><a href=#document>Document</a></code> was created, and when the element's
+ <code><a href=#document>Document</a></code> was parsed from a resource whose <a href=#content-type-sniffing-0 title="Content-Type sniffing">sniffed type</a> as determined
+ during <a href=#navigate title=navigate>navigation</a> is
+ <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code>, and when the element has an
+ ancestor <a href=#media-element>media element</a>, and when the element has an
+ ancestor <code><a href=#the-object-element>object</a></code> element that is <em>not</em> showing
+ its <a href=#fallback-content>fallback content</a>, and when no Java Language runtime
+ <a href=#plugin>plugin</a> is available, and when one <em>is</em> available
+ but it is disabled, the element <a href=#represents>represents</a> its
+ contents.</p>
+
+ <p>Otherwise, the user agent should instantiate a Java Language
+ runtime <a href=#plugin>plugin</a>, and should pass the names and values of
+ all the attributes on the element, in the order they were added to
+ the element, with the attributes added by the parser being ordered
+ in source order, and then a parameter named "PARAM" whose value is
+ null, and then all the names and values of <a href=#concept-param-parameter title=concept-param-parameter>parameters</a> given by
+ <code><a href=#the-param-element>param</a></code> elements that are children of the
+ <code><a href=#the-applet-element>applet</a></code> element, in <a href=#tree-order>tree order</a>, to the
+ <a href=#plugin>plugin</a> used. If the <a href=#plugin>plugin</a> supports a
+ scriptable interface, the <code><a href=#htmlappletelement>HTMLAppletElement</a></code> object
+ representing the element should expose that interface. The
+ <code><a href=#the-applet-element>applet</a></code> element <a href=#represents>represents</a> the
+ <a href=#plugin>plugin</a>.</p>
+
+ <!-- If we ever make this fetch anything manually, remember to delay
+ the load event, and to include ", from the element's <span>browsing
+ context scope origin</span> if it has one" when fetching -->
+
+ <p class=note>The <code><a href=#the-applet-element>applet</a></code> element is unaffected by the
+ CSS 'display' property. The Java Language runtime is instantiated
+ even if the element is hidden with a 'display:none' CSS style.</p>
+
+ <p>The <code><a href=#the-applet-element>applet</a></code> element must implement the
+ <code><a href=#htmlappletelement>HTMLAppletElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmlappletelement>HTMLAppletElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-applet-align title=dom-applet-align>align</a>;
+ attribute DOMString <a href=#dom-applet-alt title=dom-applet-alt>alt</a>;
+ attribute DOMString <a href=#dom-applet-archive title=dom-applet-archive>archive</a>;
+ attribute DOMString <a href=#dom-applet-code title=dom-applet-code>code</a>;
+ attribute DOMString <a href=#dom-applet-codebase title=dom-applet-codeBase>codeBase</a>;
+ attribute DOMString <a href=#dom-applet-height title=dom-applet-height>height</a>;
+ attribute unsigned long <a href=#dom-applet-hspace title=dom-applet-hspace>hspace</a>;
+ attribute DOMString <a href=#dom-applet-name title=dom-applet-name>name</a>;
+ attribute DOMString _<a href=#dom-applet-object title=dom-applet-object>object</a>; // the underscore is not part of the identifier <!-- it's a Web IDL escaping mechanism -->
+ attribute unsigned long <a href=#dom-applet-vspace title=dom-applet-vspace>vspace</a>;
+ attribute DOMString <a href=#dom-applet-width title=dom-applet-width>width</a>;
+};</pre>
+
+ <p>The <dfn id=dom-applet-align title=dom-applet-align><code>align</code></dfn>, <dfn id=dom-applet-alt title=dom-applet-alt><code>alt</code></dfn>, <dfn id=dom-applet-archive title=dom-applet-archive><code>archive</code></dfn>, <dfn id=dom-applet-code title=dom-applet-code><code>code</code></dfn>, <dfn id=dom-applet-height title=dom-applet-height><code>height</code></dfn>, <dfn id=dom-applet-hspace title=dom-applet-hspace><code>hspace</code></dfn>, <dfn id=dom-applet-name title=dom-applet-name><code>name</code></dfn>, <dfn id=dom-applet-object title=dom-applet-object><code>object</code></dfn>, <dfn id=dom-applet-vspace title=dom-applet-vspace><code>vspace</code></dfn>, and <dfn id=dom-applet-width title=dom-applet-width><code>width</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name.</p>
+
+ <p>The <dfn id=dom-applet-codebase title=dom-applet-codeBase><code>codeBase</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-applet-codebase>codebase</code> content attribute.</p>
+
+
+ <h4 id=the-marquee-element><span class=secno>13.3.2 </span>The <dfn><code>marquee</code></dfn> element</h4>
+
+ <p>The <code><a href=#the-marquee-element>marquee</a></code> element is a presentational element that
+ animates content. CSS transitions and animations are a more
+ appropriate mechanism.</p>
+
+ <p>The <a href=#task-source>task source</a> for tasks mentioned in this section
+ is the <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
+
+ <p>The <code><a href=#the-marquee-element>marquee</a></code> element must implement the
+ <code><a href=#htmlmarqueeelement>HTMLMarqueeElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmlmarqueeelement>HTMLMarqueeElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-marquee-behavior title=dom-marquee-behavior>behavior</a>;
+ attribute DOMString <a href=#dom-marquee-bgcolor title=dom-marquee-bgColor>bgColor</a>;
+ attribute DOMString <a href=#dom-marquee-direction title=dom-marquee-direction>direction</a>;
+ attribute DOMString <a href=#dom-marquee-height title=dom-marquee-height>height</a>;
+ attribute unsigned long <a href=#dom-marquee-hspace title=dom-marquee-hspace>hspace</a>;
+ attribute long <a href=#dom-marquee-loop title=dom-marquee-loop>loop</a>;
+ attribute unsigned long <a href=#dom-marquee-scrollamount title=dom-marquee-scrollamount>scrollAmount</a>;
+ attribute unsigned long <a href=#dom-marquee-scrolldelay title=dom-marquee-scrollDelay>scrollDelay</a>;
+ attribute DOMString <a href=#dom-marquee-truespeed title=dom-marquee-trueSpeed>trueSpeed</a>;
+ attribute unsigned long <a href=#dom-marquee-vspace title=dom-marquee-vspace>vspace</a>;
+ attribute DOMString <a href=#dom-marquee-width title=dom-marquee-width>width</a>;
+
+ attribute <a href=#function>Function</a> <a href=#handler-marquee-onbounce title=handler-marquee-onbounce>onbounce</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-marquee-onfinish title=handler-marquee-onfinish>onfinish</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-marquee-onstart title=handler-marquee-onstart>onstart</a>;
+
+ void <a href=#dom-marquee-start title=dom-marquee-start>start</a>();
+ void <a href=#dom-marquee-stop title=dom-marquee-stop>stop</a>();
+};</pre>
+
+ <p>A <code><a href=#the-marquee-element>marquee</a></code> element can be <dfn id=concept-marquee-on title=concept-marquee-on>turned on</dfn> or <dfn id=concept-marquee-off title=concept-marquee-off>turned off</dfn>. When it is created, it
+ is <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>.</p>
+
+ <p>When the <dfn id=dom-marquee-start title=dom-marquee-start><code>start()</code></dfn> method is
+ called, the <code><a href=#the-marquee-element>marquee</a></code> element must be <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>.</p>
+
+ <p>When the <dfn id=dom-marquee-stop title=dom-marquee-stop><code>stop()</code></dfn>
+ method is called, the <code><a href=#the-marquee-element>marquee</a></code> element must be <a href=#concept-marquee-off title=concept-marquee-off>turned off</a>.</p>
+
+ <p>When a <code><a href=#the-marquee-element>marquee</a></code> element is created, the user agent
+ must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
+ named <code title=event-start>start</code> at the element.</p>
+
+ <hr><p>The <dfn id=attr-marquee-behavior title=attr-marquee-behavior><code>behavior</code></dfn> content
+ attribute on <code><a href=#the-marquee-element>marquee</a></code> elements is an <a href=#enumerated-attribute>enumerated
+ attribute</a> with the following keywords (all
+ non-conforming):</p>
+
+ <table><thead><tr><th>Keyword
+ <th>State
+ <tbody><tr><td><code title="">scroll</code>
+ <td><dfn id=attr-marquee-behavior-scroll title=attr-marquee-behavior-scroll>scroll</dfn>
+ <tr><td><code title="">slide</code>
+ <td><dfn id=attr-marquee-behavior-slide title=attr-marquee-behavior-slide>slide</dfn>
+ <tr><td><code title="">alternate</code>
+ <td><dfn id=attr-marquee-behavior-alternate title=attr-marquee-behavior-alternate>alternate</dfn>
+ </table><p>The <i>missing value default</i> is the <a href=#attr-marquee-behavior-scroll title=attr-marquee-behavior-scroll>scroll</a> state.</p>
+
+ <hr><p>The <dfn id=attr-marquee-direction title=attr-marquee-direction><code>direction</code></dfn> content
+ attribute on <code><a href=#the-marquee-element>marquee</a></code> elements is an <a href=#enumerated-attribute>enumerated
+ attribute</a> with the following keywords (all
+ non-conforming):</p>
+
+ <table><thead><tr><th>Keyword
+ <th>State
+ <tbody><tr><td><code title="">left</code>
+ <td><dfn id=attr-marquee-direction-left title=attr-marquee-direction-left>left</dfn>
+ <tr><td><code title="">right</code>
+ <td><dfn id=attr-marquee-direction-right title=attr-marquee-direction-right>right</dfn>
+ <tr><td><code title="">up</code>
+ <td><dfn id=attr-marquee-direction-up title=attr-marquee-direction-up>up</dfn>
+ <tr><td><code title="">down</code>
+ <td><dfn id=attr-marquee-direction-down title=attr-marquee-direction-down>down</dfn>
+ </table><p>The <i>missing value default</i> is the <a href=#attr-marquee-direction-left title=attr-marquee-direction-left>left</a> state.</p>
+
+ <hr><p>The <dfn id=attr-marquee-truespeed title=attr-marquee-truespeed><code>truespeed</code></dfn> content
+ attribute on <code><a href=#the-marquee-element>marquee</a></code> elements is an <a href=#enumerated-attribute>enumerated
+ attribute</a> with the following keywords (all
+ non-conforming):</p>
+
+ <table><thead><tr><th>Keyword
+ <th>State
+ <tbody><tr><td><code title="">true</code>
+ <td><dfn id=attr-marquee-truespeed-true title=attr-marquee-truespeed-true>true</dfn>
+ <tr><td><code title="">false</code>
+ <td><dfn id=attr-marquee-truespeed-false title=attr-marquee-truespeed-false>false</dfn>
+ </table><p>The <i>missing value default</i> is the <a href=#attr-marquee-truespeed-false title=attr-marquee-truespeed-false>false</a> state.</p>
+
+ <hr><p>A <code><a href=#the-marquee-element>marquee</a></code> element has a <dfn id=marquee-scroll-interval>marquee scroll
+ interval</dfn>, which is obtained as follows:</p>
+
+ <ol><li><p>If the element has a <code title=attr-marquee-scrolldelay>scrolldelay</code> attribute, and
+ parsing its value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a> does not return an error, then let <var title="">delay</var> be the parsed value. Otherwise, let <var title="">delay</var> be 85.</li>
+
+ <li><p>If the element does not have a <code title=attr-marquee-truespeed><a href=#attr-marquee-truespeed>truespeed</a></code> attribute, or if it
+ does but that attribute is in the <a href=#attr-marquee-truespeed-false title=attr-marquee-truespeed-false>false</a> state, and the
+ <var title="">delay</var> value is less than 60, then let <var title="">delay</var> be 60 instead.</li>
+
+ <li><p>The <a href=#marquee-scroll-interval>marquee scroll interval</a> is <var title="">delay</var>, interpreted in milliseconds.</li>
+
+ </ol><hr><p>A <code><a href=#the-marquee-element>marquee</a></code> element has a <dfn id=marquee-scroll-distance>marquee scroll
+ distance</dfn>, which, if the element has a <code title=attr-marquee-scrollamount>scrollamount</code> attribute, and
+ parsing its value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
+ integers</a> does not return an error, is the parsed value
+ interpreted in CSS pixels, and otherwise is 6 CSS pixels.</p>
+
+ <hr><p>A <code><a href=#the-marquee-element>marquee</a></code> element has a <dfn id=marquee-loop-count>marquee loop
+ count</dfn>, which, if the element has a <code title=attr-marquee-loop>loop</code> attribute, and parsing its
+ value using the <a href=#rules-for-parsing-integers>rules for parsing integers</a> does not
+ return an error or a number less than 1, is the parsed value, and
+ otherwise is &minus;1.</p>
+
+ <p>The <dfn id=dom-marquee-loop title=dom-marquee-loop><code>loop</code></dfn> IDL
+ attribute, on getting, must return the element's <a href=#marquee-loop-count>marquee loop
+ count</a>; and on setting, if the new value is different than the
+ element's <a href=#marquee-loop-count>marquee loop count</a> and either greater than
+ zero or equal to &minus;1, must set the element's <code title=attr-marquee-loop>loop</code> content attribute (adding it
+ if necessary) to the <a href=#valid-integer>valid integer</a> that represents the
+ new value. (Other values are ignored.)</p>
+
+ <p>A <code><a href=#the-marquee-element>marquee</a></code> element also has a <dfn id=marquee-current-loop-index>marquee current
+ loop index</dfn>, which is zero when the element is created.</p>
+
+ <p>The rendering layer will occasionally <dfn id=increment-the-marquee-current-loop-index>increment the marquee
+ current loop index</dfn>, which must cause the following steps to be
+ run:</p>
+
+ <ol><li><p>If the <a href=#marquee-loop-count>marquee loop count</a> is &minus;1, then
+ abort these steps.</p>
+
+ <li><p>Increment the <a href=#marquee-current-loop-index>marquee current loop index</a> by
+ one.</li>
+
+ <li>
+
+ <p>If the <a href=#marquee-current-loop-index>marquee current loop index</a> is now equal to
+ or greater than the element's <a href=#marquee-loop-count>marquee loop count</a>,
+ <a href=#concept-marquee-off title=concept-marquee-off>turn off</a> the
+ <code><a href=#the-marquee-element>marquee</a></code> element and <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-finish>finish</code> at the <code><a href=#the-marquee-element>marquee</a></code>
+ element.</p>
+
+ <p>Otherwise, if the <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
+ <a href=#attr-marquee-behavior-alternate title=attr-marquee-behavior-alternate>alternate</a>
+ state, then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-bounce>bounce</code> at
+ the <code><a href=#the-marquee-element>marquee</a></code> element.</p>
+
+ <p>Otherwise, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-start>start</code> at the
+ <code><a href=#the-marquee-element>marquee</a></code> element.</p>
+
+ </li>
+
+ </ol><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported, as content and IDL
+ attributes, by <code><a href=#the-marquee-element>marquee</a></code> elements:</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-marquee-onbounce title=handler-marquee-onbounce><code>onbounce</code></dfn> <td> <code title=event-bounce>bounce</code>
+ <tr><td><dfn id=handler-marquee-onfinish title=handler-marquee-onfinish><code>onfinish</code></dfn> <td> <code title=event-finish>finish</code>
+ <tr><td><dfn id=handler-marquee-onstart title=handler-marquee-onstart><code>onstart</code></dfn> <td> <code title=event-start>start</code>
+ </table><hr><p>The <dfn id=dom-marquee-behavior title=dom-marquee-behavior><code>behavior</code></dfn>, <dfn id=dom-marquee-direction title=dom-marquee-direction><code>direction</code></dfn>, <dfn id=dom-marquee-height title=dom-marquee-height><code>height</code></dfn>, <dfn id=dom-marquee-hspace title=dom-marquee-hspace><code>hspace</code></dfn>, <dfn id=dom-marquee-vspace title=dom-marquee-vspace><code>vspace</code></dfn>, and <dfn id=dom-marquee-width title=dom-marquee-width><code>width</code></dfn> IDL attributes
+ must <a href=#reflect>reflect</a> the respective content attributes of the
+ same name.</p>
+
+ <p>The <dfn id=dom-marquee-bgcolor title=dom-marquee-bgColor><code>bgColor</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-marquee-bgcolor>bgcolor</code> content attribute.</p>
+
+ <p>The <dfn id=dom-marquee-scrollamount title=dom-marquee-scrollAmount><code>scrollAmount</code></dfn>
+ IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-marquee-scrollamount>scrollamount</code> content
+ attribute. The default value is 6.</p>
+
+ <p>The <dfn id=dom-marquee-scrolldelay title=dom-marquee-scrollDelay><code>scrollDelay</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-marquee-scrolldelay>scrolldelay</code> content
+ attribute. The default value is 85.</p>
+
+ <p>The <dfn id=dom-marquee-truespeed title=dom-marquee-trueSpeed><code>trueSpeed</code></dfn> IDL
+ attribute must <a href=#reflect>reflect</a> the <code title=attr-marquee-truespeed><a href=#attr-marquee-truespeed>truespeed</a></code> content
+ attribute.</p>
+
+
+ <h4 id=frames><span class=secno>13.3.3 </span>Frames</h4>
+
+ <p>The <dfn id=frameset><code>frameset</code></dfn> element acts as <a href=#the-body-element>the
+ body element</a> in documents that use frames.</p>
+
+ <p>The <code><a href=#frameset>frameset</a></code> element must implement the
+ <code><a href=#htmlframesetelement>HTMLFrameSetElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmlframesetelement>HTMLFrameSetElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-frameset-cols title=dom-frameset-cols>cols</a>;
+ attribute DOMString <a href=#dom-frameset-rows title=dom-frameset-rows>rows</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onafterprint title=handler-window-onafterprint>onafterprint</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeprint title=handler-window-onbeforeprint>onbeforeprint</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onblur title=handler-window-onblur>onblur</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onerror title=handler-window-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onfocus title=handler-window-onfocus>onfocus</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onload title=handler-window-onload>onload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-ononline title=handler-window-ononline>ononline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpagehide title=handler-window-onpagehide>onpagehide</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpageshow title=handler-window-onpageshow>onpageshow</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onpopstate title=handler-window-onpopstate>onpopstate</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onredo title=handler-window-onredo>onredo</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onresize title=handler-window-onresize>onresize</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onstorage title=handler-window-onstorage>onstorage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onundo title=handler-window-onundo>onundo</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onunload title=handler-window-onunload>onunload</a>;
+};</pre>
+
+ <p>The <dfn id=dom-frameset-cols title=dom-frameset-cols><code>cols</code></dfn> and
+ <dfn id=dom-frameset-rows title=dom-frameset-rows><code>rows</code></dfn> IDL
+ attributes of the <code><a href=#frameset>frameset</a></code> element must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The <code><a href=#frameset>frameset</a></code> element must support the following
+ <a href=#event-handler-content-attributes>event handler content attributes</a> exposing the
+ <a href=#event-handlers>event handlers</a> of the <code><a href=#window>Window</a></code> object:</p>
+
+ <ul class=brief><li><code title=handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code></li>
+ <li><code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code></li>
+ <li><code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code></li>
+ <li><code title=handler-window-onblur><a href=#handler-window-onblur>onblur</a></code></li>
+ <li><code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code></li>
+ <li><code title=handler-window-onfocus><a href=#handler-window-onfocus>onfocus</a></code></li>
+ <li><code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code></li>
+ <li><code title=handler-window-onload><a href=#handler-window-onload>onload</a></code></li>
+ <li><code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code></li>
+ <li><code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code></li>
+ <li><code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code></li>
+ <li><code title=handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code></li>
+ <li><code title=handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code></li>
+ <li><code title=handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code></li>
+ <li><code title=handler-window-onredo><a href=#handler-window-onredo>onredo</a></code></li>
+ <li><code title=handler-window-onresize><a href=#handler-window-onresize>onresize</a></code></li>
+ <li><code title=handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code></li>
+ <li><code title=handler-window-onundo><a href=#handler-window-onundo>onundo</a></code></li>
+ <li><code title=handler-window-onunload><a href=#handler-window-onunload>onunload</a></code></li>
+ </ul><p>The DOM interface also exposes <a href=#event-handler-idl-attributes>event handler IDL
+ attributes</a> that mirror those on the <code><a href=#window>Window</a></code>
+ element.</p>
+
+ <p>The <code title=handler-window-onblur><a href=#handler-window-onblur>onblur</a></code>, <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code>, <code title=handler-window-onfocus><a href=#handler-window-onfocus>onfocus</a></code>, and <code title=handler-window-onload><a href=#handler-window-onload>onload</a></code> <a href=#event-handler-idl-attributes>event handler IDL
+ attributes</a> of the <code><a href=#window>Window</a></code> object, exposed on the
+ <code><a href=#frameset>frameset</a></code> element, shadow the generic <a href=#event-handler-idl-attributes>event
+ handler IDL attributes</a> with the same names normally supported
+ by <a href=#html-elements>HTML elements</a>.</p>
+
+ <hr><p>The <dfn id=frame><code>frame</code></dfn> element defines a <a href=#nested-browsing-context>nested
+ browsing context</a> similar to the <code><a href=#the-iframe-element>iframe</a></code> element,
+ but rendered within a <code><a href=#frameset>frameset</a></code> element.</p>
+
+ <p>When the browsing context is created, if a <code title=attr-frame-src>src</code> attribute is present, the user
+ agent must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of
+ that attribute, relative to the element, and if that is successful,
+ must then <a href=#navigate>navigate</a> the element's browsing context to
+ the resulting <a href=#absolute-url>absolute URL</a>, with <a href=#replacement-enabled>replacement
+ enabled</a>, and with the <code><a href=#frame>frame</a></code> element's
+ document's <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source
+ browsing context</a>.</p>
+
+ <p>Whenever the <code title=attr-frame-src>src</code> attribute
+ is set, the user agent must <a href=#resolve-a-url title="resolve a
+ url">resolve</a> the value of that attribute, relative to the
+ element, and if that is successful, the nested <a href=#browsing-context>browsing
+ context</a> must be <a href=#navigate title=navigate>navigated</a> to
+ the resulting <a href=#absolute-url>absolute URL</a>, with the
+ <code><a href=#frame>frame</a></code> element's document's <a href=#browsing-context>browsing
+ context</a> as the <a href=#source-browsing-context>source browsing context</a>.</p>
+
+ <p>When the browsing context is created, if a <code title=attr-frame-name>name</code> attribute is present, the
+ <a href=#browsing-context-name>browsing context name</a> must be set to the value of this
+ attribute; otherwise, the <a href=#browsing-context-name>browsing context name</a> must be
+ set to the empty string.</p>
+
+ <p>Whenever the <code title=attr-frame-name>name</code> attribute
+ is set, the nested <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-name title="browsing context name">name</a> must be changed to the new
+ value. If the attribute is removed, the <a href=#browsing-context-name>browsing context
+ name</a> must be set to the empty string.</p>
+
+ <p>When content loads in a <code><a href=#frame>frame</a></code>, after any <code title=event-load>load</code> events are fired within the content
+ itself, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
+ a simple event</a> named <code title=event-load>load</code> at
+ the <code><a href=#frame>frame</a></code> element. When content fails to load (e.g. due
+ to a network error), then the user agent must <a href=#queue-a-task>queue a
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the element instead.</p>
+
+ <p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> above is the <a href=#dom-manipulation-task-source>DOM
+ manipulation task source</a>.</p>
+
+ <p>When there is an <a href=#active-parser>active parser</a> in the
+ <code><a href=#frame>frame</a></code>, and when anything in the <code><a href=#frame>frame</a></code> is
+ <a href=#delay-the-load-event title="delay the load event">delaying the load event</a> of
+ the <code><a href=#frame>frame</a></code>'s <a href=#browsing-context>browsing context</a>'s
+ <a href=#active-document>active document</a>, the <code><a href=#frame>frame</a></code> must
+ <a href=#delay-the-load-event>delay the load event</a> of its document.</p>
+
+ <p>The <code><a href=#frame>frame</a></code> element must implement the
+ <code><a href=#htmlframeelement>HTMLFrameElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmlframeelement>HTMLFrameElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-frame-frameborder title=dom-frame-frameBorder>frameBorder</a>;
+ attribute DOMString <a href=#dom-frame-longdesc title=dom-frame-longDesc>longDesc</a>;
+ attribute DOMString <a href=#dom-frame-marginheight title=dom-frame-marginHeight>marginHeight</a>;
+ attribute DOMString <a href=#dom-frame-marginwidth title=dom-frame-marginWidth>marginWidth</a>;
+ attribute DOMString <a href=#dom-frame-name title=dom-frame-name>name</a>;
+ attribute boolean <a href=#dom-frame-noresize title=dom-frame-noResize>noResize</a>;
+ attribute DOMString <a href=#dom-frame-scrolling title=dom-frame-scrolling>scrolling</a>;
+ attribute DOMString <a href=#dom-frame-src title=dom-frame-src>src</a>;
+ readonly attribute Document <a href=#dom-frame-contentdocument title=dom-frame-contentDocument>contentDocument</a>;
+};</pre>
+
+ <p>The <dfn id=dom-frame-name title=dom-frame-name><code>name</code></dfn>, <dfn id=dom-frame-scrolling title=dom-frame-scrolling><code>scrolling</code></dfn>, and <dfn id=dom-frame-src title=dom-frame-src><code>src</code></dfn> IDL attributes of the
+ <code><a href=#frame>frame</a></code> element must <a href=#reflect>reflect</a> the respective
+ content attributes of the same name.</p>
+
+ <p>The <dfn id=dom-frame-frameborder title=dom-frame-frameBorder><code>frameBorder</code></dfn> IDL
+ attribute of the <code><a href=#frame>frame</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-frame-frameborder>frameborder</code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-frame-longdesc title=dom-frame-longDesc><code>longDesc</code></dfn>
+ IDL attribute of the <code><a href=#frame>frame</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-frame-longdesc>longdesc</code> content attribute.</p>
+
+ <p>The <dfn id=dom-frame-marginheight title=dom-frame-marginHeight><code>marginHeight</code></dfn> IDL
+ attribute of the <code><a href=#frame>frame</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-frame-marginheight>marginheight</code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-frame-marginwidth title=dom-frame-marginWidth><code>marginWidth</code></dfn> IDL
+ attribute of the <code><a href=#frame>frame</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-frame-marginwidth>marginwidth</code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-frame-noresize title=dom-frame-noResize><code>noResize</code></dfn>
+ IDL attribute of the <code><a href=#frame>frame</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-frame-noresize>noresize</code> content attribute.</p>
+
+ <p>The <dfn id=dom-frame-contentdocument title=dom-frame-contentDocument><code>contentDocument</code></dfn>
+ IDL attribute of the <code><a href=#frame>frame</a></code> element must return the
+ <code><a href=#document>Document</a></code> object of the <a href=#active-document>active document</a> of
+ the <code><a href=#frame>frame</a></code> element's <a href=#nested-browsing-context>nested browsing
+ context</a>.</p>
+
+
+
+ <h4 id=other-elements,-attributes-and-apis><span class=secno>13.3.4 </span>Other elements, attributes and APIs</h4> <!-- alphabetical by name and attribute -->
+
+ <p>User agents must treat <code><a href=#acronym>acronym</a></code> elements in a manner
+ equivalent to <code><a href=#the-abbr-element>abbr</a></code> elements.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlanchorelement>HTMLAnchorElement</a> {
+ attribute DOMString <a href=#dom-a-coords title=dom-a-coords>coords</a>;
+ attribute DOMString <a href=#dom-a-charset title=dom-a-charset>charset</a>;
+ attribute DOMString <a href=#dom-a-name title=dom-a-name>name</a>;
+ attribute DOMString <a href=#dom-a-rev title=dom-a-rev>rev</a>;
+ attribute DOMString <a href=#dom-a-shape title=dom-a-shape>shape</a>;
+};</pre>
+
+ <p>The <dfn id=dom-a-coords title=dom-a-coords><code>coords</code></dfn>, <dfn id=dom-a-charset title=dom-a-charset><code>charset</code></dfn>, <dfn id=dom-a-name title=dom-a-name><code>name</code></dfn>, <dfn id=dom-a-rev title=dom-a-rev><code>rev</code></dfn>, and <dfn id=dom-a-shape title=dom-a-shape><code>shape</code></dfn> IDL attributes of the
+ <code><a href=#the-a-element>a</a></code> element must <a href=#reflect>reflect</a> the respective
+ content attributes of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlareaelement>HTMLAreaElement</a> {
+ attribute boolean <a href=#dom-area-nohref title=dom-area-noHref>noHref</a>;
+};</pre>
+
+ <p>The <dfn id=dom-area-nohref title=dom-area-noHref><code>noHref</code></dfn> IDL
+ attribute of the <code><a href=#the-area-element>area</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-area-nohref><a href=#attr-area-nohref>nohref</a></code> content
+ attribute.</p>
+
+ <hr><p>The <code><a href=#basefont>basefont</a></code> element must implement the
+ <code><a href=#htmlbasefontelement>HTMLBaseFontElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmlbasefontelement>HTMLBaseFontElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-basefont-color title=dom-basefont-color>color</a>;
+ attribute DOMString <a href=#dom-basefont-face title=dom-basefont-face>face</a>;
+ attribute long <a href=#dom-basefont-size title=dom-basefont-size>size</a>; <!-- yes, long, not DOMString (so says DOM2 HTML) -->
+};</pre>
+
+ <p>The <dfn id=dom-basefont-color title=dom-basefont-color><code>color</code></dfn>,
+ <dfn id=dom-basefont-face title=dom-basefont-face><code>face</code></dfn>, and <dfn id=dom-basefont-size title=dom-basefont-size><code>size</code></dfn> IDL attributes of
+ the <code><a href=#basefont>basefont</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlbodyelement>HTMLBodyElement</a> {
+ attribute DOMString <a href=#dom-body-text title=dom-body-text>text</a>;
+ attribute DOMString <a href=#dom-body-bgcolor title=dom-body-bgColor>bgColor</a>;
+ attribute DOMString <a href=#dom-body-background title=dom-body-background>background</a>;
+ attribute DOMString <a href=#dom-body-link title=dom-body-link>link</a>;
+ attribute DOMString <a href=#dom-body-vlink title=dom-body-vLink>vLink</a>;
+ attribute DOMString <a href=#dom-body-alink title=dom-body-aLink>aLink</a>;
+};</pre>
+
+ <p>The <dfn id=dom-body-text title=dom-body-text><code>text</code></dfn> IDL
+ attribute of the <code><a href=#the-body-element-0>body</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-body-text><a href=#attr-body-text>text</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-body-bgcolor title=dom-body-bgColor><code>bgColor</code></dfn> IDL
+ attribute of the <code><a href=#the-body-element-0>body</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-body-bgcolor><a href=#attr-body-bgcolor>bgcolor</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-body-background title=dom-body-background><code>background</code></dfn> IDL
+ attribute of the <code><a href=#the-body-element-0>body</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-background><a href=#attr-background>background</a></code>
+ content attribute. (The <code title=attr-background><a href=#attr-background>background</a></code> content is <em>not</em>
+ defined to contain a <a href=#url>URL</a>, despite rules regarding its
+ handling in the rendering section above.)</p>
+
+ <p>The <dfn id=dom-body-link title=dom-body-link><code>link</code></dfn> IDL
+ attribute of the <code><a href=#the-body-element-0>body</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-body-link><a href=#attr-body-link>link</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-body-alink title=dom-body-aLink><code>aLink</code></dfn> IDL
+ attribute of the <code><a href=#the-body-element-0>body</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-body-alink><a href=#attr-body-alink>alink</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-body-vlink title=dom-body-vLink><code>vLink</code></dfn> IDL
+ attribute of the <code><a href=#the-body-element-0>body</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-body-vlink><a href=#attr-body-vlink>vlink</a></code> content
+ attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlbrelement>HTMLBRElement</a> {
+ attribute DOMString <a href=#dom-br-clear title=dom-br-clear>clear</a>;
+};</pre>
+
+ <p>The <dfn id=dom-br-clear title=dom-br-clear><code>clear</code></dfn> IDL
+ attribute of the <code><a href=#the-br-element>br</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmltablecaptionelement>HTMLTableCaptionElement</a> {
+ attribute DOMString <a href=#dom-caption-align title=dom-caption-align>align</a>;
+};</pre>
+
+ <p>The <dfn id=dom-caption-align title=dom-caption-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-caption-element>caption</a></code> element must
+ <a href=#reflect>reflect</a> the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmltablecolelement>HTMLTableColElement</a> {
+ attribute DOMString <a href=#dom-col-align title=dom-col-align>align</a>;
+ attribute DOMString <a href=#dom-col-ch title=dom-col-ch>ch</a>;
+ attribute DOMString <a href=#dom-col-choff title=dom-col-chOff>chOff</a>;
+ attribute DOMString <a href=#dom-col-valign title=dom-col-vAlign>vAlign</a>;
+ attribute DOMString <a href=#dom-col-width title=dom-col-width>width</a>;
+};</pre>
+
+ <p>The <dfn id=dom-col-align title=dom-col-align><code>align</code></dfn> and <dfn id=dom-col-width title=dom-col-width><code>width</code></dfn> IDL attributes of
+ the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <p>The <dfn id=dom-col-ch title=dom-col-ch><code>ch</code></dfn> IDL attribute
+ of the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a> the
+ element's <code title=attr-col-char><a href=#attr-col-char>char</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-col-choff title=dom-col-chOff><code>chOff</code></dfn> IDL
+ attribute of the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-col-charoff><a href=#attr-col-charoff>charoff</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-col-valign title=dom-col-vAlign><code>vAlign</code></dfn> IDL
+ attribute of the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-col-valign><a href=#attr-col-valign>valign</a></code> content
+ attribute.</p>
+
+ <hr><p>User agents must treat <code><a href=#dir>dir</a></code> elements in a manner
+ equivalent to <code><a href=#the-ul-element>ul</a></code> elements.</p>
+
+ <p>The <code><a href=#dir>dir</a></code> element must implement the
+ <code><a href=#htmldirectoryelement>HTMLDirectoryElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmldirectoryelement>HTMLDirectoryElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute boolean <a href=#dom-dir-compact title=dom-dir-compact>compact</a>;
+};</pre>
+
+ <p>The <dfn id=dom-dir-compact title=dom-dir-compact><code>compact</code></dfn> IDL
+ attribute of the <code><a href=#dir>dir</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmldivelement>HTMLDivElement</a> {
+ attribute DOMString <a href=#dom-div-align title=dom-div-align>align</a>;
+};</pre>
+
+ <p>The <dfn id=dom-div-align title=dom-div-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-div-element>div</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmldlistelement>HTMLDListElement</a> {
+ attribute boolean <a href=#dom-dl-compact title=dom-dl-compact>compact</a>;
+};</pre>
+
+ <p>The <dfn id=dom-dl-compact title=dom-dl-compact><code>compact</code></dfn> IDL
+ attribute of the <code><a href=#the-dl-element>dl</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlembedelement>HTMLEmbedElement</a> {
+ attribute DOMString <a href=#dom-embed-align title=dom-embed-align>align</a>;
+ attribute DOMString <a href=#dom-embed-name title=dom-embed-name>name</a>;
+};</pre>
+
+ <p>The <dfn id=dom-embed-name title=dom-embed-name><code>name</code></dfn> and <dfn id=dom-embed-align title=dom-embed-align><code>align</code></dfn> IDL attributes of
+ the <code><a href=#the-embed-element>embed</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <hr><p>The <code><a href=#font>font</a></code> element must implement the
+ <code><a href=#htmlfontelement>HTMLFontElement</a></code> interface.</p>
+
+ <pre class=idl>interface <dfn id=htmlfontelement>HTMLFontElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute DOMString <a href=#dom-font-color title=dom-font-color>color</a>;
+ attribute DOMString <a href=#dom-font-face title=dom-font-face>face</a>;
+ attribute DOMString <a href=#dom-font-size title=dom-font-size>size</a>; <!-- yes, DOMString, not long (so says DOM2 HTML) -->
+};</pre>
+
+ <p>The <dfn id=dom-font-color title=dom-font-color><code>color</code></dfn>,
+ <dfn id=dom-font-face title=dom-font-face><code>face</code></dfn>, and <dfn id=dom-font-size title=dom-font-size><code>size</code></dfn> IDL attributes of
+ the <code><a href=#font>font</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlheadingelement>HTMLHeadingElement</a> {
+ attribute DOMString <a href=#dom-hx-align title=dom-hx-align>align</a>;
+};</pre>
+
+ <p>The <dfn id=dom-hx-align title=dom-hx-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements must
+ <a href=#reflect>reflect</a> the content attribute of the same name.</p>
+
+ <hr><p class=note>The <dfn id=dom-head-profile title=dom-head-profile><code>profile</code></dfn> IDL attribute on
+ <code><a href=#the-head-element-0>head</a></code> elements (with the <code><a href=#htmlheadelement>HTMLHeadElement</a></code>
+ interface) is intentionally omitted. Unless so required by <a href=#other-applicable-specifications title="other applicable specifications">another applicable
+ specification</a>, implementations would therefore not support
+ this attribute. (It is mentioned here as it was defined in a
+ previous version of the DOM specifications.)</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlhrelement>HTMLHRElement</a> {
+ attribute DOMString <a href=#dom-hr-align title=dom-hr-align>align</a>;
+ attribute DOMString <a href=#dom-hr-color title=dom-hr-color>color</a>;
+ attribute boolean <a href=#dom-hr-noshade title=dom-hr-noShade>noShade</a>;
+ attribute DOMString <a href=#dom-hr-size title=dom-hr-size>size</a>;
+ attribute DOMString <a href=#dom-hr-width title=dom-hr-width>width</a>;
+};</pre>
+
+ <p>The <dfn id=dom-hr-align title=dom-hr-align><code>align</code></dfn>, <dfn id=dom-hr-color title=dom-hr-color><code>color</code></dfn>, <dfn id=dom-hr-size title=dom-hr-size><code>size</code></dfn>, and <dfn id=dom-hr-width title=dom-hr-width><code>width</code></dfn> IDL attributes of the
+ <code><a href=#the-hr-element>hr</a></code> element must <a href=#reflect>reflect</a> the respective
+ content attributes of the same name.</p>
+
+ <p>The <dfn id=dom-hr-noshade title=dom-hr-noShade><code>noShade</code></dfn> IDL
+ attribute of the <code><a href=#the-hr-element>hr</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-input-noshade>noshade</code>
+ content attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlhtmlelement>HTMLHtmlElement</a> {
+ attribute DOMString <a href=#dom-html-version title=dom-html-version>version</a>;
+};</pre>
+
+ <p>The <dfn id=dom-html-version title=dom-html-version><code>version</code></dfn> IDL
+ attribute of the <code><a href=#the-html-element-0>html</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmliframeelement>HTMLIFrameElement</a> {
+ attribute DOMString <a href=#dom-iframe-align title=dom-iframe-align>align</a>;
+ attribute DOMString <a href=#dom-iframe-frameborder title=dom-iframe-frameBorder>frameBorder</a>;
+ attribute DOMString <a href=#dom-iframe-longdesc title=dom-iframe-longDesc>longDesc</a>;
+ attribute DOMString <a href=#dom-iframe-marginheight title=dom-iframe-marginHeight>marginHeight</a>;
+ attribute DOMString <a href=#dom-iframe-marginwidth title=dom-iframe-marginWidth>marginWidth</a>;
+ attribute DOMString <a href=#dom-iframe-scrolling title=dom-iframe-scrolling>scrolling</a>;
+};</pre>
+
+ <p>The <dfn id=dom-iframe-align title=dom-iframe-align><code>align</code></dfn> and
+ <dfn id=dom-iframe-scrolling title=dom-iframe-scrolling><code>scrolling</code></dfn> IDL
+ attributes of the <code><a href=#the-iframe-element>iframe</a></code> element must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The <dfn id=dom-iframe-frameborder title=dom-iframe-frameBorder><code>frameBorder</code></dfn> IDL
+ attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-iframe-frameborder><a href=#attr-iframe-frameborder>frameborder</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-iframe-longdesc title=dom-iframe-longDesc><code>longDesc</code></dfn>
+ IDL attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-iframe-longdesc><a href=#attr-iframe-longdesc>longdesc</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-iframe-marginheight title=dom-iframe-marginHeight><code>marginHeight</code></dfn> IDL
+ attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-iframe-marginwidth title=dom-iframe-marginWidth><code>marginWidth</code></dfn> IDL
+ attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> content
+ attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlimageelement>HTMLImageElement</a> {
+ attribute DOMString <a href=#dom-img-name title=dom-img-name>name</a>;
+ attribute DOMString <a href=#dom-img-align title=dom-img-align>align</a>;
+ attribute DOMString <a href=#dom-img-border title=dom-img-border>border</a>;
+ attribute unsigned long <a href=#dom-img-hspace title=dom-img-hspace>hspace</a>;
+ attribute DOMString <a href=#dom-img-longdesc title=dom-img-longDesc>longDesc</a>;
+ attribute unsigned long <a href=#dom-img-vspace title=dom-img-vspace>vspace</a>;
+};</pre>
+
+ <p>The <dfn id=dom-img-name title=dom-img-name><code>name</code></dfn>, <dfn id=dom-img-align title=dom-img-align><code>align</code></dfn>, <dfn id=dom-img-border title=dom-img-border><code>border</code></dfn>, <dfn id=dom-img-hspace title=dom-img-hspace><code>hspace</code></dfn>, and <dfn id=dom-img-vspace title=dom-img-vspace><code>vspace</code></dfn> IDL attributes of
+ the <code><a href=#the-img-element>img</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <p>The <dfn id=dom-img-longdesc title=dom-img-longDesc><code>longDesc</code></dfn> IDL
+ attribute of the <code><a href=#the-img-element>img</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-img-longdesc><a href=#attr-img-longdesc>longdesc</a></code> content
+ attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlinputelement>HTMLInputElement</a> {
+ attribute DOMString <a href=#dom-input-align title=dom-input-align>align</a>;
+ attribute DOMString <a href=#dom-input-usemap title=dom-input-useMap>useMap</a>;
+};</pre>
+
+ <p>The <dfn id=dom-input-align title=dom-input-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-input-element>input</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <p>The <dfn id=dom-input-usemap title=dom-input-useMap><code>useMap</code></dfn> IDL
+ attribute of the <code><a href=#the-input-element>input</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-input-usemap><a href=#attr-input-usemap>usemap</a></code> content attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmllegendelement>HTMLLegendElement</a> {
+ attribute DOMString <a href=#dom-legend-align title=dom-legend-align>align</a>;
+};</pre>
+
+ <p>The <dfn id=dom-legend-align title=dom-legend-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-legend-element>legend</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmllielement>HTMLLIElement</a> {
+ attribute DOMString <a href=#dom-li-type title=dom-li-type>type</a>;
+};</pre>
+
+ <p>The <dfn id=dom-li-type title=dom-li-type><code>type</code></dfn> IDL
+ attribute of the <code><a href=#the-li-element>li</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmllinkelement>HTMLLinkElement</a> {
+ attribute DOMString <a href=#dom-link-charset title=dom-link-charset>charset</a>;
+ attribute DOMString <a href=#dom-link-rev title=dom-link-rev>rev</a>;
+ attribute DOMString <a href=#dom-link-target title=dom-link-target>target</a>;
+};</pre>
+
+ <p>The <dfn id=dom-link-charset title=dom-link-charset><code>charset</code></dfn>,
+ <dfn id=dom-link-rev title=dom-link-rev><code>rev</code></dfn>, and <dfn id=dom-link-target title=dom-link-target><code>target</code></dfn> IDL attributes of
+ the <code><a href=#the-link-element>link</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <hr><p>User agents must treat <code><a href=#listing>listing</a></code> elements in a manner
+ equivalent to <code><a href=#the-pre-element>pre</a></code> elements.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlmenuelement>HTMLMenuElement</a> {
+ attribute boolean <a href=#dom-menu-compact title=dom-menu-compact>compact</a>;
+};</pre>
+
+ <p>The <dfn id=dom-menu-compact title=dom-menu-compact><code>compact</code></dfn> IDL
+ attribute of the <code><a href=#menus>menu</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlmetaelement>HTMLMetaElement</a> {
+ attribute DOMString <a href=#dom-meta-scheme title=dom-meta-scheme>scheme</a>;
+};</pre>
+
+ <p>User agents may treat the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> content attribute on the
+ <code><a href=#meta>meta</a></code> element as an extension of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> content attribute when processing
+ a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute whose value is one that
+ the user agent recognizes as supporting the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute.</p>
+
+ <p>User agents are encouraged to ignore the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute and instead process
+ the value given to the metadata name as if it had been specified for
+ each expected value of the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute.</p>
+
+ <div class=example>
+
+ <p>For example, if the user agent acts on <code><a href=#meta>meta</a></code>
+ elements with <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attributes
+ having the value "eGMS.subject.keyword", and knows that the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute is used with this
+ metadata name, then it could take the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute into account,
+ acting as if it was an extension of the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute. Thus the following
+ two <code><a href=#meta>meta</a></code> elements could be treated as two elements
+ giving values for two different metadata names, one consisting of a
+ combination of "eGMS.subject.keyword" and "LGCL", and the other
+ consisting of a combination of "eGMS.subject.keyword" and
+ "ORLY":</p>
+
+ <pre class=bad>&lt;!-- this markup is invalid --&gt;
+&lt;meta name="eGMS.subject.keyword" scheme="LGCL" content="Abandoned vehicles"&gt;
+&lt;meta name="eGMS.subject.keyword" scheme="ORLY" content="Mah car: kthxbye"&gt;</pre>
+
+ <p>The recommended processing of this markup, however, would be
+ equivalent to the following:</p>
+
+ <pre>&lt;meta name="eGMS.subject.keyword" content="Abandoned vehicles"&gt;
+&lt;meta name="eGMS.subject.keyword" content="Mah car: kthxbye"&gt;</pre>
+
+ </div>
+
+ <p>The <dfn id=dom-meta-scheme title=dom-meta-scheme><code>scheme</code></dfn> IDL
+ attribute of the <code><a href=#meta>meta</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlobjectelement>HTMLObjectElement</a> {
+ attribute DOMString <a href=#dom-object-align title=dom-object-align>align</a>;
+ attribute DOMString <a href=#dom-object-archive title=dom-object-archive>archive</a>;
+ attribute DOMString <a href=#dom-object-border title=dom-object-border>border</a>;
+ attribute DOMString <a href=#dom-object-code title=dom-object-code>code</a>;
+ attribute DOMString <a href=#dom-object-codebase title=dom-object-codeBase>codeBase</a>;
+ attribute DOMString <a href=#dom-object-codetype title=dom-object-codeType>codeType</a>;
+ attribute boolean <a href=#dom-object-declare title=dom-object-declare>declare</a>;
+ attribute unsigned long <a href=#dom-object-hspace title=dom-object-hspace>hspace</a>;
+ attribute DOMString <a href=#dom-object-standby title=dom-object-standby>standby</a>;
+ attribute unsigned long <a href=#dom-object-vspace title=dom-object-vspace>vspace</a>;
+};</pre>
+
+ <p>The <dfn id=dom-object-align title=dom-object-align><code>align</code></dfn>, <dfn id=dom-object-archive title=dom-object-archive><code>archive</code></dfn>, <dfn id=dom-object-border title=dom-object-border><code>border</code></dfn>, <dfn id=dom-object-code title=dom-object-code><code>code</code></dfn>, <dfn id=dom-object-declare title=dom-object-declare><code>declare</code></dfn>, <dfn id=dom-object-hspace title=dom-object-hspace><code>hspace</code></dfn>, <dfn id=dom-object-standby title=dom-object-standby><code>standby</code></dfn>, and <dfn id=dom-object-vspace title=dom-object-vspace><code>vspace</code></dfn> IDL attributes
+ of the <code><a href=#the-object-element>object</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <p>The <dfn id=dom-object-codebase title=dom-object-codeBase><code>codeBase</code></dfn> IDL
+ attribute of the <code><a href=#the-object-element>object</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-object-codebase><a href=#attr-object-codebase>codebase</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-object-codetype title=dom-object-codeType><code>codeType</code></dfn> IDL
+ attribute of the <code><a href=#the-object-element>object</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-object-codetype><a href=#attr-object-codetype>codetype</a></code> content
+ attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlolistelement>HTMLOListElement</a> {
+ attribute boolean <a href=#dom-ol-compact title=dom-ol-compact>compact</a>;
+ attribute DOMString <a href=#dom-ol-type title=dom-ol-type>type</a>;
+};</pre>
+
+ <p>The <dfn id=dom-ol-compact title=dom-ol-compact><code>compact</code></dfn> and
+ <dfn id=dom-ol-type title=dom-ol-type><code>type</code></dfn> IDL attributes of
+ the <code><a href=#the-ol-element>ol</a></code> element must <a href=#reflect>reflect</a> the respective
+ content attributes of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlparagraphelement>HTMLParagraphElement</a> {
+ attribute DOMString <a href=#dom-p-align title=dom-p-align>align</a>;
+};</pre>
+
+ <p>The <dfn id=dom-p-align title=dom-p-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-p-element>p</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlparamelement>HTMLParamElement</a> {
+ attribute DOMString <a href=#dom-param-type title=dom-param-type>type</a>;
+ attribute DOMString <a href=#dom-param-valuetype title=dom-param-valueType>valueType</a>;
+};</pre>
+
+ <p>The <dfn id=dom-param-type title=dom-param-type><code>type</code></dfn> IDL
+ attribute of the <code><a href=#the-param-element>param</a></code> element must
+ <a href=#reflect>reflect</a> the content attribute of the same name.</p>
+
+ <p>The <dfn id=dom-param-valuetype title=dom-param-valueType><code>valueType</code></dfn>
+ IDL attribute of the <code><a href=#the-param-element>param</a></code> element must
+ <a href=#reflect>reflect</a> the element's <code title=attr-param-valuetype><a href=#attr-param-valuetype>valuetype</a></code> content attribute.</p>
+
+ <hr><p>User agents must treat <code><a href=#plaintext>plaintext</a></code> elements in a
+ manner equivalent to <code><a href=#the-pre-element>pre</a></code> elements.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlpreelement>HTMLPreElement</a> {
+ attribute unsigned long <a href=#dom-pre-width title=dom-pre-width>width</a>;
+};</pre>
+
+ <p>The <dfn id=dom-pre-width title=dom-pre-width><code>width</code></dfn> IDL
+ attribute of the <code><a href=#the-pre-element>pre</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlscriptelement>HTMLScriptElement</a> {
+ attribute DOMString <a href=#dom-script-event title=dom-script-event>event</a>;
+ attribute DOMString <a href=#dom-script-htmlfor title=dom-script-htmlFor>htmlFor</a>;
+};</pre>
+
+ <p>The <dfn id=dom-script-event title=dom-script-event><code>event</code></dfn> and
+ <dfn id=dom-script-htmlfor title=dom-script-htmlFor><code>htmlFor</code></dfn> IDL
+ attributes of the <code><a href=#script>script</a></code> element must return the empty
+ string on getting, and do nothing on setting.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmltableelement>HTMLTableElement</a> {
+ attribute DOMString <a href=#dom-table-align title=dom-table-align>align</a>;
+ attribute DOMString <a href=#dom-table-bgcolor title=dom-table-bgColor>bgColor</a>;
+ attribute DOMString <a href=#dom-table-border title=dom-table-border>border</a>;
+ attribute DOMString <a href=#dom-table-cellpadding title=dom-table-cellPadding>cellPadding</a>;
+ attribute DOMString <a href=#dom-table-cellspacing title=dom-table-cellSpacing>cellSpacing</a>;
+ attribute DOMString <a href=#dom-table-frame title=dom-table-frame>frame</a>;
+ attribute DOMString <a href=#dom-table-rules title=dom-table-rules>rules</a>;
+ attribute DOMString <a href=#dom-table-width title=dom-table-width>width</a>;
+};</pre>
+
+ <p>The <dfn id=dom-table-align title=dom-table-align><code>align</code></dfn>, <dfn id=dom-table-border title=dom-table-border><code>border</code></dfn>, <dfn id=dom-table-frame title=dom-table-frame><code>frame</code></dfn>, <dfn id=dom-table-rules title=dom-table-rules><code>rules</code></dfn>, and <dfn id=dom-table-width title=dom-table-width><code>width</code></dfn>, IDL attributes of
+ the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name.</p>
+
+ <p>The <dfn id=dom-table-bgcolor title=dom-table-bgColor><code>bgColor</code></dfn> IDL
+ attribute of the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-table-bgcolor><a href=#attr-table-bgcolor>bgcolor</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-table-cellpadding title=dom-table-cellPadding><code>cellPadding</code></dfn> IDL
+ attribute of the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-table-cellspacing title=dom-table-cellSpacing><code>cellSpacing</code></dfn> IDL
+ attribute of the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code> content
+ attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmltablesectionelement>HTMLTableSectionElement</a> {
+ attribute DOMString <a href=#dom-tbody-align title=dom-tbody-align>align</a>;
+ attribute DOMString <a href=#dom-tbody-ch title=dom-tbody-ch>ch</a>;
+ attribute DOMString <a href=#dom-tbody-choff title=dom-tbody-chOff>chOff</a>;
+ attribute DOMString <a href=#dom-tbody-valign title=dom-tbody-vAlign>vAlign</a>;
+};</pre>
+
+ <p>The <dfn id=dom-tbody-align title=dom-tbody-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
+ <code><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect>reflect</a> the content
+ attribute of the same name.</p>
+
+ <p>The <dfn id=dom-tbody-ch title=dom-tbody-ch><code>ch</code></dfn> IDL attribute
+ of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
+ <code><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect>reflect</a> the elements'
+ <code title=attr-tbody-char><a href=#attr-tbody-char>char</a></code> content attributes.</p>
+
+ <p>The <dfn id=dom-tbody-choff title=dom-tbody-chOff><code>chOff</code></dfn> IDL
+ attribute of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
+ <code><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect>reflect</a> the elements'
+ <code title=attr-tbody-charoff><a href=#attr-tbody-charoff>charoff</a></code> content attributes.</p>
+
+ <p>The <dfn id=dom-tbody-valign title=dom-tbody-vAlign><code>vAlign</code></dfn> IDL
+ attribute of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
+ <code><a href=#the-tfoot-element>tfoot</a></code> element must <a href=#reflect>reflect</a> the elements'
+ <code title=attr-tbody-valign><a href=#attr-tbody-valign>valign</a></code> content
+ attributes.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmltablecellelement>HTMLTableCellElement</a> {
+ attribute DOMString <a href=#dom-tdth-abbr title=dom-tdth-abbr>abbr</a>;
+ attribute DOMString <a href=#dom-tdth-align title=dom-tdth-align>align</a>;
+ attribute DOMString <a href=#dom-tdth-axis title=dom-tdth-axis>axis</a>;
+ attribute DOMString <a href=#dom-tdth-bgcolor title=dom-tdth-bgColor>bgColor</a>;
+ attribute DOMString <a href=#dom-tdth-ch title=dom-tdth-ch>ch</a>;
+ attribute DOMString <a href=#dom-tdth-choff title=dom-tdth-chOff>chOff</a>;
+ attribute DOMString <a href=#dom-tdth-height title=dom-tdth-height>height</a>;
+ attribute boolean <a href=#dom-tdth-nowrap title=dom-tdth-noWrap>noWrap</a>;
+ attribute DOMString <a href=#dom-tdth-valign title=dom-tdth-vAlign>vAlign</a>;
+ attribute DOMString <a href=#dom-tdth-width title=dom-tdth-width>width</a>;
+};</pre>
+
+ <p>The <dfn id=dom-tdth-abbr title=dom-tdth-abbr><code>abbr</code></dfn>, <dfn id=dom-tdth-align title=dom-tdth-align><code>align</code></dfn>, <dfn id=dom-tdth-axis title=dom-tdth-axis><code>axis</code></dfn>, <dfn id=dom-tdth-height title=dom-tdth-height><code>height</code></dfn>, and <dfn id=dom-tdth-width title=dom-tdth-width><code>width</code></dfn> IDL attributes of
+ the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
+ <a href=#reflect>reflect</a> the respective content attributes of the same
+ name.</p>
+
+ <p>The <dfn id=dom-tdth-bgcolor title=dom-tdth-bgColor><code>bgColor</code></dfn> IDL
+ attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
+ <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-bgcolor><a href=#attr-tdth-bgcolor>bgcolor</a></code> content attributes.</p>
+
+ <p>The <dfn id=dom-tdth-ch title=dom-tdth-ch><code>ch</code></dfn> IDL
+ attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
+ <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-char><a href=#attr-tdth-char>char</a></code> content attributes.</p>
+
+ <p>The <dfn id=dom-tdth-choff title=dom-tdth-chOff><code>chOff</code></dfn> IDL
+ attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
+ <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-charoff><a href=#attr-tdth-charoff>charoff</a></code> content attributes.</p>
+
+ <p>The <dfn id=dom-tdth-nowrap title=dom-tdth-noWrap><code>noWrap</code></dfn> IDL
+ attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
+ <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-nowrap><a href=#attr-tdth-nowrap>nowrap</a></code> content attributes.</p>
+
+ <p>The <dfn id=dom-tdth-valign title=dom-tdth-vAlign><code>vAlign</code></dfn> IDL
+ attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> element must
+ <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-valign><a href=#attr-tdth-valign>valign</a></code> content attributes.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmltablerowelement>HTMLTableRowElement</a> {
+ attribute DOMString <a href=#dom-tr-align title=dom-tr-align>align</a>;
+ attribute DOMString <a href=#dom-tr-bgcolor title=dom-tr-bgColor>bgColor</a>;
+ attribute DOMString <a href=#dom-tr-ch title=dom-tr-ch>ch</a>;
+ attribute DOMString <a href=#dom-tr-choff title=dom-tr-chOff>chOff</a>;
+ attribute DOMString <a href=#dom-tr-valign title=dom-tr-vAlign>vAlign</a>;
+};</pre>
+
+ <p>The <dfn id=dom-tr-align title=dom-tr-align><code>align</code></dfn> IDL
+ attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
+ the content attribute of the same name.</p>
+
+ <p>The <dfn id=dom-tr-bgcolor title=dom-tr-bgColor><code>bgColor</code></dfn> IDL
+ attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-tr-bgcolor><a href=#attr-tr-bgcolor>bgcolor</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-tr-ch title=dom-tr-ch><code>ch</code></dfn> IDL attribute of
+ the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a> the element's
+ <code title=attr-tr-char><a href=#attr-tr-char>char</a></code> content attribute.</p>
+
+ <p>The <dfn id=dom-tr-choff title=dom-tr-chOff><code>chOff</code></dfn> IDL
+ attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-tr-charoff><a href=#attr-tr-charoff>charoff</a></code> content
+ attribute.</p>
+
+ <p>The <dfn id=dom-tr-valign title=dom-tr-vAlign><code>vAlign</code></dfn> IDL
+ attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
+ the element's <code title=attr-tr-valign><a href=#attr-tr-valign>valign</a></code> content
+ attribute.</p>
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmlulistelement>HTMLUListElement</a> {
+ attribute boolean <a href=#dom-ul-compact title=dom-ul-compact>compact</a>;
+ attribute DOMString <a href=#dom-ul-type title=dom-ul-type>type</a>;
+};</pre>
+
+ <p>The <dfn id=dom-ul-compact title=dom-ul-compact><code>compact</code></dfn> and
+ <dfn id=dom-ul-type title=dom-ul-type><code>type</code></dfn> IDL attributes of
+ the <code><a href=#the-ul-element>ul</a></code> element must <a href=#reflect>reflect</a> the respective
+ content attributes of the same name.</p>
+
+ <hr><p>User agents must treat <code><a href=#xmp>xmp</a></code> elements in a manner
+ equivalent to <code><a href=#the-pre-element>pre</a></code> elements.</p>
+
+ <hr><p>The <code><a href=#bgsound>bgsound</a></code>, <code><a href=#isindex-0>isindex</a></code>,
+ <code><a href=#multicol>multicol</a></code>, <code><a href=#nextid>nextid</a></code>, <code><a href=#rb>rb</a></code>, and
+ <code><a href=#spacer>spacer</a></code> elements must use the
+ <code><a href=#htmlunknownelement>HTMLUnknownElement</a></code> interface.</p> <!-- has to be
+ explicitly listed because technically we define the elements in the
+ spec, albeit as obsolete, and then we say that only elements not
+ defined in this spec use HTMLUnknownElement. -->
+
+ <hr><pre class=idl>[Supplemental]
+interface <a href=#htmldocument>HTMLDocument</a> {
+ attribute DOMString <a href=#dom-document-fgcolor title=dom-document-fgColor>fgColor</a>;
+ attribute DOMString <a href=#dom-document-bgcolor title=dom-document-bgColor>bgColor</a>;
+ attribute DOMString <a href=#dom-document-linkcolor title=dom-document-linkColor>linkColor</a>;
+ attribute DOMString <a href=#dom-document-vlinkcolor title=dom-document-vlinkColor>vlinkColor</a>;
+ attribute DOMString <a href=#dom-document-alinkcolor title=dom-document-alinkColor>alinkColor</a>;
+
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-anchors title=dom-document-anchors>anchors</a>;
+ readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-applets title=dom-document-applets>applets</a>;
+
+ void <a href=#dom-document-clear title=dom-document-clear>clear</a>();
+
+ readonly attribute <a href=#htmlallcollection>HTMLAllCollection</a> <a href=#dom-document-all title=dom-document-all>all</a>;
+};</pre>
+
+ <p>The attributes of the <code><a href=#document>Document</a></code> object listed in the
+ first column of the following table must <a href=#reflect>reflect</a> the
+ content attribute on <a href=#the-body-element>the body element</a> with the name
+ given in the corresponding cell in the second column on the same
+ row, if <a href=#the-body-element>the body element</a> is a <code><a href=#the-body-element-0>body</a></code> element
+ (as opposed to a <code><a href=#frameset>frameset</a></code> element). When there is no
+ <a href=#the-body-element title="the body element">body element</a> or if it is a
+ <code><a href=#frameset>frameset</a></code> element, the attributes must instead return
+ the empty string on getting and do nothing on setting.</p>
+
+ <table><thead><tr><th> IDL attribute
+ <th> Content attribute
+ <tbody><tr><td><dfn id=dom-document-fgcolor title=dom-document-fgColor><code>fgColor</code></dfn>
+ <td><code title=attr-body-text><a href=#attr-body-text>text</a></code>
+ <tr><td><dfn id=dom-document-bgcolor title=dom-document-bgColor><code>bgColor</code></dfn>
+ <td><code title=attr-body-bgcolor><a href=#attr-body-bgcolor>bgcolor</a></code>
+ <tr><td><dfn id=dom-document-linkcolor title=dom-document-linkColor><code>linkColor</code></dfn>
+ <td><code title=attr-body-link><a href=#attr-body-link>link</a></code>
+ <tr><td><dfn id=dom-document-vlinkcolor title=dom-document-vLinkColor><code>vLinkColor</code></dfn>
+ <td><code title=attr-body-vlink><a href=#attr-body-vlink>vlink</a></code>
+ <tr><td><dfn id=dom-document-alinkcolor title=dom-document-aLinkColor><code>aLinkColor</code></dfn>
+ <td><code title=attr-body-alink><a href=#attr-body-alink>alink</a></code>
+ </table><hr><p>The <dfn id=dom-document-anchors title=dom-document-anchors><code>anchors</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only <code><a href=#the-a-element>a</a></code>
+ elements with <code title=attr-a-name><a href=#attr-a-name>name</a></code>
+ attributes.</p>
+
+ <p>The <dfn id=dom-document-applets title=dom-document-applets><code>applets</code></dfn>
+ attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches only
+ <code><a href=#the-applet-element>applet</a></code> elements.</p>
+
+ <p>The <dfn id=dom-document-clear title=dom-document-clear><code>clear()</code></dfn>
+ method must do nothing.</p>
+
+ <hr><p>The <dfn id=dom-document-all title=dom-document-all><code>all</code></dfn>
+ attribute must return an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> rooted at the
+ <code><a href=#document>Document</a></code> node, whose filter matches all elements.</p>
+
+ <p>The object returned for <code title=dom-document-all><a href=#dom-document-all>all</a></code>
+ has several unusual behaviors:</p>
+
+ <ul><li><p>The user agent must act as if the ToBoolean() operator in
+ JavaScript converts the object returned for <code title=dom-document-all><a href=#dom-document-all>all</a></code> to the false value.</li>
+
+ <li><p>The user agent must act as if, for the purposes of the <code title="">==</code> and <code title="">!=</code> operators in
+ JavaScript, the object returned for <code title=dom-document-all><a href=#dom-document-all>all</a></code> is equal to the <code title="">undefined</code> value.</li>
+
+ <li><p>The user agent must act such that the <code title="">typeof</code> operator in JavaScript returns the string
+ <code title="">undefined</code> when applied to the object returned
+ for <code title=dom-document-all><a href=#dom-document-all>all</a></code>.</li>
+
+ </ul><p class=note>These requirements are a <a href=#willful-violation>willful
+ violation</a> of the JavaScript specification current at the time
+ of writing (ECMAScript edition 3). The JavaScript specification
+ requires that the ToBoolean() operator convert all objects to the
+ true value, and does not have provisions for objects acting as if
+ they were <code title="">undefined</code> for the purposes of
+ certain operators. This violation is motivated by a desire for
+ compatibility with two classes of legacy content: one that uses the
+ presence of <code title=dom-document-all><a href=#dom-document-all>document.all</a></code> as a
+ way to detect legacy user agents, and one that only supports those
+ legacy user agents and uses the <code title=dom-document-all><a href=#dom-document-all>document.all</a></code> object without testing
+ for its presence first. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </div>
+
+
+
+
+ <h2 id=iana><span class=secno>14 </span>IANA considerations</h2>
+
+ <!-- http://www.w3.org/2002/06/registering-mediatype.html -->
+
+
+
+ <h3 id=text/html><span class=secno>14.1 </span><dfn><code>text/html</code></dfn></h3>
+
+ <p>This registration is for community review and will be submitted
+ to the IESG for review, approval, and registration with IANA.</p>
+
+ <!--
+ To: ietf-types@iana.org
+ Subject: Registration of media type text/html
+ -->
+
+ <!--
+ Obsoletes:
+ http://www.ietf.org/rfc/rfc2854
+
+ Include a request to retire RFC 2854 persuant to section 6.4 of RFC 2026.
+ -->
+
+ <dl><dt>Type name:</dt>
+ <dd>text</dd>
+ <dt>Subtype name:</dt>
+ <dd>html</dd>
+ <dt>Required parameters:</dt>
+ <dd>No required parameters</dd>
+ <dt>Optional parameters:</dt>
+ <dd>
+ <dl><dt><code title="">charset</code></dt>
+ <dd>
+ <p>The <code title="">charset</code> parameter may be provided
+ to definitively specify the <a href="#document's-character-encoding">document's character
+ encoding</a>, overriding any <a href=#character-encoding-declaration title="character encoding
+ declaration">character encoding declarations</a> in the
+ document. The parameter's value must be the name of the
+ character encoding used to serialize the file, must be a valid
+ character encoding name, and must be an <a href=#ascii-case-insensitive>ASCII
+ case-insensitive</a> match for the <a href=#preferred-mime-name>preferred MIME
+ name</a> for that encoding. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>
+ </dd>
+ </dl></dd>
+ <dt>Encoding considerations:</dt>
+ <dd>See the section on <a href=#character-encoding-declaration title="character encoding
+ declaration">character encoding declarations</a>.</dd>
+ <dt>Security considerations:</dt>
+ <dd>
+
+ <p>Entire novels have been written about the security
+ considerations that apply to HTML documents. Many are listed in
+ this document, to which the reader is referred for more
+ details. Some general concerns bear mentioning here, however:</p>
+
+ <p>HTML is scripted language, and has a large number of APIs (some
+ of which are described in this document). Script can expose the
+ user to potential risks of information leakage, credential
+ leakage, cross-site scripting attacks, cross-site request
+ forgeries, and a host of other problems. While the designs in this
+ specification are intended to be safe if implemented correctly, a
+ full implementation is a massive undertaking and, as with any
+ software, user agents are likely to have security bugs.</p>
+
+ <p>Even without scripting, there are specific features in HTML
+ which, for historical reasons, are required for broad
+ compatibility with legacy content but that expose the user to
+ unfortunate security problems. In particular, the <code><a href=#the-img-element>img</a></code>
+ element can be used in conjunction with some other features as a
+ way to effect a port scan from the user's location on the
+ Internet. This can expose local network topologies that the
+ attacker would otherwise not be able to determine.</p>
+
+ <p>HTML relies on a compartmentalization scheme sometimes known as
+ the <i>same-origin policy</i>. An <a href=#origin>origin</a> in most
+ cases consists of all the pages served from the same host, on the
+ same port, using the same protocol.</p>
+
+ <p>It is critical, therefore, to ensure that any untrusted content
+ that forms part of a site be hosted on a different
+ <a href=#origin>origin</a> than any sensitive content on that site.
+ Untrusted content can easily spoof any other page on the same
+ origin, read data from that origin, cause scripts in that origin
+ to execute, submit forms to and from that origin even if they are
+ protected from cross-site request forgery attacks by unique
+ tokens, and make use of any third-party resources exposed to or
+ rights granted to that origin.</p>
+
+ </dd>
+ <dt>Interoperability considerations:</dt>
+ <dd>
+ Rules for processing both conforming and non-conforming content
+ are defined in this specification.
+ </dd>
+ <dt>Published specification:</dt>
+ <dd id=authors-using-html>
+ This document is the relevant specification. Labeling a resource
+ with the <code><a href=#text/html>text/html</a></code> type asserts that the resource is
+ an <a href=#html-documents title="HTML documents">HTML document</a> using
+ <a href=#syntax>the HTML syntax</a>.
+ </dd>
+ <dt>Applications that use this media type:</dt>
+ <dd>
+ Web browsers, tools for processing Web content, HTML authoring
+ tools, search engines, validators.
+ </dd>
+ <dt>Additional information:</dt>
+ <dd>
+ <dl><dt>Magic number(s):</dt>
+ <dd>No sequence of bytes can uniquely identify an HTML
+ document. More information on detecting HTML documents is
+ available in the Content-Type Processing Model specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></dd>
+ <dt>File extension(s):</dt>
+ <dd>"<code title="">html</code>" and "<code title="">htm</code>"
+ are commonly, but certainly not exclusively, used as the
+ extension for HTML documents.</dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd><code title="">TEXT</code></dd>
+ </dl></dd>
+ <dt>Person &amp; email address to contact for further information:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Intended usage:</dt>
+ <dd>Common</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>No restrictions apply.</dd>
+ <dt>Author:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Change controller:</dt>
+ <dd>W3C</dd>
+ </dl><p>Fragment identifiers used with <code><a href=#text/html>text/html</a></code> resources
+ refer to <a href=#the-indicated-part-of-the-document>the indicated part of the document</a>.</p>
+
+
+ <h3 id=text/html-sandboxed><span class=secno>14.2 </span><dfn><code>text/html-sandboxed</code></dfn></h3>
+
+ <p>This registration is for community review and will be submitted
+ to the IESG for review, approval, and registration with IANA.</p>
+
+ <!--
+ To: ietf-types@iana.org
+ Subject: Registration of media type text/html-sandboxed
+ -->
+
+ <dl><dt>Type name:</dt>
+ <dd>text</dd>
+ <dt>Subtype name:</dt>
+ <dd>html-sandboxed</dd>
+ <dt>Required parameters:</dt>
+ <dd>No required parameters</dd>
+ <dt>Optional parameters:</dt>
+ <dd>Same as for <code><a href=#text/html>text/html</a></code></dd>
+ <dt>Encoding considerations:</dt>
+ <dd>Same as for <code><a href=#text/html>text/html</a></code></dd>
+ <dt>Security considerations:</dt>
+ <dd>
+ <p>The purpose of the <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> MIME type
+ is to provide a way for content providers to indicate that they
+ want the file to be interpreted in a manner that does not give the
+ file's contents access to the rest of the site. This is achieved
+ by assigning the <code><a href=#document>Document</a></code> objects generated from
+ resources labeled as <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> unique
+ origins.</p>
+ <p>To avoid having legacy user agents treating resources labeled
+ as <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> as regular
+ <code><a href=#text/html>text/html</a></code> files, authors should avoid using the <code title="">.html</code> or <code title="">.htm</code> extensions for
+ resources labeled as <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code>.</p>
+ <p>Beyond this, the type is identical to <code><a href=#text/html>text/html</a></code>,
+ and the same considerations apply.</p>
+ </dd>
+ <dt>Interoperability considerations:</dt>
+ <dd>Same as for <code><a href=#text/html>text/html</a></code></dd>
+ <dt>Published specification:</dt>
+ <dd>
+ This document is the relevant specification. Labeling a resource
+ with the <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> type asserts that the
+ resource is an <a href=#html-documents title="HTML documents">HTML document</a>
+ using <a href=#syntax>the HTML syntax</a>.
+ </dd>
+ <dt>Applications that use this media type:</dt>
+ <dd>Same as for <code><a href=#text/html>text/html</a></code></dd>
+ <dt>Additional information:</dt>
+ <dd>
+ <dl><dt>Magic number(s):</dt>
+ <dd>Documents labeled as <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code> are
+ heuristically indistinguishable from those labeled as
+ <code><a href=#text/html>text/html</a></code>.</dd>
+ <dt>File extension(s):</dt>
+ <dd>"<code title="">sandboxed</code>"</dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd><code title="">TEXT</code></dd>
+ </dl></dd>
+ <dt>Person &amp; email address to contact for further information:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Intended usage:</dt>
+ <dd>Common</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>No restrictions apply.</dd>
+ <dt>Author:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Change controller:</dt>
+ <dd>WHATWG</dd>
+ </dl><p>Fragment identifiers used with <code><a href=#text/html-sandboxed>text/html-sandboxed</a></code>
+ resources refer to <a href=#the-indicated-part-of-the-document>the indicated part of the
+ document</a>.</p>
+
+
+ <h3 id=application/xhtml+xml><span class=secno>14.3 </span><dfn><code>application/xhtml+xml</code></dfn></h3>
+
+ <p>This registration is for community review and will be submitted
+ to the IESG for review, approval, and registration with IANA.</p>
+
+ <!--
+ To: ietf-types@iana.org
+ Subject: Registration of media type application/xhtml+xml
+ -->
+
+ <!--
+ Obsoletes:
+ http://www.ietf.org/rfc/rfc3236.txt
+ -->
+
+ <dl><dt>Type name:</dt>
+ <dd>application</dd>
+ <dt>Subtype name:</dt>
+ <dd>xhtml+xml</dd>
+ <dt>Required parameters:</dt>
+ <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
+ <dt>Optional parameters:</dt>
+ <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
+ <dt>Encoding considerations:</dt>
+ <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
+ <dt>Security considerations:</dt>
+ <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
+ <dt>Interoperability considerations:</dt>
+ <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
+ <dt id=authors-using-xhtml>Published specification:</dt>
+ <dd>
+ Labeling a resource with the <code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>
+ type asserts that the resource is an XML document that likely has
+ a root element from the <a href=#html-namespace-0>HTML namespace</a>. As such, the
+ relevant specifications are the XML specification, the Namespaces
+ in XML specification, and this specification. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a>
+ </dd>
+ <dt>Applications that use this media type:</dt>
+ <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
+ <dt>Additional information:</dt>
+ <dd>
+ <dl><dt>Magic number(s):</dt>
+ <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
+ <dt>File extension(s):</dt>
+ <dd>"<code title="">xhtml</code>" and "<code title="">xht</code>"
+ are sometimes used as extensions for XML resources that have a
+ root element from the <a href=#html-namespace-0>HTML namespace</a>.</dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd><code title="">TEXT</code></dd>
+ </dl></dd>
+ <dt>Person &amp; email address to contact for further information:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Intended usage:</dt>
+ <dd>Common</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>No restrictions apply.</dd>
+ <dt>Author:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Change controller:</dt>
+ <dd>W3C</dd>
+ </dl><p>Fragment identifiers used with <code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>
+ resources have the same semantics as with any <a href=#xml-mime-type>XML MIME
+ type</a>. <a href=#refsRFC3023>[RFC3023]</a></p>
+
+
+ <h3 id=text/cache-manifest><span class=secno>14.4 </span><dfn><code>text/cache-manifest</code></dfn></h3>
+
+ <p>This registration is for community review and will be submitted
+ to the IESG for review, approval, and registration with IANA.</p>
+
+ <!--
+ To: ietf-types@iana.org
+ Subject: Registration of media type text/cache-manifest
+ -->
+
+ <dl><dt>Type name:</dt>
+ <dd>text</dd>
+ <dt>Subtype name:</dt>
+ <dd>cache-manifest</dd>
+ <dt>Required parameters:</dt>
+ <dd>No parameters</dd>
+ <dt>Optional parameters:</dt>
+ <dd>No parameters</dd>
+ <dt>Encoding considerations:</dt>
+ <dd>Always UTF-8.</dd>
+ <dt>Security considerations:</dt>
+ <dd>
+ <p>Cache manifests themselves pose no immediate risk unless
+ sensitive information is included within the
+ manifest. Implementations, however, are required to follow
+ specific rules when populating a cache based on a cache manifest,
+ to ensure that certain origin-based restrictions are
+ honored. Failure to correctly implement these rules can result in
+ information leakage, cross-site scripting attacks, and the
+ like.</p>
+ </dd>
+ <dt>Interoperability considerations:</dt>
+ <dd>
+ Rules for processing both conforming and non-conforming content
+ are defined in this specification.
+ </dd>
+ <dt>Published specification:</dt>
+ <dd>
+ This document is the relevant specification.
+ </dd>
+ <dt>Applications that use this media type:</dt>
+ <dd>
+ Web browsers.
+ </dd>
+ <dt>Additional information:</dt>
+ <dd>
+ <dl><dt>Magic number(s):</dt>
+ <dd>Cache manifests begin with the string "<code title="">CACHE
+ MANIFEST</code>", followed by either a U+0020 SPACE character, a
+ U+0009 CHARACTER TABULATION (tab) character, a U+000A LINE FEED
+ (LF) character, or a U+000D CARRIAGE RETURN (CR) character.</dd>
+ <dt>File extension(s):</dt>
+ <dd>"<code title="">manifest</code>"</dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd>No specific Macintosh file type codes are recommended for this type.</dd>
+ </dl></dd>
+ <dt>Person &amp; email address to contact for further information:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Intended usage:</dt>
+ <dd>Common</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>No restrictions apply.</dd>
+ <dt>Author:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Change controller:</dt>
+ <dd>WHATWG</dd>
+ </dl><p>Fragment identifiers have no meaning with
+ <code><a href=#text/cache-manifest>text/cache-manifest</a></code> resources.</p>
+
+
+<!--PING-->
+ <h3 id=text/ping><span class=secno>14.5 </span><dfn><code>text/ping</code></dfn></h3>
+
+ <p>This registration is for community review and will be submitted
+ to the IESG for review, approval, and registration with IANA.</p>
+
+ <!--
+ To: ietf-types@iana.org
+ Subject: Registration of media type text/ping
+ -->
+
+ <dl><dt>Type name:</dt>
+ <dd>text</dd>
+ <dt>Subtype name:</dt>
+ <dd>ping</dd>
+ <dt>Required parameters:</dt>
+ <dd>No parameters</dd>
+ <dt>Optional parameters:</dt>
+ <dd>No parameters</dd>
+ <dt>Encoding considerations:</dt>
+ <dd>Not applicable.</dd>
+ <dt>Security considerations:</dt>
+ <dd>
+ <p>If used exclusively in the fashion described in the context of
+ <a href=#hyperlink-auditing>hyperlink auditing</a>, this type introduces no new
+ security concerns.</p>
+ </dd>
+ <dt>Interoperability considerations:</dt>
+ <dd>
+ Rules applicable to this type are defined in this specification.
+ </dd>
+ <dt>Published specification:</dt>
+ <dd>
+ This document is the relevant specification.
+ </dd>
+ <dt>Applications that use this media type:</dt>
+ <dd>
+ Web browsers.
+ </dd>
+ <dt>Additional information:</dt>
+ <dd>
+ <dl><dt>Magic number(s):</dt>
+ <dd><code><a href=#text/ping>text/ping</a></code> resources always consist of the four
+ bytes 0x50 0x49 0x4E 0x47 (ASCII 'PING').</dd>
+ <dt>File extension(s):</dt>
+ <dd>No specific file extension is recommended for this type.</dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd>No specific Macintosh file type codes are recommended for this type.</dd>
+ </dl></dd>
+ <dt>Person &amp; email address to contact for further information:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Intended usage:</dt>
+ <dd>Common</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>Only intended for use with HTTP POST requests generated as part
+ of a Web browser's processing of the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute.</dd>
+ <dt>Author:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Change controller:</dt>
+ <dd>WHATWG</dd>
+ </dl><p>Fragment identifiers have no meaning with
+ <code><a href=#text/ping>text/ping</a></code> resources.</p>
+<!--PING-->
+
+ <h3 id=text/srt><span class=secno>14.6 </span><dfn><code>text/srt</code></dfn></h3>
+
+ <p>This registration is for community review and will be submitted
+ to the IESG for review, approval, and registration with IANA.</p>
+
+ <!--
+ To: ietf-types@iana.org
+ Subject: Registration of media type text/cues
+ -->
+
+ <dl><dt>Type name:</dt>
+ <dd>text</dd>
+ <dt>Subtype name:</dt>
+ <dd>srt</dd>
+ <dt>Required parameters:</dt>
+ <dd>No parameters</dd>
+ <dt>Optional parameters:</dt>
+ <dd>No parameters</dd>
+ <dt>Encoding considerations:</dt>
+ <dd>Always UTF-8.</dd>
+ <dt>Security considerations:</dt>
+ <dd>
+ <p>Timed track files themselves pose no immediate risk unless
+ sensitive information is included within the
+ data. Implementations, however, are required to follow specific
+ rules when processing timed tracks, to ensure that certain
+ origin-based restrictions are honored. Failure to correctly
+ implement these rules can result in information leakage,
+ cross-site scripting attacks, and the like.</p>
+ </dd>
+ <dt>Interoperability considerations:</dt>
+ <dd>
+ Rules for processing both conforming and non-conforming content
+ are defined in this specification.
+ </dd>
+ <dt>Published specification:</dt>
+ <dd>
+ This document is the relevant specification.
+ </dd>
+ <dt>Applications that use this media type:</dt>
+ <dd>
+ Web browsers and other video players.
+ </dd>
+ <dt>Additional information:</dt>
+ <dd>
+ <dl><dt>Magic number(s):</dt>
+ <dd>No sequence of bytes can uniquely identify a WebSRT timed
+ track file.</dd>
+ <dt>File extension(s):</dt>
+ <dd>"<code title="">srt</code>"</dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd>No specific Macintosh file type codes are recommended for this type.</dd>
+ </dl></dd>
+ <dt>Person &amp; email address to contact for further information:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Intended usage:</dt>
+ <dd>Common</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>No restrictions apply.</dd>
+ <dt>Author:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Change controller:</dt>
+ <dd>WHATWG</dd>
+ </dl><p>Fragment identifiers have no meaning with
+ <code><a href=#text/srt>text/srt</a></code> resources.</p>
+
+
+
+ <h3 id=application/microdata+json><span class=secno>14.7 </span><dfn><code>application/microdata+json</code></dfn></h3>
+
+
+ <p>This registration is for community review and will be submitted
+ to the IESG for review, approval, and registration with IANA.</p>
+
+ <!--
+ To: ietf-types@iana.org
+ Subject: Registration of media type application/microdata+json
+ -->
+
+ <dl><dt>Type name:</dt>
+ <dd>application</dd>
+ <dt>Subtype name:</dt>
+ <dd>microdata+json</dd>
+ <dt>Required parameters:</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ <dt>Optional parameters:</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ <dt>Encoding considerations:</dt>
+ <dd>Always UTF-8.</dd>
+ <dt>Security considerations:</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ <dt>Interoperability considerations:</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ <dt>Published specification:</dt>
+ <dd>
+
+ Labeling a resource with the
+ <code><a href=#application/microdata+json>application/microdata+json</a></code> type asserts that the
+ resource is a JSON text that consists of an object with a single
+ entry called "<code title="">items</code>" consisting of an array
+ of entries, each of which consists of an object with two entries,
+ one called "<code title="">type</code>" whose value is an array of
+ strings, and one called "<code title="">properties</code>" whose
+ value is an object whose entries each have a value consisting of
+ an array of either objects or strings, the objects being of the
+ same form as the objects in the aforementioned "<code title="">items</code>" entry. As such, the relevant specifications
+ are the JSON specification and this specification. <a href=#refsJSON>[JSON]</a>
+
+ </dd>
+ <dt>Applications that use this media type:</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ <dt>Additional information:</dt>
+ <dd>
+ <dl><dt>Magic number(s):</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ <dt>File extension(s):</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
+ </dl></dd>
+ <dt>Person &amp; email address to contact for further information:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Intended usage:</dt>
+ <dd>Common</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>No restrictions apply.</dd>
+ <dt>Author:</dt>
+ <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
+ <dt>Change controller:</dt>
+ <dd>WHATWG</dd>
+ </dl><p>Fragment identifiers used with
+ <code><a href=#application/microdata+json>application/microdata+json</a></code> resources have the same
+ semantics as when used with <code>application/json</code>. <a href=#refsJSON>[JSON]</a></p>
+
+
+
+<!--PING-->
+ <h3 id=ping-from><span class=secno>14.8 </span><dfn title=http-ping-from><code>Ping-From</code></dfn></h3>
+
+ <p>This section describes a header field for registration in the
+ Permanent Message Header Field Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
+
+ <dl><dt>Header field name</dt>
+ <dd>Ping-From</dd>
+ <dt>Applicable protocol</dt>
+ <dd>http</dd>
+ <dt>Status</dt>
+ <dd>standard</dd>
+ <dt>Author/Change controller</dt>
+ <dd>WHATWG</dd>
+ <dt>Specification document(s)</dt>
+ <dd>
+ This document is the relevant specification.
+ </dd>
+ <dt>Related information</dt>
+ <dd>None.</dd>
+ </dl><h3 id=ping-to><span class=secno>14.9 </span><dfn title=http-ping-to><code>Ping-To</code></dfn></h3>
+
+ <p>This section describes a header field for registration in the
+ Permanent Message Header Field Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
+
+ <dl><dt>Header field name</dt>
+ <dd>Ping-To</dd>
+ <dt>Applicable protocol</dt>
+ <dd>http</dd>
+ <dt>Status</dt>
+ <dd>standard</dd>
+ <dt>Author/Change controller</dt>
+ <dd>WHATWG</dd>
+ <dt>Specification document(s)</dt>
+ <dd>
+ This document is the relevant specification.
+ </dd>
+ <dt>Related information</dt>
+ <dd>None.</dd>
+ </dl><!--PING--><h2 class=no-num id=index>Index</h2>
+
+ <div class=impl>
+
+ <p>The following sections only cover conforming elements and features.</p>
+
+ </div>
+
+ <h3 class=no-num id=elements-1>Elements</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <table><caption>List of elements</caption>
+ <thead><tr><th> Element
+ <th> Description
+ <th> Categories
+ <th> Parents
+ <th> Children
+ <th> Attributes
+ <th> Interface
+ <tbody><tr><th><code><a href=#the-a-element>a</a></code></th>
+ <td>Hyperlink</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>*;
+ <a href=#interactive-content title="Interactive content">interactive</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#transparent>transparent</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>;
+ <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>;
+<!--PING-->
+ <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>;
+<!--PING-->
+ <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>;
+ <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>;
+ <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
+ <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code></td>
+ <td><code><a href=#htmlanchorelement>HTMLAnchorElement</a></code></td>
+ <tr><th><code><a href=#the-abbr-element>abbr</a></code></th>
+ <td>Abbreviation</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-address-element>address</a></code></th>
+ <td>Contact information for a page or section</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-area-element>area</a></code></th>
+ <td>Hyperlink or dead area on an image map</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code>;
+ <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code>;
+ <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code>;
+ <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>;
+ <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>;
+<!--PING-->
+ <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>;
+<!--PING-->
+ <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>;
+ <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>;
+ <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
+ <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code></td>
+ <td><code><a href=#htmlareaelement>HTMLAreaElement</a></code></td>
+ <tr><th><code><a href=#the-article-element>article</a></code></th>
+ <td>Self-contained syndicatable or reusable composition</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-content title="Sectioning content">sectioning</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-aside-element>aside</a></code></th>
+ <td>Sidebar for tangentially related content</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-content title="Sectioning content">sectioning</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#audio>audio</a></code></th>
+ <td>Audio player</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#embedded-content title="Embedded content">embedded</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><code><a href=#the-source-element>source</a></code>*;
+ <a href=#transparent>transparent</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-media-src><a href=#attr-media-src>src</a></code>;
+ <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>;
+ <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>;
+ <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>;
+ <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code></td>
+ <td><code><a href=#htmlaudioelement>HTMLAudioElement</a></code></td>
+ <tr><th><code><a href=#the-b-element>b</a></code></th>
+ <td>Keywords</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-base-element>base</a></code></th>
+ <td>Base URL and default target <a href=#browsing-context>browsing context</a> for <a href=#attr-hyperlink-target title=attr-hyperlink-target>hyperlinks</a> and <a href=#attr-fs-target title=attr-fs-target>forms</a></td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a></td>
+ <td><code><a href=#the-head-element-0>head</a></code></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-base-href><a href=#attr-base-href>href</a></code>;
+ <code title=attr-base-target><a href=#attr-base-target>target</a></code></td>
+ <td><code><a href=#htmlbaseelement>HTMLBaseElement</a></code></td>
+ <tr><th><code><a href=#the-bdo-element>bdo</a></code></th>
+ <td>Text directionality formatting</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-blockquote-element>blockquote</a></code></th>
+ <td>A section quoted from another source</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-root title="Sectioning root">sectioning root</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code></td>
+ <td><code><a href=#htmlquoteelement>HTMLQuoteElement</a></code></td>
+ <tr><th><code><a href=#the-body-element-0>body</a></code></th>
+ <td>Document body</td>
+ <td><a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
+ <td><code><a href=#the-html-element-0>html</a></code></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code>;
+ <code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code>;
+ <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code>;
+ <code title=handler-window-onblur><a href=#handler-window-onblur>onblur</a></code>;
+ <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code>;
+ <code title=handler-window-onfocus><a href=#handler-window-onfocus>onfocus</a></code>;
+ <code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code>;
+ <code title=handler-window-onload><a href=#handler-window-onload>onload</a></code>;
+ <code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code>;
+ <code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code>;
+ <code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code>;
+ <code title=handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code>;
+ <code title=handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code>;
+ <code title=handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code>;
+ <code title=handler-window-onredo><a href=#handler-window-onredo>onredo</a></code>;
+ <code title=handler-window-onresize><a href=#handler-window-onresize>onresize</a></code>;
+ <code title=handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code>;
+ <code title=handler-window-onundo><a href=#handler-window-onundo>onundo</a></code>;
+ <code title=handler-window-onunload><a href=#handler-window-onunload>onunload</a></code></td>
+ <td><code><a href=#htmlbodyelement>HTMLBodyElement</a></code></td>
+ <tr><th><code><a href=#the-br-element>br</a></code></th>
+ <td>Line break, e.g. in poem or postal address</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlbrelement>HTMLBRElement</a></code></td>
+ <tr><th><code><a href=#the-button-element>button</a></code></th>
+ <td>Button control</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#category-submit title=category-submit>submittable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content>Phrasing content</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>;
+ <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>;
+ <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>;
+ <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
+ <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
+ <code title=attr-button-type><a href=#attr-button-type>type</a></code>;
+ <code title=attr-button-value><a href=#attr-button-value>value</a></code></td>
+ <td><code><a href=#htmlbuttonelement>HTMLButtonElement</a></code></td>
+ <tr><th><code><a href=#the-canvas-element>canvas</a></code></th>
+ <td>Scriptable bitmap canvas</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#embedded-content title="Embedded content">embedded</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#transparent>transparent</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code>;
+ <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code></td>
+ <td><code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code></td>
+ <tr><th><code><a href=#the-caption-element>caption</a></code></th>
+ <td>Table caption</td>
+ <td>none</td>
+ <td><code><a href=#the-table-element>table</a></code></td>
+ <td><a href=#flow-content title="Flow content">flow</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code></td>
+ <tr><th><code><a href=#the-cite-element>cite</a></code></th>
+ <td>Title of a work</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-code-element>code</a></code></th>
+ <td>Computer code</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-col-element>col</a></code></th>
+ <td>Table column</td>
+ <td>none</td>
+ <td><code><a href=#the-colgroup-element>colgroup</a></code></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-col-span><a href=#attr-col-span>span</a></code></td>
+ <td><code><a href=#htmltablecolelement>HTMLTableColElement</a></code></td>
+ <tr><th><code><a href=#the-colgroup-element>colgroup</a></code></th>
+ <td>Group of columns in a table</td>
+ <td>none</td>
+ <td><code><a href=#the-table-element>table</a></code></td>
+ <td><code><a href=#the-col-element>col</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code></td>
+ <td><code><a href=#htmltablecolelement>HTMLTableColElement</a></code></td>
+ <tr><th><code><a href=#the-command>command</a></code></th>
+ <td>Menu command</td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a>;
+ <a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><code><a href=#the-head-element-0>head</a></code>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-command-type><a href=#attr-command-type>type</a></code>;
+ <code title=attr-command-label><a href=#attr-command-label>label</a></code>;
+ <code title=attr-command-icon><a href=#attr-command-icon>icon</a></code>;
+ <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code>;
+ <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code>;
+ <code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code></td>
+ <td><code><a href=#htmlcommandelement>HTMLCommandElement</a></code></td>
+ <tr><th><code><a href=#the-datalist-element>datalist</a></code></th>
+ <td>Container for options for <a href=#attr-input-list title=attr-input-list>combo box control</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <code><a href=#the-option-element>option</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmldatalistelement>HTMLDataListElement</a></code></td>
+ <tr><th><code><a href=#the-dd-element>dd</a></code></th>
+ <td>Content for corresponding <code><a href=#the-dt-element>dt</a></code> element(s)</td>
+ <td>none</td>
+ <td><code><a href=#the-dl-element>dl</a></code></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-del-element>del</a></code></th>
+ <td>A removal from the document</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#transparent>transparent</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code>;
+ <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code></td>
+ <td><code><a href=#htmlmodelement>HTMLModElement</a></code></td>
+ <tr><th><code><a href=#the-details-element>details</a></code></th>
+ <td>Disclosure control for hiding details</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-root title="Sectioning root">sectioning root</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-summary-element>summary</a></code>*;
+ <a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-details-open><a href=#attr-details-open>open</a></code></td>
+ <td><code><a href=#htmldetailselement>HTMLDetailsElement</a></code></td>
+ <tr><th><code><a href=#the-dfn-element>dfn</a></code></th>
+ <td>Defining instance</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-div-element>div</a></code></th>
+ <td>Generic flow container</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmldivelement>HTMLDivElement</a></code></td>
+ <tr><th><code><a href=#the-dl-element>dl</a></code></th>
+ <td>Association list consisting of zero or more name-value groups</td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-dt-element>dt</a></code>*;
+ <code><a href=#the-dd-element>dd</a></code>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmldlistelement>HTMLDListElement</a></code></td>
+ <tr><th><code><a href=#the-dt-element>dt</a></code></th>
+ <td>Legend for corresponding <code><a href=#the-dd-element>dd</a></code> element(s)</td>
+ <td>none</td>
+ <td><code><a href=#the-dl-element>dl</a></code></td>
+ <td>varies*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-em-element>em</a></code></th>
+ <td>Stress emphasis</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-embed-element>embed</a></code></th>
+ <td><a href=#plugin>Plugin</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#embedded-content title="Embedded content">embedded</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-embed-src><a href=#attr-embed-src>src</a></code>;
+ <code title=attr-embed-type><a href=#attr-embed-type>type</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>;
+ any*</td>
+ <td><code><a href=#htmlembedelement>HTMLEmbedElement</a></code></td>
+ <tr><th><code><a href=#the-fieldset-element>fieldset</a></code></th>
+ <td>Group of form controls</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-root title="Sectioning root">sectioning root</a>;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-legend-element>legend</a></code>*;
+ <a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code></td>
+ <td><code><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code></td>
+ <tr><th><code><a href=#the-figcaption-element>figcaption</a></code></th>
+ <td>Caption for <code><a href=#the-figure-element>figure</a></code></td>
+ <td>none</td>
+ <td><code><a href=#the-figure-element>figure</a></code></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-figure-element>figure</a></code></th>
+ <td>Figure with optional caption</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-figcaption-element>figcaption</a></code>*;
+ <a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-footer-element>footer</a></code></th>
+ <td>Footer for a page or section</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-form-element>form</a></code></th>
+ <td>User-submittable form</td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code>;
+ <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>;
+ <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code>;
+ <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>;
+ <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>;
+ <code title=attr-form-name><a href=#attr-form-name>name</a></code>;
+ <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>;
+ <code title=attr-fs-target><a href=#attr-fs-target>target</a></code></td>
+ <td><code><a href=#htmlformelement>HTMLFormElement</a></code></td>
+ <tr><th><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></th>
+ <td>Section heading</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#heading-content title="Heading content">heading</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><code><a href=#the-hgroup-element>hgroup</a></code>;
+ <a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlheadingelement>HTMLHeadingElement</a></code></td>
+ <tr><th><code><a href=#the-head-element-0>head</a></code></th>
+ <td>Container for document metadata</td>
+ <td>none</td>
+ <td><code><a href=#the-html-element-0>html</a></code></td>
+ <td><a href=#metadata-content title="Metadata content">metadata content</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlheadelement>HTMLHeadElement</a></code></td>
+ <tr><th><code><a href=#the-header-element>header</a></code></th>
+ <td>Introductory or navigational aids for a page or section</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-hgroup-element>hgroup</a></code></th>
+ <td>heading group</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#heading-content title="Heading content">heading</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td>One or more <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, and/or <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-hr-element>hr</a></code></th>
+ <td>Thematic break</td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlhrelement>HTMLHRElement</a></code></td>
+ <tr><th><code><a href=#the-html-element-0>html</a></code></th>
+ <td>Root element</td>
+ <td>none</td>
+ <td>none*</td>
+ <td><code><a href=#the-head-element-0>head</a></code>*;
+ <code><a href=#the-body-element-0>body</a></code>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code></td>
+ <td><code><a href=#htmlhtmlelement>HTMLHtmlElement</a></code></td>
+ <tr><th><code><a href=#the-i-element>i</a></code></th>
+ <td>Alternate voice</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-iframe-element>iframe</a></code></th>
+ <td><a href=#nested-browsing-context>Nested browsing context</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#embedded-content title="Embedded content">embedded</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>text*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code>;
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>;
+ <code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code>;
+ <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>;
+ <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
+ <td><code><a href=#htmliframeelement>HTMLIFrameElement</a></code></td>
+ <tr><th><code><a href=#the-img-element>img</a></code></th>
+ <td>Image</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#embedded-content title="Embedded content">embedded</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>*</td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>;
+ <code title=attr-img-src><a href=#attr-img-src>src</a></code>;
+ <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code>;
+ <code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
+ <td><code><a href=#htmlimageelement>HTMLImageElement</a></code></td>
+ <tr><th><code><a href=#the-input-element>input</a></code></th>
+ <td>Form control</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>*;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#category-submit title=category-submit>submittable</a>;
+ <a href=#category-reset title=category-reset>resettable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>;
+ <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>;
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
+ <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>;
+ <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>;
+ <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>;
+ <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
+ <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>;
+ <code title=attr-input-list><a href=#attr-input-list>list</a></code>;
+ <code title=attr-input-max><a href=#attr-input-max>max</a></code>;
+ <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>;
+ <code title=attr-input-min><a href=#attr-input-min>min</a></code>;
+ <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
+ <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>;
+ <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>;
+ <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>;
+ <code title=attr-input-required><a href=#attr-input-required>required</a></code>;
+ <code title=attr-input-size><a href=#attr-input-size>size</a></code>;
+ <code title=attr-input-src><a href=#attr-input-src>src</a></code>;
+ <code title=attr-input-step><a href=#attr-input-step>step</a></code>;
+ <code title=attr-input-type><a href=#attr-input-type>type</a></code>;
+ <code title=attr-input-value><a href=#attr-input-value>value</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>width</a></code></td>
+ <td><code><a href=#htmlinputelement>HTMLInputElement</a></code></td>
+ <tr><th><code><a href=#the-ins-element>ins</a></code></th>
+ <td>An addition to the document</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#transparent>transparent</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code>;
+ <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code></td>
+ <td><code><a href=#htmlmodelement>HTMLModElement</a></code></td>
+ <tr><th><code><a href=#the-kbd-element>kbd</a></code></th>
+ <td>User input</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-keygen-element>keygen</a></code></th>
+ <td>Cryptographic key-pair generator form control</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#category-submit title=category-submit>submittable</a>;
+ <a href=#category-reset title=category-reset>resettable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
+ <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code></td>
+ <td><code><a href=#htmlkeygenelement>HTMLKeygenElement</a></code></td>
+ <tr><th><code><a href=#the-label-element>label</a></code></th>
+ <td>Caption for a form control</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-label-for><a href=#attr-label-for>for</a></code></td>
+ <td><code><a href=#htmllabelelement>HTMLLabelElement</a></code></td>
+ <tr><th><code><a href=#the-legend-element>legend</a></code></th>
+ <td>Caption for <code><a href=#the-fieldset-element>fieldset</a></code></td>
+ <td>none</td>
+ <td><code><a href=#the-fieldset-element>fieldset</a></code></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmllegendelement>HTMLLegendElement</a></code></td>
+ <tr><th><code><a href=#the-li-element>li</a></code></th>
+ <td>List item</td>
+ <td>none</td>
+ <td><code><a href=#the-ol-element>ol</a></code>; <code><a href=#the-ul-element>ul</a></code>; <code><a href=#menus>menu</a></code></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-li-value><a href=#attr-li-value>value</a></code>*</td>
+ <td><code><a href=#htmllielement>HTMLLIElement</a></code></td>
+ <tr><th><code><a href=#the-link-element>link</a></code></th>
+ <td>Link metadata</td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a>;
+ <a href=#flow-content title="Flow content">flow</a>*;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><code><a href=#the-head-element-0>head</a></code>;
+ <code><a href=#the-noscript-element>noscript</a></code>*;
+ <a href=#phrasing-content title="phrasing content">phrasing</a>*</td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-link-href><a href=#attr-link-href>href</a></code>;
+ <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code>;
+ <code title=attr-link-media><a href=#attr-link-media>media</a></code>;
+ <code title=attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code>;
+ <code title=attr-link-type><a href=#attr-link-type>type</a></code>;
+ <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code></td>
+ <td><code><a href=#htmllinkelement>HTMLLinkElement</a></code></td>
+ <tr><th><code><a href=#the-map-element>map</a></code></th>
+ <td><a href=#image-map>Image map</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#transparent>transparent</a>;
+ <code><a href=#the-area-element>area</a></code>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-map-name><a href=#attr-map-name>name</a></code></td>
+ <td><code><a href=#htmlmapelement>HTMLMapElement</a></code></td>
+ <tr><th><code><a href=#the-mark-element>mark</a></code></th>
+ <td>Highlight</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#menus>menu</a></code></th>
+ <td>Menu of commands</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>*</td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-li-element>li</a></code>*;
+ <a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-menu-type><a href=#attr-menu-type>type</a></code>;
+ <code title=attr-menu-label><a href=#attr-menu-label>label</a></code></td>
+ <td><code><a href=#htmlmenuelement>HTMLMenuElement</a></code></td>
+ <tr><th><code><a href=#meta>meta</a></code></th>
+ <td>Text metadata</td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a>;
+ <a href=#flow-content title="Flow content">flow</a>*;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><code><a href=#the-head-element-0>head</a></code>;
+ <code><a href=#the-noscript-element>noscript</a></code>*;
+ <a href=#phrasing-content title="phrasing content">phrasing</a>*</td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>;
+ <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>;
+ <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>;
+ <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code></td>
+ <td><code><a href=#htmlmetaelement>HTMLMetaElement</a></code></td>
+ <tr><th><code><a href=#the-meter-element>meter</a></code></th>
+ <td>Gauge</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>;
+ <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>;
+ <code title=attr-meter-max><a href=#attr-meter-max>max</a></code>;
+ <code title=attr-meter-low><a href=#attr-meter-low>low</a></code>;
+ <code title=attr-meter-high><a href=#attr-meter-high>high</a></code>;
+ <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code></td>
+ <td><code><a href=#htmlmeterelement>HTMLMeterElement</a></code></td>
+ <tr><th><code><a href=#the-nav-element>nav</a></code></th>
+ <td>Section with navigational links</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-content title="Sectioning content">sectioning</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-noscript-element>noscript</a></code></th>
+ <td>Fallback content for script</td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a>;
+ <a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><code><a href=#the-head-element-0>head</a></code>*;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td>varies*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-object-element>object</a></code></th>
+ <td>Image, <a href=#nested-browsing-context>nested browsing context</a>, or <a href=#plugin>plugin</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#embedded-content title="Embedded content">embedded</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>*;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#category-submit title=category-submit>submittable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><code><a href=#the-param-element>param</a></code>*;
+ <a href=#transparent>transparent</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-object-data><a href=#attr-object-data>data</a></code>;
+ <code title=attr-object-type><a href=#attr-object-type>type</a></code>;
+ <code title=attr-object-name><a href=#attr-object-name>name</a></code>;
+ <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
+ <td><code><a href=#htmlobjectelement>HTMLObjectElement</a></code></td>
+ <tr><th><code><a href=#the-ol-element>ol</a></code></th>
+ <td>Ordered list</td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-li-element>li</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code>;
+ <code title=attr-ol-start><a href=#attr-ol-start>start</a></code></td>
+ <td><code><a href=#htmlolistelement>HTMLOListElement</a></code></td>
+ <tr><th><code><a href=#the-optgroup-element>optgroup</a></code></th>
+ <td>Group of options in a list box</td>
+ <td>none</td>
+ <td><code><a href=#the-select-element>select</a></code></td>
+ <td><code><a href=#the-option-element>option</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code>;
+ <code title=attr-optgroup-label><a href=#attr-optgroup-label>label</a></code></td>
+ <td><code><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code></td>
+ <tr><th><code><a href=#the-option-element>option</a></code></th>
+ <td>Option in a list box or combo box control</td>
+ <td>none</td>
+ <td><code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-datalist-element>datalist</a></code>;
+ <code><a href=#the-optgroup-element>optgroup</a></code></td>
+ <td><a href=#text-content title="text content">text</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code>;
+ <code title=attr-option-label><a href=#attr-option-label>label</a></code>;
+ <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code>;
+ <code title=attr-option-value><a href=#attr-option-value>value</a></code></td>
+ <td><code><a href=#htmloptionelement>HTMLOptionElement</a></code></td>
+ <tr><th><code><a href=#the-output-element>output</a></code></th>
+ <td>Calculated output value</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#category-reset title=category-reset>resettable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-output-for><a href=#attr-output-for>for</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code></td>
+ <td><code><a href=#htmloutputelement>HTMLOutputElement</a></code></td>
+ <tr><th><code><a href=#the-p-element>p</a></code></th>
+ <td>Paragraph</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlparagraphelement>HTMLParagraphElement</a></code></td>
+ <tr><th><code><a href=#the-param-element>param</a></code></th>
+ <td>Parameter for <code><a href=#the-object-element>object</a></code></td>
+ <td>none</td>
+ <td><code><a href=#the-object-element>object</a></code></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-param-name><a href=#attr-param-name>name</a></code>;
+ <code title=attr-param-value><a href=#attr-param-value>value</a></code></td>
+ <td><code><a href=#htmlparamelement>HTMLParamElement</a></code></td>
+ <tr><th><code><a href=#the-pre-element>pre</a></code></th>
+ <td>Block of preformatted text</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlpreelement>HTMLPreElement</a></code></td>
+ <tr><th><code><a href=#the-progress-element>progress</a></code></th>
+ <td>Progress bar</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>;
+ <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code></td>
+ <td><code><a href=#htmlprogresselement>HTMLProgressElement</a></code></td>
+ <tr><th><code><a href=#the-q-element>q</a></code></th>
+ <td>Quotation</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-q-cite><a href=#attr-q-cite>cite</a></code></td>
+ <td><code><a href=#htmlquoteelement>HTMLQuoteElement</a></code></td>
+ <tr><th><code><a href=#the-rp-element>rp</a></code></th>
+ <td>Parenthesis for ruby annotation text</td>
+ <td>none</td>
+ <td><code><a href=#the-ruby-element>ruby</a></code></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-rt-element>rt</a></code></th>
+ <td>Ruby annotation text</td>
+ <td>none</td>
+ <td><code><a href=#the-ruby-element>ruby</a></code></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-ruby-element>ruby</a></code></th>
+ <td>Ruby annotation(s)</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <code><a href=#the-rt-element>rt</a></code> element;
+ <code><a href=#the-rp-element>rp</a></code> element*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-samp-element>samp</a></code></th>
+ <td>Computer output</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#script>script</a></code></th>
+ <td>Embedded script</td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a>;
+ <a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><code><a href=#the-head-element-0>head</a></code>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>script, data, or script documentation*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-script-src><a href=#attr-script-src>src</a></code>;
+ <code title=attr-script-async><a href=#attr-script-async>async</a></code>;
+ <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code>;
+ <code title=attr-script-type><a href=#attr-script-type>type</a></code>;
+ <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code></td>
+ <td><code><a href=#htmlscriptelement>HTMLScriptElement</a></code></td>
+ <tr><th><code><a href=#the-section-element>section</a></code></th>
+ <td>Generic document or application section</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#sectioning-content title="Sectioning content">sectioning</a>;
+ <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidate</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-select-element>select</a></code></th>
+ <td>List box control</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#category-submit title=category-submit>submittable</a>;
+ <a href=#category-reset title=category-reset>resettable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><code><a href=#the-option-element>option</a></code>, <code><a href=#the-optgroup-element>optgroup</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
+ <code title=attr-select-size><a href=#attr-select-size>size</a></code></td>
+ <td><code><a href=#htmlselectelement>HTMLSelectElement</a></code></td>
+ <tr><th><code><a href=#the-small-element>small</a></code></th>
+ <td>Side comment</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-source-element>source</a></code></th>
+ <td>Media source for <code><a href=#video>video</a></code> or <code><a href=#audio>audio</a></code></td>
+ <td>none</td>
+ <td><code><a href=#video>video</a></code>;
+ <code><a href=#audio>audio</a></code></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-source-src><a href=#attr-source-src>src</a></code>;
+ <code title=attr-source-type><a href=#attr-source-type>type</a></code>;
+ <code title=attr-source-media><a href=#attr-source-media>media</a></code></td>
+ <td><code><a href=#htmlsourceelement>HTMLSourceElement</a></code></td>
+ <tr><th><code><a href=#the-span-element>span</a></code></th>
+ <td>Generic phrasing container</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlspanelement>HTMLSpanElement</a></code></td>
+ <tr><th><code><a href=#the-strong-element>strong</a></code></th>
+ <td>Importance</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-style-element>style</a></code></th>
+ <td>Embedded styling information</td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a>;
+ <a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-head-element-0>head</a></code>;
+ <code><a href=#the-noscript-element>noscript</a></code>*;
+ <a href=#flow-content title="flow content">flow</a>*</td>
+ <td>varies*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-style-media><a href=#attr-style-media>media</a></code>;
+ <code title=attr-style-type><a href=#attr-style-type>type</a></code>;
+ <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code></td>
+ <td><code><a href=#htmlstyleelement>HTMLStyleElement</a></code></td>
+ <tr><th><code><a href=#the-sub-and-sup-elements>sub</a></code></th>
+ <td>Subscript</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-summary-element>summary</a></code></th>
+ <td>Caption for <code><a href=#the-details-element>details</a></code></td>
+ <td>none</td>
+ <td><code><a href=#the-details-element>details</a></code></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-sub-and-sup-elements>sup</a></code></th>
+ <td>Superscript</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#the-table-element>table</a></code></th>
+ <td>Table</td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-caption-element>caption</a></code>*;
+ <code><a href=#the-colgroup-element>colgroup</a></code>*;
+ <code><a href=#the-thead-element>thead</a></code>*;
+ <code><a href=#the-tbody-element>tbody</a></code>*;
+ <code><a href=#the-tfoot-element>tfoot</a></code>*;
+ <code><a href=#the-tr-element>tr</a></code>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-table-summary><a href=#attr-table-summary>summary</a></code></td>
+ <td><code><a href=#htmltableelement>HTMLTableElement</a></code></td>
+ <tr><th><code><a href=#the-tbody-element>tbody</a></code></th>
+ <td>Group of rows in a table</td>
+ <td>none</td>
+ <td><code><a href=#the-table-element>table</a></code></td>
+ <td><code><a href=#the-tr-element>tr</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code></td>
+ <tr><th><code><a href=#the-td-element>td</a></code></th>
+ <td>Table cell</td>
+ <td><a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
+ <td><code><a href=#the-tr-element>tr</a></code></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>;
+ <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>;
+ <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code></td>
+ <td><code><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code></td>
+ <tr><th><code><a href=#the-textarea-element>textarea</a></code></th>
+ <td>Multiline text field</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a>;
+ <a href=#category-listed title=category-listed>listed</a>;
+ <a href=#category-label title=category-label>labelable</a>;
+ <a href=#category-submit title=category-submit>submittable</a>;
+ <a href=#category-reset title=category-reset>resettable</a>;
+ <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#text-content title="text content">text</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
+ <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
+ <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
+ <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code>;
+ <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code>;
+ <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>;
+ <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code>;
+ <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code></td>
+ <td><code><a href=#htmltextareaelement>HTMLTextAreaElement</a></code></td>
+ <tr><th><code><a href=#the-tfoot-element>tfoot</a></code></th>
+ <td>Group of footer rows in a table</td>
+ <td>none</td>
+ <td><code><a href=#the-table-element>table</a></code></td>
+ <td><code><a href=#the-tr-element>tr</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code></td>
+ <tr><th><code><a href=#the-th-element>th</a></code></th>
+ <td>Table header cell</td>
+ <td>none</td>
+ <td><code><a href=#the-tr-element>tr</a></code></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>;
+ <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>;
+ <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code>;
+ <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code></td>
+ <td><code><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code></td>
+ <tr><th><code><a href=#the-thead-element>thead</a></code></th>
+ <td>Group of heading rows in a table</td>
+ <td>none</td>
+ <td><code><a href=#the-table-element>table</a></code></td>
+ <td><code><a href=#the-tr-element>tr</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code></td>
+ <tr><th><code><a href=#the-time-element>time</a></code></th>
+ <td>Date and/or time</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code>;
+ <code title=attr-time-pubdate><a href=#attr-time-pubdate>pubdate</a></code></td>
+ <td><code><a href=#htmltimeelement>HTMLTimeElement</a></code></td>
+ <tr><th><code><a href=#the-title-element-0>title</a></code></th>
+ <td>Document title</td>
+ <td><a href=#metadata-content title="Metadata content">metadata</a></td>
+ <td><code><a href=#the-head-element-0>head</a></code></td>
+ <td><a href=#text-content title="text content">text</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmltitleelement>HTMLTitleElement</a></code></td>
+ <tr><th><code><a href=#the-tr-element>tr</a></code></th>
+ <td>Table row</td>
+ <td>none</td>
+ <td><code><a href=#the-table-element>table</a></code>;
+ <code><a href=#the-thead-element>thead</a></code>;
+ <code><a href=#the-tbody-element>tbody</a></code>;
+ <code><a href=#the-tfoot-element>tfoot</a></code></td>
+ <td><code><a href=#the-th-element>th</a></code>*;
+ <code><a href=#the-td-element>td</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmltablerowelement>HTMLTableRowElement</a></code></td>
+ </tr><!--TT--><tr><th><code><a href=#the-track-element>track</a></code></th>
+ <td>Timed track</td>
+ <td>none</td>
+ <td><code><a href=#audio>audio</a></code>;
+ <code><a href=#video>video</a></code></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code>;
+ <code title=attr-track-label><a href=#attr-track-label>label</a></code>;
+ <code title=attr-track-src><a href=#attr-track-src>src</a></code>;
+ <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code></td>
+ <td><code><a href=#htmltrackelement>HTMLTrackElement</a></code></td>
+ </tr><!--TT--><tr><th><code><a href=#the-ul-element>ul</a></code></th>
+ <td>List</td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><a href=#flow-content title="Flow content">flow</a></td>
+ <td><code><a href=#the-li-element>li</a></code></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlulistelement>HTMLUListElement</a></code></td>
+ <tr><th><code><a href=#the-var-element>var</a></code></th>
+ <td>Variable</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ <tr><th><code><a href=#video>video</a></code></th>
+ <td>Video player</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a>;
+ <a href=#embedded-content title="Embedded content">embedded</a>;
+ <a href=#interactive-content title="Interactive content">interactive</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><code><a href=#the-source-element>source</a></code>*;
+ <a href=#transparent>transparent</a>*</td>
+ <td><a href=#global-attributes title="global attributes">globals</a>;
+ <code title=attr-media-src><a href=#attr-media-src>src</a></code>;
+ <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code>;
+ <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>;
+ <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>;
+ <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>;
+ <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
+ <td><code><a href=#htmlvideoelement>HTMLVideoElement</a></code></td>
+ <tr><th><code><a href=#the-wbr-element>wbr</a></code></th>
+ <td>Line breaking opportunity</td>
+ <td><a href=#flow-content title="Flow content">flow</a>;
+ <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
+ <td>empty</td>
+ <td><a href=#global-attributes title="global attributes">globals</a></td>
+ <td><code><a href=#htmlelement>HTMLElement</a></code></td>
+ </table><p>An asterisk (*) in a cell indicates that the actual rules are more complicated than indicated in the table above.</p>
+
+
+
+
+ <h3 class=no-num id=element-content-categories>Element content categories</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <!-- when updating this also check the category-list <ul>s -->
+
+ <table><caption>List of element content categories</caption>
+ <thead><tr><th> Category
+ <th> Elements
+ <th> Elements with exceptions
+ <tbody><tr><td> <a href=#metadata-content>Metadata content</a>
+ <td>
+ <code><a href=#the-base-element>base</a></code>;
+ <code><a href=#the-command>command</a></code>;
+ <code><a href=#the-link-element>link</a></code>;
+ <code><a href=#meta>meta</a></code>;
+ <code><a href=#the-noscript-element>noscript</a></code>;
+ <code><a href=#script>script</a></code>;
+ <code><a href=#the-style-element>style</a></code>;
+ <code><a href=#the-title-element-0>title</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#flow-content>Flow content</a>
+ <td>
+ <code><a href=#the-a-element>a</a></code>;
+ <code><a href=#the-abbr-element>abbr</a></code>;
+ <code><a href=#the-address-element>address</a></code>;
+ <code><a href=#the-article-element>article</a></code>;
+ <code><a href=#the-aside-element>aside</a></code>;
+ <code><a href=#audio>audio</a></code>;
+ <code><a href=#the-b-element>b</a></code>;
+ <code><a href=#the-bdo-element>bdo</a></code>;
+ <code><a href=#the-blockquote-element>blockquote</a></code>;
+ <code><a href=#the-br-element>br</a></code>;
+ <code><a href=#the-button-element>button</a></code>;
+ <code><a href=#the-canvas-element>canvas</a></code>;
+ <code><a href=#the-cite-element>cite</a></code>;
+ <code><a href=#the-code-element>code</a></code>;
+ <code><a href=#the-command>command</a></code>;
+ <!-- v2DATAGRID <code>datagrid</code>; -->
+ <code><a href=#the-datalist-element>datalist</a></code>;
+ <code><a href=#the-del-element>del</a></code>;
+ <code><a href=#the-details-element>details</a></code>;
+ <code><a href=#the-dfn-element>dfn</a></code>;
+ <code><a href=#the-div-element>div</a></code>;
+ <code><a href=#the-dl-element>dl</a></code>;
+ <code><a href=#the-em-element>em</a></code>;
+ <code><a href=#the-embed-element>embed</a></code>;
+ <code><a href=#the-fieldset-element>fieldset</a></code>;
+ <code><a href=#the-figure-element>figure</a></code>;
+ <code><a href=#the-footer-element>footer</a></code>;
+ <code><a href=#the-form-element>form</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
+ <code><a href=#the-header-element>header</a></code>;
+ <code><a href=#the-hgroup-element>hgroup</a></code>;
+ <code><a href=#the-hr-element>hr</a></code>;
+ <code><a href=#the-i-element>i</a></code>;
+ <code><a href=#the-iframe-element>iframe</a></code>;
+ <code><a href=#the-img-element>img</a></code>;
+ <code><a href=#the-input-element>input</a></code>;
+ <code><a href=#the-ins-element>ins</a></code>;
+ <code><a href=#the-kbd-element>kbd</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-label-element>label</a></code>;
+ <code><a href=#the-map-element>map</a></code>;
+ <code><a href=#the-mark-element>mark</a></code>;
+ <code><a href=#math>math</a></code>;
+ <code><a href=#menus>menu</a></code>;
+ <code><a href=#the-meter-element>meter</a></code>;
+ <code><a href=#the-nav-element>nav</a></code>;
+ <code><a href=#the-noscript-element>noscript</a></code>;
+ <code><a href=#the-object-element>object</a></code>;
+ <code><a href=#the-ol-element>ol</a></code>;
+ <code><a href=#the-output-element>output</a></code>;
+ <code><a href=#the-p-element>p</a></code>;
+ <code><a href=#the-pre-element>pre</a></code>;
+ <code><a href=#the-progress-element>progress</a></code>;
+ <code><a href=#the-q-element>q</a></code>;
+ <code><a href=#the-ruby-element>ruby</a></code>;
+ <code><a href=#the-samp-element>samp</a></code>;
+ <code><a href=#script>script</a></code>;
+ <code><a href=#the-section-element>section</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-small-element>small</a></code>;
+ <code><a href=#the-span-element>span</a></code>;
+ <code><a href=#the-strong-element>strong</a></code>;
+ <code><a href=#the-sub-and-sup-elements>sub</a></code>;
+ <code><a href=#the-sub-and-sup-elements>sup</a></code>;
+ <code><a href=#svg>svg</a></code>;
+ <code><a href=#the-table-element>table</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>;
+ <code><a href=#the-time-element>time</a></code>;
+ <code><a href=#the-ul-element>ul</a></code>;
+ <code><a href=#the-var-element>var</a></code>;
+ <code><a href=#video>video</a></code>;
+ <code><a href=#the-wbr-element>wbr</a></code>;
+ <a href=#text-content title="text content">Text</a>
+ <td>
+ <code><a href=#the-area-element>area</a></code> (if it is a descendant of a <code><a href=#the-map-element>map</a></code> element);
+
+ <code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
+ <code><a href=#meta>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
+
+ <code><a href=#the-style-element>style</a></code> (if the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present)
+
+ <tr><td> <a href=#sectioning-content>Sectioning content</a>
+ <td>
+ <code><a href=#the-article-element>article</a></code>;
+ <code><a href=#the-aside-element>aside</a></code>;
+ <code><a href=#the-nav-element>nav</a></code>;
+ <code><a href=#the-section-element>section</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#heading-content>Heading content</a>
+ <td>
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
+ <code><a href=#the-hgroup-element>hgroup</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#phrasing-content>Phrasing content</a>
+ <td>
+ <code><a href=#the-abbr-element>abbr</a></code>;
+ <code><a href=#audio>audio</a></code>;
+ <code><a href=#the-b-element>b</a></code>;
+ <code><a href=#the-bdo-element>bdo</a></code>;
+ <code><a href=#the-br-element>br</a></code>;
+ <code><a href=#the-button-element>button</a></code>;
+ <code><a href=#the-canvas-element>canvas</a></code>;
+ <code><a href=#the-cite-element>cite</a></code>;
+ <code><a href=#the-code-element>code</a></code>;
+ <code><a href=#the-command>command</a></code>;
+ <code><a href=#the-datalist-element>datalist</a></code>;
+ <code><a href=#the-dfn-element>dfn</a></code>;
+ <code><a href=#the-em-element>em</a></code>;
+ <code><a href=#the-embed-element>embed</a></code>;
+ <code><a href=#the-i-element>i</a></code>;
+ <code><a href=#the-iframe-element>iframe</a></code>;
+ <code><a href=#the-img-element>img</a></code>;
+ <code><a href=#the-input-element>input</a></code>;
+ <code><a href=#the-kbd-element>kbd</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-label-element>label</a></code>;
+ <code><a href=#the-mark-element>mark</a></code>;
+ <code><a href=#math>math</a></code>;
+ <code><a href=#the-meter-element>meter</a></code>;
+ <code><a href=#the-noscript-element>noscript</a></code>;
+ <code><a href=#the-object-element>object</a></code>;
+ <code><a href=#the-output-element>output</a></code>;
+ <code><a href=#the-progress-element>progress</a></code>;
+ <code><a href=#the-q-element>q</a></code>;
+ <code><a href=#the-ruby-element>ruby</a></code>;
+ <code><a href=#the-samp-element>samp</a></code>;
+ <code><a href=#script>script</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-small-element>small</a></code>;
+ <code><a href=#the-span-element>span</a></code>;
+ <code><a href=#the-strong-element>strong</a></code>;
+ <code><a href=#the-sub-and-sup-elements>sub</a></code>;
+ <code><a href=#the-sub-and-sup-elements>sup</a></code>;
+ <code><a href=#svg>svg</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>;
+ <code><a href=#the-time-element>time</a></code>;
+ <code><a href=#the-var-element>var</a></code>;
+ <code><a href=#video>video</a></code>;
+ <code><a href=#the-wbr-element>wbr</a></code>;
+ <a href=#text-content title="text content">Text</a>
+ <td>
+ <code><a href=#the-a-element>a</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>);
+ <code><a href=#the-area-element>area</a></code> (if it is a descendant of a <code><a href=#the-map-element>map</a></code> element);
+ <code><a href=#the-del-element>del</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>);
+ <code><a href=#the-ins-element>ins</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>);
+
+ <code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
+
+ <code><a href=#the-map-element>map</a></code> (if it contains only <a href=#phrasing-content>phrasing content</a>)<!--
+ --><!--
+ -->; <code><a href=#meta>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)<!--
+ --><!--
+ -->
+
+ <tr><td> <a href=#embedded-content>Embedded content</a>
+ <td>
+ <code><a href=#audio>audio</a></code>
+ <code><a href=#the-canvas-element>canvas</a></code>
+ <code><a href=#the-embed-element>embed</a></code>
+ <code><a href=#the-iframe-element>iframe</a></code>
+ <code><a href=#the-img-element>img</a></code>
+ <code><a href=#math>math</a></code>
+ <code><a href=#the-object-element>object</a></code>
+ <code><a href=#svg>svg</a></code>
+ <code><a href=#video>video</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#interactive-content>Interactive content</a>
+ <td>
+ <code><a href=#the-a-element>a</a></code>;
+ <code><a href=#the-button-element>button</a></code>;
+ <!-- v2DATAGRID <code>datagrid</code>; -->
+ <code><a href=#the-details-element>details</a></code>;
+ <code><a href=#the-embed-element>embed</a></code>;
+ <code><a href=#the-iframe-element>iframe</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-label-element>label</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>;
+ <td>
+ <code><a href=#audio>audio</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present);
+ <code><a href=#the-img-element>img</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present);
+ <code><a href=#the-input-element>input</a></code> (if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state);
+ <code><a href=#menus>menu</a></code> (if the <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state);
+ <code><a href=#the-object-element>object</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)<!-- see also comment in <object> section -->;
+ <code><a href=#video>video</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)
+
+ <tr><td> <a href=#sectioning-root title="sectioning root">Sectioning roots</a>
+ <td>
+ <code><a href=#the-blockquote-element>blockquote</a></code>;
+ <code><a href=#the-body-element-0>body</a></code>;
+ <!-- v2DATAGRID <code>datagrid</code>; -->
+ <code><a href=#the-details-element>details</a></code>;
+ <code><a href=#the-fieldset-element>fieldset</a></code>;
+ <code><a href=#the-figure-element>figure</a></code>;
+ <code><a href=#the-td-element>td</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#form-associated-element title="form-associated element">Form-associated elements</a>
+ <td>
+ <code><a href=#the-button-element>button</a></code>;
+ <code><a href=#the-fieldset-element>fieldset</a></code>;
+ <code><a href=#the-input-element>input</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-label-element>label</a></code>;
+ <code><a href=#the-meter-element>meter</a></code>;
+ <code><a href=#the-object-element>object</a></code>;
+ <code><a href=#the-output-element>output</a></code>;
+ <code><a href=#the-progress-element>progress</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#category-listed title=category-listed>Listed elements</a>
+ <td>
+ <code><a href=#the-button-element>button</a></code>;
+ <code><a href=#the-fieldset-element>fieldset</a></code>;
+ <code><a href=#the-input-element>input</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-object-element>object</a></code>;
+ <code><a href=#the-output-element>output</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#category-label title=category-label>Labelable elements</a>
+ <td>
+ <code><a href=#the-button-element>button</a></code>;
+ <code><a href=#the-input-element>input</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-meter-element>meter</a></code>;
+ <code><a href=#the-output-element>output</a></code>;
+ <code><a href=#the-progress-element>progress</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#category-submit title=category-submit>Submittable elements</a>
+ <td>
+ <code><a href=#the-button-element>button</a></code>;
+ <code><a href=#the-input-element>input</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-object-element>object</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#category-reset title=category-reset>Resettable elements</a>
+ <td>
+ <code><a href=#the-input-element>input</a></code>;
+ <code><a href=#the-keygen-element>keygen</a></code>;
+ <code><a href=#the-output-element>output</a></code>;
+ <code><a href=#the-select-element>select</a></code>;
+ <code><a href=#the-textarea-element>textarea</a></code>
+ <td>
+ &mdash;
+
+ <tr><td> <a href=#formatblock-candidate title="formatBlock candidate"><code title="">formatBlock</code> candidates</a>
+ <td>
+ <code><a href=#the-section-element>section</a></code>;
+ <code><a href=#the-nav-element>nav</a></code>;
+ <code><a href=#the-article-element>article</a></code>;
+ <code><a href=#the-aside-element>aside</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
+ <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
+ <code><a href=#the-hgroup-element>hgroup</a></code>;
+ <code><a href=#the-header-element>header</a></code>;
+ <code><a href=#the-footer-element>footer</a></code>;
+ <code><a href=#the-address-element>address</a></code>;
+ <code><a href=#the-p-element>p</a></code>;
+ <code><a href=#the-pre-element>pre</a></code>;
+ <code><a href=#the-blockquote-element>blockquote</a></code>;
+ <code><a href=#the-div-element>div</a></code>
+ <td>
+ &mdash;
+
+ </table><h3 class=no-num id=attributes-1>Attributes</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <table><caption>List of attributes (excluding event handler content attributes)</caption>
+ <thead><tr><th> Attribute
+ <th> Element(s)
+ <th> Description
+ <th> Value
+ <tbody><tr><th> <code title="">accept</code>
+ <td> <code title=attr-input-accept><a href=#attr-input-accept>input</a></code>
+ <td> Hint for expected file type in <a href=#file-upload-state title=attr-input-type-file>file upload controls</a>
+ <td> <a href=#set-of-comma-separated-tokens>Set of comma-separated tokens</a>* consisting of <a href=#valid-mime-type title="valid MIME type">valid MIME types with no parameters</a> or <code title="">audio/*</code>, <code title="">video/*</code>, or <code title="">image/*</code>
+ <tr><th> <code title="">accept-charset</code>
+ <td> <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>form</a></code>
+ <td> Character encodings to use for <a href=#form-submission>form submission</a>
+ <td> <a href=#ordered-set-of-unique-space-separated-tokens>Ordered set of unique space-separated tokens</a> consisting of <a href=#preferred-mime-name title="preferred MIME name">preferred MIME names</a> of <a href=#ascii-compatible-character-encoding title="ASCII-compatible character encoding">ASCII-compatible character encodings</a>*
+ <tr><th> <code title="">accesskey</code>
+ <td> <a href=#the-accesskey-attribute title=attr-accesskey>HTML elements</a>
+ <td> Keyboard shortcut to activate or focus element
+ <td> <a href=#ordered-set-of-unique-space-separated-tokens>Ordered set of unique space-separated tokens</a> consisting of one Unicode code point in length
+ <tr><th> <code title="">action</code>
+ <td> <code title=attr-fs-action><a href=#attr-fs-action>form</a></code>
+ <td> <a href=#url>URL</a> to use for <a href=#form-submission>form submission</a>
+ <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">alt</code>
+ <td> <code title=attr-area-alt><a href=#attr-area-alt>area</a></code>;
+ <code title=attr-img-alt><a href=#attr-img-alt>img</a></code>;
+ <code title=attr-input-alt><a href=#attr-input-alt>input</a></code>
+ <td> Replacement text for use when images are not available
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">async</code>
+ <td> <code title=attr-script-async><a href=#attr-script-async>script</a></code>
+ <td> Execute script asynchronously
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">autocomplete</code>
+ <td> <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>form</a></code>;
+ <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>input</a></code>
+ <td> Prevent the user agent from providing autocompletions for the form control(s)
+ <td> "<code title="">on</code>"; "<code title="">off</code>"
+ <tr><th> <code title="">autofocus</code>
+ <td> <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>button</a></code>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>input</a></code>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>keygen</a></code>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>select</a></code>;
+ <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>textarea</a></code>
+ <td> Automatically focus the form control when the page is loaded
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">autoplay</code>
+ <td> <code title=attr-media-autoplay><a href=#attr-media-autoplay>audio</a></code>;
+ <code title=attr-media-autoplay><a href=#attr-media-autoplay>video</a></code>
+ <td> Hint that the <a href=#media-resource>media resource</a> can be started automatically when the page is loaded
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">challenge</code>
+ <td> <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>keygen</a></code>
+ <td> String to package with the generated and signed public key
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">charset</code>
+ <td> <code title=attr-meta-charset><a href=#attr-meta-charset>meta</a></code>
+ <td> <a href=#character-encoding-declaration>Character encoding declaration</a>
+ <td> <a href=#preferred-mime-name>Preferred MIME name</a> of an encoding*
+ <tr><th> <code title="">charset</code>
+ <td> <code title=attr-script-charset><a href=#attr-script-charset>script</a></code>
+ <td> Character encoding of the external script resource
+ <td> <a href=#preferred-mime-name>Preferred MIME name</a> of an encoding*
+ <tr><th> <code title="">checked</code>
+ <td> <code title=attr-command-checked><a href=#attr-command-checked>command</a></code>;
+ <code title=attr-input-checked><a href=#attr-input-checked>input</a></code>
+ <td> Whether the command or control is checked
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">cite</code>
+ <td> <code title=attr-blockquote-cite><a href=#attr-blockquote-cite>blockquote</a></code>;
+ <code title=attr-mod-cite><a href=#attr-mod-cite>del</a></code>;
+ <code title=attr-mod-cite><a href=#attr-mod-cite>ins</a></code>;
+ <code title=attr-q-cite><a href=#attr-q-cite>q</a></code>
+ <td> Link to the source of the quotation or more information about the edit
+ <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">class</code>
+ <td> <a href=#classes title=attr-class>HTML elements</a>
+ <td> Classes to which the element belongs
+ <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a>
+ <tr><th> <code title="">cols</code>
+ <td> <code title=attr-textarea-cols><a href=#attr-textarea-cols>textarea</a></code>
+ <td> Maximum number of characters per line
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
+ <tr><th> <code title="">colspan</code>
+ <td> <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>td</a></code>;
+ <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>th</a></code>
+ <td> Number of columns that the cell is to span
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
+ <tr><th> <code title="">content</code>
+ <td> <code title=attr-meta-content><a href=#attr-meta-content>meta</a></code>
+ <td> Value of the element
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">contenteditable</code>
+ <td> <a href=#attr-contenteditable title=attr-contenteditable>HTML elements</a>
+ <td> Whether the element is <a href=#editable>editable</a>
+ <td> "<code title="">true</code>"; "<code title="">false</code>"
+ <tr><th> <code title="">contextmenu</code>
+ <td> <a href=#attr-contextmenu title=attr-contextmenu>HTML elements</a>
+ <td> The element's context menu
+ <td> ID*
+ <tr><th> <code title="">controls</code>
+ <td> <code title=attr-media-controls><a href=#attr-media-controls>audio</a></code>;
+ <code title=attr-media-controls><a href=#attr-media-controls>video</a></code>
+ <td> Show user agent controls
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">coords</code>
+ <td> <code title=attr-area-coords><a href=#attr-area-coords>area</a></code>
+ <td> Coordinates for the shape to be created in an <a href=#image-map>image map</a>
+ <td> <a href=#valid-list-of-integers>Valid list of integers</a>*
+ <tr><th> <code title="">data</code>
+ <td> <code title=attr-object-data><a href=#attr-object-data>object</a></code>
+ <td> Address of the resource
+ <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">datetime</code>
+ <td> <code title=attr-mod-datetime><a href=#attr-mod-datetime>del</a></code>;
+ <code title=attr-mod-datetime><a href=#attr-mod-datetime>ins</a></code>
+ <td> Time and date of the change
+ <td> <a href=#valid-global-date-and-time-string>Valid global date and time string</a>
+ <tr><th> <code title="">datetime</code>
+ <td> <code title=attr-time-datetime><a href=#attr-time-datetime>time</a></code>
+ <td> Value of the element
+ <td> <a href=#valid-date-or-time-string>Valid date or time string</a>*
+ <tr><th> <code title="">defer</code>
+ <td> <code title=attr-script-defer><a href=#attr-script-defer>script</a></code>
+ <td> Defer script execution
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">dir</code>
+ <td> <a href=#the-dir-attribute title=attr-dir>HTML elements</a>
+ <td> <a href=#the-directionality title="the directionality">The text directionality</a> of the element
+ <td> "<code title="">ltr</code>"; "<code title="">rtl</code>"
+ <tr><th> <code title="">disabled</code>
+ <td> <code title=attr-fe-disabled><a href=#attr-fe-disabled>button</a></code>;
+ <code title=attr-command-disabled><a href=#attr-command-disabled>command</a></code>;
+ <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>fieldset</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>input</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>keygen</a></code>;
+ <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>optgroup</a></code>;
+ <code title=attr-option-disabled><a href=#attr-option-disabled>option</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>select</a></code>;
+ <code title=attr-fe-disabled><a href=#attr-fe-disabled>textarea</a></code>
+ <td> Whether the form control is disabled
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">draggable</code>
+ <td> <a href=#the-draggable-attribute title=attr-draggable>HTML elements</a>
+ <td> Whether the element is draggable
+ <td> "<code title="">true</code>"; "<code title="">false</code>"
+ <tr><th> <code title="">enctype</code>
+ <td> <code title=attr-fs-enctype><a href=#attr-fs-enctype>form</a></code>
+ <td> Form data set encoding type to use for <a href=#form-submission>form submission</a>
+ <td> "<code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>"; "<code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code>"; "<code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code>"
+ <tr><th> <code title="">for</code>
+ <td> <code title=attr-label-for><a href=#attr-label-for>label</a></code>
+ <td> Associate the label with form control
+ <td> ID*
+ <tr><th> <code title="">for</code>
+ <td> <code title=attr-output-for><a href=#attr-output-for>output</a></code>
+ <td> Specifies controls from which the output was calculated
+ <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a> consisting of IDs*
+ <tr><th> <code title="">form</code>
+ <td> <code title=attr-fae-form><a href=#attr-fae-form>button</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>fieldset</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>input</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>keygen</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>label</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>meter</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>object</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>output</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>progress</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>select</a></code>;
+ <code title=attr-fae-form><a href=#attr-fae-form>textarea</a></code>
+ <td> Associates the control with a <code><a href=#the-form-element>form</a></code> element
+ <td> ID*
+ <tr><th> <code title="">formaction</code>
+ <td> <code title=attr-fs-formaction><a href=#attr-fs-formaction>button</a></code>;
+ <code title=attr-fs-formaction><a href=#attr-fs-formaction>input</a></code>
+ <td> <a href=#url>URL</a> to use for <a href=#form-submission>form submission</a>
+ <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">formenctype</code>
+ <td> <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>button</a></code>;
+ <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>input</a></code>
+ <td> Form data set encoding type to use for <a href=#form-submission>form submission</a>
+ <td> "<code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>"; "<code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code>"; "<code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code>"
+ <tr><th> <code title="">formmethod</code>
+ <td> <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>button</a></code>;
+ <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>input</a></code>
+ <td> HTTP method to use for <a href=#form-submission>form submission</a>
+ <td> "<code title="">GET</code>"; "<code title="">POST</code>"; "<code title="">PUT</code>"; "<code title="">DELETE</code>"
+ <tr><th> <code title="">formnovalidate</code>
+ <td> <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>button</a></code>;
+ <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>input</a></code>
+ <td> Bypass form control validation for <a href=#form-submission>form submission</a>
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">formtarget</code>
+ <td> <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>button</a></code>;
+ <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>input</a></code>
+ <td> <a href=#browsing-context>Browsing context</a> for <a href=#form-submission>form submission</a>
+ <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
+ <tr><th> <code title="">headers</code>
+ <td> <code title=attr-tdth-headers><a href=#attr-tdth-headers>td</a></code>;
+ <code title=attr-tdth-headers><a href=#attr-tdth-headers>th</a></code>
+ <td> The header cells for this cell
+ <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a> consisting of IDs*
+ <tr><th> <code title="">height</code>
+ <td> <code title=attr-canvas-height><a href=#attr-canvas-height>canvas</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>embed</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>iframe</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>img</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>input</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>object</a></code>;
+ <code title=attr-dim-height><a href=#attr-dim-height>video</a></code>
+ <td> Vertical dimension
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a>
+ <tr><th> <code title="">hidden</code>
+ <td> <a href=#the-hidden-attribute title=attr-hidden>HTML elements</a>
+ <td> Whether the element is relevant
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">high</code>
+ <td> <code title=attr-meter-high><a href=#attr-meter-high>meter</a></code>
+ <td> Low limit of high range
+ <td> <a href=#valid-floating-point-number>Valid floating point number</a>*
+ <tr><th> <code title="">href</code>
+ <td> <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>a</a></code>;
+ <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>area</a></code>
+ <td> Address of the <a href=#hyperlink>hyperlink</a>
+ <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">href</code>
+ <td> <code title=attr-link-href><a href=#attr-link-href>link</a></code>
+ <td> Address of the <a href=#hyperlink>hyperlink</a>
+ <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">href</code>
+ <td> <code title=attr-base-href><a href=#attr-base-href>base</a></code>
+ <td> <a href=#document-base-url>Document base URL</a>
+ <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">hreflang</code>
+ <td> <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>a</a></code>;
+ <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>area</a></code>;
+ <code title=attr-link-hreflang><a href=#attr-link-hreflang>link</a></code>
+ <td> Language of the linked resource
+ <td> Valid BCP 47 language tag
+ <tr><th> <code title="">http-equiv</code>
+ <td> <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>meta</a></code>
+ <td> Pragma directive
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">icon</code>
+ <td> <code title=attr-command-icon><a href=#attr-command-icon>command</a></code>
+ <td> Icon for the command
+ <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">id</code>
+ <td> <a href=#the-id-attribute title=attr-id>HTML elements</a>
+ <td> The element's <a href=#concept-id title=concept-id>ID</a>
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">ismap</code>
+ <td> <code title=attr-img-ismap><a href=#attr-img-ismap>img</a></code>
+ <td> Whether the image is a server-side image map
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+
+ <tr><th> <code title="">itemid</code>
+ <td> <a href=#attr-itemid title=attr-itemid>HTML elements</a>
+ <td> <a href=#global-identifier>Global identifier</a> for a microdata item
+ <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">itemprop</code>
+ <td> <a href=#names:-the-itemprop-attribute title=attr-itemprop>HTML elements</a>
+ <td> <a href=#property-names>Property names</a> of a microdata item
+ <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a> consisting of <a href=#absolute-url title="absolute URL">valid absolute URLs</a>, <a href=#defined-property-name title="defined property name">defined property names</a>, or text*
+ <tr><th> <code title="">itemref</code>
+ <td> <code title=attr-itemref><a href=#attr-itemref>itemref</a></code>
+ <td> Referenced elements
+ <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a> consisting of IDs*
+ <tr><th> <code title="">itemscope</code>
+ <td> <a href=#attr-itemscope title=attr-itemscope>HTML elements</a>
+ <td> Introduces a microdata item
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">itemtype</code>
+ <td> <a href=#attr-itemtype title=attr-itemtype>HTML elements</a>
+ <td> <a href=#item-type>Item type</a> of a microdata item
+ <td> <a href=#absolute-url title="absolute URL">Valid absolute URL</a>*
+
+ <tr><th> <code title="">keytype</code>
+ <td> <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keygen</a></code>
+ <td> The type of cryptographic key to generate
+ <td> <a href=#attribute-text>Text</a>*
+<!--TT-->
+ <tr><th> <code title="">kind</code>
+ <td> <code title=attr-track-kind><a href=#attr-track-kind>track</a></code>
+ <td> The type of timed track
+ <td> "<code title=attr-track-kind-subtitles><a href=#attr-track-kind-subtitles>subtitles</a></code>";
+ "<code title=attr-track-kind-captions><a href=#attr-track-kind-captions>captions</a></code>";
+ "<code title=attr-track-kind-descriptions><a href=#attr-track-kind-descriptions>descriptions</a></code>";
+ "<code title=attr-track-kind-chapters><a href=#attr-track-kind-chapters>chapters</a></code>";
+ "<code title=attr-track-kind-metadata><a href=#attr-track-kind-metadata>metadata</a></code>"
+<!--TT-->
+ <tr><th> <code title="">label</code>
+ <td> <code title=attr-command-label><a href=#attr-command-label>command</a></code>;
+ <code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>;
+ <code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>;
+ <code title=attr-option-label><a href=#attr-option-label>option</a></code>;
+<!--TT-->
+ <code title=attr-track-label><a href=#attr-track-label>track</a></code>
+<!--TT-->
+ <td> User-visible label
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">lang</code>
+ <td> <a href=#attr-lang title=attr-lang>HTML elements</a>
+ <td> <a href=#language>Language</a> of the element
+ <td> Valid BCP 47 language tag or the empty string
+ <tr><th> <code title="">list</code>
+ <td> <code title=attr-input-list><a href=#attr-input-list>input</a></code>
+ <td> List of autocomplete options
+ <td> ID*
+ <tr><th> <code title="">loop</code>
+ <td> <code title=attr-media-loop><a href=#attr-media-loop>audio</a></code>;
+ <code title=attr-media-loop><a href=#attr-media-loop>video</a></code>
+ <td> Whether to loop the <a href=#media-resource>media resource</a>
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">low</code>
+ <td> <code title=attr-meter-low><a href=#attr-meter-low>meter</a></code>
+ <td> High limit of low range
+ <td> <a href=#valid-floating-point-number>Valid floating point number</a>*
+ <tr><th> <code title="">manifest</code>
+ <td> <code title=attr-html-manifest><a href=#attr-html-manifest>html</a></code>
+ <td> <a href=#concept-appcache-manifest title=concept-appcache-manifest>Application cache manifest</a>
+ <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">max</code>
+ <td> <code title=attr-input-max><a href=#attr-input-max>input</a></code>
+ <td> Maximum value
+ <td> varies*
+ <tr><th> <code title="">max</code>
+ <td> <code title=attr-meter-max><a href=#attr-meter-max>meter</a></code>;
+ <code title=attr-progress-max><a href=#attr-progress-max>progress</a></code>
+ <td> Upper bound of range
+ <td> <a href=#valid-floating-point-number>Valid floating point number</a>*
+ <tr><th> <code title="">maxlength</code>
+ <td> <code title=attr-input-maxlength><a href=#attr-input-maxlength>input</a></code>;
+ <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>textarea</a></code>
+ <td> Maximum length of value
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a>
+ <tr><th> <code title="">media</code>
+ <td> <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>a</a></code>;
+ <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>area</a></code>;
+ <code title=attr-link-media><a href=#attr-link-media>link</a></code>;
+ <code title=attr-source-media><a href=#attr-source-media>source</a></code>;
+ <code title=attr-style-media><a href=#attr-style-media>style</a></code>
+ <td> Applicable media
+ <td> <a href=#valid-media-query>Valid media query</a>
+ <tr><th> <code title="">method</code>
+ <td> <code title=attr-fs-method><a href=#attr-fs-method>form</a></code>
+ <td> HTTP method to use for <a href=#form-submission>form submission</a>
+ <td> "<code title="">GET</code>"; "<code title="">POST</code>"; "<code title="">PUT</code>"; "<code title="">DELETE</code>"
+ <tr><th> <code title="">min</code>
+ <td> <code title=attr-input-min><a href=#attr-input-min>input</a></code>
+ <td> Minimum value
+ <td> varies*
+ <tr><th> <code title="">min</code>
+ <td> <code title=attr-meter-min><a href=#attr-meter-min>meter</a></code>
+ <td> Lower bound of range
+ <td> <a href=#valid-floating-point-number>Valid floating point number</a>*
+ <tr><th> <code title="">multiple</code>
+ <td> <code title=attr-input-multiple><a href=#attr-input-multiple>input</a></code>;
+ <code title=attr-select-multiple><a href=#attr-select-multiple>select</a></code>
+ <td> Whether to allow multiple values
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">name</code>
+ <td> <code title=attr-fe-name><a href=#attr-fe-name>button</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>fieldset</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>input</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>keygen</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>output</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>select</a></code>;
+ <code title=attr-fe-name><a href=#attr-fe-name>textarea</a></code>
+ <td> Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">name</code>
+ <td> <code title=attr-form-name><a href=#attr-form-name>form</a></code>
+ <td> Name of form to use in the <code title=dom-document-forms><a href=#dom-document-forms>document.forms</a></code> API
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">name</code>
+ <td> <code title=attr-iframe-name><a href=#attr-iframe-name>iframe</a></code>;
+ <code title=attr-object-name><a href=#attr-object-name>object</a></code>
+ <td> Name of <a href=#nested-browsing-context>nested browsing context</a>
+ <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
+ <tr><th> <code title="">name</code>
+ <td> <code title=attr-map-name><a href=#attr-map-name>map</a></code>
+ <td> Name of <a href=#image-map>image map</a> to reference from the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">name</code>
+ <td> <code title=attr-meta-name><a href=#attr-meta-name>meta</a></code>
+ <td> Metadata name
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">name</code>
+ <td> <code title=attr-param-name><a href=#attr-param-name>param</a></code>
+ <td> Name of parameter
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">novalidate</code>
+ <td> <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>form</a></code>
+ <td> Bypass form control validation for <a href=#form-submission>form submission</a>
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">open</code>
+ <td> <code title=attr-details-open><a href=#attr-details-open>details</a></code>
+ <td> Whether the details are visible
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">optimum</code>
+ <td> <code title=attr-meter-optimum><a href=#attr-meter-optimum>meter</a></code>
+ <td> Optimum value in gauge
+ <td> <a href=#valid-floating-point-number>Valid floating point number</a>*
+ <tr><th> <code title="">pattern</code>
+ <td> <code title=attr-input-pattern><a href=#attr-input-pattern>input</a></code>
+ <td> Pattern to be matched by the form control's value
+ <td> Regular expression matching the JavaScript <i title="">Pattern</i> production
+<!--PING-->
+ <tr><th> <code title="">ping</code>
+ <td> <code title=attr-hyperlink-ping><a href=#ping>a</a></code>;
+ <code title=attr-hyperlink-ping><a href=#ping>area</a></code>
+ <td> <a href=#url title=URL>URLs</a> to ping
+ <td> <a href=#set-of-space-separated-tokens>Set of space-separated tokens</a> consisting of <a href=#valid-non-empty-url title="valid non-empty URL">valid non-empty URLs</a>
+<!--PING-->
+ <tr><th> <code title="">placeholder</code>
+ <td> <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code>;
+ <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code>
+ <td> User-visible label to be placed within the form control
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">poster</code>
+ <td> <code title=attr-video-poster><a href=#attr-video-poster>video</a></code>
+ <td> Poster frame to show prior to video playback
+ <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">preload</code>
+ <td> <code title=attr-media-preload><a href=#attr-media-preload>audio</a></code>;
+ <code title=attr-media-preload><a href=#attr-media-preload>video</a></code>
+ <td> Hints how much buffering the <a href=#media-resource>media resource</a> will likely need
+ <td> "<code title=attr-media-preload-none><a href=#attr-media-preload-none>none</a></code>";
+ "<code title=attr-media-preload-metadata><a href=#attr-media-preload-metadata>metadata</a></code>";
+ "<code title=attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>"
+ <tr><th> <code title="">pubdate</code>
+ <td> <code title=attr-time-pubdate><a href=#attr-time-pubdate>time</a></code>
+ <td> Whether the element's value represents a publication time for the nearest <code><a href=#the-article-element>article</a></code> or <code><a href=#the-body-element-0>body</a></code>
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">radiogroup</code>
+ <td> <code title=attr-command-radiogroup><a href=#attr-command-radiogroup>command</a></code>
+ <td> Name of group of commands to treat as a radio button group
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">readonly</code>
+ <td> <code title=attr-input-readonly><a href=#attr-input-readonly>input</a></code>;
+ <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>textarea</a></code>
+ <td> Whether to allow the value to be edited by the user
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">rel</code>
+ <td> <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>a</a></code>;
+ <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>area</a></code>;
+ <code title=attr-link-rel><a href=#attr-link-rel>link</a></code>
+ <td> Relationship between the document containing the hyperlink and the destination resource
+ <td> <a href=#set-of-space-separated-tokens>Set of space-separated tokens</a>*
+ <tr><th> <code title="">required</code>
+ <td> <code title=attr-input-required><a href=#attr-input-required>input</a></code>;
+ <code title=attr-textarea-required><a href=#attr-textarea-required>textarea</a></code>
+ <td> Whether the control is required for <a href=#form-submission>form submission</a>
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">reversed</code>
+ <td> <code title=attr-ol-reversed><a href=#attr-ol-reversed>ol</a></code>
+ <td> Number the list backwards
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">rows</code>
+ <td> <code title=attr-textarea-rows><a href=#attr-textarea-rows>textarea</a></code>
+ <td> Number of lines to show
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
+ <tr><th> <code title="">rowspan</code>
+ <td> <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>td</a></code>;
+ <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>th</a></code>
+ <td> Number of rows that the cell is to span
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a>
+ <tr><th> <code title="">sandbox</code>
+ <td> <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>iframe</a></code>
+ <td> Security rules for nested content
+ <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a> consisting of
+ "<code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>",
+ "<code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>", and
+ "<code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>"
+ <tr><th> <code title="">spellcheck</code>
+ <td> <a href=#attr-spellcheck title=attr-spellcheck>HTML elements</a>
+ <td> Whether the element is to have its spelling and grammar checked
+ <td> "<code title="">true</code>"; "<code title="">false</code>"
+ <tr><th> <code title="">scope</code>
+ <td> <code title=attr-th-scope><a href=#attr-th-scope>th</a></code>
+ <td> Specifies which cells the header cell applies to
+ <td> "<code title=attr-th-scope-row><a href=#attr-th-scope-row>row</a></code>";
+ "<code title=attr-th-scope-col><a href=#attr-th-scope-col>col</a></code>";
+ "<code title=attr-th-scope-rowgroup><a href=#attr-th-scope-rowgroup>rowgroup</a></code>";
+ "<code title=attr-th-scope-colgroup><a href=#attr-th-scope-colgroup>colgroup</a></code>"
+ <tr><th> <code title="">scoped</code>
+ <td> <code title=attr-style-scoped><a href=#attr-style-scoped>style</a></code>
+ <td> Whether the styles apply to the entire document or just the parent subtree
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">seamless</code>
+ <td> <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>iframe</a></code>
+ <td> Whether to apply the document's styles to the nested content
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">selected</code>
+ <td> <code title=attr-option-selected><a href=#attr-option-selected>option</a></code>
+ <td> Whether the option is selected by default
+ <td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">shape</code>
+ <td> <code title=attr-area-shape><a href=#attr-area-shape>area</a></code>
+ <td> The kind of shape to be created in an <a href=#image-map>image map</a>
+ <td> "<code title=attr-area-shape-keyword-circle><a href=#attr-area-shape-keyword-circle>circle</a></code>";
+ "<code title=attr-area-shape-keyword-default><a href=#attr-area-shape-keyword-default>default</a></code>";
+ "<code title=attr-area-shape-keyword-poly><a href=#attr-area-shape-keyword-poly>poly</a></code>";
+ "<code title=attr-area-shape-keyword-rect><a href=#attr-area-shape-keyword-rect>rect</a></code>"
+ <tr><th> <code title="">size</code>
+ <td> <code title=attr-input-size><a href=#attr-input-size>input</a></code>;
+ <code title=attr-select-size><a href=#attr-select-size>select</a></code>
+ <td> Size of the control
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
+ <tr><th> <code title="">sizes</code>
+ <td> <code title=attr-link-sizes><a href=#attr-link-sizes>link</a></code>
+ <td> Sizes of the icons (for <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code>="<code title=rel-icon><a href=#rel-icon>icon</a></code>")
+ <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a> consisting of sizes*
+ <tr><th> <code title="">span</code>
+ <td> <code title=attr-col-span><a href=#attr-col-span>col</a></code>;
+ <code title=attr-colgroup-span><a href=#attr-colgroup-span>colgroup</a></code>
+ <td> Number of columns spanned by the element
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
+ <tr><th> <code title="">src</code>
+ <td> <code title=attr-media-src><a href=#attr-media-src>audio</a></code>;
+ <code title=attr-embed-src><a href=#attr-embed-src>embed</a></code>;
+ <code title=attr-iframe-src><a href=#attr-iframe-src>iframe</a></code>;
+ <code title=attr-img-src><a href=#attr-img-src>img</a></code>;
+ <code title=attr-input-src><a href=#attr-input-src>input</a></code>;
+ <code title=attr-script-src><a href=#attr-script-src>script</a></code>;
+ <code title=attr-source-src><a href=#attr-source-src>source</a></code>;
+<!--TT-->
+ <code title=attr-track-src><a href=#attr-track-src>track</a></code>;
+<!--TT-->
+ <code title=attr-media-src><a href=#attr-media-src>video</a></code>
+ <td> Address of the resource
+ <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
+ <tr><th> <code title="">srcdoc</code>
+ <td> <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>iframe</a></code>
+ <td> A document to render in the <code><a href=#the-iframe-element>iframe</a></code>
+ <td> The source of <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>*
+<!--TT-->
+ <tr><th> <code title="">srclang</code>
+ <td> <code title=attr-track-srclang><a href=#attr-track-srclang>track</a></code>
+ <td> Language of the timed track
+ <td> Valid BCP 47 language tag
+<!--TT-->
+ <tr><th> <code title="">start</code>
+ <td> <code title=attr-ol-start><a href=#attr-ol-start>ol</a></code>
+ <td> Ordinal value of the first item
+ <td> <a href=#valid-integer>Valid integer</a>
+ <tr><th> <code title="">step</code>
+ <td> <code title=attr-input-step><a href=#attr-input-step>input</a></code>
+ <td> Granularity to be matched by the form control's value
+ <td> <a href=#valid-floating-point-number>Valid floating point number</a> greater than zero, or "<code title="">any</code>"
+ <tr><th> <code title="">style</code>
+ <td> <a href=#the-style-attribute title=attr-style>HTML elements</a>
+ <td> Presentational and formatting instructions
+ <td> CSS declarations*
+ <tr><th> <code title="">summary</code>
+ <td> <code title=attr-table-summary><a href=#attr-table-summary>table</a></code>
+ <td> Explanatory text for complex tables for users of screen readers
+ <td> <a href=#attribute-text>Text</a>*
+ <tr><th> <code title="">tabindex</code>
+ <td> <a href=#attr-tabindex title=attr-tabindex>HTML elements</a>
+ <td> Whether the element is focusable, and the relative order of the element for the purposes of sequential focus navigation
+ <td> <a href=#valid-integer>Valid integer</a>
+ <tr><th> <code title="">target</code>
+ <td> <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>a</a></code>;
+ <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>area</a></code>
+ <td> <a href=#browsing-context>Browsing context</a> for <a href=#hyperlink>hyperlink</a> <a href=#navigate title=navigate>navigation</a>
+ <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
+ <tr><th> <code title="">target</code>
+ <td> <code title=attr-base-target><a href=#attr-base-target>base</a></code>
+ <td> Default <a href=#browsing-context>browsing context</a> for <a href=#hyperlink>hyperlink</a> <a href=#navigate title=navigate>navigation</a> and <a href=#form-submission>form submission</a>
+ <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
+ <tr><th> <code title="">target</code>
+ <td> <code title=attr-fs-target><a href=#attr-fs-target>form</a></code>
+ <td> <a href=#browsing-context>Browsing context</a> for <a href=#form-submission>form submission</a>
+ <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
+ <tr><th> <code title="">title</code>
+ <td> <a href=#the-title-attribute title=attr-title>HTML elements</a>
+ <td> Advisory information for the element
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">title</code>
+ <td> <code title=attr-abbr-title><a href=#attr-abbr-title>abbr</a></code>;
+ <code title=attr-dfn-title><a href=#attr-dfn-title>dfn</a></code>
+ <td> Full term or expansion of abbreviation
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">title</code>
+ <td> <code title=attr-command-title><a href=#attr-command-title>command</a></code>
+ <td> Hint describing the command
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">title</code>
+ <td> <code title=attr-link-title><a href=#attr-link-title>link</a></code>
+ <td> Title of the link
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">title</code>
+ <td> <code title=attr-link-title><a href=#attr-link-title>link</a></code>;
+ <code title=attr-style-title><a href=#attr-style-title>style</a></code>
+ <td> Alternative style sheet set name
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">type</code>
+ <td> <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>a</a></code>;
+ <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>area</a></code>;
+ <code title=attr-link-type><a href=#attr-link-type>link</a></code>
+ <td> Hint for the type of the referenced resource
+ <td> <a href=#valid-mime-type>Valid MIME type</a>
+ <tr><th> <code title="">type</code>
+ <td> <code title=attr-button-type><a href=#attr-button-type>button</a></code>
+ <td> Type of button
+ <td> "<code title=attr-button-type-submit><a href=#attr-button-type-submit>submit</a></code>";
+ "<code title=attr-button-type-reset><a href=#attr-button-type-reset>reset</a></code>";
+ "<code title=attr-button-type-button><a href=#attr-button-type-button>button</a></code>"
+ <tr><th> <code title="">type</code>
+ <td> <code title=attr-button-type><a href=#attr-button-type>button</a></code>;
+ <code title=attr-input-type><a href=#attr-input-type>input</a></code>
+ <td> Type of form control
+ <td> <a href=#attr-input-type title=attr-input-type><code>input</code> type keyword</a>
+ <tr><th> <code title="">type</code>
+ <td> <code title=attr-command-type><a href=#attr-command-type>command</a></code>
+ <td> Type of command
+ <td> "<code title=attr-command-type-keyword-command><a href=#attr-command-type-keyword-command>command</a></code>";
+ "<code title=attr-command-type-keyword-checkbox><a href=#attr-command-type-keyword-checkbox>checkbox</a></code>";
+ "<code title=attr-command-type-keyword-radio><a href=#attr-command-type-keyword-radio>radio</a></code>"
+ <tr><th> <code title="">type</code>
+ <td> <code title=attr-embed-type><a href=#attr-embed-type>embed</a></code>;
+ <code title=attr-object-type><a href=#attr-object-type>object</a></code>;
+ <code title=attr-script-type><a href=#attr-script-type>script</a></code>;
+ <code title=attr-source-type><a href=#attr-source-type>source</a></code>;
+ <code title=attr-style-type><a href=#attr-style-type>style</a></code>
+ <td> Type of embedded resource
+ <td> <a href=#valid-mime-type>Valid MIME type</a>
+ <tr><th> <code title="">type</code>
+ <td> <code title=attr-menu-type><a href=#attr-menu-type>menu</a></code>
+ <td> Type of menu
+ <td> "<code title="context menu state"><a href=#context-menu-state>context</a></code>"; "<code title="toolbar state"><a href=#toolbar-state>toolbar</a></code>"
+ <tr><th> <code title="">usemap</code>
+ <td> <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>img</a></code>;
+ <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>object</a></code>
+ <td> Name of <a href=#image-map>image map</a> to use
+ <td> <a href=#valid-hash-name-reference>Valid hash-name reference</a>*
+ <tr><th> <code title="">value</code>
+ <td> <code title=attr-button-value><a href=#attr-button-value>button</a></code>;
+ <code title=attr-option-value><a href=#attr-option-value>option</a></code>
+ <td> Value to be used for <a href=#form-submission>form submission</a>
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">value</code>
+ <td> <code title=attr-input-value><a href=#attr-input-value>input</a></code>
+ <td> Value of the form control
+ <td> varies*
+ <tr><th> <code title="">value</code>
+ <td> <code title=attr-li-value><a href=#attr-li-value>li</a></code>
+ <td> Ordinal value of the list item
+ <td> <a href=#valid-integer>Valid integer</a>
+ <tr><th> <code title="">value</code>
+ <td> <code title=attr-meter-value><a href=#attr-meter-value>meter</a></code>;
+ <code title=attr-progress-value><a href=#attr-progress-value>progress</a></code>
+ <td> Current value of the element
+ <td> <a href=#valid-floating-point-number>Valid floating point number</a>
+ <tr><th> <code title="">value</code>
+ <td> <code title=attr-param-value><a href=#attr-param-value>param</a></code>
+ <td> Value of parameter
+ <td> <a href=#attribute-text>Text</a>
+ <tr><th> <code title="">width</code>
+ <td> <code title=attr-canvas-width><a href=#attr-canvas-width>canvas</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>embed</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>iframe</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>img</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>input</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>object</a></code>;
+ <code title=attr-dim-width><a href=#attr-dim-width>video</a></code>
+ <td> Horizontal dimension
+ <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a>
+ <tr><th> <code title="">wrap</code>
+ <td> <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>textarea</a></code>
+ <td> How the value of the form control is to be wrapped for <a href=#form-submission>form submission</a>
+ <td> "<code title=attr-textarea-wrap-soft><a href=#attr-textarea-wrap-soft>soft</a></code>";
+ "<code title=attr-textarea-wrap-hard><a href=#attr-textarea-wrap-hard>hard</a></code>"
+ </table><p>An asterisk (*) in a cell indicates that the actual rules are more complicated than indicated in the table above.</p>
+
+ <hr><table><caption>List of event handler content attributes</caption>
+ <thead><tr><th> Attribute
+ <th> Element(s)
+ <th> Description
+ <th> Value
+ <tbody><tr><th> <code title="">onabort</code>
+ <td> <a href=#handler-onabort title=handler-onabort>HTML elements</a>
+ <td> <code title=event-abort>abort</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onafterprint</code>
+ <td> <code title=handler-window-onafterprint><a href=#handler-window-onafterprint>body</a></code>
+ <td> <code title=event-afterprint>afterprint</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onbeforeprint</code>
+ <td> <code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>body</a></code>
+ <td> <code title=event-beforeprint>beforeprint</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onbeforeunload</code>
+ <td> <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>body</a></code>
+ <td> <code title=event-beforeunload>beforeunload</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onblur</code>
+ <td> <code title=handler-window-onblur><a href=#handler-window-onblur>body</a></code>
+ <td> <code title=event-blur>blur</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onblur</code>
+ <td> <a href=#handler-onblur title=handler-onblur>HTML elements</a>
+ <td> <code title=event-blur>blur</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">oncanplay</code>
+ <td> <a href=#handler-oncanplay title=handler-oncanplay>HTML elements</a>
+ <td> <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">oncanplaythrough</code>
+ <td> <a href=#handler-oncanplaythrough title=handler-oncanplaythrough>HTML elements</a>
+ <td> <code title=event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onchange</code>
+ <td> <a href=#handler-onchange title=handler-onchange>HTML elements</a>
+ <td> <code title=event-change>change</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onclick</code>
+ <td> <a href=#handler-onclick title=handler-onclick>HTML elements</a>
+ <td> <code title=event-click><a href=#event-click>click</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">oncontextmenu</code>
+ <td> <a href=#handler-oncontextmenu title=handler-oncontextmenu>HTML elements</a>
+ <td> <code title=event-contextmenu>contextmenu</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondblclick</code>
+ <td> <a href=#handler-ondblclick title=handler-ondblclick>HTML elements</a>
+ <td> <code title=event-dblclick>dblclick</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondrag</code>
+ <td> <a href=#handler-ondrag title=handler-ondrag>HTML elements</a>
+ <td> <code title=event-drag><a href=#event-drag>drag</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondragend</code>
+ <td> <a href=#handler-ondragend title=handler-ondragend>HTML elements</a>
+ <td> <code title=event-dragend><a href=#event-dragend>dragend</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondragenter</code>
+ <td> <a href=#handler-ondragenter title=handler-ondragenter>HTML elements</a>
+ <td> <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondragleave</code>
+ <td> <a href=#handler-ondragleave title=handler-ondragleave>HTML elements</a>
+ <td> <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondragover</code>
+ <td> <a href=#handler-ondragover title=handler-ondragover>HTML elements</a>
+ <td> <code title=event-dragover><a href=#event-dragover>dragover</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondragstart</code>
+ <td> <a href=#handler-ondragstart title=handler-ondragstart>HTML elements</a>
+ <td> <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondrop</code>
+ <td> <a href=#handler-ondrop title=handler-ondrop>HTML elements</a>
+ <td> <code title=event-drop><a href=#event-drop>drop</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ondurationchange</code>
+ <td> <a href=#handler-ondurationchange title=handler-ondurationchange>HTML elements</a>
+ <td> <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onemptied</code>
+ <td> <a href=#handler-onemptied title=handler-onemptied>HTML elements</a>
+ <td> <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onended</code>
+ <td> <a href=#handler-onended title=handler-onended>HTML elements</a>
+ <td> <code title=event-media-ended><a href=#event-media-ended>ended</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onerror</code>
+ <td> <code title=handler-window-onerror><a href=#handler-window-onerror>body</a></code>
+ <td> <code title=event-error>error</code> event handler for <code><a href=#window>Window</a></code> object, and handler for <a href=#runtime-script-errors>script error notifications</a>
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onerror</code>
+ <td> <a href=#handler-onerror title=handler-onerror>HTML elements</a>
+ <td> <code title=event-error>error</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onfocus</code>
+ <td> <code title=handler-window-onfocus><a href=#handler-window-onfocus>body</a></code>
+ <td> <code title=event-focus>focus</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onfocus</code>
+ <td> <a href=#handler-onfocus title=handler-onfocus>HTML elements</a>
+ <td> <code title=event-focus>focus</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onformchange</code>
+ <td> <a href=#handler-onformchange title=handler-onformchange>HTML elements</a>
+ <td> <code title=event-formchange>formchange</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onforminput</code>
+ <td> <a href=#handler-onforminput title=handler-onforminput>HTML elements</a>
+ <td> <code title=event-forminput>forminput</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onhashchange</code>
+ <td> <code title=handler-window-onhashchange><a href=#handler-window-onhashchange>body</a></code>
+ <td> <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">oninput</code>
+ <td> <a href=#handler-oninput title=handler-oninput>HTML elements</a>
+ <td> <code title=event-input>input</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">oninvalid</code>
+ <td> <a href=#handler-oninvalid title=handler-oninvalid>HTML elements</a>
+ <td> <code title=event-invalid>invalid</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onkeydown</code>
+ <td> <a href=#handler-onkeydown title=handler-onkeydown>HTML elements</a>
+ <td> <code title=event-keydown>keydown</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onkeypress</code>
+ <td> <a href=#handler-onkeypress title=handler-onkeypress>HTML elements</a>
+ <td> <code title=event-keypress>keypress</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onkeyup</code>
+ <td> <a href=#handler-onkeyup title=handler-onkeyup>HTML elements</a>
+ <td> <code title=event-keyup>keyup</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onload</code>
+ <td> <code title=handler-window-onload><a href=#handler-window-onload>body</a></code>
+ <td> <code title=event-load>load</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onload</code>
+ <td> <a href=#handler-onload title=handler-onload>HTML elements</a>
+ <td> <code title=event-load>load</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onloadeddata</code>
+ <td> <a href=#handler-onloadeddata title=handler-onloadeddata>HTML elements</a>
+ <td> <code title=event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onloadedmetadata</code>
+ <td> <a href=#handler-onloadedmetadata title=handler-onloadedmetadata>HTML elements</a>
+ <td> <code title=event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onloadstart</code>
+ <td> <a href=#handler-onloadstart title=handler-onloadstart>HTML elements</a>
+ <td> <code title=event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onmessage</code>
+ <td> <code title=handler-window-onmessage><a href=#handler-window-onmessage>body</a></code>
+ <td> <code title=event-message><a href=#event-message>message</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onmousedown</code>
+ <td> <a href=#handler-onmousedown title=handler-onmousedown>HTML elements</a>
+ <td> <code title=event-mousedown>mousedown</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onmousemove</code>
+ <td> <a href=#handler-onmousemove title=handler-onmousemove>HTML elements</a>
+ <td> <code title=event-mousemove>mousemove</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onmouseout</code>
+ <td> <a href=#handler-onmouseout title=handler-onmouseout>HTML elements</a>
+ <td> <code title=event-mouseout>mouseout</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onmouseover</code>
+ <td> <a href=#handler-onmouseover title=handler-onmouseover>HTML elements</a>
+ <td> <code title=event-mouseover>mouseover</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onmouseup</code>
+ <td> <a href=#handler-onmouseup title=handler-onmouseup>HTML elements</a>
+ <td> <code title=event-mouseup>mouseup</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onmousewheel</code>
+ <td> <a href=#handler-onmousewheel title=handler-onmousewheel>HTML elements</a>
+ <td> <code title=event-mousewheel>mousewheel</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onoffline</code>
+ <td> <code title=handler-window-onoffline><a href=#handler-window-onoffline>body</a></code>
+ <td> <code title=event-offline><a href=#event-offline>offline</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ononline</code>
+ <td> <code title=handler-window-ononline><a href=#handler-window-ononline>body</a></code>
+ <td> <code title=event-online><a href=#event-online>online</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onpause</code>
+ <td> <a href=#handler-onpause title=handler-onpause>HTML elements</a>
+ <td> <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onplay</code>
+ <td> <a href=#handler-onplay title=handler-onplay>HTML elements</a>
+ <td> <code title=event-media-play><a href=#event-media-play>play</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onplaying</code>
+ <td> <a href=#handler-onplaying title=handler-onplaying>HTML elements</a>
+ <td> <code title=event-media-playing><a href=#event-media-playing>playing</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onpagehide</code>
+ <td> <code title=handler-window-onpagehide><a href=#handler-window-onpagehide>body</a></code>
+ <td> <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onpageshow</code>
+ <td> <code title=handler-window-onpageshow><a href=#handler-window-onpageshow>body</a></code>
+ <td> <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onpopstate</code>
+ <td> <code title=handler-window-onpopstate><a href=#handler-window-onpopstate>body</a></code>
+ <td> <code title=event-popstate><a href=#event-popstate>popstate</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onprogress</code>
+ <td> <a href=#handler-onprogress title=handler-onprogress>HTML elements</a>
+ <td> <code title=event-media-progress><a href=#event-media-progress>progress</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onratechange</code>
+ <td> <a href=#handler-onratechange title=handler-onratechange>HTML elements</a>
+ <td> <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onreadystatechange</code>
+ <td> <a href=#handler-onreadystatechange title=handler-onreadystatechange>HTML elements</a>
+ <td> <code title=event-readystatechange>readystatechange</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onredo</code>
+ <td> <code title=handler-window-onredo><a href=#handler-window-onredo>body</a></code>
+ <td> <code title=event-redo><a href=#event-redo>redo</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onresize</code>
+ <td> <code title=handler-window-onresize><a href=#handler-window-onresize>body</a></code>
+ <td> <code title=event-resize>resize</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onscroll</code>
+ <td> <a href=#handler-onscroll title=handler-onscroll>HTML elements</a>
+ <td> <code title=event-scroll>scroll</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onseeked</code>
+ <td> <a href=#handler-onseeked title=handler-onseeked>HTML elements</a>
+ <td> <code title=event-media-seeked><a href=#event-media-seeked>seeked</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onseeking</code>
+ <td> <a href=#handler-onseeking title=handler-onseeking>HTML elements</a>
+ <td> <code title=event-media-seeking><a href=#event-media-seeking>seeking</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onselect</code>
+ <td> <a href=#handler-onselect title=handler-onselect>HTML elements</a>
+ <td> <code title=event-select>select</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onshow</code>
+ <td> <a href=#handler-onshow title=handler-onshow>HTML elements</a>
+ <td> <code title=event-show>show</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onstalled</code>
+ <td> <a href=#handler-onstalled title=handler-onstalled>HTML elements</a>
+ <td> <code title=event-media-stalled><a href=#event-media-stalled>stalled</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onstorage</code>
+ <td> <code title=handler-window-onstorage><a href=#handler-window-onstorage>body</a></code>
+ <td> <code title=event-storage>storage</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onsubmit</code>
+ <td> <a href=#handler-onsubmit title=handler-onsubmit>HTML elements</a>
+ <td> <code title=event-submit>submit</code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onsuspend</code>
+ <td> <a href=#handler-onsuspend title=handler-onsuspend>HTML elements</a>
+ <td> <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">ontimeupdate</code>
+ <td> <a href=#handler-ontimeupdate title=handler-ontimeupdate>HTML elements</a>
+ <td> <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onundo</code>
+ <td> <code title=handler-window-onundo><a href=#handler-window-onundo>body</a></code>
+ <td> <code title=event-undo><a href=#event-undo>undo</a></code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onunload</code>
+ <td> <code title=handler-window-onunload><a href=#handler-window-onunload>body</a></code>
+ <td> <code title=event-unload>unload</code> event handler for <code><a href=#window>Window</a></code> object
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onvolumechange</code>
+ <td> <a href=#handler-onvolumechange title=handler-onvolumechange>HTML elements</a>
+ <td> <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ <tr><th> <code title="">onwaiting</code>
+ <td> <a href=#handler-onwaiting title=handler-onwaiting>HTML elements</a>
+ <td> <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> event handler
+ <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>
+
+ </table><!-- v2 for completeness: (also search for REFLECTIDL)
+ <h3 class="no-num">Reflecting IDL attributes</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <table>
+ <caption>List of <dfn>reflecting IDL attributes</dfn></caption>
+ <thead>
+ <tr>
+ <th> Interface
+ <th> Element(s)
+ <th> IDL attribute
+ <th> Reflects...
+ <tbody>
+ ...
+ <tr>
+ <td> <code>HTMLElement</code>
+ <td> <span>HTML elements</span>
+ <td> <code title="dom-contextMenu">contextMenu</code>
+ <td> <code title="attr-contextmenu">contextmenu</code>
+ <tr>
+ <td> <code>HTMLOptionElement</code>
+ <td> <code>option</code>
+ <td> <code title="dom-option-text">text</code>
+ <td> <code>textContent</code>
+ </table>
+ ( include option.text; textarea.defaultValue, and other attributes that "reflect" the element's textContent )
+--><h3 class=no-num id=interfaces>Interfaces</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <table><caption>List of interfaces for elements</caption>
+ <thead><tr><th> Element(s)
+ <th> Interface(s)
+ <tbody><tr><td> <code><a href=#the-a-element>a</a></code>
+ <td> <code><a href=#htmlanchorelement>HTMLAnchorElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-abbr-element>abbr</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-address-element>address</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-area-element>area</a></code>
+ <td> <code><a href=#htmlareaelement>HTMLAreaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-article-element>article</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-aside-element>aside</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#audio>audio</a></code>
+ <td> <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> : <code><a href=#htmlmediaelement>HTMLMediaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-b-element>b</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-base-element>base</a></code>
+ <td> <code><a href=#htmlbaseelement>HTMLBaseElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-bdo-element>bdo</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-blockquote-element>blockquote</a></code>
+ <td> <code><a href=#htmlquoteelement>HTMLQuoteElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-body-element-0>body</a></code>
+ <td> <code><a href=#htmlbodyelement>HTMLBodyElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-br-element>br</a></code>
+ <td> <code><a href=#htmlbrelement>HTMLBRElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-button-element>button</a></code>
+ <td> <code><a href=#htmlbuttonelement>HTMLButtonElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-canvas-element>canvas</a></code>
+ <td> <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-caption-element>caption</a></code>
+ <td> <code><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-cite-element>cite</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-code-element>code</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-col-element>col</a></code>
+ <td> <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-colgroup-element>colgroup</a></code>
+ <td> <code><a href=#htmltablecolelement>HTMLTableColElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-command>command</a></code>
+ <td> <code><a href=#htmlcommandelement>HTMLCommandElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-datalist-element>datalist</a></code>
+ <td> <code><a href=#htmldatalistelement>HTMLDataListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-dd-element>dd</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-del-element>del</a></code>
+ <td> <code><a href=#htmlmodelement>HTMLModElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-details-element>details</a></code>
+ <td> <code><a href=#htmldetailselement>HTMLDetailsElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-div-element>div</a></code>
+ <td> <code><a href=#htmldivelement>HTMLDivElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-dl-element>dl</a></code>
+ <td> <code><a href=#htmldlistelement>HTMLDListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-dt-element>dt</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-em-element>em</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-embed-element>embed</a></code>
+ <td> <code><a href=#htmlembedelement>HTMLEmbedElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-fieldset-element>fieldset</a></code>
+ <td> <code><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-figcaption-element>figcaption</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-figure-element>figure</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-footer-element>footer</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-form-element>form</a></code>
+ <td> <code><a href=#htmlformelement>HTMLFormElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-head-element-0>head</a></code>
+ <td> <code><a href=#htmlheadelement>HTMLHeadElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
+ <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>
+ <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>
+ <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>
+ <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>
+ <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>
+ <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-header-element>header</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-hgroup-element>hgroup</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-hr-element>hr</a></code>
+ <td> <code><a href=#htmlhrelement>HTMLHRElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-html-element-0>html</a></code>
+ <td> <code><a href=#htmlhtmlelement>HTMLHtmlElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-i-element>i</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-iframe-element>iframe</a></code>
+ <td> <code><a href=#htmliframeelement>HTMLIFrameElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-img-element>img</a></code>
+ <td> <code><a href=#htmlimageelement>HTMLImageElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-input-element>input</a></code>
+ <td> <code><a href=#htmlinputelement>HTMLInputElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-ins-element>ins</a></code>
+ <td> <code><a href=#htmlmodelement>HTMLModElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-kbd-element>kbd</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-keygen-element>keygen</a></code>
+ <td> <code><a href=#htmlkeygenelement>HTMLKeygenElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-label-element>label</a></code>
+ <td> <code><a href=#htmllabelelement>HTMLLabelElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-legend-element>legend</a></code>
+ <td> <code><a href=#htmllegendelement>HTMLLegendElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-li-element>li</a></code>
+ <td> <code><a href=#htmllielement>HTMLLIElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-link-element>link</a></code>
+ <td> <code><a href=#htmllinkelement>HTMLLinkElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-map-element>map</a></code>
+ <td> <code><a href=#htmlmapelement>HTMLMapElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-mark-element>mark</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-meter-element>meter</a></code>
+ <td> <code><a href=#htmlmeterelement>HTMLMeterElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-nav-element>nav</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-noscript-element>noscript</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-object-element>object</a></code>
+ <td> <code><a href=#htmlobjectelement>HTMLObjectElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-ol-element>ol</a></code>
+ <td> <code><a href=#htmlolistelement>HTMLOListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-optgroup-element>optgroup</a></code>
+ <td> <code><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-option-element>option</a></code>
+ <td> <code><a href=#htmloptionelement>HTMLOptionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-output-element>output</a></code>
+ <td> <code><a href=#htmloutputelement>HTMLOutputElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-p-element>p</a></code>
+ <td> <code><a href=#htmlparagraphelement>HTMLParagraphElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-param-element>param</a></code>
+ <td> <code><a href=#htmlparamelement>HTMLParamElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-pre-element>pre</a></code>
+ <td> <code><a href=#htmlpreelement>HTMLPreElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-progress-element>progress</a></code>
+ <td> <code><a href=#htmlprogresselement>HTMLProgressElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-q-element>q</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-rp-element>rp</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-rt-element>rt</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-ruby-element>ruby</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-samp-element>samp</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-section-element>section</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-select-element>select</a></code>
+ <td> <code><a href=#htmlselectelement>HTMLSelectElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-small-element>small</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-source-element>source</a></code>
+ <td> <code><a href=#htmlsourceelement>HTMLSourceElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-span-element>span</a></code>
+ <td> <code><a href=#htmlspanelement>HTMLSpanElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-strong-element>strong</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-style-element>style</a></code>
+ <td> <code><a href=#htmlstyleelement>HTMLStyleElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-sub-and-sup-elements>sub</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-summary-element>summary</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-sub-and-sup-elements>sup</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-table-element>table</a></code>
+ <td> <code><a href=#htmltableelement>HTMLTableElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-tbody-element>tbody</a></code>
+ <td> <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-td-element>td</a></code>
+ <td> <code><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code> : <code><a href=#htmltablecellelement>HTMLTableCellElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-textarea-element>textarea</a></code>
+ <td> <code><a href=#htmltextareaelement>HTMLTextAreaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-tfoot-element>tfoot</a></code>
+ <td> <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-th-element>th</a></code>
+ <td> <code><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code> : <code><a href=#htmltablecellelement>HTMLTableCellElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-thead-element>thead</a></code>
+ <td> <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-time-element>time</a></code>
+ <td> <code><a href=#htmltimeelement>HTMLTimeElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-title-element-0>title</a></code>
+ <td> <code><a href=#htmltitleelement>HTMLTitleElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-tr-element>tr</a></code>
+ <td> <code><a href=#htmltablerowelement>HTMLTableRowElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+<!--TT-->
+ <tr><td> <code><a href=#the-track-element>track</a></code>
+ <td> <code><a href=#htmltrackelement>HTMLTrackElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+<!--TT-->
+
+ <tr><td> <code><a href=#the-ul-element>ul</a></code>
+ <td> <code><a href=#htmlulistelement>HTMLUListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-var-element>var</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#video>video</a></code>
+ <td> <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> : <code><a href=#htmlmediaelement>HTMLMediaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>
+
+ <tr><td> <code><a href=#the-wbr-element>wbr</a></code>
+ <td> <code><a href=#htmlelement>HTMLElement</a></code>
+
+ </table><!-- (only has events from HTML5) --><h3 class=no-num id=events-0>Events</h3>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <table><caption>List of events</caption>
+ <thead><tr><th> Event
+ <th> Interface
+ <th> Description
+ <tbody><tr><td> <code title=event-DOMActivate><a href=#event-domactivate>DOMActivate</a></code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at an element before its <a href=#activation-behavior>activation behavior</a> is run
+
+ <tr><td> <code title=event-DOMContentLoaded>DOMContentLoaded</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#document>Document</a></code> once it and its scripts have loaded, without waiting for other subresources
+
+ <tr><td> <code title=event-abort>abort</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the download was aborted by the user
+
+ <tr><td> <code title=event-afterprint>afterprint</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> after printing
+
+ <tr><td> <code title=event-beforeprint>beforeprint</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> before printing
+
+ <tr><td> <code title=event-beforeunload>beforeunload</code>
+ <td> <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the page is about to be unloaded, in case the page would like to show a warning prompt
+
+ <tr><td> <code title=event-blur>blur</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at nodes losing focus
+
+ <tr><td> <code title=event-change>change</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at controls when the user commits a value change
+
+ <tr><td> <code title=event-contextmenu>contextmenu</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at elements when the user requests their context menu
+
+ <tr><td> <code title=event-error>error</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at elements when network and script errors occur
+
+ <tr><td> <code title=event-focus>focus</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at nodes gaining focus
+
+ <tr><td> <code title=event-formchange>formchange</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at form controls when the user commits a value change to a control on the form
+
+ <tr><td> <code title=event-forminput>forminput</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at form controls when the user changes the value of a control on the form
+
+ <tr><td> <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code>
+ <td> <code><a href=#hashchangeevent>HashChangeEvent</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the fragment identifier part of <a href="#the-document's-current-address">the document's current address</a> changes
+
+ <tr><td> <code title=event-input>input</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at controls when the user changes the value
+
+ <tr><td> <code title=event-invalid>invalid</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at controls during form validation if they do not satisfy their constraints
+
+ <tr><td> <code title=event-load>load</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the document has finished loading; fired at an element containing a resource (e.g. <code><a href=#the-img-element>img</a></code>, <code><a href=#the-embed-element>embed</a></code>) when its resource has finished loading
+
+ <tr><td> <code title=event-message><a href=#event-message>message</a></code>
+ <td> <code><a href=#messageevent>MessageEvent</a></code>
+ <td> Fired at an object when the object receives a message
+
+ <tr><td> <code title=event-offline><a href=#event-offline>offline</a></code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the network connections fails
+
+ <tr><td> <code title=event-online><a href=#event-online>online</a></code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the network connections returns
+
+ <tr><td> <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code>
+ <td> <code><a href=#pagetransitionevent>PageTransitionEvent</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the page's entry in the <a href=#session-history>session history</a> stops being the <a href=#current-entry>current entry</a>
+
+ <tr><td> <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>
+ <td> <code><a href=#pagetransitionevent>PageTransitionEvent</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the page's entry in the <a href=#session-history>session history</a> becomes the <a href=#current-entry>current entry</a>
+
+ <tr><td> <code title=event-popstate><a href=#event-popstate>popstate</a></code>
+ <td> <code><a href=#popstateevent>PopStateEvent</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> when the user navigates the <a href=#session-history>session history</a>
+
+ <tr><td> <code title=event-readystatechange>readystatechange</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#document>Document</a></code> when it finishes parsing and again when all its subresources have finished loading
+
+ <tr><td> <code title=event-redo><a href=#event-redo>redo</a></code>
+ <td> <code><a href=#undomanagerevent>UndoManagerEvent</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> object when the user <a href=#redo:-moving-forward-in-the-undo-transaction-history title=do-redo>goes forward in the undo transaction history</a>
+
+ <tr><td> <code title=event-reset>reset</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at a <code><a href=#the-form-element>form</a></code> element when it is <a href=#concept-form-reset title=concept-form-reset>reset</a>
+
+ <tr><td> <code title=event-show>show</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at a <code><a href=#menus>menu</a></code> element when it is shown as a context menu
+
+ <tr><td> <code title=event-submit>submit</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at a <code><a href=#the-form-element>form</a></code> element when it is <a href=#concept-form-submit title=concept-form-submit>submitted</a>
+
+ <tr><td> <code title=event-undo><a href=#event-undo>undo</a></code>
+ <td> <code><a href=#undomanagerevent>UndoManagerEvent</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> object when the user <a href=#undo:-moving-back-in-the-undo-transaction-history title=do-undo>goes backward in the undo transaction history</a>
+
+ <tr><td> <code title=event-unload>unload</code>
+ <td> <code><a href=#event>Event</a></code>
+ <td> Fired at the <code><a href=#window>Window</a></code> object when the page is going away
+
+ </table><p class=note>See also <a href=#mediaevents>media element
+ events</a>, <a href=#appcacheevents>application cache events</a>,
+ and <a href=#dndevents>drag-and-drop events</a>.</p>
+
+
+
+
+
+
+
+
+
+
+ <h2 class=no-num id=references>References</h2><!--REFS-->
+
+ <p>All references are normative unless marked "Non-normative".</p>
+
+ <!-- Dates are only included for standards older than the Web, because the newer ones keep changing. -->
+
+ <dl><dt id=refsABNF>[ABNF]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/std/std68.txt>Augmented
+ BNF for Syntax Specifications: ABNF</a></cite>, D. Crocker,
+ P. Overell. IETF.</dd>
+
+ <dt id=refsABOUT>[ABOUT]</dt>
+ <dd><cite><a href=http://tools.ietf.org/html/draft-holsten-about-uri-scheme>The
+ 'about' URI scheme</a></cite>, J. Holsten, L. Hunt. IETF.</dd>
+
+ <dt id=refsARIA>[ARIA]</dt>
+ <dd><cite><a href=http://www.w3.org/WAI/PF/aria/>Accessible Rich
+ Internet Applications (WAI-ARIA)</a></cite>, J. Craig, M. Cooper, L. Pappas,
+ R. Schwerdtfeger, L. Seeman. W3C.</dd>
+
+ <dt id=refsARIAIMPL>[ARIAIMPL]</dt>
+ <dd><cite><a href=http://www.w3.org/WAI/PF/aria-implementation/>WAI-ARIA 1.0
+ User Agent Implementation Guide</a></cite>, A. Snow-Weaver,
+ M. Cooper. W3C.</dd>
+
+ <dt id=refsATAG>[ATAG]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/ATAG20/>Authoring Tool Accessibility
+ Guidelines (ATAG) 2.0</a></cite>, J. Richards, J. Spellman,
+ J. Treviranus. W3C.</dd>
+
+ <dt id=refsATOM>[ATOM]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.ietf.org/rfc/rfc4287.txt>The Atom Syndication
+ Format</a></cite>, M. Nottingham, R. Sayre. IETF.</dd>
+
+ <dt id=refsBCP47>[BCP47]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/bcp/bcp47.txt>Tags for
+ Identifying Languages; Matching of Language Tags</a></cite>,
+ A. Phillips, M. Davis. IETF.</dd>
+
+ <dt id=refsBECSS>[BECSS]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/becss/>Behavioral
+ Extensions to CSS</a></cite>, I. Hickson. W3C.</dd>
+
+ <dt id=refsBEZIER>[BEZIER]</dt>
+ <dd><cite>Courbes &agrave; poles</cite>, P. de Casteljau. INPI, 1959.</dd>
+
+ <dt id=refsBIDI>[BIDI]</dt>
+ <dd><cite><a href=http://www.unicode.org/reports/tr9/>UAX #9: Unicode
+ Bidirectional Algorithm</a></cite>, M. Davis. Unicode Consortium.</dd>
+
+ <dt id=refsBOCU1>[BOCU1]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.unicode.org/notes/tn6/>UTN #6: BOCU-1:
+ MIME-Compatible Unicode Compression</a></cite>, M. Scherer,
+ M. Davis. Unicode Consortium.</dd>
+
+ <dt id=refsCESU8>[CESU8]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr26/>UTR #26: Compatibility
+ Encoding Scheme For UTF-16: 8-BIT (CESU-8)</a></cite>,
+ T. Phipps. Unicode Consortium.</dd>
+
+ <dt id=refsCHARMOD>[CHARMOD]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/charmod/>Character Model for the World
+ Wide Web 1.0: Fundamentals</a></cite>, M. D&uuml;rst, F. Yergeau,
+ R. Ishida, M. Wolf, T. Texin. W3C.</dd>
+
+ <dt id=refsCOMPUTABLE>[COMPUTABLE]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.turingarchive.org/browse.php/B/12>On computable
+ numbers, with an application to the
+ Entscheidungsproblem</a></cite>, A. Turing. In <cite>Proceedings of
+ the London Mathematical Society</cite>, series 2, volume 42, pages
+ 230-265. London Mathematical Society, 1937.</dd>
+
+ <dt id=refsCOOKIES>[COOKIES]</dt>
+ <!--
+ <dd><cite><a href="http://www.ietf.org/rfc/rfc2109.txt">HTTP State
+ Management Mechanism</a></cite>, D. Kristol, L. Montulli. IETF.</dd>
+ <dd><cite><a href="http://www.ietf.org/rfc/rfc2965.txt">HTTP State Management
+ Mechanism</a></cite>, D. Kristol, L. Montulli. IETF.</dd>
+ -->
+ <dd><cite><a href=http://tools.ietf.org/html/draft-ietf-httpstate-cookie>HTTP State
+ Management Mechanism</a></cite>, A. Barth. IETF.</dd>
+
+ <dt id=refsCORS>[CORS]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/cors/">Cross-Origin
+ Resource Sharing</a></cite>, A. van Kesteren. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/2006/waf/access-control/>Cross-Origin
+ Resource Sharing</a></cite>, A. van Kesteren. W3C.</dd>
+
+ <dt id=refsCSS>[CSS]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/CSS/>Cascading Style Sheets Level 2
+ Revision 1</a></cite>, B. Bos, T. &Ccedil;elik, I.
+ Hickson, H. Lie. W3C.</dd>
+
+ <dt id=refsCSSATTR>[CSSATTR]</dt>
+ <dd><cite><a href=http://dev.w3.org/csswg/css-style-attr/>CSS
+ Styling Attribute Syntax</a></cite>, E. Etemad. W3C.</dd>
+
+ <dt id=refsCSSCOLOR>[CSSCOLOR]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/css3-color/">CSS Color
+ Module Level 3</a></cite>, T. &Ccedil;elik, C. Lilley, L.
+ Baron. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/csswg/css3-color/>CSS Color
+ Module Level 3</a></cite>, T. &Ccedil;elik, C. Lilley, L.
+ Baron. W3C.</dd>
+
+ <dt id=refsCSSFONTS>[CSSFONTS]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/css3-fonts/>CSS Fonts
+ Module Level 3</a></cite>, J. Daggett. W3C.</dd>
+
+ <dt id=refsCSSOM>[CSSOM]</dt>
+ <dd><cite><a href=http://dev.w3.org/csswg/cssom/>Cascading Style Sheets
+ Object Model (CSSOM)</a></cite>, A. van Kesteren. W3C.</dd>
+
+ <dt id=refsCSSUI>[CSSUI]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/css3-ui/>CSS3 Basic User
+ Interface Module</a></cite>, T. &Ccedil;elik. W3C.</dd>
+
+ <dt id=refsDOMCORE>[DOMCORE]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/DOM-Level-3-Core/>Document
+ Object Model (DOM) Level 3 Core Specification</a></cite>, A. Le
+ Hors, P. Le Hegaret, L. Wood, G. Nicol, J. Robie, M. Champion,
+ S. Byrnes. W3C.</dd>
+ <!--
+ <dd><cite><a href="http://simon.html5.org/specs/web-dom-core">Web
+ DOM Core</a></cite>, S. Pieters. W3C.</dd>
+ -->
+
+ <dt id=refsDOMEVENTS>[DOMEVENTS]</dt>
+ <!--
+ <dd><cite><a
+ href="http://www.w3.org/TR/DOM-Level-3-Events/">Document Object
+ Model (DOM) Level 3 Events Specification</a></cite>,
+ B. H&ouml;hrmann, P. Le Hegaret, T. Pixley. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html>Document
+ Object Model (DOM) Level 3 Events Specification</a></cite>,
+ D. Schepers. W3C.</dd>
+
+ <dt id=refsDOMRANGE>[DOMRANGE]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/DOM-Level-2-Traversal-Range/>Document
+ Object Model (DOM) Level 2 Traversal and Range
+ Specification</a></cite>, J. Kesselman, J. Robie, M. Champion,
+ P. Sharpe, V. Apparao, L. Wood. W3C.</dd>
+
+ <dt id=refsE163>[E163]</dt>
+ <dd><cite>Recommendation E.163 &mdash; Numbering Plan for The International
+ Telephone Service</cite>, CCITT Blue Book, Fascicle II.2, pp. 128-134, November
+ 1988.</dd>
+
+ <dt id=refsECMA262>[ECMA262]</dt>
+ <dd><cite><a href=http://www.ecma-international.org/publications/standards/Ecma-262.htm>ECMAScript
+ Language Specification</a></cite>. ECMA.</dd>
+
+ <dt id=refsECMA357>[ECMA357]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.ecma-international.org/publications/standards/Ecma-357.htm>ECMAScript
+ for XML (E4X) Specification</a></cite>. ECMA.</dd>
+
+ <dt id=refsEUCKR>[EUCKR]</dt>
+ <dd><cite>Hangul Unix Environment</cite>. Korea Industrial
+ Standards Association. Ref. No. KS C 5861-1992.</dd>
+
+ <dt id=refsEVENTSOURCE>[EVENTSOURCE]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/eventsource/">Server-Sent
+ Events</a></cite>, I. Hickson. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/html5/eventsource/>Server-Sent
+ Events</a></cite>, I. Hickson. W3C.</dd>
+
+ <dt id=refsFILEAPI>[FILEAPI]</dt>
+ <dd><cite><a href=http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.html>File
+ API</a></cite>, A. Ranganathan. W3C.</dd>
+
+ <dt id=refsGBK>[GBK]</dt>
+ <dd><cite>Chinese Internal Code Specification</cite>. Chinese IT
+ Standardization Technical Committee.</dd>
+ <!-- http://www.iana.org/assignments/charset-reg/GBK -->
+
+ <dt id=refsGRAPHICS>[GRAPHICS]</dt>
+ <dd>(Non-normative) <cite>Computer Graphics: Principles and
+ Practice in C</cite>, Second Edition, J. Foley, A. van Dam,
+ S. Feiner, J. Hughes. Addison-Wesley. ISBN
+ 0-201-84840-6.</dd>
+ <!--
+ This book ("Computer Graphics: Principles and Practice in C")
+ apparently does not make any references to literature in the
+ bibliographic section to define the "even-odd" rule for polygon
+ filling and hit testing. In the absence of such a reference, I
+ guess that this book is the most authoritative reference.
+ -->
+
+ <dt id=refsGREGORIAN>[GREGORIAN]</dt>
+ <dd>(Non-normative) <cite>Inter Gravissimas</cite>, A. Lilius,
+ C. Clavius. Gregory XIII Papal Bulls, February 1582.</dd>
+
+ <dt id=refsHATOM>[HATOM]</dt>
+ <dd>(Non-normative) <cite><a href=http://microformats.org/wiki/hatom>hAtom</a></cite>, D
+ Janes. Microformats.</dd>
+
+ <dt id=refsHTMLDIFF>[HTMLDIFF]</dt>
+ <!--
+ <dd>(Non-normative) <cite><a
+ href="http://www.w3.org/TR/html5-diff/">HTML5 differences from
+ HTML4</a></cite>, A. van Kesteren. W3C.</dd>
+ -->
+ <dd>(Non-normative) <cite><a href=http://dev.w3.org/html5/html4-differences/>HTML5
+ differences from HTML4</a></cite>, A. van Kesteren. W3C.</dd>
+
+ <dt id=refsHTTP>[HTTP]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2616.txt>Hypertext
+ Transfer Protocol &mdash; HTTP/1.1</a></cite>, R. Fielding, J. Gettys,
+ J. Mogul, H. Frystyk, L. Masinter, P. Leach, T. Berners-Lee. IETF.</dd>
+
+ <dt id=refsIANACHARSET>[IANACHARSET]</dt>
+ <dd><cite><a href=http://www.iana.org/assignments/character-sets>Character
+ Sets</a></cite>. IANA.</dd>
+
+ <dt id=refsIANAPERMHEADERS>[IANAPERMHEADERS]</dt>
+ <dd><cite><a href=http://www.iana.org/assignments/message-headers/perm-headers.html>Permanent
+ Message Header Field Names</a></cite>. IANA.</dd>
+
+ <dt id=refsISO8601>[ISO8601]</dt>
+ <dd><cite><a href="http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetch&amp;nodeid=4021199">ISO8601: Data elements and interchange formats &mdash; Information interchange &mdash; Representation of dates and times</a></cite>. ISO.</dd>
+
+ <dt id=refsISO885911>[ISO885911]</dt>
+ <dd><cite><a href=http://anubis.dkuug.dk/jtc1/sc2/open/02n3333.pdf>ISO-8859-11:
+ Information technology &mdash; 8-bit single-byte coded graphic
+ character sets &mdash; Part 11: Latin/Thai
+ alphabet</a></cite>. ISO.</dd>
+
+ <dt id=refsJSON>[JSON]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc4627.txt>The
+ application/json Media Type for JavaScript Object Notation
+ (JSON)</a></cite>, D. Crockford. IETF.</dd>
+
+ <dt id=refsJSURL>[JSURL]</dt>
+ <dd><cite><a href=http://tools.ietf.org/html/draft-hoehrmann-javascript-scheme>The
+ 'javascript' resource identifier scheme</a></cite>,
+ B. H&ouml;hrmann. IETF.</dd>
+
+ <dt id=refsMAILTO>[MAILTO]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2368.txt>The mailto URL
+ scheme</a></cite>, P. Hoffman, L. Masinter, J. Zawinski.
+ IETF.</dd>
+
+ <dt id=refsMATHML>[MATHML]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/MathML/>Mathematical
+ Markup Language (MathML)</a></cite>, D. Carlisle, P. Ion, R. Miner,
+ N. Poppelier. W3C.</dd>
+
+ <dt id=refsMIMESNIFF>[MIMESNIFF]</dt>
+ <dd><cite><a href=http://tools.ietf.org/html/draft-abarth-mime-sniff>Content-Type
+ Processing Model</a></cite>, A. Barth, I. Hickson. IETF.</dd>
+
+ <dt id=refsMQ>[MQ]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/css3-mediaqueries/">Media
+ Queries</a></cite>, H. Lie, T. &Ccedil;elik, D. Glazman, A. van
+ Kesteren. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/csswg/css3-mediaqueries/>Media
+ Queries</a></cite>, H. Lie, T. &Ccedil;elik, D. Glazman, A. van
+ Kesteren. W3C.</dd>
+
+ <dt id=refsNPAPI>[NPAPI]</dt>
+ <dd>(Non-normative) <cite><a href=https://developer.mozilla.org/en/Gecko_Plugin_API_Reference>Gecko
+ Plugin API Reference</a></cite>. Mozilla.</dd>
+
+ <dt id=refsOPENSEARCH>[OPENSEARCH]</dt>
+ <dd><cite><a href=http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML>Autodiscovery
+ in HTML/XHTML</a></cite>. In <cite>OpenSearch 1.1 Draft 4</cite>,
+ Section 4.6.2. OpenSearch.org.</dd>
+
+ <dt id=refsORIGIN>[ORIGIN]</dt>
+ <dd><cite><a href=http://tools.ietf.org/html/draft-abarth-origin>The HTTP
+ Origin Header</a></cite>, A. Barth, C. Jackson, I. Hickson. IETF.</dd>
+
+ <dt id=refsPINGBACK>[PINGBACK]</dt>
+ <dd><cite><a href=http://www.hixie.ch/specs/pingback/pingback>Pingback
+ 1.0</a></cite>, S. Langridge, I. Hickson.</dd>
+
+ <dt id=refsPNG>[PNG]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/PNG/>Portable Network
+ Graphics (PNG) Specification</a></cite>, D. Duce. W3C.</dd>
+
+ <dt id=refsPORTERDUFF>[PORTERDUFF]</dt>
+ <dd><cite><a href=http://keithp.com/~keithp/porterduff/p253-porter.pdf>Compositing
+ Digital Images</a></cite>, T. Porter, T. Duff. In <cite>Computer
+ graphics</cite>, volume 18, number 3, pp. 253-259. ACM Press, July
+ 1984.</dd>
+
+ <dt id=refsPPUTF8>[PPUTF8]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.ifi.uzh.ch/mml/mduerst/papers/PDF/IUC11-UTF-8.pdf>The
+ Properties and Promises <!-- Promizes (sic) --> of
+ UTF-8</a></cite>, M. D&uuml;rst. University of Z&uuml;rich. In <cite>Proceedings of the 11th International
+ Unicode Conference</cite>.</dd>
+
+ <dt id=refsPROGRESS>[PROGRESS]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/progress-events/">Progress
+ Events</a></cite>, C. McCathieNevile. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/2006/webapi/progress/Progress.html>Progress
+ Events</a></cite>, C. McCathieNevile. W3C.</dd>
+
+ <dt id=refsPSL>[PSL]</dt>
+ <dd><cite><a href=http://publicsuffix.org/>Public Suffix List</a></cite>.
+ Mozilla Foundation.</dd>
+
+ <dt id=refsRFC1034>[RFC1034]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc1034.txt>Domain
+ Names - Concepts and Facilities</a></cite>, P. Mockapetris. IETF,
+ November 1987.</dd>
+
+ <dt id=refsRFC1345>[RFC1345]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc1345.txt>Character Mnemonics
+ and Character Sets</a></cite>, K. Simonsen. IETF.</dd>
+
+ <dt id=refsRFC1468>[RFC1468]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc1468.txt>Japanese Character
+ Encoding for Internet Messages</a></cite>, J. Murai, M. Crispin, E. van der
+ Poel. IETF.</dd>
+
+ <dt id=refsRFC1554>[RFC1554]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc1554.txt>ISO-2022-JP-2:
+ Multilingual Extension of ISO-2022-JP</a></cite>, M. Ohta, K. Handa. IETF.</dd>
+
+ <dt id=refsRFC1557>[RFC1557]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc1557.txt>Korean Character
+ Encoding for Internet Messages</a></cite>, U. Choi, K. Chon, H. Park. IETF.</dd>
+
+ <dt id=refsRFC1842>[RFC1842]</dt>
+
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc1842.txt>ASCII
+ Printable Characters-Based Chinese Character Encoding for Internet
+ Messages</a></cite>, Y. Wei, Y. Zhang, J. Li, J. Ding, Y. Jiang.
+ IETF.</dd>
+
+ <dt id=refsRFC1922>[RFC1922]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc1922.txt>Chinese Character
+ Encoding for Internet Messages</a></cite>, HF. Zhu, DY. Hu, ZG. Wang, TC. Kao,
+ WCH. Chang, M. Crispin. IETF.</dd>
+
+ <dt id=refsRFC2045>[RFC2045]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2045.txt>Multipurpose Internet
+ Mail Extensions (MIME) Part One: Format of Internet Message Bodies</a></cite>,
+ N. Freed, N. Borenstein. IETF.</dd>
+
+ <dt id=refsRFC2046>[RFC2046]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2046.txt>Multipurpose Internet
+ Mail Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed,
+ N. Borenstein. IETF.</dd> <!-- for text/plain and
+ "Internet Media type"; not for definition of "valid MIME type". -->
+
+ <dt id=refsRFC2119>[RFC2119]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2119.txt>Key words for use in
+ RFCs to Indicate Requirement Levels</a></cite>, S. Bradner. IETF.</dd>
+
+ <dt id=refsRFC2237>[RFC2237]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2237.txt>Japanese Character
+ Encoding for Internet Messages</a></cite>, K. Tamaru. IETF.</dd>
+
+ <dt id=refsRFC2313>[RFC2313]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2313.txt>PKCS #1:
+ RSA Encryption</a></cite>, B. Kaliski. IETF.</dd>
+
+ <dt id=refsRFC2318>[RFC2318]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2318.txt>The
+ text/css Media Type</a></cite>, H. Lie, B. Bos, C. Lilley. IETF.</dd>
+
+ <dt id=refsRFC2388>[RFC2388]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2388.txt>Returning Values from
+ Forms: multipart/form-data</a></cite>, L. Masinter. IETF.</dd>
+
+ <dt id=refsRFC2425>[RFC2425]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2425.txt>A MIME
+ Content-Type for Directory Information</a></cite>, T. Howes,
+ M. Smith, F. Dawson. IETF.</dd>
+
+ <dt id=refsRFC2426>[RFC2426]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2426.txt>vCard MIME Directory
+ Profile</a></cite>, F. Dawson, T. Howes. IETF.</dd>
+
+ <dt id=refsRFC2445>[RFC2445]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2445.txt>Internet Calendaring
+ and Scheduling Core Object Specification (iCalendar)</a></cite>, F. Dawson, D.
+ Stenerson. IETF.</dd>
+
+ <dt id=refsRFC2483>[RFC2483]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2483.txt>URI Resolution
+ Services Necessary for URN Resolution</a></cite>, M. Mealling, R. Daniel.
+ IETF.</dd>
+
+ <dt id=refsRFC2781>[RFC2781]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2781.txt>UTF-16, an
+ encoding of ISO 10646</a></cite>, P. Hoffman, F. Yergeau. IETF.</dd>
+
+ <dt id=refsRFC2646>[RFC2646]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2646.txt>The Text/Plain Format
+ Parameter</a></cite>, R. Gellens. IETF.</dd>
+
+ <dt id=refsRFC3023>[RFC3023]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc3023.txt>XML Media
+ Types</a></cite>, M. Murata, S. St. Laurent, D. Kohn. IETF.</dd>
+
+ <dt id=refsRFC3279>[RFC3279]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc3279.txt>Algorithms
+ and Identifiers for the Internet X.509 Public Key Infrastructure
+ Certificate and Certificate Revocation List (CRL)
+ Profile</a></cite>, W. Polk, R. Housley, L. Bassham. IETF.</dd>
+
+ <dt id=refsRFC3490>[RFC3490]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc3490.txt>Internationalizing
+ Domain Names in Applications (IDNA)</a></cite>, P. Faltstrom, P. Hoffman, A.
+ Costello. IETF.</dd>
+
+ <dt id=refsRFC3548>[RFC3548]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc3548.txt>The Base16, Base32,
+ and Base64 Data Encodings</a></cite>, S. Josefsson. IETF.</dd>
+
+ <dt id=refsRFC3864>[RFC3864]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc3864.txt>Registration Procedures
+ for Message Header Fields</a></cite>, G. Klyne, M. Nottingham,
+ J. Mogul. IETF.</dd>
+
+ <dt id=refsRFC3986>[RFC3986]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc3986.txt>Uniform Resource
+ Identifier (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding, L.
+ Masinter. IETF.</dd>
+
+ <dt id=refsRFC3987>[RFC3987]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc3987.txt>Internationalized
+ Resource Identifiers (IRIs)</a></cite>, M. D&uuml;rst, M. Suignard. IETF.</dd>
+
+ <dt id=refsRFC4281>[RFC4281]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc4281.txt>The Codecs Parameter
+ for "Bucket" Media Types</a></cite>, R. Gellens, D. Singer, P. Frojdh. IETF.</dd>
+
+ <dt id=refsRFC4329>[RFC4329]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.ietf.org/rfc/rfc4329.txt>Scripting Media
+ Types</a></cite>, B. H&ouml;hrmann. IETF.</dd>
+
+ <dt id=refsRFC4770>[RFC4770]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc4770.txt>vCard Extensions for
+ Instant Messaging (IM)</a></cite>, C. Jennings, J. Reschke. IETF.</dd>
+
+ <dt id=refsRFC5280>[RFC5280]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc5280.txt>Internet
+ X.509 Public Key Infrastructure Certificate and Certificate
+ Revocation List (CRL) Profile</a></cite>, D. Cooper, S. Santesson,
+ S. Farrell, S. Boeyen, R. Housley, W. Polk. IETF.</dd>
+
+ <dt id=refsRFC5322>[RFC5322]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc5322.txt>Internet Message
+ Format</a></cite>, P. Resnick. IETF.</dd>
+
+ <dt id=refsRFC5724>[RFC5724]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc5724.txt>URI Scheme
+ for Global System for Mobile Communications (GSM) Short Message
+ Service (SMS)</a></cite>, E. Wilde, A. Vaha-Sipila. IETF.</dd>
+
+ <dt id=refsSCSU>[SCSU]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr6/>UTR #6: A Standard
+ Compression Scheme For Unicode</a></cite>, M. Wolf, K. Whistler,
+ C. Wicksteed, M. Davis, A. Freytag, M. Scherer. Unicode Consortium.</dd>
+
+ <dt id=refsSELECTORS>[SELECTORS]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/css3-selectors>Selectors</a></cite>,
+ T. &Ccedil;elik, E. Etemad, D. Glazman, I. Hickson, P. Linss,
+ J. Williams. W3C.</dd>
+
+ <dt id=refsSHIFTJIS>[SHIFTJIS]</dt>
+ <dd><cite>JIS X0208: 7-bit and 8-bit double byte coded KANJI sets
+ for information interchange</cite>. Japanese Standards Association.</dd>
+
+ <dt id=refsSRGB>[SRGB]</dt>
+ <dd><cite lang=en-GB><a href="http://webstore.iec.ch/webstore/webstore.nsf/artnum/025408!OpenDocument&amp;Click=">IEC
+ 61966-2-1: Multimedia systems and equipment &mdash; Colour measurement
+ and management &mdash; Part 2-1: Colour management &mdash; Default RGB colour
+ space &mdash; sRGB</a></cite>. IEC.</dd>
+
+ <dt id=refsSVG>[SVG]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/SVGTiny12/>Scalable Vector
+ Graphics (SVG) Tiny 1.2 Specification</a></cite>, O. Andersson,
+ R. Berjon, E. Dahlstr&ouml;m, A. Emmons, J. Ferraiolo, A. Grasso,
+ V. Hardy, S. Hayman, D. Jackson, C. Lilley, C. McCormack,
+ A. Neumann, C. Northway, A. Quint, N. Ramani, D. Schepers,
+ A. Shellshear. W3C.</dd>
+
+ <dt id=refsTIS620>[TIS620]</dt>
+ <dd><cite><a href=http://www.nectec.or.th/it-standards/std620/std620.htm>UDC
+ 681.3.04:003.62</a></cite>. Thai Industrial Standards Institute,
+ Ministry of Industry, Royal Thai Government. ISBN
+ 974-606-153-4.</dd>
+
+ <dt id=refsUAAG>[UAAG]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/UAAG20/>Web Content Accessibility
+ Guidelines (UAAG) 2.0</a></cite>, J. Allan, K. Ford, J. Richards,
+ J. Spellman. W3C.</dd>
+
+ <dt id=refsUNICODE>[UNICODE]</dt>
+ <dd><cite><a href=http://www.unicode.org/versions/>The Unicode Standard</a></cite>. Unicode Consortium.</dd>
+
+ <dt id=refsUNIVCHARDET>[UNIVCHARDET]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html>A
+ composite approach to language/encoding
+ detection</a></cite>, S. Li, K. Momoi. Netscape. In
+ <cite>Proceedings of the 19th International Unicode
+ Conference</cite>.</dd>
+
+ <dt id=refsUTF7>[UTF7]</dt>
+ <dd><cite><a href=http://www.ietf.org/rfc/rfc2152.txt>UTF-7: A
+ Mail-Safe Transformation Format of Unicode</a></cite>,
+ D. Goldsmith, M. Davis. IETF.</dd>
+
+ <dt id=refsUTF8DET>[UTF8DET]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.w3.org/International/questions/qa-forms-utf-8>Multilingual
+ form encoding</a></cite>, M. D&uuml;rst. W3C.</dd>
+
+ <dt id=refsUTR36>[UTR36]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr36/>UTR #36: Unicode
+ Security Considerations</a></cite>, M. Davis, M. Suignard. Unicode
+ Consortium.</dd>
+
+ <dt id=refsWCAG>[WCAG]</dt>
+ <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/WCAG20/>Web Content Accessibility
+ Guidelines (WCAG) 2.0</a></cite>, B. Caldwell, M. Cooper, L. Reid,
+ G. Vanderheiden. W3C.</dd>
+
+ <dt id=refsWEBIDL>[WEBIDL]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/WebIDL/">Web
+ IDL</a></cite>, C. McCormack. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/2006/webapi/WebIDL/>Web
+ IDL</a></cite>, C. McCormack. W3C.</dd>
+
+ <dt id=refsWEBLINK>[WEBLINK]</dt>
+ <dd><cite><a href=http://tools.ietf.org/html/draft-nottingham-http-link-header>Web
+ Linking</a></cite>, M. Nottingham. IETF.</dd>
+
+ <dt id=refsWEBSOCKET>[WEBSOCKET]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/websockets/">The WebSocket
+ API</a></cite>, I. Hickson. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/html5/websockets/>The WebSocket
+ API</a></cite>, I. Hickson. W3C.</dd>
+
+ <dt id=refsWEBSQL>[WEBSQL]</dt>
+ <dd><cite><a href=http://dev.w3.org/html5/webdatabase/>Web SQL
+ Database</a></cite>, I. Hickson. W3C.</dd>
+
+ <dt id=refsWEBSTORAGE>[WEBSTORAGE]</dt>
+ <dd><cite><a href=http://dev.w3.org/html5/webstorage/>Web
+ Storage</a></cite>, I. Hickson. W3C.</dd>
+
+ <dt id=refsWEBWORKERS>[WEBWORKERS]</dt>
+ <!--
+ <dd><cite><a
+ href="http://www.w3.org/TR/webworkers/">Workers</a></cite>,
+ I. Hickson. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/html5/workers/>Web
+ Workers</a></cite>, I. Hickson. W3C.</dd>
+
+ <dt id=refsWHATWGWIKI>[WHATWGWIKI]</dt>
+ <dd><cite><a href=http://wiki.whatwg.org/>The WHATWG Wiki</a></cite>. WHATWG.</dd>
+
+ <dt id=refsWIN1252>[WIN1252]</dt>
+ <dd><cite><a href=http://www.microsoft.com/globaldev/reference/sbcs/1252.htm>Windows 1252</a></cite>. Microsoft.</dd>
+
+ <dt id=refsWIN1254>[WIN1254]</dt>
+ <dd><cite><a href=http://www.microsoft.com/globaldev/reference/sbcs/1254.htm>Windows 1254</a></cite>. Microsoft.</dd>
+
+ <dt id=refsWIN31J>[WIN31J]</dt>
+ <dd><cite><a href=http://www.microsoft.com/globaldev/reference/dbcs/932.mspx>Windows Codepage 932</a></cite>. Microsoft.</dd>
+
+ <dt id=refsWIN874>[WIN874]</dt>
+ <dd><cite><a href=http://www.microsoft.com/globaldev/reference/sbcs/874.mspx>Windows 874</a></cite>. Microsoft.</dd>
+
+ <dt id=refsWIN949>[WIN949]</dt>
+ <dd><cite><a href=http://www.microsoft.com/globaldev/reference/dbcs/949.mspx>Windows Codepage 949</a></cite>. Microsoft.</dd>
+
+ <dt id=refsX121>[X121]</dt>
+ <dd><cite>Recommendation X.121 &mdash; International Numbering Plan for
+ Public Data Networks</cite>, CCITT Blue Book, Fascicle VIII.3,
+ pp. 317-332.</dd>
+
+ <dt id=refsX690>[X690]</dt>
+ <dd><cite><a href=http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf>Recommendation
+ X.690 &mdash; Information Technology &mdash; ASN.1 Encoding Rules &mdash;
+ Specification of Basic Encoding Rules (BER), Canonical Encoding
+ Rules (CER), and Distinguished Encoding Rules
+ (DER)</a></cite>. International Telecommunication Union.</dd>
+
+ <dt id=refsXHR>[XHR]</dt>
+ <!--
+ <dd><cite><a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest
+ Object</a></cite>, A. van Kesteren. W3C.</dd>
+ -->
+ <dd><cite><a href=http://dev.w3.org/2006/webapi/XMLHttpRequest-2/><code>XMLHttpRequest</code></a></cite>,
+ A. van Kesteren. W3C.</dd>
+
+ <dt id=refsXML>[XML]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/xml/>Extensible Markup
+ Language</a></cite>, T. Bray, J. Paoli, C. Sperberg-McQueen,
+ E. Maler, F. Yergeau. W3C.</dd>
+
+ <dt id=refsXMLBASE>[XMLBASE]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/xmlbase/>XML
+ Base</a></cite>, J. Marsh, R. Tobin. W3C.</dd>
+
+ <dt id=refsXMLNS>[XMLNS]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/xml-names/>Namespaces in
+ XML</a></cite>, T. Bray, D. Hollander, A. Layman, R. Tobin. W3C.</dd>
+
+ <dt id=refsXPATH10>[XPATH10]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/1999/REC-xpath-19991116>XML Path
+ Language (XPath) Version 1.0</a></cite>, J. Clark, S. DeRose. W3C.</dd>
+
+ <dt id=refsXSLT10>[XSLT10]</dt>
+ <dd><cite><a href=http://www.w3.org/TR/1999/REC-xslt-19991116>XSL
+ Transformations (XSLT) Version 1.0</a></cite>, J. Clark. W3C.</dd>
+
+
+
+ </dl><h2 class=no-num id=acknowledgements>Acknowledgements</h2> <!-- ACKS -->
+
+ <p>Thanks to
+
+ Aankhen,
+ Aaron Boodman,
+ Aaron Leventhal,
+ Adam Barth,
+ Adam de Boor,
+ Adam Hepton,
+ Adam Roben,
+ Addison Phillips,
+ Adele Peterson,
+ Adrian Bateman,
+ Adrian Sutton,
+ Agust&iacute;n Fern&aacute;ndez,
+ Ajai Tirumali,
+ Akatsuki Kitamura,
+ Alan Plum,
+ Alastair Campbell,
+ Alex Bishop,
+ Alex Nicolaou,
+ Alex Rousskov,
+ Alexander J. Vincent,
+ Alexey Feldgendler,
+ &#1040;&#1083;&#1077;&#1082;&#1089;&#1077;&#1081; &#1055;&#1088;&#1086;&#1089;&#1082;&#1091;&#1088;&#1103;&#1082;&#1086;&#1074; (Alexey Proskuryakov),
+ Alexis Deveria,
+ Allan Clements,
+ Amos Jeffries,
+ Anders Carlsson,
+ Andreas<!-- mqmq87 -->,
+ Andrei Popescu,
+ Andr&eacute; E. Veltstra,
+ Andrew Clover,
+ Andrew Gove,
+ Andrew Grieve,
+ Andrew Oakley,
+ Andrew Sidwell,
+ Andrew Smith,
+ Andrew W. Hagen,
+ Andrey V. Lukyanov,
+ Andy Heydon,
+ Andy Palay,
+ Anne van Kesteren,
+ Anthony Boyd,
+ Anthony Bryan,
+ Anthony Hickson,
+ Anthony Ricaud,
+ Antti Koivisto,
+ Aron Spohr,
+ Arphen Lin,
+ Aryeh Gregor,
+ Asbj&oslash;rn Ulsberg,
+ Ashley Sheridan,
+ Atsushi Takayama,
+ Aurelien Levy,
+ Ave Wrigley,
+ Ben Boyle,
+ Ben Godfrey,
+ Ben Lerner,
+ Ben Leslie,
+ Ben Meadowcroft,
+ Ben Millard,
+ Benjamin Carl Wiley Sittler,
+ Benjamin Hawkes-Lewis,
+ Bert Bos,
+ Bijan Parsia,
+ Bil Corry,
+ Bill Mason,
+ Bill McCoy,
+ Billy Wong,
+ Bjartur Thorlacius,
+ Bj&ouml;rn H&ouml;hrmann,
+ Blake Frantz,
+ Boris Zbarsky,
+ Brad Fults,
+ Brad Neuberg,
+ Brady Eidson,
+ Brendan Eich,
+ Brenton Simpson,
+ Brett Wilson,
+ Brett Zamir,
+ Brian Campbell,
+ Brian Korver,
+ Brian Kuhn,
+ Brian Ryner,
+ Brian Smith,
+ Brian Wilson,
+ Bryan Sullivan,
+ Bruce D'Arcus,
+ Bruce Lawson,
+ Bruce Miller,
+ C. Williams,
+ Cameron McCormack,
+ Cao Yipeng,
+ Carlos Gabriel Cardona,
+ Carlos Perell&oacute; Mar&iacute;n,
+ Chao Cai,
+ &#50980;&#49437;&#52268; (Channy Yun),
+ Charl van Niekerk,
+ Charles Iliya Krempeaux,
+ Charles McCathieNevile,
+ Chris Apers,
+ Chris Cressman,
+ Chris Evans,
+ Chris Morris,
+ Chris Pearce,
+ Christian Biesinger,
+ Christian Johansen,
+ Christian Schmidt,
+ Christopher Aillon,
+ Chriswa,
+ Cole Robison,
+ Colin Fine,
+ Collin Jackson,
+ Corprew Reed,
+ Craig Cockburn,
+ Csaba Gabor,
+ Csaba Marton,
+ Daniel Barclay,
+ Daniel Bratell,
+ Daniel Brooks,
+ Daniel Brumbaugh Keeney,
+ Daniel Cheng,
+ Daniel Davis,
+ Daniel Glazman,
+ Daniel Peng,
+ Daniel Schattenkirchner,
+ Daniel Sp&aring;ng,
+ Daniel Steinberg,
+ Danny Sullivan,
+ Darin Adler,
+ Darin Fisher,
+ Darxus,
+ Dave Camp,
+ Dave Hodder,
+ Dave Lampton,
+ Dave Singer,
+ Dave Townsend<!-- Mossop on moz irc -->,
+ David Baron,
+ David Bloom,
+ David Bruant,
+ David Carlisle,
+ David E. Cleary,
+ David Egan Evans,
+ David Flanagan,
+ David Gerard,
+ David H&aring;s&auml;ther,
+ David Hyatt,
+ David I. Lehn,
+ David Matja,
+ David Remahl,
+ David Smith,
+ David Woolley,
+ DeWitt Clinton,
+ Dean Edridge,
+ Dean Edwards,
+ Debi Orton,
+ Derek Featherstone,
+ Devdatta,
+ Dimitri Glazkov,
+ Dimitry Golubovsky,
+ Divya Manian,
+ dolphinling,
+ Dominique Haza&euml;l-Massieux,
+ Don Brutzman,
+ Doron Rosenberg,
+ Doug Kramer,
+ Drew Wilson,
+ Edmund Lai,
+ Eduard Pascual,
+ Eduardo Vela,
+ Edward O'Connor,
+ Edward Welbourne,
+ Edward Z. Yang,
+ Eira Monstad,
+ Eitan Adler,
+ Eliot Graff,
+ Elizabeth Castro,
+ Elliott Sprehn,
+ Elliotte Harold,
+ Eric Carlson,
+ Eric Law,
+ Eric Rescorla,
+ Erik Arvidsson,
+ Evan Martin,
+ Evan Prodromou,
+ Evert,
+ fantasai,
+ Felix Sasaki,
+ Francesco Schwarz,
+ Francis Brosnan Blazquez,
+ Franck 'Shift' Qu&eacute;lain,
+ Frank Barchard,
+ &#40284;&#39164;&#25991;&#25935; (Fumitoshi Ukai),
+ Futomi Hatano,
+ Gavin Carothers,
+ Gareth Rees,
+ Garrett Smith,
+ Geoffrey Garen,
+ Geoffrey Sneddon,
+ George Lund,
+ Gianmarco Armellin,
+ Giovanni Campagna,
+ Graham Klyne,
+ Greg Botten,
+ Greg Houston,
+ Greg Wilkins,
+ Gregg Tavares,
+ Grey,
+ Gytis Jakutonis,
+ H&aring;kon Wium Lie,
+ Hallvord Reiar Michaelsen Steen,
+ Hans S. T&oslash;mmerhalt,
+ Henri Sivonen,
+ Henrik Lied,
+ Henry Mason,
+ Hugh Winkler,
+ Ian Bicking,
+ Ian Davis,
+ Ignacio Javier,
+ Ivan Enderlin,
+ Ivo Emanuel Gon&ccedil;alves,
+ J. King,
+ Jacques Distler,
+ James Craig,
+ James Graham,
+ James Justin Harrell,
+ James M Snell,
+ James Perrett,
+ James Robinson,
+ Jan-Klaas Kollhof,
+ Jason Kersey,
+ Jason Lustig,
+ Jason White,
+ Jasper Bryant-Greene,
+ Jatinder Mann,
+ Jed Hartman,
+ Jeff Balogh,
+ Jeff Cutsinger,
+ Jeff Schiller,
+ Jeff Walden,
+ Jeffrey Zeldman,
+ &#32993;&#24935;&#37586; (Jennifer Braithwaite),
+ Jens Bannmann,
+ Jens Fendler,
+ Jens Lindstr&ouml;m,
+ Jens Meiert,
+ Jeremy Keith,
+ Jeremy Orlow,
+ Jeroen van der Meer,
+ Jian Li,
+ Jim Jewett,
+ Jim Ley,
+ Jim Meehan,
+ Jjgod Jiang,
+ Jo&atilde;o Eiras,
+ Joe Clark,
+ Joe Gregorio,
+ Joel Spolsky,
+ Johan Herland,
+ John Boyer,
+ John Bussjaeger,
+ John Carpenter,
+ John Fallows,
+ John Foliot,
+ John Harding,
+ John Keiser,
+ John Snyders,
+ John-Mark Bell,
+ Johnny Stenback,
+ Jon Ferraiolo,
+ Jon Gibbins,
+ Jon Perlow,
+ Jonas Sicking,
+ Jonathan Cook,
+ Jonathan Rees,
+ Jonathan Worent,
+ Jonny Axelsson,
+ Jorgen Horstink,
+ Jorunn Danielsen Newth,
+ Joseph Kesselman,
+ Joseph Pecoraro,
+ Josh Aas,
+ Josh Levenberg,
+ Joshua Randall,
+ Jukka K. Korpela,
+ Jules Cl&eacute;ment-Ripoche,
+ Julian Reschke,
+ Justin Lebar,
+ Justin Sinclair,
+ Kai Hendry,
+ Kartikaya Gupta,
+ Kathy Walton,
+ Kelly Norton,
+ Kevin Benson,
+ Korn&eacute;l P&aacute;l,
+ Kornel Lesinski,
+ Kristof Zelechovski,
+ &#40658;&#28580;&#21083;&#24535; (Kurosawa Takeshi),
+ Kyle Hofmann<!-- Ozob -->,
+ L&eacute;onard Bouchet,
+ Lachlan Hunt,
+ Larry Masinter,
+ Larry Page,
+ Lars Gunther<!-- Keryx Web -->,
+ Lars Solberg,
+ Laura Granka,
+ Laura L. Carlson,
+ Laura Wisewell,
+ Laurens Holst,
+ Lee Kowalkowski,
+ Leif Halvard Silli,
+ Lenny Domnitser,
+ Leons Petrazickis,
+ Lobotom Dysmon,
+ Logan<!-- on moz irc -->,
+ Loune,
+ Luke Kenneth Casson Leighton,
+ Maciej Stachowiak,
+ Magnus Kristiansen<!-- Dashiva -->,
+ Maik Merten,
+ Malcolm Rowe,
+ Mark Birbeck,
+ Mark Miller,
+ Mark Nottingham,
+ Mark Pilgrim,
+ Mark Rowe<!--bdash-->,
+ Mark Schenk,
+ Mark Wilton-Jones,
+ Martijn Wargers,
+ Martin Atkins,
+ Martin D&uuml;rst,
+ Martin Honnen,
+ Martin Kutschker,
+ Martin Thomson,
+ Masataka Yakura,
+ Mathieu Henri,
+ Matt Schmidt,
+ Matt Wright,
+ Matthew Gregan,
+ Matthew Mastracci,
+ Matthew Raymond,
+ Matthew Thomas,
+ Mattias Waldau,
+ Max Romantschuk,
+ Menno van Slooten,
+ Micah Dubinko,
+ Michael 'Ratt' Iannarelli,
+ Michael A. Nachbaur,
+ Michael A. Puls II<!--Shadow2531-->,
+ Michael Carter,
+ Michael Daskalov,
+ Michael Enright,
+ Michael Gratton,
+ Michael Nordman,
+ Michael Powers,
+ Michael(tm) Smith,
+ Michal Zalewski,
+ Michel Fortin,
+ Michelangelo De Simone,
+ Michiel van der Blonk,
+ Mihai &#350;ucan<!-- from ROBO Design -->,
+ Mike Brown,
+ Mike Dierken<!-- S. Mike Dierken -->,
+ Mike Dixon,
+ Mike Schinkel,
+ Mike Shaver,
+ Mikko Rantalainen,
+ Mohamed Zergaoui<!-- Innovimax SARL -->,
+ Mounir Lamouri,
+ Ms2ger,
+ NARUSE Yui,
+ Neil Deakin,
+ Neil Rashbrook,
+ Neil Soiffer,
+ Nicholas Shanks,
+ Nicholas Stimpson,
+ Nicholas Zakas,
+ Nicolas Gallagher,
+ Noah Mendelsohn,
+ Noah Slater,
+ Ojan Vafai,
+ Olaf Hoffmann,
+ Olav Junker Kj&aelig;r,
+ Old&#345;ich Vete&scaron;n&iacute;k,
+ Oliver Hunt,
+ Oliver Rigby,
+ Olivier Gendrin,
+ Olli Pettay,
+ Patrick H. Lauke,
+ Paul Norman,
+ Per-Erik Brodin,
+ Perry Smith,
+ Peter Karlsson,
+ Peter Kasting,
+ Peter Stark,
+ Peter-Paul Koch,
+ Phil Pickering,
+ Philip J&auml;genstedt,
+ Philip Taylor,
+ Philip TAYLOR<!-- a different one -->,
+ Prateek Rungta,
+ Pravir Gupta,
+ Rachid Finge,
+ Rajas Moonka,
+ Ralf Stoltze,
+ Ralph Giles,
+ Raphael Champeimont,
+ Remco,
+ Remy Sharp,
+ Rene Saarsoo,
+ Rene Stach,
+ Ric Hardacre,
+ Rich Doughty,
+ Richard Ishida,
+ Rigo Wenning,
+ Rikkert Koppes,
+ Rimantas Liubertas,
+ Riona Macnamara,
+ Rob Ennals,
+ Rob Jellinghaus,
+ Robert Blaut,
+ Robert Collins,
+ Robert O'Callahan,
+ Robert Sayre,
+ Robin Berjon,
+ Roland Steiner,
+ Roman Ivanov,
+ Roy Fielding,
+ Ryan King,
+ S. Mike Dierken,
+ Salvatore Loreto,
+ Sam Dutton,
+ Sam Kuper,
+ Sam Ruby,
+ Sam Weinig,
+ Sander van Lambalgen,
+ Sarven Capadisli,
+ Scott Gonz&aacute;lez,
+ Scott Hess,
+ Sean Fraser,
+ Sean Hogan,
+ Sean Knapp,
+ Sebastian Markb&aring;ge,
+ Sebastian Schnitzenbaumer,
+ Seth Call,
+ Shanti Rao,
+ Shaun Inman,
+ Shiki Okasaka,
+ Sierk Bornemann,
+ Sigbj&oslash;rn Vik,
+ Silvia Pfeiffer,
+ Simon Montagu,
+ Simon Pieters,
+ Simon Spiegel,
+ skeww, <!-- on reddit -->
+ Stefan Haustein,
+ Stefan Santesson,
+ Steffen Meschkat,
+ Stephen Ma,
+ Steve Faulkner,
+ Steve Runyon,
+ Steven Bennett,
+ Steven Garrity,
+ Steven Tate,
+ Stewart Brodie,
+ Stuart Ballard,
+ Stuart Parmenter,
+ Subramanian Peruvemba,
+ Sunava Dutta,
+ Susan Borgrink,
+ Susan <!--G.--> Lesch,
+ Sylvain Pasche,
+ T. J. Crowder,
+ <span lang=tr title="">Tantek &Ccedil;elik</span>,
+ &#30000;&#26449;&#20581;&#20154; (TAMURA Kent),
+ Ted Mielczarek,
+ Terrence Wood,
+ Thomas Broyer,
+ Thomas O'Connor,
+ Tim Altman,
+ Tim Johansson,
+ Toby Inkster,
+ Todd Moody,
+ Tom Pike,
+ Tommy Thorsen,
+ Travis Leithead,
+ Tyler Close,
+ Vladimir Katardjiev,
+ Vladimir Vuki&#263;evi&#263;,
+ voracity,
+ Wakaba,
+ Wayne Pollock,
+ Wellington Fernando de Macedo,
+ Will Levine,
+ William Swanson,
+ Wladimir Palant,
+ Wojciech Mach,
+ Wolfram Kriesing,
+ Yang Chen,
+ Yehuda Katz,
+ Yi-An Huang,
+ Yngve Nysaeter Pettersen,
+ Yuzo Fujishima,
+ Zhenbin Xu,
+ Zoltan Herczeg,
+ and
+ &Oslash;istein E. Andersen,
+
+ for their useful comments, both large and small, that have led to
+ changes to this specification over the years.</p>
+
+ <p>Thanks also to everyone who has ever posted about HTML to their
+ blogs, public mailing lists, or forums, including all the
+ contributors to the <a href=http://www.w3.org/html/wg/lists/>various W3C HTML WG
+ lists</a> and the <a href=http://www.whatwg.org/mailing-list>various WHATWG lists</a>.
+
+ <p>Special thanks to Richard Williamson for creating the first
+ implementation of <code><a href=#the-canvas-element>canvas</a></code> in Safari, from which the
+ canvas feature was designed.</p>
+
+ <p>Special thanks also to the Microsoft employees who first
+ implemented the event-based drag-and-drop mechanism, <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>, and other
+ features first widely deployed by the Windows Internet Explorer
+ browser.</p>
+
+ <p>Thanks to the participants of the microdata usability study for
+ allowing us to use their mistakes as a guide for designing the
+ microdata feature.</p>
+
+<!--TT-->
+ <p>Thanks to the SubRip community, including in particular Zuggy and
+ ai4spam, for their work on the SubRip software program whose SRT
+ file format was used as the basis for the WebSRT timed track file
+ format.</p>
+<!--TT-->
+
+ <div class=impl>
+
+ <p>Special thanks and $10,000 to David Hyatt who came up with a
+ broken implementation of the <a href=#adoptionAgency>adoption
+ agency algorithm</a> that the editor had to reverse engineer and fix
+ before using it in the parsing section.</p>
+
+ </div>
+
+ <p>Thanks to the many sources that provided inspiration for the
+ examples used in the specification.</p>
+
+
+ <p>Thanks also to the Microsoft blogging community for some ideas,
+ to the attendees of the W3C Workshop on Web Applications and
+ Compound Documents for inspiration, to the #mrt crew, the #mrt.no
+ crew, and the #whatwg crew, and to Pillar and Hedral for their ideas
+ and support.</p>
+
+ <!-- Hopefully Kam won't notice he's covered by these
+ acknowledgements three times! -->
+
+<!--
+ v2 * library of resources:
+ var library = new ZipFile("data.zip");
+ library.onload = function() {
+ var sound1 = library.getAudio("sound1.wav"); // returns an Audio object
+ var image1 = library.getImage("image1.png"); // returns an HTMLImageElement
+ var doc1 = library.getXMLDocument("doc1.xml"); // returns a Document
+ var doc2 = library.getHTMLDocument("doc1.html"); // returns an HTMLDocument
+ }
+ or:
+ var library = new ResourceLoader("data.zip");
+ library.add("moredata.zip");
+ library.onload = function() { ... }
+ library.onloading = function() {
+ reportLoadProgress(library.progress); // 0.0 .. 1.0
+ }
+ or:
+ var library = new AudioZip("sounds.zip");
+ library.onload = function() {
+ var sound1 = library["sound1.wav"];
+ sound.play();
+ }
+ v2 * [onclick] should make element focusable; enter should send onclick ?
+ v2 * a fairly common situation for web authors is to have two lists, where
+ the contents of the second depends on the value of the first. Is there
+ any way we could extend the current model to include this functionality?
+ (e.g. bugzilla product/component ui)
+ v2 * quick-searchable select
+ v2 * include/exclude selectors (two multi-select columns with arrows to
+ move selected items) and that sort of thing.
+ http://slashdot.org/comments.pl?sid=110240&cid=9357022
+ v2 * Oh, and forms need a standardized Help widget/icon. I know I can
+ turn my cursor into a question mark, but I'm looking for something
+ simple and pervasive. Maybe you can wrap fields in a help tag, just
+ as you do for fieldsets. And in that help tag, attributes are
+ available that allow for a nice, formatted, clean, full help text
+ popup/area/thing.
+ http://slashdot.org/comments.pl?sid=110240&cid=9359006
+ v2 * Validating only part of a form. - Anja Lehmann
+ v2 * Reminder to add a way to expose access keys in buttons, i.e.
+ Sub&mit where & signifies the m is the access key to use. Possibly
+ automatic? <input accesskey="m" value="Submit"> browser would be
+ smart enough to underline the first instance of the access key if
+ it exists (case insensitive)? - kerz
+ [or deprecate the lot (->web apps)]
+ v2 * need an attribute that says "the children of this element are in
+ their own tabbing universe, tabindex should be relative to each
+ other, not to the document"
+ -> web apps?
+ v2 * make select widgets have multiple columns
+ or ->web apps with list view
+ v2 * required as a group (one of the following must be available):
+ + i propose something like the following:
+ <input type="text" group="contact" name="voicephone"> Voice phone
+ <input type="text" group="contact" name="fax"> Fax
+ <input type="text" group="contact" name="mobile"> Mobile phone
+ <input type="text" group="contact" name="email"> E-mail
+ if the user fills out none of the form fields in the "contact"
+ group, an error message is shown and the form is not submitted.
+ - Peter-Paul Koch
+ v2 * formatting of number fields, text fields, etc, so that when the
+ field is not focused, the value is displayed differently. Seems
+ like this would also be useful e.g. for <output> or something so
+ you can display localised dates, etc.
+ v2 * being able to select date range (from day x to day y)
+ v2 * ways of visualizing a linefeed in a <textarea> so it looks different
+ from wrapping text
+ v2 * all login systems have
+ 1. enter username and password
+ 2. create new account
+ 3. lost password
+ some way of integrating this into one system, since it's so common
+ v2 * way of identifying different sorts of mailadresses
+ a) mailing-list
+ b) person
+ c) department in a company ("support", "marketing" and such)
+ d) general mail (like "info", "mail", "contact" and such)
+ e) other sorts of groupings
+ (or ->web apps; this is talking about in mailto: links, I think)
+ v2 * hotswapping login identities like in windows xp
+ you are logged in on operamail.com, and you want to check the mail
+ of another user. somehow, combined with the wand or whatever,
+ the browser will remember the login page, and it can re-submit it
+ without having to load the initial page (saving time)
+ v2 * provide different measuring systems, like having the html indicate
+ fluid in both fluid ounces and liters, and the browser can display
+ one or the other based on regional settings in the browser or ui,
+ display conversions in a tooltip, or let the user decide which
+ format to display.
+ v2 * indicate "x days ago" or "y days into the future" rather than date
+ v2 * input control for anniversaries
+ v2 * only submit fields that have changed, or a way to include in the
+ submission a list of which form controls were changed from their
+ default value
+ v2 * have a way of marking the first option of a <select> as the default
+ but have it not satisfy a new required="" attribute on <select> so
+ that you can have selects that require a valid value.
+ v2 * type="time" value="now"
+ v2 * add something to type="number" to support basic currency and unit
+ formatting of input
+ v2 * <fieldset enabled-if-checked="myCheckboxOrRadioButton">
+ ...to allow sections to only be enabled if a radio button makes it
+ relevant, for instance.
+ v2 * Yan Morin proposed a multi-column dropdown <select> or <datalist>:
+ _________________
+ |_New_York______|V|_________________ <- input with a table link and a down arrow
+ |_City__________|_State_|_Country_|_| <- header of the table
+ | Montreal | QC | Canada |A| <- top arrow of the scroll
+ |>New York <| NY | US | | <- selected row
+ | Washington | DC | US |X| <- cursor scroll
+ | San Francisco | CA | US | |
+ |_Toronto_______|__ON___|_Canada__|V| <- bottom arrow of the scroll
+
+ v2 * add for="" attribute to <input type="password"> so that you can
+ link usernames and passwords. (Jonas Sicking)
+ v2 * value for unchecked checkbox?
+ v2 * A way to specify the default button - Michael Gratton
+ v2 * <fieldset readonly>?
+ v2 * dolphinling suggests having a way to mark certain parts of a
+ form as being dependent on another (mutually exclusive parts of
+ a form)
+ v2 * expose the form data set, either as an object (on which one can
+ invoke the JSON serialiser), or in the form of a method on
+ HTMLFormElement that returns the form data set serialised
+ according to a particular encoding (defaulting to the form's
+ enctype="" one, probably). This would allow forms to be used
+ with XHR-like systems without having to manually construct the
+ form data set the way that is done today.
+
+Consistency in editorial style:
+ v2 * need to become consistent about whether or not to quote keyword
+ ("<code title="">foo</code>" vs <code>foo</code>)
+ v2 * make the spec consistent about whether the word "algorithm" is part of
+ an algorithm's name or not ("</dfn> algorithm", "</span> algorithm")
+ v2 * make the spec more consistent about its use of "hexadecimal"
+ and "base-sixteen", the order that 0-9 A-Z a-z is mentioned,
+ and the detail to which the spec explains how to interpret a
+ string as a hexadecimal number.
+ v2 * become more consistent about what markup we use to mark up
+ productions (nothing? <i>? <code>?)
+ v2 * use <code>Document</code> consistently instead of 'document'.
+ v2 * s/raise/throw/g
+ v2 * be clearer about arrays/lists/collections being zero-based
+ despite using the term "/index/th".
+ v2 * use the sample widgets:
+ <li><img alt="A text field with editable sections for each
+ value, with a button to pop up a dialog showing a calendar or
+ clock." src="sample-datetime-ui-2"></li>
+ <li><img alt="A calendar grid with a clock in the upper right
+ hand corner." src="sample-datetime-ui-3"></li>
+-->
+
diff --git a/WebCore/bindings/ScriptControllerBase.cpp b/WebCore/bindings/ScriptControllerBase.cpp
index cbd4214..9bea8ae 100644
--- a/WebCore/bindings/ScriptControllerBase.cpp
+++ b/WebCore/bindings/ScriptControllerBase.cpp
@@ -44,12 +44,12 @@ bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso
return allowed;
}
-ScriptValue ScriptController::executeScript(const String& script, bool forceUserGesture)
+ScriptValue ScriptController::executeScript(const String& script, bool forceUserGesture, ShouldAllowXSS shouldAllowXSS)
{
- return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()));
+ return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()), shouldAllowXSS);
}
-ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode)
+ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode, ShouldAllowXSS shouldAllowXSS)
{
if (!canExecuteScripts(AboutToExecuteScript) || isPaused())
return ScriptValue();
@@ -57,7 +57,7 @@ ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode)
bool wasInExecuteScript = m_inExecuteScript;
m_inExecuteScript = true;
- ScriptValue result = evaluate(sourceCode);
+ ScriptValue result = evaluate(sourceCode, shouldAllowXSS);
if (!wasInExecuteScript) {
m_inExecuteScript = false;
@@ -80,10 +80,10 @@ bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture,
const int javascriptSchemeLength = sizeof("javascript:") - 1;
- String script = decodeURLEscapeSequences(url.string().substring(javascriptSchemeLength));
+ String decodedURL = decodeURLEscapeSequences(url.string());
ScriptValue result;
- if (xssAuditor()->canEvaluateJavaScriptURL(script))
- result = executeScript(script, userGesture);
+ if (xssAuditor()->canEvaluateJavaScriptURL(decodedURL))
+ result = executeScript(decodedURL.substring(javascriptSchemeLength), userGesture, AllowXSS);
String scriptResult;
#if USE(JSC)
diff --git a/WebCore/bindings/js/GCController.cpp b/WebCore/bindings/js/GCController.cpp
index d5a1789..f193b2e 100644
--- a/WebCore/bindings/js/GCController.cpp
+++ b/WebCore/bindings/js/GCController.cpp
@@ -61,7 +61,7 @@ GCController::GCController()
void GCController::garbageCollectSoon()
{
if (!m_GCTimer.isActive())
- m_GCTimer.startOneShot(0.5);
+ m_GCTimer.startOneShot(0);
}
void GCController::gcTimerFired(Timer<GCController>*)
diff --git a/WebCore/bindings/js/JSAttrCustom.cpp b/WebCore/bindings/js/JSAttrCustom.cpp
index 4cd40ac..998ecad 100644
--- a/WebCore/bindings/js/JSAttrCustom.cpp
+++ b/WebCore/bindings/js/JSAttrCustom.cpp
@@ -31,9 +31,8 @@
#include "CSSHelper.h"
#include "Document.h"
-#include "HTMLFrameElementBase.h"
+#include "Element.h"
#include "HTMLNames.h"
-#include "JSDOMBinding.h"
using namespace JSC;
@@ -41,20 +40,6 @@ namespace WebCore {
using namespace HTMLNames;
-void JSAttr::setValue(ExecState* exec, JSValue value)
-{
- Attr* imp = static_cast<Attr*>(impl());
- String attrValue = valueToStringWithNullCheck(exec, value);
-
- Element* ownerElement = imp->ownerElement();
- if (ownerElement && !allowSettingSrcToJavascriptURL(exec, ownerElement, imp->name(), attrValue))
- return;
-
- ExceptionCode ec = 0;
- imp->setValue(attrValue, ec);
- setDOMException(exec, ec);
-}
-
void JSAttr::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index cd6ddfb..7a105ff 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -85,6 +85,7 @@
#include "JSJavaScriptCallFrameCustom.cpp"
#include "JSLazyEventListener.cpp"
#include "JSLocationCustom.cpp"
+#include "JSMainThreadExecState.cpp"
#include "JSMessageChannelConstructor.cpp"
#include "JSMessageChannelCustom.cpp"
#include "JSMessageEventCustom.cpp"
diff --git a/WebCore/bindings/js/JSCallbackData.cpp b/WebCore/bindings/js/JSCallbackData.cpp
index e128f27..e813da2 100644
--- a/WebCore/bindings/js/JSCallbackData.cpp
+++ b/WebCore/bindings/js/JSCallbackData.cpp
@@ -31,6 +31,7 @@
#include "Document.h"
#include "JSDOMBinding.h"
+#include "JSMainThreadExecState.h"
using namespace JSC;
@@ -59,7 +60,9 @@ JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE
}
globalObject()->globalData()->timeoutChecker.start();
- JSValue result = JSC::call(exec, function, callType, callData, callback(), args);
+ JSValue result = globalObject()->scriptExecutionContext()->isDocument()
+ ? JSMainThreadExecState::call(exec, function, callType, callData, callback(), args)
+ : JSC::call(exec, function, callType, callData, callback(), args);
globalObject()->globalData()->timeoutChecker.stop();
Document::updateStyleForAllDocuments();
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index a4c3d6a..87d8cf7 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -686,7 +686,7 @@ KURL completeURL(ExecState* exec, const String& relativeURL)
JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, objectProtoFuncToString);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, objectProtoFuncToString);
}
Structure* getCachedDOMStructure(JSDOMGlobalObject* globalObject, const ClassInfo* classInfo)
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index 209be3f..215e09a 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -58,7 +58,10 @@ namespace WebCore {
// updated to store a globalObject pointer.
class DOMObjectWithGlobalPointer : public DOMObject {
public:
- JSDOMGlobalObject* globalObject() const { return static_cast<JSDOMGlobalObject*>(getAnonymousValue(GlobalObjectSlot).asCell()); }
+ JSDOMGlobalObject* globalObject() const
+ {
+ return static_cast<JSDOMGlobalObject*>(DOMObject::globalObject());
+ }
ScriptExecutionContext* scriptExecutionContext() const
{
@@ -72,19 +75,14 @@ namespace WebCore {
}
protected:
- static const unsigned AnonymousSlotCount = 1 + DOMObject::AnonymousSlotCount;
- static const unsigned GlobalObjectSlot = AnonymousSlotCount - 1;
-
DOMObjectWithGlobalPointer(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
- : DOMObject(structure)
+ : DOMObject(globalObject, structure)
{
// FIXME: This ASSERT is valid, but fires in fast/dom/gc-6.html when trying to create
// new JavaScript objects on detached windows due to DOMWindow::document()
// needing to reach through the frame to get to the Document*. See bug 27640.
// ASSERT(globalObject->scriptExecutionContext());
- putAnonymousValue(GlobalObjectSlot, globalObject);
}
- virtual ~DOMObjectWithGlobalPointer() { }
};
// Base class for all constructor objects in the JSC bindings.
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 656d580..343c8f9 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -130,7 +130,7 @@ void JSDOMWindow::markChildren(MarkStack& markStack)
template<NativeFunction nativeFunction, int length>
JSValue nonCachingStaticFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), length, propertyName, nativeFunction);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), length, propertyName, nativeFunction);
}
static JSValue childFrameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
diff --git a/WebCore/bindings/js/JSDOMWindowShell.cpp b/WebCore/bindings/js/JSDOMWindowShell.cpp
index 1e82a49..65096b9 100644
--- a/WebCore/bindings/js/JSDOMWindowShell.cpp
+++ b/WebCore/bindings/js/JSDOMWindowShell.cpp
@@ -61,10 +61,11 @@ void JSDOMWindowShell::setWindow(PassRefPtr<DOMWindow> domWindow)
// when we allocate the global object. (Once the global object is fully
// constructed, it can mark its own prototype.)
RefPtr<Structure> prototypeStructure = JSDOMWindowPrototype::createStructure(jsNull());
- ProtectedPtr<JSDOMWindowPrototype> prototype = new JSDOMWindowPrototype(prototypeStructure.release());
+ ProtectedPtr<JSDOMWindowPrototype> prototype = new JSDOMWindowPrototype(0, prototypeStructure.release());
RefPtr<Structure> structure = JSDOMWindow::createStructure(prototype);
JSDOMWindow* jsDOMWindow = new (JSDOMWindow::commonJSGlobalData()) JSDOMWindow(structure.release(), domWindow, this);
+ prototype->putAnonymousValue(0, jsDOMWindow);
setWindow(jsDOMWindow);
}
diff --git a/WebCore/bindings/js/JSDOMWindowShell.h b/WebCore/bindings/js/JSDOMWindowShell.h
index 1b986b8..888325d 100644
--- a/WebCore/bindings/js/JSDOMWindowShell.h
+++ b/WebCore/bindings/js/JSDOMWindowShell.h
@@ -37,8 +37,8 @@ namespace WebCore {
class DOMWindow;
class Frame;
- class JSDOMWindowShell : public DOMObject {
- typedef DOMObject Base;
+ class JSDOMWindowShell : public JSC::JSObject {
+ typedef JSC::JSObject Base;
public:
JSDOMWindowShell(PassRefPtr<DOMWindow>, DOMWrapperWorld* world);
virtual ~JSDOMWindowShell();
@@ -66,7 +66,7 @@ namespace WebCore {
DOMWrapperWorld* world() { return m_world.get(); }
private:
- static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | DOMObject::StructureFlags;
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | Base::StructureFlags;
virtual void markChildren(JSC::MarkStack&);
virtual JSC::UString className() const;
diff --git a/WebCore/bindings/js/JSDOMWrapper.h b/WebCore/bindings/js/JSDOMWrapper.h
index 00594cf..2d09f01 100644
--- a/WebCore/bindings/js/JSDOMWrapper.h
+++ b/WebCore/bindings/js/JSDOMWrapper.h
@@ -22,15 +22,15 @@
#ifndef JSDOMWrapper_h
#define JSDOMWrapper_h
-#include <runtime/JSObject.h>
+#include <runtime/JSObjectWithGlobalObject.h>
namespace WebCore {
-// Base class for all objects in this binding except Window.
-class DOMObject : public JSC::JSObject {
+// FIXME: Rename to JSDOMWrapper.
+class DOMObject : public JSC::JSObjectWithGlobalObject {
protected:
- explicit DOMObject(NonNullPassRefPtr<JSC::Structure> structure)
- : JSObject(structure)
+ explicit DOMObject(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
{
}
diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp
index e5fdbe7..bc69323 100644
--- a/WebCore/bindings/js/JSEventCustom.cpp
+++ b/WebCore/bindings/js/JSEventCustom.cpp
@@ -32,11 +32,13 @@
#include "Clipboard.h"
#include "CompositionEvent.h"
#include "CustomEvent.h"
+#include "DeviceOrientationEvent.h"
#include "Event.h"
#include "JSBeforeLoadEvent.h"
#include "JSClipboard.h"
#include "JSCustomEvent.h"
#include "JSCompositionEvent.h"
+#include "JSDeviceOrientationEvent.h"
#include "JSErrorEvent.h"
#if ENABLE(INDEXED_DATABASE)
#include "JSIDBErrorEvent.h"
@@ -171,6 +173,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, PopStateEvent, event);
else if (event->isCustomEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CustomEvent, event);
+#if ENABLE(DEVICE_ORIENTATION)
+ else if (event->isDeviceOrientationEvent())
+ wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceOrientationEvent, event);
+#endif
else
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, Event, event);
diff --git a/WebCore/bindings/js/JSEventListener.cpp b/WebCore/bindings/js/JSEventListener.cpp
index c64aa29..e25a5d1 100644
--- a/WebCore/bindings/js/JSEventListener.cpp
+++ b/WebCore/bindings/js/JSEventListener.cpp
@@ -24,6 +24,7 @@
#include "Frame.h"
#include "JSEvent.h"
#include "JSEventTarget.h"
+#include "JSMainThreadExecState.h"
#include <runtime/JSLock.h>
#include <wtf/RefCountedLeakCounter.h>
@@ -111,9 +112,17 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext
DynamicGlobalObjectScope globalObjectScope(exec, globalData->dynamicGlobalObject ? globalData->dynamicGlobalObject : globalObject);
globalData->timeoutChecker.start();
- JSValue retval = handleEventFunction
- ? JSC::call(exec, handleEventFunction, callType, callData, jsFunction, args)
- : JSC::call(exec, jsFunction, callType, callData, toJS(exec, globalObject, event->currentTarget()), args);
+ JSValue retval;
+ if (handleEventFunction) {
+ retval = scriptExecutionContext->isDocument()
+ ? JSMainThreadExecState::call(exec, handleEventFunction, callType, callData, jsFunction, args)
+ : JSC::call(exec, handleEventFunction, callType, callData, jsFunction, args);
+ } else {
+ JSValue currentTarget = toJS(exec, globalObject, event->currentTarget());
+ retval = scriptExecutionContext->isDocument()
+ ? JSMainThreadExecState::call(exec, jsFunction, callType, callData, currentTarget, args)
+ : JSC::call(exec, jsFunction, callType, callData, currentTarget, args);
+ }
globalData->timeoutChecker.stop();
globalObject->setCurrentEvent(savedEvent);
diff --git a/WebCore/bindings/js/JSHistoryCustom.cpp b/WebCore/bindings/js/JSHistoryCustom.cpp
index c031b30..53b554f 100644
--- a/WebCore/bindings/js/JSHistoryCustom.cpp
+++ b/WebCore/bindings/js/JSHistoryCustom.cpp
@@ -40,17 +40,17 @@ namespace WebCore {
static JSValue nonCachingStaticBackFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsHistoryPrototypeFunctionBack);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsHistoryPrototypeFunctionBack);
}
static JSValue nonCachingStaticForwardFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsHistoryPrototypeFunctionForward);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsHistoryPrototypeFunctionForward);
}
static JSValue nonCachingStaticGoFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsHistoryPrototypeFunctionGo);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsHistoryPrototypeFunctionGo);
}
bool JSHistory::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 1fedd7e..df191b7 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -36,6 +36,7 @@
#if ENABLE(INSPECTOR)
#include "Console.h"
+#include "JSMainThreadExecState.h"
#if ENABLE(DATABASE)
#include "Database.h"
#include "JSDatabase.h"
@@ -82,7 +83,7 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& source, Scri
JSLock lock(SilenceAssertionsOnly);
JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
JSValue globalThisValue = scriptState->globalThisValue();
- Completion comp = JSC::evaluate(scriptState, globalObject->globalScopeChain(), sourceCode, globalThisValue);
+ Completion comp = JSMainThreadExecState::evaluate(scriptState, globalObject->globalScopeChain(), sourceCode, globalThisValue);
if (comp.complType() != JSC::Normal && comp.complType() != JSC::ReturnValue)
return ScriptObject();
JSValue functionValue = comp.value();
diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp
index e92a750..da35c23 100644
--- a/WebCore/bindings/js/JSLocationCustom.cpp
+++ b/WebCore/bindings/js/JSLocationCustom.cpp
@@ -41,17 +41,17 @@ namespace WebCore {
static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionReplace);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionReplace);
}
static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsLocationPrototypeFunctionReload);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsLocationPrototypeFunctionReload);
}
static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionAssign);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionAssign);
}
bool JSLocation::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
diff --git a/WebCore/bindings/js/JSMainThreadExecState.cpp b/WebCore/bindings/js/JSMainThreadExecState.cpp
new file mode 100644
index 0000000..d679a58
--- /dev/null
+++ b/WebCore/bindings/js/JSMainThreadExecState.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSMainThreadExecState.h"
+
+namespace WebCore {
+
+JSC::ExecState* JSMainThreadExecState::s_mainThreadState = 0;
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/JSMainThreadExecState.h b/WebCore/bindings/js/JSMainThreadExecState.h
new file mode 100644
index 0000000..8193d7c
--- /dev/null
+++ b/WebCore/bindings/js/JSMainThreadExecState.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSMainThreadExecState_h
+#define JSMainThreadExecState_h
+
+#include <JSDOMBinding.h>
+#ifndef NDEBUG
+#include <wtf/MainThread.h>
+#endif
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class JSMainThreadExecState : public Noncopyable {
+public:
+ static JSC::ExecState* currentState()
+ {
+ ASSERT(WTF::isMainThread());
+ return s_mainThreadState;
+ };
+
+ static JSC::JSValue call(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args)
+ {
+ JSMainThreadExecState currentState(exec);
+ return JSC::call(exec, functionObject, callType, callData, thisValue, args);
+ };
+
+ static JSC::Completion evaluate(JSC::ExecState* exec, JSC::ScopeChain& chain, const JSC::SourceCode& source, JSC::JSValue thisValue)
+ {
+ JSMainThreadExecState currentState(exec);
+ return JSC::evaluate(exec, chain, source, thisValue);
+ };
+
+protected:
+ explicit JSMainThreadExecState(JSC::ExecState* exec)
+ : m_previousState(s_mainThreadState)
+ {
+ ASSERT(WTF::isMainThread());
+ s_mainThreadState = exec;
+ };
+
+ ~JSMainThreadExecState()
+ {
+ ASSERT(WTF::isMainThread());
+ s_mainThreadState = m_previousState;
+ }
+
+private:
+ static JSC::ExecState* s_mainThreadState;
+ JSC::ExecState* m_previousState;
+};
+
+// Null state prevents origin security checks.
+class JSMainThreadNullState : private JSMainThreadExecState {
+public:
+ explicit JSMainThreadNullState() : JSMainThreadExecState(0) {};
+};
+
+} // namespace WebCore
+
+#endif // JSMainThreadExecState_h
diff --git a/WebCore/bindings/js/JSNamedNodeMapCustom.cpp b/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
index e1c490e..8df9304 100644
--- a/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
+++ b/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
@@ -35,38 +35,6 @@ using namespace JSC;
namespace WebCore {
-JSValue JSNamedNodeMap::setNamedItem(ExecState* exec, const ArgList& args)
-{
- NamedNodeMap* imp = static_cast<NamedNodeMap*>(impl());
- ExceptionCode ec = 0;
- Node* newNode = toNode(args.at(0));
-
- if (newNode && newNode->nodeType() == Node::ATTRIBUTE_NODE && imp->element()) {
- if (!allowSettingSrcToJavascriptURL(exec, imp->element(), newNode->nodeName(), newNode->nodeValue()))
- return jsNull();
- }
-
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setNamedItem(newNode, ec)));
- setDOMException(exec, ec);
- return result;
-}
-
-JSValue JSNamedNodeMap::setNamedItemNS(ExecState* exec, const ArgList& args)
-{
- NamedNodeMap* imp = static_cast<NamedNodeMap*>(impl());
- ExceptionCode ec = 0;
- Node* newNode = toNode(args.at(0));
-
- if (newNode && newNode->nodeType() == Node::ATTRIBUTE_NODE && imp->element()) {
- if (!allowSettingSrcToJavascriptURL(exec, imp->element(), newNode->nodeName(), newNode->nodeValue()))
- return jsNull();
- }
-
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setNamedItemNS(newNode, ec)));
- setDOMException(exec, ec);
- return result;
-}
-
bool JSNamedNodeMap::canGetItemsForName(ExecState*, NamedNodeMap* impl, const Identifier& propertyName)
{
return impl->getNamedItem(identifierToString(propertyName));
diff --git a/WebCore/bindings/js/JSNodeCustom.cpp b/WebCore/bindings/js/JSNodeCustom.cpp
index 9fbcffd..747f238 100644
--- a/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/WebCore/bindings/js/JSNodeCustom.cpp
@@ -68,51 +68,9 @@ using namespace JSC;
namespace WebCore {
-static inline bool isAttrFrameSrc(Element *element, const String& name)
-{
- return element && (element->hasTagName(HTMLNames::iframeTag) || element->hasTagName(HTMLNames::frameTag)) && equalIgnoringCase(name, "src");
-}
-
-void JSNode::setNodeValue(JSC::ExecState* exec, JSC::JSValue value)
-{
- Node* imp = static_cast<Node*>(impl());
- String nodeValue = valueToStringWithNullCheck(exec, value);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE) {
- Element* ownerElement = static_cast<Attr*>(impl())->ownerElement();
- if (ownerElement && !allowSettingSrcToJavascriptURL(exec, ownerElement, imp->nodeName(), nodeValue))
- return;
- }
-
- ExceptionCode ec = 0;
- imp->setNodeValue(nodeValue, ec);
- setDOMException(exec, ec);
-}
-
-void JSNode::setTextContent(JSC::ExecState* exec, JSC::JSValue value)
-{
- Node* imp = static_cast<Node*>(impl());
- String nodeValue = valueToStringWithNullCheck(exec, value);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE) {
- Element* ownerElement = static_cast<Attr*>(impl())->ownerElement();
- if (ownerElement && !allowSettingSrcToJavascriptURL(exec, ownerElement, imp->nodeName(), nodeValue))
- return;
- }
-
- ExceptionCode ec = 0;
- imp->setTextContent(nodeValue, ec);
- setDOMException(exec, ec);
-}
-
JSValue JSNode::insertBefore(ExecState* exec, const ArgList& args)
{
Node* imp = static_cast<Node*>(impl());
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isAttrFrameSrc(static_cast<Attr*>(impl())->ownerElement(), imp->nodeName())) {
- setDOMException(exec, NOT_SUPPORTED_ERR);
- return jsNull();
- }
-
ExceptionCode ec = 0;
bool ok = imp->insertBefore(toNode(args.at(0)), toNode(args.at(1)), ec, true);
setDOMException(exec, ec);
@@ -124,11 +82,6 @@ JSValue JSNode::insertBefore(ExecState* exec, const ArgList& args)
JSValue JSNode::replaceChild(ExecState* exec, const ArgList& args)
{
Node* imp = static_cast<Node*>(impl());
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isAttrFrameSrc(static_cast<Attr*>(impl())->ownerElement(), imp->nodeName())) {
- setDOMException(exec, NOT_SUPPORTED_ERR);
- return jsNull();
- }
-
ExceptionCode ec = 0;
bool ok = imp->replaceChild(toNode(args.at(0)), toNode(args.at(1)), ec, true);
setDOMException(exec, ec);
@@ -140,11 +93,6 @@ JSValue JSNode::replaceChild(ExecState* exec, const ArgList& args)
JSValue JSNode::removeChild(ExecState* exec, const ArgList& args)
{
Node* imp = static_cast<Node*>(impl());
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isAttrFrameSrc(static_cast<Attr*>(impl())->ownerElement(), imp->nodeName())) {
- setDOMException(exec, NOT_SUPPORTED_ERR);
- return jsNull();
- }
-
ExceptionCode ec = 0;
bool ok = imp->removeChild(toNode(args.at(0)), ec);
setDOMException(exec, ec);
@@ -156,11 +104,6 @@ JSValue JSNode::removeChild(ExecState* exec, const ArgList& args)
JSValue JSNode::appendChild(ExecState* exec, const ArgList& args)
{
Node* imp = static_cast<Node*>(impl());
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isAttrFrameSrc(static_cast<Attr*>(impl())->ownerElement(), imp->nodeName())) {
- setDOMException(exec, NOT_SUPPORTED_ERR);
- return jsNull();
- }
-
ExceptionCode ec = 0;
bool ok = imp->appendChild(toNode(args.at(0)), ec, true);
setDOMException(exec, ec);
diff --git a/WebCore/bindings/js/ScheduledAction.cpp b/WebCore/bindings/js/ScheduledAction.cpp
index 8fc860b..8cafefe 100644
--- a/WebCore/bindings/js/ScheduledAction.cpp
+++ b/WebCore/bindings/js/ScheduledAction.cpp
@@ -30,6 +30,7 @@
#include "FrameLoader.h"
#include "JSDOMBinding.h"
#include "JSDOMWindow.h"
+#include "JSMainThreadExecState.h"
#include "ScriptController.h"
#include "ScriptExecutionContext.h"
#include "ScriptSourceCode.h"
@@ -84,7 +85,7 @@ void ScheduledAction::execute(ScriptExecutionContext* context)
#endif
}
-void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSValue thisValue)
+void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSValue thisValue, ScriptExecutionContext* context)
{
ASSERT(m_function);
JSLock lock(SilenceAssertionsOnly);
@@ -102,7 +103,10 @@ void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSV
args.append(m_args[i]);
globalObject->globalData()->timeoutChecker.start();
- JSC::call(exec, m_function, callType, callData, thisValue, args);
+ if (context->isDocument())
+ JSMainThreadExecState::call(exec, m_function, callType, callData, thisValue, args);
+ else
+ JSC::call(exec, m_function, callType, callData, thisValue, args);
globalObject->globalData()->timeoutChecker.stop();
if (exec->hadException())
@@ -122,7 +126,7 @@ void ScheduledAction::execute(Document* document)
frame->script()->setProcessingTimerCallback(true);
if (m_function) {
- executeFunctionInContext(window, window->shell());
+ executeFunctionInContext(window, window->shell(), document);
Document::updateStyleForAllDocuments();
} else
frame->script()->executeScriptInWorld(m_isolatedWorld.get(), m_code);
@@ -140,7 +144,7 @@ void ScheduledAction::execute(WorkerContext* workerContext)
if (m_function) {
JSWorkerContext* contextWrapper = scriptController->workerContextWrapper();
- executeFunctionInContext(contextWrapper, contextWrapper);
+ executeFunctionInContext(contextWrapper, contextWrapper, workerContext);
} else {
ScriptSourceCode code(m_code, workerContext->url());
scriptController->evaluate(code);
diff --git a/WebCore/bindings/js/ScheduledAction.h b/WebCore/bindings/js/ScheduledAction.h
index 3b7e001..313451a 100644
--- a/WebCore/bindings/js/ScheduledAction.h
+++ b/WebCore/bindings/js/ScheduledAction.h
@@ -55,7 +55,7 @@ namespace WebCore {
{
}
- void executeFunctionInContext(JSC::JSGlobalObject*, JSC::JSValue thisValue);
+ void executeFunctionInContext(JSC::JSGlobalObject*, JSC::JSValue thisValue, ScriptExecutionContext*);
void execute(Document*);
#if ENABLE(WORKERS)
void execute(WorkerContext*);
diff --git a/WebCore/bindings/js/ScriptCallStack.cpp b/WebCore/bindings/js/ScriptCallStack.cpp
index 771141d..64600cf 100644
--- a/WebCore/bindings/js/ScriptCallStack.cpp
+++ b/WebCore/bindings/js/ScriptCallStack.cpp
@@ -33,7 +33,7 @@
#include <interpreter/CallFrame.h>
#include <interpreter/Interpreter.h>
-#include <runtime/InternalFunction.h>
+#include <runtime/JSFunction.h>
#include <runtime/JSValue.h>
#include <runtime/UString.h>
#include <runtime/JSGlobalData.h>
@@ -57,7 +57,7 @@ ScriptCallStack::ScriptCallStack(ExecState* exec, const ArgList& args, unsigned
unsigned lineNumber = signedLineNumber >= 0 ? signedLineNumber : 0;
if (function) {
- m_caller = asInternalFunction(function);
+ m_caller = asFunction(function);
m_frames.append(ScriptCallFrame(m_caller->name(m_exec), urlString, lineNumber, args, skipArgumentCount));
} else {
// Caller is unknown, but we should still add the frame, because
@@ -93,10 +93,10 @@ void ScriptCallStack::initialize()
JSValue func = m_exec->interpreter()->retrieveCaller(m_exec, m_caller);
while (!func.isNull()) {
- InternalFunction* internalFunction = asInternalFunction(func);
+ JSFunction* jsFunction = asFunction(func);
ArgList emptyArgList;
- m_frames.append(ScriptCallFrame(internalFunction->name(m_exec), UString(), 0, emptyArgList, 0));
- func = m_exec->interpreter()->retrieveCaller(m_exec, internalFunction);
+ m_frames.append(ScriptCallFrame(jsFunction->name(m_exec), UString(), 0, emptyArgList, 0));
+ func = m_exec->interpreter()->retrieveCaller(m_exec, jsFunction);
}
m_initialized = true;
}
diff --git a/WebCore/bindings/js/ScriptCallStack.h b/WebCore/bindings/js/ScriptCallStack.h
index e51d97a..7b66a97 100644
--- a/WebCore/bindings/js/ScriptCallStack.h
+++ b/WebCore/bindings/js/ScriptCallStack.h
@@ -61,7 +61,7 @@ namespace WebCore {
JSC::ExecState* m_exec;
Vector<ScriptCallFrame> m_frames;
- JSC::InternalFunction* m_caller;
+ JSC::JSFunction* m_caller;
};
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index 508b2f8..3dcbb0b 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -29,6 +29,7 @@
#include "HTMLPlugInElement.h"
#include "InspectorTimelineAgent.h"
#include "JSDocument.h"
+#include "JSMainThreadExecState.h"
#include "NP_jsobject.h"
#include "Page.h"
#include "PageGroup.h"
@@ -110,12 +111,12 @@ JSDOMWindowShell* ScriptController::createWindowShell(DOMWrapperWorld* world)
return windowShell;
}
-ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world)
+ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world, ShouldAllowXSS shouldAllowXSS)
{
const SourceCode& jsSourceCode = sourceCode.jsSourceCode();
String sourceURL = ustringToString(jsSourceCode.provider()->url());
- if (!m_XSSAuditor->canEvaluate(sourceCode.source())) {
+ if (shouldAllowXSS == DoNotAllowXSS && !m_XSSAuditor->canEvaluate(sourceCode.source())) {
// This script is not safe to be evaluated.
return JSValue();
}
@@ -142,7 +143,7 @@ ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode
#endif
exec->globalData().timeoutChecker.start();
- Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell);
+ Completion comp = JSMainThreadExecState::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell);
exec->globalData().timeoutChecker.stop();
#if ENABLE(INSPECTOR)
@@ -166,9 +167,9 @@ ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode
return JSValue();
}
-ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
+ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode, ShouldAllowXSS shouldAllowXSS)
{
- return evaluateInWorld(sourceCode, mainThreadNormalWorld());
+ return evaluateInWorld(sourceCode, mainThreadNormalWorld(), shouldAllowXSS);
}
PassRefPtr<DOMWrapperWorld> ScriptController::createWorld()
@@ -181,7 +182,7 @@ void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
static_cast<WebCoreJSClientData*>(JSDOMWindow::commonJSGlobalData()->clientData)->getAllWorlds(worlds);
}
-void ScriptController::clearWindowShell()
+void ScriptController::clearWindowShell(bool goingIntoPageCache)
{
if (m_windowShells.isEmpty())
return;
@@ -203,8 +204,10 @@ void ScriptController::clearWindowShell()
}
}
- // It's likely that resetting our windows created a lot of garbage.
- gcController().garbageCollectSoon();
+ // It's likely that resetting our windows created a lot of garbage, unless
+ // it went in a back/forward cache.
+ if (!goingIntoPageCache)
+ gcController().garbageCollectSoon();
}
JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world)
@@ -283,6 +286,16 @@ bool ScriptController::anyPageIsProcessingUserGesture() const
return false;
}
+bool ScriptController::canAccessFromCurrentOrigin(Frame *frame)
+{
+ ExecState* exec = JSMainThreadExecState::currentState();
+ if (exec)
+ return allowsAccessFromFrame(exec, frame);
+ // If the current state is 0 we're in a call path where the DOM security
+ // check doesn't apply (eg. parser).
+ return true;
+}
+
void ScriptController::attachDebugger(JSC::Debugger* debugger)
{
for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter)
@@ -441,7 +454,7 @@ void ScriptController::clearScriptObjects()
#endif
}
-ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture)
+ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture, ShouldAllowXSS shouldAllowXSS)
{
ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url());
@@ -451,7 +464,7 @@ ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const
bool wasInExecuteScript = m_inExecuteScript;
m_inExecuteScript = true;
- ScriptValue result = evaluateInWorld(sourceCode, world);
+ ScriptValue result = evaluateInWorld(sourceCode, world, shouldAllowXSS);
if (!wasInExecuteScript) {
m_inExecuteScript = false;
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index ed6c0a0..877eb9f 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -67,6 +67,12 @@ enum ReasonForCallingCanExecuteScripts {
NotAboutToExecuteScript
};
+// Whether to call the XSSAuditor to audit a script before passing it to the JavaScript engine.
+enum ShouldAllowXSS {
+ AllowXSS,
+ DoNotAllowXSS
+};
+
class ScriptController {
friend class ScriptCachedFrameData;
typedef WTF::HashMap< RefPtr<DOMWrapperWorld>, JSC::ProtectedPtr<JSDOMWindowShell> > ShellMap;
@@ -97,9 +103,9 @@ public:
static void getAllWorlds(Vector<DOMWrapperWorld*>&);
- ScriptValue executeScript(const ScriptSourceCode&);
- ScriptValue executeScript(const String& script, bool forceUserGesture = false);
- ScriptValue executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture = false);
+ ScriptValue executeScript(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
+ ScriptValue executeScript(const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
+ ScriptValue executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
// Returns true if argument is a JavaScript URL.
bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
@@ -108,8 +114,8 @@ public:
// Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
static void initializeThreading();
- ScriptValue evaluate(const ScriptSourceCode&);
- ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*);
+ ScriptValue evaluate(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
+ ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
void setEventHandlerLineNumber(int lineno) { m_handlerLineNumber = lineno; }
int eventHandlerLineNumber() { return m_handlerLineNumber; }
@@ -118,6 +124,7 @@ public:
bool processingUserGesture(DOMWrapperWorld*) const;
bool anyPageIsProcessingUserGesture() const;
+ static bool canAccessFromCurrentOrigin(Frame*);
bool canExecuteScripts(ReasonForCallingCanExecuteScripts);
// Debugger can be 0 to detach any existing Debugger.
@@ -132,7 +139,7 @@ public:
const String* sourceURL() const { return m_sourceURL; } // 0 if we are not evaluating any script
- void clearWindowShell();
+ void clearWindowShell(bool goingIntoPageCache = false);
void updateDocument();
// Notifies the ScriptController that the securityOrigin of the current
diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp
index e9073b5..3784457 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -32,6 +32,7 @@
#include "ScriptFunctionCall.h"
#include "JSDOMBinding.h"
+#include "JSMainThreadExecState.h"
#include "ScriptString.h"
#include "ScriptValue.h"
@@ -146,7 +147,7 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions)
if (callType == CallTypeNone)
return ScriptValue();
- JSValue result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments);
+ JSValue result = JSMainThreadExecState::call(m_exec, function, callType, callData, thisObject, m_arguments);
if (m_exec->hadException()) {
if (reportExceptions)
reportException(m_exec, m_exec->exception());
diff --git a/WebCore/bindings/js/WorkerScriptController.cpp b/WebCore/bindings/js/WorkerScriptController.cpp
index 85d6861..1d45dfa 100644
--- a/WebCore/bindings/js/WorkerScriptController.cpp
+++ b/WebCore/bindings/js/WorkerScriptController.cpp
@@ -71,22 +71,26 @@ void WorkerScriptController::initScript()
// when we allocate the global object. (Once the global object is fully
// constructed, it can mark its own prototype.)
RefPtr<Structure> workerContextPrototypeStructure = JSWorkerContextPrototype::createStructure(jsNull());
- ProtectedPtr<JSWorkerContextPrototype> workerContextPrototype = new (m_globalData.get()) JSWorkerContextPrototype(workerContextPrototypeStructure.release());
+ ProtectedPtr<JSWorkerContextPrototype> workerContextPrototype = new (m_globalData.get()) JSWorkerContextPrototype(0, workerContextPrototypeStructure.release());
if (m_workerContext->isDedicatedWorkerContext()) {
RefPtr<Structure> dedicatedContextPrototypeStructure = JSDedicatedWorkerContextPrototype::createStructure(workerContextPrototype);
- ProtectedPtr<JSDedicatedWorkerContextPrototype> dedicatedContextPrototype = new (m_globalData.get()) JSDedicatedWorkerContextPrototype(dedicatedContextPrototypeStructure.release());
+ ProtectedPtr<JSDedicatedWorkerContextPrototype> dedicatedContextPrototype = new (m_globalData.get()) JSDedicatedWorkerContextPrototype(0, dedicatedContextPrototypeStructure.release());
RefPtr<Structure> structure = JSDedicatedWorkerContext::createStructure(dedicatedContextPrototype);
m_workerContextWrapper = new (m_globalData.get()) JSDedicatedWorkerContext(structure.release(), m_workerContext->toDedicatedWorkerContext());
+ workerContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
+ dedicatedContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
#if ENABLE(SHARED_WORKERS)
} else {
ASSERT(m_workerContext->isSharedWorkerContext());
RefPtr<Structure> sharedContextPrototypeStructure = JSSharedWorkerContextPrototype::createStructure(workerContextPrototype);
- ProtectedPtr<JSSharedWorkerContextPrototype> sharedContextPrototype = new (m_globalData.get()) JSSharedWorkerContextPrototype(sharedContextPrototypeStructure.release());
+ ProtectedPtr<JSSharedWorkerContextPrototype> sharedContextPrototype = new (m_globalData.get()) JSSharedWorkerContextPrototype(0, sharedContextPrototypeStructure.release());
RefPtr<Structure> structure = JSSharedWorkerContext::createStructure(sharedContextPrototype);
m_workerContextWrapper = new (m_globalData.get()) JSSharedWorkerContext(structure.release(), m_workerContext->toSharedWorkerContext());
+ workerContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
+ sharedContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
#endif
}
}
diff --git a/WebCore/bindings/objc/ObjCEventListener.mm b/WebCore/bindings/objc/ObjCEventListener.mm
index d73ac30..c1b8aa5 100644
--- a/WebCore/bindings/objc/ObjCEventListener.mm
+++ b/WebCore/bindings/objc/ObjCEventListener.mm
@@ -32,6 +32,7 @@
#import "DOMEventListener.h"
#import "Event.h"
#import "EventListener.h"
+#import "JSMainThreadExecState.h"
#import <wtf/HashMap.h>
namespace WebCore {
diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm
index 1cec41c..794fc69 100644
--- a/WebCore/bindings/objc/WebScriptObject.mm
+++ b/WebCore/bindings/objc/WebScriptObject.mm
@@ -34,6 +34,7 @@
#import "JSDOMWindow.h"
#import "JSDOMWindowCustom.h"
#import "JSHTMLElement.h"
+#import "JSMainThreadExecState.h"
#import "JSPluginElementFunctions.h"
#import "ObjCRuntimeObject.h"
#import "PlatformString.h"
@@ -304,7 +305,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
return nil;
[self _rootObject]->globalObject()->globalData()->timeoutChecker.start();
- JSValue result = JSC::call(exec, function, callType, callData, [self _imp], argList);
+ JSValue result = JSMainThreadExecState::call(exec, function, callType, callData, [self _imp], argList);
[self _rootObject]->globalObject()->globalData()->timeoutChecker.stop();
if (exec->hadException()) {
@@ -333,7 +334,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
JSLock lock(SilenceAssertionsOnly);
[self _rootObject]->globalObject()->globalData()->timeoutChecker.start();
- Completion completion = JSC::evaluate([self _rootObject]->globalObject()->globalExec(), [self _rootObject]->globalObject()->globalScopeChain(), makeSource(String(script)), JSC::JSValue());
+ Completion completion = JSMainThreadExecState::evaluate([self _rootObject]->globalObject()->globalExec(), [self _rootObject]->globalObject()->globalScopeChain(), makeSource(String(script)), JSC::JSValue());
[self _rootObject]->globalObject()->globalData()->timeoutChecker.stop();
ComplType type = completion.complType();
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 46ac42d..3be997f 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -226,7 +226,7 @@ sub IndexGetterReturnsStrings
{
my $type = shift;
- return 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "CSSVariablesDeclaration";
+ return 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "CSSVariablesDeclaration" or $type eq "DOMStringList";
return 0;
}
@@ -643,6 +643,8 @@ sub GenerateHeader
if ($hasParent && $dataNode->extendedAttributes->{"GenerateNativeConverter"}) {
$headerIncludes{"$implClassName.h"} = 1;
}
+
+ $headerIncludes{"<runtime/JSObjectWithGlobalObject.h>"} = 1;
$headerIncludes{"SVGElement.h"} = 1 if $className =~ /^JSSVG/;
@@ -935,8 +937,8 @@ sub GenerateHeader
# Add prototype declaration.
%structureFlags = ();
- push(@headerContent, "class ${className}Prototype : public JSC::JSObject {\n");
- push(@headerContent, " typedef JSC::JSObject Base;\n");
+ push(@headerContent, "class ${className}Prototype : public JSC::JSObjectWithGlobalObject {\n");
+ push(@headerContent, " typedef JSC::JSObjectWithGlobalObject Base;\n");
push(@headerContent, "public:\n");
if ($interfaceName eq "DOMWindow") {
push(@headerContent, " void* operator new(size_t);\n");
@@ -970,7 +972,7 @@ sub GenerateHeader
# Custom defineGetter function
push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"};
- push(@headerContent, " ${className}Prototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }\n");
+ push(@headerContent, " ${className}Prototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { }\n");
# structure flags
push(@headerContent, "protected:\n");
@@ -985,7 +987,7 @@ sub GenerateHeader
if ($numFunctions > 0) {
push(@headerContent,"// Functions\n\n");
foreach my $function (@{$dataNode->functions}) {
- next if $function->{overloadIndex} > 1;
+ next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name);
push(@headerContent, "JSC::JSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);\n");
}
@@ -1254,7 +1256,7 @@ sub GenerateImplementation
}
foreach my $function (@{$dataNode->functions}) {
- next if $function->{overloadIndex} > 1;
+ next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
my $name = $function->signature->name;
push(@hashKeys, $name);
@@ -1440,9 +1442,9 @@ sub GenerateImplementation
push(@implContent, "JSObject* ${className}::createPrototype(ExecState* exec, JSGlobalObject* globalObject)\n");
push(@implContent, "{\n");
if ($hasParent && $parentClassName ne "JSC::DOMNodeFilter") {
- push(@implContent, " return new (exec) ${className}Prototype(${className}Prototype::createStructure(${parentClassName}Prototype::self(exec, globalObject)));\n");
+ push(@implContent, " return new (exec) ${className}Prototype(globalObject, ${className}Prototype::createStructure(${parentClassName}Prototype::self(exec, globalObject)));\n");
} else {
- push(@implContent, " return new (exec) ${className}Prototype(${className}Prototype::createStructure(globalObject->objectPrototype()));\n");
+ push(@implContent, " return new (exec) ${className}Prototype(globalObject, ${className}Prototype::createStructure(globalObject->objectPrototype()));\n");
}
push(@implContent, "}\n\n");
}
@@ -1781,7 +1783,7 @@ sub GenerateImplementation
my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name);
- if (@{$function->{overloads}} > 1) {
+ if ($function->{overloads} && @{$function->{overloads}} > 1) {
# Append a number to an overloaded method's name to make it unique:
$functionName = $functionName . $function->{overloadIndex};
}
@@ -1953,7 +1955,7 @@ sub GenerateImplementation
}
push(@implContent, "}\n\n");
- if (@{$function->{overloads}} > 1 && $function->{overloadIndex} == @{$function->{overloads}}) {
+ if ($function->{overloads} && @{$function->{overloads}} > 1 && $function->{overloadIndex} == @{$function->{overloads}}) {
# Generate a function dispatching call to the rest of the overloads.
GenerateOverloadedPrototypeFunction($function, $dataNode, $implClassName);
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index 7132e22..e06b274 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -80,6 +80,7 @@ my %baseTypeHash = ("Object" => 1, "Node" => 1, "NodeList" => 1, "NamedNodeMap"
my $buildingForTigerOrEarlier = 1 if $ENV{"MACOSX_DEPLOYMENT_TARGET"} and $ENV{"MACOSX_DEPLOYMENT_TARGET"} <= 10.4;
my $buildingForLeopardOrLater = 1 if $ENV{"MACOSX_DEPLOYMENT_TARGET"} and $ENV{"MACOSX_DEPLOYMENT_TARGET"} >= 10.5;
my $exceptionInit = "WebCore::ExceptionCode ec = 0;";
+my $jsContextSetter = "WebCore::JSMainThreadNullState state;";
my $exceptionRaiseOnError = "WebCore::raiseOnDOMError(ec);";
my $assertMainThread = "{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }";
@@ -1056,6 +1057,7 @@ sub GenerateImplementation
$implIncludes{"ExceptionHandlers.h"} = 1;
$implIncludes{"ThreadCheck.h"} = 1;
+ $implIncludes{"JSMainThreadExecState.h"} = 1;
$implIncludes{"WebScriptObjectPrivate.h"} = 1;
$implIncludes{$classHeaderName . "Internal.h"} = 1;
@@ -1268,6 +1270,7 @@ sub GenerateImplementation
push(@implContent, $getterSig);
push(@implContent, "{\n");
+ push(@implContent, " $jsContextSetter\n");
push(@implContent, @customGetterContent);
if ($hasGetterException) {
# Differentiated between when the return type is a pointer and
@@ -1308,6 +1311,7 @@ sub GenerateImplementation
push(@implContent, $setterSig);
push(@implContent, "{\n");
+ push(@implContent, " $jsContextSetter\n");
unless ($codeGenerator->IsPrimitiveType($idlType) or $codeGenerator->IsStringType($idlType)) {
push(@implContent, " ASSERT($argName);\n\n");
@@ -1523,6 +1527,7 @@ sub GenerateImplementation
push(@implContent, "$functionSig\n");
push(@implContent, "{\n");
+ push(@implContent, " $jsContextSetter\n");
push(@implContent, @functionContent);
push(@implContent, "}\n\n");
@@ -1533,6 +1538,7 @@ sub GenerateImplementation
push(@implContent, "$deprecatedFunctionSig\n");
push(@implContent, "{\n");
+ push(@implContent, " $jsContextSetter\n");
push(@implContent, @functionContent);
push(@implContent, "}\n\n");
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index f38e0d1..0167a4f 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -628,7 +628,10 @@ sub GenerateNormalAttrGetter
my $getterStringUsesImp = $implClassName ne "float";
- # Getter
+ # Getter
+ my $conditionalString = GenerateConditionalString($attribute->signature);
+ push(@implContentDecls, "#if ${conditionalString}\n\n") if $conditionalString;
+
push(@implContentDecls, <<END);
static v8::Handle<v8::Value> ${attrName}AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
@@ -671,6 +674,7 @@ END
$implIncludes{"${namespace}.h"} = 1;
push(@implContentDecls, " return getElementStringAttr(info, ${namespace}::${contentAttributeName}Attr);\n");
push(@implContentDecls, "}\n\n");
+ push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
return;
# Skip the rest of the function!
}
@@ -801,6 +805,7 @@ END
push(@implContentDecls, " }\n");
push(@implContentDecls, " return wrapper;\n");
push(@implContentDecls, "}\n\n");
+ push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
return;
}
}
@@ -825,6 +830,7 @@ END
}
push(@implContentDecls, "}\n\n"); # end of getter
+ push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
}
sub GenerateNormalAttrSetter
@@ -836,6 +842,9 @@ sub GenerateNormalAttrSetter
my $attrExt = $attribute->signature->extendedAttributes;
+ my $conditionalString = GenerateConditionalString($attribute->signature);
+ push(@implContentDecls, "#if ${conditionalString}\n\n") if $conditionalString;
+
push(@implContentDecls, "static void ${attrName}AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n");
push(@implContentDecls, " INC_STATS(\"DOM.$implClassName.$attrName._set\");\n");
@@ -875,6 +884,7 @@ END
$implIncludes{"${namespace}.h"} = 1;
push(@implContentDecls, " setElementStringAttr(info, ${namespace}::${contentAttributeName}Attr, value);\n");
push(@implContentDecls, "}\n\n");
+ push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
return;
# Skip the rest of the function!
}
@@ -963,6 +973,7 @@ END
push(@implContentDecls, " return;\n");
push(@implContentDecls, "}\n\n"); # end of setter
+ push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
}
sub GetFunctionTemplateCallbackName
diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
index 233ba21..51eb4ec 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
@@ -44,13 +44,7 @@ static const HashTableValue JSTestInterfaceTableValues[2] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestInterfaceTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 0, JSTestInterfaceTableValues, 0 };
-#else
- { 2, 1, JSTestInterfaceTableValues, 0 };
-#endif
-
+static JSC_CONST_HASHTABLE HashTable JSTestInterfaceTable = { 2, 1, JSTestInterfaceTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
@@ -64,13 +58,7 @@ static const HashTableValue JSTestInterfaceConstructorTableValues[1] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestInterfaceConstructorTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 0, JSTestInterfaceConstructorTableValues, 0 };
-#else
- { 1, 0, JSTestInterfaceConstructorTableValues, 0 };
-#endif
-
+static JSC_CONST_HASHTABLE HashTable JSTestInterfaceConstructorTable = { 1, 0, JSTestInterfaceConstructorTableValues, 0 };
class JSTestInterfaceConstructor : public DOMConstructorObject {
public:
JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
@@ -129,13 +117,7 @@ static const HashTableValue JSTestInterfacePrototypeTableValues[1] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestInterfacePrototypeTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 0, JSTestInterfacePrototypeTableValues, 0 };
-#else
- { 1, 0, JSTestInterfacePrototypeTableValues, 0 };
-#endif
-
+static JSC_CONST_HASHTABLE HashTable JSTestInterfacePrototypeTable = { 1, 0, JSTestInterfacePrototypeTableValues, 0 };
const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", 0, &JSTestInterfacePrototypeTable, 0 };
JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index de5a171..926d137 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -66,13 +66,7 @@ static const HashTableValue JSTestObjTableValues[15] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 127, JSTestObjTableValues, 0 };
-#else
- { 34, 31, JSTestObjTableValues, 0 };
-#endif
-
+static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 34, 31, JSTestObjTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
@@ -86,13 +80,7 @@ static const HashTableValue JSTestObjConstructorTableValues[1] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjConstructorTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 0, JSTestObjConstructorTableValues, 0 };
-#else
- { 1, 0, JSTestObjConstructorTableValues, 0 };
-#endif
-
+static JSC_CONST_HASHTABLE HashTable JSTestObjConstructorTable = { 1, 0, JSTestObjConstructorTableValues, 0 };
class JSTestObjConstructor : public DOMConstructorObject {
public:
JSTestObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
@@ -167,13 +155,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[29] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 8191, JSTestObjPrototypeTableValues, 0 };
-#else
- { 69, 63, JSTestObjPrototypeTableValues, 0 };
-#endif
-
+static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 69, 63, JSTestObjPrototypeTableValues, 0 };
const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 };
JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm
index 5201a91..e941eda 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm
@@ -50,6 +50,7 @@
#import "DOMStyleSheetInternal.h"
#import "DOMTestCallbackInternal.h"
#import "ExceptionHandlers.h"
+#import "JSMainThreadExecState.h"
#import "KURL.h"
#import "TestCallback.h"
#import "ThreadCheck.h"
@@ -80,21 +81,25 @@
- (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param
{
+ WebCore::JSMainThreadNullState state;
return IMPL->callbackWithClass1Param(core(class1Param));
}
- (BOOL)callbackWithClass2Param:(DOMClass2 *)class2Param strArg:(NSString *)strArg
{
+ WebCore::JSMainThreadNullState state;
return IMPL->callbackWithClass2Param(core(class2Param), strArg);
}
- (int)callbackWithNonBoolReturnType:(DOMClass3 *)class3Param
{
+ WebCore::JSMainThreadNullState state;
return IMPL->callbackWithNonBoolReturnType(core(class3Param));
}
- (int)customCallback:(DOMClass5 *)class5Param class6Param:(DOMClass6 *)class6Param
{
+ WebCore::JSMainThreadNullState state;
return IMPL->customCallback(core(class5Param), core(class6Param));
}
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm
index a88b366..8fd7791 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm
@@ -37,6 +37,7 @@
#import "DOMStyleSheetInternal.h"
#import "DOMTestInterfaceInternal.h"
#import "ExceptionHandlers.h"
+#import "JSMainThreadExecState.h"
#import "TestInterface.h"
#import "ThreadCheck.h"
#import "WebCoreObjCExtras.h"
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
index a24f6fe..0f3fb66 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
@@ -39,6 +39,7 @@
#import "DOMlogInternal.h"
#import "EventListener.h"
#import "ExceptionHandlers.h"
+#import "JSMainThreadExecState.h"
#import "KURL.h"
#import "ObjCEventListener.h"
#import "SerializedScriptValue.h"
@@ -72,66 +73,79 @@
- (int)readOnlyIntAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->readOnlyIntAttr();
}
- (NSString *)readOnlyStringAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->readOnlyStringAttr();
}
- (DOMTestObj *)readOnlyTestObjAttr
{
+ WebCore::JSMainThreadNullState state;
return kit(WTF::getPtr(IMPL->readOnlyTestObjAttr()));
}
- (int)intAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->intAttr();
}
- (void)setIntAttr:(int)newIntAttr
{
+ WebCore::JSMainThreadNullState state;
IMPL->setIntAttr(newIntAttr);
}
- (long long)longLongAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->longLongAttr();
}
- (void)setLongLongAttr:(long long)newLongLongAttr
{
+ WebCore::JSMainThreadNullState state;
IMPL->setLongLongAttr(newLongLongAttr);
}
- (unsigned long long)unsignedLongLongAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->unsignedLongLongAttr();
}
- (void)setUnsignedLongLongAttr:(unsigned long long)newUnsignedLongLongAttr
{
+ WebCore::JSMainThreadNullState state;
IMPL->setUnsignedLongLongAttr(newUnsignedLongLongAttr);
}
- (NSString *)stringAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->stringAttr();
}
- (void)setStringAttr:(NSString *)newStringAttr
{
+ WebCore::JSMainThreadNullState state;
IMPL->setStringAttr(newStringAttr);
}
- (DOMTestObj *)testObjAttr
{
+ WebCore::JSMainThreadNullState state;
return kit(WTF::getPtr(IMPL->testObjAttr()));
}
- (void)setTestObjAttr:(DOMTestObj *)newTestObjAttr
{
+ WebCore::JSMainThreadNullState state;
ASSERT(newTestObjAttr);
IMPL->setTestObjAttr(core(newTestObjAttr));
@@ -139,16 +153,19 @@
- (int)attrWithException
{
+ WebCore::JSMainThreadNullState state;
return IMPL->attrWithException();
}
- (void)setAttrWithException:(int)newAttrWithException
{
+ WebCore::JSMainThreadNullState state;
IMPL->setAttrWithException(newAttrWithException);
}
- (int)attrWithSetterException
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
int result = IMPL->attrWithSetterException(ec);
WebCore::raiseOnDOMError(ec);
@@ -157,6 +174,7 @@
- (void)setAttrWithSetterException:(int)newAttrWithSetterException
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
IMPL->setAttrWithSetterException(newAttrWithSetterException, ec);
WebCore::raiseOnDOMError(ec);
@@ -164,11 +182,13 @@
- (int)attrWithGetterException
{
+ WebCore::JSMainThreadNullState state;
return IMPL->attrWithGetterException();
}
- (void)setAttrWithGetterException:(int)newAttrWithGetterException
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
IMPL->setAttrWithGetterException(newAttrWithGetterException, ec);
WebCore::raiseOnDOMError(ec);
@@ -176,56 +196,67 @@
- (int)customAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->customAttr();
}
- (void)setCustomAttr:(int)newCustomAttr
{
+ WebCore::JSMainThreadNullState state;
IMPL->setCustomAttr(newCustomAttr);
}
- (NSString *)scriptStringAttr
{
+ WebCore::JSMainThreadNullState state;
return IMPL->scriptStringAttr();
}
- (void)voidMethod
{
+ WebCore::JSMainThreadNullState state;
IMPL->voidMethod();
}
- (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg
{
+ WebCore::JSMainThreadNullState state;
IMPL->voidMethodWithArgs(intArg, strArg, core(objArg));
}
- (int)intMethod
{
+ WebCore::JSMainThreadNullState state;
return IMPL->intMethod();
}
- (int)intMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg
{
+ WebCore::JSMainThreadNullState state;
return IMPL->intMethodWithArgs(intArg, strArg, core(objArg));
}
- (DOMTestObj *)objMethod
{
+ WebCore::JSMainThreadNullState state;
return kit(WTF::getPtr(IMPL->objMethod()));
}
- (DOMTestObj *)objMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg
{
+ WebCore::JSMainThreadNullState state;
return kit(WTF::getPtr(IMPL->objMethodWithArgs(intArg, strArg, core(objArg))));
}
- (DOMTestObj *)methodThatRequiresAllArgs:(NSString *)strArg objArg:(DOMTestObj *)objArg
{
+ WebCore::JSMainThreadNullState state;
return kit(WTF::getPtr(IMPL->methodThatRequiresAllArgs(strArg, core(objArg))));
}
- (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
DOMTestObj *result = kit(WTF::getPtr(IMPL->methodThatRequiresAllArgsAndThrows(strArg, core(objArg), ec)));
WebCore::raiseOnDOMError(ec);
@@ -234,11 +265,13 @@
- (void)serializedValue:(NSString *)serializedArg
{
+ WebCore::JSMainThreadNullState state;
IMPL->serializedValue(WebCore::SerializedScriptValue::create(WebCore::String(serializedArg)));
}
- (void)methodWithException
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
IMPL->methodWithException(ec);
WebCore::raiseOnDOMError(ec);
@@ -246,16 +279,19 @@
- (void)customMethod
{
+ WebCore::JSMainThreadNullState state;
IMPL->customMethod();
}
- (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg
{
+ WebCore::JSMainThreadNullState state;
IMPL->customMethodWithArgs(intArg, strArg, core(objArg));
}
- (void)customArgsAndException:(DOMlog *)intArg
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
IMPL->customArgsAndException(core(intArg), ec);
WebCore::raiseOnDOMError(ec);
@@ -263,53 +299,63 @@
- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture
{
+ WebCore::JSMainThreadNullState state;
RefPtr<WebCore::EventListener> nativeEventListener = WebCore::ObjCEventListener::wrap(listener);
IMPL->addEventListener(type, WTF::getPtr(nativeEventListener), useCapture);
}
- (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture
{
+ WebCore::JSMainThreadNullState state;
RefPtr<WebCore::EventListener> nativeEventListener = WebCore::ObjCEventListener::wrap(listener);
IMPL->removeEventListener(type, WTF::getPtr(nativeEventListener), useCapture);
}
- (void)withDynamicFrame
{
+ WebCore::JSMainThreadNullState state;
IMPL->withDynamicFrame();
}
- (void)withDynamicFrameAndArg:(int)intArg
{
+ WebCore::JSMainThreadNullState state;
IMPL->withDynamicFrameAndArg(intArg);
}
- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg
{
+ WebCore::JSMainThreadNullState state;
IMPL->withDynamicFrameAndOptionalArg(intArg, optionalArg);
}
- (void)withDynamicFrameAndUserGesture:(int)intArg
{
+ WebCore::JSMainThreadNullState state;
IMPL->withDynamicFrameAndUserGesture(intArg);
}
- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg
{
+ WebCore::JSMainThreadNullState state;
IMPL->withDynamicFrameAndUserGestureASAD(intArg, optionalArg);
}
- (void)withScriptStateVoid
{
+ WebCore::JSMainThreadNullState state;
IMPL->withScriptStateVoid();
}
- (DOMTestObj *)withScriptStateObj
{
+ WebCore::JSMainThreadNullState state;
return kit(WTF::getPtr(IMPL->withScriptStateObj()));
}
- (void)withScriptStateVoidException
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
IMPL->withScriptStateVoidException(ec);
WebCore::raiseOnDOMError(ec);
@@ -317,6 +363,7 @@
- (DOMTestObj *)withScriptStateObjException
{
+ WebCore::JSMainThreadNullState state;
WebCore::ExceptionCode ec = 0;
DOMTestObj *result = kit(WTF::getPtr(IMPL->withScriptStateObjException(ec)));
WebCore::raiseOnDOMError(ec);
@@ -325,16 +372,19 @@
- (void)methodWithOptionalArg:(int)opt
{
+ WebCore::JSMainThreadNullState state;
IMPL->methodWithOptionalArg(opt);
}
- (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt
{
+ WebCore::JSMainThreadNullState state;
IMPL->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
}
- (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2
{
+ WebCore::JSMainThreadNullState state;
IMPL->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
}
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index 56f9810..d8076f3 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -52,13 +52,7 @@
#include <v8.h>
#include <wtf/StringExtras.h>
-using WebCore::npObjectInternalFieldCount;
-using WebCore::toV8Context;
-using WebCore::toV8Proxy;
-using WebCore::V8DOMWrapper;
-using WebCore::V8GCController;
-using WebCore::V8Proxy;
-using WebCore::WrapperTypeInfo;
+using namespace WebCore;
namespace WebCore {
@@ -68,8 +62,6 @@ WrapperTypeInfo* npObjectTypeInfo()
return &typeInfo;
}
-}
-
// FIXME: Comments on why use malloc and free.
static NPObject* allocV8NPObject(NPP, NPClass*)
{
@@ -110,7 +102,7 @@ static v8::Local<v8::String> npIdentifierToV8Identifier(NPIdentifier name)
NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<NPObject*>(object->GetPointerFromInternalField(WebCore::v8DOMWrapperObjectIndex));
+ return reinterpret_cast<NPObject*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static NPClass V8NPObjectClass = { NP_CLASS_STRUCT_VERSION,
@@ -121,12 +113,12 @@ static NPClass V8NPObjectClass = { NP_CLASS_STRUCT_VERSION,
// NPAPI's npruntime functions.
NPClass* npScriptObjectClass = &V8NPObjectClass;
-NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, WebCore::DOMWindow* root)
+NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWindow* root)
{
// Check to see if this object is already wrapped.
if (object->InternalFieldCount() == npObjectInternalFieldCount) {
- WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(WebCore::v8DOMWrapperTypeIndex));
- if (typeInfo == WebCore::npObjectTypeInfo()) {
+ WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(v8DOMWrapperTypeIndex));
+ if (typeInfo == npObjectTypeInfo()) {
NPObject* returnValue = v8ObjectToNPObject(object);
_NPN_RetainObject(returnValue);
@@ -137,12 +129,14 @@ NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, WebCore
V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp, &V8NPObjectClass));
v8npObject->v8Object = v8::Persistent<v8::Object>::New(object);
#ifndef NDEBUG
- V8GCController::registerGlobalHandle(WebCore::NPOBJECT, v8npObject, v8npObject->v8Object);
+ V8GCController::registerGlobalHandle(NPOBJECT, v8npObject, v8npObject->v8Object);
#endif
v8npObject->rootObject = root;
return reinterpret_cast<NPObject*>(v8npObject);
}
+} // namespace WebCore
+
bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
if (!npObject)
@@ -162,6 +156,14 @@ bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV
if (!identifier->isString)
return false;
+ if (!strcmp(identifier->value.string, "eval")) {
+ if (argumentCount != 1)
+ return false;
+ if (arguments[0].type != NPVariantType_String)
+ return false;
+ return _NPN_Evaluate(npp, npObject, const_cast<NPString*>(&arguments[0].value.stringValue), result);
+ }
+
v8::HandleScope handleScope;
// FIXME: should use the plugin's owner frame as the security context.
v8::Handle<v8::Context> context = toV8Context(npp, npObject);
@@ -169,14 +171,7 @@ bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV
return false;
v8::Context::Scope scope(context);
-
- if (methodName == _NPN_GetStringIdentifier("eval")) {
- if (argumentCount != 1)
- return false;
- if (arguments[0].type != NPVariantType_String)
- return false;
- return _NPN_Evaluate(npp, npObject, const_cast<NPString*>(&arguments[0].value.stringValue), result);
- }
+ ExceptionCatcher exceptionCatcher;
v8::Handle<v8::Value> functionObject = v8NpObject->v8Object->Get(v8::String::New(identifier->value.string));
if (functionObject.IsEmpty() || functionObject->IsNull()) {
@@ -229,6 +224,7 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments,
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
// Lookup the function object and call it.
v8::Handle<v8::Object> functionObject(v8NpObject->v8Object);
@@ -255,7 +251,7 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments,
bool _NPN_Evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* result)
{
- bool popupsAllowed = WebCore::PlatformBridge::popupsAllowed(npp);
+ bool popupsAllowed = PlatformBridge::popupsAllowed(npp);
return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result);
}
@@ -277,13 +273,14 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
ASSERT(proxy);
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
- WebCore::String filename;
+ String filename;
if (!popupsAllowed)
filename = "npscript";
- WebCore::String script = WebCore::String::fromUTF8(npScript->UTF8Characters, npScript->UTF8Length);
- v8::Local<v8::Value> v8result = proxy->evaluate(WebCore::ScriptSourceCode(script, WebCore::KURL(WebCore::ParsedURLString, filename)), 0);
+ String script = String::fromUTF8(npScript->UTF8Characters, npScript->UTF8Length);
+ v8::Local<v8::Value> v8result = proxy->evaluate(ScriptSourceCode(script, KURL(ParsedURLString, filename)), 0);
if (v8result.IsEmpty())
return false;
@@ -306,6 +303,7 @@ bool _NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NP
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
v8::Handle<v8::Object> obj(object->v8Object);
v8::Local<v8::Value> v8result = obj->Get(npIdentifierToV8Identifier(propertyName));
@@ -340,6 +338,7 @@ bool _NPN_SetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, co
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
v8::Handle<v8::Object> obj(object->v8Object);
obj->Set(npIdentifierToV8Identifier(propertyName),
@@ -367,6 +366,7 @@ bool _NPN_RemoveProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName)
if (context.IsEmpty())
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
v8::Handle<v8::Object> obj(object->v8Object);
// FIXME: Verify that setting to undefined is right.
@@ -387,6 +387,7 @@ bool _NPN_HasProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName)
if (context.IsEmpty())
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
v8::Handle<v8::Object> obj(object->v8Object);
return obj->Has(npIdentifierToV8Identifier(propertyName));
@@ -410,6 +411,7 @@ bool _NPN_HasMethod(NPP npp, NPObject* npObject, NPIdentifier methodName)
if (context.IsEmpty())
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
v8::Handle<v8::Object> obj(object->v8Object);
v8::Handle<v8::Value> prop = obj->Get(npIdentifierToV8Identifier(methodName));
@@ -439,6 +441,8 @@ void _NPN_SetException(NPObject* npObject, const NPUTF8 *message)
return;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
+
V8Proxy::throwError(V8Proxy::GeneralError, message);
}
@@ -455,6 +459,7 @@ bool _NPN_Enumerate(NPP npp, NPObject* npObject, NPIdentifier** identifier, uint
if (context.IsEmpty())
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
v8::Handle<v8::Object> obj(object->v8Object);
@@ -509,6 +514,7 @@ bool _NPN_Construct(NPP npp, NPObject* npObject, const NPVariant* arguments, uin
if (context.IsEmpty())
return false;
v8::Context::Scope scope(context);
+ ExceptionCatcher exceptionCatcher;
// Lookup the constructor function.
v8::Handle<v8::Object> ctorObj(object->v8Object);
diff --git a/WebCore/bindings/v8/NPV8Object.h b/WebCore/bindings/v8/NPV8Object.h
index b6fecce..2a81181 100644
--- a/WebCore/bindings/v8/NPV8Object.h
+++ b/WebCore/bindings/v8/NPV8Object.h
@@ -45,12 +45,12 @@
#include <v8.h>
namespace WebCore {
- class DOMWindow;
- static const int npObjectInternalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+class DOMWindow;
- WrapperTypeInfo* npObjectTypeInfo();
-}
+static const int npObjectInternalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+
+WrapperTypeInfo* npObjectTypeInfo();
extern NPClass* npScriptObjectClass;
@@ -59,7 +59,7 @@ extern NPClass* npScriptObjectClass;
struct V8NPObject {
NPObject object;
v8::Persistent<v8::Object> v8Object;
- WebCore::DOMWindow* rootObject;
+ DOMWindow* rootObject;
};
struct PrivateIdentifier {
@@ -70,8 +70,10 @@ struct PrivateIdentifier {
bool isString;
};
-NPObject* npCreateV8ScriptObject(NPP, v8::Handle<v8::Object>, WebCore::DOMWindow*);
+NPObject* npCreateV8ScriptObject(NPP, v8::Handle<v8::Object>, DOMWindow*);
NPObject* v8ObjectToNPObject(v8::Handle<v8::Object>);
+} // namespace WebCore
+
#endif // NPV8Object_h
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 7748f75..41cb5a2 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -88,6 +88,11 @@ Frame* ScriptController::retrieveFrameForCurrentContext()
return V8Proxy::retrieveFrameForCurrentContext();
}
+bool ScriptController::canAccessFromCurrentOrigin(Frame *frame)
+{
+ return !v8::Context::InContext() || V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true);
+}
+
bool ScriptController::isSafeScript(Frame* target)
{
return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, true);
@@ -219,13 +224,13 @@ void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<Sc
}
// Evaluate a script file in the environment of this proxy.
-ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
+ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode, ShouldAllowXSS shouldAllowXSS)
{
String sourceURL = sourceCode.url();
const String* savedSourceURL = m_sourceURL;
m_sourceURL = &sourceURL;
- if (!m_XSSAuditor->canEvaluate(sourceCode.source())) {
+ if (shouldAllowXSS == DoNotAllowXSS && !m_XSSAuditor->canEvaluate(sourceCode.source())) {
// This script is not safe to be evaluated.
return ScriptValue();
}
@@ -444,7 +449,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
}
-void ScriptController::clearWindowShell()
+void ScriptController::clearWindowShell(bool)
{
// V8 binding expects ScriptController::clearWindowShell only be called
// when a frame is loading a new page. V8Proxy::clearForNavigation
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 1400134..ee39e9a 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -60,6 +60,12 @@ enum ReasonForCallingCanExecuteScripts {
NotAboutToExecuteScript
};
+// Whether to call the XSSAuditor to audit a script before passing it to the JavaScript engine.
+enum ShouldAllowXSS {
+ AllowXSS,
+ DoNotAllowXSS
+};
+
class ScriptController {
public:
ScriptController(Frame*);
@@ -69,8 +75,8 @@ public:
// or this accessor should be made JSProxy*
V8Proxy* proxy() { return m_proxy.get(); }
- ScriptValue executeScript(const ScriptSourceCode&);
- ScriptValue executeScript(const String& script, bool forceUserGesture = false);
+ ScriptValue executeScript(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
+ ScriptValue executeScript(const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
// Returns true if argument is a JavaScript URL.
bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
@@ -81,7 +87,7 @@ public:
// Evaluate a script file in the environment of this proxy.
// If succeeded, 'succ' is set to true and result is returned
// as a string.
- ScriptValue evaluate(const ScriptSourceCode&);
+ ScriptValue evaluate(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&);
@@ -118,6 +124,8 @@ public:
// Check if the javascript engine has been initialized.
bool haveInterpreter() const;
+ static bool canAccessFromCurrentOrigin(Frame*);
+
bool canExecuteScripts(ReasonForCallingCanExecuteScripts);
// FIXME: void* is a compile hack.
@@ -158,7 +166,7 @@ public:
const String* sourceURL() const { return m_sourceURL; } // 0 if we are not evaluating any script.
- void clearWindowShell();
+ void clearWindowShell(bool = false);
void updateDocument();
void updateSecurityOrigin();
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index 84450e5..f9cc94a 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -45,7 +45,7 @@
#include "npruntime_priv.h"
#include <wtf/OwnArrayPtr.h>
-using namespace WebCore;
+namespace WebCore {
enum InvokeFunctionType {
InvokeMethod = 1,
@@ -409,3 +409,5 @@ void forgetV8ObjectForNPObject(NPObject* object)
_NPN_ReleaseObject(object);
}
}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8NPObject.h b/WebCore/bindings/v8/V8NPObject.h
index 5924b3c..a540ca9 100644
--- a/WebCore/bindings/v8/V8NPObject.h
+++ b/WebCore/bindings/v8/V8NPObject.h
@@ -39,6 +39,8 @@
#include <v8.h>
+namespace WebCore {
+
// These functions can be replaced by normal JS operation.
// Getters
v8::Handle<v8::Value> npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo&);
@@ -65,4 +67,6 @@ v8::Local<v8::Object> createV8ObjectForNPObject(NPObject*, NPObject* root);
// cannot be referred to.
void forgetV8ObjectForNPObject(NPObject*);
+} // namespace WebCore
+
#endif // V8NPObject_h
diff --git a/WebCore/bindings/v8/V8NPUtils.cpp b/WebCore/bindings/v8/V8NPUtils.cpp
index 17855d7..8fa19d7 100644
--- a/WebCore/bindings/v8/V8NPUtils.cpp
+++ b/WebCore/bindings/v8/V8NPUtils.cpp
@@ -29,19 +29,18 @@
*/
#include "config.h"
-
#include "V8NPUtils.h"
#include "DOMWindow.h"
#include "Frame.h"
#include "PlatformString.h"
-#undef LOG
-
+#include "npruntime_impl.h"
+#include "npruntime_priv.h"
#include "NPV8Object.h"
#include "V8NPObject.h"
#include "V8Proxy.h"
-#include "npruntime_impl.h"
-#include "npruntime_priv.h"
+
+namespace WebCore {
void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NPVariant* result)
{
@@ -69,7 +68,7 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP
char* utf8_chars = strdup(*utf8);
STRINGN_TO_NPVARIANT(utf8_chars, utf8.length(), *result);
} else if (object->IsObject()) {
- WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(WebCore::V8Proxy::currentContext());
+ DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext());
NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window);
if (npobject)
_NPN_RegisterObject(npobject, owner);
@@ -77,7 +76,6 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP
}
}
-
v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObject* npobject)
{
NPVariantType type = variant->type;
@@ -128,3 +126,45 @@ NPIdentifier getStringIdentifier(v8::Handle<v8::String> str)
v8::String::Utf8Value utf8(str);
return _NPN_GetStringIdentifier(*utf8);
}
+
+struct ExceptionHandlerInfo {
+ ExceptionHandlerInfo* previous;
+ ExceptionHandler handler;
+ void* data;
+};
+
+static ExceptionHandlerInfo* topHandler;
+
+void pushExceptionHandler(ExceptionHandler handler, void* data)
+{
+ ExceptionHandlerInfo* info = new ExceptionHandlerInfo;
+ info->previous = topHandler;
+ info->handler = handler;
+ info->data = data;
+ topHandler = info;
+}
+
+void popExceptionHandler()
+{
+ ASSERT(topHandler);
+ ExceptionHandlerInfo* doomed = topHandler;
+ topHandler = topHandler->previous;
+ delete doomed;
+}
+
+ExceptionCatcher::ExceptionCatcher()
+{
+ if (!topHandler)
+ m_tryCatch.SetVerbose(true);
+}
+
+ExceptionCatcher::~ExceptionCatcher()
+{
+ if (!m_tryCatch.HasCaught())
+ return;
+
+ if (topHandler)
+ topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.Exception()));
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8NPUtils.h b/WebCore/bindings/v8/V8NPUtils.h
index c978d2b..78414b4 100644
--- a/WebCore/bindings/v8/V8NPUtils.h
+++ b/WebCore/bindings/v8/V8NPUtils.h
@@ -38,6 +38,8 @@
#include <v8.h>
+namespace WebCore {
+
// Convert a V8 Value of any type (string, bool, object, etc) to a NPVariant.
void convertV8ObjectToNPVariant(v8::Local<v8::Value>, NPObject*, NPVariant*);
@@ -48,4 +50,22 @@ v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant*, NPObject*);
// Helper function to create an NPN String Identifier from a v8 string.
NPIdentifier getStringIdentifier(v8::Handle<v8::String>);
+// The ExceptionHandler will be notified of any exceptions thrown while
+// operating on a NPObject.
+typedef void (*ExceptionHandler)(void* data, const NPUTF8* message);
+void pushExceptionHandler(ExceptionHandler, void* data);
+void popExceptionHandler();
+
+// Upon destruction, an ExceptionCatcher will pass a caught exception to the
+// current ExceptionHandler.
+class ExceptionCatcher {
+public:
+ ExceptionCatcher();
+ ~ExceptionCatcher();
+private:
+ v8::TryCatch m_tryCatch;
+};
+
+} // namespace WebCore
+
#endif // V8NPUtils_h
diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp
index 8a1a339..bce1561 100644
--- a/WebCore/bindings/v8/custom/V8EventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventCustom.cpp
@@ -40,6 +40,7 @@
#include "V8Clipboard.h"
#include "V8CompositionEvent.h"
#include "V8CustomEvent.h"
+#include "V8DeviceOrientationEvent.h"
#include "V8ErrorEvent.h"
#include "V8IDBErrorEvent.h"
#include "V8IDBSuccessEvent.h"
@@ -153,6 +154,10 @@ v8::Handle<v8::Value> toV8(Event* impl)
#endif
if (impl->isBeforeLoadEvent())
return toV8(static_cast<BeforeLoadEvent*>(impl));
+#if ENABLE(DEVICE_ORIENTATION)
+ if (impl->isDeviceOrientationEvent())
+ return toV8(static_cast<DeviceOrientationEvent*>(impl));
+#endif
if (impl->isCustomEvent())
return toV8(static_cast<CustomEvent*>(impl));
return V8Event::wrap(impl);
diff --git a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
index 4e1dd21..d9e1de0 100644
--- a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
@@ -75,48 +75,6 @@ v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String>
return toV8(result.release());
}
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.NamedNodeMap.setNamedItemNS");
- NamedNodeMap* imp = V8NamedNodeMap::toNative(args.Holder());
- Node* newNode = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
-
- if (newNode && newNode->nodeType() == Node::ATTRIBUTE_NODE && imp->element()) {
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), imp->element(), newNode->nodeName(), newNode->nodeValue()))
- return v8::Handle<v8::Value>();
- }
-
- ExceptionCode ec = 0;
- RefPtr<Node> result = imp->setNamedItemNS(newNode, ec);
- if (UNLIKELY(ec)) {
- throwError(ec);
- return v8::Handle<v8::Value>();
- }
-
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments & args)
-{
- INC_STATS("DOM.NamedNodeMap.setNamedItem");
- NamedNodeMap* imp = V8NamedNodeMap::toNative(args.Holder());
- Node* newNode = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
-
- if (newNode && newNode->nodeType() == Node::ATTRIBUTE_NODE && imp->element()) {
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), imp->element(), newNode->nodeName(), newNode->nodeValue()))
- return v8::Handle<v8::Value>();
- }
-
- ExceptionCode ec = 0;
- RefPtr<Node> result = imp->setNamedItem(newNode, ec);
- if (UNLIKELY(ec)) {
- throwError(ec);
- return v8::Handle<v8::Value>();
- }
-
- return toV8(result.release());
-}
-
v8::Handle<v8::Value> toV8(NamedNodeMap* impl)
{
if (!impl)
diff --git a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
index 0723498..905b23d 100644
--- a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
+++ b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
@@ -31,7 +31,7 @@
#include "V8NamedNodesCollection.h"
#include "Element.h"
-#include "NamedAttrMap.h"
+#include "NamedNodeMap.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
index 0a7198a..1f0c79b 100644
--- a/WebCore/bindings/v8/custom/V8NodeCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
@@ -57,57 +57,12 @@
namespace WebCore {
-static inline bool isFrameSrc(Element *element, const String& name)
-{
- return element && (element->hasTagName(HTMLNames::iframeTag) || element->hasTagName(HTMLNames::frameTag)) && equalIgnoringCase(name, "src");
-}
-
-void V8Node::textContentAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- Node* imp = V8Node::toNative(info.Holder());
- String nodeValue = toWebCoreStringWithNullCheck(value);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE) {
- Element * ownerElement = V8Attr::toNative(info.Holder())->ownerElement();
- if (ownerElement && !V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), ownerElement, imp->nodeName(), nodeValue))
- return;
- }
-
- ExceptionCode ec = 0;
- imp->setTextContent(nodeValue, ec);
- if (ec)
- throwError(ec);
-}
-
-void V8Node::nodeValueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- Node* imp = V8Node::toNative(info.Holder());
- String nodeValue = toWebCoreStringWithNullCheck(value);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE) {
- Element * ownerElement = V8Attr::toNative(info.Holder())->ownerElement();
- if (ownerElement && !V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), ownerElement, imp->nodeName(), nodeValue))
- return;
- }
-
- ExceptionCode ec = 0;
- imp->setNodeValue(nodeValue, ec);
- if (ec)
- throwError(ec);
-}
-
// This function is customized to take advantage of the optional 4th argument: shouldLazyAttach
v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Node.insertBefore");
v8::Handle<v8::Object> holder = args.Holder();
Node* imp = V8Node::toNative(holder);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) {
- V8Proxy::setDOMException(NOT_SUPPORTED_ERR);
- return v8::Handle<v8::Value>();
- }
-
ExceptionCode ec = 0;
Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
Node* refChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
@@ -127,12 +82,6 @@ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args)
INC_STATS("DOM.Node.replaceChild");
v8::Handle<v8::Object> holder = args.Holder();
Node* imp = V8Node::toNative(holder);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) {
- V8Proxy::setDOMException(NOT_SUPPORTED_ERR);
- return v8::Handle<v8::Value>();
- }
-
ExceptionCode ec = 0;
Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
Node* oldChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
@@ -151,12 +100,6 @@ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args)
INC_STATS("DOM.Node.removeChild");
v8::Handle<v8::Object> holder = args.Holder();
Node* imp = V8Node::toNative(holder);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) {
- V8Proxy::setDOMException(NOT_SUPPORTED_ERR);
- return v8::Handle<v8::Value>();
- }
-
ExceptionCode ec = 0;
Node* oldChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
bool success = imp->removeChild(oldChild, ec);
@@ -175,12 +118,6 @@ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args)
INC_STATS("DOM.Node.appendChild");
v8::Handle<v8::Object> holder = args.Holder();
Node* imp = V8Node::toNative(holder);
-
- if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) {
- V8Proxy::setDOMException(NOT_SUPPORTED_ERR);
- return v8::Handle<v8::Value>();
- }
-
ExceptionCode ec = 0;
Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
bool success = imp->appendChild(newChild, ec, true );
diff --git a/WebCore/bindings/v8/npruntime.cpp b/WebCore/bindings/v8/npruntime.cpp
index 35015b0..12500a7 100644
--- a/WebCore/bindings/v8/npruntime.cpp
+++ b/WebCore/bindings/v8/npruntime.cpp
@@ -35,6 +35,8 @@
#include <wtf/HashSet.h>
#include <wtf/Assertions.h>
+using namespace WebCore;
+
// FIXME: Consider removing locks if we're singlethreaded already.
// The static initializer here should work okay, but we want to avoid
// static initialization in general.
diff --git a/WebCore/bridge/c/CRuntimeObject.cpp b/WebCore/bridge/c/CRuntimeObject.cpp
index 47425a2..4be4982 100644
--- a/WebCore/bridge/c/CRuntimeObject.cpp
+++ b/WebCore/bridge/c/CRuntimeObject.cpp
@@ -35,8 +35,8 @@ namespace Bindings {
const ClassInfo CRuntimeObject::s_info = { "CRuntimeObject", &RuntimeObject::s_info, 0, 0 };
-CRuntimeObject::CRuntimeObject(ExecState* exec, PassRefPtr<CInstance> instance)
- : RuntimeObject(exec, instance)
+CRuntimeObject::CRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<CInstance> instance)
+ : RuntimeObject(exec, globalObject, instance)
{
}
diff --git a/WebCore/bridge/c/CRuntimeObject.h b/WebCore/bridge/c/CRuntimeObject.h
index b53387a..bcd39d3 100644
--- a/WebCore/bridge/c/CRuntimeObject.h
+++ b/WebCore/bridge/c/CRuntimeObject.h
@@ -37,7 +37,7 @@ class CInstance;
class CRuntimeObject : public RuntimeObject {
public:
- CRuntimeObject(ExecState*, PassRefPtr<CInstance>);
+ CRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<CInstance>);
virtual ~CRuntimeObject();
CInstance* getInternalCInstance() const;
diff --git a/WebCore/bridge/c/c_instance.cpp b/WebCore/bridge/c/c_instance.cpp
index 7dbc1d9..e985059 100644
--- a/WebCore/bridge/c/c_instance.cpp
+++ b/WebCore/bridge/c/c_instance.cpp
@@ -93,7 +93,7 @@ CInstance::~CInstance()
RuntimeObject* CInstance::newRuntimeObject(ExecState* exec)
{
- return new (exec) CRuntimeObject(exec, this);
+ return new (exec) CRuntimeObject(exec, exec->lexicalGlobalObject(), this);
}
Class *CInstance::getClass() const
@@ -110,8 +110,8 @@ bool CInstance::supportsInvokeDefaultMethod() const
class CRuntimeMethod : public RuntimeMethod {
public:
- CRuntimeMethod(ExecState* exec, const Identifier& name, Bindings::MethodList& list)
- : RuntimeMethod(exec, name, list)
+ CRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
+ : RuntimeMethod(exec, globalObject, name, list)
{
}
@@ -125,7 +125,7 @@ const ClassInfo CRuntimeMethod::s_info = { "CRuntimeMethod", &RuntimeMethod::s_i
JSValue CInstance::getMethod(ExecState* exec, const Identifier& propertyName)
{
MethodList methodList = getClass()->methodsNamed(propertyName, this);
- return new (exec) CRuntimeMethod(exec, propertyName, methodList);
+ return new (exec) CRuntimeMethod(exec, exec->lexicalGlobalObject(), propertyName, methodList);
}
JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod, const ArgList& args)
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
index 8959189..2fae747 100644
--- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
@@ -65,7 +65,7 @@ JavaInstance::~JavaInstance()
RuntimeObject* JavaInstance::newRuntimeObject(ExecState* exec)
{
- return new (exec) JavaRuntimeObject(exec, this);
+ return new (exec) JavaRuntimeObject(exec, exec->lexicalGlobalObject(), this);
}
#define NUM_LOCAL_REFS 64
@@ -118,8 +118,8 @@ JSValue JavaInstance::booleanValue() const
class JavaRuntimeMethod : public RuntimeMethod {
public:
- JavaRuntimeMethod(ExecState* exec, const Identifier& name, Bindings::MethodList& list)
- : RuntimeMethod(exec, name, list)
+ JavaRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
+ : RuntimeMethod(exec, globalObject, name, list)
{
}
@@ -133,7 +133,7 @@ const ClassInfo JavaRuntimeMethod::s_info = { "JavaRuntimeMethod", &RuntimeMetho
JSValue JavaInstance::getMethod(ExecState* exec, const Identifier& propertyName)
{
MethodList methodList = getClass()->methodsNamed(propertyName, this);
- return new (exec) JavaRuntimeMethod(exec, propertyName, methodList);
+ return new (exec) JavaRuntimeMethod(exec, exec->lexicalGlobalObject(), propertyName, methodList);
}
JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod, const ArgList &args)
diff --git a/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp b/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp
index dc58b71..6270f9f 100644
--- a/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp
+++ b/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp
@@ -33,8 +33,8 @@ namespace Bindings {
const ClassInfo JavaRuntimeObject::s_info = { "JavaRuntimeObject", &RuntimeObject::s_info, 0, 0 };
-JavaRuntimeObject::JavaRuntimeObject(ExecState* exec, PassRefPtr<JavaInstance> instance)
- : RuntimeObject(exec, instance)
+JavaRuntimeObject::JavaRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<JavaInstance> instance)
+ : RuntimeObject(exec, globalObject, instance)
{
}
diff --git a/WebCore/bridge/jni/jsc/JavaRuntimeObject.h b/WebCore/bridge/jni/jsc/JavaRuntimeObject.h
index d9bf693..0e400f4 100644
--- a/WebCore/bridge/jni/jsc/JavaRuntimeObject.h
+++ b/WebCore/bridge/jni/jsc/JavaRuntimeObject.h
@@ -35,7 +35,7 @@ class JavaInstance;
class JavaRuntimeObject : public RuntimeObject {
public:
- JavaRuntimeObject(ExecState*, PassRefPtr<JavaInstance>);
+ JavaRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<JavaInstance>);
virtual ~JavaRuntimeObject();
JavaInstance* getInternalJavaInstance() const;
diff --git a/WebCore/bridge/jsc/BridgeJSC.cpp b/WebCore/bridge/jsc/BridgeJSC.cpp
index 3d8f62d..d44cdb5 100644
--- a/WebCore/bridge/jsc/BridgeJSC.cpp
+++ b/WebCore/bridge/jsc/BridgeJSC.cpp
@@ -98,7 +98,7 @@ RuntimeObject* Instance::createRuntimeObject(ExecState* exec)
RuntimeObject* Instance::newRuntimeObject(ExecState* exec)
{
JSLock lock(SilenceAssertionsOnly);
- return new (exec)RuntimeObject(exec, this);
+ return new (exec)RuntimeObject(exec, exec->lexicalGlobalObject(), this);
}
void Instance::willDestroyRuntimeObject()
diff --git a/WebCore/bridge/objc/ObjCRuntimeObject.h b/WebCore/bridge/objc/ObjCRuntimeObject.h
index 5c44157..78550b9 100644
--- a/WebCore/bridge/objc/ObjCRuntimeObject.h
+++ b/WebCore/bridge/objc/ObjCRuntimeObject.h
@@ -35,7 +35,7 @@ class ObjcInstance;
class ObjCRuntimeObject : public RuntimeObject {
public:
- ObjCRuntimeObject(ExecState*, PassRefPtr<ObjcInstance>);
+ ObjCRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<ObjcInstance>);
virtual ~ObjCRuntimeObject();
ObjcInstance* getInternalObjCInstance() const;
diff --git a/WebCore/bridge/objc/ObjCRuntimeObject.mm b/WebCore/bridge/objc/ObjCRuntimeObject.mm
index c7c4e98..d9afdf2 100644
--- a/WebCore/bridge/objc/ObjCRuntimeObject.mm
+++ b/WebCore/bridge/objc/ObjCRuntimeObject.mm
@@ -33,8 +33,8 @@ namespace Bindings {
const ClassInfo ObjCRuntimeObject::s_info = { "ObjCRuntimeObject", &RuntimeObject::s_info, 0, 0 };
-ObjCRuntimeObject::ObjCRuntimeObject(ExecState* exec, PassRefPtr<ObjcInstance> instance)
- : RuntimeObject(exec, instance)
+ObjCRuntimeObject::ObjCRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<ObjcInstance> instance)
+ : RuntimeObject(exec, globalObject, instance)
{
}
diff --git a/WebCore/bridge/objc/objc_class.mm b/WebCore/bridge/objc/objc_class.mm
index 5f3677e..62f0a34 100644
--- a/WebCore/bridge/objc/objc_class.mm
+++ b/WebCore/bridge/objc/objc_class.mm
@@ -246,7 +246,7 @@ JSValue ObjcClass::fallbackObject(ExecState* exec, Instance* instance, const Ide
if (![targetObject respondsToSelector:@selector(invokeUndefinedMethodFromWebScript:withArguments:)])
return jsUndefined();
- return new (exec) ObjcFallbackObjectImp(exec, objcInstance, propertyName);
+ return new (exec) ObjcFallbackObjectImp(exec, exec->lexicalGlobalObject(), objcInstance, propertyName);
}
}
diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm
index de330ae..d75a758 100644
--- a/WebCore/bridge/objc/objc_instance.mm
+++ b/WebCore/bridge/objc/objc_instance.mm
@@ -65,7 +65,7 @@ static NSMapTable *createInstanceWrapperCache()
RuntimeObject* ObjcInstance::newRuntimeObject(ExecState* exec)
{
- return new (exec) ObjCRuntimeObject(exec, this);
+ return new (exec) ObjCRuntimeObject(exec, exec->lexicalGlobalObject(), this);
}
void ObjcInstance::setGlobalException(NSString* exception, JSGlobalObject* exceptionEnvironment)
@@ -176,8 +176,8 @@ bool ObjcInstance::supportsInvokeDefaultMethod() const
class ObjCRuntimeMethod : public RuntimeMethod {
public:
- ObjCRuntimeMethod(ExecState* exec, const Identifier& name, Bindings::MethodList& list)
- : RuntimeMethod(exec, name, list)
+ ObjCRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
+ : RuntimeMethod(exec, globalObject, name, list)
{
}
@@ -191,7 +191,7 @@ const ClassInfo ObjCRuntimeMethod::s_info = { "ObjCRuntimeMethod", &RuntimeMetho
JSValue ObjcInstance::getMethod(ExecState* exec, const Identifier& propertyName)
{
MethodList methodList = getClass()->methodsNamed(propertyName, this);
- return new (exec) ObjCRuntimeMethod(exec, propertyName, methodList);
+ return new (exec) ObjCRuntimeMethod(exec, exec->lexicalGlobalObject(), propertyName, methodList);
}
JSValue ObjcInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod, const ArgList &args)
diff --git a/WebCore/bridge/objc/objc_runtime.h b/WebCore/bridge/objc/objc_runtime.h
index 35485ad..60fbdac 100644
--- a/WebCore/bridge/objc/objc_runtime.h
+++ b/WebCore/bridge/objc/objc_runtime.h
@@ -29,6 +29,7 @@
#include "Bridge.h"
#include "objc_header.h"
#include <runtime/JSGlobalObject.h>
+#include <runtime/JSObjectWithGlobalObject.h>
#include <wtf/RetainPtr.h>
namespace JSC {
@@ -89,9 +90,9 @@ private:
RetainPtr<ObjectStructPtr> _array;
};
-class ObjcFallbackObjectImp : public JSObject {
+class ObjcFallbackObjectImp : public JSObjectWithGlobalObject {
public:
- ObjcFallbackObjectImp(ExecState*, ObjcInstance*, const Identifier& propertyName);
+ ObjcFallbackObjectImp(ExecState*, JSGlobalObject*, ObjcInstance*, const Identifier& propertyName);
static const ClassInfo s_info;
diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm
index f845a00..5605333 100644
--- a/WebCore/bridge/objc/objc_runtime.mm
+++ b/WebCore/bridge/objc/objc_runtime.mm
@@ -189,9 +189,9 @@ unsigned int ObjcArray::getLength() const
const ClassInfo ObjcFallbackObjectImp::s_info = { "ObjcFallbackObject", 0, 0, 0 };
-ObjcFallbackObjectImp::ObjcFallbackObjectImp(ExecState* exec, ObjcInstance* i, const Identifier& propertyName)
+ObjcFallbackObjectImp::ObjcFallbackObjectImp(ExecState* exec, JSGlobalObject* globalObject, ObjcInstance* i, const Identifier& propertyName)
// FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
- : JSObject(deprecatedGetDOMStructure<ObjcFallbackObjectImp>(exec))
+ : JSObjectWithGlobalObject(globalObject, deprecatedGetDOMStructure<ObjcFallbackObjectImp>(exec))
, _instance(i)
, _item(propertyName)
{
diff --git a/WebCore/bridge/qt/qt_instance.cpp b/WebCore/bridge/qt/qt_instance.cpp
index 97bb34b..c78bbbf 100644
--- a/WebCore/bridge/qt/qt_instance.cpp
+++ b/WebCore/bridge/qt/qt_instance.cpp
@@ -46,7 +46,7 @@ static QObjectInstanceMap cachedInstances;
// Derived RuntimeObject
class QtRuntimeObject : public RuntimeObject {
public:
- QtRuntimeObject(ExecState*, PassRefPtr<Instance>);
+ QtRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<Instance>);
static const ClassInfo s_info;
@@ -72,8 +72,8 @@ private:
const ClassInfo QtRuntimeObject::s_info = { "QtRuntimeObject", &RuntimeObject::s_info, 0, 0 };
-QtRuntimeObject::QtRuntimeObject(ExecState* exec, PassRefPtr<Instance> instance)
- : RuntimeObject(exec, WebCore::deprecatedGetDOMStructure<QtRuntimeObject>(exec), instance)
+QtRuntimeObject::QtRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<Instance> instance)
+ : RuntimeObject(exec, globalObject, WebCore::deprecatedGetDOMStructure<QtRuntimeObject>(exec), instance)
{
}
@@ -182,7 +182,7 @@ Class* QtInstance::getClass() const
RuntimeObject* QtInstance::newRuntimeObject(ExecState* exec)
{
JSLock lock(SilenceAssertionsOnly);
- return new (exec) QtRuntimeObject(exec, this);
+ return new (exec) QtRuntimeObject(exec, exec->lexicalGlobalObject(), this);
}
void QtInstance::markAggregate(MarkStack& markStack)
@@ -245,7 +245,7 @@ JSValue QtInstance::getMethod(ExecState* exec, const Identifier& propertyName)
if (!getClass())
return jsNull();
MethodList methodList = m_class->methodsNamed(propertyName, this);
- return new (exec) RuntimeMethod(exec, propertyName, methodList);
+ return new (exec) RuntimeMethod(exec, exec->lexicalGlobalObject(), propertyName, methodList);
}
JSValue QtInstance::invokeMethod(ExecState*, RuntimeMethod*, const ArgList&)
diff --git a/WebCore/bridge/qt/qt_pixmapruntime.cpp b/WebCore/bridge/qt/qt_pixmapruntime.cpp
index 803316d..5b6bc83 100644
--- a/WebCore/bridge/qt/qt_pixmapruntime.cpp
+++ b/WebCore/bridge/qt/qt_pixmapruntime.cpp
@@ -145,7 +145,7 @@ struct QtPixmapMetaData {
// Derived RuntimeObject
class QtPixmapRuntimeObject : public RuntimeObject {
public:
- QtPixmapRuntimeObject(ExecState*, PassRefPtr<Instance>);
+ QtPixmapRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<Instance>);
static const ClassInfo s_info;
@@ -161,8 +161,8 @@ private:
virtual const ClassInfo* classInfo() const { return &s_info; }
};
-QtPixmapRuntimeObject::QtPixmapRuntimeObject(ExecState* exec, PassRefPtr<Instance> instance)
- : RuntimeObject(exec, WebCore::deprecatedGetDOMStructure<QtPixmapRuntimeObject>(exec), instance)
+QtPixmapRuntimeObject::QtPixmapRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<Instance> instance)
+ : RuntimeObject(exec, globalObject, WebCore::deprecatedGetDOMStructure<QtPixmapRuntimeObject>(exec), instance)
{
}
@@ -181,7 +181,7 @@ Class* QtPixmapInstance::getClass() const
JSValue QtPixmapInstance::getMethod(ExecState* exec, const Identifier& propertyName)
{
MethodList methodList = getClass()->methodsNamed(propertyName, this);
- return new (exec) RuntimeMethod(exec, propertyName, methodList);
+ return new (exec) RuntimeMethod(exec, exec->lexicalGlobalObject(), propertyName, methodList);
}
JSValue QtPixmapInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod, const ArgList& args)
@@ -349,7 +349,7 @@ returnEmptyVariant:
JSObject* QtPixmapInstance::createRuntimeObject(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& data)
{
JSLock lock(SilenceAssertionsOnly);
- return new(exec) QtPixmapRuntimeObject(exec, new QtPixmapInstance(root, data));
+ return new(exec) QtPixmapRuntimeObject(exec, exec->lexicalGlobalObject(), new QtPixmapInstance(root, data));
}
bool QtPixmapInstance::canHandle(QMetaType::Type hint)
diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp
index 4524d97..7d82f4c 100644
--- a/WebCore/bridge/qt/qt_runtime.cpp
+++ b/WebCore/bridge/qt/qt_runtime.cpp
@@ -825,7 +825,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con
RefPtr<JSC::RegExp> regExp = JSC::RegExp::create(&exec->globalData(), pattern, uflags);
if (regExp->isValid())
- return new (exec) RegExpObject(exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
+ return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
else
return jsNull();
}
@@ -947,7 +947,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con
const ClassInfo QtRuntimeMethod::s_info = { "QtRuntimeMethod", 0, 0, 0 };
QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, const Identifier& ident, PassRefPtr<QtInstance> inst)
- : InternalFunction(&exec->globalData(), deprecatedGetDOMStructure<QtRuntimeMethod>(exec), ident)
+ : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject(), deprecatedGetDOMStructure<QtRuntimeMethod>(exec), ident)
, d_ptr(dd)
{
QW_D(QtRuntimeMethod);
diff --git a/WebCore/bridge/runtime_method.cpp b/WebCore/bridge/runtime_method.cpp
index 29145b6..cd2194a 100644
--- a/WebCore/bridge/runtime_method.cpp
+++ b/WebCore/bridge/runtime_method.cpp
@@ -43,11 +43,11 @@ ASSERT_CLASS_FITS_IN_CELL(RuntimeMethod);
const ClassInfo RuntimeMethod::s_info = { "RuntimeMethod", &InternalFunction::info, 0, 0 };
-RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings::MethodList& m)
+RuntimeMethod::RuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& ident, Bindings::MethodList& m)
// FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
// exec-globalData() is also likely wrong.
// Callers will need to pass in the right global object corresponding to this native object "m".
- : InternalFunction(&exec->globalData(), deprecatedGetDOMStructure<RuntimeMethod>(exec), ident)
+ : InternalFunction(&exec->globalData(), globalObject, deprecatedGetDOMStructure<RuntimeMethod>(exec), ident)
, _methodList(new MethodList(m))
{
}
diff --git a/WebCore/bridge/runtime_method.h b/WebCore/bridge/runtime_method.h
index 9c80ba1..96d12aa 100644
--- a/WebCore/bridge/runtime_method.h
+++ b/WebCore/bridge/runtime_method.h
@@ -35,7 +35,7 @@ namespace JSC {
class RuntimeMethod : public InternalFunction {
public:
- RuntimeMethod(ExecState*, const Identifier& name, Bindings::MethodList&);
+ RuntimeMethod(ExecState*, JSGlobalObject*, const Identifier& name, Bindings::MethodList&);
Bindings::MethodList* methods() const { return _methodList.get(); }
static const ClassInfo s_info;
diff --git a/WebCore/bridge/runtime_object.cpp b/WebCore/bridge/runtime_object.cpp
index 83aae74..0863452 100644
--- a/WebCore/bridge/runtime_object.cpp
+++ b/WebCore/bridge/runtime_object.cpp
@@ -38,16 +38,16 @@ namespace Bindings {
const ClassInfo RuntimeObject::s_info = { "RuntimeObject", 0, 0, 0 };
-RuntimeObject::RuntimeObject(ExecState* exec, PassRefPtr<Instance> instance)
+RuntimeObject::RuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<Instance> instance)
// FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
// We need to pass in the right global object for "i".
- : JSObject(deprecatedGetDOMStructure<RuntimeObject>(exec))
+ : JSObjectWithGlobalObject(globalObject, deprecatedGetDOMStructure<RuntimeObject>(exec))
, m_instance(instance)
{
}
-RuntimeObject::RuntimeObject(ExecState*, NonNullPassRefPtr<Structure> structure, PassRefPtr<Instance> instance)
- : JSObject(structure)
+RuntimeObject::RuntimeObject(ExecState*, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, PassRefPtr<Instance> instance)
+ : JSObjectWithGlobalObject(globalObject, structure)
, m_instance(instance)
{
}
diff --git a/WebCore/bridge/runtime_object.h b/WebCore/bridge/runtime_object.h
index b735e36..64c8049 100644
--- a/WebCore/bridge/runtime_object.h
+++ b/WebCore/bridge/runtime_object.h
@@ -28,13 +28,14 @@
#include "Bridge.h"
#include <runtime/JSGlobalObject.h>
+#include <runtime/JSObjectWithGlobalObject.h>
namespace JSC {
namespace Bindings {
-class RuntimeObject : public JSObject {
+class RuntimeObject : public JSObjectWithGlobalObject {
public:
- RuntimeObject(ExecState*, PassRefPtr<Instance>);
+ RuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<Instance>);
virtual ~RuntimeObject();
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
@@ -67,7 +68,7 @@ public:
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
- RuntimeObject(ExecState*, NonNullPassRefPtr<Structure>, PassRefPtr<Instance>);
+ RuntimeObject(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, PassRefPtr<Instance>);
private:
virtual const ClassInfo* classInfo() const { return &s_info; }
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index 86756b7..35fbb7d 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -186,6 +186,7 @@ static const int computedProperties[] = {
CSSPropertyWebkitColumnRuleColor,
CSSPropertyWebkitColumnRuleStyle,
CSSPropertyWebkitColumnRuleWidth,
+ CSSPropertyWebkitColumnSpan,
CSSPropertyWebkitColumnWidth,
#if ENABLE(DASHBOARD_SUPPORT)
CSSPropertyWebkitDashboardRegion,
@@ -382,8 +383,9 @@ static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int prope
return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
}
-static PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle* style, const Color& color)
+PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(RenderStyle* style, const Color& color) const
{
+ // This function does NOT look at visited information, so that computed style doesn't expose that.
if (!color.isValid())
return CSSPrimitiveValue::createColor(style->color().rgb());
return CSSPrimitiveValue::createColor(color.rgb());
@@ -825,6 +827,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->columnRuleStyle());
case CSSPropertyWebkitColumnRuleWidth:
return CSSPrimitiveValue::create(style->columnRuleWidth(), CSSPrimitiveValue::CSS_PX);
+ case CSSPropertyWebkitColumnSpan:
+ if (style->columnSpan())
+ return CSSPrimitiveValue::createIdentifier(CSSValueAll);
+ return CSSPrimitiveValue::create(1, CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitColumnBreakAfter:
return CSSPrimitiveValue::create(style->columnBreakAfter());
case CSSPropertyWebkitColumnBreakBefore:
diff --git a/WebCore/css/CSSComputedStyleDeclaration.h b/WebCore/css/CSSComputedStyleDeclaration.h
index ba55d77..a2e8ba7 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.h
+++ b/WebCore/css/CSSComputedStyleDeclaration.h
@@ -27,7 +27,9 @@
namespace WebCore {
+class Color;
class CSSMutableStyleDeclaration;
+class CSSPrimitiveValue;
class ShadowData;
enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
@@ -69,7 +71,8 @@ private:
virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&);
PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int) const;
-
+ PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
+
RefPtr<Node> m_node;
PseudoId m_pseudoElementSpecifier;
bool m_allowVisitedStyle;
diff --git a/WebCore/css/CSSCursorImageValue.cpp b/WebCore/css/CSSCursorImageValue.cpp
index fe10cf3..239048d 100644
--- a/WebCore/css/CSSCursorImageValue.cpp
+++ b/WebCore/css/CSSCursorImageValue.cpp
@@ -17,7 +17,7 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
#include "config.h"
#include "CSSCursorImageValue.h"
diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y
index 7798264..37c5385 100644
--- a/WebCore/css/CSSGrammar.y
+++ b/WebCore/css/CSSGrammar.y
@@ -257,6 +257,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%type <selector> class
%type <selector> attrib
%type <selector> pseudo
+%type <selector> pseudo_page
%type <selector> page_selector
%type <boolean> declaration_list
@@ -755,7 +756,14 @@ page:
PAGE_SYM maybe_space page_selector maybe_space
'{' maybe_space declarations_and_margins closing_brace {
CSSParser* p = static_cast<CSSParser*>(parser);
- $$ = p->createPageRule(p->sinkFloatingSelector($3));
+ if ($3)
+ $$ = p->createPageRule(p->sinkFloatingSelector($3));
+ else {
+ // Clear properties in the invalid @page rule.
+ p->clearProperties();
+ // Also clear margin at-rules here once we fully implement margin at-rules parsing.
+ $$ = 0;
+ }
}
| PAGE_SYM error invalid_block {
$$ = 0;
@@ -771,13 +779,13 @@ page_selector:
$$ = p->createFloatingSelector();
$$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace);
}
- | IDENT pseudo {
+ | IDENT pseudo_page {
CSSParser* p = static_cast<CSSParser*>(parser);
$$ = $2;
if ($$)
$$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace);
}
- | pseudo {
+ | pseudo_page {
$$ = $1;
}
| /* empty */ {
@@ -1167,6 +1175,17 @@ ident_or_string:
| STRING
;
+pseudo_page:
+ ':' IDENT {
+ $$ = static_cast<CSSParser*>(parser)->createFloatingSelector();
+ $$->m_match = CSSSelector::PagePseudoClass;
+ $2.lower();
+ $$->m_value = $2;
+ CSSSelector::PseudoType type = $$->pseudoType();
+ if (type == CSSSelector::PseudoUnknown)
+ $$ = 0;
+ }
+
pseudo:
':' IDENT {
$$ = static_cast<CSSParser*>(parser)->createFloatingSelector();
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 5f64925..ac8d94d 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -172,7 +172,7 @@ CSSParser::~CSSParser()
fastFree(m_parsedProperties);
clearVariables();
-
+
delete m_valueList;
fastFree(m_data);
@@ -214,7 +214,7 @@ void CSSParser::setupParser(const char* prefix, const String& string, const char
m_data = static_cast<UChar*>(fastMalloc(length * sizeof(UChar)));
for (unsigned i = 0; i < strlen(prefix); i++)
m_data[i] = prefix[i];
-
+
memcpy(m_data + strlen(prefix), string.characters(), string.length() * sizeof(UChar));
unsigned start = strlen(prefix) + string.length();
@@ -238,7 +238,7 @@ void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string)
#endif
m_styleSheet = sheet;
m_defaultNamespace = starAtom; // Reset the default namespace.
-
+
setupParser("", string, "");
cssyyparse(this);
m_rule = 0;
@@ -288,9 +288,9 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int id, cons
m_id = id;
m_important = important;
-
+
cssyyparse(this);
-
+
m_rule = 0;
bool ok = false;
@@ -351,10 +351,14 @@ bool CSSParser::parseColor(CSSMutableStyleDeclaration* declaration, const String
}
void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorList& selectorList)
+<<<<<<< HEAD
{
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
#endif
+=======
+{
+>>>>>>> webkit.org at r60074
RefPtr<CSSStyleSheet> dummyStyleSheet = CSSStyleSheet::create(doc);
m_styleSheet = dummyStyleSheet.get();
@@ -556,7 +560,7 @@ static int unitFromString(CSSParserValue* value)
return CSSPrimitiveValue::CSS_HZ;
if (equal(value->string, "kHz"))
return CSSPrimitiveValue::CSS_KHZ;
-
+
return 0;
}
@@ -564,7 +568,7 @@ void CSSParser::checkForOrphanedUnits()
{
if (m_strict || inShorthand())
return;
-
+
// The purpose of this code is to implement the WinIE quirk that allows unit types to be separated from their numeric values
// by whitespace, so e.g., width: 20 px instead of width:20px. This is invalid CSS, so we don't do this in strict mode.
CSSParserValue* numericVal = 0;
@@ -586,7 +590,7 @@ void CSSParser::checkForOrphanedUnits()
continue;
}
}
-
+
numericVal = (value->unit == CSSPrimitiveValue::CSS_NUMBER) ? value : 0;
}
}
@@ -606,7 +610,7 @@ bool CSSParser::parseValue(int propId, bool important)
// In quirks mode, we will look for units that have been incorrectly separated from the number they belong to
// by a space. We go ahead and associate the unit with the number even though it is invalid CSS.
checkForOrphanedUnits();
-
+
int num = inShorthand() ? 1 : m_valueList->size();
if (id == CSSValueInherit) {
@@ -799,8 +803,8 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyOutlineStyle: // (<border-style> except hidden) | auto | inherit
if (id == CSSValueAuto || id == CSSValueNone || (id >= CSSValueInset && id <= CSSValueDouble))
validPrimitive = true;
- break;
-
+ break;
+
case CSSPropertyBorderTopStyle: //// <border-style> | inherit
case CSSPropertyBorderRightStyle: // Defined as: none | hidden | dotted | dashed |
case CSSPropertyBorderBottomStyle: // solid | double | groove | ridge | inset | outset
@@ -873,14 +877,14 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyCursor: {
// [<uri>,]* [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize |
- // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize |
+ // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize |
// ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | text | wait | help |
// vertical-text | cell | context-menu | alias | copy | no-drop | not-allowed | -webkit-zoom-in
// -webkit-zoom-in | -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit
RefPtr<CSSValueList> list;
while (value && value->unit == CSSPrimitiveValue::CSS_URI) {
if (!list)
- list = CSSValueList::createCommaSeparated();
+ list = CSSValueList::createCommaSeparated();
String uri = value->string;
Vector<int> coords;
value = m_valueList->next();
@@ -894,7 +898,7 @@ bool CSSParser::parseValue(int propId, bool important)
return false;
if (nrcoords == 2)
hotspot = IntPoint(coords[0], coords[1]);
-
+
if (!uri.isNull() && m_styleSheet) {
// FIXME: The completeURL call should be done when using the CSSCursorImageValue,
// not when creating it.
@@ -1165,7 +1169,7 @@ bool CSSParser::parseValue(int propId, bool important)
else
validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonNeg, true));
break;
-
+
case CSSPropertyTableLayout: // auto | fixed | inherit
if (id == CSSValueAuto || id == CSSValueFixed)
validPrimitive = true;
@@ -1199,7 +1203,7 @@ bool CSSParser::parseValue(int propId, bool important)
}
if (!parsedValue)
break;
-
+
// FIXME: We can't use release() here since we might hit this path twice
// but that logic seems wrong to me to begin with, we convert all non-uri values
// into the last seen URI value!?
@@ -1210,7 +1214,7 @@ bool CSSParser::parseValue(int propId, bool important)
}
if (!values->length())
return false;
-
+
addProperty(propId, values.release(), important);
m_valueList->next();
return true;
@@ -1538,6 +1542,12 @@ bool CSSParser::parseValue(int propId, bool important)
else
validPrimitive = validUnit(value, FLength | FNonNeg, m_strict);
break;
+ case CSSPropertyWebkitColumnSpan: // all | 1
+ if (id == CSSValueAll)
+ validPrimitive = true;
+ else
+ validPrimitive = validUnit(value, FNumber | FNonNeg, m_strict) && value->fValue == 1;
+ break;
case CSSPropertyWebkitColumnWidth: // auto | <length>
if (id == CSSValueAuto)
validPrimitive = true;
@@ -1551,7 +1561,7 @@ bool CSSParser::parseValue(int propId, bool important)
(id >= CSSValueVisiblepainted && id <= CSSValueStroke))
validPrimitive = true;
break;
-
+
// End of CSS3 properties
// Apple specific properties. These will never be standardized and are purely to
@@ -1569,7 +1579,7 @@ bool CSSParser::parseValue(int propId, bool important)
if (id == CSSValueLogical || id == CSSValueVisual)
validPrimitive = true;
break;
-
+
case CSSPropertyWebkitFontSizeDelta: // <length>
validPrimitive = validUnit(value, FLength, m_strict);
break;
@@ -1593,12 +1603,12 @@ bool CSSParser::parseValue(int propId, bool important)
if (id == CSSValueNone || value->unit == CSSPrimitiveValue::CSS_STRING)
validPrimitive = true;
break;
-
+
case CSSPropertyWebkitBorderFit:
if (id == CSSValueBorder || id == CSSValueLines)
validPrimitive = true;
break;
-
+
case CSSPropertyWebkitTextSecurity:
// disc | circle | square | none | inherit
if (id == CSSValueDisc || id == CSSValueCircle || id == CSSValueSquare|| id == CSSValueNone)
@@ -1606,13 +1616,13 @@ bool CSSParser::parseValue(int propId, bool important)
break;
case CSSPropertyWebkitFontSmoothing:
- if (id == CSSValueAuto || id == CSSValueNone
+ if (id == CSSValueAuto || id == CSSValueNone
|| id == CSSValueAntialiased || id == CSSValueSubpixelAntialiased)
validPrimitive = true;
break;
#if ENABLE(DASHBOARD_SUPPORT)
- case CSSPropertyWebkitDashboardRegion: // <dashboard-region> | <dashboard-region>
+ case CSSPropertyWebkitDashboardRegion: // <dashboard-region> | <dashboard-region>
if (value->unit == CSSParserValue::Function || id == CSSValueNone)
return parseDashboardRegions(propId, important);
break;
@@ -1624,13 +1634,13 @@ bool CSSParser::parseValue(int propId, bool important)
// Position must come before color in this array because a plain old "0" is a legal color
// in quirks mode but it's usually the X coordinate of a position.
// FIXME: Add CSSPropertyBackgroundSize to the shorthand.
- const int properties[] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat,
- CSSPropertyBackgroundAttachment, CSSPropertyBackgroundPosition, CSSPropertyBackgroundOrigin,
+ const int properties[] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat,
+ CSSPropertyBackgroundAttachment, CSSPropertyBackgroundPosition, CSSPropertyBackgroundOrigin,
CSSPropertyBackgroundColor };
return parseFillShorthand(propId, properties, 6, important);
}
case CSSPropertyWebkitMask: {
- const int properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
+ const int properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPosition,
CSSPropertyWebkitMaskOrigin };
return parseFillShorthand(propId, properties, 5, important);
@@ -1812,8 +1822,8 @@ PassRefPtr<CSSValue> CSSParser::parseWCSSInputProperty()
parsedValue = CSSPrimitiveValue::create(inputProperty, CSSPrimitiveValue::CSS_STRING);
while (m_valueList->next()) {
- // pass all other values, if any. If we don't do this,
- // the parser will think that it's not done and won't process this property
+ // pass all other values, if any. If we don't do this,
+ // the parser will think that it's not done and won't process this property
}
return parsedValue;
@@ -1890,7 +1900,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro
if (!m_valueList->current())
break;
}
-
+
bool found = false;
for (i = 0; !found && i < numProperties; ++i) {
if (!parsedProperty[i]) {
@@ -1921,7 +1931,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro
if (!found)
return false;
}
-
+
// Fill in any remaining properties with the initial value.
for (i = 0; i < numProperties; ++i) {
if (!parsedProperty[i]) {
@@ -1936,7 +1946,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro
}
}
}
-
+
// Now add all of the properties we found.
for (i = 0; i < numProperties; i++) {
if (properties[i] == CSSPropertyBackgroundPosition) {
@@ -1957,7 +1967,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro
addProperty(CSSPropertyWebkitMaskRepeatY, repeatYValue.release(), important);
} else
addProperty(properties[i], values[i].release(), important);
-
+
// Add in clip values when we hit the corresponding origin property.
if (properties[i] == CSSPropertyBackgroundOrigin)
addProperty(CSSPropertyBackgroundClip, clipValue.release(), important);
@@ -1995,12 +2005,12 @@ bool CSSParser::parseAnimationShorthand(bool important)
CSSPropertyWebkitAnimationDirection,
CSSPropertyWebkitAnimationFillMode };
const int numProperties = sizeof(properties) / sizeof(properties[0]);
-
+
ShorthandScope scope(this, CSSPropertyWebkitAnimation);
bool parsedProperty[numProperties] = { false }; // compiler will repeat false as necessary
RefPtr<CSSValue> values[numProperties];
-
+
int i;
while (m_valueList->current()) {
CSSParserValue* val = m_valueList->current();
@@ -2015,7 +2025,7 @@ bool CSSParser::parseAnimationShorthand(bool important)
if (!m_valueList->current())
break;
}
-
+
bool found = false;
for (i = 0; !found && i < numProperties; ++i) {
if (!parsedProperty[i]) {
@@ -2032,17 +2042,17 @@ bool CSSParser::parseAnimationShorthand(bool important)
if (!found)
return false;
}
-
+
// Fill in any remaining properties with the initial value.
for (i = 0; i < numProperties; ++i) {
if (!parsedProperty[i])
addAnimationValue(values[i], CSSInitialValue::createImplicit());
}
-
+
// Now add all of the properties we found.
for (i = 0; i < numProperties; i++)
addProperty(properties[i], values[i].release(), important);
-
+
return true;
}
@@ -2053,12 +2063,12 @@ bool CSSParser::parseTransitionShorthand(bool important)
CSSPropertyWebkitTransitionTimingFunction,
CSSPropertyWebkitTransitionDelay };
const int numProperties = sizeof(properties) / sizeof(properties[0]);
-
+
ShorthandScope scope(this, CSSPropertyWebkitTransition);
bool parsedProperty[numProperties] = { false }; // compiler will repeat false as necessary
RefPtr<CSSValue> values[numProperties];
-
+
int i;
while (m_valueList->current()) {
CSSParserValue* val = m_valueList->current();
@@ -2073,7 +2083,7 @@ bool CSSParser::parseTransitionShorthand(bool important)
if (!m_valueList->current())
break;
}
-
+
bool found = false;
for (i = 0; !found && i < numProperties; ++i) {
if (!parsedProperty[i]) {
@@ -2090,17 +2100,17 @@ bool CSSParser::parseTransitionShorthand(bool important)
if (!found)
return false;
}
-
+
// Fill in any remaining properties with the initial value.
for (i = 0; i < numProperties; ++i) {
if (!parsedProperty[i])
addAnimationValue(values[i], CSSInitialValue::createImplicit());
}
-
+
// Now add all of the properties we found.
for (i = 0; i < numProperties; i++)
addProperty(properties[i], values[i].release(), important);
-
+
return true;
}
@@ -2130,7 +2140,7 @@ bool CSSParser::parseShorthand(int propId, const int *properties, int numPropert
if (!found)
return false;
}
-
+
// Fill in any remaining properties with the initial value.
m_implicitShorthand = true;
for (int i = 0; i < numProperties; ++i) {
@@ -2151,9 +2161,9 @@ bool CSSParser::parse4Values(int propId, const int *properties, bool important)
* second, and the bottom is set to the third. If there are four values, they apply to the top,
* right, bottom, and left, respectively.
*/
-
+
int num = inShorthand() ? 1 : m_valueList->size();
-
+
ShorthandScope scope(this, propId);
// the order is top, right, bottom, left
@@ -2199,7 +2209,7 @@ bool CSSParser::parse4Values(int propId, const int *properties, bool important)
return false;
}
}
-
+
return true;
}
@@ -2380,7 +2390,7 @@ PassRefPtr<CSSValue> CSSParser::parseAttr(CSSParserValueList* args)
if (document() && document()->isHTMLDocument())
attrName = attrName.lower();
-
+
return CSSPrimitiveValue::create(attrName, CSSPrimitiveValue::CSS_ATTR);
}
@@ -2444,29 +2454,29 @@ PassRefPtr<CSSValue> CSSParser::parseFillPositionXY(bool& xFound, bool& yFound)
if (validUnit(m_valueList->current(), FPercent | FLength, m_strict))
return CSSPrimitiveValue::create(m_valueList->current()->fValue,
(CSSPrimitiveValue::UnitTypes)m_valueList->current()->unit);
-
+
return 0;
}
void CSSParser::parseFillPosition(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2)
{
CSSParserValue* value = m_valueList->current();
-
+
// Parse the first value. We're just making sure that it is one of the valid keywords or a percentage/length.
bool value1IsX = false, value1IsY = false;
value1 = parseFillPositionXY(value1IsX, value1IsY);
if (!value1)
return;
-
+
// It only takes one value for background-position to be correctly parsed if it was specified in a shorthand (since we
// can assume that any other values belong to the rest of the shorthand). If we're not parsing a shorthand, though, the
// value was explicitly specified for our property.
value = m_valueList->next();
-
+
// First check for the comma. If so, we are finished parsing this value or value pair.
if (value && value->unit == CSSParserValue::Operator && value->iValue == ',')
value = 0;
-
+
bool value2IsX = false, value2IsY = false;
if (value) {
value2 = parseFillPositionXY(value2IsX, value2IsY);
@@ -2479,7 +2489,7 @@ void CSSParser::parseFillPosition(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& va
}
}
}
-
+
if (!value2)
// Only one value was specified. If that value was not a keyword, then it sets the x position, and the y position
// is simply 50%. This is our default.
@@ -2502,13 +2512,13 @@ void CSSParser::parseFillRepeat(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& valu
value2 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat);
m_valueList->next();
return;
- }
+ }
if (id == CSSValueRepeatY) {
m_implicitShorthand = true;
value1 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat);
value2 = CSSPrimitiveValue::createIdentifier(CSSValueRepeat);
m_valueList->next();
- return;
+ return;
}
if (id == CSSValueRepeat || id == CSSValueNoRepeat || id == CSSValueRound || id == CSSValueSpace)
value1 = CSSPrimitiveValue::createIdentifier(id);
@@ -2525,11 +2535,11 @@ void CSSParser::parseFillRepeat(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& valu
if (value)
id = m_valueList->current()->id;
-
+
if (value && (id == CSSValueRepeat || id == CSSValueNoRepeat || id == CSSValueRound || id == CSSValueSpace)) {
value2 = CSSPrimitiveValue::createIdentifier(id);
m_valueList->next();
- } else {
+ } else {
// If only one value was specified, value2 is the same as value1.
m_implicitShorthand = true;
value2 = CSSPrimitiveValue::createIdentifier(static_cast<CSSPrimitiveValue*>(value1.get())->getIdent());
@@ -2577,7 +2587,7 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
return CSSPrimitiveValue::create(Pair::create(parsedValue1.release(), parsedValue2.release()));
}
-bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
+bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
RefPtr<CSSValue>& retValue1, RefPtr<CSSValue>& retValue2)
{
RefPtr<CSSValueList> values;
@@ -2585,9 +2595,9 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
CSSParserValue* val;
RefPtr<CSSValue> value;
RefPtr<CSSValue> value2;
-
+
bool allowComma = false;
-
+
retValue1 = retValue2 = 0;
propId1 = propId;
propId2 = propId;
@@ -2608,7 +2618,7 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
while ((val = m_valueList->current())) {
RefPtr<CSSValue> currValue;
RefPtr<CSSValue> currValue2;
-
+
if (allowComma) {
if (val->unit != CSSParserValue::Operator || val->iValue != ',')
return false;
@@ -2702,17 +2712,17 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
}
if (!currValue)
return false;
-
+
if (value && !values) {
values = CSSValueList::createCommaSeparated();
values->append(value.release());
}
-
+
if (value2 && !values2) {
values2 = CSSValueList::createCommaSeparated();
values2->append(value2.release());
}
-
+
if (values)
values->append(currValue.release());
else
@@ -2724,7 +2734,7 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
value2 = currValue2.release();
}
}
-
+
// When parsing any fill shorthand property, we let it handle building up the lists for all
// properties.
if (inShorthand())
@@ -2858,11 +2868,11 @@ PassRefPtr<CSSValue> CSSParser::parseAnimationTimingFunction()
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueEase || value->id == CSSValueLinear || value->id == CSSValueEaseIn || value->id == CSSValueEaseOut || value->id == CSSValueEaseInOut)
return CSSPrimitiveValue::createIdentifier(value->id);
-
+
// We must be a function.
if (value->unit != CSSParserValue::Function)
return 0;
-
+
// The only timing function we accept for now is a cubic bezier function. 4 points must be specified.
CSSParserValueList* args = value->function->args;
if (!equalIgnoringCase(value->function->name, "cubic-bezier(") || !args || args->size() != 7)
@@ -2889,7 +2899,7 @@ bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
CSSParserValue* val;
RefPtr<CSSValue> value;
bool allowComma = false;
-
+
result = 0;
while ((val = m_valueList->current())) {
@@ -2951,29 +2961,29 @@ bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
m_valueList->next();
break;
}
-
+
if (!currValue)
return false;
-
+
if (value && !values) {
values = CSSValueList::createCommaSeparated();
values->append(value.release());
}
-
+
if (values)
values->append(currValue.release());
else
value = currValue.release();
-
+
allowComma = true;
}
-
+
// When parsing the 'transition' shorthand property, we let it handle building up the lists for all
// properties.
if (inShorthand())
break;
}
-
+
if (values && values->length()) {
result = values.release();
return true;
@@ -3006,7 +3016,7 @@ static CSSParserValue* skipCommaInDashboardRegion(CSSParserValueList *args)
bool CSSParser::parseDashboardRegions(int propId, bool important)
{
bool valid = true;
-
+
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueNone) {
@@ -3015,7 +3025,7 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
addProperty(propId, CSSPrimitiveValue::createIdentifier(value->id), important);
return valid;
}
-
+
RefPtr<DashboardRegion> firstRegion = DashboardRegion::create();
DashboardRegion* region = 0;
@@ -3027,12 +3037,12 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
region->m_next = nextRegion;
region = nextRegion.get();
}
-
+
if (value->unit != CSSParserValue::Function) {
valid = false;
break;
}
-
+
// Commas count as values, so allow:
// dashboard-region(label, type, t, r, b, l) or dashboard-region(label type t r b l)
// dashboard-region(label, type, t, r, b, l) or dashboard-region(label type t r b l)
@@ -3044,21 +3054,21 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
valid = false;
break;
}
-
+
int numArgs = args->size();
if ((numArgs != DASHBOARD_REGION_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_NUM_PARAMETERS*2-1)) &&
(numArgs != DASHBOARD_REGION_SHORT_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1))) {
valid = false;
break;
}
-
+
// First arg is a label.
CSSParserValue* arg = args->current();
if (arg->unit != CSSPrimitiveValue::CSS_IDENT) {
valid = false;
break;
}
-
+
region->m_label = arg->string;
// Second arg is a type.
@@ -3077,13 +3087,13 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
valid = false;
break;
}
-
+
region->m_geometryType = arg->string;
if (numArgs == DASHBOARD_REGION_SHORT_NUM_PARAMETERS || numArgs == (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1)) {
// This originally used CSSValueInvalid by accident. It might be more logical to use something else.
RefPtr<CSSPrimitiveValue> amount = CSSPrimitiveValue::createIdentifier(CSSValueInvalid);
-
+
region->setTop(amount);
region->setRight(amount);
region->setBottom(amount);
@@ -3098,11 +3108,11 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
valid = arg->id == CSSValueAuto || validUnit(arg, FLength, m_strict);
if (!valid)
break;
-
+
RefPtr<CSSPrimitiveValue> amount = arg->id == CSSValueAuto ?
CSSPrimitiveValue::createIdentifier(CSSValueAuto) :
CSSPrimitiveValue::create(arg->fValue, (CSSPrimitiveValue::UnitTypes) arg->unit);
-
+
if (i == 0)
region->setTop(amount);
else if (i == 1)
@@ -3122,7 +3132,7 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
if (valid)
addProperty(propId, CSSPrimitiveValue::create(firstRegion.release()), important);
-
+
return valid;
}
@@ -3135,7 +3145,7 @@ PassRefPtr<CSSValue> CSSParser::parseCounterContent(CSSParserValueList* args, bo
return 0;
if (!counters && numArgs != 1 && numArgs != 3)
return 0;
-
+
CSSParserValue* i = args->current();
if (i->unit != CSSPrimitiveValue::CSS_IDENT)
return 0;
@@ -3148,11 +3158,11 @@ PassRefPtr<CSSValue> CSSParser::parseCounterContent(CSSParserValueList* args, bo
i = args->next();
if (i->unit != CSSParserValue::Operator || i->iValue != ',')
return 0;
-
+
i = args->next();
if (i->unit != CSSPrimitiveValue::CSS_STRING)
return 0;
-
+
separator = CSSPrimitiveValue::create(i->string, (CSSPrimitiveValue::UnitTypes) i->unit);
}
@@ -3163,11 +3173,11 @@ PassRefPtr<CSSValue> CSSParser::parseCounterContent(CSSParserValueList* args, bo
else {
if (i->unit != CSSParserValue::Operator || i->iValue != ',')
return 0;
-
+
i = args->next();
if (i->unit != CSSPrimitiveValue::CSS_IDENT)
return 0;
-
+
short ls = 0;
if (i->id == CSSValueNone)
ls = CSSValueKatakanaIroha - CSSValueDisc + 1;
@@ -3186,7 +3196,7 @@ bool CSSParser::parseShape(int propId, bool important)
{
CSSParserValue* value = m_valueList->current();
CSSParserValueList* args = value->function->args;
-
+
if (!equalIgnoringCase(value->function->name, "rect(") || !args)
return false;
@@ -3327,7 +3337,7 @@ bool CSSParser::parseFont(bool important)
if (!value)
return false;
}
-
+
if (!font->lineHeight)
font->lineHeight = CSSPrimitiveValue::createIdentifier(CSSValueNormal);
@@ -3382,7 +3392,7 @@ PassRefPtr<CSSValueList> CSSParser::parseFontFamily()
} else {
break;
}
-
+
if (!nextValue)
break;
@@ -3571,7 +3581,7 @@ bool CSSParser::parseFontFaceSrc()
allowFormat = true;
expectComma = true;
} else if (val->unit == CSSParserValue::Function) {
- // There are two allowed functions: local() and format().
+ // There are two allowed functions: local() and format().
CSSParserValueList* args = val->function->args;
if (args && args->size() == 1) {
if (equalIgnoringCase(val->function->name, "local(") && !expectComma) {
@@ -3596,7 +3606,7 @@ bool CSSParser::parseFontFaceSrc()
m_valueList->next();
continue;
}
-
+
if (parsedValue)
values->append(parsedValue.release());
else {
@@ -3605,7 +3615,7 @@ bool CSSParser::parseFontFaceSrc()
}
m_valueList->next();
}
-
+
if (values->length() && !failed) {
addProperty(CSSPropertySrc, values.release(), m_important);
m_valueList->next();
@@ -3712,7 +3722,7 @@ static inline bool parseInt(const UChar*& string, const UChar* end, UChar termin
const UChar* current = string;
int localValue = 0;
bool negative = false;
- while (current != end && isCSSWhitespace(*current))
+ while (current != end && isCSSWhitespace(*current))
current++;
if (current != end && *current == '-') {
negative = true;
@@ -3754,7 +3764,7 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict)
return false;
rgb = makeRGB(red, green, blue);
return true;
- }
+ }
// Try named colors.
Color tc;
tc.setNamedColor(name);
@@ -4031,7 +4041,7 @@ bool CSSParser::parseShadow(int propId, bool important)
// -webkit-svg-shadow does not support multiple values.
if (static_cast<CSSPropertyID>(propId) == CSSPropertyWebkitSvgShadow)
return false;
-#endif
+#endif
// The value is good. Commit it.
context.commitValue();
} else if (validUnit(val, FLength, true)) {
@@ -4064,7 +4074,7 @@ bool CSSParser::parseShadow(int propId, bool important)
if (!parsedColor || !context.allowColor)
return false; // This value is not a color or length and is invalid or
// it is a color, but a color isn't allowed at this point.
-
+
context.commitColor(parsedColor.release());
}
@@ -4086,7 +4096,7 @@ bool CSSParser::parseShadow(int propId, bool important)
bool CSSParser::parseReflect(int propId, bool important)
{
// box-reflect: <direction> <offset> <mask>
-
+
// Direction comes first.
CSSParserValue* val = m_valueList->current();
CSSReflectionDirection direction;
@@ -4146,7 +4156,7 @@ struct BorderImageParseContext {
, m_horizontalRule(0)
, m_verticalRule(0)
{}
-
+
bool allowBreak() const { return m_allowBreak; }
bool allowNumber() const { return m_allowNumber; }
bool allowSlash() const { return m_allowSlash; }
@@ -4167,7 +4177,7 @@ struct BorderImageParseContext {
ASSERT(!m_left);
m_left = val;
}
-
+
m_allowBreak = m_allowSlash = m_allowRule = true;
m_allowNumber = !m_left;
}
@@ -4210,7 +4220,7 @@ struct BorderImageParseContext {
}
if (!m_left)
m_left = CSSPrimitiveValue::create(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType());
-
+
// Now build a rect value to hold all four of our primitive values.
RefPtr<Rect> rect = Rect::create();
rect->setTop(m_top);
@@ -4221,7 +4231,7 @@ struct BorderImageParseContext {
// Fill in STRETCH as the default if it wasn't specified.
if (!m_horizontalRule)
m_horizontalRule = CSSValueStretch;
-
+
// The vertical rule should match the horizontal rule if unspecified.
if (!m_verticalRule)
m_verticalRule = m_horizontalRule;
@@ -4246,25 +4256,25 @@ struct BorderImageParseContext {
// Make our new border image value now.
return CSSBorderImageValue::create(m_image, rect.release(), m_horizontalRule, m_verticalRule);
}
-
+
bool m_allowBreak;
bool m_allowNumber;
bool m_allowSlash;
bool m_allowWidth;
bool m_allowRule;
-
+
RefPtr<CSSValue> m_image;
RefPtr<CSSPrimitiveValue> m_top;
RefPtr<CSSPrimitiveValue> m_right;
RefPtr<CSSPrimitiveValue> m_bottom;
RefPtr<CSSPrimitiveValue> m_left;
-
+
CSSParserValue* m_borderTop;
CSSParserValue* m_borderRight;
CSSParserValue* m_borderBottom;
CSSParserValue* m_borderLeft;
-
+
int m_horizontalRule;
int m_verticalRule;
};
@@ -4304,7 +4314,7 @@ bool CSSParser::parseBorderImage(int propId, bool important, RefPtr<CSSValue>& r
return false;
}
}
-
+
if (context.allowNumber() && propId != CSSPropertyWebkitBorderImage) {
// Allow the slices to be omitted for images that don't fit to a border. We just set the slices to be 0.
context.m_top = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_NUMBER);
@@ -4316,7 +4326,7 @@ bool CSSParser::parseBorderImage(int propId, bool important, RefPtr<CSSValue>& r
result = context.commitBorderImage(this, important);
return true;
}
-
+
return false;
}
@@ -4395,7 +4405,7 @@ bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
RefPtr<CSSPrimitiveValue> counterName;
-
+
while (true) {
CSSParserValue* val = m_valueList->current();
switch (state) {
@@ -4422,7 +4432,7 @@ bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
}
break;
}
-
+
if (list->length() > 0) {
addProperty(propId, list.release(), important);
return true;
@@ -4435,11 +4445,11 @@ static PassRefPtr<CSSPrimitiveValue> parseGradientPoint(CSSParserValue* a, bool
{
RefPtr<CSSPrimitiveValue> result;
if (a->unit == CSSPrimitiveValue::CSS_IDENT) {
- if ((equalIgnoringCase(a->string, "left") && horizontal) ||
- (equalIgnoringCase(a->string, "top") && !horizontal))
+ if ((equalIgnoringCase(a->string, "left") && horizontal)
+ || (equalIgnoringCase(a->string, "top") && !horizontal))
result = CSSPrimitiveValue::create(0., CSSPrimitiveValue::CSS_PERCENTAGE);
- else if ((equalIgnoringCase(a->string, "right") && horizontal) ||
- (equalIgnoringCase(a->string, "bottom") && !horizontal))
+ else if ((equalIgnoringCase(a->string, "right") && horizontal)
+ || (equalIgnoringCase(a->string, "bottom") && !horizontal))
result = CSSPrimitiveValue::create(100., CSSPrimitiveValue::CSS_PERCENTAGE);
else if (equalIgnoringCase(a->string, "center"))
result = CSSPrimitiveValue::create(50., CSSPrimitiveValue::CSS_PERCENTAGE);
@@ -4452,27 +4462,27 @@ static bool parseGradientColorStop(CSSParser* p, CSSParserValue* a, CSSGradientC
{
if (a->unit != CSSParserValue::Function)
return false;
-
+
if (!equalIgnoringCase(a->function->name, "from(") &&
!equalIgnoringCase(a->function->name, "to(") &&
!equalIgnoringCase(a->function->name, "color-stop("))
return false;
-
+
CSSParserValueList* args = a->function->args;
if (!args)
return false;
-
- if (equalIgnoringCase(a->function->name, "from(") ||
- equalIgnoringCase(a->function->name, "to(")) {
+
+ if (equalIgnoringCase(a->function->name, "from(")
+ || equalIgnoringCase(a->function->name, "to(")) {
// The "from" and "to" stops expect 1 argument.
if (args->size() != 1)
return false;
-
+
if (equalIgnoringCase(a->function->name, "from("))
stop.m_stop = 0.f;
else
stop.m_stop = 1.f;
-
+
int id = args->current()->id;
if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu)
stop.m_color = CSSPrimitiveValue::createIdentifier(id);
@@ -4481,12 +4491,12 @@ static bool parseGradientColorStop(CSSParser* p, CSSParserValue* a, CSSGradientC
if (!stop.m_color)
return false;
}
-
+
// The "color-stop" function expects 3 arguments.
if (equalIgnoringCase(a->function->name, "color-stop(")) {
if (args->size() != 3)
return false;
-
+
CSSParserValue* stopArg = args->current();
if (stopArg->unit == CSSPrimitiveValue::CSS_PERCENTAGE)
stop.m_stop = (float)stopArg->fValue / 100.f;
@@ -4498,7 +4508,7 @@ static bool parseGradientColorStop(CSSParser* p, CSSParserValue* a, CSSGradientC
stopArg = args->next();
if (stopArg->unit != CSSParserValue::Operator || stopArg->iValue != ',')
return false;
-
+
stopArg = args->next();
int id = stopArg->id;
if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu)
@@ -4515,12 +4525,12 @@ static bool parseGradientColorStop(CSSParser* p, CSSParserValue* a, CSSGradientC
bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
{
RefPtr<CSSGradientValue> result = CSSGradientValue::create();
-
+
// Walk the arguments.
CSSParserValueList* args = m_valueList->current()->function->args;
if (!args || args->size() == 0)
return false;
-
+
// The first argument is the gradient type. It is an identifier.
CSSParserValue* a = args->current();
if (!a || a->unit != CSSPrimitiveValue::CSS_IDENT)
@@ -4531,12 +4541,12 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
result->setType(CSSRadialGradient);
else
return false;
-
+
// Comma.
a = args->next();
if (!a || a->unit != CSSParserValue::Operator || a->iValue != ',')
return false;
-
+
// Next comes the starting point for the gradient as an x y pair. There is no
// comma between the x and the y values.
// First X. It can be left, right, number or percent.
@@ -4547,7 +4557,7 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
if (!point)
return false;
result->setFirstX(point.release());
-
+
// First Y. It can be top, bottom, number or percent.
a = args->next();
if (!a)
@@ -4556,25 +4566,25 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
if (!point)
return false;
result->setFirstY(point.release());
-
+
// Comma after the first point.
a = args->next();
if (!a || a->unit != CSSParserValue::Operator || a->iValue != ',')
return false;
-
+
// For radial gradients only, we now expect a numeric radius.
if (result->type() == CSSRadialGradient) {
a = args->next();
if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER)
return false;
result->setFirstRadius(CSSPrimitiveValue::create(a->fValue, CSSPrimitiveValue::CSS_NUMBER));
-
+
// Comma after the first radius.
a = args->next();
if (!a || a->unit != CSSParserValue::Operator || a->iValue != ',')
return false;
}
-
+
// Next is the ending point for the gradient as an x, y pair.
// Second X. It can be left, right, number or percent.
a = args->next();
@@ -4584,7 +4594,7 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
if (!point)
return false;
result->setSecondX(point.release());
-
+
// Second Y. It can be top, bottom, number or percent.
a = args->next();
if (!a)
@@ -4600,7 +4610,7 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
a = args->next();
if (!a || a->unit != CSSParserValue::Operator || a->iValue != ',')
return false;
-
+
a = args->next();
if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER)
return false;
@@ -4613,22 +4623,22 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
// Look for the comma before the next stop.
if (a->unit != CSSParserValue::Operator || a->iValue != ',')
return false;
-
+
// Now examine the stop itself.
a = args->next();
if (!a)
return false;
-
+
// The function name needs to be one of "from", "to", or "color-stop."
CSSGradientColorStop stop;
if (!parseGradientColorStop(this, a, stop))
return false;
result->addStop(stop);
-
+
// Advance
a = args->next();
}
-
+
gradient = result.release();
return true;
}
@@ -4636,12 +4646,12 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
bool CSSParser::parseCanvas(RefPtr<CSSValue>& canvas)
{
RefPtr<CSSCanvasValue> result = CSSCanvasValue::create();
-
+
// Walk the arguments.
CSSParserValueList* args = m_valueList->current()->function->args;
if (!args || args->size() != 1)
return false;
-
+
// The first argument is the canvas name. It is an identifier.
CSSParserValue* a = args->current();
if (!a || a->unit != CSSPrimitiveValue::CSS_IDENT)
@@ -4730,7 +4740,7 @@ public:
m_argCount = 3;
}
}
-
+
WebKitCSSTransformValue::TransformOperationType type() const { return m_type; }
unsigned argCount() const { return m_argCount; }
CSSParser::Units unit() const { return m_unit; }
@@ -4756,17 +4766,17 @@ PassRefPtr<CSSValueList> CSSParser::parseTransform()
for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
if (value->unit != CSSParserValue::Function || !value->function)
return 0;
-
+
// Every primitive requires at least one argument.
CSSParserValueList* args = value->function->args;
if (!args)
return 0;
-
+
// See if the specified primitive is one we understand.
TransformOperationInfo info(value->function->name);
if (info.unknown())
return 0;
-
+
if (!info.hasCorrectArgCount(args->size()))
return 0;
@@ -4786,7 +4796,7 @@ PassRefPtr<CSSValueList> CSSParser::parseTransform()
return 0;
} else if (!validUnit(a, unit, true))
return 0;
-
+
// Add the value to the current transform operation.
transformValue->append(CSSPrimitiveValue::create(a->fValue, (CSSPrimitiveValue::UnitTypes) a->unit));
@@ -4796,11 +4806,11 @@ PassRefPtr<CSSValueList> CSSParser::parseTransform()
if (a->unit != CSSParserValue::Operator || a->iValue != ',')
return 0;
a = args->next();
-
+
argNumber++;
}
}
-
+
return list.release();
}
@@ -4842,7 +4852,7 @@ bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int
break;
}
}
-
+
return value;
}
@@ -4874,7 +4884,7 @@ bool CSSParser::parsePerspectiveOrigin(int propId, int& propId1, int& propId2, R
break;
}
}
-
+
return value;
}
@@ -5102,9 +5112,9 @@ UChar* CSSParser::text(int *length)
uc = 0xfffd;
*out++ = uc;
}
-
+
*length = out - start;
-
+
// If we have an unrecognized @-keyword, and if we handled any escapes at all, then
// we should attempt to adjust yyTok to the correct type.
if (yyTok == ATKEYWORD && sawEscape)
@@ -5271,7 +5281,7 @@ CSSRuleList* CSSParser::createRuleList()
{
RefPtr<CSSRuleList> list = CSSRuleList::create();
CSSRuleList* listPtr = list.get();
-
+
m_parsedRuleLists.append(list.release());
return listPtr;
}
@@ -5357,7 +5367,7 @@ CSSRule* CSSParser::createVariablesRule(MediaList* mediaList, bool variablesKeyw
m_allowImportRules = false;
RefPtr<CSSVariablesRule> rule = CSSVariablesRule::create(m_styleSheet, mediaList, variablesKeyword);
rule->setDeclaration(CSSVariablesDeclaration::create(rule.get(), m_variableNames, m_variableValues));
- clearVariables();
+ clearVariables();
CSSRule* result = rule.get();
m_parsedStyleObjects.append(rule.release());
return result;
@@ -5407,6 +5417,7 @@ CSSRule* CSSParser::createMarginAtRule(CSSSelector::MarginBoxType /* marginBox *
// FIXME: Implement margin at-rule here, using:
// - marginBox: margin box
// - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMarginBox, m_numParsedProperties) are for this at-rule.
+ // Don't forget to also update the action for page symbol in CSSGrammar.y such that margin at-rule data is cleared if page_selector is invalid.
endDeclarationsForMarginBox();
return 0; // until this method is implemented.
@@ -5448,8 +5459,8 @@ bool CSSParser::parseVariable(CSSVariablesDeclaration* declaration, const String
if (m_variableNames.size()) {
ok = true;
declaration->addParsedVariable(variableName, m_variableValues[0]);
- }
-
+ }
+
clearVariables();
#ifdef ANDROID_INSTRUMENT
@@ -5465,7 +5476,7 @@ void CSSParser::parsePropertyWithResolvedVariables(int propId, bool isImportant,
if (parseValue(propId, isImportant))
declaration->addParsedProperties(m_parsedProperties, m_numParsedProperties);
-
+
clearProperties();
m_valueList = 0;
}
@@ -5480,8 +5491,8 @@ bool CSSParser::checkForVariables(CSSParserValueList* valueList)
if (valueList->valueAt(i)->isVariable()) {
hasVariables = true;
break;
- }
-
+ }
+
if (valueList->valueAt(i)->unit == CSSParserValue::Function && checkForVariables(valueList->valueAt(i)->function->args)) {
hasVariables = true;
break;
@@ -5526,11 +5537,11 @@ WebKitCSSKeyframeRule* CSSParser::createKeyframeRule(CSSParserValueList* keys)
keyString += String::number(key);
keyString += "%";
}
-
+
RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create(m_styleSheet);
keyframe->setKeyText(keyString);
keyframe->setDeclaration(CSSMutableStyleDeclaration::create(0, m_parsedProperties, m_numParsedProperties));
-
+
clearProperties();
WebKitCSSKeyframeRule* keyframePtr = keyframe.get();
diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h
index 6e0354e..d1a5a43 100644
--- a/WebCore/css/CSSParser.h
+++ b/WebCore/css/CSSParser.h
@@ -85,7 +85,7 @@ namespace WebCore {
void parseFillPosition(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma);
-
+
bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important);
@@ -108,7 +108,7 @@ namespace WebCore {
bool parseAnimationProperty(int propId, RefPtr<CSSValue>&);
bool parseTransitionShorthand(bool important);
bool parseAnimationShorthand(bool important);
-
+
bool parseDashboardRegions(int propId, bool important);
bool parseShape(int propId, bool important);
@@ -148,7 +148,7 @@ namespace WebCore {
bool parseShadow(int propId, bool important);
bool parseBorderImage(int propId, bool important, RefPtr<CSSValue>&);
bool parseBorderRadius(int propId, bool important);
-
+
bool parseReflect(int propId, bool important);
// Image generators
@@ -209,6 +209,8 @@ namespace WebCore {
void updateLastSelectorLine() { m_lastSelectorLine = m_line; }
+ void clearProperties();
+
bool m_strict;
bool m_important;
int m_id;
@@ -241,18 +243,16 @@ namespace WebCore {
UChar* text(int* length);
void countLines();
int lex();
-
+
private:
void recheckAtKeyword(const UChar* str, int len);
-
- void clearProperties();
void setupParser(const char* prefix, const String&, const char* suffix);
bool inShorthand() const { return m_inParseShorthand; }
void checkForOrphanedUnits();
-
+
void clearVariables();
void deleteFontFaceOnlyValues();
@@ -294,7 +294,7 @@ namespace WebCore {
MediaQuery* m_floatingMediaQuery;
MediaQueryExp* m_floatingMediaQueryExp;
Vector<MediaQueryExp*>* m_floatingMediaQueryExpList;
-
+
Vector<CSSSelector*> m_reusableSelectorVector;
// defines units allowed for a certain property, used in parseUnit
@@ -317,7 +317,7 @@ namespace WebCore {
}
static bool validUnit(CSSParserValue*, Units, bool strict);
-
+
friend class TransformOperationInfo;
};
diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in
index 6ed923a..5b9e7fd 100644
--- a/WebCore/css/CSSPropertyNames.in
+++ b/WebCore/css/CSSPropertyNames.in
@@ -203,6 +203,7 @@ z-index
-webkit-column-rule-color
-webkit-column-rule-style
-webkit-column-rule-width
+-webkit-column-span
-webkit-column-width
-webkit-columns
-webkit-font-size-delta
diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp
index ee9c846..5add90b 100644
--- a/WebCore/css/CSSSelector.cpp
+++ b/WebCore/css/CSSSelector.cpp
@@ -424,13 +424,14 @@ CSSSelector::PseudoType CSSSelector::parsePseudoType(const AtomicString& name)
void CSSSelector::extractPseudoType() const
{
- if (m_match != PseudoClass && m_match != PseudoElement)
+ if (m_match != PseudoClass && m_match != PseudoElement && m_match != PagePseudoClass)
return;
m_pseudoType = parsePseudoType(m_value);
bool element = false; // pseudo-element
bool compat = false; // single colon compatbility mode
+ bool isPagePseudoClass = false; // Page pseudo-class
switch (m_pseudoType) {
case PseudoAfter:
@@ -529,12 +530,14 @@ void CSSSelector::extractPseudoType() const
case PseudoFirstPage:
case PseudoLeftPage:
case PseudoRightPage:
- // FIXME: These should only be allowed in @page rules. Disabled them altogether until that's implemented correctly.
- m_pseudoType = PseudoUnknown;
- return;
+ isPagePseudoClass = true;
+ break;
}
- if (m_match == PseudoClass && element) {
+ bool matchPagePseudoClass = (m_match == PagePseudoClass);
+ if (matchPagePseudoClass != isPagePseudoClass)
+ m_pseudoType = PseudoUnknown;
+ else if (m_match == PseudoClass && element) {
if (!compat)
m_pseudoType = PseudoUnknown;
else
@@ -586,7 +589,7 @@ String CSSSelector::selectorText() const
} else if (cs->m_match == CSSSelector::Class) {
str += ".";
str += cs->m_value;
- } else if (cs->m_match == CSSSelector::PseudoClass) {
+ } else if (cs->m_match == CSSSelector::PseudoClass || cs->m_match == CSSSelector::PagePseudoClass) {
str += ":";
str += cs->m_value;
if (cs->pseudoType() == PseudoNot) {
diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h
index f97f36d..11d30b1 100644
--- a/WebCore/css/CSSSelector.h
+++ b/WebCore/css/CSSSelector.h
@@ -85,9 +85,10 @@ namespace WebCore {
Hyphen,
PseudoClass,
PseudoElement,
- Contain, // css3: E[foo*="bar"]
- Begin, // css3: E[foo^="bar"]
- End // css3: E[foo$="bar"]
+ Contain, // css3: E[foo*="bar"]
+ Begin, // css3: E[foo^="bar"]
+ End, // css3: E[foo$="bar"]
+ PagePseudoClass
};
enum Relation {
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index ff650bc..ae919ef 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "CSSStyleSelector.h"
+#include "Attribute.h"
#include "CSSBorderImageValue.h"
#include "CSSCursorImageValue.h"
#include "CSSFontFaceRule.h"
@@ -61,9 +62,8 @@
#include "HTMLTextAreaElement.h"
#include "KeyframeList.h"
#include "LinkHash.h"
-#include "MappedAttribute.h"
-#include "MatrixTransformOperation.h"
#include "Matrix3DTransformOperation.h"
+#include "MatrixTransformOperation.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "NodeRenderStyle.h"
@@ -1037,7 +1037,7 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
if (classesMatch) {
bool mappedAttrsMatch = true;
if (s->hasMappedAttributes())
- mappedAttrsMatch = s->mappedAttributes()->mapsEquivalent(m_styledElement->mappedAttributes());
+ mappedAttrsMatch = s->mappedAttributes()->mappedMapsEquivalent(m_styledElement->mappedAttributes());
if (mappedAttrsMatch) {
if (s->isLink()) {
if (m_elementLinkState != style->insideLink())
@@ -1255,17 +1255,14 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
// Ask if the HTML element has mapped attributes.
if (m_styledElement->hasMappedAttributes()) {
// Walk our attribute list and add in each decl.
- const NamedMappedAttrMap* map = m_styledElement->mappedAttributes();
+ const NamedNodeMap* map = m_styledElement->mappedAttributes();
for (unsigned i = 0; i < map->length(); i++) {
Attribute* attr = map->attributeItem(i);
- if (attr->isMappedAttribute()) {
- MappedAttribute* mappedAttr = static_cast<MappedAttribute*>(attr);
- if (mappedAttr->decl()) {
- lastAuthorRule = m_matchedDecls.size();
- if (firstAuthorRule == -1)
- firstAuthorRule = lastAuthorRule;
- addMatchedDeclaration(mappedAttr->decl());
- }
+ if (attr->isMappedAttribute() && attr->decl()) {
+ lastAuthorRule = m_matchedDecls.size();
+ if (firstAuthorRule == -1)
+ firstAuthorRule = lastAuthorRule;
+ addMatchedDeclaration(attr->decl());
}
}
}
@@ -2568,11 +2565,6 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
break;
return true;
}
- case CSSSelector::PseudoLeftPage:
- case CSSSelector::PseudoRightPage:
- case CSSSelector::PseudoFirstPage:
- // Page media related pseudo-classes are not handled yet.
- return false;
case CSSSelector::PseudoUnknown:
case CSSSelector::PseudoNotParsed:
default:
@@ -4872,6 +4864,11 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
m_style->setColumnGap(primitiveValue->computeLengthFloat(style(), m_rootElementStyle, zoomFactor));
return;
}
+ case CSSPropertyWebkitColumnSpan: {
+ HANDLE_INHERIT_AND_INITIAL(columnSpan, ColumnSpan)
+ m_style->setColumnSpan(primitiveValue->getIdent() == CSSValueAll);
+ return;
+ }
case CSSPropertyWebkitColumnWidth: {
if (isInherit) {
if (m_parentStyle->hasAutoColumnWidth())
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index 5949f96..fb25374 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -28,9 +28,7 @@
#include "Document.h"
#include "ExceptionCode.h"
#include "Node.h"
-#include "Page.h"
#include "SecurityOrigin.h"
-#include "Settings.h"
#include "TextEncoding.h"
#include <wtf/Deque.h>
@@ -139,23 +137,8 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio
PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules)
{
- if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) {
-
- // The Safari welcome page runs afoul of the same-origin restriction on access to stylesheet rules
- // that was added to address <https://bugs.webkit.org/show_bug.cgi?id=20527>. The following site-
- // specific quirk relaxes this restriction for the particular cross-origin access that occurs on
- // the Safari welcome page (<rdar://problem/7847573>).
-
- Settings* settings = doc()->settings();
- if (!settings || !settings->needsSiteSpecificQuirks())
- return 0;
-
- if (!equalIgnoringCase(baseURL().string(), "http://images.apple.com/safari/welcome/styles/safari.css"))
- return 0;
-
- if (!doc()->url().string().contains("apple.com/safari/welcome/", false))
- return 0;
- }
+ if (doc() && !doc()->securityOrigin()->canRequest(baseURL()))
+ return 0;
return CSSRuleList::create(this, omitCharsetRules);
}
diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp
index 75d48b7..1deb259 100644
--- a/WebCore/css/SVGCSSStyleSelector.cpp
+++ b/WebCore/css/SVGCSSStyleSelector.cpp
@@ -90,13 +90,13 @@ static int angleToGlyphOrientation(float angle)
return -1;
}
-static Color colorFromSVGColorCSSValue(CSSValue* value, RenderStyle* style)
+static Color colorFromSVGColorCSSValue(CSSValue* value, const Color& fgColor)
{
ASSERT(value->isSVGColor());
SVGColor* c = static_cast<SVGColor*>(value);
Color color;
if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
- color = style->color();
+ color = fgColor;
else
color = c->color();
return color;
@@ -454,13 +454,13 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
case CSSPropertyStopColor:
{
HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor);
- svgstyle->setStopColor(colorFromSVGColorCSSValue(value, m_style.get()));
+ svgstyle->setStopColor(colorFromSVGColorCSSValue(value, m_style->color()));
break;
}
case CSSPropertyLightingColor:
{
HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor);
- svgstyle->setLightingColor(colorFromSVGColorCSSValue(value, m_style.get()));
+ svgstyle->setLightingColor(colorFromSVGColorCSSValue(value, m_style->color()));
break;
}
case CSSPropertyFloodOpacity:
@@ -487,7 +487,7 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
svgstyle->setFloodColor(SVGRenderStyle::initialFloodColor());
return;
}
- svgstyle->setFloodColor(colorFromSVGColorCSSValue(value, m_style.get()));
+ svgstyle->setFloodColor(colorFromSVGColorCSSValue(value, m_style->color()));
break;
}
case CSSPropertyGlyphOrientationHorizontal:
diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp
index 2ef5f9b..597f9ba 100644
--- a/WebCore/dom/Attr.cpp
+++ b/WebCore/dom/Attr.cpp
@@ -38,10 +38,10 @@ inline Attr::Attr(Element* element, Document* document, PassRefPtr<Attribute> at
, m_element(element)
, m_attribute(attribute)
, m_ignoreChildrenChanged(0)
- , m_specified(true)
+ , m_specified(true)
{
ASSERT(!m_attribute->attr());
- m_attribute->m_impl = this;
+ m_attribute->bindAttr(this);
}
PassRefPtr<Attr> Attr::create(Element* element, Document* document, PassRefPtr<Attribute> attribute)
@@ -54,7 +54,7 @@ PassRefPtr<Attr> Attr::create(Element* element, Document* document, PassRefPtr<A
Attr::~Attr()
{
ASSERT(m_attribute->attr() == this);
- m_attribute->m_impl = 0;
+ m_attribute->unbindAttr(this);
}
void Attr::createTextChild()
diff --git a/WebCore/dom/Attr.idl b/WebCore/dom/Attr.idl
index 3c73bc0..d959cd1 100644
--- a/WebCore/dom/Attr.idl
+++ b/WebCore/dom/Attr.idl
@@ -31,7 +31,7 @@ module core {
readonly attribute boolean specified;
- attribute [ConvertNullStringTo=Null, ConvertNullToNullString, CustomSetter] DOMString value
+ attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString value
setter raises(DOMException);
// DOM Level 2
diff --git a/WebCore/dom/Attribute.cpp b/WebCore/dom/Attribute.cpp
index 0ab0bb6..20c05d8 100644
--- a/WebCore/dom/Attribute.cpp
+++ b/WebCore/dom/Attribute.cpp
@@ -26,20 +26,64 @@
#include "Attr.h"
#include "Element.h"
+#include <wtf/HashMap.h>
+#include <wtf/UnusedParam.h>
namespace WebCore {
+typedef HashMap<Attribute*, Attr*> AttributeAttrMap;
+static AttributeAttrMap& attributeAttrMap()
+{
+ DEFINE_STATIC_LOCAL(AttributeAttrMap, map, ());
+ return map;
+}
+
PassRefPtr<Attribute> Attribute::clone() const
{
- return adoptRef(new Attribute(m_name, m_value));
+ return adoptRef(new Attribute(m_name, m_value, m_isMappedAttribute, m_styleDecl.get()));
+}
+
+Attr* Attribute::attr() const
+{
+ if (m_hasAttr) {
+ ASSERT(attributeAttrMap().contains(const_cast<Attribute*>(this)));
+ return attributeAttrMap().get(const_cast<Attribute*>(this));
+ }
+
+ ASSERT(!attributeAttrMap().contains(const_cast<Attribute*>(this)));
+ return 0;
}
PassRefPtr<Attr> Attribute::createAttrIfNeeded(Element* e)
{
- RefPtr<Attr> r = m_impl;
- if (!r)
- r = Attr::create(e, e->document(), this);
+ RefPtr<Attr> r;
+ if (m_hasAttr) {
+ ASSERT(attributeAttrMap().contains(this));
+ r = attributeAttrMap().get(this);
+ } else {
+ ASSERT(!attributeAttrMap().contains(this));
+ r = Attr::create(e, e->document(), this); // This will end up calling Attribute::bindAttr.
+ ASSERT(attributeAttrMap().contains(this));
+ }
+
return r.release();
}
+void Attribute::bindAttr(Attr* attr)
+{
+ ASSERT(!m_hasAttr);
+ ASSERT(!attributeAttrMap().contains(this));
+ attributeAttrMap().set(this, attr);
+ m_hasAttr = true;
+}
+
+void Attribute::unbindAttr(Attr* attr)
+{
+ ASSERT(m_hasAttr);
+ ASSERT(attributeAttrMap().contains(this));
+ ASSERT_UNUSED(attr, attributeAttrMap().get(this) == attr);
+ attributeAttrMap().remove(this);
+ m_hasAttr = false;
}
+
+} // namespace WebCore
diff --git a/WebCore/dom/Attribute.h b/WebCore/dom/Attribute.h
index b06d120..9e1afc6 100644
--- a/WebCore/dom/Attribute.h
+++ b/WebCore/dom/Attribute.h
@@ -25,6 +25,7 @@
#ifndef Attribute_h
#define Attribute_h
+#include "CSSMappedAttributeDeclaration.h"
#include "QualifiedName.h"
namespace WebCore {
@@ -43,10 +44,17 @@ class Attribute : public RefCounted<Attribute> {
public:
static PassRefPtr<Attribute> create(const QualifiedName& name, const AtomicString& value)
{
- return adoptRef(new Attribute(name, value));
+ return adoptRef(new Attribute(name, value, false, 0));
}
- virtual ~Attribute() { }
-
+ static PassRefPtr<Attribute> createMapped(const QualifiedName& name, const AtomicString& value)
+ {
+ return adoptRef(new Attribute(name, value, true, 0));
+ }
+ static PassRefPtr<Attribute> createMapped(const AtomicString& name, const AtomicString& value)
+ {
+ return adoptRef(new Attribute(name, value, true, 0));
+ }
+
const AtomicString& value() const { return m_value; }
const AtomicString& prefix() const { return m_name.prefix(); }
const AtomicString& localName() const { return m_name.localName(); }
@@ -54,38 +62,55 @@ public:
const QualifiedName& name() const { return m_name; }
- Attr* attr() const { return m_impl; }
+ Attr* attr() const;
PassRefPtr<Attr> createAttrIfNeeded(Element*);
bool isNull() const { return m_value.isNull(); }
bool isEmpty() const { return m_value.isEmpty(); }
- virtual PassRefPtr<Attribute> clone() const;
+ PassRefPtr<Attribute> clone() const;
// An extension to get the style information for presentational attributes.
- virtual CSSStyleDeclaration* style() const { return 0; }
-
+ CSSStyleDeclaration* style() const { return m_styleDecl.get(); }
+ CSSMappedAttributeDeclaration* decl() const { return m_styleDecl.get(); }
+ void setDecl(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_styleDecl = decl; }
+
void setValue(const AtomicString& value) { m_value = value; }
void setPrefix(const AtomicString& prefix) { m_name.setPrefix(prefix); }
- virtual bool isMappedAttribute() { return false; }
+ bool isMappedAttribute() { return m_isMappedAttribute; }
-protected:
- Attribute(const QualifiedName& name, const AtomicString& value)
- : m_name(name), m_value(value), m_impl(0)
+private:
+ Attribute(const QualifiedName& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl)
+ : m_isMappedAttribute(isMappedAttribute)
+ , m_hasAttr(false)
+ , m_name(name)
+ , m_value(value)
+ , m_styleDecl(styleDecl)
{
}
- Attribute(const AtomicString& name, const AtomicString& value)
- : m_name(nullAtom, name, nullAtom), m_value(value), m_impl(0)
+
+ Attribute(const AtomicString& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl)
+ : m_isMappedAttribute(isMappedAttribute)
+ , m_hasAttr(false)
+ , m_name(nullAtom, name, nullAtom)
+ , m_value(value)
+ , m_styleDecl(styleDecl)
{
}
-private:
+ void bindAttr(Attr*);
+ void unbindAttr(Attr*);
+
+ // These booleans will go into the spare 32-bits of padding from RefCounted in 64-bit.
+ bool m_isMappedAttribute;
+ bool m_hasAttr;
+
QualifiedName m_name;
AtomicString m_value;
- Attr* m_impl;
+ RefPtr<CSSMappedAttributeDeclaration> m_styleDecl;
};
-} //namespace
+} // namespace WebCore
-#endif
+#endif // Attribute_h
diff --git a/WebCore/workers/GenericWorkerTask.h b/WebCore/dom/CrossThreadTask.h
index ad16b45..ee05bec 100644
--- a/WebCore/workers/GenericWorkerTask.h
+++ b/WebCore/dom/CrossThreadTask.h
@@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GenericTask_h
-#define GenericTask_h
+#ifndef CrossThreadTask_h
+#define CrossThreadTask_h
#include "CrossThreadCopier.h"
#include "ScriptExecutionContext.h"
@@ -40,37 +40,37 @@
namespace WebCore {
-// Traits for the GenericTask.
-template<typename T> struct GenericTaskTraits {
+// Traits for the CrossThreadTask.
+template<typename T> struct CrossThreadTaskTraits {
typedef const T& ParamType;
};
-template<typename T> struct GenericTaskTraits<T*> {
+template<typename T> struct CrossThreadTaskTraits<T*> {
typedef T* ParamType;
};
-template<typename T> struct GenericTaskTraits<PassRefPtr<T> > {
+template<typename T> struct CrossThreadTaskTraits<PassRefPtr<T> > {
typedef PassRefPtr<T> ParamType;
};
-template<typename T> struct GenericTaskTraits<PassOwnPtr<T> > {
+template<typename T> struct CrossThreadTaskTraits<PassOwnPtr<T> > {
typedef PassOwnPtr<T> ParamType;
};
template<typename P1, typename MP1>
-class GenericTask1 : public ScriptExecutionContext::Task {
+class CrossThreadTask1 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1);
- typedef GenericTask1<P1, MP1> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
+ typedef CrossThreadTask1<P1, MP1> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1)
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1)
{
- return new GenericTask(method, parameter1);
+ return new CrossThreadTask(method, parameter1);
}
private:
- GenericTask1(Method method, Param1 parameter1)
+ CrossThreadTask1(Method method, Param1 parameter1)
: m_method(method)
, m_parameter1(parameter1)
{
@@ -87,20 +87,20 @@ private:
};
template<typename P1, typename MP1, typename P2, typename MP2>
-class GenericTask2 : public ScriptExecutionContext::Task {
+class CrossThreadTask2 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1, MP2);
- typedef GenericTask2<P1, MP1, P2, MP2> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
- typedef typename GenericTaskTraits<P2>::ParamType Param2;
+ typedef CrossThreadTask2<P1, MP1, P2, MP2> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1, Param2 parameter2)
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2)
{
- return new GenericTask(method, parameter1, parameter2);
+ return new CrossThreadTask(method, parameter1, parameter2);
}
private:
- GenericTask2(Method method, Param1 parameter1, Param2 parameter2)
+ CrossThreadTask2(Method method, Param1 parameter1, Param2 parameter2)
: m_method(method)
, m_parameter1(parameter1)
, m_parameter2(parameter2)
@@ -119,21 +119,21 @@ private:
};
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
-class GenericTask3 : public ScriptExecutionContext::Task {
+class CrossThreadTask3 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3);
- typedef GenericTask3<P1, MP1, P2, MP2, P3, MP3> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
- typedef typename GenericTaskTraits<P2>::ParamType Param2;
- typedef typename GenericTaskTraits<P3>::ParamType Param3;
+ typedef CrossThreadTask3<P1, MP1, P2, MP2, P3, MP3> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+ typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
{
- return new GenericTask(method, parameter1, parameter2, parameter3);
+ return new CrossThreadTask(method, parameter1, parameter2, parameter3);
}
private:
- GenericTask3(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
+ CrossThreadTask3(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
: m_method(method)
, m_parameter1(parameter1)
, m_parameter2(parameter2)
@@ -154,22 +154,22 @@ private:
};
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
-class GenericTask4 : public ScriptExecutionContext::Task {
+class CrossThreadTask4 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4);
- typedef GenericTask4<P1, MP1, P2, MP2, P3, MP3, P4, MP4> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
- typedef typename GenericTaskTraits<P2>::ParamType Param2;
- typedef typename GenericTaskTraits<P3>::ParamType Param3;
- typedef typename GenericTaskTraits<P4>::ParamType Param4;
+ typedef CrossThreadTask4<P1, MP1, P2, MP2, P3, MP3, P4, MP4> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+ typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
+ typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
{
- return new GenericTask(method, parameter1, parameter2, parameter3, parameter4);
+ return new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4);
}
private:
- GenericTask4(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
+ CrossThreadTask4(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
: m_method(method)
, m_parameter1(parameter1)
, m_parameter2(parameter2)
@@ -192,23 +192,23 @@ private:
};
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
-class GenericTask5 : public ScriptExecutionContext::Task {
+class CrossThreadTask5 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5);
- typedef GenericTask5<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
- typedef typename GenericTaskTraits<P2>::ParamType Param2;
- typedef typename GenericTaskTraits<P3>::ParamType Param3;
- typedef typename GenericTaskTraits<P4>::ParamType Param4;
- typedef typename GenericTaskTraits<P5>::ParamType Param5;
-
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
+ typedef CrossThreadTask5<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+ typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
+ typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
+ typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
+
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
{
- return new GenericTask(method, parameter1, parameter2, parameter3, parameter4, parameter5);
+ return new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5);
}
private:
- GenericTask5(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
+ CrossThreadTask5(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
: m_method(method)
, m_parameter1(parameter1)
, m_parameter2(parameter2)
@@ -233,24 +233,24 @@ private:
};
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
-class GenericTask6 : public ScriptExecutionContext::Task {
+class CrossThreadTask6 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6);
- typedef GenericTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
- typedef typename GenericTaskTraits<P2>::ParamType Param2;
- typedef typename GenericTaskTraits<P3>::ParamType Param3;
- typedef typename GenericTaskTraits<P4>::ParamType Param4;
- typedef typename GenericTaskTraits<P5>::ParamType Param5;
- typedef typename GenericTaskTraits<P6>::ParamType Param6;
-
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
+ typedef CrossThreadTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+ typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
+ typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
+ typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
+ typedef typename CrossThreadTaskTraits<P6>::ParamType Param6;
+
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
{
- return new GenericTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6);
+ return new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6);
}
private:
- GenericTask6(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
+ CrossThreadTask6(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
: m_method(method)
, m_parameter1(parameter1)
, m_parameter2(parameter2)
@@ -277,25 +277,25 @@ private:
};
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7>
-class GenericTask7 : public ScriptExecutionContext::Task {
+class CrossThreadTask7 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7);
- typedef GenericTask7<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
- typedef typename GenericTaskTraits<P2>::ParamType Param2;
- typedef typename GenericTaskTraits<P3>::ParamType Param3;
- typedef typename GenericTaskTraits<P4>::ParamType Param4;
- typedef typename GenericTaskTraits<P5>::ParamType Param5;
- typedef typename GenericTaskTraits<P6>::ParamType Param6;
- typedef typename GenericTaskTraits<P7>::ParamType Param7;
-
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
+ typedef CrossThreadTask7<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+ typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
+ typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
+ typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
+ typedef typename CrossThreadTaskTraits<P6>::ParamType Param6;
+ typedef typename CrossThreadTaskTraits<P7>::ParamType Param7;
+
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
{
- return new GenericTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7);
+ return new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7);
}
private:
- GenericTask7(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
+ CrossThreadTask7(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
: m_method(method)
, m_parameter1(parameter1)
, m_parameter2(parameter2)
@@ -324,26 +324,26 @@ private:
};
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
-class GenericTask8 : public ScriptExecutionContext::Task {
+class CrossThreadTask8 : public ScriptExecutionContext::Task {
public:
typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
- typedef GenericTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> GenericTask;
- typedef typename GenericTaskTraits<P1>::ParamType Param1;
- typedef typename GenericTaskTraits<P2>::ParamType Param2;
- typedef typename GenericTaskTraits<P3>::ParamType Param3;
- typedef typename GenericTaskTraits<P4>::ParamType Param4;
- typedef typename GenericTaskTraits<P5>::ParamType Param5;
- typedef typename GenericTaskTraits<P6>::ParamType Param6;
- typedef typename GenericTaskTraits<P7>::ParamType Param7;
- typedef typename GenericTaskTraits<P8>::ParamType Param8;
+ typedef CrossThreadTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> CrossThreadTask;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+ typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
+ typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
+ typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
+ typedef typename CrossThreadTaskTraits<P6>::ParamType Param6;
+ typedef typename CrossThreadTaskTraits<P7>::ParamType Param7;
+ typedef typename CrossThreadTaskTraits<P8>::ParamType Param8;
- static PassOwnPtr<GenericTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+ static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
{
- return new GenericTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8);
+ return new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8);
}
private:
- GenericTask8(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+ CrossThreadTask8(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
: m_method(method)
, m_parameter1(parameter1)
, m_parameter2(parameter2)
@@ -378,7 +378,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1),
const P1& parameter1)
{
- return GenericTask1<typename CrossThreadCopier<P1>::Type, MP1>::create(
+ return CrossThreadTask1<typename CrossThreadCopier<P1>::Type, MP1>::create(
method,
CrossThreadCopier<P1>::copy(parameter1));
}
@@ -388,7 +388,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1, MP2),
const P1& parameter1, const P2& parameter2)
{
- return GenericTask2<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
+ return CrossThreadTask2<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
method,
CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2));
}
@@ -398,7 +398,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1, MP2, MP3),
const P1& parameter1, const P2& parameter2, const P3& parameter3)
{
- return GenericTask3<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create(
+ return CrossThreadTask3<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create(
method,
CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
CrossThreadCopier<P3>::copy(parameter3));
@@ -409,7 +409,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4),
const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4)
{
- return GenericTask4<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+ return CrossThreadTask4<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
typename CrossThreadCopier<P4>::Type, MP4>::create(
method,
CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
@@ -421,7 +421,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5),
const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5)
{
- return GenericTask5<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+ return CrossThreadTask5<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5>::create(
method,
CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
@@ -434,7 +434,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6),
const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6)
{
- return GenericTask6<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+ return CrossThreadTask6<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6>::create(
method,
CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
@@ -447,7 +447,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7),
const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7)
{
- return GenericTask7<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+ return CrossThreadTask7<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
typename CrossThreadCopier<P7>::Type, MP7>::create(
method,
@@ -462,7 +462,7 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7, const P8& parameter8)
{
- return GenericTask8<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+ return CrossThreadTask8<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
typename CrossThreadCopier<P7>::Type, MP7, typename CrossThreadCopier<P8>::Type, MP8>::create(
method,
@@ -474,4 +474,4 @@ PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
} // namespace WebCore
-#endif // GenericTask_h
+#endif // CrossThreadTask_h
diff --git a/WebCore/dom/DOMStringList.cpp b/WebCore/dom/DOMStringList.cpp
new file mode 100644
index 0000000..660be92
--- /dev/null
+++ b/WebCore/dom/DOMStringList.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DOMStringList.h"
+
+namespace WebCore {
+
+bool DOMStringList::contains(const String& string) const
+{
+ // FIXME: Currently, all consumers of DOMStringList store fairly small lists and thus an O(n)
+ // algorithm is OK. But this may need to be optimized if larger amounts of data are
+ // stored in m_strings.
+ size_t count = m_strings.size();
+ for (size_t i = 0; i < count; ++i) {
+ if (m_strings[i] == string)
+ return true;
+ }
+ return false;
+}
+
+} // namespace WebCore
diff --git a/WebCore/dom/DOMStringList.h b/WebCore/dom/DOMStringList.h
new file mode 100644
index 0000000..a3f9b40
--- /dev/null
+++ b/WebCore/dom/DOMStringList.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMStringList_h
+#define DOMStringList_h
+
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+// FIXME: Some consumers of this class may benefit from lazily fetching items rather
+// than creating the list statically as is currently the only option.
+class DOMStringList : public RefCounted<DOMStringList> {
+public:
+ static PassRefPtr<DOMStringList> create()
+ {
+ return adoptRef(new DOMStringList());
+ }
+
+ bool isEmpty() const { return m_strings.isEmpty(); }
+ void clear() { m_strings.clear(); }
+ void append(const String& string) { m_strings.append(string); }
+
+ // Implements the IDL.
+ size_t length() const { return m_strings.size(); }
+ String item(unsigned index) const { return m_strings[index]; }
+ bool contains(const String& str) const;
+
+private:
+ DOMStringList() { }
+
+ Vector<String> m_strings;
+};
+
+} // namespace WebCore
+
+#endif // DOMStringList_h
+
diff --git a/WebCore/dom/DOMStringList.idl b/WebCore/dom/DOMStringList.idl
new file mode 100644
index 0000000..271c9de
--- /dev/null
+++ b/WebCore/dom/DOMStringList.idl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module core {
+
+ interface [
+ GenerateConstructor,
+ HasIndexGetter
+ ] DOMStringList {
+ readonly attribute unsigned long length;
+ DOMString item(in [IsIndex] unsigned long index);
+ boolean contains(in DOMString string);
+ };
+
+}
+
diff --git a/WebCore/dom/DeviceOrientation.cpp b/WebCore/dom/DeviceOrientation.cpp
new file mode 100644
index 0000000..6f8d06a
--- /dev/null
+++ b/WebCore/dom/DeviceOrientation.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DeviceOrientation.h"
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+#include "DeviceOrientationClient.h"
+#include "DeviceOrientationEvent.h"
+#include <wtf/UnusedParam.h>
+
+namespace WebCore {
+
+DeviceOrientation::DeviceOrientation(Page* page, DeviceOrientationClient* client)
+ : m_page(page)
+ , m_client(client)
+{
+}
+
+void DeviceOrientation::onDeviceOrientationChange(double alpha, double beta, double gamma)
+{
+ // FIXME: Fire DeviceOrientationEvents on the window object of all frames
+ // that are listening to orientation.
+ UNUSED_PARAM(alpha);
+ UNUSED_PARAM(beta);
+ UNUSED_PARAM(gamma);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/dom/DeviceOrientation.h b/WebCore/dom/DeviceOrientation.h
new file mode 100644
index 0000000..e4d96be
--- /dev/null
+++ b/WebCore/dom/DeviceOrientation.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeviceOrientation_h
+#define DeviceOrientation_h
+
+namespace WebCore {
+
+class DeviceOrientationClient;
+class Page;
+
+class DeviceOrientation {
+public:
+ DeviceOrientation(Page*, DeviceOrientationClient*);
+
+ // FIXME: Add methods to start and stop the service.
+
+ void onDeviceOrientationChange(double alpha, double beta, double gamma);
+
+private:
+ Page* m_page;
+ DeviceOrientationClient* m_client;
+};
+
+} // namespace WebCore
+
+#endif // DeviceOrientation_h
diff --git a/WebCore/dom/DeviceOrientationClient.h b/WebCore/dom/DeviceOrientationClient.h
new file mode 100644
index 0000000..e0f14eb
--- /dev/null
+++ b/WebCore/dom/DeviceOrientationClient.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeviceOrientationClient_h
+#define DeviceOrientationClient_h
+
+namespace WebCore {
+
+class DeviceOrientationClient {
+public:
+ virtual void startUpdating() = 0;
+ virtual void stopUpdating() = 0;
+
+protected:
+ virtual ~DeviceOrientationClient() {}
+};
+
+} // namespace WebCore
+
+#endif // DeviceOrientationClient_h
diff --git a/WebCore/dom/DeviceOrientationEvent.cpp b/WebCore/dom/DeviceOrientationEvent.cpp
new file mode 100644
index 0000000..b1aae65
--- /dev/null
+++ b/WebCore/dom/DeviceOrientationEvent.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DeviceOrientationEvent.h"
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+namespace WebCore {
+
+DeviceOrientationEvent::DeviceOrientationEvent()
+ : m_alpha(0)
+ , m_beta(0)
+ , m_gamma(0)
+{
+}
+
+DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, double alpha, double beta, double gamma)
+ : Event(eventType, false, false) // Can't bubble, not cancelable
+ , m_alpha(alpha)
+ , m_beta(beta)
+ , m_gamma(gamma)
+{
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double alpha, double beta, double gamma)
+{
+ if (dispatched())
+ return;
+
+ initEvent(eventType, canBubble, cancelable);
+
+ m_alpha = alpha;
+ m_beta = beta;
+ m_gamma = gamma;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/dom/DeviceOrientationEvent.h b/WebCore/dom/DeviceOrientationEvent.h
new file mode 100644
index 0000000..0cec9ba
--- /dev/null
+++ b/WebCore/dom/DeviceOrientationEvent.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeviceOrientationEvent_h
+#define DeviceOrientationEvent_h
+
+#include "DOMWindow.h"
+#include "Event.h"
+
+namespace WebCore {
+
+class DeviceOrientationEvent : public Event {
+public:
+ static PassRefPtr<DeviceOrientationEvent> create()
+ {
+ return adoptRef(new DeviceOrientationEvent);
+ }
+ static PassRefPtr<DeviceOrientationEvent> create(const AtomicString& eventType, double alpha, double beta, double gamma)
+ {
+ return adoptRef(new DeviceOrientationEvent(eventType, alpha, beta, gamma));
+ }
+
+ void initDeviceOrientationEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double alpha, double beta, double gamma);
+ double alpha() const { return m_alpha; }
+ double beta() const { return m_beta; }
+ double gamma() const { return m_gamma; }
+
+ virtual bool isDeviceOrientationEvent() const { return true; }
+
+private:
+ DeviceOrientationEvent();
+ DeviceOrientationEvent(const AtomicString& eventType, double alpha, double beta, double gamma);
+
+ double m_alpha;
+ double m_beta;
+ double m_gamma;
+};
+
+} // namespace WebCore
+
+#endif // DeviceOrientationEvent_h
diff --git a/WebCore/dom/DeviceOrientationEvent.idl b/WebCore/dom/DeviceOrientationEvent.idl
new file mode 100644
index 0000000..95d96ec
--- /dev/null
+++ b/WebCore/dom/DeviceOrientationEvent.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module core {
+
+ interface [
+ Conditional=DEVICE_ORIENTATION
+ ] DeviceOrientationEvent : Event {
+ readonly attribute double alpha;
+ readonly attribute double beta;
+ readonly attribute double gamma;
+ void initDeviceOrientationEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in double alpha, in double beta, in double gamma);
+ };
+
+}
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 7fc7aa9..d8905c5 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -29,6 +29,7 @@
#include "AXObjectCache.h"
#include "AnimationController.h"
#include "Attr.h"
+#include "Attribute.h"
#include "CDATASection.h"
#include "CSSHelper.h"
#include "CSSStyleSelector.h"
@@ -88,7 +89,6 @@
#include "InspectorTimelineAgent.h"
#include "KeyboardEvent.h"
#include "Logging.h"
-#include "MappedAttribute.h"
#include "MessageEvent.h"
#include "MouseEvent.h"
#include "MouseEventWithHitTestResults.h"
@@ -477,7 +477,7 @@ Document::Document(Frame* frame, bool isXHTML, bool isHTML)
static int docID = 0;
m_docID = docID++;
#if ENABLE(XHTMLMP)
- m_shouldProcessNoScriptElement = m_frame->script()->canExecuteScripts(NotAboutToExecuteScript);
+ m_shouldProcessNoScriptElement = m_frame && m_frame->script()->canExecuteScripts(NotAboutToExecuteScript);
#endif
}
@@ -2439,11 +2439,12 @@ void Document::processViewport(const String& features)
if (!frame)
return;
- ViewportArguments arguments;
- processArguments(features, (void*)&arguments, &setViewportFeature);
+ if (frame->page()) {
+ ViewportArguments arguments;
+ processArguments(features, (void*)&arguments, &setViewportFeature);
- if (frame->page())
frame->page()->chrome()->client()->didReceiveViewportArguments(frame, arguments);
+ }
}
MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& request, const IntPoint& documentPoint, const PlatformMouseEvent& event)
@@ -2679,9 +2680,9 @@ void Document::addStyleSheetCandidateNode(Node* node, bool createdByParser)
}
// Determine an appropriate insertion point.
- ListHashSet<Node*>::iterator begin = m_styleSheetCandidateNodes.begin();
- ListHashSet<Node*>::iterator end = m_styleSheetCandidateNodes.end();
- ListHashSet<Node*>::iterator it = end;
+ StyleSheetCandidateListHashSet::iterator begin = m_styleSheetCandidateNodes.begin();
+ StyleSheetCandidateListHashSet::iterator end = m_styleSheetCandidateNodes.end();
+ StyleSheetCandidateListHashSet::iterator it = end;
Node* followingNode = 0;
do {
--it;
@@ -2713,11 +2714,11 @@ void Document::recalcStyleSelector()
if (Settings* settings = this->settings())
matchAuthorAndUserStyles = settings->authorAndUserStylesEnabled();
- ListHashSet<Node*>::iterator begin = m_styleSheetCandidateNodes.begin();
- ListHashSet<Node*>::iterator end = m_styleSheetCandidateNodes.end();
+ StyleSheetCandidateListHashSet::iterator begin = m_styleSheetCandidateNodes.begin();
+ StyleSheetCandidateListHashSet::iterator end = m_styleSheetCandidateNodes.end();
if (!matchAuthorAndUserStyles)
end = begin;
- for (ListHashSet<Node*>::iterator it = begin; it != end; ++it) {
+ for (StyleSheetCandidateListHashSet::iterator it = begin; it != end; ++it) {
Node* n = *it;
StyleSheet* sheet = 0;
@@ -4298,7 +4299,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S
// FIXME: Assume this is a mapped attribute, since createAttribute isn't namespace-aware. There's no harm to XML
// documents if we're wrong.
- return Attr::create(0, this, MappedAttribute::create(qName, StringImpl::empty()));
+ return Attr::create(0, this, Attribute::createMapped(qName, StringImpl::empty()));
}
#if ENABLE(SVG)
@@ -4421,7 +4422,7 @@ Vector<String> Document::formElementsState() const
{
Vector<String> stateVector;
stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 3);
- typedef ListHashSet<Element*>::const_iterator Iterator;
+ typedef FormElementListHashSet::const_iterator Iterator;
Iterator end = m_formElementsWithState.end();
for (Iterator it = m_formElementsWithState.begin(); it != end; ++it) {
Element* elementWithState = *it;
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 676caf9..aa4d9e3 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -1104,10 +1104,14 @@ private:
unsigned short m_listenerTypes;
RefPtr<StyleSheetList> m_styleSheets; // All of the stylesheets that are currently in effect for our media type and stylesheet set.
- ListHashSet<Node*> m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
+
+ typedef ListHashSet<Node*, 32> StyleSheetCandidateListHashSet;
+ StyleSheetCandidateListHashSet m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
+
+ typedef ListHashSet<Element*, 64> FormElementListHashSet;
+ FormElementListHashSet m_formElementsWithState;
typedef HashMap<FormElementKey, Vector<String>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
- ListHashSet<Element*> m_formElementsWithState;
FormElementStateMap m_stateForNewFormElements;
Color m_linkColor;
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 3e88071..ec33ea6 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -936,7 +936,7 @@ void Element::recalcStyle(StyleChange change)
newStyle->setChildrenAffectedByDirectAdjacentRules();
}
- if (ch != NoChange || pseudoStyleCacheIsInvalid(currentStyle.get(), newStyle.get())) {
+ if (ch != NoChange || pseudoStyleCacheIsInvalid(currentStyle.get(), newStyle.get()) || change == Force && renderer() && renderer()->requiresForcedStyleRecalcPropagation()) {
setRenderStyle(newStyle);
} else if (needsStyleRecalc() && (styleChangeType() != SyntheticStyleChange) && (document()->usesSiblingRules() || document()->usesDescendantRules())) {
// Although no change occurred, we use the new style so that the cousin style sharing code won't get
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index e89cf37..8da2892 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -312,7 +312,7 @@ private:
bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle);
- virtual void createAttributeMap() const;
+ void createAttributeMap() const;
virtual void updateStyleAttribute() const { }
diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp
index 876f8a8..4ea3e0c 100644
--- a/WebCore/dom/Event.cpp
+++ b/WebCore/dom/Event.cpp
@@ -212,6 +212,13 @@ bool Event::isTouchEvent() const
}
#endif
+#if ENABLE(DEVICE_ORIENTATION)
+bool Event::isDeviceOrientationEvent() const
+{
+ return false;
+}
+#endif
+
bool Event::fromUserGesture()
{
if (!UserGestureIndicator::processingUserGesture())
diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h
index fbcdc94..2b570d5 100644
--- a/WebCore/dom/Event.h
+++ b/WebCore/dom/Event.h
@@ -139,6 +139,9 @@ namespace WebCore {
#if ENABLE(TOUCH_EVENTS)
virtual bool isTouchEvent() const;
#endif
+#if ENABLE(DEVICE_ORIENTATION)
+ virtual bool isDeviceOrientationEvent() const;
+#endif
bool fromUserGesture();
bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h
index ca2ae96..0491d02 100644
--- a/WebCore/dom/EventNames.h
+++ b/WebCore/dom/EventNames.h
@@ -49,6 +49,7 @@ namespace WebCore {
macro(copy) \
macro(cut) \
macro(dblclick) \
+ macro(deviceorientation) \
macro(display) \
macro(downloading) \
macro(drag) \
diff --git a/WebCore/dom/InputElement.cpp b/WebCore/dom/InputElement.cpp
index 3459906..079dd56 100644
--- a/WebCore/dom/InputElement.cpp
+++ b/WebCore/dom/InputElement.cpp
@@ -31,6 +31,7 @@
#include "CSSStyleSelector.h"
#endif
+#include "Attribute.h"
#include "Chrome.h"
#include "ChromeClient.h"
#include "Document.h"
@@ -39,7 +40,6 @@
#include "Frame.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderTextControlSingleLine.h"
#include "SelectionController.h"
@@ -219,7 +219,7 @@ void InputElement::handleBeforeTextInsertedEvent(InputElementData& data, InputEl
textEvent->setText(sanitizeUserInputValue(inputElement, textEvent->text(), appendableLength));
}
-void InputElement::parseSizeAttribute(InputElementData& data, Element* element, MappedAttribute* attribute)
+void InputElement::parseSizeAttribute(InputElementData& data, Element* element, Attribute* attribute)
{
data.setSize(attribute->isNull() ? InputElement::s_defaultSize : attribute->value().toInt());
@@ -227,7 +227,7 @@ void InputElement::parseSizeAttribute(InputElementData& data, Element* element,
renderer->setNeedsLayoutAndPrefWidthsRecalc();
}
-void InputElement::parseMaxLengthAttribute(InputElementData& data, InputElement* inputElement, Element* element, MappedAttribute* attribute)
+void InputElement::parseMaxLengthAttribute(InputElementData& data, InputElement* inputElement, Element* element, Attribute* attribute)
{
int maxLength = attribute->isNull() ? InputElement::s_maximumLength : attribute->value().toInt();
if (maxLength <= 0 || maxLength > InputElement::s_maximumLength)
diff --git a/WebCore/dom/InputElement.h b/WebCore/dom/InputElement.h
index bdd5645..d477046 100644
--- a/WebCore/dom/InputElement.h
+++ b/WebCore/dom/InputElement.h
@@ -26,11 +26,11 @@
namespace WebCore {
+class Attribute;
class Document;
class Element;
class Event;
class InputElementData;
-class MappedAttribute;
class InputElement {
public:
@@ -80,8 +80,8 @@ protected:
// This should be applied to values specified by users.
static String sanitizeUserInputValue(const InputElement*, const String&, int);
static void handleBeforeTextInsertedEvent(InputElementData&, InputElement*, Element*, Event*);
- static void parseSizeAttribute(InputElementData&, Element*, MappedAttribute*);
- static void parseMaxLengthAttribute(InputElementData&, InputElement*, Element*, MappedAttribute*);
+ static void parseSizeAttribute(InputElementData&, Element*, Attribute*);
+ static void parseMaxLengthAttribute(InputElementData&, InputElement*, Element*, Attribute*);
static void updateValueIfNeeded(InputElementData&, InputElement*);
static void notifyFormStateChanged(Element*);
#if ENABLE(WCSS)
diff --git a/WebCore/dom/MappedAttribute.h b/WebCore/dom/MappedAttribute.h
deleted file mode 100644
index 4167e30..0000000
--- a/WebCore/dom/MappedAttribute.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef MappedAttribute_h
-#define MappedAttribute_h
-
-#include "Attribute.h"
-#include "CSSMappedAttributeDeclaration.h"
-
-namespace WebCore {
-
-class MappedAttribute : public Attribute {
-public:
- static PassRefPtr<MappedAttribute> create(const QualifiedName& name, const AtomicString& value)
- {
- return adoptRef(new MappedAttribute(name, value, 0));
- }
- static PassRefPtr<MappedAttribute> create(const AtomicString& name, const AtomicString& value)
- {
- return adoptRef(new MappedAttribute(name, value, 0));
- }
-
- virtual PassRefPtr<Attribute> clone() const;
-
- virtual CSSStyleDeclaration* style() const { return m_styleDecl.get(); }
-
- virtual bool isMappedAttribute() { return true; }
-
- CSSMappedAttributeDeclaration* decl() const { return m_styleDecl.get(); }
- void setDecl(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_styleDecl = decl; }
-
-private:
- MappedAttribute(const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* declaration)
- : Attribute(name, value), m_styleDecl(declaration)
- {
- }
- MappedAttribute(const AtomicString& name, const AtomicString& value, CSSMappedAttributeDeclaration* declaration)
- : Attribute(name, value), m_styleDecl(declaration)
- {
- }
-
- RefPtr<CSSMappedAttributeDeclaration> m_styleDecl;
-};
-
-} //namespace
-
-#endif
diff --git a/WebCore/dom/NamedAttrMap.h b/WebCore/dom/NamedAttrMap.h
deleted file mode 100644
index e292576..0000000
--- a/WebCore/dom/NamedAttrMap.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef NamedAttrMap_h
-#define NamedAttrMap_h
-
-#include "Attribute.h"
-
-#ifdef __OBJC__
-#define id id_AVOID_KEYWORD
-#endif
-
-namespace WebCore {
-
-class Node;
-
-typedef int ExceptionCode;
-
-class NamedNodeMap : public RefCounted<NamedNodeMap> {
- friend class Element;
-
-protected:
- NamedNodeMap(Element* element) : m_element(element) { }
-
-public:
- static PassRefPtr<NamedNodeMap> create(Element* element) { return adoptRef(new NamedNodeMap(element)); }
-
- virtual ~NamedNodeMap();
-
- // Public DOM interface.
-
- PassRefPtr<Node> getNamedItem(const String& name) const;
- PassRefPtr<Node> removeNamedItem(const String& name, ExceptionCode&);
-
- PassRefPtr<Node> getNamedItemNS(const String& namespaceURI, const String& localName) const;
- PassRefPtr<Node> removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode&);
-
- PassRefPtr<Node> getNamedItem(const QualifiedName& name) const;
- PassRefPtr<Node> removeNamedItem(const QualifiedName& name, ExceptionCode&);
- PassRefPtr<Node> setNamedItem(Node*, ExceptionCode&);
- PassRefPtr<Node> setNamedItemNS(Node* node, ExceptionCode& ec) { return setNamedItem(node, ec); }
-
- PassRefPtr<Node> item(unsigned index) const;
- size_t length() const { return m_attributes.size(); }
- bool isEmpty() const { return !length(); }
-
- // Internal interface.
-
- void setAttributes(const NamedNodeMap&);
-
- Attribute* attributeItem(unsigned index) const { return m_attributes[index].get(); }
- Attribute* getAttributeItem(const QualifiedName&) const;
-
- void copyAttributesToVector(Vector<RefPtr<Attribute> >&);
-
- void shrinkToLength() { m_attributes.shrinkCapacity(length()); }
- void reserveInitialCapacity(unsigned capacity) { m_attributes.reserveInitialCapacity(capacity); }
-
- // Used during parsing: only inserts if not already there. No error checking!
- void insertAttribute(PassRefPtr<Attribute> newAttribute, bool allowDuplicates)
- {
- ASSERT(!m_element);
- if (allowDuplicates || !getAttributeItem(newAttribute->name()))
- addAttribute(newAttribute);
- }
-
- virtual bool isMappedAttributeMap() const;
-
- const AtomicString& id() const { return m_id; }
- void setID(const AtomicString& newId) { m_id = newId; }
-
- bool mapsEquivalent(const NamedNodeMap* otherMap) const;
-
- // These functions do no error checking.
- void addAttribute(PassRefPtr<Attribute>);
- void removeAttribute(const QualifiedName&);
-
- Element* element() const { return m_element; }
-
-protected:
- virtual void clearAttributes();
-
-private:
- void detachAttributesFromElement();
- void detachFromElement();
- Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const;
- Attribute* getAttributeItemSlowCase(const String& name, bool shouldIgnoreAttributeCase) const;
-
- Element* m_element;
- Vector<RefPtr<Attribute> > m_attributes;
- AtomicString m_id;
-};
-
-inline Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const
-{
- unsigned len = length();
- for (unsigned i = 0; i < len; ++i) {
- if (m_attributes[i]->name().matches(name))
- return m_attributes[i].get();
- }
- return 0;
-}
-
-// We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller
-// can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not).
-inline Attribute* NamedNodeMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const
-{
- unsigned len = length();
- bool doSlowCheck = shouldIgnoreAttributeCase;
-
- // Optimize for the case where the attribute exists and its name exactly matches.
- for (unsigned i = 0; i < len; ++i) {
- const QualifiedName& attrName = m_attributes[i]->name();
- if (!attrName.hasPrefix()) {
- if (name == attrName.localName())
- return m_attributes[i].get();
- } else
- doSlowCheck = true;
- }
-
- if (doSlowCheck)
- return getAttributeItemSlowCase(name, shouldIgnoreAttributeCase);
- return 0;
-}
-
-} //namespace
-
-#undef id
-
-#endif
diff --git a/WebCore/dom/NamedMappedAttrMap.cpp b/WebCore/dom/NamedMappedAttrMap.cpp
deleted file mode 100644
index d8e3c80..0000000
--- a/WebCore/dom/NamedMappedAttrMap.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * (C) 2007 David Smith (catfish.man@gmail.com)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "NamedMappedAttrMap.h"
-
-#include "Document.h"
-#include "Element.h"
-#include "MappedAttribute.h"
-
-namespace WebCore {
-
-void NamedMappedAttrMap::clearAttributes()
-{
- m_classNames.clear();
- m_mappedAttributeCount = 0;
- NamedNodeMap::clearAttributes();
-}
-
-bool NamedMappedAttrMap::isMappedAttributeMap() const
-{
- return true;
-}
-
-int NamedMappedAttrMap::declCount() const
-{
- int result = 0;
- for (unsigned i = 0; i < length(); i++) {
- Attribute* attr = attributeItem(i);
- if (attr->isMappedAttribute() &&
- static_cast<MappedAttribute*>(attr)->decl())
- result++;
- }
- return result;
-}
-
-bool NamedMappedAttrMap::mapsEquivalent(const NamedMappedAttrMap* otherMap) const
-{
- // The # of decls must match.
- if (declCount() != otherMap->declCount())
- return false;
-
- // The values for each decl must match.
- for (unsigned i = 0; i < length(); i++) {
- Attribute* attr = attributeItem(i);
- if (attr->isMappedAttribute() &&
- static_cast<MappedAttribute*>(attr)->decl()) {
- Attribute* otherAttr = otherMap->getAttributeItem(attr->name());
- if (!otherAttr || (attr->value() != otherAttr->value()))
- return false;
- }
- }
- return true;
-}
-
-void NamedMappedAttrMap::setClass(const String& classStr)
-{
- if (!element()->hasClass()) {
- m_classNames.clear();
- return;
- }
-
- m_classNames.set(classStr, element()->document()->inCompatMode());
-}
-
-}
diff --git a/WebCore/dom/NamedMappedAttrMap.h b/WebCore/dom/NamedMappedAttrMap.h
deleted file mode 100644
index a288685..0000000
--- a/WebCore/dom/NamedMappedAttrMap.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * (C) 2007 David Smith (catfish.man@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef NamedMappedAttrMap_h
-#define NamedMappedAttrMap_h
-
-#include "NamedNodeMap.h"
-#include "SpaceSplitString.h"
-
-namespace WebCore {
-
-class NamedMappedAttrMap : public NamedNodeMap {
-public:
- static PassRefPtr<NamedMappedAttrMap> create(Element* element = 0) { return adoptRef(new NamedMappedAttrMap(element)); }
-
- void clearClass() { m_classNames.clear(); }
- void setClass(const String&);
- const SpaceSplitString& classNames() const { return m_classNames; }
-
- bool hasMappedAttributes() const { return m_mappedAttributeCount > 0; }
- void declRemoved() { m_mappedAttributeCount--; }
- void declAdded() { m_mappedAttributeCount++; }
-
- bool mapsEquivalent(const NamedMappedAttrMap*) const;
-
-private:
- NamedMappedAttrMap(Element* element) : NamedNodeMap(element), m_mappedAttributeCount(0) { }
-
- virtual void clearAttributes();
- virtual bool isMappedAttributeMap() const;
-
- int declCount() const;
-
- SpaceSplitString m_classNames;
- int m_mappedAttributeCount;
-};
-
-} //namespace
-
-#endif
diff --git a/WebCore/dom/NamedAttrMap.cpp b/WebCore/dom/NamedNodeMap.cpp
index ee979cf..e310ff8 100644
--- a/WebCore/dom/NamedAttrMap.cpp
+++ b/WebCore/dom/NamedNodeMap.cpp
@@ -54,11 +54,6 @@ NamedNodeMap::~NamedNodeMap()
detachAttributesFromElement();
}
-bool NamedNodeMap::isMappedAttributeMap() const
-{
- return false;
-}
-
PassRefPtr<Node> NamedNodeMap::getNamedItem(const String& name) const
{
Attribute* a = getAttributeItem(name, shouldIgnoreAttributeCase(m_element));
@@ -144,6 +139,11 @@ PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* arg, ExceptionCode& ec)
return r.release();
}
+PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionCode& ec)
+{
+ return setNamedItem(node, ec);
+}
+
// The DOM2 spec doesn't say that removeAttribute[NS] throws NOT_FOUND_ERR
// if the attribute is not found, but at this level we have to throw NOT_FOUND_ERR
// because of removeNamedItem, removeNamedItemNS, and removeAttributeNode.
@@ -200,6 +200,9 @@ Attribute* NamedNodeMap::getAttributeItemSlowCase(const String& name, bool shoul
void NamedNodeMap::clearAttributes()
{
+ m_classNames.clear();
+ m_mappedAttributeCount = 0;
+
detachAttributesFromElement();
m_attributes.clear();
}
@@ -299,6 +302,29 @@ void NamedNodeMap::removeAttribute(const QualifiedName& name)
}
}
+void NamedNodeMap::setClass(const String& classStr)
+{
+ if (!element()->hasClass()) {
+ m_classNames.clear();
+ return;
+ }
+
+ m_classNames.set(classStr, element()->document()->inCompatMode());
+}
+
+int NamedNodeMap::declCount() const
+{
+ int result = 0;
+ for (unsigned i = 0; i < length(); i++) {
+ Attribute* attr = attributeItem(i);
+ if (attr->decl()) {
+ ASSERT(attr->isMappedAttribute());
+ result++;
+ }
+ }
+ return result;
+}
+
bool NamedNodeMap::mapsEquivalent(const NamedNodeMap* otherMap) const
{
if (!otherMap)
@@ -309,9 +335,8 @@ bool NamedNodeMap::mapsEquivalent(const NamedNodeMap* otherMap) const
return false;
for (unsigned i = 0; i < len; i++) {
- Attribute *attr = attributeItem(i);
- Attribute *otherAttr = otherMap->getAttributeItem(attr->name());
-
+ Attribute* attr = attributeItem(i);
+ Attribute* otherAttr = otherMap->getAttributeItem(attr->name());
if (!otherAttr || attr->value() != otherAttr->value())
return false;
}
@@ -319,4 +344,24 @@ bool NamedNodeMap::mapsEquivalent(const NamedNodeMap* otherMap) const
return true;
}
+bool NamedNodeMap::mappedMapsEquivalent(const NamedNodeMap* otherMap) const
+{
+ // The # of decls must match.
+ if (declCount() != otherMap->declCount())
+ return false;
+
+ // The values for each decl must match.
+ for (unsigned i = 0; i < length(); i++) {
+ Attribute* attr = attributeItem(i);
+ if (attr->decl()) {
+ ASSERT(attr->isMappedAttribute());
+
+ Attribute* otherAttr = otherMap->getAttributeItem(attr->name());
+ if (!otherAttr || attr->value() != otherAttr->value())
+ return false;
+ }
+ }
+ return true;
}
+
+} // namespace WebCore
diff --git a/WebCore/dom/NamedNodeMap.h b/WebCore/dom/NamedNodeMap.h
index 37ef870..50cb4cb 100644
--- a/WebCore/dom/NamedNodeMap.h
+++ b/WebCore/dom/NamedNodeMap.h
@@ -1 +1,166 @@
-#include "NamedAttrMap.h"
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NamedNodeMap_h
+#define NamedNodeMap_h
+
+#include "Attribute.h"
+#include "SpaceSplitString.h"
+
+#ifdef __OBJC__
+#define id id_AVOID_KEYWORD
+#endif
+
+namespace WebCore {
+
+class Node;
+
+typedef int ExceptionCode;
+
+class NamedNodeMap : public RefCounted<NamedNodeMap> {
+ friend class Element;
+public:
+ static PassRefPtr<NamedNodeMap> create(Element* element = 0)
+ {
+ return adoptRef(new NamedNodeMap(element));
+ }
+
+ ~NamedNodeMap();
+
+ // Public DOM interface.
+
+ PassRefPtr<Node> getNamedItem(const String& name) const;
+ PassRefPtr<Node> removeNamedItem(const String& name, ExceptionCode&);
+
+ PassRefPtr<Node> getNamedItemNS(const String& namespaceURI, const String& localName) const;
+ PassRefPtr<Node> removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode&);
+
+ PassRefPtr<Node> getNamedItem(const QualifiedName& name) const;
+ PassRefPtr<Node> removeNamedItem(const QualifiedName& name, ExceptionCode&);
+ PassRefPtr<Node> setNamedItem(Node*, ExceptionCode&);
+ PassRefPtr<Node> setNamedItemNS(Node*, ExceptionCode&);
+
+ PassRefPtr<Node> item(unsigned index) const;
+ size_t length() const { return m_attributes.size(); }
+ bool isEmpty() const { return !length(); }
+
+ // Internal interface.
+
+ void setAttributes(const NamedNodeMap&);
+
+ Attribute* attributeItem(unsigned index) const { return m_attributes[index].get(); }
+ Attribute* getAttributeItem(const QualifiedName&) const;
+
+ void copyAttributesToVector(Vector<RefPtr<Attribute> >&);
+
+ void shrinkToLength() { m_attributes.shrinkCapacity(length()); }
+ void reserveInitialCapacity(unsigned capacity) { m_attributes.reserveInitialCapacity(capacity); }
+
+ // Used during parsing: only inserts if not already there. No error checking!
+ void insertAttribute(PassRefPtr<Attribute> newAttribute, bool allowDuplicates)
+ {
+ ASSERT(!m_element);
+ if (allowDuplicates || !getAttributeItem(newAttribute->name()))
+ addAttribute(newAttribute);
+ }
+
+ const AtomicString& id() const { return m_id; }
+ void setID(const AtomicString& newId) { m_id = newId; }
+
+ // FIXME: These two functions should be merged if possible.
+ bool mapsEquivalent(const NamedNodeMap* otherMap) const;
+ bool mappedMapsEquivalent(const NamedNodeMap* otherMap) const;
+
+ // These functions do no error checking.
+ void addAttribute(PassRefPtr<Attribute>);
+ void removeAttribute(const QualifiedName&);
+
+ Element* element() const { return m_element; }
+
+ void clearClass() { m_classNames.clear(); }
+ void setClass(const String&);
+ const SpaceSplitString& classNames() const { return m_classNames; }
+
+ bool hasMappedAttributes() const { return m_mappedAttributeCount > 0; }
+ void declRemoved() { m_mappedAttributeCount--; }
+ void declAdded() { m_mappedAttributeCount++; }
+
+private:
+ NamedNodeMap(Element* element)
+ : m_mappedAttributeCount(0)
+ , m_element(element)
+ {
+ }
+
+ void detachAttributesFromElement();
+ void detachFromElement();
+ Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const;
+ Attribute* getAttributeItemSlowCase(const String& name, bool shouldIgnoreAttributeCase) const;
+ void clearAttributes();
+ int declCount() const;
+
+ int m_mappedAttributeCount;
+ SpaceSplitString m_classNames;
+ Element* m_element;
+ Vector<RefPtr<Attribute> > m_attributes;
+ AtomicString m_id;
+};
+
+inline Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const
+{
+ unsigned len = length();
+ for (unsigned i = 0; i < len; ++i) {
+ if (m_attributes[i]->name().matches(name))
+ return m_attributes[i].get();
+ }
+ return 0;
+}
+
+// We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller
+// can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not).
+inline Attribute* NamedNodeMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const
+{
+ unsigned len = length();
+ bool doSlowCheck = shouldIgnoreAttributeCase;
+
+ // Optimize for the case where the attribute exists and its name exactly matches.
+ for (unsigned i = 0; i < len; ++i) {
+ const QualifiedName& attrName = m_attributes[i]->name();
+ if (!attrName.hasPrefix()) {
+ if (name == attrName.localName())
+ return m_attributes[i].get();
+ } else
+ doSlowCheck = true;
+ }
+
+ if (doSlowCheck)
+ return getAttributeItemSlowCase(name, shouldIgnoreAttributeCase);
+ return 0;
+}
+
+} // namespace WebCore
+
+#undef id
+
+#endif // NamedNodeMap_h
diff --git a/WebCore/dom/NamedNodeMap.idl b/WebCore/dom/NamedNodeMap.idl
index 7bfbf23..4d36577 100644
--- a/WebCore/dom/NamedNodeMap.idl
+++ b/WebCore/dom/NamedNodeMap.idl
@@ -28,7 +28,7 @@ module core {
Node getNamedItem(in DOMString name);
- [Custom] Node setNamedItem(in Node node)
+ Node setNamedItem(in Node node)
raises(DOMException);
Node removeNamedItem(in DOMString name)
@@ -46,7 +46,7 @@ module core {
// FIXME: the implementation does take an exceptioncode parameter.
/*raises(DOMException)*/;
- [Custom] Node setNamedItemNS(in Node node)
+ Node setNamedItemNS(in Node node)
raises(DOMException);
[OldStyleObjC] Node removeNamedItemNS(in [ConvertNullToNullString] DOMString namespaceURI,
diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp
index eb36417..a7d416a 100644
--- a/WebCore/dom/Node.cpp
+++ b/WebCore/dom/Node.cpp
@@ -31,6 +31,7 @@
#endif
#include "Attr.h"
+#include "Attribute.h"
#include "CSSParser.h"
#include "CSSRule.h"
#include "CSSRuleList.h"
@@ -58,7 +59,6 @@
#include "InspectorTimelineAgent.h"
#include "KeyboardEvent.h"
#include "Logging.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "MutationEvent.h"
#include "NameNodeList.h"
@@ -84,11 +84,11 @@
#include "WheelEvent.h"
#include "XMLNames.h"
#include "htmlediting.h"
-#include <wtf/text/CString.h>
#include <wtf/HashSet.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/RefCountedLeakCounter.h>
#include <wtf/UnusedParam.h>
+#include <wtf/text/CString.h>
#if ENABLE(DOM_STORAGE)
#include "StorageEvent.h"
@@ -152,7 +152,6 @@ void Node::dumpStatistics()
size_t mappedAttributesWithStyleDecl = 0;
size_t attributesWithAttr = 0;
size_t attrMaps = 0;
- size_t mappedAttrMaps = 0;
for (HashSet<Node*>::iterator it = liveNodeSet.begin(); it != liveNodeSet.end(); ++it) {
Node* node = *it;
@@ -174,8 +173,6 @@ void Node::dumpStatistics()
if (NamedNodeMap* attrMap = element->attributes(true)) {
attributes += attrMap->length();
++attrMaps;
- if (attrMap->isMappedAttributeMap())
- ++mappedAttrMaps;
for (unsigned i = 0; i < attrMap->length(); ++i) {
Attribute* attr = attrMap->attributeItem(i);
if (attr->attr())
@@ -238,7 +235,6 @@ void Node::dumpStatistics()
break;
}
}
-
}
printf("Number of Nodes: %d\n\n", liveNodeSet.size());
@@ -265,11 +261,10 @@ void Node::dumpStatistics()
printf("Attribute Maps:\n");
printf(" Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes, sizeof(Attribute));
- printf(" Number of MappedAttributes: %zu [%zu]\n", mappedAttributes, sizeof(MappedAttribute));
- printf(" Number of MappedAttributes with a StyleDeclaration: %zu\n", mappedAttributesWithStyleDecl);
+ printf(" Number of Attributes that are mapped: %zu\n", mappedAttributes);
+ printf(" Number of Attributes with a StyleDeclaration: %zu\n", mappedAttributesWithStyleDecl);
printf(" Number of Attributes with an Attr: %zu\n", attributesWithAttr);
- printf(" Number of NamedNodeMaps: %zu\n", attrMaps);
- printf(" Number of NamedMappedAttrMap: %zu\n", mappedAttrMaps);
+ printf(" Number of NamedNodeMaps: %zu [%zu]\n", attrMaps, sizeof(NamedNodeMap));
#endif
}
diff --git a/WebCore/dom/Node.idl b/WebCore/dom/Node.idl
index 7bc6d1d..2db9c27 100644
--- a/WebCore/dom/Node.idl
+++ b/WebCore/dom/Node.idl
@@ -51,7 +51,7 @@ module core {
readonly attribute [ConvertNullStringTo=Null] DOMString nodeName;
// FIXME: the spec says this can also raise on retrieval.
- attribute [CustomSetter, ConvertNullStringTo=Null, ConvertNullToNullString] DOMString nodeValue
+ attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString nodeValue
setter raises(DOMException);
readonly attribute unsigned short nodeType;
@@ -96,7 +96,7 @@ module core {
readonly attribute [ConvertNullStringTo=Null] DOMString baseURI;
// FIXME: the spec says this can also raise on retrieval.
- attribute [CustomSetter, ConvertNullStringTo=Null, ConvertNullToNullString] DOMString textContent
+ attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString textContent
setter raises(DOMException);
boolean isSameNode(in Node other);
diff --git a/WebCore/dom/Position.h b/WebCore/dom/Position.h
index 591b0e6..ce06f48 100644
--- a/WebCore/dom/Position.h
+++ b/WebCore/dom/Position.h
@@ -117,6 +117,7 @@ public:
bool isNull() const { return !m_anchorNode; }
bool isNotNull() const { return m_anchorNode; }
+ bool isOrphan() const { return m_anchorNode && !m_anchorNode->inDocument(); }
Element* element() const;
PassRefPtr<CSSComputedStyleDeclaration> computedStyle() const;
diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp
index 22d6981..b457f5d 100644
--- a/WebCore/dom/ScriptElement.cpp
+++ b/WebCore/dom/ScriptElement.cpp
@@ -32,9 +32,11 @@
#include "HTMLNames.h"
#include "HTMLScriptElement.h"
#include "MIMETypeRegistry.h"
+#include "Page.h"
#include "ScriptController.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
+#include "Settings.h"
#include "StringHash.h"
#include "Text.h"
#include <wtf/StdLibExtras.h>
@@ -82,12 +84,28 @@ void ScriptElement::childrenChanged(ScriptElementData& data)
data.evaluateScript(ScriptSourceCode(data.scriptContent(), element->document()->url())); // FIXME: Provide a real starting line number here
}
+static inline bool useHTML5Parser(Document* document)
+{
+ ASSERT(document);
+ Settings* settings = document->page() ? document->page()->settings() : 0;
+ return settings && settings->html5ParserEnabled();
+}
+
void ScriptElement::finishParsingChildren(ScriptElementData& data, const String& sourceUrl)
{
// The parser just reached </script>. If we have no src and no text,
// allow dynamic loading later.
if (sourceUrl.isEmpty() && data.scriptContent().isEmpty())
data.setCreatedByParser(false);
+ // HTML5 Requires that we execute scripts from the parser, not from
+ // HTMLTokenizer like we currently do.
+ // FIXME: It may not be safe to execute scripts from here if
+ // HTMLParser::popOneBlockCommon is not reentrant.
+ else if (useHTML5Parser(data.element()->document())) {
+ // This is currently an incomplete implementation, see:
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#parsing-main-incdata
+ data.evaluateScript(ScriptSourceCode(data.scriptContent(), data.element()->document()->url())); // FIXME: Provide a real starting line number here
+ }
}
void ScriptElement::handleSourceAttribute(ScriptElementData& data, const String& sourceUrl)
diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp
index fb7d9a6..c7052b3 100644
--- a/WebCore/dom/SelectElement.cpp
+++ b/WebCore/dom/SelectElement.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "SelectElement.h"
+#include "Attribute.h"
#include "CharacterNames.h"
#include "Chrome.h"
#include "ChromeClient.h"
@@ -30,11 +31,10 @@
#include "FormDataList.h"
#include "Frame.h"
#include "HTMLFormElement.h"
-#include "HTMLNames.h"
#include "HTMLKeygenElement.h"
+#include "HTMLNames.h"
#include "HTMLSelectElement.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "OptionElement.h"
#include "OptionGroupElement.h"
@@ -443,7 +443,7 @@ void SelectElement::restoreFormControlState(SelectElementData& data, Element* el
setOptionsChangedOnRenderer(data, element);
}
-void SelectElement::parseMultipleAttribute(SelectElementData& data, Element* element, MappedAttribute* attribute)
+void SelectElement::parseMultipleAttribute(SelectElementData& data, Element* element, Attribute* attribute)
{
bool oldUsesMenuList = data.usesMenuList();
data.setMultiple(!attribute->isNull());
diff --git a/WebCore/dom/SelectElement.h b/WebCore/dom/SelectElement.h
index 6db841e..493bee5 100644
--- a/WebCore/dom/SelectElement.h
+++ b/WebCore/dom/SelectElement.h
@@ -27,12 +27,12 @@
namespace WebCore {
+class Attribute;
class Element;
class Event;
class FormDataList;
class HTMLFormElement;
class KeyboardEvent;
-class MappedAttribute;
class SelectElementData;
class String;
@@ -89,7 +89,7 @@ protected:
static void deselectItems(SelectElementData&, Element*, Element* excludeElement = 0);
static bool saveFormControlState(const SelectElementData&, const Element*, String& state);
static void restoreFormControlState(SelectElementData&, Element*, const String& state);
- static void parseMultipleAttribute(SelectElementData&, Element*, MappedAttribute*);
+ static void parseMultipleAttribute(SelectElementData&, Element*, Attribute*);
static bool appendFormData(SelectElementData&, Element*, FormDataList&);
static void reset(SelectElementData&, Element*);
static void defaultEventHandler(SelectElementData&, Element*, Event*);
diff --git a/WebCore/dom/StyleElement.cpp b/WebCore/dom/StyleElement.cpp
index f881179..a323e16 100644
--- a/WebCore/dom/StyleElement.cpp
+++ b/WebCore/dom/StyleElement.cpp
@@ -21,9 +21,9 @@
#include "config.h"
#include "StyleElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "Element.h"
-#include "MappedAttribute.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp
index cd5f863..34a593c 100644
--- a/WebCore/dom/StyledElement.cpp
+++ b/WebCore/dom/StyledElement.cpp
@@ -24,12 +24,12 @@
#include "config.h"
#include "StyledElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
#include "CSSStyleSheet.h"
#include "CSSValueKeywords.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include <wtf/HashFunctions.h>
using namespace std;
@@ -118,7 +118,7 @@ StyledElement::~StyledElement()
PassRefPtr<Attribute> StyledElement::createAttribute(const QualifiedName& name, const AtomicString& value)
{
- return MappedAttribute::create(name, value);
+ return Attribute::createMapped(name, value);
}
void StyledElement::createInlineStyleDecl()
@@ -145,9 +145,8 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls)
return;
}
- MappedAttribute* mappedAttr = static_cast<MappedAttribute*>(attr);
- if (mappedAttr->decl() && !preserveDecls) {
- mappedAttr->setDecl(0);
+ if (attr->decl() && !preserveDecls) {
+ attr->setDecl(0);
setNeedsStyleRecalc();
if (namedAttrMap)
mappedAttributes()->declRemoved();
@@ -157,17 +156,16 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls)
MappedAttributeEntry entry;
bool needToParse = mapToEntry(attr->name(), entry);
if (preserveDecls) {
- if (mappedAttr->decl()) {
+ if (attr->decl()) {
setNeedsStyleRecalc();
if (namedAttrMap)
mappedAttributes()->declAdded();
checkDecl = false;
}
- }
- else if (!attr->isNull() && entry != eNone) {
+ } else if (!attr->isNull() && entry != eNone) {
CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(entry, attr);
if (decl) {
- mappedAttr->setDecl(decl);
+ attr->setDecl(decl);
setNeedsStyleRecalc();
if (namedAttrMap)
mappedAttributes()->declAdded();
@@ -182,17 +180,17 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls)
// If that changes for some reason moving between documents will be buggy.
// webarchive/adopt-attribute-styled-node-webarchive.html should catch any resulting crashes.
if (needToParse)
- parseMappedAttribute(mappedAttr);
+ parseMappedAttribute(attr);
if (entry == eNone)
recalcStyleIfNeededAfterAttributeChanged(attr);
- if (checkDecl && mappedAttr->decl()) {
+ if (checkDecl && attr->decl()) {
// Add the decl to the table in the appropriate spot.
- setMappedAttributeDecl(entry, attr, mappedAttr->decl());
- mappedAttr->decl()->setMappedState(entry, attr->name(), attr->value());
- mappedAttr->decl()->setParent(0);
- mappedAttr->decl()->setNode(0);
+ setMappedAttributeDecl(entry, attr, attr->decl());
+ attr->decl()->setMappedState(entry, attr->name(), attr->value());
+ attr->decl()->setParent(0);
+ attr->decl()->setNode(0);
if (namedAttrMap)
mappedAttributes()->declAdded();
}
@@ -227,7 +225,7 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString)
dispatchSubtreeModifiedEvent();
}
-void StyledElement::parseMappedAttribute(MappedAttribute *attr)
+void StyledElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == idAttributeName()) {
// unique id
@@ -253,11 +251,6 @@ void StyledElement::parseMappedAttribute(MappedAttribute *attr)
}
}
-void StyledElement::createAttributeMap() const
-{
- namedAttrMap = NamedMappedAttrMap::create(const_cast<StyledElement*>(this));
-}
-
CSSMutableStyleDeclaration* StyledElement::getInlineStyleDecl()
{
if (!m_inlineStyleDecl)
@@ -270,25 +263,25 @@ CSSStyleDeclaration* StyledElement::style()
return getInlineStyleDecl();
}
-void StyledElement::addCSSProperty(MappedAttribute* attr, int id, const String &value)
+void StyledElement::addCSSProperty(Attribute* attr, int id, const String &value)
{
if (!attr->decl()) createMappedDecl(attr);
attr->decl()->setProperty(id, value, false);
}
-void StyledElement::addCSSProperty(MappedAttribute* attr, int id, int value)
+void StyledElement::addCSSProperty(Attribute* attr, int id, int value)
{
if (!attr->decl()) createMappedDecl(attr);
attr->decl()->setProperty(id, value, false);
}
-void StyledElement::addCSSImageProperty(MappedAttribute* attr, int id, const String& url)
+void StyledElement::addCSSImageProperty(Attribute* attr, int id, const String& url)
{
if (!attr->decl()) createMappedDecl(attr);
attr->decl()->setImageProperty(id, url, false);
}
-void StyledElement::addCSSLength(MappedAttribute* attr, int id, const String &value)
+void StyledElement::addCSSLength(Attribute* attr, int id, const String &value)
{
// FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct
// length unit and make the appropriate parsed value.
@@ -325,7 +318,7 @@ void StyledElement::addCSSLength(MappedAttribute* attr, int id, const String &va
}
/* color parsing that tries to match as close as possible IE 6. */
-void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c)
+void StyledElement::addCSSColor(Attribute* attr, int id, const String& c)
{
// this is the only case no color gets applied in IE.
if (!c.length())
@@ -397,7 +390,7 @@ void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c)
attr->decl()->setProperty(id, CSSValueBlack, false);
}
-void StyledElement::createMappedDecl(MappedAttribute* attr)
+void StyledElement::createMappedDecl(Attribute* attr)
{
RefPtr<CSSMappedAttributeDeclaration> decl = CSSMappedAttributeDeclaration::create();
attr->setDecl(decl);
diff --git a/WebCore/dom/StyledElement.h b/WebCore/dom/StyledElement.h
index 279282c..6facce7 100644
--- a/WebCore/dom/StyledElement.h
+++ b/WebCore/dom/StyledElement.h
@@ -29,28 +29,28 @@
#include "CSSPrimitiveValue.h"
#include "Element.h"
#include "MappedAttributeEntry.h"
-#include "NamedMappedAttrMap.h"
+#include "NamedNodeMap.h"
namespace WebCore {
+class Attribute;
class CSSMappedAttributeDeclaration;
-class MappedAttribute;
class StyledElement : public Element {
public:
virtual ~StyledElement();
- NamedMappedAttrMap* mappedAttributes() { return static_cast<NamedMappedAttrMap*>(namedAttrMap.get()); }
- const NamedMappedAttrMap* mappedAttributes() const { return static_cast<NamedMappedAttrMap*>(namedAttrMap.get()); }
+ NamedNodeMap* mappedAttributes() { return namedAttrMap.get(); }
+ const NamedNodeMap* mappedAttributes() const { return namedAttrMap.get(); }
bool hasMappedAttributes() const { return namedAttrMap && mappedAttributes()->hasMappedAttributes(); }
bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; }
- void addCSSLength(MappedAttribute*, int id, const String& value);
- void addCSSProperty(MappedAttribute*, int id, const String& value);
- void addCSSProperty(MappedAttribute*, int id, int value);
- void addCSSImageProperty(MappedAttribute*, int propertyID, const String& url);
- void addCSSColor(MappedAttribute*, int id, const String& color);
+ void addCSSLength(Attribute*, int id, const String& value);
+ void addCSSProperty(Attribute*, int id, const String& value);
+ void addCSSProperty(Attribute*, int id, int value);
+ void addCSSImageProperty(Attribute*, int propertyID, const String& url);
+ void addCSSColor(Attribute*, int id, const String& color);
static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value);
static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*);
@@ -79,7 +79,7 @@ protected:
}
virtual void attributeChanged(Attribute*, bool preserveDecls = false);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void copyNonAttributeProperties(const Element*);
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
@@ -92,14 +92,12 @@ protected:
virtual void didMoveToNewOwnerDocument();
private:
- void createMappedDecl(MappedAttribute*);
+ void createMappedDecl(Attribute*);
void createInlineStyleDecl();
void destroyInlineStyleDecl();
virtual void updateStyleAttribute() const;
- virtual void createAttributeMap() const;
-
RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl;
};
diff --git a/WebCore/dom/Tokenizer.h b/WebCore/dom/Tokenizer.h
index 939ac70..d6ac1a8 100644
--- a/WebCore/dom/Tokenizer.h
+++ b/WebCore/dom/Tokenizer.h
@@ -29,6 +29,9 @@ namespace WebCore {
class SegmentedString;
class XSSAuditor;
+ // FIXME: This class should renamed DocumentParser or similar to express
+ // that it does more than tokenizing. It manages the lifetime of of the
+ // parser as well as handles various tag-handling hacks for HTML/XML.
class Tokenizer : public Noncopyable {
public:
virtual ~Tokenizer() { }
diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp
index 529d9d3..c50c988 100644
--- a/WebCore/editing/ApplyStyleCommand.cpp
+++ b/WebCore/editing/ApplyStyleCommand.cpp
@@ -416,7 +416,7 @@ static const int editingStyleProperties[] = {
};
size_t numEditingStyleProperties = sizeof(editingStyleProperties)/sizeof(editingStyleProperties[0]);
-PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle)
+PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle)
{
RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = pos.computedStyle();
RefPtr<CSSMutableStyleDeclaration> style;
@@ -454,7 +454,7 @@ void prepareEditingStyleToApplyAt(CSSMutableStyleDeclaration* editingStyle, Posi
// ReplaceSelectionCommand::handleStyleSpans() requires that this function only removes the editing style.
// If this function was modified in the future to delete all redundant properties, then add a boolean value to indicate
// which one of editingStyleAtPosition or computedStyle is called.
- RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(pos);
+ RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(pos);
style->diff(editingStyle);
// if alpha value is zero, we don't add the background color.
@@ -472,8 +472,8 @@ void removeStylesAddedByNode(CSSMutableStyleDeclaration* editingStyle, Node* nod
{
ASSERT(node);
ASSERT(node->parentNode());
- RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleAtPosition(Position(node->parentNode(), 0));
- RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(Position(node, 0));
+ RefPtr<CSSMutableStyleDeclaration> parentStyle = ApplyStyleCommand::editingStyleAtPosition(Position(node->parentNode(), 0));
+ RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(Position(node, 0));
parentStyle->diff(style.get());
style->diff(editingStyle);
}
@@ -619,7 +619,11 @@ void ApplyStyleCommand::applyBlockStyle(CSSMutableStyleDeclaration *style)
if (!m_removeOnly)
addBlockStyle(styleChange, static_cast<HTMLElement*>(block.get()));
}
+
+ if (nextParagraphStart.isOrphan())
+ nextParagraphStart = endOfParagraph(paragraphStart).next();
}
+
paragraphStart = nextParagraphStart;
nextParagraphStart = endOfParagraph(paragraphStart).next();
}
@@ -1753,10 +1757,10 @@ void ApplyStyleCommand::addBlockStyle(const StyleChange& styleChange, HTMLElemen
setNodeAttribute(block, styleAttr, cssText);
}
-static bool fontColorChangesComputedStyle(RenderStyle* computedStyle, StyleChange styleChange)
+static bool fontColorChangesComputedStyle(const Color& computedStyleColor, StyleChange styleChange)
{
if (styleChange.applyFontColor()) {
- if (Color(styleChange.fontColor()) != computedStyle->color())
+ if (Color(styleChange.fontColor()) != computedStyleColor)
return true;
}
return false;
@@ -1797,7 +1801,7 @@ void ApplyStyleCommand::addInlineStyleIfNeeded(CSSMutableStyleDeclaration *style
// We only want to insert a font element if it will end up changing the style of the
// text somehow. Otherwise it will be a garbage node that will create problems for us
// most notably when we apply a blockquote style for a message reply.
- if (fontColorChangesComputedStyle(computedStyle, styleChange)
+ if (fontColorChangesComputedStyle(computedStyle->color(), styleChange)
|| fontFaceChangesComputedStyle(computedStyle, styleChange)
|| fontSizeChangesComputedStyle(computedStyle, styleChange)) {
if (styleChange.applyFontColor())
diff --git a/WebCore/editing/ApplyStyleCommand.h b/WebCore/editing/ApplyStyleCommand.h
index 2804604..8326329 100644
--- a/WebCore/editing/ApplyStyleCommand.h
+++ b/WebCore/editing/ApplyStyleCommand.h
@@ -34,6 +34,11 @@ class CSSPrimitiveValue;
class HTMLElement;
class StyleChange;
+enum ShouldIncludeTypingStyle {
+ IncludeTypingStyle,
+ IgnoreTypingStyle
+};
+
class ApplyStyleCommand : public CompositeEditCommand {
public:
enum EPropertyLevel { PropertyDefault, ForceBlockProperties };
@@ -50,6 +55,8 @@ public:
{
return adoptRef(new ApplyStyleCommand(element, removeOnly, action));
}
+
+ static PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle = IgnoreTypingStyle);
private:
ApplyStyleCommand(Document*, CSSStyleDeclaration*, EditAction, EPropertyLevel);
@@ -117,12 +124,6 @@ bool isStyleSpan(const Node*);
PassRefPtr<HTMLElement> createStyleSpanElement(Document*);
RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDeclaration* style, CSSComputedStyleDeclaration* computedStyle);
-enum ShouldIncludeTypingStyle {
- IncludeTypingStyle,
- IgnoreTypingStyle
-};
-
-PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position, ShouldIncludeTypingStyle = IgnoreTypingStyle);
void prepareEditingStyleToApplyAt(CSSMutableStyleDeclaration*, Position);
void removeStylesAddedByNode(CSSMutableStyleDeclaration*, Node*);
diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp
index 9dc918d..e33f143 100644
--- a/WebCore/editing/CompositeEditCommand.cpp
+++ b/WebCore/editing/CompositeEditCommand.cpp
@@ -940,7 +940,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
// too, <div><b><br></b></div> for example. Save it so that we can preserve it later.
RefPtr<CSSMutableStyleDeclaration> styleInEmptyParagraph;
if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) {
- styleInEmptyParagraph = editingStyleAtPosition(startOfParagraphToMove.deepEquivalent(), IncludeTypingStyle);
+ styleInEmptyParagraph = ApplyStyleCommand::editingStyleAtPosition(startOfParagraphToMove.deepEquivalent(), IncludeTypingStyle);
// The moved paragraph should assume the block style of the destination.
styleInEmptyParagraph->removeBlockProperties();
}
@@ -1003,7 +1003,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
if (!emptyListItem)
return false;
- RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(endingSelection().start(), IncludeTypingStyle);
+ RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(endingSelection().start(), IncludeTypingStyle);
Node* listNode = emptyListItem->parentNode();
// FIXME: Can't we do something better when the immediate parent wasn't a list node?
diff --git a/WebCore/editing/DeleteButtonController.cpp b/WebCore/editing/DeleteButtonController.cpp
index d999f84..24c8270 100644
--- a/WebCore/editing/DeleteButtonController.cpp
+++ b/WebCore/editing/DeleteButtonController.cpp
@@ -133,7 +133,7 @@ static bool isDeletableElement(const Node* node)
if (!parentStyle)
return false;
- if (style->hasBackground() && (!parentStyle->hasBackground() || style->backgroundColor() != parentStyle->backgroundColor()))
+ if (renderer->hasBackground() && (!parentRenderer->hasBackground() || style->visitedDependentColor(CSSPropertyBackgroundColor) != parentStyle->visitedDependentColor(CSSPropertyBackgroundColor)))
return true;
}
diff --git a/WebCore/editing/DeleteSelectionCommand.cpp b/WebCore/editing/DeleteSelectionCommand.cpp
index 5e81d50..623b188 100644
--- a/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/WebCore/editing/DeleteSelectionCommand.cpp
@@ -294,14 +294,14 @@ void DeleteSelectionCommand::saveTypingStyleState()
return;
// Figure out the typing style in effect before the delete is done.
- m_typingStyle = editingStyleAtPosition(positionBeforeTabSpan(m_selectionToDelete.start()));
+ m_typingStyle = ApplyStyleCommand::editingStyleAtPosition(positionBeforeTabSpan(m_selectionToDelete.start()));
removeEnclosingAnchorStyle(m_typingStyle.get(), m_selectionToDelete.start());
// If we're deleting into a Mail blockquote, save the style at end() instead of start()
// We'll use this later in computeTypingStyleAfterDelete if we end up outside of a Mail blockquote
if (nearestMailBlockquote(m_selectionToDelete.start().node()))
- m_deleteIntoBlockquoteStyle = editingStyleAtPosition(m_selectionToDelete.end());
+ m_deleteIntoBlockquoteStyle = ApplyStyleCommand::editingStyleAtPosition(m_selectionToDelete.end());
else
m_deleteIntoBlockquoteStyle = 0;
}
diff --git a/WebCore/editing/IndentOutdentCommand.cpp b/WebCore/editing/IndentOutdentCommand.cpp
index 0f3975b..9830ca0 100644
--- a/WebCore/editing/IndentOutdentCommand.cpp
+++ b/WebCore/editing/IndentOutdentCommand.cpp
@@ -75,12 +75,8 @@ bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCu
if (!listNode)
return false;
- // Find the list item enclosing the current paragraph
+ // Find the block that we want to indent. If it's not a list item (e.g., a div inside a list item), we bail out.
Element* selectedListItem = static_cast<Element*>(enclosingBlock(lastNodeInSelectedParagraph));
- // FIXME: enclosingBlock shouldn't return the passed in element. See the
- // comment on the function about how to fix rather than having to adjust here.
- if (selectedListItem == lastNodeInSelectedParagraph)
- selectedListItem = static_cast<Element*>(enclosingBlock(lastNodeInSelectedParagraph->parentNode()));
// FIXME: we need to deal with the case where there is no li (malformed HTML)
if (!selectedListItem->hasTagName(liTag))
@@ -117,7 +113,7 @@ void IndentOutdentCommand::indentIntoBlockquote(const VisiblePosition& endOfCurr
else
nodeToSplitTo = editableRootForPosition(start);
- RefPtr<Node> outerBlock = splitTreeToNode(start.node(), nodeToSplitTo);
+ RefPtr<Node> outerBlock = (start.node() == nodeToSplitTo) ? start.node() : splitTreeToNode(start.node(), nodeToSplitTo);
if (!targetBlockquote) {
// Create a new blockquote and insert it as a child of the root editable element. We accomplish
diff --git a/WebCore/editing/InsertParagraphSeparatorCommand.cpp b/WebCore/editing/InsertParagraphSeparatorCommand.cpp
index affb639..47c6efd 100644
--- a/WebCore/editing/InsertParagraphSeparatorCommand.cpp
+++ b/WebCore/editing/InsertParagraphSeparatorCommand.cpp
@@ -82,7 +82,7 @@ void InsertParagraphSeparatorCommand::calculateStyleBeforeInsertion(const Positi
if (!isStartOfParagraph(visiblePos) && !isEndOfParagraph(visiblePos))
return;
- m_style = editingStyleAtPosition(pos, IncludeTypingStyle);
+ m_style = ApplyStyleCommand::editingStyleAtPosition(pos, IncludeTypingStyle);
}
void InsertParagraphSeparatorCommand::applyStyleAfterInsertion(Node* originalEnclosingBlock)
diff --git a/WebCore/editing/RemoveFormatCommand.cpp b/WebCore/editing/RemoveFormatCommand.cpp
index 9243adc..e456df6 100644
--- a/WebCore/editing/RemoveFormatCommand.cpp
+++ b/WebCore/editing/RemoveFormatCommand.cpp
@@ -56,7 +56,7 @@ void RemoveFormatCommand::doApply()
// Get the default style for this editable root, it's the style that we'll give the
// content that we're operating on.
Node* root = frame->selection()->rootEditableElement();
- RefPtr<CSSMutableStyleDeclaration> defaultStyle = editingStyleAtPosition(Position(root, 0));
+ RefPtr<CSSMutableStyleDeclaration> defaultStyle = ApplyStyleCommand::editingStyleAtPosition(Position(root, 0));
// Delete the selected content.
// FIXME: We should be able to leave this to insertText, but its delete operation
diff --git a/WebCore/editing/ReplaceNodeWithSpanCommand.cpp b/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
index 0874201..c3b6b89 100644
--- a/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
+++ b/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
@@ -34,7 +34,6 @@
#include "htmlediting.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
-#include "NamedAttrMap.h"
#include <wtf/Assertions.h>
diff --git a/WebCore/editing/ReplaceSelectionCommand.cpp b/WebCore/editing/ReplaceSelectionCommand.cpp
index e4acf85..2f0bddf 100644
--- a/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -577,7 +577,7 @@ static bool handleStyleSpansBeforeInsertion(ReplacementFragment& fragment, const
Node* sourceDocumentStyleSpan = topNode;
RefPtr<Node> copiedRangeStyleSpan = sourceDocumentStyleSpan->firstChild();
- RefPtr<CSSMutableStyleDeclaration> styleAtInsertionPos = editingStyleAtPosition(rangeCompliantEquivalent(insertionPos));
+ RefPtr<CSSMutableStyleDeclaration> styleAtInsertionPos = ApplyStyleCommand::editingStyleAtPosition(rangeCompliantEquivalent(insertionPos));
String styleText = styleAtInsertionPos->cssText();
@@ -634,8 +634,8 @@ void ReplaceSelectionCommand::handleStyleSpans()
// styles from blockquoteNode are allowed to override those from the source document, see <rdar://problem/4930986> and <rdar://problem/5089327>.
Node* blockquoteNode = isMailPasteAsQuotationNode(context) ? context : nearestMailBlockquote(context);
if (blockquoteNode) {
- RefPtr<CSSMutableStyleDeclaration> blockquoteStyle = editingStyleAtPosition(Position(blockquoteNode, 0));
- RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleAtPosition(Position(blockquoteNode->parentNode(), 0));
+ RefPtr<CSSMutableStyleDeclaration> blockquoteStyle = ApplyStyleCommand::editingStyleAtPosition(Position(blockquoteNode, 0));
+ RefPtr<CSSMutableStyleDeclaration> parentStyle = ApplyStyleCommand::editingStyleAtPosition(Position(blockquoteNode->parentNode(), 0));
parentStyle->diff(blockquoteStyle.get());
CSSMutableStyleDeclaration::const_iterator end = blockquoteStyle->end();
@@ -794,7 +794,7 @@ void ReplaceSelectionCommand::doApply()
return;
if (m_matchStyle)
- m_insertionStyle = editingStyleAtPosition(selection.start(), IncludeTypingStyle);
+ m_insertionStyle = ApplyStyleCommand::editingStyleAtPosition(selection.start(), IncludeTypingStyle);
VisiblePosition visibleStart = selection.visibleStart();
VisiblePosition visibleEnd = selection.visibleEnd();
diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp
index 002226d..db0e04d 100644
--- a/WebCore/editing/SelectionController.cpp
+++ b/WebCore/editing/SelectionController.cpp
@@ -1082,7 +1082,7 @@ void SelectionController::paintCaret(GraphicsContext* context, int tx, int ty, c
ColorSpace colorSpace = DeviceColorSpace;
Element* element = rootEditableElement();
if (element && element->renderer()) {
- caretColor = element->renderer()->style()->color();
+ caretColor = element->renderer()->style()->visitedDependentColor(CSSPropertyColor);
colorSpace = element->renderer()->style()->colorSpace();
}
diff --git a/WebCore/editing/VisiblePosition.h b/WebCore/editing/VisiblePosition.h
index d888806..fe795a1 100644
--- a/WebCore/editing/VisiblePosition.h
+++ b/WebCore/editing/VisiblePosition.h
@@ -61,6 +61,7 @@ public:
bool isNull() const { return m_deepPosition.isNull(); }
bool isNotNull() const { return m_deepPosition.isNotNull(); }
+ bool isOrphan() const { return m_deepPosition.isOrphan(); }
Position deepEquivalent() const { return m_deepPosition; }
EAffinity affinity() const { ASSERT(m_affinity == UPSTREAM || m_affinity == DOWNSTREAM); return m_affinity; }
diff --git a/WebCore/editing/brew/EditorBrew.cpp b/WebCore/editing/brew/EditorBrew.cpp
new file mode 100644
index 0000000..b610b62
--- /dev/null
+++ b/WebCore/editing/brew/EditorBrew.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Editor.h"
+
+#include "ClipboardBrew.h"
+
+namespace WebCore {
+
+PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
+{
+ return new ClipboardBrew(policy, false);
+}
+
+} // namespace WebCore
diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp
index 606f141..46f0e94 100644
--- a/WebCore/editing/markup.cpp
+++ b/WebCore/editing/markup.cpp
@@ -49,6 +49,7 @@
#include "HTMLElement.h"
#include "HTMLNames.h"
#include "InlineTextBox.h"
+#include "KURL.h"
#include "Logging.h"
#include "ProcessingInstruction.h"
#include "QualifiedName.h"
@@ -1018,7 +1019,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
// Add a wrapper span with the styles that all of the nodes in the markup inherit.
Node* parentOfLastClosed = lastClosed ? lastClosed->parentNode() : 0;
if (parentOfLastClosed && parentOfLastClosed->renderer()) {
- RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(Position(parentOfLastClosed, 0));
+ RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(Position(parentOfLastClosed, 0));
// Styles that Mail blockquotes contribute should only be placed on the Mail blockquote, to help
// us differentiate those styles from ones that the user has applied. This helps us
@@ -1042,7 +1043,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
// Add a style span with the document's default styles. We add these in a separate
// span so that at paste time we can differentiate between document defaults and user
// applied styles.
- RefPtr<CSSMutableStyleDeclaration> defaultStyle = editingStyleAtPosition(Position(document->documentElement(), 0));
+ RefPtr<CSSMutableStyleDeclaration> defaultStyle = ApplyStyleCommand::editingStyleAtPosition(Position(document->documentElement(), 0));
if (defaultStyle->length() > 0)
addStyleMarkup(preMarkups, markups, defaultStyle.get(), document);
@@ -1287,4 +1288,15 @@ String createFullMarkup(const Range* range)
return frame->documentTypeString() + createMarkup(range, 0, AnnotateForInterchange);
}
+String urlToMarkup(const KURL& url, const String& title)
+{
+ Vector<UChar> markup;
+ append(markup, "<a href=\"");
+ append(markup, url.string());
+ append(markup, "\">");
+ appendEscapedContent(markup, make_pair(title.characters(), title.length()), false);
+ append(markup, "</a>");
+ return String::adopt(markup);
+}
+
}
diff --git a/WebCore/editing/markup.h b/WebCore/editing/markup.h
index 5ace04a..dd34159 100644
--- a/WebCore/editing/markup.h
+++ b/WebCore/editing/markup.h
@@ -35,6 +35,7 @@ namespace WebCore {
class Document;
class DocumentFragment;
+ class KURL;
class Node;
class Range;
class String;
@@ -54,6 +55,7 @@ namespace WebCore {
String createFullMarkup(const Node*);
String createFullMarkup(const Range*);
+ String urlToMarkup(const KURL&, const String& title);
}
#endif // markup_h
diff --git a/WebCore/html/FileReader.cpp b/WebCore/html/FileReader.cpp
index 69e01ce..3442342 100644
--- a/WebCore/html/FileReader.cpp
+++ b/WebCore/html/FileReader.cpp
@@ -41,6 +41,7 @@
#include "Logging.h"
#include "ProgressEvent.h"
#include "ScriptExecutionContext.h"
+#include "TextResourceDecoder.h"
#include <wtf/CurrentTime.h>
namespace WebCore {
@@ -50,14 +51,13 @@ const double progressNotificationIntervalMS = 50;
FileReader::FileReader(ScriptExecutionContext* context)
: ActiveDOMObject(context, this)
- , m_state(Empty)
+ , m_state(None)
, m_readType(ReadFileAsBinaryString)
, m_result("")
, m_isRawDataConverted(false)
, m_bytesLoaded(0)
, m_totalBytes(0)
, m_lastProgressNotificationTimeMS(0)
- , m_alreadyStarted(false)
{
m_buffer.resize(bufferSize);
}
@@ -69,7 +69,7 @@ FileReader::~FileReader()
bool FileReader::hasPendingActivity() const
{
- return m_state == Loading || ActiveDOMObject::hasPendingActivity();
+ return (m_state != None && m_state != Completed) || ActiveDOMObject::hasPendingActivity();
}
bool FileReader::canSuspend() const
@@ -110,11 +110,12 @@ void FileReader::readAsDataURL(File* file)
void FileReader::readInternal(Blob* fileBlob, ReadType type)
{
// readAs*** methods() can be called multiple times. Only the last call before the actual reading happens is processed.
- if (m_alreadyStarted)
+ if (m_state != None && m_state != Starting)
return;
m_fileBlob = fileBlob;
m_readType = type;
+ m_state = Starting;
// When FileStreamProxy is created, FileReader::didStart() will get notified on the File thread and we will start
// opening and reading the file since then.
@@ -142,18 +143,18 @@ void FileReader::terminate()
m_streamProxy->stop();
m_streamProxy = 0;
}
- m_state = Done;
+ m_state = Completed;
}
void FileReader::didStart()
{
- m_alreadyStarted = true;
+ m_state = Opening;
m_streamProxy->openForRead(m_fileBlob.get());
}
void FileReader::didGetSize(long long size)
{
- m_state = Loading;
+ m_state = Reading;
fireEvent(eventNames().loadstartEvent);
m_totalBytes = size;
@@ -165,7 +166,7 @@ void FileReader::didRead(const char* data, int bytesRead)
ASSERT(data && bytesRead);
// Bail out if we have aborted the reading.
- if (m_state == Done)
+ if (m_state == Completed)
return;
switch (m_readType) {
@@ -198,7 +199,7 @@ void FileReader::didRead(const char* data, int bytesRead)
void FileReader::didFinish()
{
- m_state = Done;
+ m_state = Completed;
m_streamProxy->close();
@@ -208,7 +209,7 @@ void FileReader::didFinish()
void FileReader::didFail(ExceptionCode ec)
{
- m_state = Done;
+ m_state = Completed;
m_error = FileError::create(ec);
m_streamProxy->close();
@@ -223,6 +224,22 @@ void FileReader::fireEvent(const AtomicString& type)
dispatchEvent(ProgressEvent::create(type, true, static_cast<unsigned>(m_bytesLoaded), static_cast<unsigned>(m_totalBytes)));
}
+FileReader::ReadyState FileReader::readyState() const
+{
+ switch (m_state) {
+ case None:
+ case Starting:
+ return Empty;
+ case Opening:
+ case Reading:
+ return Loading;
+ case Completed:
+ return Done;
+ }
+ ASSERT_NOT_REACHED();
+ return Empty;
+}
+
const ScriptString& FileReader::result()
{
// If reading as binary string, we can return the result immediately.
@@ -237,7 +254,7 @@ const ScriptString& FileReader::result()
if (m_readType == ReadFileAsText)
convertToText();
// For data URL, we only do the coversion until we receive all the raw data.
- else if (m_readType == ReadFileAsDataURL && m_state == Done)
+ else if (m_readType == ReadFileAsDataURL && m_state == Completed)
convertToDataURL();
return m_result;
@@ -250,26 +267,17 @@ void FileReader::convertToText()
return;
}
- // Try to determine the encoding if it is not provided.
- // FIXME: move the following logic to a more generic place.
- int offset = 0;
- if (!m_encoding.isValid()) {
- if (m_rawData.size() >= 2 && m_rawData[0] == '\xFE' && m_rawData[1] == '\xFF') {
- offset = 2;
- m_encoding = UTF16BigEndianEncoding();
- } else if (m_rawData.size() >= 2 && m_rawData[0] == '\xFF' && m_rawData[1] == '\xFE') {
- offset = 2;
- m_encoding = UTF16LittleEndianEncoding();
- } else if (m_rawData.size() >= 2 && m_rawData[0] == '\xEF' && m_rawData[1] == '\xBB' && m_rawData[2] == '\xBF') {
- offset = 3;
- m_encoding = UTF8Encoding();
- } else
- m_encoding = UTF8Encoding();
- }
-
// Decode the data.
+ // The File API spec says that we should use the supplied encoding if it is valid. However, we choose to ignore this
+ // requirement in order to be consistent with how WebKit decodes the web content: always has the BOM override the
+ // provided encoding.
// FIXME: consider supporting incremental decoding to improve the perf.
- m_result = m_encoding.decode(&m_rawData.at(0) + offset, m_rawData.size() - offset);
+ if (!m_decoder)
+ m_decoder = TextResourceDecoder::create("text/plain", m_encoding.isValid() ? m_encoding : UTF8Encoding());
+ m_result = m_decoder->decode(&m_rawData.at(0), m_rawData.size());
+
+ if (m_state == Completed && !m_error)
+ m_result += m_decoder->flush();
}
void FileReader::convertToDataURL()
diff --git a/WebCore/html/FileReader.h b/WebCore/html/FileReader.h
index b30fad7..80d425c 100644
--- a/WebCore/html/FileReader.h
+++ b/WebCore/html/FileReader.h
@@ -51,6 +51,7 @@ class Blob;
class File;
class FileStreamProxy;
class ScriptExecutionContext;
+class TextResourceDecoder;
class FileReader : public RefCounted<FileReader>, public ActiveDOMObject, public EventTarget, public FileStreamClient {
public:
@@ -72,7 +73,7 @@ public:
void readAsDataURL(File*);
void abort();
- ReadyState readyState() const { return m_state; }
+ ReadyState readyState() const;
PassRefPtr<FileError> error() { return m_error; }
const ScriptString& result();
@@ -108,6 +109,13 @@ private:
ReadFileAsText,
ReadFileAsDataURL
};
+ enum InternalState {
+ None,
+ Starting,
+ Opening,
+ Reading,
+ Completed
+ };
FileReader(ScriptExecutionContext*);
@@ -123,11 +131,12 @@ private:
void convertToText();
void convertToDataURL();
- ReadyState m_state;
+ InternalState m_state;
EventTargetData m_eventTargetData;
RefPtr<Blob> m_fileBlob;
ReadType m_readType;
+ TextEncoding m_encoding;
// Like XMLHttpRequest.m_responseText, we keep this as a ScriptString, not a WebCore::String.
// That's because these strings can easily get huge (they are filled from the file) and
@@ -141,8 +150,8 @@ private:
Vector<char> m_rawData;
bool m_isRawDataConverted;
- // Encoding scheme used to decode the data.
- TextEncoding m_encoding;
+ // The decoder used to decode the text data.
+ RefPtr<TextResourceDecoder> m_decoder;
// Needed to create data URL.
String m_fileType;
@@ -153,7 +162,6 @@ private:
long long m_bytesLoaded;
long long m_totalBytes;
double m_lastProgressNotificationTimeMS;
- bool m_alreadyStarted;
};
} // namespace WebCore
diff --git a/WebCore/html/FileStreamProxy.cpp b/WebCore/html/FileStreamProxy.cpp
index 6b41f32..eb99cf3 100644
--- a/WebCore/html/FileStreamProxy.cpp
+++ b/WebCore/html/FileStreamProxy.cpp
@@ -35,10 +35,10 @@
#include "FileStreamProxy.h"
#include "Blob.h"
+#include "CrossThreadTask.h"
#include "FileStream.h"
#include "FileThread.h"
#include "FileThreadTask.h"
-#include "GenericWorkerTask.h"
#include "PlatformString.h"
#include "ScriptExecutionContext.h"
diff --git a/WebCore/html/HTML5Lexer.cpp b/WebCore/html/HTML5Lexer.cpp
new file mode 100644
index 0000000..44eae83
--- /dev/null
+++ b/WebCore/html/HTML5Lexer.cpp
@@ -0,0 +1,1319 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HTML5Lexer.h"
+
+#include "AtomicString.h"
+#include "HTML5Token.h"
+#include "HTMLNames.h"
+#include "NotImplemented.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/text/CString.h>
+#include <wtf/unicode/Unicode.h>
+
+
+// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file
+#ifdef __GNUC__
+// The main tokenizer includes this too so we are getting two copies of the data. However, this way the code gets inlined.
+#include "HTMLEntityNames.c"
+#else
+// Not inlined for non-GCC compilers
+struct Entity {
+ const char* name;
+ int code;
+};
+const struct Entity* findEntity(register const char* str, register unsigned int len);
+#endif
+
+using namespace WTF;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+inline UChar toLowerCase(UChar cc)
+{
+ ASSERT(cc >= 'A' && cc <= 'Z');
+ const int lowerCaseOffset = 0x20;
+ return cc + lowerCaseOffset;
+}
+
+HTML5Lexer::HTML5Lexer()
+{
+ reset();
+}
+
+HTML5Lexer::~HTML5Lexer()
+{
+}
+
+void HTML5Lexer::reset()
+{
+ m_state = DataState;
+ m_token = 0;
+ m_emitPending = false;
+ m_additionalAllowedCharacter = '\0';
+}
+
+static inline bool isWhitespace(UChar c)
+{
+ return c == ' ' || c == '\n' || c == '\r' || c == '\t';
+}
+
+static inline unsigned legalEntityFor(unsigned value)
+{
+ // FIXME There is a table for more exceptions in the HTML5 specification.
+ if (value == 0 || value > 0x10FFFF || (value >= 0xD800 && value <= 0xDFFF))
+ return 0xFFFD;
+ return value;
+}
+
+unsigned HTML5Lexer::consumeEntity(SegmentedString& source, bool& notEnoughCharacters)
+{
+ enum EntityState {
+ Initial,
+ NumberType,
+ MaybeHex,
+ Hex,
+ Decimal,
+ Named
+ };
+ EntityState entityState = Initial;
+ unsigned result = 0;
+ Vector<UChar, 10> seenChars;
+ Vector<char, 10> entityName;
+
+ while (!source.isEmpty()) {
+ UChar cc = *source;
+ seenChars.append(cc);
+ switch (entityState) {
+ case Initial:
+ if (isWhitespace(cc) || cc == '<' || cc == '&')
+ return 0;
+ else if (cc == '#')
+ entityState = NumberType;
+ else if ((cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z')) {
+ entityName.append(cc);
+ entityState = Named;
+ } else
+ return 0;
+ break;
+ case NumberType:
+ if (cc == 'x' || cc == 'X')
+ entityState = MaybeHex;
+ else if (cc >= '0' && cc <= '9') {
+ entityState = Decimal;
+ result = cc - '0';
+ } else {
+ source.push('#');
+ return 0;
+ }
+ break;
+ case MaybeHex:
+ if (cc >= '0' && cc <= '9')
+ result = cc - '0';
+ else if (cc >= 'a' && cc <= 'f')
+ result = 10 + cc - 'a';
+ else if (cc >= 'A' && cc <= 'F')
+ result = 10 + cc - 'A';
+ else {
+ source.push('#');
+ source.push(seenChars[1]);
+ return 0;
+ }
+ entityState = Hex;
+ break;
+ case Hex:
+ if (cc >= '0' && cc <= '9')
+ result = result * 16 + cc - '0';
+ else if (cc >= 'a' && cc <= 'f')
+ result = result * 16 + 10 + cc - 'a';
+ else if (cc >= 'A' && cc <= 'F')
+ result = result * 16 + 10 + cc - 'A';
+ else if (cc == ';') {
+ source.advance();
+ return legalEntityFor(result);
+ } else
+ return legalEntityFor(result);
+ break;
+ case Decimal:
+ if (cc >= '0' && cc <= '9')
+ result = result * 10 + cc - '0';
+ else if (cc == ';') {
+ source.advance();
+ return legalEntityFor(result);
+ } else
+ return legalEntityFor(result);
+ break;
+ case Named:
+ // This is the attribute only version, generic version matches somewhat differently
+ while (entityName.size() <= 8) {
+ if (cc == ';') {
+ const Entity* entity = findEntity(entityName.data(), entityName.size());
+ if (entity) {
+ source.advance();
+ return entity->code;
+ }
+ break;
+ }
+ if (!(cc >= 'a' && cc <= 'z') && !(cc >= 'A' && cc <= 'Z') && !(cc >= '0' && cc <= '9')) {
+ const Entity* entity = findEntity(entityName.data(), entityName.size());
+ if (entity)
+ return entity->code;
+ break;
+ }
+ entityName.append(cc);
+ source.advance();
+ if (source.isEmpty())
+ goto outOfCharacters;
+ cc = *source;
+ seenChars.append(cc);
+ }
+ if (seenChars.size() == 2)
+ source.push(seenChars[0]);
+ else if (seenChars.size() == 3) {
+ source.push(seenChars[0]);
+ source.push(seenChars[1]);
+ } else
+ source.prepend(SegmentedString(String(seenChars.data(), seenChars.size() - 1)));
+ return 0;
+ }
+ source.advance();
+ }
+outOfCharacters:
+ notEnoughCharacters = true;
+ source.prepend(SegmentedString(String(seenChars.data(), seenChars.size())));
+ return 0;
+}
+
+bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token)
+{
+ // If we have a token in progress, then we're supposed to be called back
+ // with the same token so we can finish it.
+ ASSERT(!m_token || m_token == &token || token.type() == HTML5Token::Uninitialized);
+ m_token = &token;
+
+ if (!m_bufferedEndTagName.isEmpty()) {
+ // We started an end tag during our last iteration.
+ m_token->beginEndTag(m_bufferedEndTagName);
+ m_bufferedEndTagName.clear();
+ if (m_state == DataState) {
+ // We're back in the data state, so we must be done with the tag.
+ return true;
+ }
+ }
+
+ // Source: http://www.whatwg.org/specs/web-apps/current-work/#tokenisation0
+ // FIXME: This while should stop as soon as we have a token to return.
+ while (!source.isEmpty()) {
+ UChar cc = *source;
+ switch (m_state) {
+ case DataState: {
+ if (cc == '&')
+ m_state = CharacterReferenceInDataState;
+ else if (cc == '<') {
+ if (m_token->type() == HTML5Token::Character) {
+ // We have a bunch of character tokens queued up that we
+ // are emitting lazily here.
+ return true;
+ }
+ m_state = TagOpenState;
+ } else
+ emitCharacter(cc);
+ break;
+ }
+ case CharacterReferenceInDataState: {
+ notImplemented();
+ break;
+ }
+ case RCDATAState: {
+ if (cc == '&')
+ m_state = CharacterReferenceInRCDATAState;
+ else if (cc == '<')
+ m_state = RCDATALessThanSignState;
+ else
+ emitCharacter(cc);
+ break;
+ }
+ case CharacterReferenceInRCDATAState: {
+ notImplemented();
+ break;
+ }
+ case RAWTEXTState: {
+ if (cc == '<')
+ m_state = RAWTEXTLessThanSignState;
+ else
+ emitCharacter(cc);
+ break;
+ }
+ case ScriptDataState: {
+ if (cc == '<')
+ m_state = ScriptDataLessThanSignState;
+ else
+ emitCharacter(cc);
+ break;
+ }
+ case PLAINTEXTState: {
+ emitCharacter(cc);
+ break;
+ }
+ case TagOpenState: {
+ if (cc == '!')
+ m_state = MarkupDeclarationOpenState;
+ else if (cc == '/')
+ m_state = EndTagOpenState;
+ else if (cc >= 'A' && cc <= 'Z') {
+ m_token->beginStartTag(toLowerCase(cc));
+ m_state = TagNameState;
+ } else if (cc >= 'a' && cc <= 'z') {
+ m_token->beginStartTag(cc);
+ m_state = TagNameState;
+ } else if (cc == '?') {
+ emitParseError();
+ m_state = BogusCommentState;
+ } else {
+ emitParseError();
+ m_state = DataState;
+ emitCharacter('<');
+ continue;
+ }
+ break;
+ }
+ case EndTagOpenState: {
+ if (cc >= 'A' && cc <= 'Z') {
+ m_token->beginEndTag(toLowerCase(cc));
+ m_state = TagNameState;
+ } else if (cc >= 'a' && cc <= 'z') {
+ m_token->beginEndTag(cc);
+ m_state = TagNameState;
+ } else if (cc == '>') {
+ emitParseError();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ m_state = DataState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case TagNameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BeforeAttributeNameState;
+ else if (cc == '/')
+ m_state = SelfClosingStartTagState;
+ else if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ m_token->appendToName(toLowerCase(cc));
+ else
+ m_token->appendToName(cc);
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case RCDATALessThanSignState: {
+ if (cc == '/') {
+ m_temporaryBuffer.clear();
+ m_state = RCDATAEndTagOpenState;
+ } else {
+ emitCharacter('<');
+ m_state = RCDATAState;
+ continue;
+ }
+ break;
+ }
+ case RCDATAEndTagOpenState: {
+ if (cc >= 'A' && cc <= 'Z') {
+ notImplemented();
+ m_state = RCDATAEndTagNameState;
+ } else if (cc >= 'a' && cc <= 'z') {
+ notImplemented();
+ m_state = RCDATAEndTagNameState;
+ emitCharacter('<');
+ emitCharacter('/');
+ m_state = RCDATAState;
+ continue;
+ }
+ break;
+ }
+ case RCDATAEndTagNameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
+ notImplemented();
+ m_state = BeforeAttributeNameState;
+ } else if (cc == '/') {
+ notImplemented();
+ m_state = SelfClosingStartTagState;
+ } else if (cc == '>') {
+ notImplemented();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ notImplemented();
+ else if (cc >= 'a' && cc <= 'z')
+ notImplemented();
+ else {
+ emitCharacter('<');
+ emitCharacter('/');
+ notImplemented();
+ m_state = RCDATAState;
+ continue;
+ }
+ break;
+ }
+ case RAWTEXTLessThanSignState: {
+ if (cc == '/') {
+ m_temporaryBuffer.clear();
+ m_state = RAWTEXTEndTagOpenState;
+ } else {
+ emitCharacter('<');
+ m_state = RAWTEXTState;
+ continue;
+ }
+ break;
+ }
+ case RAWTEXTEndTagOpenState: {
+ if (cc >= 'A' && cc <= 'Z') {
+ notImplemented();
+ m_state = RAWTEXTEndTagNameState;
+ } else if (cc >= 'a' && cc <= 'z') {
+ notImplemented();
+ m_state = RAWTEXTEndTagNameState;
+ } else {
+ emitCharacter('<');
+ emitCharacter('/');
+ m_state = RAWTEXTState;
+ continue;
+ }
+ break;
+ }
+ case RAWTEXTEndTagNameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
+ notImplemented();
+ m_state = BeforeAttributeNameState;
+ } else if (cc == '/') {
+ notImplemented();
+ m_state = SelfClosingStartTagState;
+ } else if (cc == '>') {
+ notImplemented();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ notImplemented();
+ else if (cc >= 'a' && cc <= 'z')
+ notImplemented();
+ else {
+ emitCharacter('<');
+ emitCharacter('/');
+ notImplemented();
+ m_state = RAWTEXTState;
+ continue;
+ }
+ }
+ case ScriptDataLessThanSignState: {
+ if (cc == '/') {
+ m_temporaryBuffer.clear();
+ ASSERT(m_bufferedEndTagName.isEmpty());
+ m_state = ScriptDataEndTagOpenState;
+ } else if (cc == '!') {
+ emitCharacter('<');
+ emitCharacter('!');
+ m_state = ScriptDataEscapeStartState;
+ } else {
+ emitCharacter('<');
+ m_state = ScriptDataState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataEndTagOpenState: {
+ if (cc >= 'A' && cc <= 'Z') {
+ m_temporaryBuffer.append(cc);
+ m_bufferedEndTagName.append(toLowerCase(cc));
+ m_state = ScriptDataEndTagNameState;
+ } else if (cc >= 'a' && cc <= 'z') {
+ m_temporaryBuffer.append(cc);
+ m_bufferedEndTagName.append(cc);
+ m_state = ScriptDataEndTagNameState;
+ } else {
+ emitCharacter('<');
+ emitCharacter('/');
+ m_state = ScriptDataState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataEndTagNameState: {
+ if (cc >= 'A' && cc <= 'Z') {
+ m_temporaryBuffer.append(cc);
+ m_bufferedEndTagName.append(toLowerCase(cc));
+ } else if (cc >= 'a' && cc <= 'z') {
+ m_temporaryBuffer.append(cc);
+ m_bufferedEndTagName.append(cc);
+ } else {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
+ if (isAppropriateEndTag()) {
+ m_state = BeforeAttributeNameState;
+ ASSERT(m_token->type() == HTML5Token::Character);
+ emitCurrentToken();
+ break;
+ }
+ } else if (cc == '/') {
+ if (isAppropriateEndTag()) {
+ m_state = SelfClosingStartTagState;
+ ASSERT(m_token->type() == HTML5Token::Character);
+ emitCurrentToken();
+ break;
+ }
+ } else if (cc == '>') {
+ if (isAppropriateEndTag()) {
+ m_state = DataState;
+ ASSERT(m_token->type() == HTML5Token::Character);
+ emitCurrentToken();
+ break;
+ }
+ }
+ emitCharacter('<');
+ emitCharacter('/');
+ m_token->appendToCharacter(m_temporaryBuffer);
+ m_bufferedEndTagName.clear();
+ m_state = ScriptDataState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataEscapeStartState: {
+ if (cc == '-') {
+ emitCharacter(cc);
+ m_state = ScriptDataEscapeStartDashState;
+ } else {
+ m_state = ScriptDataState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataEscapeStartDashState: {
+ if (cc == '-') {
+ emitCharacter(cc);
+ m_state = ScriptDataEscapedDashDashState;
+ } else {
+ m_state = ScriptDataState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataEscapedState: {
+ if (cc == '-') {
+ emitCharacter(cc);
+ m_state = ScriptDataEscapedDashState;
+ } else if (cc == '<')
+ m_state = ScriptDataEscapedLessThanSignState;
+ else
+ emitCharacter(cc);
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case ScriptDataEscapedDashState: {
+ if (cc == '-') {
+ emitCharacter(cc);
+ m_state = ScriptDataEscapedDashDashState;
+ } else if (cc == '<')
+ m_state = ScriptDataEscapedLessThanSignState;
+ else {
+ emitCharacter(cc);
+ m_state = ScriptDataEscapedState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case ScriptDataEscapedDashDashState: {
+ if (cc == '-')
+ emitCharacter(cc);
+ else if (cc == '<')
+ m_state = ScriptDataEscapedLessThanSignState;
+ else if (cc == '>') {
+ emitCharacter(cc);
+ m_state = ScriptDataState;
+ } else {
+ emitCharacter(cc);
+ m_state = ScriptDataEscapedState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case ScriptDataEscapedLessThanSignState: {
+ if (cc == '/') {
+ m_temporaryBuffer.clear();
+ m_state = ScriptDataEscapedEndTagOpenState;
+ } else if (cc >= 'A' && cc <= 'Z') {
+ notImplemented();
+ m_state = ScriptDataDoubleEscapeStartState;
+ } else if (cc >= 'a' && cc <= 'z') {
+ notImplemented();
+ m_state = ScriptDataDoubleEscapeStartState;
+ } else {
+ emitCharacter('<');
+ m_state = ScriptDataEscapedState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataEscapedEndTagOpenState: {
+ if (cc >= 'A' && cc <= 'Z') {
+ notImplemented();
+ m_state = ScriptDataEscapedEndTagNameState;
+ } else if (cc >= 'a' && cc <= 'z') {
+ notImplemented();
+ m_state = ScriptDataEscapedEndTagNameState;
+ } else {
+ emitCharacter('<');
+ emitCharacter('/');
+ m_state = ScriptDataEscapedState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataEscapedEndTagNameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
+ notImplemented();
+ m_state = BeforeAttributeNameState;
+ } else if (cc == '/') {
+ notImplemented();
+ m_state = SelfClosingStartTagState;
+ } else if (cc == '>') {
+ notImplemented();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ notImplemented();
+ else if (cc >= 'a' && cc <= 'z')
+ notImplemented();
+ else {
+ emitCharacter('<');
+ emitCharacter('/');
+ notImplemented();
+ m_state = ScriptDataEscapedState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataDoubleEscapeStartState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '/' || cc == '>') {
+ emitCharacter(cc);
+ if (temporaryBufferIs("string"))
+ m_state = ScriptDataDoubleEscapedState;
+ else
+ m_state = ScriptDataEscapedState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ notImplemented();
+ else if (cc >= 'a' && cc <= 'z')
+ notImplemented();
+ else {
+ m_state = ScriptDataEscapedState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataDoubleEscapedState: {
+ if (cc == '-') {
+ emitCharacter(cc);
+ m_state = ScriptDataDoubleEscapedDashState;
+ } else if (cc == '<') {
+ emitCharacter(cc);
+ m_state = ScriptDataDoubleEscapedLessThanSignState;
+ } else
+ emitCharacter(cc);
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case ScriptDataDoubleEscapedDashState: {
+ if (cc == '-') {
+ emitCharacter(cc);
+ m_state = ScriptDataDoubleEscapedDashDashState;
+ } else if (cc == '<') {
+ emitCharacter(cc);
+ m_state = ScriptDataDoubleEscapedLessThanSignState;
+ } else {
+ emitCharacter(cc);
+ m_state = ScriptDataDoubleEscapedState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case ScriptDataDoubleEscapedDashDashState: {
+ if (cc == '-')
+ emitCharacter(cc);
+ else if (cc == '<') {
+ emitCharacter(cc);
+ m_state = ScriptDataDoubleEscapedLessThanSignState;
+ } else if (cc == '>') {
+ emitCharacter(cc);
+ m_state = ScriptDataState;
+ } else {
+ emitCharacter(cc);
+ m_state = ScriptDataDoubleEscapedState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case ScriptDataDoubleEscapedLessThanSignState: {
+ if (cc == '/') {
+ emitCharacter(cc);
+ m_temporaryBuffer.clear();
+ m_state = ScriptDataDoubleEscapeEndState;
+ } else {
+ m_state = ScriptDataDoubleEscapedState;
+ continue;
+ }
+ break;
+ }
+ case ScriptDataDoubleEscapeEndState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '/' || cc == '>') {
+ emitCharacter(cc);
+ if (temporaryBufferIs("string"))
+ m_state = ScriptDataEscapedState;
+ else
+ m_state = ScriptDataDoubleEscapedState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ notImplemented();
+ else if (cc >= 'a' && cc <= 'z')
+ notImplemented();
+ else {
+ m_state = ScriptDataDoubleEscapedState;
+ continue;
+ }
+ break;
+ }
+ case BeforeAttributeNameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc == '/')
+ m_state = SelfClosingStartTagState;
+ else if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z') {
+ m_token->addNewAttribute();
+ m_token->appendToAttributeName(toLowerCase(cc));
+ m_state = AttributeNameState;
+ } else {
+ if (cc == '"' || cc == '\'' || cc == '<' || cc == '=')
+ emitParseError();
+ m_token->addNewAttribute();
+ m_token->appendToAttributeName(cc);
+ m_state = AttributeNameState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AttributeNameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = AfterAttributeNameState;
+ else if (cc == '/')
+ m_state = SelfClosingStartTagState;
+ else if (cc == '=')
+ m_state = BeforeAttributeValueState;
+ else if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ m_token->appendToAttributeName(toLowerCase(cc));
+ else {
+ if (cc == '"' || cc == '\'' || cc == '<' || cc == '=')
+ emitParseError();
+ m_token->appendToAttributeName(cc);
+ m_state = AttributeNameState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AfterAttributeNameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc == '/')
+ m_state = SelfClosingStartTagState;
+ else if (cc == '=')
+ m_state = BeforeAttributeValueState;
+ else if (cc == '=') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z') {
+ m_token->addNewAttribute();
+ m_token->appendToAttributeName(toLowerCase(cc));
+ m_state = AttributeNameState;
+ } else {
+ if (cc == '"' || cc == '\'' || cc == '<')
+ emitParseError();
+ m_token->addNewAttribute();
+ m_token->appendToAttributeName(cc);
+ m_state = AttributeNameState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case BeforeAttributeValueState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc == '"')
+ m_state = AttributeValueDoubleQuotedState;
+ else if (cc == '&') {
+ m_state = AttributeValueUnquotedState;
+ continue;
+ } else if (cc == '\'')
+ m_state = AttributeValueSingleQuotedState;
+ else if (cc == '>') {
+ emitParseError();
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ if (cc == '<' || cc == '=' || cc == '`')
+ emitParseError();
+ m_token->appendToAttributeValue(cc);
+ m_state = AttributeValueUnquotedState;
+ }
+ break;
+ }
+ case AttributeValueDoubleQuotedState: {
+ if (cc == '"')
+ m_state = AfterAttributeValueQuotedState;
+ else if (cc == '&') {
+ m_state = CharacterReferenceInAttributeValueState;
+ m_additionalAllowedCharacter = '"';
+ } else
+ m_token->appendToAttributeValue(cc);
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AttributeValueSingleQuotedState: {
+ if (cc == '\'')
+ m_state = AfterAttributeValueQuotedState;
+ else if (cc == '&') {
+ m_state = CharacterReferenceInAttributeValueState;
+ m_additionalAllowedCharacter = '\'';
+ } else
+ m_token->appendToAttributeValue(cc);
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AttributeValueUnquotedState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BeforeAttributeNameState;
+ else if (cc == '&') {
+ m_state = CharacterReferenceInAttributeValueState;
+ m_additionalAllowedCharacter = '>';
+ } else if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ if (cc == '"' || cc == '\'' || cc == '<' || cc == '=' || cc == '`')
+ emitParseError();
+ m_token->appendToAttributeValue(cc);
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CharacterReferenceInAttributeValueState: {
+ notImplemented();
+ break;
+ }
+ case AfterAttributeValueQuotedState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BeforeAttributeNameState;
+ else if (cc == '/')
+ m_state = SelfClosingStartTagState;
+ else if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ m_state = BeforeAttributeNameState;
+ continue;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case SelfClosingStartTagState: {
+ if (cc == '>') {
+ notImplemented();
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ m_state = BeforeAttributeNameState;
+ continue;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case BogusCommentState: {
+ notImplemented();
+ m_state = DataState;
+ break;
+ }
+ case MarkupDeclarationOpenState: {
+ DEFINE_STATIC_LOCAL(String, dashDashString, ("--"));
+ if (cc == '-') {
+ SegmentedString::LookAheadResult result = source.lookAhead(dashDashString);
+ if (result == SegmentedString::DidMatch) {
+ source.advanceAndASSERT('-');
+ source.advanceAndASSERT('-');
+ m_token->beginComment();
+ m_state = CommentStartState;
+ continue;
+ } else if (result == SegmentedString::NotEnoughCharacters)
+ return false; // We need to wait for more characters to arrive.
+ }
+ notImplemented();
+ break;
+ }
+ case CommentStartState: {
+ if (cc == '-')
+ m_state = CommentStartDashState;
+ else if (cc == '>') {
+ emitParseError();
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ m_token->appendToComment(cc);
+ m_state = CommentState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CommentStartDashState: {
+ if (cc == '-')
+ m_state = CommentEndState;
+ else if (cc == '>') {
+ emitParseError();
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ m_token->appendToComment('-');
+ m_token->appendToComment(cc);
+ m_state = CommentState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CommentState: {
+ if (cc == '-')
+ m_state = CommentEndDashState;
+ else
+ m_token->appendToComment(cc);
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CommentEndDashState: {
+ if (cc == '-')
+ m_state = CommentEndState;
+ else {
+ m_token->appendToComment('-');
+ m_token->appendToComment(cc);
+ m_state = CommentState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CommentEndState: {
+ if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
+ emitParseError();
+ m_token->appendToComment('-');
+ m_token->appendToComment('-');
+ m_token->appendToComment(cc);
+ m_state = CommentEndSpaceState;
+ } else if (cc == '!') {
+ emitParseError();
+ m_state = CommentEndBangState;
+ } else if (cc == '-') {
+ emitParseError();
+ m_token->appendToComment('-');
+ m_token->appendToComment(cc);
+ } else {
+ emitParseError();
+ m_token->appendToComment('-');
+ m_token->appendToComment('-');
+ m_token->appendToComment(cc);
+ m_state = CommentState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CommentEndBangState: {
+ if (cc == '-') {
+ m_token->appendToComment('-');
+ m_token->appendToComment('-');
+ m_token->appendToComment('!');
+ m_state = CommentEndDashState;
+ } else if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ m_token->appendToComment('-');
+ m_token->appendToComment('-');
+ m_token->appendToComment('!');
+ m_token->appendToComment(cc);
+ m_state = CommentState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CommentEndSpaceState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_token->appendToComment(cc);
+ else if (cc == '-')
+ m_state = CommentEndDashState;
+ else if (cc == '>') {
+ emitCurrentToken();
+ m_state = DataState;
+ } else {
+ m_token->appendToComment(cc);
+ m_state = CommentState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case DOCTYPEState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BeforeDOCTYPENameState;
+ else {
+ emitParseError();
+ m_state = BeforeDOCTYPENameState;
+ continue;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case BeforeDOCTYPENameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc >= 'A' && cc <= 'Z') {
+ notImplemented();
+ m_state = DOCTYPENameState;
+ } else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else {
+ notImplemented();
+ m_state = DOCTYPENameState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case DOCTYPENameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = AfterDOCTYPENameState;
+ else if (cc == '>') {
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else if (cc >= 'A' && cc <= 'Z')
+ notImplemented();
+ else
+ notImplemented();
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AfterDOCTYPENameState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc == '>') {
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else
+ notImplemented();
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AfterDOCTYPEPublicKeywordState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BeforeDOCTYPEPublicIdentifierState;
+ else if (cc == '"') {
+ emitParseError();
+ notImplemented();
+ m_state = DOCTYPEPublicIdentifierDoubleQuotedState;
+ } else if (cc == '\'') {
+ emitParseError();
+ notImplemented();
+ m_state = DOCTYPEPublicIdentifierSingleQuotedState;
+ } else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ notImplemented();
+ m_state = BogusDOCTYPEState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case BeforeDOCTYPEPublicIdentifierState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc == '"') {
+ notImplemented();
+ m_state = DOCTYPEPublicIdentifierDoubleQuotedState;
+ } else if (cc == '\'') {
+ notImplemented();
+ m_state = DOCTYPEPublicIdentifierSingleQuotedState;
+ } else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ notImplemented();
+ m_state = BogusDOCTYPEState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case DOCTYPEPublicIdentifierDoubleQuotedState: {
+ if (cc == '"')
+ m_state = AfterDOCTYPEPublicIdentifierState;
+ else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else
+ notImplemented();
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case DOCTYPEPublicIdentifierSingleQuotedState: {
+ if (cc == '\'')
+ m_state = AfterDOCTYPEPublicIdentifierState;
+ else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else
+ notImplemented();
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AfterDOCTYPEPublicIdentifierState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BetweenDOCTYPEPublicAndSystemIdentifiersState;
+ else if (cc == '>') {
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else if (cc == '"') {
+ emitParseError();
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierDoubleQuotedState;
+ } else if (cc == '\'') {
+ emitParseError();
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierSingleQuotedState;
+ } else {
+ emitParseError();
+ notImplemented();
+ m_state = BogusDOCTYPEState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case BetweenDOCTYPEPublicAndSystemIdentifiersState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BetweenDOCTYPEPublicAndSystemIdentifiersState;
+ else if (cc == '>') {
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else if (cc == '"') {
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierDoubleQuotedState;
+ } else if (cc == '\'') {
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierSingleQuotedState;
+ } else {
+ emitParseError();
+ notImplemented();
+ m_state = BogusDOCTYPEState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AfterDOCTYPESystemKeywordState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ m_state = BeforeDOCTYPESystemIdentifierState;
+ else if (cc == '"') {
+ emitParseError();
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierDoubleQuotedState;
+ } else if (cc == '\'') {
+ emitParseError();
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierSingleQuotedState;
+ } else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ notImplemented();
+ m_state = BogusDOCTYPEState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case BeforeDOCTYPESystemIdentifierState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc == '"') {
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierDoubleQuotedState;
+ } else if (cc == '\'') {
+ notImplemented();
+ m_state = DOCTYPESystemIdentifierSingleQuotedState;
+ } else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ notImplemented();
+ m_state = BogusDOCTYPEState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case DOCTYPESystemIdentifierDoubleQuotedState: {
+ if (cc == '"')
+ m_state = AfterDOCTYPESystemIdentifierState;
+ else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else
+ notImplemented();
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case DOCTYPESystemIdentifierSingleQuotedState: {
+ if (cc == '\'')
+ m_state = AfterDOCTYPESystemIdentifierState;
+ else if (cc == '>') {
+ emitParseError();
+ notImplemented();
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else
+ notImplemented();
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case AfterDOCTYPESystemIdentifierState: {
+ if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ')
+ break;
+ else if (cc == '>') {
+ emitCurrentDoctypeToken();
+ m_state = DataState;
+ } else {
+ emitParseError();
+ m_state = BogusDOCTYPEState;
+ }
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case BogusDOCTYPEState: {
+ if (cc == '>')
+ emitCurrentDoctypeToken();
+ // FIXME: Handle EOF properly.
+ break;
+ }
+ case CDATASectionState: {
+ notImplemented();
+ break;
+ }
+ case TokenizingCharacterReferencesState: {
+ notImplemented();
+ break;
+ }
+ }
+ source.advance();
+ if (m_emitPending) {
+ m_emitPending = false;
+ return true;
+ }
+ }
+ // We've reached the end of the input stream. If we have a character
+ // token buffered, we should emit it.
+ return m_token->type() == HTML5Token::Character;
+}
+
+inline bool HTML5Lexer::temporaryBufferIs(const char*)
+{
+ notImplemented();
+ return true;
+}
+
+inline bool HTML5Lexer::isAppropriateEndTag()
+{
+ if (m_bufferedEndTagName.size() != m_appropriateEndTagName.length())
+ return false;
+ const UChar* appropriate = m_appropriateEndTagName.characters();
+ const UChar* actual = m_bufferedEndTagName.data();
+ // FIXME: Is there a higher-level function we should be calling here?
+ return !memcmp(appropriate, actual, m_bufferedEndTagName.size() * sizeof(UChar));
+}
+
+inline void HTML5Lexer::emitCharacter(UChar character)
+{
+ if (m_token->type() != HTML5Token::Character) {
+ m_token->beginCharacter(character);
+ return;
+ }
+ m_token->appendToCharacter(character);
+}
+
+inline void HTML5Lexer::emitParseError()
+{
+ notImplemented();
+}
+
+inline void HTML5Lexer::emitCurrentToken()
+{
+ m_emitPending = true;
+ if (m_token->type() == HTML5Token::StartTag)
+ m_appropriateEndTagName = m_token->name();
+}
+
+inline void HTML5Lexer::emitCurrentDoctypeToken()
+{
+}
+
+}
diff --git a/WebCore/html/HTML5Lexer.h b/WebCore/html/HTML5Lexer.h
new file mode 100644
index 0000000..6d61cc2
--- /dev/null
+++ b/WebCore/html/HTML5Lexer.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTML5Lexer_h
+#define HTML5Lexer_h
+
+#include "AtomicString.h"
+#include "SegmentedString.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class HTML5Token;
+
+ class HTML5Lexer : public Noncopyable {
+ public:
+ enum State {
+ DataState,
+ CharacterReferenceInDataState,
+ RCDATAState,
+ CharacterReferenceInRCDATAState,
+ RAWTEXTState,
+ ScriptDataState,
+ PLAINTEXTState,
+ TagOpenState,
+ EndTagOpenState,
+ TagNameState,
+ RCDATALessThanSignState,
+ RCDATAEndTagOpenState,
+ RCDATAEndTagNameState,
+ RAWTEXTLessThanSignState,
+ RAWTEXTEndTagOpenState,
+ RAWTEXTEndTagNameState,
+ ScriptDataLessThanSignState,
+ ScriptDataEndTagOpenState,
+ ScriptDataEndTagNameState,
+ ScriptDataEscapeStartState,
+ ScriptDataEscapeStartDashState,
+ ScriptDataEscapedState,
+ ScriptDataEscapedDashState,
+ ScriptDataEscapedDashDashState,
+ ScriptDataEscapedLessThanSignState,
+ ScriptDataEscapedEndTagOpenState,
+ ScriptDataEscapedEndTagNameState,
+ ScriptDataDoubleEscapeStartState,
+ ScriptDataDoubleEscapedState,
+ ScriptDataDoubleEscapedDashState,
+ ScriptDataDoubleEscapedDashDashState,
+ ScriptDataDoubleEscapedLessThanSignState,
+ ScriptDataDoubleEscapeEndState,
+ BeforeAttributeNameState,
+ AttributeNameState,
+ AfterAttributeNameState,
+ BeforeAttributeValueState,
+ AttributeValueDoubleQuotedState,
+ AttributeValueSingleQuotedState,
+ AttributeValueUnquotedState,
+ CharacterReferenceInAttributeValueState,
+ AfterAttributeValueQuotedState,
+ SelfClosingStartTagState,
+ BogusCommentState,
+ MarkupDeclarationOpenState,
+ CommentStartState,
+ CommentStartDashState,
+ CommentState,
+ CommentEndDashState,
+ CommentEndState,
+ CommentEndBangState,
+ CommentEndSpaceState,
+ DOCTYPEState,
+ BeforeDOCTYPENameState,
+ DOCTYPENameState,
+ AfterDOCTYPENameState,
+ AfterDOCTYPEPublicKeywordState,
+ BeforeDOCTYPEPublicIdentifierState,
+ DOCTYPEPublicIdentifierDoubleQuotedState,
+ DOCTYPEPublicIdentifierSingleQuotedState,
+ AfterDOCTYPEPublicIdentifierState,
+ BetweenDOCTYPEPublicAndSystemIdentifiersState,
+ AfterDOCTYPESystemKeywordState,
+ BeforeDOCTYPESystemIdentifierState,
+ DOCTYPESystemIdentifierDoubleQuotedState,
+ DOCTYPESystemIdentifierSingleQuotedState,
+ AfterDOCTYPESystemIdentifierState,
+ BogusDOCTYPEState,
+ CDATASectionState,
+ TokenizingCharacterReferencesState,
+ };
+
+ HTML5Lexer();
+ ~HTML5Lexer();
+
+ void reset();
+
+ // This function returns true if it emits a token. Otherwise, callers
+ // must provide the same (in progress) token on the next call (unless
+ // they call reset() first).
+ bool nextToken(SegmentedString&, HTML5Token&);
+
+ void setState(State state) { m_state = state; }
+
+ static unsigned consumeEntity(SegmentedString&, bool& notEnoughCharacters);
+
+ private:
+ inline void emitCharacter(UChar);
+ inline void emitParseError();
+ inline void emitCurrentToken();
+ inline void emitCurrentDoctypeToken();
+
+ inline bool temporaryBufferIs(const char*);
+
+ inline bool isAppropriateEndTag();
+
+ State m_state;
+
+ AtomicString m_appropriateEndTagName;
+
+ // m_token is owned by the caller. If nextToken is not on the stack,
+ // this member might be pointing to unallocated memory.
+ HTML5Token* m_token;
+
+ bool m_emitPending;
+
+ // http://www.whatwg.org/specs/web-apps/current-work/#temporary-buffer
+ Vector<UChar, 32> m_temporaryBuffer;
+
+ // We occationally want to emit both a character token and an end tag
+ // token (e.g., when lexing script). We buffer the name of the end tag
+ // token here so we remember it next time we re-enter the lexer.
+ Vector<UChar, 32> m_bufferedEndTagName;
+
+ // http://www.whatwg.org/specs/web-apps/current-work/#additional-allowed-character
+ UChar m_additionalAllowedCharacter;
+ };
+
+}
+
+#endif
diff --git a/WebCore/html/HTML5Token.h b/WebCore/html/HTML5Token.h
new file mode 100644
index 0000000..1918589
--- /dev/null
+++ b/WebCore/html/HTML5Token.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTML5Token_h
+#define HTML5Token_h
+
+#include "NamedNodeMap.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class HTML5Token : public Noncopyable {
+public:
+ enum Type {
+ Uninitialized,
+ DOCTYPE,
+ StartTag,
+ EndTag,
+ Comment,
+ Character,
+ EndOfFile,
+ };
+
+ class Attribute {
+ public:
+ WTF::Vector<UChar, 32> m_name;
+ WTF::Vector<UChar, 32> m_value;
+ };
+
+ typedef WTF::Vector<Attribute> AttributeList;
+
+ HTML5Token() { clear(); }
+
+ void clear()
+ {
+ m_type = Uninitialized;
+ }
+
+ void beginStartTag(UChar character)
+ {
+ ASSERT(m_type == Uninitialized);
+ m_type = StartTag;
+ m_data.clear();
+ m_dataString = AtomicString();
+ m_selfClosing = false;
+ m_currentAttribute = 0;
+
+ m_data.append(character);
+ }
+
+ template<typename T>
+ void beginEndTag(T characters)
+ {
+ ASSERT(m_type == Uninitialized);
+ m_type = EndTag;
+ m_data.clear();
+ m_dataString = AtomicString();
+ m_selfClosing = false;
+ m_currentAttribute = 0;
+
+ m_data.append(characters);
+ }
+
+ void beginCharacter(UChar character)
+ {
+ ASSERT(m_type == Uninitialized);
+ m_type = Character;
+ m_data.clear();
+ m_dataString = AtomicString();
+ m_data.append(character);
+ }
+
+ void beginComment()
+ {
+ ASSERT(m_type == Uninitialized);
+ m_type = Comment;
+ m_data.clear();
+ m_dataString = AtomicString();
+ }
+
+ void appendToName(UChar character)
+ {
+ ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
+ m_data.append(character);
+ }
+
+ template<typename T>
+ void appendToCharacter(T characters)
+ {
+ ASSERT(m_type == Character);
+ m_data.append(characters);
+ }
+
+ void appendToComment(UChar character)
+ {
+ ASSERT(m_type == Comment);
+ m_data.append(character);
+ }
+
+ void addNewAttribute()
+ {
+ ASSERT(m_type == StartTag || m_type == EndTag);
+ m_attributes.grow(m_attributes.size() + 1);
+ m_currentAttribute = &m_attributes.last();
+ }
+
+ void appendToAttributeName(UChar character)
+ {
+ ASSERT(m_type == StartTag || m_type == EndTag);
+ m_currentAttribute->m_name.append(character);
+ }
+
+ void appendToAttributeValue(UChar character)
+ {
+ ASSERT(m_type == StartTag || m_type == EndTag);
+ m_currentAttribute->m_value.append(character);
+ }
+
+ Type type() const { return m_type; }
+
+ bool selfClosing() const
+ {
+ ASSERT(m_type == StartTag || m_type == EndTag);
+ return m_selfClosing;
+ }
+
+ AttributeList& attributes()
+ {
+ ASSERT(m_type == StartTag || m_type == EndTag);
+ return m_attributes;
+ }
+
+ AtomicString name()
+ {
+ ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
+ return dataString();
+ }
+
+ AtomicString characters()
+ {
+ ASSERT(m_type == Character);
+ return dataString();
+ }
+
+ AtomicString data()
+ {
+ ASSERT(m_type == Comment);
+ return dataString();
+ }
+
+private:
+ AtomicString dataString()
+ {
+ if (!m_data.isEmpty() && m_dataString.isEmpty())
+ m_dataString = AtomicString(StringImpl::adopt(m_data));
+ return m_dataString;
+ }
+
+ Type m_type;
+
+ // "name" for DOCTYPE, StartTag, and EndTag
+ // "characters" for Character
+ // "data" for Comment
+ WTF::Vector<UChar, 1024> m_data;
+
+ // For DOCTYPE
+ String m_publicIdentifier;
+ String m_systemIdentifier;
+ bool m_forceQuirks;
+
+ // For StartTag and EndTag
+ bool m_selfClosing;
+ AttributeList m_attributes; // Old tokenizer reserves 10.
+
+ // A pointer into m_attributes used during lexing.
+ Attribute* m_currentAttribute;
+
+ AtomicString m_dataString;
+};
+
+}
+
+#endif
diff --git a/WebCore/html/HTML5Tokenizer.cpp b/WebCore/html/HTML5Tokenizer.cpp
new file mode 100644
index 0000000..c531c7e
--- /dev/null
+++ b/WebCore/html/HTML5Tokenizer.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HTML5Tokenizer.h"
+
+#include "HTML5Lexer.h"
+#include "HTML5Token.h"
+#include "HTML5TreeBuilder.h"
+#include "Node.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+HTML5Tokenizer::HTML5Tokenizer(HTMLDocument* document, bool reportErrors)
+ : Tokenizer()
+ , m_lexer(new HTML5Lexer)
+ , m_treeBuilder(new HTML5TreeBuilder(m_lexer.get(), document, reportErrors))
+{
+ begin();
+}
+
+HTML5Tokenizer::~HTML5Tokenizer()
+{
+}
+
+void HTML5Tokenizer::begin()
+{
+}
+
+void HTML5Tokenizer::write(const SegmentedString& source, bool)
+{
+ m_source.append(source);
+
+ HTML5Token token;
+ while (!m_source.isEmpty()) {
+ if (m_lexer->nextToken(m_source, token)) {
+ m_treeBuilder->constructTreeFromToken(token);
+ token.clear();
+ }
+ }
+}
+
+void HTML5Tokenizer::end()
+{
+ m_treeBuilder->finished();
+}
+
+void HTML5Tokenizer::finish()
+{
+ end();
+}
+
+bool HTML5Tokenizer::isWaitingForScripts() const
+{
+ notImplemented();
+ return false;
+}
+
+}
diff --git a/WebCore/html/HTML5Tokenizer.h b/WebCore/html/HTML5Tokenizer.h
new file mode 100644
index 0000000..7d503aa
--- /dev/null
+++ b/WebCore/html/HTML5Tokenizer.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTML5Tokenizer_h
+#define HTML5Tokenizer_h
+
+#include "CachedResourceClient.h"
+#include "SegmentedString.h"
+#include "Tokenizer.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class HTMLDocument;
+class HTML5TreeBuilder;
+class HTML5Lexer;
+
+// FIXME: This is the wrong layer to hook in the new HTML 5 Lexer,
+// however HTMLTokenizer is too large and too fragile of a class to hack into.
+// Eventually we should split all of the HTML lexer logic out from HTMLTokenizer
+// and then share non-lexer-specific tokenizer logic between HTML5 and the
+// legacy WebKit HTML lexer.
+
+// FIXME: This class is far from complete.
+class HTML5Tokenizer : public Tokenizer, public CachedResourceClient {
+public:
+ HTML5Tokenizer(HTMLDocument*, bool reportErrors);
+ virtual ~HTML5Tokenizer();
+
+ virtual void begin();
+ virtual void write(const SegmentedString&, bool appendData);
+ virtual void end();
+ virtual void finish();
+ virtual bool isWaitingForScripts() const;
+
+private:
+ SegmentedString m_source;
+
+ OwnPtr<HTML5Lexer> m_lexer;
+ OwnPtr<HTML5TreeBuilder> m_treeBuilder;
+};
+
+}
+
+#endif
diff --git a/WebCore/html/HTML5TreeBuilder.cpp b/WebCore/html/HTML5TreeBuilder.cpp
new file mode 100644
index 0000000..af53ac6
--- /dev/null
+++ b/WebCore/html/HTML5TreeBuilder.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HTML5TreeBuilder.h"
+
+#include "Attribute.h"
+#include "HTML5Lexer.h"
+#include "HTML5Token.h"
+#include "HTMLDocument.h"
+#include "HTMLParser.h"
+#include "HTMLTokenizer.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+HTML5TreeBuilder::HTML5TreeBuilder(HTML5Lexer* lexer, HTMLDocument* document, bool reportErrors)
+ : m_document(document)
+ , m_reportErrors(reportErrors)
+ , m_lexer(lexer)
+ , m_legacyHTMLParser(new HTMLParser(document, reportErrors))
+{
+}
+
+HTML5TreeBuilder::~HTML5TreeBuilder()
+{
+}
+
+static void convertToOldStyle(HTML5Token& token, Token& oldStyleToken)
+{
+ switch (token.type()) {
+ case HTML5Token::Uninitialized:
+ ASSERT_NOT_REACHED();
+ break;
+ case HTML5Token::DOCTYPE:
+ case HTML5Token::EndOfFile:
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ break;
+ case HTML5Token::StartTag:
+ case HTML5Token::EndTag: {
+ oldStyleToken.beginTag = (token.type() == HTML5Token::StartTag);
+ oldStyleToken.selfClosingTag = token.selfClosing();
+ oldStyleToken.tagName = token.name();
+ HTML5Token::AttributeList& attributes = token.attributes();
+ for (HTML5Token::AttributeList::iterator iter = attributes.begin();
+ iter != attributes.end(); ++iter) {
+ if (!iter->m_name.isEmpty()) {
+ String name = String(StringImpl::adopt(iter->m_name));
+ String value = String(StringImpl::adopt(iter->m_value));
+ RefPtr<Attribute> mappedAttribute = Attribute::createMapped(name, value);
+ if (!oldStyleToken.attrs)
+ oldStyleToken.attrs = NamedNodeMap::create();
+ oldStyleToken.attrs->insertAttribute(mappedAttribute.release(), false);
+ }
+ }
+ break;
+ }
+ case HTML5Token::Comment:
+ oldStyleToken.tagName = commentAtom;
+ oldStyleToken.text = token.data().impl();
+ break;
+ case HTML5Token::Character:
+ oldStyleToken.tagName = textAtom;
+ oldStyleToken.text = token.characters().impl();
+ break;
+ }
+}
+
+PassRefPtr<Node> HTML5TreeBuilder::passTokenToLegacyParser(HTML5Token& token)
+{
+ if (token.type() == HTML5Token::StartTag && token.name() == "script") {
+ // This work is supposed to be done by the parser, but
+ // when using the old parser for we have to do this manually.
+ m_lexer->setState(HTML5Lexer::ScriptDataState);
+ }
+ // For now, we translate into an old-style token for testing.
+ Token oldStyleToken;
+ convertToOldStyle(token, oldStyleToken);
+
+ return m_legacyHTMLParser->parseToken(&oldStyleToken);
+}
+
+PassRefPtr<Node> HTML5TreeBuilder::constructTreeFromToken(HTML5Token& token)
+{
+ return passTokenToLegacyParser(token);
+ // Our HTML5 parser implementation will go here in a separate patch.
+}
+
+void HTML5TreeBuilder::finished()
+{
+ m_legacyHTMLParser->finished();
+}
+
+}
diff --git a/WebCore/html/HTML5TreeBuilder.h b/WebCore/html/HTML5TreeBuilder.h
new file mode 100644
index 0000000..466fd6e
--- /dev/null
+++ b/WebCore/html/HTML5TreeBuilder.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTML5TreeBuilder_h
+#define HTML5TreeBuilder_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+class Document;
+class HTML5Lexer;
+class HTML5Token;
+class HTMLDocument;
+class HTMLParser;
+class Node;
+
+class HTML5TreeBuilder : public Noncopyable {
+public:
+ HTML5TreeBuilder(HTML5Lexer*, HTMLDocument*, bool reportErrors);
+ ~HTML5TreeBuilder();
+
+ // The token really should be passed as a const& since it's never modified.
+ PassRefPtr<Node> constructTreeFromToken(HTML5Token&);
+ void finished();
+
+private:
+ PassRefPtr<Node> passTokenToLegacyParser(HTML5Token&);
+
+ // We could grab m_document off the lexer if we wanted to save space.
+ Document* m_document;
+ bool m_reportErrors;
+ // HTML5 spec requires that we be able to change the state of the lexer
+ // from within parser actions.
+ HTML5Lexer* m_lexer;
+
+ // We're re-using logic from the old HTMLParser while this class is being written.
+ OwnPtr<HTMLParser> m_legacyHTMLParser;
+};
+
+}
+
+#endif
diff --git a/WebCore/html/HTMLAnchorElement.cpp b/WebCore/html/HTMLAnchorElement.cpp
index e3752c3..d5faf8f 100644
--- a/WebCore/html/HTMLAnchorElement.cpp
+++ b/WebCore/html/HTMLAnchorElement.cpp
@@ -24,13 +24,13 @@
#include "config.h"
#include "HTMLAnchorElement.h"
+#include "Attribute.h"
#include "EventNames.h"
#include "Frame.h"
#include "FrameLoaderTypes.h"
#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "Page.h"
#include "RenderImage.h"
@@ -78,7 +78,7 @@ bool HTMLAnchorElement::supportsFocus() const
bool HTMLAnchorElement::isMouseFocusable() const
{
// Anchor elements should be mouse focusable, https://bugs.webkit.org/show_bug.cgi?id=26856
-#if !PLATFORM(GTK) && !PLATFORM(QT)
+#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL)
if (isLink())
// Only allow links with tabIndex or contentEditable to be mouse focusable.
return HTMLElement::supportsFocus();
@@ -251,7 +251,7 @@ void HTMLAnchorElement::setActive(bool down, bool pause)
ContainerNode::setActive(down, pause);
}
-void HTMLAnchorElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLAnchorElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == hrefAttr) {
bool wasLink = isLink();
diff --git a/WebCore/html/HTMLAnchorElement.h b/WebCore/html/HTMLAnchorElement.h
index 03d3529..4f7b4fd 100644
--- a/WebCore/html/HTMLAnchorElement.h
+++ b/WebCore/html/HTMLAnchorElement.h
@@ -94,7 +94,7 @@ public:
protected:
HTMLAnchorElement(const QualifiedName&, Document*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
private:
virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
diff --git a/WebCore/html/HTMLAppletElement.cpp b/WebCore/html/HTMLAppletElement.cpp
index fb23b5c..79fcfba 100644
--- a/WebCore/html/HTMLAppletElement.cpp
+++ b/WebCore/html/HTMLAppletElement.cpp
@@ -24,9 +24,9 @@
#include "config.h"
#include "HTMLAppletElement.h"
+#include "Attribute.h"
#include "HTMLDocument.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderApplet.h"
#include "SecurityOrigin.h"
#include "Settings.h"
@@ -46,7 +46,7 @@ PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tag
return adoptRef(new HTMLAppletElement(tagName, document));
}
-void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLAppletElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == altAttr ||
attr->name() == archiveAttr ||
diff --git a/WebCore/html/HTMLAppletElement.h b/WebCore/html/HTMLAppletElement.h
index a53bd5c..1e11b44 100644
--- a/WebCore/html/HTMLAppletElement.h
+++ b/WebCore/html/HTMLAppletElement.h
@@ -42,7 +42,7 @@ private:
virtual int tagPriority() const { return 1; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/html/HTMLAreaElement.cpp b/WebCore/html/HTMLAreaElement.cpp
index b862f69..c907f83 100644
--- a/WebCore/html/HTMLAreaElement.cpp
+++ b/WebCore/html/HTMLAreaElement.cpp
@@ -22,11 +22,11 @@
#include "config.h"
#include "HTMLAreaElement.h"
+#include "Attribute.h"
#include "HTMLImageElement.h"
#include "HTMLMapElement.h"
#include "HTMLNames.h"
#include "HitTestResult.h"
-#include "MappedAttribute.h"
#include "Path.h"
#include "RenderObject.h"
@@ -50,7 +50,7 @@ PassRefPtr<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName
return adoptRef(new HTMLAreaElement(tagName, document));
}
-void HTMLAreaElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLAreaElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == shapeAttr) {
if (equalIgnoringCase(attr->value(), "default"))
diff --git a/WebCore/html/HTMLAreaElement.h b/WebCore/html/HTMLAreaElement.h
index f8e2564..e6e087f 100644
--- a/WebCore/html/HTMLAreaElement.h
+++ b/WebCore/html/HTMLAreaElement.h
@@ -57,7 +57,7 @@ private:
virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
virtual int tagPriority() const { return 0; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool supportsFocus() const;
virtual String target() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
diff --git a/WebCore/html/HTMLBRElement.cpp b/WebCore/html/HTMLBRElement.cpp
index dbd8eba..57dc011 100644
--- a/WebCore/html/HTMLBRElement.cpp
+++ b/WebCore/html/HTMLBRElement.cpp
@@ -23,9 +23,9 @@
#include "config.h"
#include "HTMLBRElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderBR.h"
namespace WebCore {
@@ -48,7 +48,7 @@ bool HTMLBRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEnt
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLBRElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLBRElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == clearAttr) {
// If the string is empty, then don't add the clear property.
diff --git a/WebCore/html/HTMLBRElement.h b/WebCore/html/HTMLBRElement.h
index 6b20b37..5ae33c8 100644
--- a/WebCore/html/HTMLBRElement.h
+++ b/WebCore/html/HTMLBRElement.h
@@ -39,7 +39,7 @@ private:
virtual int tagPriority() const { return 0; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
};
diff --git a/WebCore/html/HTMLBaseElement.cpp b/WebCore/html/HTMLBaseElement.cpp
index 613a0f7..862f072 100644
--- a/WebCore/html/HTMLBaseElement.cpp
+++ b/WebCore/html/HTMLBaseElement.cpp
@@ -23,11 +23,11 @@
#include "config.h"
#include "HTMLBaseElement.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "Document.h"
#include "Frame.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "XSSAuditor.h"
namespace WebCore {
@@ -40,7 +40,7 @@ HTMLBaseElement::HTMLBaseElement(const QualifiedName& qName, Document* document)
ASSERT(hasTagName(baseTag));
}
-void HTMLBaseElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLBaseElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == hrefAttr) {
m_hrefAttrValue = attr->value();
diff --git a/WebCore/html/HTMLBaseElement.h b/WebCore/html/HTMLBaseElement.h
index d413bec..993a56f 100644
--- a/WebCore/html/HTMLBaseElement.h
+++ b/WebCore/html/HTMLBaseElement.h
@@ -37,7 +37,7 @@ private:
virtual String target() const { return m_target; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp
index e5a16cb..9e39cb3 100644
--- a/WebCore/html/HTMLBodyElement.cpp
+++ b/WebCore/html/HTMLBodyElement.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "HTMLBodyElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
#include "CSSStyleSheet.h"
#include "CSSValueKeywords.h"
@@ -32,7 +33,6 @@
#include "FrameView.h"
#include "HTMLFrameElementBase.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "ScriptEventListener.h"
#ifdef ANDROID_META_SUPPORT
@@ -87,7 +87,7 @@ bool HTMLBodyElement::mapToEntry(const QualifiedName& attrName, MappedAttributeE
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLBodyElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLBodyElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == backgroundAttr) {
String url = deprecatedParseURL(attr->value());
diff --git a/WebCore/html/HTMLBodyElement.h b/WebCore/html/HTMLBodyElement.h
index 76b49a1..f2c1f98 100644
--- a/WebCore/html/HTMLBodyElement.h
+++ b/WebCore/html/HTMLBodyElement.h
@@ -70,7 +70,7 @@ private:
virtual int tagPriority() const { return 10; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
diff --git a/WebCore/html/HTMLButtonElement.cpp b/WebCore/html/HTMLButtonElement.cpp
index b3d358d..2ef932b 100644
--- a/WebCore/html/HTMLButtonElement.cpp
+++ b/WebCore/html/HTMLButtonElement.cpp
@@ -26,14 +26,14 @@
#include "config.h"
#include "HTMLButtonElement.h"
+#include "Attribute.h"
#include "EventNames.h"
#include "FormDataList.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
-#include "ScriptEventListener.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "RenderButton.h"
+#include "ScriptEventListener.h"
#include <wtf/StdLibExtras.h>
namespace WebCore {
@@ -78,7 +78,7 @@ const AtomicString& HTMLButtonElement::formControlType() const
return emptyAtom;
}
-void HTMLButtonElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLButtonElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == typeAttr) {
if (equalIgnoringCase(attr->value(), "reset"))
diff --git a/WebCore/html/HTMLButtonElement.h b/WebCore/html/HTMLButtonElement.h
index f4df571..92951c3 100644
--- a/WebCore/html/HTMLButtonElement.h
+++ b/WebCore/html/HTMLButtonElement.h
@@ -37,7 +37,7 @@ public:
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void defaultEventHandler(Event*);
virtual bool appendFormData(FormDataList&, bool);
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp
index ef85323..205cf28 100644
--- a/WebCore/html/HTMLCanvasElement.cpp
+++ b/WebCore/html/HTMLCanvasElement.cpp
@@ -27,14 +27,11 @@
#include "config.h"
#include "HTMLCanvasElement.h"
+#include "Attribute.h"
#include "CanvasContextAttributes.h"
-#include "CanvasRenderingContext2D.h"
-#if ENABLE(3D_CANVAS)
-#include "WebGLContextAttributes.h"
-#include "WebGLRenderingContext.h"
-#endif
#include "CanvasGradient.h"
#include "CanvasPattern.h"
+#include "CanvasRenderingContext2D.h"
#include "CanvasStyle.h"
#include "Chrome.h"
#include "Document.h"
@@ -42,13 +39,17 @@
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "ImageBuffer.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderHTMLCanvas.h"
#include "Settings.h"
#include <math.h>
#include <stdio.h>
+#if ENABLE(3D_CANVAS)
+#include "WebGLContextAttributes.h"
+#include "WebGLRenderingContext.h"
+#endif
+
namespace WebCore {
using namespace HTMLNames;
@@ -90,7 +91,7 @@ int HTMLCanvasElement::tagPriority() const
#endif
-void HTMLCanvasElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLCanvasElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == widthAttr || attrName == heightAttr)
diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h
index 4ee4b3e..a7f42ce 100644
--- a/WebCore/html/HTMLCanvasElement.h
+++ b/WebCore/html/HTMLCanvasElement.h
@@ -110,7 +110,7 @@ private:
virtual int tagPriority() const;
#endif
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
void reset();
diff --git a/WebCore/html/HTMLDataGridColElement.cpp b/WebCore/html/HTMLDataGridColElement.cpp
index 935375e..7f02aa5 100644
--- a/WebCore/html/HTMLDataGridColElement.cpp
+++ b/WebCore/html/HTMLDataGridColElement.cpp
@@ -27,11 +27,11 @@
#if ENABLE(DATAGRID)
+#include "Attribute.h"
#include "DataGridColumn.h"
-#include "HTMLDataGridElement.h"
#include "HTMLDataGridColElement.h"
+#include "HTMLDataGridElement.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "Text.h"
namespace WebCore {
@@ -145,7 +145,7 @@ void HTMLDataGridColElement::setPrimary(bool primary)
setAttribute(primaryAttr, primary ? "" : 0);
}
-void HTMLDataGridColElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLDataGridColElement::parseMappedAttribute(Attribute* attr)
{
HTMLElement::parseMappedAttribute(attr);
diff --git a/WebCore/html/HTMLDataGridColElement.h b/WebCore/html/HTMLDataGridColElement.h
index d91ec51..2ee284b 100644
--- a/WebCore/html/HTMLDataGridColElement.h
+++ b/WebCore/html/HTMLDataGridColElement.h
@@ -43,7 +43,7 @@ public:
virtual int tagPriority() const { return 0; }
virtual void insertedIntoTree(bool /*deep*/);
virtual void removedFromTree(bool /*deep*/);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
String label() const;
void setLabel(const String&);
diff --git a/WebCore/html/HTMLDivElement.cpp b/WebCore/html/HTMLDivElement.cpp
index bd7195e..4482946 100644
--- a/WebCore/html/HTMLDivElement.cpp
+++ b/WebCore/html/HTMLDivElement.cpp
@@ -23,10 +23,10 @@
#include "config.h"
#include "HTMLDivElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -51,7 +51,7 @@ bool HTMLDivElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEn
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLDivElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLDivElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == alignAttr) {
String v = attr->value();
diff --git a/WebCore/html/HTMLDivElement.h b/WebCore/html/HTMLDivElement.h
index 49cbc38..8359b96 100644
--- a/WebCore/html/HTMLDivElement.h
+++ b/WebCore/html/HTMLDivElement.h
@@ -35,7 +35,7 @@ public:
virtual int tagPriority() const { return 5; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
String align() const;
void setAlign(const String&);
diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp
index c0e9eb7..5e08a99 100644
--- a/WebCore/html/HTMLDocument.cpp
+++ b/WebCore/html/HTMLDocument.cpp
@@ -64,6 +64,7 @@
#include "FrameLoader.h"
#include "FrameTree.h"
#include "FrameView.h"
+#include "HTML5Tokenizer.h"
#include "HTMLBodyElement.h"
#include "HTMLElementFactory.h"
#include "HTMLNames.h"
@@ -71,6 +72,7 @@
#include "InspectorController.h"
#include "KURL.h"
#include "Page.h"
+#include "Settings.h"
#include <wtf/text/CString.h>
#include "DocTypeStrings.cpp"
@@ -281,7 +283,7 @@ void HTMLDocument::releaseEvents()
{
}
-Tokenizer *HTMLDocument::createTokenizer()
+Tokenizer* HTMLDocument::createTokenizer()
{
bool reportErrors = false;
#if ENABLE(INSPECTOR)
@@ -289,6 +291,9 @@ Tokenizer *HTMLDocument::createTokenizer()
reportErrors = page->inspectorController()->windowVisible();
#endif
+ if (settings() && settings()->html5ParserEnabled())
+ return new HTML5Tokenizer(this, reportErrors);
+
return new HTMLTokenizer(this, reportErrors);
}
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index 77aa93b..a623f24 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "HTMLElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "DocumentFragment.h"
@@ -39,7 +40,6 @@
#include "HTMLFormElement.h"
#include "HTMLNames.h"
#include "HTMLTokenizer.h"
-#include "MappedAttribute.h"
#include "RenderWordBreak.h"
#include "ScriptEventListener.h"
#include "Settings.h"
@@ -142,7 +142,7 @@ bool HTMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry
return StyledElement::mapToEntry(attrName, result);
}
-void HTMLElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == idAttributeName() || attr->name() == classAttr || attr->name() == styleAttr)
return StyledElement::parseMappedAttribute(attr);
@@ -569,12 +569,12 @@ void HTMLElement::insertAdjacentText(const String& where, const String& text, Ex
insertAdjacent(where, textNode.get(), ec);
}
-void HTMLElement::addHTMLAlignment(MappedAttribute* attr)
+void HTMLElement::addHTMLAlignment(Attribute* attr)
{
addHTMLAlignmentToStyledElement(this, attr);
}
-void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, MappedAttribute* attr)
+void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, Attribute* attr)
{
// Vertical alignment with respect to the current baseline of the text
// right or left means floating images.
@@ -670,7 +670,7 @@ String HTMLElement::contentEditable() const
}
}
-void HTMLElement::setContentEditable(MappedAttribute* attr)
+void HTMLElement::setContentEditable(Attribute* attr)
{
const AtomicString& enabled = attr->value();
if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) {
@@ -858,9 +858,7 @@ static HashSet<AtomicStringImpl*>* inlineTagList()
tagList.add(rpTag.localName().impl());
tagList.add(rtTag.localName().impl());
tagList.add(rubyTag.localName().impl());
-#if ENABLE(PROGRESS_TAG)
tagList.add(progressTag.localName().impl());
-#endif
tagList.add(meterTag.localName().impl());
}
return &tagList;
diff --git a/WebCore/html/HTMLElement.h b/WebCore/html/HTMLElement.h
index b51dba4..db9cb98 100644
--- a/WebCore/html/HTMLElement.h
+++ b/WebCore/html/HTMLElement.h
@@ -79,15 +79,15 @@ public:
HTMLFormElement* form() const { return virtualForm(); }
- static void addHTMLAlignmentToStyledElement(StyledElement*, MappedAttribute*);
+ static void addHTMLAlignmentToStyledElement(StyledElement*, Attribute*);
protected:
HTMLElement(const QualifiedName& tagName, Document*, ConstructionType = CreateHTMLElementZeroRefCount);
- void addHTMLAlignment(MappedAttribute*);
+ void addHTMLAlignment(Attribute*);
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD
@@ -104,7 +104,7 @@ protected:
private:
virtual String nodeName() const;
- void setContentEditable(MappedAttribute*);
+ void setContentEditable(Attribute*);
virtual HTMLFormElement* virtualForm() const;
diff --git a/WebCore/html/HTMLEmbedElement.cpp b/WebCore/html/HTMLEmbedElement.cpp
index eba980c..3f700ef 100644
--- a/WebCore/html/HTMLEmbedElement.cpp
+++ b/WebCore/html/HTMLEmbedElement.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "HTMLEmbedElement.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "Frame.h"
@@ -31,7 +32,6 @@
#include "HTMLImageLoader.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
-#include "MappedAttribute.h"
#include "RenderEmbeddedObject.h"
#include "RenderImage.h"
#include "RenderWidget.h"
@@ -83,7 +83,7 @@ bool HTMLEmbedElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
return HTMLPlugInElement::mapToEntry(attrName, result);
}
-void HTMLEmbedElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLEmbedElement::parseMappedAttribute(Attribute* attr)
{
const AtomicString& value = attr->value();
diff --git a/WebCore/html/HTMLEmbedElement.h b/WebCore/html/HTMLEmbedElement.h
index 16f0893..53da011 100644
--- a/WebCore/html/HTMLEmbedElement.h
+++ b/WebCore/html/HTMLEmbedElement.h
@@ -40,7 +40,7 @@ private:
virtual int tagPriority() const { return 0; }
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual bool canLazyAttach() { return false; }
diff --git a/WebCore/html/HTMLFontElement.cpp b/WebCore/html/HTMLFontElement.cpp
index d19032a..b6de0b8 100644
--- a/WebCore/html/HTMLFontElement.cpp
+++ b/WebCore/html/HTMLFontElement.cpp
@@ -23,10 +23,10 @@
#include "config.h"
#include "HTMLFontElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
using namespace WTF;
@@ -130,7 +130,7 @@ bool HTMLFontElement::cssValueFromFontSizeNumber(const String& s, int& size)
return true;
}
-void HTMLFontElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLFontElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == sizeAttr) {
int size;
diff --git a/WebCore/html/HTMLFontElement.h b/WebCore/html/HTMLFontElement.h
index 029a23e..b3439b7 100644
--- a/WebCore/html/HTMLFontElement.h
+++ b/WebCore/html/HTMLFontElement.h
@@ -34,7 +34,7 @@ public:
virtual int tagPriority() const { return 1; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
String color() const;
void setColor(const String&);
diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp
index 5512236..5894999 100644
--- a/WebCore/html/HTMLFormControlElement.cpp
+++ b/WebCore/html/HTMLFormControlElement.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "HTMLFormControlElement.h"
+#include "Attribute.h"
#include "CharacterNames.h"
#include "Chrome.h"
#include "ChromeClient.h"
@@ -38,7 +39,6 @@
#include "HTMLNames.h"
#include "HTMLParser.h"
#include "HTMLTokenizer.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderBox.h"
#include "RenderTextControl.h"
@@ -92,7 +92,7 @@ ValidityState* HTMLFormControlElement::validity()
return m_validityState.get();
}
-void HTMLFormControlElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLFormControlElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == disabledAttr) {
bool oldDisabled = m_disabled;
@@ -604,7 +604,7 @@ VisibleSelection HTMLTextFormControlElement::selection() const
return toRenderTextControl(renderer())->selection(cachedSelectionStart(), cachedSelectionEnd());
}
-void HTMLTextFormControlElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLTextFormControlElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == placeholderAttr)
updatePlaceholderVisibility(true);
diff --git a/WebCore/html/HTMLFormControlElement.h b/WebCore/html/HTMLFormControlElement.h
index 5c13d24..befa67b 100644
--- a/WebCore/html/HTMLFormControlElement.h
+++ b/WebCore/html/HTMLFormControlElement.h
@@ -51,7 +51,7 @@ public:
virtual bool isTextFormControl() const { return false; }
virtual bool isEnabledFormControl() const { return !disabled(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual void insertedIntoTree(bool deep);
virtual void removedFromTree(bool deep);
@@ -189,7 +189,7 @@ protected:
void updatePlaceholderVisibility(bool);
virtual int cachedSelectionStart() const = 0;
virtual int cachedSelectionEnd() const = 0;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
private:
// A subclass should return true if placeholder processing is needed.
diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp
index 7c58364..c84454d 100644
--- a/WebCore/html/HTMLFormElement.cpp
+++ b/WebCore/html/HTMLFormElement.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "HTMLFormElement.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "DOMFormData.h"
#include "DOMWindow.h"
@@ -44,10 +45,9 @@
#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
-#include "ScriptEventListener.h"
#include "MIMETypeRegistry.h"
-#include "MappedAttribute.h"
#include "RenderTextControl.h"
+#include "ScriptEventListener.h"
#include "ValidityState.h"
#include <limits>
#include <wtf/CurrentTime.h>
@@ -431,7 +431,7 @@ void HTMLFormElement::reset()
m_inreset = false;
}
-void HTMLFormElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLFormElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == actionAttr)
m_url = deprecatedParseURL(attr->value());
diff --git a/WebCore/html/HTMLFormElement.h b/WebCore/html/HTMLFormElement.h
index 68aebdf..e3de222 100644
--- a/WebCore/html/HTMLFormElement.h
+++ b/WebCore/html/HTMLFormElement.h
@@ -71,7 +71,7 @@ public:
bool autoComplete() const { return m_autocomplete; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
void registerFormElement(HTMLFormControlElement*);
void removeFormElement(HTMLFormControlElement*);
diff --git a/WebCore/html/HTMLFrameElement.cpp b/WebCore/html/HTMLFrameElement.cpp
index b456ac3..3ccc87f 100644
--- a/WebCore/html/HTMLFrameElement.cpp
+++ b/WebCore/html/HTMLFrameElement.cpp
@@ -24,10 +24,10 @@
#include "config.h"
#include "HTMLFrameElement.h"
+#include "Attribute.h"
#include "Frame.h"
#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderFrame.h"
namespace WebCore {
@@ -80,7 +80,7 @@ void HTMLFrameElement::attach()
}
}
-void HTMLFrameElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLFrameElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == frameborderAttr) {
m_frameBorder = attr->value().toInt();
diff --git a/WebCore/html/HTMLFrameElement.h b/WebCore/html/HTMLFrameElement.h
index 4a8e16c..20f298e 100644
--- a/WebCore/html/HTMLFrameElement.h
+++ b/WebCore/html/HTMLFrameElement.h
@@ -48,7 +48,7 @@ private:
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
bool m_frameBorder;
bool m_frameBorderSet;
diff --git a/WebCore/html/HTMLFrameElementBase.cpp b/WebCore/html/HTMLFrameElementBase.cpp
index c30b74f..756dd84 100644
--- a/WebCore/html/HTMLFrameElementBase.cpp
+++ b/WebCore/html/HTMLFrameElementBase.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "HTMLFrameElementBase.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "Document.h"
#include "EventNames.h"
@@ -34,11 +35,11 @@
#include "FrameView.h"
#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
-#include "ScriptEventListener.h"
#include "KURL.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderFrame.h"
+#include "ScriptController.h"
+#include "ScriptEventListener.h"
#include "Settings.h"
namespace WebCore {
@@ -64,6 +65,12 @@ bool HTMLFrameElementBase::isURLAllowed() const
const KURL& completeURL = document()->completeURL(m_URL);
+ if (protocolIsJavaScript(completeURL)) {
+ Document* contentDoc = this->contentDocument();
+ if (contentDoc && !ScriptController::canAccessFromCurrentOrigin(contentDoc->frame()))
+ return false;
+ }
+
// Don't allow more than 200 total frames in a set. This seems
// like a reasonable upper bound, and otherwise mutually recursive
// frameset pages can quickly bring the program to its knees with
@@ -109,7 +116,7 @@ void HTMLFrameElementBase::openURL(bool lockHistory, bool lockBackForwardList)
contentFrame()->setInViewSourceMode(viewSourceMode());
}
-void HTMLFrameElementBase::parseMappedAttribute(MappedAttribute *attr)
+void HTMLFrameElementBase::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == srcAttr)
setLocation(deprecatedParseURL(attr->value()));
diff --git a/WebCore/html/HTMLFrameElementBase.h b/WebCore/html/HTMLFrameElementBase.h
index 6424ba7..1b6e2a3 100644
--- a/WebCore/html/HTMLFrameElementBase.h
+++ b/WebCore/html/HTMLFrameElementBase.h
@@ -49,7 +49,7 @@ protected:
bool isURLAllowed() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp
index a669e59..b97c498 100644
--- a/WebCore/html/HTMLFrameSetElement.cpp
+++ b/WebCore/html/HTMLFrameSetElement.cpp
@@ -24,16 +24,16 @@
#include "config.h"
#include "HTMLFrameSetElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
#include "HTMLNames.h"
-#include "ScriptEventListener.h"
#include "Length.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "RenderFrameSet.h"
+#include "ScriptEventListener.h"
#include "Text.h"
namespace WebCore {
@@ -83,7 +83,7 @@ bool HTMLFrameSetElement::mapToEntry(const QualifiedName& attrName, MappedAttrib
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLFrameSetElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == rowsAttr) {
if (!attr->isNull()) {
diff --git a/WebCore/html/HTMLFrameSetElement.h b/WebCore/html/HTMLFrameSetElement.h
index 0c75efe..faf800d 100644
--- a/WebCore/html/HTMLFrameSetElement.h
+++ b/WebCore/html/HTMLFrameSetElement.h
@@ -40,7 +40,7 @@ public:
virtual bool checkDTD(const Node* newChild);
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual bool rendererIsNeeded(RenderStyle*);
diff --git a/WebCore/html/HTMLHRElement.cpp b/WebCore/html/HTMLHRElement.cpp
index 6858f56..92fb3b2 100644
--- a/WebCore/html/HTMLHRElement.cpp
+++ b/WebCore/html/HTMLHRElement.cpp
@@ -23,10 +23,10 @@
#include "config.h"
#include "HTMLHRElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -55,7 +55,7 @@ bool HTMLHRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEnt
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLHRElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLHRElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == alignAttr) {
if (equalIgnoringCase(attr->value(), "left")) {
diff --git a/WebCore/html/HTMLHRElement.h b/WebCore/html/HTMLHRElement.h
index 7a9f498..8763082 100644
--- a/WebCore/html/HTMLHRElement.h
+++ b/WebCore/html/HTMLHRElement.h
@@ -35,7 +35,7 @@ public:
virtual int tagPriority() const { return 0; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
String align() const;
void setAlign(const String&);
diff --git a/WebCore/html/HTMLIFrameElement.cpp b/WebCore/html/HTMLIFrameElement.cpp
index cce39df..b3fffe3 100644
--- a/WebCore/html/HTMLIFrameElement.cpp
+++ b/WebCore/html/HTMLIFrameElement.cpp
@@ -25,11 +25,11 @@
#include "config.h"
#include "HTMLIFrameElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "Frame.h"
#include "HTMLDocument.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderIFrame.h"
namespace WebCore {
@@ -68,7 +68,7 @@ bool HTMLIFrameElement::mapToEntry(const QualifiedName& attrName, MappedAttribut
}
#if ENABLE(SANDBOX)
-static SandboxFlags parseSandboxAttribute(MappedAttribute* attribute)
+static SandboxFlags parseSandboxAttribute(Attribute* attribute)
{
if (attribute->isNull())
return SandboxNone;
@@ -105,7 +105,7 @@ static SandboxFlags parseSandboxAttribute(MappedAttribute* attribute)
}
#endif
-void HTMLIFrameElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLIFrameElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == widthAttr)
addCSSLength(attr, CSSPropertyWidth, attr->value());
diff --git a/WebCore/html/HTMLIFrameElement.h b/WebCore/html/HTMLIFrameElement.h
index c708456..1d01c66 100644
--- a/WebCore/html/HTMLIFrameElement.h
+++ b/WebCore/html/HTMLIFrameElement.h
@@ -39,7 +39,7 @@ private:
virtual int tagPriority() const { return 1; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp
index db66533..5256e6d 100644
--- a/WebCore/html/HTMLImageElement.cpp
+++ b/WebCore/html/HTMLImageElement.cpp
@@ -23,6 +23,7 @@
#include "config.h"
#include "HTMLImageElement.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
@@ -31,7 +32,6 @@
#include "HTMLDocument.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderImage.h"
#include "ScriptEventListener.h"
@@ -88,7 +88,7 @@ bool HTMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLImageElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLImageElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == altAttr) {
diff --git a/WebCore/html/HTMLImageElement.h b/WebCore/html/HTMLImageElement.h
index e9b813c..61faa39 100644
--- a/WebCore/html/HTMLImageElement.h
+++ b/WebCore/html/HTMLImageElement.h
@@ -44,7 +44,7 @@ public:
virtual int tagPriority() const { return 0; }
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index 31d2cc2..7994472 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -27,6 +27,7 @@
#include "HTMLInputElement.h"
#include "AXObjectCache.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "ChromeClient.h"
#include "DateComponents.h"
@@ -49,7 +50,6 @@
#include "HTMLParser.h"
#include "KeyboardEvent.h"
#include "LocalizedStrings.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "Page.h"
#include "RegularExpression.h"
@@ -849,7 +849,7 @@ void HTMLInputElement::setInputType(const String& t)
registerForActivationCallbackIfNeeded();
if (didRespectHeightAndWidth != willRespectHeightAndWidth) {
- NamedMappedAttrMap* map = mappedAttributes();
+ NamedNodeMap* map = mappedAttributes();
ASSERT(map);
if (Attribute* height = map->getAttributeItem(heightAttr))
attributeChanged(height, false);
@@ -1063,7 +1063,7 @@ bool HTMLInputElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLInputElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLInputElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == nameAttr) {
checkedRadioButtons(this).removeButton(this);
@@ -2646,8 +2646,36 @@ void HTMLInputElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons
bool HTMLInputElement::recalcWillValidate() const
{
- return HTMLFormControlElementWithState::recalcWillValidate()
- && inputType() != HIDDEN && inputType() != BUTTON && inputType() != RESET;
+ switch (inputType()) {
+ case CHECKBOX:
+ case COLOR:
+ case DATE:
+ case DATETIME:
+ case DATETIMELOCAL:
+ case EMAIL:
+ case FILE:
+ case ISINDEX:
+ case MONTH:
+ case NUMBER:
+ case PASSWORD:
+ case RADIO:
+ case RANGE:
+ case SEARCH:
+ case TELEPHONE:
+ case TEXT:
+ case TIME:
+ case URL:
+ case WEEK:
+ return HTMLFormControlElementWithState::recalcWillValidate();
+ case BUTTON:
+ case HIDDEN:
+ case IMAGE:
+ case RESET:
+ case SUBMIT:
+ return false;
+ }
+ ASSERT_NOT_REACHED();
+ return false;
}
bool HTMLInputElement::parseToDateComponents(InputType type, const String& formString, DateComponents* out)
diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h
index 96fb492..da9cee7 100644
--- a/WebCore/html/HTMLInputElement.h
+++ b/WebCore/html/HTMLInputElement.h
@@ -179,7 +179,7 @@ public:
virtual void accessKeyAction(bool sendToAnyElement);
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void copyNonAttributeProperties(const Element* source);
diff --git a/WebCore/html/HTMLIsIndexElement.cpp b/WebCore/html/HTMLIsIndexElement.cpp
index 31fafa6..5cc73de 100644
--- a/WebCore/html/HTMLIsIndexElement.cpp
+++ b/WebCore/html/HTMLIsIndexElement.cpp
@@ -25,8 +25,8 @@
#include "config.h"
#include "HTMLIsIndexElement.h"
+#include "Attribute.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -39,7 +39,7 @@ HTMLIsIndexElement::HTMLIsIndexElement(const QualifiedName& tagName, Document *d
setDefaultName(isindexTag.localName());
}
-void HTMLIsIndexElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLIsIndexElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == promptAttr)
setValue(attr->value());
diff --git a/WebCore/html/HTMLIsIndexElement.h b/WebCore/html/HTMLIsIndexElement.h
index ad56079..f8124f6 100644
--- a/WebCore/html/HTMLIsIndexElement.h
+++ b/WebCore/html/HTMLIsIndexElement.h
@@ -35,7 +35,7 @@ public:
virtual int tagPriority() const { return 0; }
virtual bool canTriggerImplicitSubmission() const { return true; }
- virtual void parseMappedAttribute(MappedAttribute *attr);
+ virtual void parseMappedAttribute(Attribute* attr);
String prompt() const;
void setPrompt(const String &);
diff --git a/WebCore/html/HTMLKeygenElement.cpp b/WebCore/html/HTMLKeygenElement.cpp
index 6af088f..dbcc2b2 100644
--- a/WebCore/html/HTMLKeygenElement.cpp
+++ b/WebCore/html/HTMLKeygenElement.cpp
@@ -25,11 +25,11 @@
#include "config.h"
#include "HTMLKeygenElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "FormDataList.h"
#include "HTMLNames.h"
#include "HTMLOptionElement.h"
-#include "MappedAttribute.h"
#include "SSLKeyGenerator.h"
#include "Text.h"
#include <wtf/StdLibExtras.h>
@@ -61,7 +61,7 @@ const AtomicString& HTMLKeygenElement::formControlType() const
return keygen;
}
-void HTMLKeygenElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLKeygenElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == challengeAttr)
m_challenge = attr->value();
diff --git a/WebCore/html/HTMLKeygenElement.h b/WebCore/html/HTMLKeygenElement.h
index b2a0c26..8b6b198 100644
--- a/WebCore/html/HTMLKeygenElement.h
+++ b/WebCore/html/HTMLKeygenElement.h
@@ -35,10 +35,12 @@ public:
virtual int tagPriority() const { return 0; }
virtual const AtomicString& formControlType() const;
virtual bool isEnumeratable() const { return false; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool appendFormData(FormDataList&, bool);
private:
+ virtual bool isOptionalFormControl() const { return false; }
+
AtomicString m_challenge;
AtomicString m_keyType;
};
diff --git a/WebCore/html/HTMLLIElement.cpp b/WebCore/html/HTMLLIElement.cpp
index a8a327a..1bfb6f5 100644
--- a/WebCore/html/HTMLLIElement.cpp
+++ b/WebCore/html/HTMLLIElement.cpp
@@ -23,10 +23,10 @@
#include "config.h"
#include "HTMLLIElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderListItem.h"
namespace WebCore {
@@ -50,7 +50,7 @@ bool HTMLLIElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEnt
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLLIElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLLIElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == valueAttr) {
m_requestedValue = attr->value().toInt();
diff --git a/WebCore/html/HTMLLIElement.h b/WebCore/html/HTMLLIElement.h
index e3afaf5..6b46b41 100644
--- a/WebCore/html/HTMLLIElement.h
+++ b/WebCore/html/HTMLLIElement.h
@@ -34,7 +34,7 @@ public:
virtual int tagPriority() const { return 3; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
diff --git a/WebCore/html/HTMLLinkElement.cpp b/WebCore/html/HTMLLinkElement.cpp
index 4afccde..c02c4fe 100644
--- a/WebCore/html/HTMLLinkElement.cpp
+++ b/WebCore/html/HTMLLinkElement.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "HTMLLinkElement.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "CachedCSSStyleSheet.h"
#include "DocLoader.h"
@@ -33,7 +34,6 @@
#include "FrameLoaderClient.h"
#include "FrameTree.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "Page.h"
@@ -112,7 +112,7 @@ StyleSheet* HTMLLinkElement::sheet() const
return m_sheet.get();
}
-void HTMLLinkElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLLinkElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == relAttr) {
tokenizeRelAttribute(attr->value(), m_relAttribute);
diff --git a/WebCore/html/HTMLLinkElement.h b/WebCore/html/HTMLLinkElement.h
index 4ca921f..8da4494 100644
--- a/WebCore/html/HTMLLinkElement.h
+++ b/WebCore/html/HTMLLinkElement.h
@@ -96,7 +96,7 @@ public:
StyleSheet* sheet() const;
// overload from HTMLElement
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
void process();
diff --git a/WebCore/html/HTMLMapElement.cpp b/WebCore/html/HTMLMapElement.cpp
index 10a05d6..cc709a0 100644
--- a/WebCore/html/HTMLMapElement.cpp
+++ b/WebCore/html/HTMLMapElement.cpp
@@ -22,6 +22,7 @@
#include "config.h"
#include "HTMLMapElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "HTMLAreaElement.h"
#include "HTMLCollection.h"
@@ -29,7 +30,6 @@
#include "HTMLNames.h"
#include "HitTestResult.h"
#include "IntSize.h"
-#include "MappedAttribute.h"
#include "RenderObject.h"
using namespace std;
@@ -95,7 +95,7 @@ HTMLImageElement* HTMLMapElement::imageElement() const
return 0;
}
-void HTMLMapElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLMapElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == idAttributeName() || attrName == nameAttr) {
diff --git a/WebCore/html/HTMLMapElement.h b/WebCore/html/HTMLMapElement.h
index f40e78e..8dc9edf 100644
--- a/WebCore/html/HTMLMapElement.h
+++ b/WebCore/html/HTMLMapElement.h
@@ -42,7 +42,7 @@ public:
const AtomicString& getName() const { return m_name; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
bool mapMouseEvent(int x, int y, const IntSize&, HitTestResult&);
diff --git a/WebCore/html/HTMLMarqueeElement.cpp b/WebCore/html/HTMLMarqueeElement.cpp
index 7c16f16..23122dc 100644
--- a/WebCore/html/HTMLMarqueeElement.cpp
+++ b/WebCore/html/HTMLMarqueeElement.cpp
@@ -23,10 +23,10 @@
#include "config.h"
#include "HTMLMarqueeElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderLayer.h"
#include "RenderMarquee.h"
@@ -64,7 +64,7 @@ bool HTMLMarqueeElement::mapToEntry(const QualifiedName& attrName, MappedAttribu
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLMarqueeElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLMarqueeElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == widthAttr) {
if (!attr->value().isEmpty())
diff --git a/WebCore/html/HTMLMarqueeElement.h b/WebCore/html/HTMLMarqueeElement.h
index 9100e8f..871edc8 100644
--- a/WebCore/html/HTMLMarqueeElement.h
+++ b/WebCore/html/HTMLMarqueeElement.h
@@ -38,7 +38,7 @@ public:
virtual int tagPriority() const { return 3; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
int minimumDelay() const { return m_minimumDelay; }
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index a08ff45..efef1d2 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -28,13 +28,14 @@
#if ENABLE(VIDEO)
#include "HTMLMediaElement.h"
+#include "Attribute.h"
+#include "CSSHelper.h"
+#include "CSSPropertyNames.h"
+#include "CSSValueKeywords.h"
#include "Chrome.h"
#include "ChromeClient.h"
#include "ClientRect.h"
#include "ClientRectList.h"
-#include "CSSHelper.h"
-#include "CSSPropertyNames.h"
-#include "CSSValueKeywords.h"
#include "ContentType.h"
#include "DocLoader.h"
#include "Event.h"
@@ -49,7 +50,6 @@
#include "HTMLSourceElement.h"
#include "HTMLVideoElement.h"
#include "MIMETypeRegistry.h"
-#include "MappedAttribute.h"
#include "MediaDocument.h"
#include "MediaError.h"
#include "MediaList.h"
@@ -129,6 +129,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc)
, m_needWidgetUpdate(false)
#endif
, m_dispatchingCanPlayEvent(false)
+ , m_loadInitiatedByUserGesture(false)
{
document()->registerForDocumentActivationCallbacks(this);
document()->registerForMediaVolumeCallbacks(this);
@@ -188,7 +189,7 @@ void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls)
#endif
}
-void HTMLMediaElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLMediaElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
@@ -468,6 +469,7 @@ void HTMLMediaElement::load(bool isUserGesture, ExceptionCode& ec)
if (m_restrictions & RequireUserGestureForLoadRestriction && !isUserGesture)
ec = INVALID_STATE_ERR;
else {
+ m_loadInitiatedByUserGesture = isUserGesture;
prepareForLoad();
loadInternal();
}
@@ -1206,7 +1208,7 @@ void HTMLMediaElement::play(bool isUserGesture)
Document* doc = document();
Settings* settings = doc->settings();
- if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayEvent) {
+ if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayEvent && !m_loadInitiatedByUserGesture) {
// It should be impossible to be processing the canplay event while handling a user gesture
// since it is dispatched asynchronously.
ASSERT(!isUserGesture);
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index 9c36438..35c2235 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -173,7 +173,7 @@ protected:
HTMLMediaElement(const QualifiedName&, Document*);
virtual ~HTMLMediaElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual void willMoveToNewOwnerDocument();
@@ -364,6 +364,7 @@ private:
#endif
bool m_dispatchingCanPlayEvent : 1;
+ bool m_loadInitiatedByUserGesture : 1;
};
} //namespace
diff --git a/WebCore/html/HTMLMetaElement.cpp b/WebCore/html/HTMLMetaElement.cpp
index 51bfac3..70129b1 100644
--- a/WebCore/html/HTMLMetaElement.cpp
+++ b/WebCore/html/HTMLMetaElement.cpp
@@ -23,9 +23,9 @@
#include "config.h"
#include "HTMLMetaElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#ifdef ANDROID_META_SUPPORT
#include "Settings.h"
@@ -46,7 +46,7 @@ HTMLMetaElement::~HTMLMetaElement()
{
}
-void HTMLMetaElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLMetaElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == http_equivAttr) {
m_equiv = attr->value();
diff --git a/WebCore/html/HTMLMetaElement.h b/WebCore/html/HTMLMetaElement.h
index 19e8ecd..61d6a86 100644
--- a/WebCore/html/HTMLMetaElement.h
+++ b/WebCore/html/HTMLMetaElement.h
@@ -34,7 +34,7 @@ public:
virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
virtual int tagPriority() const { return 0; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
void process();
diff --git a/WebCore/html/HTMLMeterElement.cpp b/WebCore/html/HTMLMeterElement.cpp
index 2c1f8a5..a1b74b2 100644
--- a/WebCore/html/HTMLMeterElement.cpp
+++ b/WebCore/html/HTMLMeterElement.cpp
@@ -22,12 +22,12 @@
#if ENABLE(METER_TAG)
#include "HTMLMeterElement.h"
+#include "Attribute.h"
#include "EventNames.h"
#include "FormDataList.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
#include "HTMLParser.h"
-#include "MappedAttribute.h"
#include "RenderMeter.h"
#include <wtf/StdLibExtras.h>
@@ -57,7 +57,7 @@ const AtomicString& HTMLMeterElement::formControlType() const
return meter;
}
-void HTMLMeterElement::parseMappedAttribute(MappedAttribute* attribute)
+void HTMLMeterElement::parseMappedAttribute(Attribute* attribute)
{
if (attribute->name() == valueAttr || attribute->name() == minAttr || attribute->name() == maxAttr || attribute->name() == lowAttr || attribute->name() == highAttr || attribute->name() == optimumAttr) {
if (renderer())
diff --git a/WebCore/html/HTMLMeterElement.h b/WebCore/html/HTMLMeterElement.h
index 0808b9f..a218584 100644
--- a/WebCore/html/HTMLMeterElement.h
+++ b/WebCore/html/HTMLMeterElement.h
@@ -57,7 +57,7 @@ private:
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
};
} // namespace
diff --git a/WebCore/html/HTMLOListElement.cpp b/WebCore/html/HTMLOListElement.cpp
index 344a069..82c4526 100644
--- a/WebCore/html/HTMLOListElement.cpp
+++ b/WebCore/html/HTMLOListElement.cpp
@@ -22,10 +22,10 @@
#include "config.h"
#include "HTMLOListElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderListItem.h"
namespace WebCore {
@@ -49,7 +49,7 @@ bool HTMLOListElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLOListElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLOListElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == typeAttr) {
if (attr->value() == "a")
diff --git a/WebCore/html/HTMLOListElement.h b/WebCore/html/HTMLOListElement.h
index b7a13ee..3d76abf 100644
--- a/WebCore/html/HTMLOListElement.h
+++ b/WebCore/html/HTMLOListElement.h
@@ -34,7 +34,7 @@ public:
virtual int tagPriority() const { return 5; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
bool compact() const;
void setCompact(bool);
diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp
index 74fbf21..ea130b9 100644
--- a/WebCore/html/HTMLObjectElement.cpp
+++ b/WebCore/html/HTMLObjectElement.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "HTMLObjectElement.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "EventNames.h"
#include "ExceptionCode.h"
@@ -32,13 +33,12 @@
#include "HTMLFormElement.h"
#include "HTMLImageLoader.h"
#include "HTMLNames.h"
-#include "ScriptEventListener.h"
#include "MIMETypeRegistry.h"
-#include "MappedAttribute.h"
#include "RenderEmbeddedObject.h"
#include "RenderImage.h"
#include "RenderWidget.h"
#include "ScriptController.h"
+#include "ScriptEventListener.h"
#include "Text.h"
namespace WebCore {
@@ -67,7 +67,7 @@ RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
return toRenderWidget(renderer());
}
-void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLObjectElement::parseMappedAttribute(Attribute* attr)
{
String val = attr->value();
int pos;
diff --git a/WebCore/html/HTMLObjectElement.h b/WebCore/html/HTMLObjectElement.h
index ec1132f..4a22ea3 100644
--- a/WebCore/html/HTMLObjectElement.h
+++ b/WebCore/html/HTMLObjectElement.h
@@ -55,7 +55,7 @@ private:
virtual int tagPriority() const { return 5; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual bool canLazyAttach() { return false; }
diff --git a/WebCore/html/HTMLOptGroupElement.cpp b/WebCore/html/HTMLOptGroupElement.cpp
index 90156da..5c5faac 100644
--- a/WebCore/html/HTMLOptGroupElement.cpp
+++ b/WebCore/html/HTMLOptGroupElement.cpp
@@ -97,7 +97,7 @@ void HTMLOptGroupElement::childrenChanged(bool changedByParser, Node* beforeChan
HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
-void HTMLOptGroupElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLOptGroupElement::parseMappedAttribute(Attribute* attr)
{
HTMLFormControlElement::parseMappedAttribute(attr);
recalcSelectOptions();
diff --git a/WebCore/html/HTMLOptGroupElement.h b/WebCore/html/HTMLOptGroupElement.h
index 6e5b043..cdd1d37 100644
--- a/WebCore/html/HTMLOptGroupElement.h
+++ b/WebCore/html/HTMLOptGroupElement.h
@@ -39,7 +39,7 @@ public:
virtual const AtomicString& formControlType() const;
virtual bool supportsFocus() const;
virtual bool isFocusable() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
virtual void attach();
virtual void detach();
diff --git a/WebCore/html/HTMLOptionElement.cpp b/WebCore/html/HTMLOptionElement.cpp
index 1e07221..fa430d3 100644
--- a/WebCore/html/HTMLOptionElement.cpp
+++ b/WebCore/html/HTMLOptionElement.cpp
@@ -26,12 +26,12 @@
#include "config.h"
#include "HTMLOptionElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "HTMLNames.h"
#include "HTMLSelectElement.h"
-#include "MappedAttribute.h"
#include "NodeRenderStyle.h"
#include "RenderMenuList.h"
#include "Text.h"
@@ -134,7 +134,7 @@ int HTMLOptionElement::index() const
return OptionElement::optionIndex(ownerSelectElement(), this);
}
-void HTMLOptionElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLOptionElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == selectedAttr)
m_data.setSelected(!attr->isNull());
diff --git a/WebCore/html/HTMLOptionElement.h b/WebCore/html/HTMLOptionElement.h
index 4255f25..4692119 100644
--- a/WebCore/html/HTMLOptionElement.h
+++ b/WebCore/html/HTMLOptionElement.h
@@ -29,9 +29,9 @@
namespace WebCore {
-class HTMLSelectElement;
+class Attribute;
class HTMLFormElement;
-class MappedAttribute;
+class HTMLSelectElement;
class HTMLOptionElement : public HTMLFormControlElement, public OptionElement {
friend class HTMLSelectElement;
@@ -59,7 +59,7 @@ public:
void setText(const String&, ExceptionCode&);
int index() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual String value() const;
void setValue(const String&);
diff --git a/WebCore/html/HTMLParagraphElement.cpp b/WebCore/html/HTMLParagraphElement.cpp
index a8deb10..f39e3ff 100644
--- a/WebCore/html/HTMLParagraphElement.cpp
+++ b/WebCore/html/HTMLParagraphElement.cpp
@@ -23,11 +23,11 @@
#include "config.h"
#include "HTMLParagraphElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -53,7 +53,7 @@ bool HTMLParagraphElement::mapToEntry(const QualifiedName& attrName, MappedAttri
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLParagraphElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLParagraphElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == alignAttr) {
String v = attr->value();
diff --git a/WebCore/html/HTMLParagraphElement.h b/WebCore/html/HTMLParagraphElement.h
index 8e1646f..496951a 100644
--- a/WebCore/html/HTMLParagraphElement.h
+++ b/WebCore/html/HTMLParagraphElement.h
@@ -35,7 +35,7 @@ public:
virtual bool checkDTD(const Node* newChild);
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
String align() const;
void setAlign(const String&);
diff --git a/WebCore/html/HTMLParamElement.cpp b/WebCore/html/HTMLParamElement.cpp
index 2b0637a..61a5a65 100644
--- a/WebCore/html/HTMLParamElement.cpp
+++ b/WebCore/html/HTMLParamElement.cpp
@@ -23,9 +23,9 @@
#include "config.h"
#include "HTMLParamElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -41,7 +41,7 @@ HTMLParamElement::~HTMLParamElement()
{
}
-void HTMLParamElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLParamElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == idAttributeName()) {
// Must call base class so that hasID bit gets set.
diff --git a/WebCore/html/HTMLParamElement.h b/WebCore/html/HTMLParamElement.h
index 1867ccf..84152c6 100644
--- a/WebCore/html/HTMLParamElement.h
+++ b/WebCore/html/HTMLParamElement.h
@@ -36,7 +36,7 @@ public:
virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
virtual int tagPriority() const { return 0; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool isURLAttribute(Attribute*) const;
diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp
index 428e8d5..0f0a0fc 100644
--- a/WebCore/html/HTMLParser.cpp
+++ b/WebCore/html/HTMLParser.cpp
@@ -55,6 +55,7 @@
#include "HTMLTokenizer.h"
#include "LocalizedStrings.h"
#include "Page.h"
+#include "QualifiedName.h"
#include "Settings.h"
#include "Text.h"
#include "TreeDepthLimit.h"
@@ -77,6 +78,18 @@ static const int minBlockLevelTagPriority = 3;
// siblings instead of children once it is reached.
static const size_t cMaxBlockDepth = 4096;
+
+typedef HashSet<AtomicStringImpl*> TagNameSet;
+
+template< size_t ArraySize >
+static void addTags(TagNameSet& set, QualifiedName (&names)[ArraySize])
+{
+ for (size_t x = 0; x < ArraySize; x++) {
+ const QualifiedName& name = names[x];
+ set.add(name.localName().impl());
+ }
+}
+
struct HTMLStackElem : Noncopyable {
HTMLStackElem(const AtomicString& t, int lvl, Node* n, bool r, HTMLStackElem* nx)
: tagName(t)
@@ -342,8 +355,8 @@ static bool isTableSection(const Node* n)
static bool isTablePart(const Node* n)
{
- return n->hasTagName(trTag) || n->hasTagName(tdTag) || n->hasTagName(thTag) ||
- isTableSection(n);
+ return n->hasTagName(trTag) || n->hasTagName(tdTag) || n->hasTagName(thTag)
+ || isTableSection(n);
}
static bool isTableRelated(const Node* n)
@@ -353,7 +366,9 @@ static bool isTableRelated(const Node* n)
static bool isScopingTag(const AtomicString& tagName)
{
- return tagName == appletTag || tagName == captionTag || tagName == tdTag || tagName == thTag || tagName == buttonTag || tagName == marqueeTag || tagName == objectTag || tagName == tableTag || tagName == htmlTag;
+ return tagName == appletTag || tagName == captionTag || tagName == tdTag
+ || tagName == thTag || tagName == buttonTag || tagName == marqueeTag
+ || tagName == objectTag || tagName == tableTag || tagName == htmlTag;
}
bool HTMLParser::insertNode(Node* n, bool flat)
@@ -912,74 +927,62 @@ bool HTMLParser::mapCreateErrorCheck(Token*, RefPtr<Node>& result)
return false;
}
+static void mapTagToFunc(FunctionMap& map, const QualifiedName& tag, CreateErrorCheckFunc func)
+{
+ map.set(tag.localName().impl(), func);
+}
+
+template< size_t ArraySize >
+static void mapTagsToFunc(FunctionMap& map, QualifiedName (&names)[ArraySize], CreateErrorCheckFunc func)
+{
+ for (size_t x = 0; x < ArraySize; x++) {
+ const QualifiedName& name = names[x];
+ mapTagToFunc(map, name, func);
+ }
+}
+
PassRefPtr<Node> HTMLParser::getNode(Token* t)
{
// Init our error handling table.
DEFINE_STATIC_LOCAL(FunctionMap, gFunctionMap, ());
if (gFunctionMap.isEmpty()) {
- gFunctionMap.set(aTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
- gFunctionMap.set(addressTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(articleTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(asideTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(bTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(bigTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(blockquoteTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(bodyTag.localName().impl(), &HTMLParser::bodyCreateErrorCheck);
- gFunctionMap.set(buttonTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
- gFunctionMap.set(centerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+ QualifiedName nestedCreateErrorTags[] = { aTag, buttonTag, nobrTag, trTag };
+ mapTagsToFunc(gFunctionMap, nestedCreateErrorTags, &HTMLParser::nestedCreateErrorCheck);
+
+ QualifiedName nestedStyleCreateErrorTags[] = { bTag, bigTag, iTag, sTag, smallTag, strikeTag, ttTag, uTag };
+ mapTagsToFunc(gFunctionMap, nestedStyleCreateErrorTags, &HTMLParser::nestedStyleCreateErrorCheck);
+
+ QualifiedName pCloserCreateErrorTags[] = { addressTag, articleTag,
+ asideTag, blockquoteTag, centerTag, dirTag, divTag, dlTag,
+ fieldsetTag, footerTag, h1Tag, h2Tag, h3Tag, h4Tag, h5Tag, h6Tag,
+ headerTag, hgroupTag, hrTag, listingTag, menuTag, navTag, olTag,
+ pTag, plaintextTag, preTag, sectionTag, ulTag };
+ mapTagsToFunc(gFunctionMap, pCloserCreateErrorTags, &HTMLParser::pCloserCreateErrorCheck);
+
+ mapTagToFunc(gFunctionMap, bodyTag, &HTMLParser::bodyCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, ddTag, &HTMLParser::ddCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, dtTag, &HTMLParser::dtCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, formTag, &HTMLParser::formCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, framesetTag, &HTMLParser::framesetCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, headTag, &HTMLParser::headCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, isindexTag, &HTMLParser::isindexCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, mapTag, &HTMLParser::mapCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, liTag, &HTMLParser::nestedPCloserCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, noembedTag, &HTMLParser::noembedCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, noframesTag, &HTMLParser::noframesCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, noscriptTag, &HTMLParser::noscriptCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, tableTag, &HTMLParser::pCloserStrictCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, rpTag, &HTMLParser::rpCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, rtTag, &HTMLParser::rtCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, selectTag, &HTMLParser::selectCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, tdTag, &HTMLParser::tableCellCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, thTag, &HTMLParser::tableCellCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, tbodyTag, &HTMLParser::tableSectionCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, tfootTag, &HTMLParser::tableSectionCreateErrorCheck);
+ mapTagToFunc(gFunctionMap, theadTag, &HTMLParser::tableSectionCreateErrorCheck);
+
gFunctionMap.set(commentAtom.impl(), &HTMLParser::commentCreateErrorCheck);
- gFunctionMap.set(ddTag.localName().impl(), &HTMLParser::ddCreateErrorCheck);
- gFunctionMap.set(dirTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(divTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(dlTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(dtTag.localName().impl(), &HTMLParser::dtCreateErrorCheck);
- gFunctionMap.set(formTag.localName().impl(), &HTMLParser::formCreateErrorCheck);
- gFunctionMap.set(fieldsetTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(footerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(framesetTag.localName().impl(), &HTMLParser::framesetCreateErrorCheck);
- gFunctionMap.set(h1Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(h2Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(h3Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(h4Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(h5Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(h6Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(headTag.localName().impl(), &HTMLParser::headCreateErrorCheck);
- gFunctionMap.set(headerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(hgroupTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(hrTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(iTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(isindexTag.localName().impl(), &HTMLParser::isindexCreateErrorCheck);
- gFunctionMap.set(liTag.localName().impl(), &HTMLParser::nestedPCloserCreateErrorCheck);
- gFunctionMap.set(listingTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(mapTag.localName().impl(), &HTMLParser::mapCreateErrorCheck);
- gFunctionMap.set(menuTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(navTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(nobrTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
- gFunctionMap.set(noembedTag.localName().impl(), &HTMLParser::noembedCreateErrorCheck);
- gFunctionMap.set(noframesTag.localName().impl(), &HTMLParser::noframesCreateErrorCheck);
- gFunctionMap.set(noscriptTag.localName().impl(), &HTMLParser::noscriptCreateErrorCheck);
- gFunctionMap.set(olTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(pTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(plaintextTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(preTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(rpTag.localName().impl(), &HTMLParser::rpCreateErrorCheck);
- gFunctionMap.set(rtTag.localName().impl(), &HTMLParser::rtCreateErrorCheck);
- gFunctionMap.set(sTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(sectionTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
- gFunctionMap.set(selectTag.localName().impl(), &HTMLParser::selectCreateErrorCheck);
- gFunctionMap.set(smallTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(strikeTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(tableTag.localName().impl(), &HTMLParser::pCloserStrictCreateErrorCheck);
- gFunctionMap.set(tbodyTag.localName().impl(), &HTMLParser::tableSectionCreateErrorCheck);
- gFunctionMap.set(tdTag.localName().impl(), &HTMLParser::tableCellCreateErrorCheck);
gFunctionMap.set(textAtom.impl(), &HTMLParser::textCreateErrorCheck);
- gFunctionMap.set(tfootTag.localName().impl(), &HTMLParser::tableSectionCreateErrorCheck);
- gFunctionMap.set(thTag.localName().impl(), &HTMLParser::tableCellCreateErrorCheck);
- gFunctionMap.set(theadTag.localName().impl(), &HTMLParser::tableSectionCreateErrorCheck);
- gFunctionMap.set(trTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
- gFunctionMap.set(ttTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(uTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
- gFunctionMap.set(ulTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
}
bool proceed = true;
@@ -1035,16 +1038,11 @@ void HTMLParser::processCloseTag(Token* t)
bool HTMLParser::isHeadingTag(const AtomicString& tagName)
{
- DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, headingTags, ());
+ DEFINE_STATIC_LOCAL(TagNameSet, headingTags, ());
if (headingTags.isEmpty()) {
- headingTags.add(h1Tag.localName().impl());
- headingTags.add(h2Tag.localName().impl());
- headingTags.add(h3Tag.localName().impl());
- headingTags.add(h4Tag.localName().impl());
- headingTags.add(h5Tag.localName().impl());
- headingTags.add(h6Tag.localName().impl());
+ QualifiedName tagNames[] = { h1Tag, h2Tag, h3Tag, h4Tag, h5Tag, h6Tag };
+ addTags(headingTags, tagNames);
}
-
return headingTags.contains(tagName.impl());
}
@@ -1082,26 +1080,11 @@ bool HTMLParser::isResidualStyleTag(const AtomicString& tagName)
{
DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, residualStyleTags, ());
if (residualStyleTags.isEmpty()) {
- residualStyleTags.add(aTag.localName().impl());
- residualStyleTags.add(fontTag.localName().impl());
- residualStyleTags.add(ttTag.localName().impl());
- residualStyleTags.add(uTag.localName().impl());
- residualStyleTags.add(bTag.localName().impl());
- residualStyleTags.add(iTag.localName().impl());
- residualStyleTags.add(sTag.localName().impl());
- residualStyleTags.add(strikeTag.localName().impl());
- residualStyleTags.add(bigTag.localName().impl());
- residualStyleTags.add(smallTag.localName().impl());
- residualStyleTags.add(emTag.localName().impl());
- residualStyleTags.add(strongTag.localName().impl());
- residualStyleTags.add(dfnTag.localName().impl());
- residualStyleTags.add(codeTag.localName().impl());
- residualStyleTags.add(sampTag.localName().impl());
- residualStyleTags.add(kbdTag.localName().impl());
- residualStyleTags.add(varTag.localName().impl());
- residualStyleTags.add(nobrTag.localName().impl());
+ QualifiedName tagNames[] = { aTag, fontTag, ttTag, uTag, bTag, iTag,
+ sTag, strikeTag, bigTag, smallTag, emTag, strongTag, dfnTag,
+ codeTag, sampTag, kbdTag, varTag, nobrTag };
+ addTags(residualStyleTags, tagNames);
}
-
return residualStyleTags.contains(tagName.impl());
}
@@ -1109,25 +1092,11 @@ bool HTMLParser::isAffectedByResidualStyle(const AtomicString& tagName)
{
DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, unaffectedTags, ());
if (unaffectedTags.isEmpty()) {
- unaffectedTags.add(bodyTag.localName().impl());
- unaffectedTags.add(tableTag.localName().impl());
- unaffectedTags.add(theadTag.localName().impl());
- unaffectedTags.add(tbodyTag.localName().impl());
- unaffectedTags.add(tfootTag.localName().impl());
- unaffectedTags.add(trTag.localName().impl());
- unaffectedTags.add(thTag.localName().impl());
- unaffectedTags.add(tdTag.localName().impl());
- unaffectedTags.add(captionTag.localName().impl());
- unaffectedTags.add(colgroupTag.localName().impl());
- unaffectedTags.add(colTag.localName().impl());
- unaffectedTags.add(optionTag.localName().impl());
- unaffectedTags.add(optgroupTag.localName().impl());
- unaffectedTags.add(selectTag.localName().impl());
- unaffectedTags.add(objectTag.localName().impl());
- unaffectedTags.add(datagridTag.localName().impl());
- unaffectedTags.add(datalistTag.localName().impl());
+ QualifiedName tagNames[] = { bodyTag, tableTag, theadTag, tbodyTag,
+ tfootTag, trTag, thTag, tdTag, captionTag, colgroupTag, colTag,
+ optionTag, optgroupTag, selectTag, objectTag, datagridTag, datalistTag };
+ addTags(unaffectedTags, tagNames);
}
-
return !unaffectedTags.contains(tagName.impl());
}
@@ -1629,7 +1598,7 @@ PassRefPtr<Node> HTMLParser::handleIsindex(Token* t)
{
RefPtr<Node> n = new HTMLDivElement(divTag, m_document);
- NamedMappedAttrMap* attrs = t->attrs.get();
+ NamedNodeMap* attrs = t->attrs.get();
RefPtr<HTMLIsIndexElement> isIndex = new HTMLIsIndexElement(isindexTag, m_document, m_currentFormElement.get());
isIndex->setAttributeMap(attrs);
diff --git a/WebCore/html/HTMLPlugInElement.cpp b/WebCore/html/HTMLPlugInElement.cpp
index 51db115..18b1c6a 100644
--- a/WebCore/html/HTMLPlugInElement.cpp
+++ b/WebCore/html/HTMLPlugInElement.cpp
@@ -23,13 +23,13 @@
#include "config.h"
#include "HTMLPlugInElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameTree.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderWidget.h"
#include "ScriptController.h"
@@ -126,7 +126,7 @@ bool HTMLPlugInElement::mapToEntry(const QualifiedName& attrName, MappedAttribut
return HTMLFrameOwnerElement::mapToEntry(attrName, result);
}
-void HTMLPlugInElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLPlugInElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == widthAttr)
addCSSLength(attr, CSSPropertyWidth, attr->value());
diff --git a/WebCore/html/HTMLPlugInElement.h b/WebCore/html/HTMLPlugInElement.h
index cf18e27..e9cd9d0 100644
--- a/WebCore/html/HTMLPlugInElement.h
+++ b/WebCore/html/HTMLPlugInElement.h
@@ -58,7 +58,7 @@ protected:
static void updateWidgetCallback(Node*);
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
#if PLATFORM(ANDROID)
// in Android, plugin has a focused mode where it accepts all the touch events.
diff --git a/WebCore/html/HTMLPreElement.cpp b/WebCore/html/HTMLPreElement.cpp
index 030660f..0108ff3 100644
--- a/WebCore/html/HTMLPreElement.cpp
+++ b/WebCore/html/HTMLPreElement.cpp
@@ -23,10 +23,10 @@
#include "config.h"
#include "HTMLPreElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -46,7 +46,7 @@ bool HTMLPreElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEn
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLPreElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLPreElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == widthAttr) {
// FIXME: Implement this some day. Width on a <pre> is the # of characters that
diff --git a/WebCore/html/HTMLPreElement.h b/WebCore/html/HTMLPreElement.h
index e84f4b3..17b945e 100644
--- a/WebCore/html/HTMLPreElement.h
+++ b/WebCore/html/HTMLPreElement.h
@@ -34,7 +34,7 @@ public:
virtual int tagPriority() const { return 5; }
bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- void parseMappedAttribute(MappedAttribute*);
+ void parseMappedAttribute(Attribute*);
int width() const;
void setWidth(int w);
diff --git a/WebCore/html/HTMLProgressElement.cpp b/WebCore/html/HTMLProgressElement.cpp
index 84a9794..d275ebf 100644
--- a/WebCore/html/HTMLProgressElement.cpp
+++ b/WebCore/html/HTMLProgressElement.cpp
@@ -22,12 +22,12 @@
#if ENABLE(PROGRESS_TAG)
#include "HTMLProgressElement.h"
+#include "Attribute.h"
#include "EventNames.h"
#include "FormDataList.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
#include "HTMLParser.h"
-#include "MappedAttribute.h"
#include "RenderProgress.h"
#include <wtf/StdLibExtras.h>
@@ -57,7 +57,7 @@ const AtomicString& HTMLProgressElement::formControlType() const
return progress;
}
-void HTMLProgressElement::parseMappedAttribute(MappedAttribute* attribute)
+void HTMLProgressElement::parseMappedAttribute(Attribute* attribute)
{
if (attribute->name() == valueAttr) {
if (renderer())
diff --git a/WebCore/html/HTMLProgressElement.h b/WebCore/html/HTMLProgressElement.h
index eaf4ce9..7900063 100644
--- a/WebCore/html/HTMLProgressElement.h
+++ b/WebCore/html/HTMLProgressElement.h
@@ -41,13 +41,13 @@ public:
private:
HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
- virtual bool isOptionalFormControl() const { return true; }
+ virtual bool recalcWillValidate() const { return false; }
virtual const AtomicString& formControlType() const;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
};
} // namespace
diff --git a/WebCore/html/HTMLScriptElement.cpp b/WebCore/html/HTMLScriptElement.cpp
index 58c3b03..83af32e 100644
--- a/WebCore/html/HTMLScriptElement.cpp
+++ b/WebCore/html/HTMLScriptElement.cpp
@@ -23,11 +23,11 @@
#include "config.h"
#include "HTMLScriptElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "ScriptEventListener.h"
#include "Text.h"
@@ -63,7 +63,7 @@ void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
-void HTMLScriptElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLScriptElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
diff --git a/WebCore/html/HTMLScriptElement.h b/WebCore/html/HTMLScriptElement.h
index b6d683f..f5c3acb 100644
--- a/WebCore/html/HTMLScriptElement.h
+++ b/WebCore/html/HTMLScriptElement.h
@@ -42,7 +42,7 @@ public:
virtual int tagPriority() const { return 1; }
virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/html/HTMLSelectElement.cpp b/WebCore/html/HTMLSelectElement.cpp
index 12ec26f..c053a84 100644
--- a/WebCore/html/HTMLSelectElement.cpp
+++ b/WebCore/html/HTMLSelectElement.cpp
@@ -28,11 +28,11 @@
#include "HTMLSelectElement.h"
#include "AXObjectCache.h"
+#include "Attribute.h"
#include "EventNames.h"
#include "HTMLNames.h"
#include "HTMLOptionElement.h"
#include "HTMLOptionsCollection.h"
-#include "MappedAttribute.h"
#include "RenderListBox.h"
#include "RenderMenuList.h"
#include "ScriptEventListener.h"
@@ -189,7 +189,7 @@ void HTMLSelectElement::restoreFormControlState(const String& state)
SelectElement::restoreFormControlState(m_data, this, state);
}
-void HTMLSelectElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLSelectElement::parseMappedAttribute(Attribute* attr)
{
bool oldUsesMenuList = m_data.usesMenuList();
if (attr->name() == sizeAttr) {
diff --git a/WebCore/html/HTMLSelectElement.h b/WebCore/html/HTMLSelectElement.h
index 8a31efc..c31e7f6 100644
--- a/WebCore/html/HTMLSelectElement.h
+++ b/WebCore/html/HTMLSelectElement.h
@@ -106,7 +106,7 @@ private:
virtual bool saveFormControlState(String& value) const;
virtual void restoreFormControlState(const String&);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle *);
virtual bool appendFormData(FormDataList&, bool);
diff --git a/WebCore/html/HTMLStyleElement.cpp b/WebCore/html/HTMLStyleElement.cpp
index 206aec4..1cdfed2 100644
--- a/WebCore/html/HTMLStyleElement.cpp
+++ b/WebCore/html/HTMLStyleElement.cpp
@@ -24,9 +24,9 @@
#include "config.h"
#include "HTMLStyleElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -41,7 +41,7 @@ HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document* doc,
}
// other stuff...
-void HTMLStyleElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLStyleElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == mediaAttr)
m_media = attr->value().string().lower();
diff --git a/WebCore/html/HTMLStyleElement.h b/WebCore/html/HTMLStyleElement.h
index 03b4c66..ba8ed3e 100644
--- a/WebCore/html/HTMLStyleElement.h
+++ b/WebCore/html/HTMLStyleElement.h
@@ -37,7 +37,7 @@ public:
virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
// overload from HTMLElement
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/html/HTMLTableCaptionElement.cpp b/WebCore/html/HTMLTableCaptionElement.cpp
index 2c94727..828a4e9 100644
--- a/WebCore/html/HTMLTableCaptionElement.cpp
+++ b/WebCore/html/HTMLTableCaptionElement.cpp
@@ -25,9 +25,9 @@
#include "config.h"
#include "HTMLTableCaptionElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -49,7 +49,7 @@ bool HTMLTableCaptionElement::mapToEntry(const QualifiedName& attrName, MappedAt
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLTableCaptionElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLTableCaptionElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == alignAttr) {
if (!attr->value().isEmpty())
diff --git a/WebCore/html/HTMLTableCaptionElement.h b/WebCore/html/HTMLTableCaptionElement.h
index 3c2aaa1..cf9d4d9 100644
--- a/WebCore/html/HTMLTableCaptionElement.h
+++ b/WebCore/html/HTMLTableCaptionElement.h
@@ -38,7 +38,7 @@ public:
virtual int tagPriority() const { return 5; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
String align() const;
void setAlign(const String&);
diff --git a/WebCore/html/HTMLTableCellElement.cpp b/WebCore/html/HTMLTableCellElement.cpp
index 94bf82e..7d71ff4 100644
--- a/WebCore/html/HTMLTableCellElement.cpp
+++ b/WebCore/html/HTMLTableCellElement.cpp
@@ -25,11 +25,11 @@
#include "config.h"
#include "HTMLTableCellElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
#include "HTMLTableElement.h"
-#include "MappedAttribute.h"
#include "RenderTableCell.h"
#ifdef ANDROID_LAYOUT
#include "Document.h"
@@ -89,7 +89,7 @@ bool HTMLTableCellElement::mapToEntry(const QualifiedName& attrName, MappedAttri
return HTMLTablePartElement::mapToEntry(attrName, result);
}
-void HTMLTableCellElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLTableCellElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == rowspanAttr) {
rSpan = !attr->isNull() ? attr->value().toInt() : 1;
diff --git a/WebCore/html/HTMLTableCellElement.h b/WebCore/html/HTMLTableCellElement.h
index 9cb7cf5..b598ce8 100644
--- a/WebCore/html/HTMLTableCellElement.h
+++ b/WebCore/html/HTMLTableCellElement.h
@@ -49,7 +49,7 @@ public:
int rowSpan() const { return rSpan; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
// used by table cells to share style decls created by the enclosing table.
virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
diff --git a/WebCore/html/HTMLTableColElement.cpp b/WebCore/html/HTMLTableColElement.cpp
index 27ff6f7..7a40be2 100644
--- a/WebCore/html/HTMLTableColElement.cpp
+++ b/WebCore/html/HTMLTableColElement.cpp
@@ -25,10 +25,10 @@
#include "config.h"
#include "HTMLTableColElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
#include "HTMLTableElement.h"
-#include "MappedAttribute.h"
#include "RenderTableCol.h"
#include "Text.h"
@@ -72,7 +72,7 @@ bool HTMLTableColElement::mapToEntry(const QualifiedName& attrName, MappedAttrib
return HTMLTablePartElement::mapToEntry(attrName, result);
}
-void HTMLTableColElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLTableColElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == spanAttr) {
_span = !attr->isNull() ? attr->value().toInt() : 1;
diff --git a/WebCore/html/HTMLTableColElement.h b/WebCore/html/HTMLTableColElement.h
index af785f3..3710c11 100644
--- a/WebCore/html/HTMLTableColElement.h
+++ b/WebCore/html/HTMLTableColElement.h
@@ -42,7 +42,7 @@ public:
// overrides
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&);
diff --git a/WebCore/html/HTMLTableElement.cpp b/WebCore/html/HTMLTableElement.cpp
index af35740..338f505 100644
--- a/WebCore/html/HTMLTableElement.cpp
+++ b/WebCore/html/HTMLTableElement.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "HTMLTableElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSStyleSheet.h"
#include "CSSValueKeywords.h"
@@ -34,7 +35,6 @@
#include "HTMLTableRowElement.h"
#include "HTMLTableRowsCollection.h"
#include "HTMLTableSectionElement.h"
-#include "MappedAttribute.h"
#include "RenderTable.h"
#include "Text.h"
@@ -316,7 +316,7 @@ static bool setTableCellsChanged(Node* n)
return cellChanged;
}
-void HTMLTableElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLTableElement::parseMappedAttribute(Attribute* attr)
{
CellBorders bordersBefore = cellBorders();
unsigned short oldPadding = m_padding;
diff --git a/WebCore/html/HTMLTableElement.h b/WebCore/html/HTMLTableElement.h
index 3c6589a..7f1e747 100644
--- a/WebCore/html/HTMLTableElement.h
+++ b/WebCore/html/HTMLTableElement.h
@@ -92,7 +92,7 @@ public:
virtual ContainerNode* addChild(PassRefPtr<Node>);
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual bool isURLAttribute(Attribute*) const;
diff --git a/WebCore/html/HTMLTablePartElement.cpp b/WebCore/html/HTMLTablePartElement.cpp
index f060dce..316ace4 100644
--- a/WebCore/html/HTMLTablePartElement.cpp
+++ b/WebCore/html/HTMLTablePartElement.cpp
@@ -25,12 +25,12 @@
#include "config.h"
#include "HTMLTablePartElement.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -59,7 +59,7 @@ bool HTMLTablePartElement::mapToEntry(const QualifiedName& attrName, MappedAttri
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLTablePartElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLTablePartElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == bgcolorAttr)
addCSSColor(attr, CSSPropertyBackgroundColor, attr->value());
diff --git a/WebCore/html/HTMLTablePartElement.h b/WebCore/html/HTMLTablePartElement.h
index 1fd5218..cd8b590 100644
--- a/WebCore/html/HTMLTablePartElement.h
+++ b/WebCore/html/HTMLTablePartElement.h
@@ -37,7 +37,7 @@ public:
{ }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
};
} //namespace
diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp
index cdb7cdb..bb88b1c 100644
--- a/WebCore/html/HTMLTextAreaElement.cpp
+++ b/WebCore/html/HTMLTextAreaElement.cpp
@@ -26,10 +26,11 @@
#include "config.h"
#include "HTMLTextAreaElement.h"
+#include "Attribute.h"
#include "BeforeTextInsertedEvent.h"
+#include "CSSValueKeywords.h"
#include "Chrome.h"
#include "ChromeClient.h"
-#include "CSSValueKeywords.h"
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
@@ -39,7 +40,6 @@
#include "Frame.h"
#include "HTMLNames.h"
#include "InputElement.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderStyle.h"
#include "RenderTextControlMultiLine.h"
@@ -108,7 +108,7 @@ void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChan
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
-void HTMLTextAreaElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLTextAreaElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == rowsAttr) {
int rows = attr->value().toInt();
diff --git a/WebCore/html/HTMLTextAreaElement.h b/WebCore/html/HTMLTextAreaElement.h
index f75f076..d38f613 100644
--- a/WebCore/html/HTMLTextAreaElement.h
+++ b/WebCore/html/HTMLTextAreaElement.h
@@ -56,7 +56,7 @@ public:
virtual bool valueMissing() const { return isRequiredFormControl() && !disabled() && !readOnly() && value().isEmpty(); }
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool appendFormData(FormDataList&, bool);
virtual void reset();
diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp
index 390d332..620913f 100644
--- a/WebCore/html/HTMLTokenizer.cpp
+++ b/WebCore/html/HTMLTokenizer.cpp
@@ -28,6 +28,7 @@
#include "config.h"
#include "HTMLTokenizer.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "Cache.h"
#include "CachedScript.h"
@@ -45,7 +46,6 @@
#include "HTMLViewSourceDocument.h"
#include "ImageLoader.h"
#include "InspectorTimelineAgent.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "PreloadScanner.h"
#include "ScriptController.h"
@@ -139,9 +139,9 @@ inline void Token::addAttribute(AtomicString& attrName, const AtomicString& attr
{
if (!attrName.isEmpty()) {
ASSERT(!attrName.contains('/'));
- RefPtr<MappedAttribute> a = MappedAttribute::create(attrName, attributeValue);
+ RefPtr<Attribute> a = Attribute::createMapped(attrName, attributeValue);
if (!attrs) {
- attrs = NamedMappedAttrMap::create();
+ attrs = NamedNodeMap::create();
attrs->reserveInitialCapacity(10);
}
attrs->insertAttribute(a.release(), viewSourceMode);
@@ -1632,7 +1632,143 @@ inline bool HTMLTokenizer::continueProcessing(int& processedCount, double startT
processedCount++;
return true;
}
-
+
+// Turns the statemachine one crank using the passed in State object.
+// FIXME: Eventually this should modify m_state directly.
+ALWAYS_INLINE void HTMLTokenizer::advance(State& state)
+{
+ // do we need to enlarge the buffer?
+ checkBuffer();
+
+ UChar cc = *m_src;
+
+ bool wasSkipLF = state.skipLF();
+ if (wasSkipLF)
+ state.setSkipLF(false);
+
+ if (wasSkipLF && (cc == '\n'))
+ m_src.advance();
+ else if (state.needsSpecialWriteHandling()) {
+ // it's important to keep needsSpecialWriteHandling with the flags this block tests
+ if (state.hasEntityState())
+ state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState());
+ else if (state.inPlainText())
+ state = parseText(m_src, state);
+ else if (state.inAnyNonHTMLText())
+ state = parseNonHTMLText(m_src, state);
+ else if (state.inComment())
+ state = parseComment(m_src, state);
+ else if (state.inDoctype())
+ state = parseDoctype(m_src, state);
+ else if (state.inServer())
+ state = parseServer(m_src, state);
+ else if (state.inProcessingInstruction())
+ state = parseProcessingInstruction(m_src, state);
+ else if (state.hasTagState())
+ state = parseTag(m_src, state);
+ else if (state.startTag()) {
+ state.setStartTag(false);
+
+ switch (cc) {
+ case '/':
+ break;
+ case '!': {
+ // <!-- comment --> or <!DOCTYPE ...>
+ searchCount = 1; // Look for '<!--' sequence to start comment or '<!DOCTYPE' sequence to start doctype
+ m_doctypeSearchCount = 1;
+ break;
+ }
+ case '?': {
+ // xml processing instruction
+ state.setInProcessingInstruction(true);
+ tquote = NoQuote;
+ state = parseProcessingInstruction(m_src, state);
+ return;
+ }
+ case '%':
+ if (!m_brokenServer) {
+ // <% server stuff, handle as comment %>
+ state.setInServer(true);
+ tquote = NoQuote;
+ state = parseServer(m_src, state);
+ return;
+ }
+ // else fall through
+ default: {
+ if (((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) {
+ // Start of a Start-Tag
+ } else {
+ // Invalid tag
+ // Add as is
+ *m_dest = '<';
+ m_dest++;
+ return;
+ }
+ }
+ }; // end case
+
+ processToken();
+
+ m_cBufferPos = 0;
+ state.setTagState(TagName);
+ state = parseTag(m_src, state);
+ }
+ } else if (cc == '&' && !m_src.escaped()) {
+ m_src.advancePastNonNewline();
+ state = parseEntity(m_src, m_dest, state, m_cBufferPos, true, state.hasTagState());
+ } else if (cc == '<' && !m_src.escaped()) {
+ m_currentTagStartLineNumber = m_lineNumber;
+ m_src.advancePastNonNewline();
+ state.setStartTag(true);
+ state.setDiscardLF(false);
+ } else if (cc == '\n' || cc == '\r') {
+ if (state.discardLF())
+ // Ignore this LF
+ state.setDiscardLF(false); // We have discarded 1 LF
+ else {
+ // Process this LF
+ *m_dest++ = '\n';
+ if (cc == '\r' && !m_src.excludeLineNumbers())
+ m_lineNumber++;
+ }
+
+ /* Check for MS-DOS CRLF sequence */
+ if (cc == '\r')
+ state.setSkipLF(true);
+ m_src.advance(m_lineNumber);
+ } else {
+ state.setDiscardLF(false);
+ *m_dest++ = cc;
+ m_src.advancePastNonNewline();
+ }
+}
+
+void HTMLTokenizer::willWriteHTML(const SegmentedString& source)
+{
+ #ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!m_doc->ownerElement())
+ printf("Beginning write at time %d\n", m_doc->elapsedTime());
+ #endif
+
+ #if ENABLE(INSPECTOR)
+ if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent())
+ timelineAgent->willWriteHTML(source.length(), m_lineNumber);
+ #endif
+}
+
+void HTMLTokenizer::didWriteHTML()
+{
+ #ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!m_doc->ownerElement())
+ printf("Ending write at time %d\n", m_doc->elapsedTime());
+ #endif
+
+ #if ENABLE(INSPECTOR)
+ if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent())
+ timelineAgent->didWriteHTML(m_lineNumber);
+ #endif
+}
+
void HTMLTokenizer::write(const SegmentedString& str, bool appendData)
{
if (!m_buffer)
@@ -1675,151 +1811,31 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData)
bool wasInWrite = m_inWrite;
m_inWrite = true;
-
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
- if (!m_doc->ownerElement())
- printf("Beginning write at time %d\n", m_doc->elapsedTime());
-#endif
+<<<<<<< HEAD
int processedCount = 0;
double startTime = currentTime();
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::start(android::TimeCounter::ParsingTimeCounter);
#endif
+=======
+ willWriteHTML(source);
+>>>>>>> webkit.org at r60074
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent())
- timelineAgent->willWriteHTML(source.length(), m_lineNumber);
-#endif
-
Frame* frame = m_doc->frame();
-
State state = m_state;
+ int processedCount = 0;
+ double startTime = currentTime();
while (!m_src.isEmpty() && (!frame || !frame->redirectScheduler()->locationChangePending())) {
if (!continueProcessing(processedCount, startTime, state))
break;
-
- // do we need to enlarge the buffer?
- checkBuffer();
-
- UChar cc = *m_src;
-
- bool wasSkipLF = state.skipLF();
- if (wasSkipLF)
- state.setSkipLF(false);
-
- if (wasSkipLF && (cc == '\n'))
- m_src.advance();
- else if (state.needsSpecialWriteHandling()) {
- // it's important to keep needsSpecialWriteHandling with the flags this block tests
- if (state.hasEntityState())
- state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState());
- else if (state.inPlainText())
- state = parseText(m_src, state);
- else if (state.inAnyNonHTMLText())
- state = parseNonHTMLText(m_src, state);
- else if (state.inComment())
- state = parseComment(m_src, state);
- else if (state.inDoctype())
- state = parseDoctype(m_src, state);
- else if (state.inServer())
- state = parseServer(m_src, state);
- else if (state.inProcessingInstruction())
- state = parseProcessingInstruction(m_src, state);
- else if (state.hasTagState())
- state = parseTag(m_src, state);
- else if (state.startTag()) {
- state.setStartTag(false);
-
- switch (cc) {
- case '/':
- break;
- case '!': {
- // <!-- comment --> or <!DOCTYPE ...>
- searchCount = 1; // Look for '<!--' sequence to start comment or '<!DOCTYPE' sequence to start doctype
- m_doctypeSearchCount = 1;
- break;
- }
- case '?': {
- // xml processing instruction
- state.setInProcessingInstruction(true);
- tquote = NoQuote;
- state = parseProcessingInstruction(m_src, state);
- continue;
-
- break;
- }
- case '%':
- if (!m_brokenServer) {
- // <% server stuff, handle as comment %>
- state.setInServer(true);
- tquote = NoQuote;
- state = parseServer(m_src, state);
- continue;
- }
- // else fall through
- default: {
- if ( ((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) {
- // Start of a Start-Tag
- } else {
- // Invalid tag
- // Add as is
- *m_dest = '<';
- m_dest++;
- continue;
- }
- }
- }; // end case
-
- processToken();
-
- m_cBufferPos = 0;
- state.setTagState(TagName);
- state = parseTag(m_src, state);
- }
- } else if (cc == '&' && !m_src.escaped()) {
- m_src.advancePastNonNewline();
- state = parseEntity(m_src, m_dest, state, m_cBufferPos, true, state.hasTagState());
- } else if (cc == '<' && !m_src.escaped()) {
- m_currentTagStartLineNumber = m_lineNumber;
- m_src.advancePastNonNewline();
- state.setStartTag(true);
- state.setDiscardLF(false);
- } else if (cc == '\n' || cc == '\r') {
- if (state.discardLF())
- // Ignore this LF
- state.setDiscardLF(false); // We have discarded 1 LF
- else {
- // Process this LF
- *m_dest++ = '\n';
- if (cc == '\r' && !m_src.excludeLineNumbers())
- m_lineNumber++;
- }
-
- /* Check for MS-DOS CRLF sequence */
- if (cc == '\r')
- state.setSkipLF(true);
- m_src.advance(m_lineNumber);
- } else {
- state.setDiscardLF(false);
- *m_dest++ = cc;
- m_src.advancePastNonNewline();
- }
+ advance(state);
}
-
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
- if (!m_doc->ownerElement())
- printf("Ending write at time %d\n", m_doc->elapsedTime());
-#endif
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent())
- timelineAgent->didWriteHTML(m_lineNumber);
-#endif
+ didWriteHTML();
m_inWrite = wasInWrite;
-
m_state = state;
#ifdef ANDROID_INSTRUMENT
@@ -1951,7 +1967,7 @@ PassRefPtr<Node> HTMLTokenizer::processToken()
RefPtr<Node> n;
if (!m_parserStopped) {
- if (NamedMappedAttrMap* map = m_currentToken.attrs.get())
+ if (NamedNodeMap* map = m_currentToken.attrs.get())
map->shrinkToLength();
if (inViewSourceMode())
static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceToken(&m_currentToken);
diff --git a/WebCore/html/HTMLTokenizer.h b/WebCore/html/HTMLTokenizer.h
index 290fc5c..dc03cf2 100644
--- a/WebCore/html/HTMLTokenizer.h
+++ b/WebCore/html/HTMLTokenizer.h
@@ -26,8 +26,8 @@
#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
-#include "NamedMappedAttrMap.h"
#include "MappedAttributeEntry.h"
+#include "NamedNodeMap.h"
#include "SegmentedString.h"
#include "Timer.h"
#include "Tokenizer.h"
@@ -83,7 +83,7 @@ struct Token {
void addViewSourceChar(UChar c) { if (!m_sourceInfo.get()) m_sourceInfo.set(new Vector<UChar>); m_sourceInfo->append(c); }
- RefPtr<NamedMappedAttrMap> attrs;
+ RefPtr<NamedNodeMap> attrs;
RefPtr<StringImpl> text;
AtomicString tagName;
bool beginTag;
@@ -132,6 +132,11 @@ public:
//-----------------------------------------------------------------------------
+// FIXME: This class does too much. Right now it is both an HTML lexer as well
+// as handling all of the non-lexer-specific junk related to tokenizing HTML
+// (like dealing with <script> tags). The HTML lexer bits should be pushed
+// down into a separate HTML lexer class.
+
class HTMLTokenizer : public Tokenizer, public CachedResourceClient {
public:
HTMLTokenizer(HTMLDocument*, bool reportErrors);
@@ -168,6 +173,10 @@ private:
void reset();
+ void willWriteHTML(const SegmentedString&);
+ ALWAYS_INLINE void advance(State&);
+ void didWriteHTML();
+
PassRefPtr<Node> processToken();
void processDoctypeToken();
diff --git a/WebCore/html/HTMLUListElement.cpp b/WebCore/html/HTMLUListElement.cpp
index f36cb57..d4ae714 100644
--- a/WebCore/html/HTMLUListElement.cpp
+++ b/WebCore/html/HTMLUListElement.cpp
@@ -22,9 +22,9 @@
#include "config.h"
#include "HTMLUListElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -46,7 +46,7 @@ bool HTMLUListElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
return HTMLElement::mapToEntry(attrName, result);
}
-void HTMLUListElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLUListElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == typeAttr)
addCSSProperty(attr, CSSPropertyListStyleType, attr->value());
diff --git a/WebCore/html/HTMLUListElement.h b/WebCore/html/HTMLUListElement.h
index 1eda5f3..ee161d0 100644
--- a/WebCore/html/HTMLUListElement.h
+++ b/WebCore/html/HTMLUListElement.h
@@ -34,7 +34,7 @@ public:
virtual int tagPriority() const { return 5; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
bool compact() const;
void setCompact(bool);
diff --git a/WebCore/html/HTMLVideoElement.cpp b/WebCore/html/HTMLVideoElement.cpp
index 3db48f1..dd37b69 100644
--- a/WebCore/html/HTMLVideoElement.cpp
+++ b/WebCore/html/HTMLVideoElement.cpp
@@ -28,15 +28,15 @@
#if ENABLE(VIDEO)
#include "HTMLVideoElement.h"
-#include "Chrome.h"
-#include "ChromeClient.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "HTMLImageLoader.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderImage.h"
#include "RenderVideo.h"
@@ -91,7 +91,7 @@ void HTMLVideoElement::detach()
m_imageLoader.clear();
}
-void HTMLVideoElement::parseMappedAttribute(MappedAttribute* attr)
+void HTMLVideoElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
diff --git a/WebCore/html/HTMLVideoElement.h b/WebCore/html/HTMLVideoElement.h
index 4dad3db..5480448 100644
--- a/WebCore/html/HTMLVideoElement.h
+++ b/WebCore/html/HTMLVideoElement.h
@@ -73,7 +73,7 @@ private:
#endif
virtual void attach();
virtual void detach();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool isVideo() const { return true; }
virtual bool hasVideo() const { return player() && player()->hasVideo(); }
virtual bool supportsFullscreen() const;
diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp
index 2d800b4..0173715 100644
--- a/WebCore/html/HTMLViewSourceDocument.cpp
+++ b/WebCore/html/HTMLViewSourceDocument.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "HTMLViewSourceDocument.h"
+#include "Attribute.h"
#include "DOMImplementation.h"
#include "HTMLAnchorElement.h"
#include "HTMLBodyElement.h"
@@ -36,7 +37,6 @@
#include "HTMLTableRowElement.h"
#include "HTMLTableSectionElement.h"
#include "HTMLTokenizer.h"
-#include "MappedAttribute.h"
#include "Text.h"
#include "TextDocument.h"
@@ -59,6 +59,7 @@ Tokenizer* HTMLViewSourceDocument::createTokenizer()
|| m_type == "application/vnd.wap.xhtml+xml"
#endif
) {
+ // FIXME: Should respect Settings::html5ParserEnabled()
return new HTMLTokenizer(this);
}
@@ -77,8 +78,8 @@ void HTMLViewSourceDocument::createContainingTable()
// Create a line gutter div that can be used to make sure the gutter extends down the height of the whole
// document.
RefPtr<HTMLDivElement> div = new HTMLDivElement(divTag, this);
- RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
- attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-gutter-backdrop"));
+ RefPtr<NamedNodeMap> attrs = NamedNodeMap::create();
+ attrs->addAttribute(Attribute::createMapped(classAttr, "webkit-line-gutter-backdrop"));
div->setAttributeMap(attrs.release());
body->addChild(div);
div->attach();
@@ -210,8 +211,8 @@ PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const String& c
}
RefPtr<HTMLElement> span = HTMLElement::create(spanTag, this);
- RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
- attrs->addAttribute(MappedAttribute::create(classAttr, className));
+ RefPtr<NamedNodeMap> attrs = NamedNodeMap::create();
+ attrs->addAttribute(Attribute::createMapped(classAttr, className));
span->setAttributeMap(attrs.release());
m_current->addChild(span);
span->attach();
@@ -227,16 +228,16 @@ void HTMLViewSourceDocument::addLine(const String& className)
// Create a cell that will hold the line number (it is generated in the stylesheet using counters).
RefPtr<HTMLTableCellElement> td = new HTMLTableCellElement(tdTag, this);
- RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
- attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-number"));
+ RefPtr<NamedNodeMap> attrs = NamedNodeMap::create();
+ attrs->addAttribute(Attribute::createMapped(classAttr, "webkit-line-number"));
td->setAttributeMap(attrs.release());
trow->addChild(td);
td->attach();
// Create a second cell for the line contents
td = new HTMLTableCellElement(tdTag, this);
- attrs = NamedMappedAttrMap::create();
- attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-content"));
+ attrs = NamedNodeMap::create();
+ attrs->addAttribute(Attribute::createMapped(classAttr, "webkit-line-content"));
td->setAttributeMap(attrs.release());
trow->addChild(td);
td->attach();
@@ -293,15 +294,15 @@ PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAn
// Now create a link for the attribute value instead of a span.
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(this);
- RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
+ RefPtr<NamedNodeMap> attrs = NamedNodeMap::create();
const char* classValue;
if (isAnchor)
classValue = "webkit-html-attribute-value webkit-html-external-link";
else
classValue = "webkit-html-attribute-value webkit-html-resource-link";
- attrs->addAttribute(MappedAttribute::create(classAttr, classValue));
- attrs->addAttribute(MappedAttribute::create(targetAttr, "_blank"));
- attrs->addAttribute(MappedAttribute::create(hrefAttr, url));
+ attrs->addAttribute(Attribute::createMapped(classAttr, classValue));
+ attrs->addAttribute(Attribute::createMapped(targetAttr, "_blank"));
+ attrs->addAttribute(Attribute::createMapped(hrefAttr, url));
anchor->setAttributeMap(attrs.release());
m_current->addChild(anchor);
anchor->attach();
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 7cdf5d6..184cc14 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2007 Alp Toker <alp@atoker.com>
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
* Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
@@ -118,14 +118,14 @@ void CanvasRenderingContext2D::reset()
}
CanvasRenderingContext2D::State::State()
- : m_strokeStyle(CanvasStyle::create("#000000"))
- , m_fillStyle(CanvasStyle::create("#000000"))
+ : m_strokeStyle(CanvasStyle::create(Color::black))
+ , m_fillStyle(CanvasStyle::create(Color::black))
, m_lineWidth(1)
, m_lineCap(ButtCap)
, m_lineJoin(MiterJoin)
, m_miterLimit(10)
, m_shadowBlur(0)
- , m_shadowColor("black")
+ , m_shadowColor(Color::transparent)
, m_globalAlpha(1)
, m_globalComposite(CompositeSourceOver)
, m_invertibleCTM(true)
@@ -315,13 +315,14 @@ void CanvasRenderingContext2D::setShadowBlur(float blur)
String CanvasRenderingContext2D::shadowColor() const
{
- // FIXME: What should this return if you called setShadow with a non-string color?
- return state().m_shadowColor;
+ return Color(state().m_shadowColor).serialized();
}
void CanvasRenderingContext2D::setShadowColor(const String& color)
{
- state().m_shadowColor = color;
+ if (!CSSParser::parseColor(state().m_shadowColor, color))
+ return;
+
applyShadow();
}
@@ -814,15 +815,17 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur)
{
state().m_shadowOffset = FloatSize(width, height);
state().m_shadowBlur = blur;
- state().m_shadowColor = "";
+ state().m_shadowColor = Color::transparent;
applyShadow();
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, const String& color)
{
+ if (!CSSParser::parseColor(state().m_shadowColor, color))
+ return;
+
state().m_shadowOffset = FloatSize(width, height);
state().m_shadowBlur = blur;
- state().m_shadowColor = color;
applyShadow();
}
@@ -830,65 +833,64 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
{
state().m_shadowOffset = FloatSize(width, height);
state().m_shadowBlur = blur;
- state().m_shadowColor = "";
+ state().m_shadowColor = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f);
GraphicsContext* c = drawingContext();
if (!c)
return;
- RGBA32 rgba = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f);
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace);
+ c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, DeviceColorSpace);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, const String& color, float alpha)
{
+ RGBA32 rgba;
+
+ if (!CSSParser::parseColor(rgba, color))
+ return;
+
+ state().m_shadowColor = colorWithOverrideAlpha(rgba, alpha);
state().m_shadowOffset = FloatSize(width, height);
state().m_shadowBlur = blur;
- state().m_shadowColor = color;
GraphicsContext* c = drawingContext();
if (!c)
return;
- RGBA32 rgba = 0; // default is transparent black
- if (!state().m_shadowColor.isEmpty())
- CSSParser::parseColor(rgba, state().m_shadowColor);
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(colorWithOverrideAlpha(rgba, alpha)), DeviceColorSpace);
+ c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, DeviceColorSpace);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float grayLevel, float alpha)
{
state().m_shadowOffset = FloatSize(width, height);
state().m_shadowBlur = blur;
- state().m_shadowColor = "";
+ state().m_shadowColor = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha);
GraphicsContext* c = drawingContext();
if (!c)
return;
- RGBA32 rgba = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha);
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace);
+ c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, DeviceColorSpace);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float r, float g, float b, float a)
{
state().m_shadowOffset = FloatSize(width, height);
state().m_shadowBlur = blur;
- state().m_shadowColor = "";
+ state().m_shadowColor = makeRGBA32FromFloats(r, g, b, a);
GraphicsContext* c = drawingContext();
if (!c)
return;
- RGBA32 rgba = makeRGBA32FromFloats(r, g, b, a); // default is transparent black
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace);
+ c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, DeviceColorSpace);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float c, float m, float y, float k, float a)
{
state().m_shadowOffset = FloatSize(width, height);
state().m_shadowBlur = blur;
- state().m_shadowColor = "";
+ state().m_shadowColor = makeRGBAFromCMYKA(c, m, y, k, a);
GraphicsContext* dc = drawingContext();
if (!dc)
@@ -901,7 +903,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
CGContextSetShadowWithColor(dc->platformContext(), adjustedShadowSize(width, -height), blur, shadowColor);
CGColorRelease(shadowColor);
#else
- dc->setShadow(IntSize(width, -height), blur, Color(c, m, y, k, a), DeviceColorSpace);
+ dc->setShadow(IntSize(width, -height), blur, state().m_shadowColor, DeviceColorSpace);
#endif
}
@@ -909,7 +911,7 @@ void CanvasRenderingContext2D::clearShadow()
{
state().m_shadowOffset = FloatSize();
state().m_shadowBlur = 0;
- state().m_shadowColor = "";
+ state().m_shadowColor = Color::transparent;
applyShadow();
}
@@ -919,12 +921,9 @@ void CanvasRenderingContext2D::applyShadow()
if (!c)
return;
- RGBA32 rgba = 0; // default is transparent black
- if (!state().m_shadowColor.isEmpty())
- CSSParser::parseColor(rgba, state().m_shadowColor);
float width = state().m_shadowOffset.width();
float height = state().m_shadowOffset.height();
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace);
+ c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, DeviceColorSpace);
}
static IntSize size(HTMLImageElement* image)
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h
index a49ff81..d6b0c8a 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.h
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.h
@@ -28,6 +28,7 @@
#include "AffineTransform.h"
#include "CanvasRenderingContext.h"
+#include "Color.h"
#include "FloatSize.h"
#include "Font.h"
#include "GraphicsTypes.h"
@@ -219,7 +220,7 @@ namespace WebCore {
float m_miterLimit;
FloatSize m_shadowOffset;
float m_shadowBlur;
- String m_shadowColor;
+ RGBA32 m_shadowColor;
float m_globalAlpha;
CompositeOperator m_globalComposite;
AffineTransform m_transform;
diff --git a/WebCore/html/canvas/CanvasStyle.cpp b/WebCore/html/canvas/CanvasStyle.cpp
index 3515e03..67e8201 100644
--- a/WebCore/html/canvas/CanvasStyle.cpp
+++ b/WebCore/html/canvas/CanvasStyle.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2007 Alp Toker <alp@atoker.com>
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
*
@@ -48,122 +48,108 @@
namespace WebCore {
-CanvasStyle::CanvasStyle(const String& color)
- : m_type(ColorString)
- , m_color(color)
+CanvasStyle::CanvasStyle(RGBA32 rgba)
+ : m_type(RGBA)
+ , m_rgba(rgba)
{
}
CanvasStyle::CanvasStyle(float grayLevel)
- : m_type(GrayLevel)
- , m_alpha(1)
- , m_grayLevel(grayLevel)
-{
-}
-
-CanvasStyle::CanvasStyle(const String& color, float alpha)
- : m_type(ColorStringWithAlpha)
- , m_color(color)
- , m_alpha(alpha)
+ : m_type(RGBA)
+ , m_rgba(makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f))
{
}
CanvasStyle::CanvasStyle(float grayLevel, float alpha)
- : m_type(GrayLevel)
- , m_alpha(alpha)
- , m_grayLevel(grayLevel)
+ : m_type(RGBA)
+ , m_rgba(makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha))
{
}
CanvasStyle::CanvasStyle(float r, float g, float b, float a)
: m_type(RGBA)
- , m_alpha(a)
- , m_red(r)
- , m_green(g)
- , m_blue(b)
+ , m_rgba(makeRGBA32FromFloats(r, g, b, a))
{
}
CanvasStyle::CanvasStyle(float c, float m, float y, float k, float a)
: m_type(CMYKA)
- , m_alpha(a)
- , m_cyan(c)
- , m_magenta(m)
- , m_yellow(y)
- , m_black(k)
+ , m_rgba(makeRGBAFromCMYKA(c, m, y, k, a))
+ , m_cmyka(c, m, y, k, a)
{
}
CanvasStyle::CanvasStyle(PassRefPtr<CanvasGradient> gradient)
- : m_type(gradient ? Gradient : ColorString)
+ : m_type(Gradient)
, m_gradient(gradient)
{
}
CanvasStyle::CanvasStyle(PassRefPtr<CanvasPattern> pattern)
- : m_type(pattern ? ImagePattern : ColorString)
+ : m_type(ImagePattern)
, m_pattern(pattern)
{
}
+PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color)
+{
+ RGBA32 rgba;
+ if (!CSSParser::parseColor(rgba, color))
+ return 0;
+ return adoptRef(new CanvasStyle(rgba));
+}
+
+PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color, float alpha)
+{
+ RGBA32 rgba;
+ if (!CSSParser::parseColor(rgba, color))
+ return 0;
+ return adoptRef(new CanvasStyle(colorWithOverrideAlpha(rgba, alpha)));
+}
+
+PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasGradient> gradient)
+{
+ if (!gradient)
+ return 0;
+ return adoptRef(new CanvasStyle(gradient));
+}
+PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasPattern> pattern)
+{
+ if (!pattern)
+ return 0;
+ return adoptRef(new CanvasStyle(pattern));
+}
+
void CanvasStyle::applyStrokeColor(GraphicsContext* context)
{
if (!context)
return;
switch (m_type) {
- case ColorString: {
- Color c = Color(m_color);
- if (c.isValid()) {
- context->setStrokeColor(c.rgb(), DeviceColorSpace);
- break;
- }
- RGBA32 color = 0; // default is transparent black
- if (CSSParser::parseColor(color, m_color))
- context->setStrokeColor(color, DeviceColorSpace);
- break;
- }
- case ColorStringWithAlpha: {
- Color c = Color(m_color);
- if (c.isValid()) {
- context->setStrokeColor(colorWithOverrideAlpha(c.rgb(), m_alpha), DeviceColorSpace);
- break;
- }
- RGBA32 color = 0; // default is transparent black
- if (CSSParser::parseColor(color, m_color))
- context->setStrokeColor(colorWithOverrideAlpha(color, m_alpha), DeviceColorSpace);
- break;
- }
- case GrayLevel:
- // We're only supporting 255 levels of gray here. Since this isn't
- // even part of HTML5, I don't expect anyone will care. If they do
- // we'll make a fancier Color abstraction.
- context->setStrokeColor(Color(m_grayLevel, m_grayLevel, m_grayLevel, m_alpha), DeviceColorSpace);
- break;
- case RGBA:
- context->setStrokeColor(Color(m_red, m_green, m_blue, m_alpha), DeviceColorSpace);
- break;
- case CMYKA: {
- // FIXME: Do this through platform-independent GraphicsContext API.
- // We'll need a fancier Color abstraction to support CYMKA correctly
+ case RGBA:
+ context->setStrokeColor(m_rgba, DeviceColorSpace);
+ break;
+ case CMYKA: {
+ // FIXME: Do this through platform-independent GraphicsContext API.
+ // We'll need a fancier Color abstraction to support CMYKA correctly
#if PLATFORM(CG)
- CGContextSetCMYKStrokeColor(context->platformContext(), m_cyan, m_magenta, m_yellow, m_black, m_alpha);
+ CGContextSetCMYKStrokeColor(context->platformContext(), m_cmyka.c, m_cmyka.m, m_cmyka.y, m_cmyka.k, m_cmyka.a);
#elif PLATFORM(QT)
- QPen currentPen = context->platformContext()->pen();
- QColor clr;
- clr.setCmykF(m_cyan, m_magenta, m_yellow, m_black, m_alpha);
- currentPen.setColor(clr);
- context->platformContext()->setPen(currentPen);
+ QPen currentPen = context->platformContext()->pen();
+ QColor clr;
+ clr.setCmykF(m_cmyka.c, m_cmyka.m, m_cmyka.y, m_cmyka.k, m_cmyka.a);
+ currentPen.setColor(clr);
+ context->platformContext()->setPen(currentPen);
#else
- context->setStrokeColor(Color(m_cyan, m_magenta, m_yellow, m_black, m_alpha), DeviceColorSpace);
+ context->setStrokeColor(m_rgba, DeviceColorSpace);
#endif
- break;
- }
- case Gradient:
- context->setStrokeGradient(canvasGradient()->gradient());
- break;
- case ImagePattern:
- context->setStrokePattern(canvasPattern()->pattern());
- break;
+ break;
+ }
+ case Gradient:
+ context->setStrokeGradient(canvasGradient()->gradient());
+ break;
+ case ImagePattern:
+ context->setStrokePattern(canvasPattern()->pattern());
+ break;
}
}
@@ -172,49 +158,31 @@ void CanvasStyle::applyFillColor(GraphicsContext* context)
if (!context)
return;
switch (m_type) {
- case ColorString: {
- RGBA32 rgba = 0; // default is transparent black
- if (CSSParser::parseColor(rgba, m_color))
- context->setFillColor(rgba, DeviceColorSpace);
- break;
- }
- case ColorStringWithAlpha: {
- RGBA32 color = 0; // default is transparent black
- if (CSSParser::parseColor(color, m_color))
- context->setFillColor(colorWithOverrideAlpha(color, m_alpha), DeviceColorSpace);
- break;
- }
- case GrayLevel:
- // We're only supporting 255 levels of gray here. Since this isn't
- // even part of HTML5, I don't expect anyone will care. If they do
- // we'll make a fancier Color abstraction.
- context->setFillColor(Color(m_grayLevel, m_grayLevel, m_grayLevel, m_alpha), DeviceColorSpace);
- break;
- case RGBA:
- context->setFillColor(Color(m_red, m_green, m_blue, m_alpha), DeviceColorSpace);
- break;
- case CMYKA: {
- // FIXME: Do this through platform-independent GraphicsContext API.
- // We'll need a fancier Color abstraction to support CYMKA correctly
+ case RGBA:
+ context->setFillColor(m_rgba, DeviceColorSpace);
+ break;
+ case CMYKA: {
+ // FIXME: Do this through platform-independent GraphicsContext API.
+ // We'll need a fancier Color abstraction to support CMYKA correctly
#if PLATFORM(CG)
- CGContextSetCMYKFillColor(context->platformContext(), m_cyan, m_magenta, m_yellow, m_black, m_alpha);
+ CGContextSetCMYKFillColor(context->platformContext(), m_cmyka.c, m_cmyka.m, m_cmyka.y, m_cmyka.k, m_cmyka.a);
#elif PLATFORM(QT)
- QBrush currentBrush = context->platformContext()->brush();
- QColor clr;
- clr.setCmykF(m_cyan, m_magenta, m_yellow, m_black, m_alpha);
- currentBrush.setColor(clr);
- context->platformContext()->setBrush(currentBrush);
+ QBrush currentBrush = context->platformContext()->brush();
+ QColor clr;
+ clr.setCmykF(m_cmyka.c, m_cmyka.m, m_cmyka.y, m_cmyka.k, m_cmyka.a);
+ currentBrush.setColor(clr);
+ context->platformContext()->setBrush(currentBrush);
#else
- context->setFillColor(Color(m_cyan, m_magenta, m_yellow, m_black, m_alpha), DeviceColorSpace);
+ context->setFillColor(m_rgba, DeviceColorSpace);
#endif
- break;
- }
- case Gradient:
- context->setFillGradient(canvasGradient()->gradient());
- break;
- case ImagePattern:
- context->setFillPattern(canvasPattern()->pattern());
- break;
+ break;
+ }
+ case Gradient:
+ context->setFillGradient(canvasGradient()->gradient());
+ break;
+ case ImagePattern:
+ context->setFillPattern(canvasPattern()->pattern());
+ break;
}
}
diff --git a/WebCore/html/canvas/CanvasStyle.h b/WebCore/html/canvas/CanvasStyle.h
index fe01bd1..18e55cf 100644
--- a/WebCore/html/canvas/CanvasStyle.h
+++ b/WebCore/html/canvas/CanvasStyle.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +27,7 @@
#ifndef CanvasStyle_h
#define CanvasStyle_h
+#include "Color.h"
#include "PlatformString.h"
namespace WebCore {
@@ -36,16 +38,17 @@ namespace WebCore {
class CanvasStyle : public RefCounted<CanvasStyle> {
public:
- static PassRefPtr<CanvasStyle> create(const String& color) { return adoptRef(new CanvasStyle(color)); }
+ static PassRefPtr<CanvasStyle> create(RGBA32 rgba) { return adoptRef(new CanvasStyle(rgba)); }
+ static PassRefPtr<CanvasStyle> create(const String& color);
+ static PassRefPtr<CanvasStyle> create(const String& color, float alpha);
static PassRefPtr<CanvasStyle> create(float grayLevel) { return adoptRef(new CanvasStyle(grayLevel)); }
- static PassRefPtr<CanvasStyle> create(const String& color, float alpha) { return adoptRef(new CanvasStyle(color, alpha)); }
static PassRefPtr<CanvasStyle> create(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); }
static PassRefPtr<CanvasStyle> create(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); }
static PassRefPtr<CanvasStyle> create(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); }
- static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasGradient> gradient) { return adoptRef(new CanvasStyle(gradient)); }
- static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasPattern> pattern) { return adoptRef(new CanvasStyle(pattern)); }
+ static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasGradient> gradient);
+ static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasPattern> pattern);
- String color() const { return m_color; }
+ String color() const { return Color(m_rgba).serialized(); }
CanvasGradient* canvasGradient() const { return m_gradient.get(); }
CanvasPattern* canvasPattern() const { return m_pattern.get(); }
@@ -53,35 +56,32 @@ namespace WebCore {
void applyStrokeColor(GraphicsContext*);
private:
- CanvasStyle(const String& color);
+ CanvasStyle(RGBA32 rgba);
CanvasStyle(float grayLevel);
- CanvasStyle(const String& color, float alpha);
CanvasStyle(float grayLevel, float alpha);
CanvasStyle(float r, float g, float b, float a);
CanvasStyle(float c, float m, float y, float k, float a);
CanvasStyle(PassRefPtr<CanvasGradient>);
CanvasStyle(PassRefPtr<CanvasPattern>);
- enum Type { ColorString, ColorStringWithAlpha, GrayLevel, RGBA, CMYKA, Gradient, ImagePattern };
+ enum Type { RGBA, CMYKA, Gradient, ImagePattern };
Type m_type;
- String m_color;
+ RGBA32 m_rgba;
+
RefPtr<CanvasGradient> m_gradient;
RefPtr<CanvasPattern> m_pattern;
- float m_alpha;
-
- float m_grayLevel;
-
- float m_red;
- float m_green;
- float m_blue;
-
- float m_cyan;
- float m_magenta;
- float m_yellow;
- float m_black;
+ struct CMYKAValues {
+ CMYKAValues() {}
+ CMYKAValues(float cyan, float magenta, float yellow, float black, float alpha) : c(cyan), m(magenta), y(yellow), k(black), a(alpha) {}
+ float c;
+ float m;
+ float y;
+ float k;
+ float a;
+ } m_cmyka;
};
} // namespace WebCore
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 23a991e..3b36a4a 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -24,7 +24,7 @@
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -445,12 +445,12 @@ void InspectorController::setFrontend(PassOwnPtr<InspectorFrontend> frontend)
m_frontend->inspectedURLChanged(m_inspectedPage->mainFrame()->loader()->url().string());
populateScriptObjects();
-
+
if (m_showAfterVisible == CurrentPanel) {
String lastActivePanelSetting = setting(lastActivePanelSettingName);
m_showAfterVisible = specialPanelForJSName(lastActivePanelSetting);
}
-
+
if (m_nodeToFocus)
focusNode();
#if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -467,7 +467,7 @@ void InspectorController::show()
if (m_openingFrontend)
return;
-
+
if (m_frontend)
m_frontend->bringToFront();
else {
@@ -604,10 +604,10 @@ void InspectorController::populateScriptObjects()
void InspectorController::unbindAllResources()
{
- ResourcesMap::iterator resourcesEnd = m_resources.end();
- for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
- it->second->releaseScriptObject(0);
-
+ ResourcesMap::iterator resourcesEnd = m_resources.end();
+ for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
+ it->second->releaseScriptObject(0);
+
#if ENABLE(DATABASE)
DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end();
for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != databasesEnd; ++it)
@@ -668,7 +668,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
// unbindAllResources should be called before database and DOM storage
// resources are cleared so that it has a chance to unbind them.
unbindAllResources();
-
+
m_cssStore->reset();
if (m_frontend) {
m_frontend->reset();
@@ -981,11 +981,11 @@ void InspectorController::scriptImported(unsigned long identifier, const String&
{
if (!enabled() || !m_resourceTrackingEnabled)
return;
-
+
InspectorResource* resource = m_resources.get(identifier).get();
if (!resource)
return;
-
+
resource->setOverrideContent(ScriptString(sourceString), InspectorResource::Script);
if (m_frontend)
@@ -1208,7 +1208,7 @@ void InspectorController::getCookies(long callId)
else
m_frontend->didGetCookies(callId, buildArrayForCookies(rawCookiesList), String());
}
-
+
ScriptArray InspectorController::buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
{
ScriptArray cookies = m_frontend->newScriptArray();
@@ -1235,7 +1235,7 @@ ScriptObject InspectorController::buildObjectForCookie(const Cookie& cookie)
value.set("session", cookie.session);
return value;
}
-
+
#if ENABLE(DOM_STORAGE)
void InspectorController::didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
{
@@ -1419,7 +1419,7 @@ ScriptObject InspectorController::createProfileHeader(const ScriptProfile& profi
String InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false)
{
if (incrementProfileNumber)
- m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++;
+ m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++;
return String::format("%s.%d", UserInitiatedProfileName, m_currentUserInitiatedProfileNumber);
}
@@ -1591,7 +1591,7 @@ void InspectorController::setBreakpoint(const String& sourceID, unsigned lineNum
void InspectorController::removeBreakpoint(const String& sourceID, unsigned lineNumber)
{
ScriptDebugServer::shared().removeBreakpoint(sourceID, lineNumber);
-
+
String url = m_sourceIDToURL.get(sourceID);
if (url.isEmpty())
return;
@@ -1695,7 +1695,7 @@ static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, co
context.restore();
}
-
+
// Now do the fill
context.addPath(quadPath);
context.setFillColor(fillColor, DeviceColorSpace);
@@ -1836,7 +1836,7 @@ bool InspectorController::stopTiming(const String& title, double& elapsed)
double startTime = it->second;
m_times.remove(it);
-
+
elapsed = currentTime() * 1000 - startTime;
return true;
}
@@ -1904,5 +1904,5 @@ void InspectorController::removeAllScriptsToEvaluateOnLoad()
}
} // namespace WebCore
-
+
#endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index 1164736..0833e15 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -748,7 +748,7 @@ void InspectorDOMAgent::didRemoveDOMNode(Node* node)
m_frontend->childNodeCountUpdated(parentId, 0);
} else
m_frontend->childNodeRemoved(parentId, m_documentNodeToIdMap.get(node));
- unbind(node, &m_documentNodeToIdMap);
+ unbind(node, &m_documentNodeToIdMap);
}
void InspectorDOMAgent::didModifyDOMAttr(Element* element)
@@ -761,14 +761,14 @@ void InspectorDOMAgent::didModifyDOMAttr(Element* element)
m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element));
}
-void InspectorDOMAgent::getStyles(long callId, long nodeId, bool authorOnly)
+void InspectorDOMAgent::getStyles(long callId, long nodeId, bool authorOnly)
{
Node* node = nodeForId(nodeId);
if (!node || node->nodeType() != Node::ELEMENT_NODE) {
m_frontend->didGetStyles(callId, ScriptValue::undefined());
return;
}
-
+
DOMWindow* defaultView = node->ownerDocument()->defaultView();
if (!defaultView) {
m_frontend->didGetStyles(callId, ScriptValue::undefined());
@@ -789,7 +789,7 @@ void InspectorDOMAgent::getStyles(long callId, long nodeId, bool authorOnly)
result.set("styleAttributes", buildObjectForAttributeStyles(element));
result.set("pseudoElements", buildArrayForPseudoElements(element, authorOnly));
-
+
ScriptObject currentStyle = result;
Element* parentElement = element->parentElement();
while (parentElement) {
@@ -906,7 +906,7 @@ void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String&
return;
}
- // Remove disabled property entry for property with given name.
+ // Remove disabled property entry for property with given name.
IdToDisabledStyleMap::iterator disabledIt = cssStore()->idToDisabledStyle.find(styleId);
if (disabledIt != cssStore()->idToDisabledStyle.end())
disabledIt->second.remove(propertyName);
@@ -978,7 +978,7 @@ void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String&
// Set the property on the real style declaration.
ExceptionCode ec = 0;
style->setProperty(name, value, priority, ec);
- // Remove disabled property entry for property with this name.
+ // Remove disabled property entry for property with this name.
if (disabledIt != cssStore()->idToDisabledStyle.end())
disabledIt->second.remove(name);
changedProperties.append(name);
diff --git a/WebCore/inspector/front-end/AuditRules.js b/WebCore/inspector/front-end/AuditRules.js
index a6976b1..8519cf2 100644
--- a/WebCore/inspector/front-end/AuditRules.js
+++ b/WebCore/inspector/front-end/AuditRules.js
@@ -92,13 +92,13 @@ WebInspector.AuditRules.GzipRule.prototype = {
}
var savings = 2 * size / 3;
totalSavings += savings;
- summary.addChild(String.sprintf("%s could save ~%s", WebInspector.AuditRuleResult.linkifyDisplayName(resource.url), Number.bytesToString(savings)));
+ summary.addChild(String.sprintf("%s could save ~%s", WebInspector.AuditRuleResult.linkifyDisplayName(resource.url), Number.bytesToString(savings, WebInspector.UIString)));
result.violationCount++;
}
}
if (!totalSavings)
return callback(null);
- summary.value = String.sprintf("Compressing the following resources with gzip could reduce their transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings));
+ summary.value = String.sprintf("Compressing the following resources with gzip could reduce their transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings, WebInspector.UIString));
callback(result);
},
@@ -955,7 +955,7 @@ WebInspector.AuditRules.CookieSizeRule.prototype = {
for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
var maxCookieSize = sortedCookieSizes[i].maxCookieSize;
if (maxCookieSize > this._maxBytesThreshold)
- hugeCookieDomains.push(WebInspector.AuditRuleResult.resourceDomain(sortedCookieSizes[i].domain) + ": " + Number.bytesToString(maxCookieSize));
+ hugeCookieDomains.push(WebInspector.AuditRuleResult.resourceDomain(sortedCookieSizes[i].domain) + ": " + Number.bytesToString(maxCookieSize, WebInspector.UIString));
}
var bigAvgCookieDomains = [];
@@ -964,9 +964,9 @@ WebInspector.AuditRules.CookieSizeRule.prototype = {
var domain = sortedCookieSizes[i].domain;
var avgCookieSize = sortedCookieSizes[i].avgCookieSize;
if (avgCookieSize > this._avgBytesThreshold && avgCookieSize < this._maxBytesThreshold)
- bigAvgCookieDomains.push(WebInspector.AuditRuleResult.resourceDomain(domain) + ": " + Number.bytesToString(avgCookieSize));
+ bigAvgCookieDomains.push(WebInspector.AuditRuleResult.resourceDomain(domain) + ": " + Number.bytesToString(avgCookieSize, WebInspector.UIString));
}
- result.addChild(String.sprintf("The average cookie size for all requests on this page is %s", Number.bytesToString(avgAllCookiesSize)));
+ result.addChild(String.sprintf("The average cookie size for all requests on this page is %s", Number.bytesToString(avgAllCookiesSize, WebInspector.UIString)));
var message;
if (hugeCookieDomains.length) {
@@ -1017,7 +1017,7 @@ WebInspector.AuditRules.StaticCookielessRule.prototype = {
if (badUrls.length < this._minResources)
return;
- var entry = result.addChild(String.sprintf("%s of cookies were sent with the following static resources. Serve these static resources from a domain that does not set cookies:", Number.bytesToString(cookieBytes)), true);
+ var entry = result.addChild(String.sprintf("%s of cookies were sent with the following static resources. Serve these static resources from a domain that does not set cookies:", Number.bytesToString(cookieBytes, WebInspector.UIString)), true);
entry.addURLs(badUrls);
result.violationCount = badUrls.length;
},
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 9d5042e..b9f6d0a 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -82,11 +82,11 @@ WebInspector.ConsoleView = function(drawer)
return categoryElement;
}
- this.allElement = createFilterElement.call(this, "All");
+ this.allElement = createFilterElement.call(this, WebInspector.UIString("All"));
createDividerElement.call(this);
- this.errorElement = createFilterElement.call(this, "Errors");
- this.warningElement = createFilterElement.call(this, "Warnings");
- this.logElement = createFilterElement.call(this, "Logs");
+ this.errorElement = createFilterElement.call(this, WebInspector.UIString("Errors"));
+ this.warningElement = createFilterElement.call(this, WebInspector.UIString("Warnings"));
+ this.logElement = createFilterElement.call(this, WebInspector.UIString("Logs"));
this.filter(this.allElement, false);
this._registerShortcuts();
diff --git a/WebCore/inspector/front-end/HelpScreen.js b/WebCore/inspector/front-end/HelpScreen.js
index 0e394c5..cad39d0 100644
--- a/WebCore/inspector/front-end/HelpScreen.js
+++ b/WebCore/inspector/front-end/HelpScreen.js
@@ -41,6 +41,7 @@ WebInspector.HelpScreen = function(title)
var closeButton = captionWindow.createChild("button", "help-close-button");
this.contentElement = mainWindow.createChild("div", "help-content");
this.contentElement.tabIndex = 0;
+ this.contentElement.addEventListener("blur", this._onBlur.bind(this), false);
captionWindow.createChild("h1", "help-window-title").innerText = title;
closeButton.innerText = "\u2716"; // Code stands for HEAVY MULTIPLICATION X.
@@ -56,15 +57,20 @@ WebInspector.HelpScreen = function(title)
WebInspector.HelpScreen.prototype = {
show: function()
{
+ if (this._isShown)
+ return;
+
this._element.style.visibility = "visible";
this._isShown = true;
- this.contentElement.focus();
+ this._previousFocusElement = WebInspector.currentFocusElement;
+ WebInspector.currentFocusElement = this.contentElement;
},
_hide: function()
{
this._isShown = false;
this._element.style.visibility = "hidden";
+ WebInspector.currentFocusElement = this._previousFocusElement;
},
_onKeyDown: function(event)
@@ -75,6 +81,13 @@ WebInspector.HelpScreen.prototype = {
}
},
+ _onBlur: function()
+ {
+ // Pretend we're modal, grab focus back if we're still shown.
+ if (this._isShown)
+ WebInspector.currentFocusElement = this.contentElement;
+ },
+
_addStyleSheetIfNeeded: function(href)
{
if (WebInspector.HelpScreen._styleSheetAdded)
diff --git a/WebCore/inspector/front-end/ImageView.js b/WebCore/inspector/front-end/ImageView.js
index 0c15a40..06ca4a4 100644
--- a/WebCore/inspector/front-end/ImageView.js
+++ b/WebCore/inspector/front-end/ImageView.js
@@ -67,7 +67,7 @@ WebInspector.ImageView.prototype = {
var imageProperties = [
{ name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", this.imagePreviewElement.naturalWidth, this.imagePreviewElement.height) },
- { name: WebInspector.UIString("File size"), value: Number.bytesToString(this.resource.resourceSize, WebInspector.UIString.bind(WebInspector)) },
+ { name: WebInspector.UIString("File size"), value: Number.bytesToString(this.resource.resourceSize, WebInspector.UIString) },
{ name: WebInspector.UIString("MIME type"), value: this.resource.mimeType }
];
diff --git a/WebCore/inspector/front-end/ProfileDataGridTree.js b/WebCore/inspector/front-end/ProfileDataGridTree.js
index db156bf..b10f392 100644
--- a/WebCore/inspector/front-end/ProfileDataGridTree.js
+++ b/WebCore/inspector/front-end/ProfileDataGridTree.js
@@ -50,7 +50,7 @@ WebInspector.ProfileDataGridNode.prototype = {
{
function formatMilliseconds(time)
{
- return Number.secondsToString(time / 1000, WebInspector.UIString.bind(WebInspector), !Preferences.samplingCPUProfiler);
+ return Number.secondsToString(time / 1000, WebInspector.UIString, !Preferences.samplingCPUProfiler);
}
var data = {};
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 7a15959..b2dfa15 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -898,7 +898,7 @@ WebInspector.ResourceTimeCalculator.prototype = {
formatValue: function(value)
{
- return Number.secondsToString(value, WebInspector.UIString.bind(WebInspector));
+ return Number.secondsToString(value, WebInspector.UIString);
},
_lowerBound: function(resource)
@@ -922,7 +922,7 @@ WebInspector.ResourceTransferTimeCalculator = function()
WebInspector.ResourceTransferTimeCalculator.prototype = {
formatValue: function(value)
{
- return Number.secondsToString(value, WebInspector.UIString.bind(WebInspector));
+ return Number.secondsToString(value, WebInspector.UIString);
},
_lowerBound: function(resource)
@@ -946,7 +946,7 @@ WebInspector.ResourceTransferDurationCalculator = function()
WebInspector.ResourceTransferDurationCalculator.prototype = {
formatValue: function(value)
{
- return Number.secondsToString(value, WebInspector.UIString.bind(WebInspector));
+ return Number.secondsToString(value, WebInspector.UIString);
},
_upperBound: function(resource)
@@ -1002,7 +1002,7 @@ WebInspector.ResourceTransferSizeCalculator.prototype = {
formatValue: function(value)
{
- return Number.bytesToString(value, WebInspector.UIString.bind(WebInspector));
+ return Number.bytesToString(value, WebInspector.UIString);
}
}
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index 31d37a1..6c817ac 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -978,7 +978,7 @@ WebInspector.ScriptsPanel.prototype = {
_registerShortcuts: function()
{
- var section = WebInspector.shortcutsHelp.section("Scripts Panel");
+ var section = WebInspector.shortcutsHelp.section(WebInspector.UIString("Scripts Panel"));
var handler, shortcut1, shortcut2;
var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;
@@ -990,7 +990,7 @@ WebInspector.ScriptsPanel.prototype = {
this._shortcuts[shortcut1.key] = handler;
shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, platformSpecificModifier);
this._shortcuts[shortcut2.key] = handler;
- section.addAlternateKeys([ shortcut1.name, shortcut2.name ], "Continue");
+ section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Continue"));
// Step over.
handler = this.stepOverButton.click.bind(this.stepOverButton);
@@ -998,7 +998,7 @@ WebInspector.ScriptsPanel.prototype = {
this._shortcuts[shortcut1.key] = handler;
shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, platformSpecificModifier);
this._shortcuts[shortcut2.key] = handler;
- section.addAlternateKeys([ shortcut1.name, shortcut2.name ], "Step over");
+ section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step over"));
// Step into.
handler = this.stepIntoButton.click.bind(this.stepIntoButton);
@@ -1006,7 +1006,7 @@ WebInspector.ScriptsPanel.prototype = {
this._shortcuts[shortcut1.key] = handler;
shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, platformSpecificModifier);
this._shortcuts[shortcut2.key] = handler;
- section.addAlternateKeys([ shortcut1.name, shortcut2.name ], "Step into");
+ section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step into"));
// Step out.
handler = this.stepOutButton.click.bind(this.stepOutButton);
@@ -1014,7 +1014,7 @@ WebInspector.ScriptsPanel.prototype = {
this._shortcuts[shortcut1.key] = handler;
shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift, platformSpecificModifier);
this._shortcuts[shortcut2.key] = handler;
- section.addAlternateKeys([ shortcut1.name, shortcut2.name ], "Step out");
+ section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step out"));
this.sidebarPanes.callstack.registerShortcuts(section);
}
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index 2dec650..953da11 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -425,11 +425,11 @@ WebInspector.SourceFrame.prototype = {
this._editBreakpointCondition(breakpoint);
}
- contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint..."), addConditionalBreakpoint.bind(this));
+ contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this));
} else {
// This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), WebInspector.panels.scripts.removeBreakpoint.bind(WebInspector.panels.scripts, breakpoint));
- contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint..."), this._editBreakpointCondition.bind(this, breakpoint));
+ contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), this._editBreakpointCondition.bind(this, breakpoint));
if (breakpoint.enabled)
contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), function() { breakpoint.enabled = false; });
else
diff --git a/WebCore/inspector/front-end/TimelineOverviewPane.js b/WebCore/inspector/front-end/TimelineOverviewPane.js
index aaf2adb..09431dc 100644
--- a/WebCore/inspector/front-end/TimelineOverviewPane.js
+++ b/WebCore/inspector/front-end/TimelineOverviewPane.js
@@ -336,7 +336,6 @@ WebInspector.TimelineOverviewPane.prototype.__proto__ = WebInspector.Object.prot
WebInspector.TimelineOverviewCalculator = function()
{
- this._uiString = WebInspector.UIString.bind(WebInspector);
}
WebInspector.TimelineOverviewCalculator.prototype = {
@@ -373,7 +372,7 @@ WebInspector.TimelineOverviewCalculator.prototype = {
formatValue: function(value)
{
- return Number.secondsToString(value, this._uiString);
+ return Number.secondsToString(value, WebInspector.UIString);
}
}
diff --git a/WebCore/inspector/front-end/TimelinePanel.js b/WebCore/inspector/front-end/TimelinePanel.js
index 733272d..af49c25 100644
--- a/WebCore/inspector/front-end/TimelinePanel.js
+++ b/WebCore/inspector/front-end/TimelinePanel.js
@@ -87,7 +87,7 @@ WebInspector.TimelinePanel = function()
this._calculator = new WebInspector.TimelineCalculator();
this._calculator._showShortEvents = false;
- var shortRecordThresholdTitle = Number.secondsToString(WebInspector.TimelinePanel.shortRecordThreshold, WebInspector.UIString.bind(WebInspector));
+ var shortRecordThresholdTitle = Number.secondsToString(WebInspector.TimelinePanel.shortRecordThreshold, WebInspector.UIString);
this._showShortRecordsTitleText = WebInspector.UIString("Show the records that are shorter than %s", shortRecordThresholdTitle);
this._hideShortRecordsTitleText = WebInspector.UIString("Hide the records that are shorter than %s", shortRecordThresholdTitle);
this._createStatusbarButtons();
@@ -615,7 +615,6 @@ WebInspector.TimelineCalculator = function()
this.reset();
this.windowLeft = 0.0;
this.windowRight = 1.0;
- this._uiString = WebInspector.UIString.bind(WebInspector);
}
WebInspector.TimelineCalculator.prototype = {
@@ -671,7 +670,7 @@ WebInspector.TimelineCalculator.prototype = {
formatValue: function(value)
{
- return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, this._uiString);
+ return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, WebInspector.UIString);
}
}
@@ -870,7 +869,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = {
label.className = "timeline-aggregated-category timeline-" + index;
cell.appendChild(label);
var text = document.createElement("span");
- text.textContent = Number.secondsToString(this._aggregatedStats[index] + 0.0001);
+ text.textContent = Number.secondsToString(this._aggregatedStats[index] + 0.0001, WebInspector.UIString);
cell.appendChild(text);
}
return cell;
@@ -881,71 +880,71 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = {
var contentHelper = new WebInspector.TimelinePanel.PopupContentHelper(this.title);
if (this._children && this._children.length) {
- contentHelper._appendTextRow("Self Time", Number.secondsToString(this._selfTime + 0.0001));
- contentHelper._appendElementRow("Aggregated Time", this._generateAggregatedInfo());
+ contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime + 0.0001, WebInspector.UIString));
+ contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"), this._generateAggregatedInfo());
}
- var text = Number.secondsToString(this._lastChildEndTime - this.startTime) + " (@" +
- calculator.formatValue(this.startTime - calculator.minimumBoundary) + ")";
- contentHelper._appendTextRow("Duration", text);
+ var text = WebInspector.UIString("%s (at %s)", Number.secondsToString(this._lastChildEndTime - this.startTime, WebInspector.UIString),
+ calculator.formatValue(this.startTime - calculator.minimumBoundary));
+ contentHelper._appendTextRow(WebInspector.UIString("Duration"), text);
const recordTypes = WebInspector.TimelineAgent.RecordType;
switch (this.type) {
case recordTypes.GCEvent:
- contentHelper._appendTextRow("Collected", Number.bytesToString(this.data.usedHeapSizeDelta));
+ contentHelper._appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data.usedHeapSizeDelta, WebInspector.UIString));
break;
case recordTypes.TimerInstall:
case recordTypes.TimerFire:
case recordTypes.TimerRemove:
- contentHelper._appendTextRow("Timer Id", this.data.timerId);
+ contentHelper._appendTextRow(WebInspector.UIString("Timer ID"), this.data.timerId);
if (typeof this.timeout === "number") {
- contentHelper._appendTextRow("Timeout", this.timeout);
- contentHelper._appendTextRow("Repeats", !this.singleShot);
+ contentHelper._appendTextRow(WebInspector.UIString("Timeout"), this.timeout);
+ contentHelper._appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot);
}
if (typeof this.callSiteScriptLine === "number")
- contentHelper._appendLinkRow("Call Site", this.callSiteScriptName, this.callSiteScriptLine);
+ contentHelper._appendLinkRow(WebInspector.UIString("Call Site"), this.callSiteScriptName, this.callSiteScriptLine);
break;
case recordTypes.FunctionCall:
- contentHelper._appendLinkRow("Location", this.data.scriptName, this.data.scriptLine);
+ contentHelper._appendLinkRow(WebInspector.UIString("Location"), this.data.scriptName, this.data.scriptLine);
break;
case recordTypes.ScheduleResourceRequest:
case recordTypes.ResourceSendRequest:
case recordTypes.ResourceReceiveResponse:
case recordTypes.ResourceReceiveData:
case recordTypes.ResourceFinish:
- contentHelper._appendLinkRow("Resource", this.data.url);
+ contentHelper._appendLinkRow(WebInspector.UIString("Resource"), this.data.url);
if (this.data.requestMethod)
- contentHelper._appendTextRow("Request Method", this.data.requestMethod);
+ contentHelper._appendTextRow(WebInspector.UIString("Request Method"), this.data.requestMethod);
if (typeof this.data.statusCode === "number")
- contentHelper._appendTextRow("Status Code", this.data.statusCode);
+ contentHelper._appendTextRow(WebInspector.UIString("Status Code"), this.data.statusCode);
if (this.data.mimeType)
- contentHelper._appendTextRow("Mime Type", this.data.mimeType);
+ contentHelper._appendTextRow(WebInspector.UIString("MIME Type"), this.data.mimeType);
if (typeof this.data.expectedContentLength === "number" && this.data.expectedContentLength !== -1)
- contentHelper._appendTextRow("Expected Content Length", this.data.expectedContentLength);
+ contentHelper._appendTextRow(WebInspector.UIString("Expected Content Length"), this.data.expectedContentLength);
break;
case recordTypes.EvaluateScript:
if (this.data && this.data.url)
- contentHelper._appendLinkRow("Script", this.data.url, this.data.lineNumber);
+ contentHelper._appendLinkRow(WebInspector.UIString("Script"), this.data.url, this.data.lineNumber);
break;
case recordTypes.Paint:
- contentHelper._appendTextRow("Location", this.data.x + "\u2009\u00d7\u2009" + this.data.y);
- contentHelper._appendTextRow("Dimensions", this.data.width + "\u2009\u00d7\u2009" + this.data.height);
+ contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("%d × %d", this.data.x, this.data.y));
+ contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data.width, this.data.height));
case recordTypes.RecalculateStyles: // We don't want to see default details.
break;
default:
if (this.details)
- contentHelper._appendTextRow("Details", this.details);
+ contentHelper._appendTextRow(WebInspector.UIString("Details"), this.details);
break;
}
if (this.data.scriptName && this.type !== recordTypes.FunctionCall)
- contentHelper._appendLinkRow("Function Call", this.data.scriptName, this.data.scriptLine);
+ contentHelper._appendLinkRow(WebInspector.UIString("Function Call"), this.data.scriptName, this.data.scriptLine);
if (this.callerScriptName && this.type !== recordTypes.GCEvent)
- contentHelper._appendLinkRow("Caller", this.callerScriptName, this.callerScriptLine);
+ contentHelper._appendLinkRow(WebInspector.UIString("Caller"), this.callerScriptName, this.callerScriptLine);
if (this.usedHeapSize)
- contentHelper._appendTextRow("Used Heap Size", WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize), Number.bytesToString(this.totalHeapSize)));
+ contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"), WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize, WebInspector.UIString), Number.bytesToString(this.totalHeapSize, WebInspector.UIString)));
return contentHelper._contentTable;
},
@@ -954,7 +953,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = {
{
switch (record.type) {
case WebInspector.TimelineAgent.RecordType.GCEvent:
- return WebInspector.UIString("%s collected", Number.bytesToString(record.data.usedHeapSizeDelta));
+ return WebInspector.UIString("%s collected", Number.bytesToString(record.data.usedHeapSizeDelta, WebInspector.UIString));
case WebInspector.TimelineAgent.RecordType.TimerFire:
return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine, "", "") : record.data.timerId;
case WebInspector.TimelineAgent.RecordType.FunctionCall:
@@ -1032,7 +1031,7 @@ WebInspector.TimelinePanel.PopupContentHelper.prototype = {
_appendTextRow: function(title, content)
{
var row = document.createElement("tr");
- row.appendChild(this._createCell(WebInspector.UIString(title), "timeline-details-row-title"));
+ row.appendChild(this._createCell(title, "timeline-details-row-title"));
row.appendChild(this._createCell(content, "timeline-details-row-data"));
this._contentTable.appendChild(row);
},
@@ -1040,7 +1039,7 @@ WebInspector.TimelinePanel.PopupContentHelper.prototype = {
_appendElementRow: function(title, content)
{
var row = document.createElement("tr");
- row.appendChild(this._createCell(WebInspector.UIString(title), "timeline-details-row-title"));
+ row.appendChild(this._createCell(title, "timeline-details-row-title"));
var cell = document.createElement("td");
cell.appendChild(content);
row.appendChild(cell);
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index f6ae79d..06ae503 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -444,8 +444,8 @@ WebInspector.loaded = function()
this._registerShortcuts();
// set order of some sections explicitly
- WebInspector.shortcutsHelp.section("Console");
- WebInspector.shortcutsHelp.section("Elements Panel");
+ WebInspector.shortcutsHelp.section(WebInspector.UIString("Console"));
+ WebInspector.shortcutsHelp.section(WebInspector.UIString("Elements Panel"));
this.drawer = new WebInspector.Drawer();
this.console = new WebInspector.ConsoleView(this.drawer);
@@ -1514,7 +1514,7 @@ WebInspector.setRecordingProfile = function(isProfiling)
if (!this._temporaryRecordingProfile) {
this._temporaryRecordingProfile = {
typeId: WebInspector.CPUProfileType.TypeId,
- title: WebInspector.UIString('Recording...'),
+ title: WebInspector.UIString("Recording…"),
uid: -1,
isTemporary: true
};
@@ -1861,10 +1861,10 @@ WebInspector.UIString = function(string)
if (window.localizedStrings && string in window.localizedStrings)
string = window.localizedStrings[string];
else {
- if (!(string in this.missingLocalizedStrings)) {
+ if (!(string in WebInspector.missingLocalizedStrings)) {
if (!WebInspector.InspectorBackendStub)
console.error("Localized string \"" + string + "\" not found.");
- this.missingLocalizedStrings[string] = true;
+ WebInspector.missingLocalizedStrings[string] = true;
}
if (Preferences.showMissingLocalizedStrings)
diff --git a/WebCore/loader/DocLoader.cpp b/WebCore/loader/DocLoader.cpp
index 6a0b3d1..c0ba2f3 100644
--- a/WebCore/loader/DocLoader.cpp
+++ b/WebCore/loader/DocLoader.cpp
@@ -477,10 +477,14 @@ void DocLoader::requestPreload(CachedResource::Type type, const String& url, con
encoding = charset.isEmpty() ? m_doc->frame()->loader()->writer()->encoding() : charset;
CachedResource* resource = requestResource(type, url, encoding, true);
- if (!resource || m_preloads.contains(resource))
+ if (!resource || (m_preloads && m_preloads->contains(resource)))
return;
resource->increasePreloadCount();
- m_preloads.add(resource);
+
+ if (!m_preloads)
+ m_preloads.set(new ListHashSet<CachedResource*>);
+ m_preloads->add(resource);
+
#if PRELOAD_DEBUG
printf("PRELOADING %s\n", resource->url().latin1().data());
#endif
@@ -491,8 +495,11 @@ void DocLoader::clearPreloads()
#if PRELOAD_DEBUG
printPreloadStats();
#endif
- ListHashSet<CachedResource*>::iterator end = m_preloads.end();
- for (ListHashSet<CachedResource*>::iterator it = m_preloads.begin(); it != end; ++it) {
+ if (!m_preloads)
+ return;
+
+ ListHashSet<CachedResource*>::iterator end = m_preloads->end();
+ for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) {
CachedResource* res = *it;
res->decreasePreloadCount();
if (res->canDelete() && !res->inCache())
diff --git a/WebCore/loader/DocLoader.h b/WebCore/loader/DocLoader.h
index 2f8f639..ec3e619 100644
--- a/WebCore/loader/DocLoader.h
+++ b/WebCore/loader/DocLoader.h
@@ -50,8 +50,7 @@ class CachedLinkPrefetch;
#endif
// The DocLoader manages the loading of scripts/images/stylesheets for a single document.
-class DocLoader : public Noncopyable
-{
+class DocLoader : public Noncopyable {
friend class Cache;
friend class ImageLoader;
@@ -129,7 +128,7 @@ private:
int m_requestCount;
- ListHashSet<CachedResource*> m_preloads;
+ OwnPtr<ListHashSet<CachedResource*> > m_preloads;
struct PendingPreload {
CachedResource::Type m_type;
String m_url;
diff --git a/WebCore/loader/DocumentWriter.cpp b/WebCore/loader/DocumentWriter.cpp
index ba0695e..0bed159 100644
--- a/WebCore/loader/DocumentWriter.cpp
+++ b/WebCore/loader/DocumentWriter.cpp
@@ -40,6 +40,7 @@
#include "SecurityOrigin.h"
#include "SegmentedString.h"
#include "Settings.h"
+#include "SinkDocument.h"
#include "TextResourceDecoder.h"
#include "Tokenizer.h"
@@ -96,6 +97,11 @@ void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origi
// Create a new document before clearing the frame, because it may need to
// inherit an aliased security context.
RefPtr<Document> document = createDocument();
+
+ // If the new document is for a Plugin but we're supposed to be sandboxed from Plugins,
+ // then replace the document with one whose tokenizer will ignore the incoming data (bug 39323)
+ if (document->isPluginDocument() && m_frame->loader()->isSandboxed(SandboxPlugins))
+ document = SinkDocument::create(m_frame);
bool resetScripting = !(m_frame->loader()->isDisplayingInitialEmptyDocument() && m_frame->document()->securityOrigin()->isSecureTransitionTo(url));
m_frame->loader()->clear(resetScripting, resetScripting);
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index c3b4d80..6fcdcbe 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -179,6 +179,18 @@ static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame
return parentFrame && parentFrame->document()->securityOrigin()->canAccess(frame->document()->securityOrigin());
}
+// This is not in the FrameLoader class to emphasize that it does not depend on
+// private FrameLoader data, and to avoid increasing the number of public functions
+// with access to private data. Since only this .cpp file needs it, making it
+// non-member lets us exclude it from the header file, thus keeping FrameLoader.h's
+// API simpler.
+//
+// FIXME: isDocumentSandboxed should eventually replace isSandboxed.
+static bool isDocumentSandboxed(Frame* frame, SandboxFlags mask)
+{
+ return frame->document() && frame->document()->securityOrigin()->isSandboxed(mask);
+}
+
FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client)
: m_frame(frame)
, m_client(client)
@@ -288,7 +300,7 @@ Frame* FrameLoader::createWindow(FrameLoader* frameLoaderForFrameLookup, const F
}
// Sandboxed frames cannot open new auxiliary browsing contexts.
- if (isDocumentSandboxed(SandboxNavigation))
+ if (isDocumentSandboxed(m_frame, SandboxNavigation))
return 0;
// FIXME: Setting the referrer should be the caller's responsibility.
@@ -353,13 +365,13 @@ void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool l
urlSelected(request, "_self", 0, lockHistory, lockBackForwardList, userGesture, SendReferrer, ReplaceDocumentIfJavaScriptURL);
}
-void FrameLoader::urlSelected(const ResourceRequest& request, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy referrerPolicy)
+void FrameLoader::urlSelected(const KURL& url, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy referrerPolicy)
{
- urlSelected(request, passedTarget, triggeringEvent, lockHistory, lockBackForwardList, userGesture, referrerPolicy, DoNotReplaceDocumentIfJavaScriptURL);
+ urlSelected(ResourceRequest(url), passedTarget, triggeringEvent, lockHistory, lockBackForwardList, userGesture, referrerPolicy, DoNotReplaceDocumentIfJavaScriptURL);
}
-// This overload will go away when the FIXME to eliminate the shouldReplaceDocumentIfJavaScriptURL
-// parameter from ScriptController::executeIfJavaScriptURL() is addressed.
+// The shouldReplaceDocumentIfJavaScriptURL parameter will go away when the FIXME to eliminate the
+// corresponding parameter from ScriptController::executeIfJavaScriptURL() is addressed.
void FrameLoader::urlSelected(const ResourceRequest& request, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy referrerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)
{
ASSERT(!m_suppressOpenerInNewFrame);
@@ -482,7 +494,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F
if (u.isEmpty())
return;
- if (isDocumentSandboxed(SandboxForms))
+ if (isDocumentSandboxed(m_frame, SandboxForms))
return;
if (protocolIsJavaScript(u)) {
@@ -757,7 +769,7 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo
// Do this after detaching the document so that the unload event works.
if (clearWindowProperties) {
m_frame->clearDOMWindow();
- m_frame->script()->clearWindowShell();
+ m_frame->script()->clearWindowShell(m_frame->document()->inPageCache());
}
m_frame->selection()->clear();
@@ -1173,7 +1185,7 @@ bool FrameLoader::requestObject(RenderEmbeddedObject* renderer, const String& ur
&& !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))
|| (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
return false;
- if (isDocumentSandboxed(SandboxPlugins))
+ if (isDocumentSandboxed(m_frame, SandboxPlugins))
return false;
return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback);
}
@@ -2218,11 +2230,11 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
// Let a frame navigate the top-level window that contains it. This is
// important to allow because it lets a site "frame-bust" (escape from a
// frame created by another web site).
- if (!isDocumentSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree()->top())
+ if (!isDocumentSandboxed(m_frame, SandboxTopNavigation) && targetFrame == m_frame->tree()->top())
return true;
// A sandboxed frame can only navigate itself and its descendants.
- if (isDocumentSandboxed(SandboxNavigation) && !targetFrame->tree()->isDescendantOf(m_frame))
+ if (isDocumentSandboxed(m_frame, SandboxNavigation) && !targetFrame->tree()->isDescendantOf(m_frame))
return false;
// Let a frame navigate its opener if the opener is a top-level window.
@@ -3992,11 +4004,6 @@ void FrameLoader::updateSandboxFlags()
child->loader()->updateSandboxFlags();
}
-bool FrameLoader::isDocumentSandboxed(SandboxFlags mask) const
-{
- return m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(mask);
-}
-
PassRefPtr<Widget> FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
{
String baseURLString;
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index 0d1e7a9..70e4b9f 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -129,6 +129,7 @@ public:
static void reportLocalLoadFailed(Frame*, const String& url);
// Called by createWindow in JSDOMWindowBase.cpp, e.g. to fulfill a modal dialog creation
+ // FIXME: Move this method outside of the FrameLoader class.
Frame* createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest&, const WindowFeatures&, bool& created);
unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
@@ -224,7 +225,7 @@ public:
void setDefersLoading(bool);
void changeLocation(const KURL&, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false, bool refresh = false);
- void urlSelected(const ResourceRequest&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy);
+ void urlSelected(const KURL&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy);
bool requestFrame(HTMLFrameOwnerElement*, const String& url, const AtomicString& frameName, bool lockHistory = true, bool lockBackForwardList = true);
void submitForm(const char* action, const String& url,
@@ -473,8 +474,6 @@ private:
bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
void updateSandboxFlags();
- // FIXME: isDocumentSandboxed should eventually replace isSandboxed.
- bool isDocumentSandboxed(SandboxFlags) const;
Frame* m_frame;
FrameLoaderClient* m_client;
diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp
index e3d3b6b..c4e9e5a 100644
--- a/WebCore/loader/HistoryController.cpp
+++ b/WebCore/loader/HistoryController.cpp
@@ -644,6 +644,9 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip)
void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString)
{
+ if (!m_currentItem)
+ return;
+
Page* page = m_frame->page();
ASSERT(page);
@@ -665,12 +668,8 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject,
void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString)
{
- // FIXME: We should always have m_currentItem here!!
- // https://bugs.webkit.org/show_bug.cgi?id=36464
- if (!m_currentItem) {
- ASSERT_NOT_REACHED();
+ if (!m_currentItem)
return;
- }
if (!urlString.isEmpty())
m_currentItem->setURLString(urlString);
diff --git a/WebCore/loader/PluginDocument.h b/WebCore/loader/PluginDocument.h
index 7b4b36b..7ff028a 100644
--- a/WebCore/loader/PluginDocument.h
+++ b/WebCore/loader/PluginDocument.h
@@ -41,10 +41,11 @@ public:
Widget* pluginWidget();
Node* pluginNode();
+ virtual bool isPluginDocument() const { return true; }
+
private:
PluginDocument(Frame*);
- virtual bool isPluginDocument() const { return true; }
virtual Tokenizer* createTokenizer();
};
diff --git a/WebCore/loader/SinkDocument.cpp b/WebCore/loader/SinkDocument.cpp
new file mode 100644
index 0000000..b9c892e
--- /dev/null
+++ b/WebCore/loader/SinkDocument.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SinkDocument.h"
+
+#include "Tokenizer.h"
+
+namespace WebCore {
+
+class SinkTokenizer : public Tokenizer {
+public:
+ SinkTokenizer(Document* document) : m_document(document) { }
+
+private:
+ virtual void write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); }
+ virtual void stopParsing();
+ virtual void finish();
+ virtual bool isWaitingForScripts() const { return false; }
+
+ virtual bool wantsRawData() const { return true; }
+ virtual bool writeRawData(const char*, int) { return false; }
+
+ Document* m_document;
+};
+
+void SinkTokenizer::stopParsing()
+{
+ Tokenizer::stopParsing();
+}
+
+void SinkTokenizer::finish()
+{
+ if (!m_parserStopped)
+ m_document->finishedParsing();
+}
+
+SinkDocument::SinkDocument(Frame* frame)
+ : HTMLDocument(frame)
+{
+ setParseMode(Compat);
+}
+
+Tokenizer* SinkDocument::createTokenizer()
+{
+ return new SinkTokenizer(this);
+}
+
+} // namespace WebCore
diff --git a/WebCore/loader/SinkDocument.h b/WebCore/loader/SinkDocument.h
new file mode 100644
index 0000000..c79ffc3
--- /dev/null
+++ b/WebCore/loader/SinkDocument.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SinkDocument_h
+#define SinkDocument_h
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class SinkDocument : public HTMLDocument {
+public:
+ static PassRefPtr<SinkDocument> create(Frame* frame)
+ {
+ return adoptRef(new SinkDocument(frame));
+ }
+
+private:
+ SinkDocument(Frame*);
+
+ virtual Tokenizer* createTokenizer();
+};
+
+
+}; // namespace WebCore
+
+#endif // SinkDocument_h
diff --git a/WebCore/loader/WorkerThreadableLoader.cpp b/WebCore/loader/WorkerThreadableLoader.cpp
index 2583498..4789a05 100644
--- a/WebCore/loader/WorkerThreadableLoader.cpp
+++ b/WebCore/loader/WorkerThreadableLoader.cpp
@@ -34,7 +34,7 @@
#include "WorkerThreadableLoader.h"
-#include "GenericWorkerTask.h"
+#include "CrossThreadTask.h"
#include "ResourceError.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp
index 5a9bfaa..b8149d2 100644
--- a/WebCore/loader/icon/IconDatabase.cpp
+++ b/WebCore/loader/icon/IconDatabase.cpp
@@ -1639,11 +1639,11 @@ void IconDatabase::pruneUnretainedIcons()
SQLiteStatement pageDeleteSQL(m_syncDB, "DELETE FROM PageURL WHERE rowid = (?);");
pageDeleteSQL.prepare();
for (size_t i = 0; i < numToDelete; ++i) {
- LOG(IconDatabase, "Pruning page with rowid %lli from disk", pageIDsToDelete[i]);
+ LOG(IconDatabase, "Pruning page with rowid %lli from disk", static_cast<long long>(pageIDsToDelete[i]));
pageDeleteSQL.bindInt64(1, pageIDsToDelete[i]);
int result = pageDeleteSQL.step();
if (result != SQLResultDone)
- LOG_ERROR("Unabled to delete page with id %lli from disk", pageIDsToDelete[i]);
+ LOG_ERROR("Unabled to delete page with id %lli from disk", static_cast<long long>(pageIDsToDelete[i]));
pageDeleteSQL.reset();
// If the thread was asked to terminate, we should commit what pruning we've done so far, figuring we can
diff --git a/WebCore/manual-tests/crash-and-no-repaint-after-wake-from-sleep.html b/WebCore/manual-tests/crash-and-no-repaint-after-wake-from-sleep.html
new file mode 100644
index 0000000..c0ccb12
--- /dev/null
+++ b/WebCore/manual-tests/crash-and-no-repaint-after-wake-from-sleep.html
@@ -0,0 +1,186 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>Test for Bugs 39295 and 39297</title>
+ <meta http-equiv="refresh" content="5">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="initial-scale=0.60, minimum-scale=0.60, maximum-scale=0.60">
+ <style type="text/css">
+
+ body {
+ font-family: 'Lucida Grande', Verdana, Arial;
+ font-size: 12px;
+ }
+
+ #stage {
+ margin: 150px auto;
+ width: 600px;
+ height: 400px;
+ /*
+
+ Setting the perspective of the contents of the stage
+ but not the stage itself
+
+ */
+ -webkit-perspective: 800;
+ }
+
+ #rotate {
+ margin: 0 auto;
+ width: 600px;
+ height: 400px;
+ /* Ensure that we're in 3D space */
+ -webkit-transform-style: preserve-3d;
+ /*
+ Make the whole set of rows use the x-axis spin animation
+ for a duration of 7 seconds, running infinitely and linearly
+ */
+ -webkit-animation-name: x-spin;
+ -webkit-animation-duration: 7s;
+ -webkit-animation-iteration-count: infinite;
+ -webkit-animation-timing-function: linear;
+ }
+
+ .ring {
+ margin: 0 auto;
+ height: 110px;
+ width: 600px;
+ -webkit-transform-style: preserve-3d;
+ -webkit-animation-iteration-count: infinite;
+ -webkit-animation-timing-function: linear;
+ }
+
+ .ring > :nth-child(odd) {
+ background-color: #995C7F;
+ }
+
+ .ring > :nth-child(even) {
+ background-color: #835A99;
+ }
+
+ .poster {
+ position: absolute;
+ left: 250px;
+ width: 100px;
+ height: 100px;
+ opacity: 0.7;
+ color: rgba(0,0,0,0.9);
+ -webkit-border-radius: 10px;
+ }
+
+ .poster > p {
+ font-family: 'Georgia', serif;
+ font-size: 36px;
+ font-weight: bold;
+ text-align: center;
+ margin-top: 28px;
+ }
+
+ /*
+ Set up each row to have a different animation duration
+ and alternating y-axis rotation directions.
+ */
+ #ring-1 {
+ -webkit-animation-name: y-spin;
+ -webkit-animation-duration: 5s;
+ }
+
+ #ring-2 {
+ -webkit-animation-name: back-y-spin;
+ -webkit-animation-duration: 4s;
+ }
+
+ #ring-3 {
+ -webkit-animation-name: y-spin;
+ -webkit-animation-duration: 3s;
+ }
+
+ /*
+
+ Here we define each of the three individual animations that
+ we will be using to have our 3D rotation effect. The first
+ animation will perform a full rotation on the x-axis, we'll
+ use that on the whole set of objects. The second and third
+ animations will perform a full rotation on the y-axis in
+ opposite directions, alternating directions between rows.
+
+ Note that you currently have to specify an intermediate step
+ for rotations even when you are using individual transformation
+ constructs.
+
+ */
+ @-webkit-keyframes x-spin {
+ 0% { -webkit-transform: rotateX(0deg); }
+ 50% { -webkit-transform: rotateX(180deg); }
+ 100% { -webkit-transform: rotateX(360deg); }
+ }
+
+ @-webkit-keyframes y-spin {
+ 0% { -webkit-transform: rotateY(0deg); }
+ 50% { -webkit-transform: rotateY(180deg); }
+ 100% { -webkit-transform: rotateY(360deg); }
+ }
+
+ @-webkit-keyframes back-y-spin {
+ 0% { -webkit-transform: rotateY(360deg); }
+ 50% { -webkit-transform: rotateY(180deg); }
+ 100% { -webkit-transform: rotateY(0deg); }
+ }
+ </style>
+
+ <script type="text/javascript">
+
+ const POSTERS_PER_ROW = 12;
+ const RING_RADIUS = 200;
+
+ function setup_posters (row)
+ {
+ var posterAngle = 360 / POSTERS_PER_ROW;
+ for (var i = 0; i < POSTERS_PER_ROW; i ++) {
+ var poster = document.createElement('div');
+ poster.className = 'poster';
+ // compute and assign the transform for this poster
+ var transform = 'rotateY(' + (posterAngle * i) + 'deg) translateZ(' + RING_RADIUS + 'px)';
+ poster.style.webkitTransform = transform;
+ // setup the number to show inside the poster
+ var content = poster.appendChild(document.createElement('p'));
+ content.textContent = i;
+ // add the poster to the row
+ row.appendChild(poster);
+ }
+
+ }
+
+ function init ()
+ {
+ setup_posters(document.getElementById('ring-1'));
+ setup_posters(document.getElementById('ring-2'));
+ setup_posters(document.getElementById('ring-3'));
+ }
+
+ // call init once the document is fully loaded
+ window.addEventListener('load', init, false);
+
+ </script>
+ </head>
+
+ <body>
+
+ <p>This is a combined test for <a href="https://bugs.webkit.org/show_bug.cgi?id=39295">Bug 39295: Crash (preceded by
+ assertion) in WKCACFLayerRenderer::setNeedsDisplay when computer wakes from sleep on particular page</a> and <a
+ href="https://bugs.webkit.org/show_bug.cgi?id=39297">Bug 39297: WebView doesn't repaint until page reloads when page
+ using hardware acceleration loads just after waking from sleep</a>. To test, put your computer to sleep (or
+ "Standby", as Windows calls it). When you wake your computer up, the browser should not crash and the animation
+ below should still be running without any periods of non-painting of the WebView.</p>
+ <div id="stage">
+ <div id="rotate">
+ <div id="ring-1" class="ring"></div>
+ <div id="ring-2" class="ring"></div>
+ <div id="ring-3" class="ring"></div>
+ </div>
+ </div>
+
+ </body>
+
+</html>
diff --git a/WebCore/manual-tests/divx-plugin-fails-to-draw.html b/WebCore/manual-tests/divx-plugin-fails-to-draw.html
new file mode 100644
index 0000000..57244b7
--- /dev/null
+++ b/WebCore/manual-tests/divx-plugin-fails-to-draw.html
@@ -0,0 +1,12 @@
+<html>
+<body>
+This is a manual test for
+<a href="https://bugs.webkit.org/show_bug.cgi?id=39457">Bug #39457</a>. It
+requires that you have the DivX plug-in installed.<br><br>
+
+The plug-in below should not appear as a white box but as a video player with
+controls.<br><br>
+
+<embed type="video/divx" width=320 height=240>
+</body>
+</html>
diff --git a/WebCore/manual-tests/ime-keydown-preventdefault.html b/WebCore/manual-tests/ime-keydown-preventdefault.html
new file mode 100644
index 0000000..aa474e9
--- /dev/null
+++ b/WebCore/manual-tests/ime-keydown-preventdefault.html
@@ -0,0 +1,27 @@
+<html>
+<body>
+<p>Typing in the input fields below should not generate text, even with an IME enabled.</p>
+
+Type into the input:
+<input type=text id='input'></input><br>
+<div id='out' style="float: right"></div>
+Or the text area:
+<textarea id='area'></textarea><br>
+Or the contentEditable area:
+<div contentEditable id='ce' style="border:1px solid red; height:300px; width:300px;"></div>
+<script>
+var input = document.getElementById('input');
+var area = document.getElementById('area');
+var ce = document.getElementById('ce');
+
+var handleKeyDown = function(e) {
+ document.getElementById('out').innerHTML += "<br>Got a key event -- cancelling";
+ e.preventDefault();
+}
+
+input.addEventListener('keydown', handleKeyDown, false);
+area.addEventListener('keydown', handleKeyDown, false);
+ce.addEventListener('keydown', handleKeyDown, false);
+</script>
+</body>
+</html>
diff --git a/WebCore/manual-tests/style-keypress-events.html b/WebCore/manual-tests/style-keypress-events.html
new file mode 100644
index 0000000..b0d2770
--- /dev/null
+++ b/WebCore/manual-tests/style-keypress-events.html
@@ -0,0 +1,38 @@
+<body onload="setup()">
+<p>cmd+b and cmd+i should generate a keydown event in contentEditable fields. Also, calling
+preventDefault() in the keydown event should cancel the text styling.</p>
+
+<div contentEditable id="test" style="border: 1px solid; padding: 4px;">
+This is some sample text.<br><br><br><br>
+</div>
+<div>
+<input type="checkbox" id="disable"><label for="disable">preventDefault() in keydown</label>
+</div>
+<div id="log"></div>
+
+<script>
+function setup()
+{
+ var test = document.getElementById("test");
+ test.addEventListener("keydown", keydown, false);
+
+ var selection = window.getSelection();
+ selection.setPosition(test, 0);
+ selection.modify("extend", "forward", "sentence");
+ test.focus();
+}
+
+function log(msg)
+{
+ var log = document.getElementById("log");
+ log.innerHTML += "<br>" + msg;
+}
+
+function keydown(event)
+{
+ log("keydown");
+ if (document.getElementById("disable").checked)
+ event.preventDefault();
+}
+</script>
+</body>
diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h
index 47de2a2..98cbfdf 100644
--- a/WebCore/notifications/Notification.h
+++ b/WebCore/notifications/Notification.h
@@ -68,11 +68,6 @@ namespace WebCore {
KURL iconURL() { return m_contents.icon(); }
NotificationContents& contents() { return m_contents; }
- String dir() const { return m_direction; }
- void setDir(const String& dir) { m_direction = dir; }
- String replaceId() const { return m_replaceId; }
- void setReplaceId(const String& replaceId) { m_replaceId = replaceId; }
-
DEFINE_ATTRIBUTE_EVENT_LISTENER(display);
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
@@ -98,9 +93,6 @@ namespace WebCore {
KURL m_notificationURL;
NotificationContents m_contents;
- String m_direction;
- String m_replaceId;
-
bool m_isShowing;
NotificationPresenter* m_presenter;
diff --git a/WebCore/notifications/Notification.idl b/WebCore/notifications/Notification.idl
index 5ca84a5..7f018b7 100644
--- a/WebCore/notifications/Notification.idl
+++ b/WebCore/notifications/Notification.idl
@@ -42,9 +42,6 @@ module threads {
attribute EventListener onerror;
attribute EventListener onclose;
- attribute DOMString dir;
- attribute DOMString replaceId;
-
// EventTarget interface
void addEventListener(in DOMString type,
in EventListener listener,
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
index e4aa4cb..a1f40a8 100644
--- a/WebCore/page/DOMWindow.h
+++ b/WebCore/page/DOMWindow.h
@@ -325,6 +325,10 @@ namespace WebCore {
DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange);
#endif
+#if ENABLE(DEVICE_ORIENTATION)
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation);
+#endif
+
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimationStart);
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnimationIteration);
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd);
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index 9314106..ec1645b 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -295,10 +295,12 @@ module window {
#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
attribute EventListener onorientationchange;
#endif
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
+ attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
+ attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
+ attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
+ attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
+
+ attribute [Conditional=DEVICE_ORIENTATION] EventListener ondeviceorientation;
// EventTarget interface
[Custom] void addEventListener(in DOMString type,
@@ -344,7 +346,7 @@ module window {
// FIXME: Implement the commented-out global constructors for interfaces listed in DOM Level 3 Core specification.
attribute DOMCoreExceptionConstructor DOMException;
-// attribute DOMStringListConstructor DOMStringList;
+ attribute DOMStringListConstructor DOMStringList;
// attribute NameListConstructor NameList;
// attribute DOMImplementationListConstructor DOMImplementationList;
// attribute DOMImplementationSourceConstructor DOMImplementationSource;
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 042f3d4..579cecc 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -1287,7 +1287,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
#if ENABLE(PAN_SCROLLING)
Page* page = m_frame->page();
- if (page && page->mainFrame()->eventHandler()->panScrollInProgress() || m_autoscrollInProgress) {
+ if ((page && page->mainFrame()->eventHandler()->panScrollInProgress()) || m_autoscrollInProgress) {
stopAutoscrollTimer();
invalidateClick();
return true;
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index f971b96..216f6b3 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -536,6 +536,9 @@ String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* e
void Frame::notifyRendererOfSelectionChange(bool userTriggered)
{
RenderObject* renderer = 0;
+
+ document()->updateStyleIfNeeded();
+
if (selection()->rootEditableElement())
renderer = selection()->rootEditableElement()->shadowAncestorNode()->renderer();
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index 4d8692e..1988040 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -29,6 +29,7 @@
#include "ContextMenuClient.h"
#include "ContextMenuController.h"
#include "DOMWindow.h"
+#include "DeviceOrientation.h"
#include "DragController.h"
#include "EditorClient.h"
#include "Event.h"
@@ -112,6 +113,7 @@ static void networkStateChanged()
frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false));
}
+<<<<<<< HEAD
#if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
static void onPackageResultAvailable()
{
@@ -124,6 +126,9 @@ static void onPackageResultAvailable()
#endif
Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient, PluginHalterClient* pluginHalterClient, GeolocationControllerClient* geolocationControllerClient)
+=======
+Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient, PluginHalterClient* pluginHalterClient, GeolocationControllerClient* geolocationControllerClient, DeviceOrientationClient* deviceOrientationClient)
+>>>>>>> webkit.org at r60074
: m_chrome(new Chrome(this, chromeClient))
, m_dragCaretController(new SelectionController(0, true))
#if ENABLE(DRAG_SUPPORT)
@@ -139,6 +144,9 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
#if ENABLE(CLIENT_BASED_GEOLOCATION)
, m_geolocationController(new GeolocationController(this, geolocationControllerClient))
#endif
+#if ENABLE(DEVICE_ORIENTATION)
+ , m_deviceOrientation(new DeviceOrientation(this, deviceOrientationClient))
+#endif
, m_settings(new Settings(this))
, m_progress(new ProgressTracker)
, m_backForwardList(BackForwardList::create(this))
@@ -173,6 +181,9 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
UNUSED_PARAM(geolocationControllerClient);
#endif
+#if !ENABLE(CLIENT_DEVICE_ORIENTATION)
+ UNUSED_PARAM(deviceOrientationClient);
+#endif
if (!allPages) {
allPages = new HashSet<Page*>;
diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h
index f38c3b7..aa7bae1 100644
--- a/WebCore/page/Page.h
+++ b/WebCore/page/Page.h
@@ -42,6 +42,8 @@ namespace WebCore {
class ChromeClient;
class ContextMenuClient;
class ContextMenuController;
+ class DeviceOrientation;
+ class DeviceOrientationClient;
class Document;
class DragClient;
class DragController;
@@ -85,7 +87,7 @@ namespace WebCore {
public:
static void setNeedsReapplyStyles();
- Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*, PluginHalterClient*, GeolocationControllerClient*);
+ Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*, PluginHalterClient*, GeolocationControllerClient*, DeviceOrientationClient*);
~Page();
RenderTheme* theme() const { return m_theme.get(); };
@@ -145,6 +147,9 @@ namespace WebCore {
#if ENABLE(CLIENT_BASED_GEOLOCATION)
GeolocationController* geolocationController() const { return m_geolocationController.get(); }
#endif
+#if ENABLE(DEVICE_ORIENTATION)
+ DeviceOrientation* deviceOrientation() const { return m_deviceOrientation.get(); }
+#endif
Settings* settings() const { return m_settings.get(); }
ProgressTracker* progress() const { return m_progress.get(); }
@@ -253,6 +258,9 @@ namespace WebCore {
#if ENABLE(CLIENT_BASED_GEOLOCATION)
OwnPtr<GeolocationController> m_geolocationController;
#endif
+#if ENABLE(DEVICE_ORIENTATION)
+ OwnPtr<DeviceOrientation> m_deviceOrientation;
+#endif
OwnPtr<Settings> m_settings;
OwnPtr<ProgressTracker> m_progress;
diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h
index a6c3a7a..2254096 100644
--- a/WebCore/page/SecurityOrigin.h
+++ b/WebCore/page/SecurityOrigin.h
@@ -119,6 +119,7 @@ public:
bool canAccessDatabase() const { return !isUnique(); }
bool canAccessLocalStorage() const { return !isUnique(); }
bool canAccessCookies() const { return !isUnique(); }
+ bool canAccessPasswordManager() const { return !isUnique(); }
// Technically, we should always allow access to sessionStorage, but we
// currently don't handle creating a sessionStorage area for unique
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index 58c9629..883875b 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -144,9 +144,13 @@ Settings::Settings(Page* page)
, m_webGLEnabled(false)
, m_loadDeferringEnabled(true)
, m_tiledBackingStoreEnabled(false)
+<<<<<<< HEAD
#ifdef ANDROID_PLUGINS
, m_pluginsOnDemand(false)
#endif
+=======
+ , m_html5ParserEnabled(false)
+>>>>>>> webkit.org at r60074
{
// A Frame may not have been created yet, so we initialize the AtomicString
// hash before trying to use it.
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index 5f567c2..9b76517 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -374,6 +374,9 @@ namespace WebCore {
void setTiledBackingStoreEnabled(bool);
bool tiledBackingStoreEnabled() const { return m_tiledBackingStoreEnabled; }
+ void setHTML5ParserEnabled(bool flag) { m_html5ParserEnabled = flag; }
+ bool html5ParserEnabled() const { return m_html5ParserEnabled; }
+
private:
Page* m_page;
@@ -490,9 +493,13 @@ namespace WebCore {
bool m_webGLEnabled : 1;
bool m_loadDeferringEnabled : 1;
bool m_tiledBackingStoreEnabled : 1;
+<<<<<<< HEAD
#ifdef ANDROID_PLUGINS
bool m_pluginsOnDemand : 1;
#endif
+=======
+ bool m_html5ParserEnabled: 1;
+>>>>>>> webkit.org at r60074
#if USE(SAFARI_THEME)
static bool gShouldPaintNativeControls;
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index a49c754..6ab56e9 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -562,7 +562,7 @@ static int gPropertyWrapperMap[numCSSProperties];
static const int cInvalidPropertyWrapperIndex = -1;
-static void ensurePropertyMap()
+void AnimationBase::ensurePropertyMap()
{
// FIXME: This data is never destroyed. Maybe we should ref count it and toss it when the last AnimationController is destroyed?
if (gPropertyWrappers == 0) {
diff --git a/WebCore/page/animation/AnimationBase.h b/WebCore/page/animation/AnimationBase.h
index a957119..ac55a2b 100644
--- a/WebCore/page/animation/AnimationBase.h
+++ b/WebCore/page/animation/AnimationBase.h
@@ -225,6 +225,9 @@ protected:
double m_totalDuration, m_nextIterationDuration;
AnimationBase* m_next;
+
+private:
+ static void ensurePropertyMap();
};
} // namespace WebCore
diff --git a/WebCore/page/brew/DragControllerBrew.cpp b/WebCore/page/brew/DragControllerBrew.cpp
new file mode 100644
index 0000000..ef89821
--- /dev/null
+++ b/WebCore/page/brew/DragControllerBrew.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DragController.h"
+
+#include "DragData.h"
+
+namespace WebCore {
+
+// FIXME: These values are straight out of DragControllerMac, so probably have
+// little correlation with BREW standards...
+const int DragController::LinkDragBorderInset = 2;
+const int DragController::MaxOriginalImageArea = 1500 * 1500;
+const int DragController::DragIconRightInset = 7;
+const int DragController::DragIconBottomInset = 3;
+
+const float DragController::DragImageAlpha = 0.75f;
+
+
+bool DragController::isCopyKeyDown()
+{
+ return false;
+}
+
+DragOperation DragController::dragOperation(DragData* dragData)
+{
+ // FIXME: This logic is incomplete
+ if (dragData->containsURL())
+ return DragOperationCopy;
+
+ return DragOperationNone;
+}
+
+const IntSize& DragController::maxDragImageSize()
+{
+ static const IntSize maxDragImageSize(400, 400);
+
+ return maxDragImageSize;
+}
+
+void DragController::cleanupAfterSystemDrag()
+{
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/page/mac/FrameMac.mm b/WebCore/page/mac/FrameMac.mm
index 356503f..bb11ac9 100644
--- a/WebCore/page/mac/FrameMac.mm
+++ b/WebCore/page/mac/FrameMac.mm
@@ -407,14 +407,14 @@ NSDictionary* Frame::fontAttributesForSelectionStart() const
NSMutableDictionary* result = [NSMutableDictionary dictionary];
- if (style->backgroundColor().isValid() && style->backgroundColor().alpha() != 0)
- [result setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
+ if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && style->visitedDependentColor(CSSPropertyBackgroundColor).alpha() != 0)
+ [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
if (style->font().primaryFont()->getNSFont())
[result setObject:style->font().primaryFont()->getNSFont() forKey:NSFontAttributeName];
- if (style->color().isValid() && style->color() != Color::black)
- [result setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
+ if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black)
+ [result setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
const ShadowData* shadow = style->textShadow();
if (shadow) {
diff --git a/WebCore/page/qt/EventHandlerQt.cpp b/WebCore/page/qt/EventHandlerQt.cpp
index 5b24eae..ace8e54 100644
--- a/WebCore/page/qt/EventHandlerQt.cpp
+++ b/WebCore/page/qt/EventHandlerQt.cpp
@@ -56,7 +56,11 @@ QT_END_NAMESPACE
namespace WebCore {
+#if defined(Q_WS_MAC)
+const double EventHandler::TextDragDelay = 0.15;
+#else
const double EventHandler::TextDragDelay = 0.0;
+#endif
static bool isKeyboardOptionTab(KeyboardEvent* event)
{
diff --git a/WebCore/platform/ContextMenu.cpp b/WebCore/platform/ContextMenu.cpp
index 7fa5f8c..66d3496 100644
--- a/WebCore/platform/ContextMenu.cpp
+++ b/WebCore/platform/ContextMenu.cpp
@@ -102,7 +102,10 @@ static void createAndAppendFontSubMenu(const HitTestResult& result, ContextMenuI
fontMenuItem.setSubMenu(&fontMenu);
}
-#if !defined(BUILDING_ON_TIGER) && !PLATFORM(GTK)
+#if !defined(BUILDING_ON_TIGER)
+
+#if !PLATFORM(GTK)
+
static void createAndAppendSpellingAndGrammarSubMenu(const HitTestResult& result, ContextMenuItem& spellingAndGrammarMenuItem)
{
ContextMenu spellingAndGrammarMenu(result);
@@ -115,24 +118,27 @@ static void createAndAppendSpellingAndGrammarSubMenu(const HitTestResult& result
contextMenuItemTagCheckSpellingWhileTyping());
ContextMenuItem grammarWithSpelling(CheckableActionType, ContextMenuItemTagCheckGrammarWithSpelling,
contextMenuItemTagCheckGrammarWithSpelling());
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)
ContextMenuItem correctSpelling(CheckableActionType, ContextMenuItemTagCorrectSpellingAutomatically,
contextMenuItemTagCorrectSpellingAutomatically());
#endif
spellingAndGrammarMenu.appendItem(showSpellingPanel);
spellingAndGrammarMenu.appendItem(checkSpelling);
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)
spellingAndGrammarMenu.appendItem(*separatorItem());
#endif
spellingAndGrammarMenu.appendItem(checkAsYouType);
spellingAndGrammarMenu.appendItem(grammarWithSpelling);
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)
spellingAndGrammarMenu.appendItem(correctSpelling);
#endif
spellingAndGrammarMenuItem.setSubMenu(&spellingAndGrammarMenu);
}
+
+#endif // !PLATFORM(GTK)
+
#else
static void createAndAppendSpellingSubMenu(const HitTestResult& result, ContextMenuItem& spellingMenuItem)
@@ -152,9 +158,11 @@ static void createAndAppendSpellingSubMenu(const HitTestResult& result, ContextM
spellingMenuItem.setSubMenu(&spellingMenu);
}
+
#endif
#if PLATFORM(MAC)
+
static void createAndAppendSpeechSubMenu(const HitTestResult& result, ContextMenuItem& speechMenuItem)
{
ContextMenu speechMenu(result);
@@ -167,9 +175,11 @@ static void createAndAppendSpeechSubMenu(const HitTestResult& result, ContextMen
speechMenuItem.setSubMenu(&speechMenu);
}
+
#endif
#if !PLATFORM(GTK)
+
static void createAndAppendWritingDirectionSubMenu(const HitTestResult& result, ContextMenuItem& writingDirectionMenuItem)
{
ContextMenu writingDirectionMenu(result);
@@ -200,9 +210,11 @@ static void createAndAppendTextDirectionSubMenu(const HitTestResult& result, Con
textDirectionMenuItem.setSubMenu(&textDirectionMenu);
}
+
#endif
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+
static void createAndAppendSubstitutionsSubMenu(const HitTestResult& result, ContextMenuItem& substitutionsMenuItem)
{
ContextMenu substitutionsMenu(result);
@@ -239,6 +251,7 @@ static void createAndAppendTransformationsSubMenu(const HitTestResult& result, C
transformationsMenuItem.setSubMenu(&transformationsMenu);
}
+
#endif
static bool selectionContainsPossibleWord(Frame* frame)
diff --git a/WebCore/platform/DragData.h b/WebCore/platform/DragData.h
index 53f320e..5020739 100644
--- a/WebCore/platform/DragData.h
+++ b/WebCore/platform/DragData.h
@@ -61,7 +61,7 @@ typedef void* DragDataRef;
#elif PLATFORM(HAIKU)
class BMessage;
typedef class BMessage* DragDataRef;
-#elif PLATFORM(EFL)
+#elif PLATFORM(EFL) || PLATFORM(BREWMP)
typedef void* DragDataRef;
#endif
diff --git a/WebCore/platform/FileSystem.cpp b/WebCore/platform/FileSystem.cpp
new file mode 100644
index 0000000..01318e3
--- /dev/null
+++ b/WebCore/platform/FileSystem.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FileSystem.h"
+
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+#if !PLATFORM(GTK) && !PLATFORM(EFL)
+char* filenameFromString(const String& string)
+{
+ return fastStrDup(string.utf8().data());
+}
+#endif
+
+} // namespace WebCore
diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h
index 39c79bb4..c79237b 100644
--- a/WebCore/platform/FileSystem.h
+++ b/WebCore/platform/FileSystem.h
@@ -172,9 +172,10 @@ String roamingUserSpecificStorageDirectory();
bool safeCreateFile(const String&, CFDataRef);
#endif
+char* filenameFromString(const String&);
+
#if PLATFORM(GTK)
String filenameToString(const char*);
-char* filenameFromString(const String&);
String filenameForDisplay(const String&);
#endif
@@ -182,10 +183,6 @@ String filenameForDisplay(const String&);
String pathGetDisplayFileName(const String&);
#endif
-#if PLATFORM(EFL)
-char *filenameFromString(const String&);
-#endif
-
} // namespace WebCore
#endif // FileSystem_h
diff --git a/WebCore/platform/GeolocationService.cpp b/WebCore/platform/GeolocationService.cpp
index 4676006..4b0e457 100644
--- a/WebCore/platform/GeolocationService.cpp
+++ b/WebCore/platform/GeolocationService.cpp
@@ -42,6 +42,9 @@ static GeolocationService* createGeolocationServiceNull(GeolocationServiceClient
}
GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &createGeolocationServiceNull;
+GeolocationService::FactoryFunction* GeolocationService::s_mockFactoryFunction = &createGeolocationServiceNull;
+#else
+GeolocationService::FactoryFunction* GeolocationService::s_mockFactoryFunction = &GeolocationServiceMock::create;
#endif
GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
@@ -52,7 +55,12 @@ GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
#if ENABLE(GEOLOCATION)
void GeolocationService::useMock()
{
- s_factoryFunction = &GeolocationServiceMock::create;
+ s_factoryFunction = s_mockFactoryFunction;
+}
+
+void GeolocationService::setCustomMockFactory(FactoryFunction f)
+{
+ s_mockFactoryFunction = f;
}
GeolocationService::GeolocationService(GeolocationServiceClient* client)
diff --git a/WebCore/platform/GeolocationService.h b/WebCore/platform/GeolocationService.h
index 363865d..2cb70f2 100644
--- a/WebCore/platform/GeolocationService.h
+++ b/WebCore/platform/GeolocationService.h
@@ -65,6 +65,8 @@ public:
void errorOccurred();
static void useMock();
+ typedef GeolocationService* (FactoryFunction)(GeolocationServiceClient*);
+ static void setCustomMockFactory(FactoryFunction);
protected:
GeolocationService(GeolocationServiceClient*);
@@ -73,8 +75,8 @@ protected:
private:
GeolocationServiceClient* m_geolocationServiceClient;
- typedef GeolocationService* (FactoryFunction)(GeolocationServiceClient*);
static FactoryFunction* s_factoryFunction;
+ static FactoryFunction* s_mockFactoryFunction;
};
} // namespace WebCore
diff --git a/WebCore/platform/brew/DragDataBrew.cpp b/WebCore/platform/brew/DragDataBrew.cpp
new file mode 100644
index 0000000..20f93b8
--- /dev/null
+++ b/WebCore/platform/brew/DragDataBrew.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DragData.h"
+
+#include "Clipboard.h"
+#include "Document.h"
+#include "DocumentFragment.h"
+
+namespace WebCore {
+
+bool DragData::canSmartReplace() const
+{
+ return false;
+}
+
+bool DragData::containsColor() const
+{
+ return false;
+}
+
+bool DragData::containsPlainText() const
+{
+ return false;
+}
+
+String DragData::asPlainText() const
+{
+ return String();
+}
+
+Color DragData::asColor() const
+{
+ return Color();
+}
+
+PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy) const
+{
+ return 0;
+}
+
+bool DragData::containsCompatibleContent() const
+{
+ return false;
+}
+
+bool DragData::containsURL() const
+{
+ return false;
+}
+
+String DragData::asURL(String*) const
+{
+ return String();
+}
+
+
+PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const
+{
+ return 0;
+}
+
+void DragData::asFilenames(Vector<String>&) const
+{
+}
+
+bool DragData::containsFiles() const
+{
+ return false;
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/brew/LocalizedStringsBrew.cpp b/WebCore/platform/brew/LocalizedStringsBrew.cpp
index 4588f0f..1bc5985 100644
--- a/WebCore/platform/brew/LocalizedStringsBrew.cpp
+++ b/WebCore/platform/brew/LocalizedStringsBrew.cpp
@@ -393,5 +393,15 @@ String validationMessageStepMismatchText()
return String();
}
+String missingPluginText()
+{
+ return "Missing Plug-in";
+}
+
+String crashedPluginText()
+{
+ return "Plug-in Crashed";
+}
+
} // namespace WebCore
diff --git a/WebCore/dom/MappedAttribute.cpp b/WebCore/platform/brew/SSLKeyGeneratorBrew.cpp
index 17d32c0..4887e4f 100644
--- a/WebCore/dom/MappedAttribute.cpp
+++ b/WebCore/platform/brew/SSLKeyGeneratorBrew.cpp
@@ -1,9 +1,5 @@
/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Company 100, Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,13 +18,21 @@
*/
#include "config.h"
-#include "MappedAttribute.h"
+#include "SSLKeyGenerator.h"
+
+#include "NotImplemented.h"
namespace WebCore {
-PassRefPtr<Attribute> MappedAttribute::clone() const
+void WebCore::getSupportedKeySizes(Vector<String>& v)
{
- return adoptRef(new MappedAttribute(name(), value(), m_styleDecl.get()));
+ notImplemented();
}
+String WebCore::signedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL& url)
+{
+ notImplemented();
+ return String();
}
+
+} // namespace WebCore
diff --git a/WebCore/platform/brew/ScrollbarThemeBrew.cpp b/WebCore/platform/brew/ScrollbarThemeBrew.cpp
new file mode 100644
index 0000000..af64f90
--- /dev/null
+++ b/WebCore/platform/brew/ScrollbarThemeBrew.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009-2010 Company 100, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScrollbarThemeBrew.h"
+
+namespace WebCore {
+
+ScrollbarTheme* ScrollbarTheme::nativeTheme()
+{
+ DEFINE_STATIC_LOCAL(ScrollbarThemeBrew, theme, ());
+ return &theme;
+}
+
+ScrollbarThemeBrew::~ScrollbarThemeBrew()
+{
+}
+
+}
+
diff --git a/WebCore/platform/brew/ScrollbarThemeBrew.h b/WebCore/platform/brew/ScrollbarThemeBrew.h
new file mode 100644
index 0000000..df438c4
--- /dev/null
+++ b/WebCore/platform/brew/ScrollbarThemeBrew.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2009-2010 Company 100, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollbarThemeBrew_h
+#define ScrollbarThemeBrew_h
+
+#include "ScrollbarTheme.h"
+
+namespace WebCore {
+
+class ScrollbarThemeBrew : public ScrollbarTheme {
+public:
+ virtual ~ScrollbarThemeBrew();
+};
+
+}
+#endif
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index 9aa714e..c84931b 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -225,7 +225,7 @@ namespace WebCore {
static void paintTrackbar(
GraphicsContext*, int part, int state, int classicState, const IntRect&);
static void paintProgressBar(
- GraphicsContext*, const IntRect& barRect, int valuePart, const IntRect& valueRect);
+ GraphicsContext*, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds);
#endif
// Trace Event --------------------------------------------------------
diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp
index ab9f3c9..750ff30 100644
--- a/WebCore/platform/chromium/ClipboardChromium.cpp
+++ b/WebCore/platform/chromium/ClipboardChromium.cpp
@@ -38,7 +38,6 @@
#include "HTMLNames.h"
#include "Image.h"
#include "MIMETypeRegistry.h"
-#include "NamedAttrMap.h"
#include "NamedNodeMap.h"
#include "Pasteboard.h"
#include "PlatformString.h"
diff --git a/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp b/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp
index 5d9ed05..b0680ac 100644
--- a/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp
+++ b/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp
@@ -52,16 +52,4 @@ void replaceNBSPWithSpace(String& str)
str.replace(NonBreakingSpaceCharacter, SpaceCharacter);
}
-String urlToMarkup(const KURL& url, const String& title)
-{
- String markup("<a href=\"");
- markup.append(url.string());
- markup.append("\">");
- // FIXME: HTML escape this, possibly by moving into the glue layer so we
- // can use net/base/escape.h.
- markup.append(title);
- markup.append("</a>");
- return markup;
-}
-
} // namespace WebCore
diff --git a/WebCore/platform/chromium/ClipboardUtilitiesChromium.h b/WebCore/platform/chromium/ClipboardUtilitiesChromium.h
index 23fd29c..7514280 100644
--- a/WebCore/platform/chromium/ClipboardUtilitiesChromium.h
+++ b/WebCore/platform/chromium/ClipboardUtilitiesChromium.h
@@ -38,6 +38,4 @@ void replaceNewlinesWithWindowsStyleNewlines(String&);
#endif
void replaceNBSPWithSpace(String&);
-String urlToMarkup(const KURL&, const String&);
-
} // namespace WebCore
diff --git a/WebCore/platform/chromium/DragDataChromium.cpp b/WebCore/platform/chromium/DragDataChromium.cpp
index 8fb40de..1ce20dc 100644
--- a/WebCore/platform/chromium/DragDataChromium.cpp
+++ b/WebCore/platform/chromium/DragDataChromium.cpp
@@ -66,11 +66,10 @@ String DragData::asURL(String* title) const
String url;
if (m_platformDragData->hasValidURL())
url = m_platformDragData->getURL().string();
- else if (m_platformDragData->filenames.size() == 1) {
+ else if (!m_platformDragData->filenames.isEmpty()) {
String fileName = m_platformDragData->filenames[0];
fileName = ChromiumBridge::getAbsolutePath(fileName);
- if (fileExists(fileName) && !ChromiumBridge::isDirectory(fileName))
- url = ChromiumBridge::filePathToURL(fileName).string();
+ url = ChromiumBridge::filePathToURL(fileName).string();
}
// |title| can be NULL
diff --git a/WebCore/platform/chromium/GeolocationServiceChromium.cpp b/WebCore/platform/chromium/GeolocationServiceChromium.cpp
index 4402fe4..9333999 100644
--- a/WebCore/platform/chromium/GeolocationServiceChromium.cpp
+++ b/WebCore/platform/chromium/GeolocationServiceChromium.cpp
@@ -37,7 +37,7 @@ namespace WebCore {
GeolocationServiceChromium::GeolocationServiceChromium(GeolocationServiceClient* c)
: GeolocationService(c),
- m_geolocation(reinterpret_cast<Geolocation*>(c)),
+ m_geolocation(static_cast<Geolocation*>(c)),
m_geolocationServiceBridge(ChromiumBridge::createGeolocationServiceBridge(this)),
m_lastError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ""))
{
diff --git a/WebCore/platform/efl/LocalizedStringsEfl.cpp b/WebCore/platform/efl/LocalizedStringsEfl.cpp
index b53ca82..a58dba2 100644
--- a/WebCore/platform/efl/LocalizedStringsEfl.cpp
+++ b/WebCore/platform/efl/LocalizedStringsEfl.cpp
@@ -70,37 +70,37 @@ String fileButtonNoFileSelectedLabel()
String contextMenuItemTagOpenLinkInNewWindow()
{
- return String::fromUTF8("Open Link in New _Window");
+ return String::fromUTF8("Open Link in New Window");
}
String contextMenuItemTagDownloadLinkToDisk()
{
- return String::fromUTF8("_Download Linked File");
+ return String::fromUTF8("Download Linked File");
}
String contextMenuItemTagCopyLinkToClipboard()
{
- return String::fromUTF8("Copy Link Loc_ation");
+ return String::fromUTF8("Copy Link Location");
}
String contextMenuItemTagOpenImageInNewWindow()
{
- return String::fromUTF8("Open _Image in New Window");
+ return String::fromUTF8("Open Image in New Window");
}
String contextMenuItemTagDownloadImageToDisk()
{
- return String::fromUTF8("Sa_ve Image As");
+ return String::fromUTF8("Save Image As");
}
String contextMenuItemTagCopyImageToClipboard()
{
- return String::fromUTF8("Cop_y Image");
+ return String::fromUTF8("Copy Image");
}
String contextMenuItemTagOpenFrameInNewWindow()
{
- return String::fromUTF8("Open _Frame in New Window");
+ return String::fromUTF8("Open Frame in New Window");
}
String contextMenuItemTagCopy()
@@ -117,29 +117,29 @@ String contextMenuItemTagDelete()
String contextMenuItemTagSelectAll()
{
- static String stockLabel = String::fromUTF8("Select _All");
+ static String stockLabel = String::fromUTF8("Select All");
return stockLabel;
}
String contextMenuItemTagUnicode()
{
- return String::fromUTF8("_Insert Unicode Control Character");
+ return String::fromUTF8("Insert Unicode Control Character");
}
String contextMenuItemTagInputMethods()
{
- return String::fromUTF8("Input _Methods");
+ return String::fromUTF8("Input Methods");
}
String contextMenuItemTagGoBack()
{
- static String stockLabel = String::fromUTF8("Go_Back");
+ static String stockLabel = String::fromUTF8("Go Back");
return stockLabel;
}
String contextMenuItemTagGoForward()
{
- static String stockLabel = String::fromUTF8("Go_Forward");
+ static String stockLabel = String::fromUTF8("Go Forward");
return stockLabel;
}
@@ -151,7 +151,7 @@ String contextMenuItemTagStop()
String contextMenuItemTagReload()
{
- return String::fromUTF8("_Reload");
+ return String::fromUTF8("Reload");
}
String contextMenuItemTagCut()
@@ -173,37 +173,37 @@ String contextMenuItemTagNoGuessesFound()
String contextMenuItemTagIgnoreSpelling()
{
- return String::fromUTF8("_Ignore Spelling");
+ return String::fromUTF8("Ignore Spelling");
}
String contextMenuItemTagLearnSpelling()
{
- return String::fromUTF8("_Learn Spelling");
+ return String::fromUTF8("Learn Spelling");
}
String contextMenuItemTagSearchWeb()
{
- return String::fromUTF8("_Search the Web");
+ return String::fromUTF8("Search the Web");
}
String contextMenuItemTagLookUpInDictionary()
{
- return String::fromUTF8("_Look Up in Dictionary");
+ return String::fromUTF8("Look Up in Dictionary");
}
String contextMenuItemTagOpenLink()
{
- return String::fromUTF8("_Open Link");
+ return String::fromUTF8("Open Link");
}
String contextMenuItemTagIgnoreGrammar()
{
- return String::fromUTF8("Ignore _Grammar");
+ return String::fromUTF8("Ignore Grammar");
}
String contextMenuItemTagSpellingMenu()
{
- return String::fromUTF8("Spelling and _Grammar");
+ return String::fromUTF8("Spelling and Grammar");
}
String contextMenuItemTagShowSpellingPanel(bool show)
@@ -213,7 +213,7 @@ String contextMenuItemTagShowSpellingPanel(bool show)
String contextMenuItemTagCheckSpelling()
{
- return String::fromUTF8("_Check Document Now");
+ return String::fromUTF8("Check Document Now");
}
String contextMenuItemTagCheckSpellingWhileTyping()
@@ -223,12 +223,12 @@ String contextMenuItemTagCheckSpellingWhileTyping()
String contextMenuItemTagCheckGrammarWithSpelling()
{
- return String::fromUTF8("Check _Grammar With Spelling");
+ return String::fromUTF8("Check Grammar With Spelling");
}
String contextMenuItemTagFontMenu()
{
- return String::fromUTF8("_Font");
+ return String::fromUTF8("Font");
}
String contextMenuItemTagBold()
@@ -251,12 +251,12 @@ String contextMenuItemTagUnderline()
String contextMenuItemTagOutline()
{
- return String::fromUTF8("_Outline");
+ return String::fromUTF8("Outline");
}
String contextMenuItemTagInspectElement()
{
- return String::fromUTF8("Inspect _Element");
+ return String::fromUTF8("Inspect Element");
}
String contextMenuItemTagRightToLeft()
@@ -296,7 +296,7 @@ String searchMenuRecentSearchesText()
String searchMenuClearRecentSearchesText()
{
- return String::fromUTF8("_Clear recent searches");
+ return String::fromUTF8("Clear recent searches");
}
String AXDefinitionListTermText()
@@ -395,6 +395,11 @@ String validationMessageValueMissingText()
return String::fromUTF8("value missing");
}
+String missingPluginText()
+{
+ return String::fromUTF8("missing plugin");
+}
+
String AXMenuListPopupActionVerb()
{
return String();
@@ -405,14 +410,14 @@ String AXMenuListActionVerb()
return String();
}
-String missingPluginText()
+String multipleFileUploadText(unsigned numberOfFiles)
{
- return String::fromUTF8("Missing Plug-in");
+ return String::number(numberOfFiles) + String::fromUTF8(" files");
}
String crashedPluginText()
{
- return String::fromUTF8("Plug-in Crashed");
+ return String::fromUTF8("plugin crashed");
}
}
diff --git a/WebCore/platform/graphics/Color.cpp b/WebCore/platform/graphics/Color.cpp
index d98b202..17a5d38 100644
--- a/WebCore/platform/graphics/Color.cpp
+++ b/WebCore/platform/graphics/Color.cpp
@@ -178,6 +178,18 @@ Color::Color(const char* name)
}
}
+String Color::serialized() const
+{
+ if (alpha() == 0xFF)
+ return String::format("#%02x%02x%02x", red(), green(), blue());
+
+ // Match Gecko ("0.0" for zero, 5 decimals for anything else)
+ if (!alpha())
+ return String::format("rgba(%u, %u, %u, 0.0)", red(), green(), blue());
+
+ return String::format("rgba(%u, %u, %u, %.5f)", red(), green(), blue(), alpha() / 255.0f);
+}
+
String Color::name() const
{
if (alpha() < 0xFF)
diff --git a/WebCore/platform/graphics/Color.h b/WebCore/platform/graphics/Color.h
index b8d19e0..a6412d6 100644
--- a/WebCore/platform/graphics/Color.h
+++ b/WebCore/platform/graphics/Color.h
@@ -80,7 +80,11 @@ public:
Color(float c, float m, float y, float k, float a) : m_color(makeRGBAFromCMYKA(c, m, y, k, a)), m_valid(true) { }
explicit Color(const String&);
explicit Color(const char*);
-
+
+ // Returns the color serialized according to HTML5
+ // - http://www.whatwg.org/specs/web-apps/current-work/#serialization-of-a-color
+ String serialized() const;
+
String name() const;
void setNamedColor(const String&);
diff --git a/WebCore/platform/graphics/Font.cpp b/WebCore/platform/graphics/Font.cpp
index 2f7c216..7682011 100644
--- a/WebCore/platform/graphics/Font.cpp
+++ b/WebCore/platform/graphics/Font.cpp
@@ -26,6 +26,7 @@
#include "FloatRect.h"
#include "FontCache.h"
+#include "FontTranscoder.h"
#include "IntPoint.h"
#include "GlyphBuffer.h"
#include "WidthIterator.h"
@@ -60,6 +61,7 @@ Font::Font()
: m_letterSpacing(0)
, m_wordSpacing(0)
, m_isPlatformFont(false)
+ , m_needsTranscoding(false)
{
}
@@ -68,6 +70,7 @@ Font::Font(const FontDescription& fd, short letterSpacing, short wordSpacing)
, m_letterSpacing(letterSpacing)
, m_wordSpacing(wordSpacing)
, m_isPlatformFont(false)
+ , m_needsTranscoding(fontTranscoder().needsTranscoding(family().family().string()))
{
}
@@ -76,6 +79,7 @@ Font::Font(const FontPlatformData& fontData, bool isPrinterFont)
, m_letterSpacing(0)
, m_wordSpacing(0)
, m_isPlatformFont(true)
+ , m_needsTranscoding(fontTranscoder().needsTranscoding(family().family().string()))
{
m_fontDescription.setUsePrinterFont(isPrinterFont);
m_fontList->setPlatformFont(fontData);
@@ -87,6 +91,7 @@ Font::Font(const Font& other)
, m_letterSpacing(other.m_letterSpacing)
, m_wordSpacing(other.m_wordSpacing)
, m_isPlatformFont(other.m_isPlatformFont)
+ , m_needsTranscoding(fontTranscoder().needsTranscoding(family().family().string()))
{
}
@@ -97,6 +102,7 @@ Font& Font::operator=(const Font& other)
m_letterSpacing = other.m_letterSpacing;
m_wordSpacing = other.m_wordSpacing;
m_isPlatformFont = other.m_isPlatformFont;
+ m_needsTranscoding = other.m_needsTranscoding;
return *this;
}
diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h
index ef305c5..6633a50 100644
--- a/WebCore/platform/graphics/Font.h
+++ b/WebCore/platform/graphics/Font.h
@@ -219,12 +219,15 @@ public:
SVGFontElement* svgFont() const;
#endif
+ bool needsTranscoding() const { return m_needsTranscoding; }
+
private:
FontDescription m_fontDescription;
mutable RefPtr<FontFallbackList> m_fontList;
short m_letterSpacing;
short m_wordSpacing;
bool m_isPlatformFont;
+ bool m_needsTranscoding;
};
inline Font::~Font()
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index ab88987..4eb4c6b 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -41,6 +41,10 @@
#include <QtGlobal>
#endif
+#if USE(GSTREAMER)
+#include "MediaPlayerPrivateGStreamer.h"
+#endif
+
#if PLATFORM(MAC)
#include "MediaPlayerPrivateQTKit.h"
#elif OS(WINCE) && !PLATFORM(QT)
@@ -48,8 +52,6 @@
#elif PLATFORM(WIN)
#include "MediaPlayerPrivateQuickTimeVisualContext.h"
#include "MediaPlayerPrivateQuicktimeWin.h"
-#elif PLATFORM(GTK)
-#include "MediaPlayerPrivateGStreamer.h"
#elif PLATFORM(QT)
// QtMultimedia support is disabled currently.
#if 1 || (QT_VERSION < 0x040700)
@@ -167,10 +169,11 @@ static Vector<MediaPlayerFactory*>& installedMediaEngines()
enginesQueried = true;
#if USE(GSTREAMER)
MediaPlayerPrivateGStreamer::registerMediaEngine(addMediaEngine);
-#else
+#endif
+
#if PLATFORM(WIN)
MediaPlayerPrivateQuickTimeVisualContext::registerMediaEngine(addMediaEngine);
-#endif
+#elif !PLATFORM(GTK)
// FIXME: currently all the MediaEngines are named
// MediaPlayerPrivate. This code will need an update when bug
// 36663 is adressed.
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index 9abbb15..f825b57 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -54,6 +54,8 @@ class QTMovieVisualContext;
namespace WebCore {
+class GStreamerGWorld;
+
// Structure that will hold every native
// types supported by the current media player.
// We have to do that has multiple media players
@@ -63,13 +65,15 @@ struct PlatformMedia {
None,
QTMovieType,
QTMovieGWorldType,
- QTMovieVisualContextType
+ QTMovieVisualContextType,
+ GStreamerGWorldType,
} type;
union {
QTMovie* qtMovie;
QTMovieGWorld* qtMovieGWorld;
QTMovieVisualContext* qtMovieVisualContext;
+ GStreamerGWorld* gstreamerGWorld;
} media;
};
diff --git a/WebCore/platform/graphics/brew/IconBrew.cpp b/WebCore/platform/graphics/brew/IconBrew.cpp
new file mode 100644
index 0000000..3345111
--- /dev/null
+++ b/WebCore/platform/graphics/brew/IconBrew.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2009-2010 Company 100, Inc.
+ *
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "Icon.h"
+
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+Icon::~Icon()
+{
+ notImplemented();
+}
+
+PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames)
+{
+ notImplemented();
+ return 0;
+}
+
+void Icon::paint(GraphicsContext*, const IntRect&)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/graphics/chromium/FontCacheLinux.cpp b/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
index ececd13..53f4a52 100644
--- a/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
@@ -128,9 +128,10 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
break;
}
}
- // if we fall out of the loop, it's ok for name to still be 0
- }
- else { // convert the name to utf8
+ if (!name)
+ name = "";
+ } else {
+ // convert the name to utf8
s = family.string().utf8();
name = s.data();
}
diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
index 259cc0c..095ded2 100644
--- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
@@ -101,12 +101,6 @@ GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
GraphicsLayerChromium::~GraphicsLayerChromium()
{
- // Clean up the Skia layer.
- if (m_layer)
- m_layer->removeFromSuperlayer();
-
- if (m_transformLayer)
- m_transformLayer->removeFromSuperlayer();
}
void GraphicsLayerChromium::setName(const String& inName)
@@ -485,6 +479,11 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
void GraphicsLayerChromium::updateLayerDrawsContent()
{
+ // Since only layers that draw content have a valid context
+ // we need to call updateGraphicsContext() here to make sure one
+ // gets created.
+ m_layer->drawsContentUpdated();
+
if (m_drawsContent)
m_layer->setNeedsDisplay();
@@ -533,7 +532,8 @@ void GraphicsLayerChromium::updateContentsRect()
if (!m_contentsLayer)
return;
- m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
+ // The position of the layer is the center of quad.
+ m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x() + m_contentsRect.width() / 2, m_contentsRect.y() + m_contentsRect.height() / 2));
m_contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
}
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp
index 05be15c..8fb28ef 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -55,9 +55,10 @@ LayerChromium::LayerChromium(LayerType type, GraphicsLayerChromium* owner)
, m_borderWidth(0)
, m_borderColor(0, 0, 0, 0)
, m_backgroundColor(0, 0, 0, 0)
+ , m_anchorPoint(0.5, 0.5)
, m_anchorPointZ(0)
, m_clearsContext(false)
- , m_doubleSided(false)
+ , m_doubleSided(true)
, m_edgeAntialiasingMask(0)
, m_hidden(false)
, m_masksToBounds(false)
@@ -69,9 +70,10 @@ LayerChromium::LayerChromium(LayerType type, GraphicsLayerChromium* owner)
, m_skiaContext(0)
, m_graphicsContext(0)
, m_geometryFlipped(false)
+ , m_contentsDirty(false)
, m_contents(0)
+ , m_hasContext(false)
{
- updateGraphicsContext(m_backingStoreRect);
}
LayerChromium::~LayerChromium()
@@ -79,14 +81,30 @@ LayerChromium::~LayerChromium()
// Our superlayer should be holding a reference to us so there should be no
// way for us to be destroyed while we still have a superlayer.
ASSERT(!superlayer());
+
+ // Remove the superlayer reference from all sublayers.
+ removeAllSublayers();
}
-void LayerChromium::updateGraphicsContext(const IntSize& size)
+void LayerChromium::updateGraphicsContext()
{
+ // If the layer doesn't draw anything (e.g. it's a container layer) then we
+ // don't create a canvas / context for it. The root layer is a special
+ // case as even if it's marked as a container layer it does actually have
+ // content that it draws.
+ RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
+ if (!drawsContent() && !(this == rootLayer())) {
+ m_graphicsContext.clear();
+ m_skiaContext.clear();
+ m_canvas.clear();
+ m_hasContext = false;
+ return;
+ }
+
#if PLATFORM(SKIA)
// Create new canvas and context. OwnPtr takes care of freeing up
// the old ones.
- m_canvas = new skia::PlatformCanvas(size.width(), size.height(), false);
+ m_canvas = new skia::PlatformCanvas(m_backingStoreSize.width(), m_backingStoreSize.height(), false);
m_skiaContext = new PlatformContextSkia(m_canvas.get());
// This is needed to get text to show up correctly. Without it,
@@ -95,31 +113,32 @@ void LayerChromium::updateGraphicsContext(const IntSize& size)
m_skiaContext->setDrawingToImageBuffer(true);
m_graphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_skiaContext.get()));
+
+ m_hasContext = true;
+ m_contentsDirty = true;
#else
#error "Need to implement for your platform."
#endif
- // The backing store allocated for a layer can be smaller than the layer's bounds.
- // This is mostly true for the root layer whose backing store is sized based on the visible
- // portion of the layer rather than the actual page size.
- m_backingStoreRect = size;
+
+ return;
+}
+
+void LayerChromium::drawsContentUpdated()
+{
+ // Create a drawing context if the layer now draws content
+ // or delete the existing context if the layer doesn't draw
+ // content anymore.
+ updateGraphicsContext();
}
void LayerChromium::updateContents()
{
RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
- if (backing && !backing->paintingGoesToWindow())
+ if (backing && !backing->paintingGoesToWindow() && drawsContent())
m_owner->paintGraphicsLayerContents(*m_graphicsContext, IntRect(0, 0, m_bounds.width(), m_bounds.height()));
-}
-void LayerChromium::drawDebugBorder()
-{
- m_graphicsContext->setStrokeColor(m_borderColor, DeviceColorSpace);
- m_graphicsContext->setStrokeThickness(m_borderWidth);
- m_graphicsContext->drawLine(IntPoint(0, 0), IntPoint(m_bounds.width(), 0));
- m_graphicsContext->drawLine(IntPoint(0, 0), IntPoint(0, m_bounds.height()));
- m_graphicsContext->drawLine(IntPoint(m_bounds.width(), 0), IntPoint(m_bounds.width(), m_bounds.height()));
- m_graphicsContext->drawLine(IntPoint(0, m_bounds.height()), IntPoint(m_bounds.width(), m_bounds.height()));
+ m_contentsDirty = false;
}
void LayerChromium::setContents(NativeImagePtr contents)
@@ -128,6 +147,7 @@ void LayerChromium::setContents(NativeImagePtr contents)
if (m_contents == contents)
return;
m_contents = contents;
+ m_contentsDirty = true;
}
void LayerChromium::setNeedsCommit()
@@ -201,28 +221,29 @@ int LayerChromium::indexOfSublayer(const LayerChromium* reference)
return -1;
}
-void LayerChromium::setBackingStoreRect(const IntSize& rect)
+// This method can be called to overide the size of the backing store
+// used for the layer. It's typically called on the root layer to limit
+// its size to the actual visible size.
+void LayerChromium::setBackingStoreSize(const IntSize& size)
{
- if (m_backingStoreRect == rect)
+ if (m_backingStoreSize == size)
return;
- updateGraphicsContext(rect);
+ m_backingStoreSize = size;
+ updateGraphicsContext();
+ setNeedsCommit();
}
-void LayerChromium::setBounds(const IntSize& rect)
+void LayerChromium::setBounds(const IntSize& size)
{
- if (rect == m_bounds)
+ if (m_bounds == size)
return;
- m_bounds = rect;
+ m_bounds = size;
+ m_backingStoreSize = size;
// Re-create the canvas and associated contexts.
- updateGraphicsContext(m_bounds);
-
- // Layer contents need to be redrawn as the backing surface
- // was recreated above.
- updateContents();
-
+ updateGraphicsContext();
setNeedsCommit();
}
@@ -270,8 +291,11 @@ LayerChromium* LayerChromium::superlayer() const
void LayerChromium::setNeedsDisplay(const FloatRect& dirtyRect)
{
- // Redraw the contents of the layer.
- updateContents();
+ // Simply mark the contents as dirty. The actual redraw will
+ // happen when it's time to do the compositing.
+ // FIXME: Should only update the dirty rect instead of marking
+ // the entire layer dirty.
+ m_contentsDirty = true;
setNeedsCommit();
}
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h
index 5b93f77..1b807a5 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerChromium.h
@@ -151,6 +151,7 @@ public:
bool geometryFlipped() const { return m_geometryFlipped; }
void updateContents();
+ bool contentsDirty() { return m_contentsDirty; }
void setContents(NativeImagePtr contents);
NativeImagePtr contents() const { return m_contents; }
@@ -158,9 +159,13 @@ public:
skia::PlatformCanvas* platformCanvas() { return m_canvas.get(); }
GraphicsContext* graphicsContext() { return m_graphicsContext.get(); }
- void setBackingStoreRect(const IntSize&);
+ void setBackingStoreSize(const IntSize&);
- void drawDebugBorder();
+ bool drawsContent() { return m_owner && m_owner->drawsContent(); }
+
+ // This method should be called every time the status drawsContent()
+ // status changes to ensure that the internal graphics context is in sync.
+ void drawsContentUpdated();
private:
LayerChromium(LayerType, GraphicsLayerChromium* owner);
@@ -184,7 +189,8 @@ private:
// Re-creates the canvas and graphics context. This method
// must be called every time the layer is resized. Only layers
- void updateGraphicsContext(const IntSize&);
+ // that do drawing and the root layer get a context.
+ void updateGraphicsContext();
Vector<RefPtr<LayerChromium> > m_sublayers;
LayerChromium* m_superlayer;
@@ -195,11 +201,12 @@ private:
OwnPtr<PlatformContextSkia> m_skiaContext;
OwnPtr<GraphicsContext> m_graphicsContext;
#endif
+ bool m_hasContext;
LayerType m_layerType;
IntSize m_bounds;
- IntSize m_backingStoreRect;
+ IntSize m_backingStoreSize;
FloatPoint m_position;
FloatPoint m_anchorPoint;
Color m_backgroundColor;
@@ -223,6 +230,8 @@ private:
bool m_geometryFlipped;
bool m_needsDisplayOnBoundsChange;
+ bool m_contentsDirty;
+
ContentsGravityType m_contentsGravity;
NativeImagePtr m_contents;
String m_name;
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 722c80c..fbdb9e2 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -34,105 +34,682 @@
#if USE(ACCELERATED_COMPOSITING)
#include "LayerRendererChromium.h"
+#include "GLES2Context.h"
#include "LayerChromium.h"
+#include "NotImplemented.h"
+#include "Page.h"
+#if PLATFORM(SKIA)
+#include "NativeImageSkia.h"
#include "PlatformContextSkia.h"
-#include "skia/ext/platform_canvas.h"
+#endif
+
+#include <GLES2/gl2.h>
namespace WebCore {
-PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create()
+static WTFLogChannel LogLayerRenderer = { 0x00000000, "LayerRenderer", WTFLogChannelOn };
+
+static void checkGLError()
+{
+#ifndef NDEBUG
+ GLenum error = glGetError();
+ if (error)
+ LOG_ERROR("GL Error: %d " , error);
+#endif
+}
+
+static GLuint loadShader(GLenum type, const char* shaderSource)
+{
+ GLuint shader = glCreateShader(type);
+ if (!shader)
+ return 0;
+ glShaderSource(shader, 1, &shaderSource, 0);
+ glCompileShader(shader);
+ GLint compiled;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+ if (!compiled) {
+ glDeleteShader(shader);
+ return 0;
+ }
+ return shader;
+}
+
+static GLuint loadShaderProgram(const char* vertexShaderSource, const char* fragmentShaderSource)
+{
+ GLuint vertexShader;
+ GLuint fragmentShader;
+ GLuint programObject;
+ GLint linked;
+ vertexShader = loadShader(GL_VERTEX_SHADER, vertexShaderSource);
+ if (!vertexShader)
+ return 0;
+ fragmentShader = loadShader(GL_FRAGMENT_SHADER, fragmentShaderSource);
+ if (!fragmentShader) {
+ glDeleteShader(vertexShader);
+ return 0;
+ }
+ programObject = glCreateProgram();
+ if (!programObject)
+ return 0;
+ glAttachShader(programObject, vertexShader);
+ glAttachShader(programObject, fragmentShader);
+ glLinkProgram(programObject);
+ glGetProgramiv(programObject, GL_LINK_STATUS, &linked);
+ if (!linked) {
+ glDeleteProgram(programObject);
+ return 0;
+ }
+ glDeleteShader(vertexShader);
+ glDeleteShader(fragmentShader);
+ return programObject;
+}
+
+static void toGLMatrix(float* flattened, const TransformationMatrix& m)
+{
+ flattened[0] = m.m11();
+ flattened[1] = m.m12();
+ flattened[2] = m.m13();
+ flattened[3] = m.m14();
+ flattened[4] = m.m21();
+ flattened[5] = m.m22();
+ flattened[6] = m.m23();
+ flattened[7] = m.m24();
+ flattened[8] = m.m31();
+ flattened[9] = m.m32();
+ flattened[10] = m.m33();
+ flattened[11] = m.m34();
+ flattened[12] = m.m41();
+ flattened[13] = m.m42();
+ flattened[14] = m.m43();
+ flattened[15] = m.m44();
+}
+
+static TransformationMatrix orthoMatrix(float left, float right, float bottom, float top, float nearZ, float farZ)
{
- return new LayerRendererChromium();
+ float deltaX = right - left;
+ float deltaY = top - bottom;
+ float deltaZ = farZ - nearZ;
+ TransformationMatrix ortho;
+ if (!deltaX || !deltaY || !deltaZ)
+ return ortho;
+ ortho.setM11(2.0f / deltaX);
+ ortho.setM41(-(right + left) / deltaX);
+ ortho.setM22(2.0f / deltaY);
+ ortho.setM42(-(top + bottom) / deltaY);
+ ortho.setM33(-2.0f / deltaZ);
+ ortho.setM43(-(nearZ + farZ) / deltaZ);
+ return ortho;
}
-LayerRendererChromium::LayerRendererChromium()
+// Creates a GL texture object to be used for transfering the layer's bitmap into.
+static GLuint createLayerTexture()
+{
+ GLuint textureId = 0;
+ glGenTextures(1, &textureId);
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ // Do basic linear filtering on resize.
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ // NPOT textures in GL ES only work when the wrap mode is set to GL_CLAMP_TO_EDGE.
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ return textureId;
+}
+
+
+PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(Page* page)
+{
+ return new LayerRendererChromium(page);
+}
+
+LayerRendererChromium::LayerRendererChromium(Page* page)
: m_rootLayer(0)
, m_needsDisplay(false)
+ , m_layerProgramObject(0)
+ , m_borderProgramObject(0)
+ , m_scrollProgramObject(0)
+ , m_positionLocation(0)
+ , m_texCoordLocation(1)
+ , m_page(page)
+ , m_rootLayerTextureWidth(0)
+ , m_rootLayerTextureHeight(0)
{
+ m_quadVboIds[Vertices] = m_quadVboIds[LayerElements] = 0;
+ m_hardwareCompositing = (initGL() && initializeSharedGLObjects());
}
LayerRendererChromium::~LayerRendererChromium()
{
+ if (m_hardwareCompositing) {
+ makeContextCurrent();
+ glDeleteBuffers(3, m_quadVboIds);
+ glDeleteProgram(m_layerProgramObject);
+ glDeleteProgram(m_scrollProgramObject);
+ glDeleteProgram(m_borderProgramObject);
+ }
}
-void LayerRendererChromium::updateLayerContents()
+void LayerRendererChromium::drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity, bool scrolling)
{
- if (m_rootLayer)
- updateLayerContentsRecursive(m_rootLayer.get());
+ static GLfloat glMatrix[16];
+
+ TransformationMatrix renderMatrix = matrix;
+
+ // Apply a scaling factor to size the quad from 1x1 to its intended size.
+ renderMatrix.scale3d(width, height, 1);
+
+ // Apply the projection matrix before sending the transform over to the shader.
+ renderMatrix.multiply(m_projectionMatrix);
+
+ toGLMatrix(&glMatrix[0], renderMatrix);
+
+ int matrixLocation = (scrolling ? m_scrollMatrixLocation : m_matrixLocation);
+ glUniformMatrix4fv(matrixLocation, 1, false, &glMatrix[0]);
+
+ if (!scrolling)
+ glUniform1f(m_alphaLocation, opacity);
+
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
}
-#if PLATFORM(SKIA)
-void LayerRendererChromium::drawLayersInCanvas(skia::PlatformCanvas* canvas, const IntRect& clipRect)
+
+// Updates the contents of the root layer texture that fall inside the updateRect
+// and re-composits all sublayers.
+void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect& visibleRect,
+ const IntRect& contentRect, const IntPoint& scrollPosition)
{
+ ASSERT(m_hardwareCompositing);
+
if (!m_rootLayer)
return;
- canvas->save();
- canvas->clipRect(SkRect(clipRect));
+ // If the size of the visible area has changed then allocate a new texture
+ // to store the contents of the root layer and adjust the projection matrix
+ // and viewport.
+ makeContextCurrent();
+
+ glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId);
+
+ unsigned int visibleRectWidth = visibleRect.width();
+ unsigned int visibleRectHeight = visibleRect.height();
+ if (visibleRectWidth != m_rootLayerTextureWidth || visibleRectHeight != m_rootLayerTextureHeight) {
+ m_rootLayerTextureWidth = visibleRect.width();
+ m_rootLayerTextureHeight = visibleRect.height();
+
+ m_projectionMatrix = orthoMatrix(0, visibleRectWidth + 0.5, visibleRectHeight + 0.5, 0, -1000, 1000);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ }
+
+ // The GL viewport covers the entire visible area, including the scrollbars.
+ glViewport(0, 0, visibleRectWidth, visibleRectHeight);
+
+ // The layer, scroll and debug border shaders all use the same vertex attributes
+ // so we can bind them only once.
+ glBindBuffer(GL_ARRAY_BUFFER, m_quadVboIds[Vertices]);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadVboIds[LayerElements]);
+ GLuint offset = 0;
+ glVertexAttribPointer(m_positionLocation, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(offset));
+ offset += 3 * sizeof(GLfloat);
+ glVertexAttribPointer(m_texCoordLocation, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(offset));
+ glEnableVertexAttribArray(m_positionLocation);
+ glEnableVertexAttribArray(m_texCoordLocation);
+ glActiveTexture(GL_TEXTURE0);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
- // First composite the root layer into the canvas.
- canvas->drawBitmap(m_rootLayer->platformCanvas()->getDevice()->accessBitmap(false), 0, 0, 0);
+ IntPoint scrollDelta = toPoint(scrollPosition - m_scrollPosition);
+ // Scroll only when the updateRect contains pixels for the newly uncovered region to avoid flashing.
+ if ((scrollDelta.x() && updateRect.width() >= abs(scrollDelta.x()) && updateRect.height() >= contentRect.height())
+ || (scrollDelta.y() && updateRect.height() >= abs(scrollDelta.y()) && updateRect.width() >= contentRect.width())) {
+ // Scrolling works as follows: We render a quad with the current root layer contents
+ // translated by the amount the page has scrolled since the last update and then read the
+ // pixels of the content area (visible area excluding the scroll bars) back into the
+ // root layer texture. The newly exposed area is subesquently filled as usual with
+ // the contents of the updateRect.
+ TransformationMatrix scrolledLayerMatrix;
+ scrolledLayerMatrix.translate3d((int)floorf(0.5 * visibleRect.width() + 0.5) - scrollDelta.x(),
+ (int)floorf(0.5 * visibleRect.height() + 0.5) + scrollDelta.y(), 0);
+ scrolledLayerMatrix.scale3d(1, -1, 1);
+
+ // Switch shaders to avoid RGB swizzling.
+ glUseProgram(m_scrollProgramObject);
+ glUniform1i(m_scrollSamplerLocation, 0);
+
+ drawTexturedQuad(scrolledLayerMatrix, visibleRect.width(), visibleRect.height(), 1, true);
+
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height());
+
+ checkGLError();
+ m_scrollPosition = scrollPosition;
+ }
+
+ // FIXME: The following check should go away when the compositor renders independently from its own thread.
+ // Ignore a 1x1 update rect at (0, 0) as that's used a way to kick off a redraw for the compositor.
+ if (!(!updateRect.x() && !updateRect.y() && updateRect.width() == 1 && updateRect.height() == 1)) {
+ // Update the root layer texture.
+ ASSERT((updateRect.x() + updateRect.width() <= m_rootLayerTextureWidth)
+ && (updateRect.y() + updateRect.height() <= m_rootLayerTextureHeight));
+
+#if PLATFORM(SKIA)
+ // Get the contents of the updated rect.
+ const SkBitmap bitmap = m_rootLayer->platformCanvas()->getDevice()->accessBitmap(false);
+ int rootLayerWidth = bitmap.width();
+ int rootLayerHeight = bitmap.height();
+ ASSERT(rootLayerWidth == updateRect.width() && rootLayerHeight == updateRect.height());
+ void* pixels = bitmap.getPixels();
- // Account for the scroll offset before compositing the remaining layers.
- // Note that the root layer's painting takes into account the scroll offset already.
- canvas->translate(-m_scrollFrame.fLeft, -m_scrollFrame.fTop);
+ checkGLError();
+ // Copy the contents of the updated rect to the root layer texture.
+ glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ checkGLError();
+#else
+#error Must port to your platform
+#endif
+ }
- float opacity = 1.0f;
+ glClearColor(0, 0, 1, 1);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ // Render the root layer using a quad that takes up the entire visible area of the window.
+ glUseProgram(m_layerProgramObject);
+ glUniform1i(m_samplerLocation, 0);
+ TransformationMatrix layerMatrix;
+ layerMatrix.translate3d(visibleRect.width() / 2, visibleRect.height() / 2, 0);
+ drawTexturedQuad(layerMatrix, visibleRect.width(), visibleRect.height(), 1, false);
+
+ // If culling is enabled then we will cull the backface.
+ glCullFace(GL_BACK);
+ // The orthographic projection is setup such that Y starts at zero and
+ // increases going down the page so we need to adjust the winding order of
+ // front facing triangles.
+ glFrontFace(GL_CW);
+
+ // The shader used to render layers returns pre-multiplied alpha colors
+ // so we need to send the blending mode appropriately.
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ checkGLError();
+
+ // FIXME: Need to prevent composited layers from drawing over the scroll
+ // bars.
+
+ // FIXME: Sublayers need to be sorted in Z to get the correct transparency effect.
+
+ // Translate all the composited layers by the scroll position.
+ TransformationMatrix matrix;
+ matrix.translate3d(-m_scrollPosition.x(), -m_scrollPosition.y(), 0);
+ float opacity = 1;
const Vector<RefPtr<LayerChromium> >& sublayers = m_rootLayer->getSublayers();
for (size_t i = 0; i < sublayers.size(); i++)
- drawLayerInCanvasRecursive(canvas, sublayers[i].get(), opacity);
+ compositeLayersRecursive(sublayers[i].get(), matrix, opacity, visibleRect);
- canvas->restore();
+ glFlush();
+ m_gles2Context->swapBuffers();
m_needsDisplay = false;
}
-void LayerRendererChromium::drawLayerInCanvasRecursive(skia::PlatformCanvas* canvas, LayerChromium* layer, float opacity)
+// Returns the id of the texture currently associated with the layer or
+// -1 if the id hasn't been registered yet.
+int LayerRendererChromium::getTextureId(LayerChromium* layer)
{
- // Guarantees that the canvas is restored to a known state on destruction.
- SkAutoCanvasRestore autoRestoreCanvas(canvas, true);
+ TextureIdMap::iterator textureId = m_textureIdMap.find(layer);
+ if (textureId != m_textureIdMap.end())
+ return textureId->second;
- FloatPoint position = layer->position();
- FloatPoint anchorPoint = layer->anchorPoint();
- SkMatrix transform = layer->transform().toAffineTransform();
+ return -1;
+}
+
+// Allocates a new texture for the layer and registers it in the textureId map.
+// FIXME: We will need to come up with a more sophisticated allocation strategy here.
+// FIXME: We need to free up the associated texture upon layer destruction.
+int LayerRendererChromium::assignTextureForLayer(LayerChromium* layer)
+{
+ GLuint textureId = createLayerTexture();
+
+ // FIXME: Check that textureId is valid
+ m_textureIdMap.set(layer, textureId);
+ return textureId;
+}
+
+bool LayerRendererChromium::freeLayerTexture(LayerChromium* layer)
+{
+ TextureIdMap::iterator textureId = m_textureIdMap.find(layer);
+ if (textureId == m_textureIdMap.end())
+ return false;
+ // Free up the texture.
+ glDeleteTextures(1, &(textureId->second));
+ m_textureIdMap.remove(textureId);
+ return true;
+}
+
+// Draws a debug border around the layer's bounds.
+void LayerRendererChromium::drawDebugBorder(LayerChromium* layer, const TransformationMatrix& matrix)
+{
+ static GLfloat glMatrix[16];
+ Color borderColor = layer->borderColor();
+ if (!borderColor.alpha())
+ return;
+
+ glUseProgram(m_borderProgramObject);
+ TransformationMatrix renderMatrix = matrix;
IntSize bounds = layer->bounds();
+ renderMatrix.scale3d(bounds.width(), bounds.height(), 1);
+ renderMatrix.multiply(m_projectionMatrix);
+ toGLMatrix(&glMatrix[0], renderMatrix);
+ glUniformMatrix4fv(m_borderMatrixLocation, 1, false, &glMatrix[0]);
- canvas->translate(position.x(), position.y());
+ glUniform4f(m_borderColorLocation, borderColor.red() / 255.0,
+ borderColor.green() / 255.0,
+ borderColor.blue() / 255.0,
+ 1);
- SkScalar tx = SkScalarMul(anchorPoint.x(), bounds.width());
- SkScalar ty = SkScalarMul(anchorPoint.y(), bounds.height());
- canvas->translate(tx, ty);
- canvas->concat(transform);
- canvas->translate(-tx, -ty);
+ glLineWidth(layer->borderWidth());
- // The position we get is for the center of the layer, but
- // drawBitmap starts at the upper-left corner, and therefore
- // we need to adjust our transform.
- canvas->translate(-0.5f * bounds.width(), -0.5f * bounds.height());
+ // The indices for the line are stored in the same array as the triangle indices.
+ glDrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, (void*)(6 * sizeof(unsigned short)));
+ checkGLError();
- layer->drawDebugBorder();
+ // Switch back to the shader program used for layer contents.
+ glUseProgram(m_layerProgramObject);
+}
+
+// Returns true if any part of the layer falls within the visibleRect
+bool LayerRendererChromium::isLayerVisible(LayerChromium* layer, const TransformationMatrix& matrix, const IntRect& visibleRect)
+{
+ // Form the matrix used by the shader to map the corners of the layer's
+ // bounds into clip space.
+ TransformationMatrix renderMatrix = matrix;
+ renderMatrix.scale3d(layer->bounds().width(), layer->bounds().height(), 1);
+ renderMatrix.multiply(m_projectionMatrix);
+
+ FloatRect layerRect(-0.5, -0.5, 1, 1);
+ FloatRect mappedRect = renderMatrix.mapRect(layerRect);
+
+ // The layer is visible if it intersects any part of a rectangle whose origin
+ // is at (-1, -1) and size is 2x2.
+ return mappedRect.intersects(FloatRect(-1, -1, 2, 2));
+}
+
+void LayerRendererChromium::compositeLayersRecursive(LayerChromium* layer, const TransformationMatrix& matrix, float opacity, const IntRect& visibleRect)
+{
+ static GLfloat glMatrix[16];
- SkPaint opacityPaint;
+ // Compute the new matrix transformation that will be applied to this layer and
+ // all its sublayers.
+ // The basic transformation chain for the layer is (using the Matrix x Vector order):
+ // M = M[p] * T[l] * T[a] * M[l] * T[-a]
+ // Where M[p] is the parent matrix passed down to the function
+ // T[l] is the translation of the layer's center
+ // T[a] and T[-a] is a translation/inverse translation by the anchor point
+ // M[l] is the layer's matrix
+ // Note that the final matrix used by the shader for the layer is P * M * S . This final product
+ // is effectively computed in drawTexturedQuad().
+ // Where: P is the projection matrix
+ // M is the layer's matrix computed above
+ // S is the scale adjustment (to scale up to the layer size)
+ IntSize bounds = layer->bounds();
+ FloatPoint anchorPoint = layer->anchorPoint();
+ FloatPoint position = layer->position();
+ float anchorX = (anchorPoint.x() - 0.5) * bounds.width();
+ float anchorY = (0.5 - anchorPoint.y()) * bounds.height();
+
+ // M = M[p]
+ TransformationMatrix localMatrix = matrix;
+ // M = M[p] * T[l]
+ localMatrix.translate3d(position.x(), position.y(), 0);
+ // M = M[p] * T[l] * T[a]
+ localMatrix.translate3d(anchorX, anchorY, 0);
+ // M = M[p] * T[l] * T[a] * M[l]
+ localMatrix.multLeft(layer->transform());
+ // M = M[p] * T[l] * T[a] * M[l] * T[-a]
+ localMatrix.translate3d(-anchorX, -anchorY, 0);
+
+ bool skipLayer = false;
+ if (bounds.width() > 2048 || bounds.height() > 2048) {
+ LOG(LayerRenderer, "Skipping layer with size %d %d", bounds.width(), bounds.height());
+ skipLayer = true;
+ }
+
+ // Calculate the layer's opacity.
opacity *= layer->opacity();
- opacityPaint.setAlpha(opacity * 255);
- canvas->drawBitmap(layer->platformCanvas()->getDevice()->accessBitmap(false), 0, 0, &opacityPaint);
+ bool layerVisible = isLayerVisible(layer, localMatrix, visibleRect);
+
+ // Note that there are two types of layers:
+ // 1. Layers that have their own GraphicsContext and can draw their contents on demand (layer->drawsContent() == true).
+ // 2. Layers that are just containers of images/video/etc that don't own a GraphicsContext (layer->contents() == true).
+ if ((layer->drawsContent() || layer->contents()) && !skipLayer && layerVisible) {
+ int textureId = getTextureId(layer);
+ // If no texture has been created for the layer yet then create one now.
+ if (textureId == -1)
+ textureId = assignTextureForLayer(layer);
+
+ // Redraw the contents of the layer if necessary.
+ if ((layer->drawsContent() || layer->contents()) && layer->contentsDirty()) {
+ // Update the contents of the layer before taking a snapshot. For layers that
+ // are simply containers, the following call just clears the dirty flag but doesn't
+ // actually do any draws/copies.
+ layer->updateContents();
+
+ const SkBitmap* skiaBitmap = 0;
+ void* pixels = 0;
+ if (layer->drawsContent()) { // Layer has its own GraphicsContext.
+ // The contents of the layer are stored in the canvas associated with it.
+ const SkBitmap& bitmap = layer->platformCanvas()->getDevice()->accessBitmap(false);
+ skiaBitmap = &bitmap;
+ } else { // Layer is a container.
+ // The layer contains an Image.
+ NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(layer->contents());
+ skiaBitmap = skiaImage;
+ }
+
+ ASSERT(skiaBitmap);
+ SkBitmap::Config skiaConfig = skiaBitmap->config();
+ // FIXME: must support more image configurations.
+ if (skiaConfig == SkBitmap::kARGB_8888_Config) {
+ SkAutoLockPixels lock(*skiaBitmap);
+ int bitmapWidth = skiaBitmap->width();
+ int bitmapHeight = skiaBitmap->height();
+ int rowBytes = skiaBitmap->rowBytes();
+ ASSERT(rowBytes == bitmapWidth * 4);
+
+ // Copy the layer contents into the texture.
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ void* pixels = skiaBitmap->getPixels();
+ if (pixels) {
+ // FIXME. We can be smart here and call glTexSubImage2D if the new bitmap has the same
+ // size as the old one which will save us one unecessary allocation / deallocation.
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmapWidth, bitmapHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ checkGLError();
+ }
+ }
+ }
+
+ if (layer->doubleSided())
+ glDisable(GL_CULL_FACE);
+ else
+ glEnable(GL_CULL_FACE);
+
+ glBindTexture(GL_TEXTURE_2D, textureId);
+
+ drawTexturedQuad(localMatrix, bounds.width(), bounds.height(), opacity, false);
+ }
+ // Draw the debug border if there is one.
+ drawDebugBorder(layer, localMatrix);
+
+ // Apply the sublayer transform.
+ localMatrix.multLeft(layer->sublayerTransform());
+
+ // The origin of the sublayers is actually the left top corner of the layer
+ // instead of the center. The matrix passed down to the sublayers is therefore:
+ // M[s] = M * T[-center]
+ localMatrix.translate3d(-bounds.width() * 0.5, -bounds.height() * 0.5, 0);
const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers();
for (size_t i = 0; i < sublayers.size(); i++)
- drawLayerInCanvasRecursive(canvas, sublayers[i].get(), opacity);
+ compositeLayersRecursive(sublayers[i].get(), localMatrix, opacity, visibleRect);
}
-#endif // PLATFORM(SKIA)
-void LayerRendererChromium::updateLayerContentsRecursive(LayerChromium* layer)
+bool LayerRendererChromium::makeContextCurrent()
{
- layer->updateContents();
+ return m_gles2Context->makeCurrent();
+}
- const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers();
- for (size_t i = 0; i < sublayers.size(); i++)
- updateLayerContentsRecursive(sublayers[i].get());
+bool LayerRendererChromium::initGL()
+{
+ m_gles2Context = GLES2Context::create(m_page);
+
+ if (!m_gles2Context)
+ return false;
+
+ return true;
}
+// Binds the given attribute name to a common location across all three programs
+// used by the compositor. This allows the code to bind the attributes only once
+// even when switching between programs.
+void LayerRendererChromium::bindCommonAttribLocation(int location, char* attribName)
+{
+ glBindAttribLocation(m_layerProgramObject, location, attribName);
+ glBindAttribLocation(m_borderProgramObject, location, attribName);
+ glBindAttribLocation(m_scrollProgramObject, location, attribName);
+}
+
+bool LayerRendererChromium::initializeSharedGLObjects()
+{
+ // Shaders for drawing the layer contents.
+ char vertexShaderString[] =
+ "attribute vec4 a_position; \n"
+ "attribute vec2 a_texCoord; \n"
+ "uniform mat4 matrix; \n"
+ "varying vec2 v_texCoord; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = matrix * a_position; \n"
+ " v_texCoord = a_texCoord; \n"
+ "} \n";
+ char fragmentShaderString[] =
+ // FIXME: Re-introduce precision qualifier when we need GL ES shaders.
+ "//precision mediump float; \n"
+ "varying vec2 v_texCoord; \n"
+ "uniform sampler2D s_texture; \n"
+ "uniform float alpha; \n"
+ "void main() \n"
+ "{ \n"
+ " vec4 texColor = texture2D(s_texture, v_texCoord); \n"
+ " gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha; \n"
+ "} \n";
+
+ // Fragment shader used for rendering the scrolled root layer quad. It differs
+ // from fragmentShaderString in that it doesn't swizzle the colors and doesn't
+ // take an alpha value.
+ char scrollFragmentShaderString[] =
+ // FIXME: Re-introduce precision qualifier when we need GL ES shaders.
+ "//precision mediump float; \n"
+ "varying vec2 v_texCoord; \n"
+ "uniform sampler2D s_texture; \n"
+ "void main() \n"
+ "{ \n"
+ " vec4 texColor = texture2D(s_texture, v_texCoord); \n"
+ " gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w); \n"
+ "} \n";
+
+ // Shaders for drawing the debug borders around the layers.
+ char borderVertexShaderString[] =
+ "attribute vec4 a_position; \n"
+ "uniform mat4 matrix; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = matrix * a_position; \n"
+ "} \n";
+ char borderFragmentShaderString[] =
+ // FIXME: Re-introduce precision qualifier when we need GL ES shaders.
+ "//precision mediump float; \n"
+ "uniform vec4 color; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = color; \n"
+ "} \n";
+
+ GLfloat vertices[] = { -0.5f, 0.5f, 0.0f, // Position 0
+ 0.0f, 1.0f, // TexCoord 0
+ -0.5f, -0.5f, 0.0f, // Position 1
+ 0.0f, 0.0f, // TexCoord 1
+ 0.5f, -0.5f, 0.0f, // Position 2
+ 1.0f, 0.0f, // TexCoord 2
+ 0.5f, 0.5f, 0.0f, // Position 3
+ 1.0f, 1.0f // TexCoord 3
+ };
+ GLushort indices[] = { 0, 1, 2, 0, 2, 3, // The two triangles that make up the layer quad.
+ 0, 1, 2, 3}; // A line path for drawing the layer border.
+
+ makeContextCurrent();
+ m_layerProgramObject = loadShaderProgram(vertexShaderString, fragmentShaderString);
+ if (!m_layerProgramObject) {
+ LOG_ERROR("Failed to create shader program for layers");
+ return false;
+ }
+
+ m_scrollProgramObject = loadShaderProgram(vertexShaderString, scrollFragmentShaderString);
+ if (!m_scrollProgramObject) {
+ LOG_ERROR("Failed to create shader program for scrolling layer");
+ return false;
+ }
+
+ m_borderProgramObject = loadShaderProgram(borderVertexShaderString, borderFragmentShaderString);
+ if (!m_borderProgramObject) {
+ LOG_ERROR("Failed to create shader program for debug borders");
+ return false;
+ }
+
+ // Specify the attrib location for the position and make it the same for all three programs to
+ // avoid binding re-binding the vertex attributes.
+ bindCommonAttribLocation(m_positionLocation, "a_position");
+ bindCommonAttribLocation(m_texCoordLocation, "a_texCoord");
+
+ checkGLError();
+
+ // Re-link the shaders to get the new attrib location to take effect.
+ glLinkProgram(m_layerProgramObject);
+ glLinkProgram(m_borderProgramObject);
+ glLinkProgram(m_scrollProgramObject);
+
+ checkGLError();
+
+ // Get locations of uniforms for the layer content shader program.
+ m_samplerLocation = glGetUniformLocation(m_layerProgramObject, "s_texture");
+ m_matrixLocation = glGetUniformLocation(m_layerProgramObject, "matrix");
+ m_alphaLocation = glGetUniformLocation(m_layerProgramObject, "alpha");
+
+ m_scrollMatrixLocation = glGetUniformLocation(m_scrollProgramObject, "matrix");
+ m_scrollSamplerLocation = glGetUniformLocation(m_scrollProgramObject, "s_texture");
+
+ // Get locations of uniforms for the debug border shader program.
+ m_borderMatrixLocation = glGetUniformLocation(m_borderProgramObject, "matrix");
+ m_borderColorLocation = glGetUniformLocation(m_borderProgramObject, "color");
+
+ glGenBuffers(3, m_quadVboIds);
+ glBindBuffer(GL_ARRAY_BUFFER, m_quadVboIds[Vertices]);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadVboIds[LayerElements]);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
+
+ // Create a texture object to hold the contents of the root layer.
+ m_rootLayerTextureId = createLayerTexture();
+ if (m_rootLayerTextureId == -1) {
+ LOG_ERROR("Failed to create texture for root layer");
+ return false;
+ }
+ // Turn off filtering for the root layer to avoid blurring from the repeated
+ // writes and reads to the framebuffer that happen while scrolling.
+ glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ return true;
+}
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index 7eb429f..498678e 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -36,45 +36,98 @@
#include "IntRect.h"
#include "LayerChromium.h"
+#include "SkBitmap.h"
+#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
-namespace skia {
-class PlatformCanvas;
-}
-
namespace WebCore {
+class GLES2Context;
+class Page;
+
+// Class that handles drawing of composited render layers using GL.
class LayerRendererChromium : public Noncopyable {
public:
- static PassOwnPtr<LayerRendererChromium> create();
+ static PassOwnPtr<LayerRendererChromium> create(Page* page);
- LayerRendererChromium();
+ LayerRendererChromium(Page* page);
~LayerRendererChromium();
-#if PLATFORM(SKIA)
- void drawLayersInCanvas(skia::PlatformCanvas*, const IntRect& clipRect);
-#endif
- void updateLayerContents();
+ // Updates the contents of the root layer that fall inside the updateRect and recomposites
+ // all the layers.
+ void drawLayers(const IntRect& updateRect, const IntRect& visibleRect, const IntRect& contentRect, const IntPoint& scrollPosition);
void setRootLayer(PassRefPtr<LayerChromium> layer) { m_rootLayer = layer; }
LayerChromium* rootLayer() { return m_rootLayer.get(); }
void setNeedsDisplay() { m_needsDisplay = true; }
- void setScrollFrame(SkIRect& scrollFrame) { m_scrollFrame = scrollFrame; }
+ // Frees the texture associated with the given layer.
+ bool freeLayerTexture(LayerChromium*);
+
+ bool hardwareCompositing() const { return m_hardwareCompositing; }
private:
-#if PLATFORM(SKIA)
- void drawLayerInCanvasRecursive(skia::PlatformCanvas*, LayerChromium*, float opacity);
-#endif
- void updateLayerContentsRecursive(LayerChromium*);
+ void compositeLayersRecursive(LayerChromium*, const TransformationMatrix&, float opacity, const IntRect& visibleRect);
+
+ void drawDebugBorder(LayerChromium*, const TransformationMatrix&);
+
+ void drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity, bool scrolling);
+
+ bool isLayerVisible(LayerChromium*, const TransformationMatrix&, const IntRect& visibleRect);
+
+ void bindCommonAttribLocation(int location, char* attribName);
+
+ enum VboIds { Vertices, LayerElements };
+
+ // These are here only temporarily and should be removed once we switch over to GGL
+ bool initGL();
+ bool makeContextCurrent();
+
+ bool initializeSharedGLObjects();
+ int getTextureId(LayerChromium*);
+ int assignTextureForLayer(LayerChromium*);
+
+ // GL shader program object IDs.
+ unsigned int m_layerProgramObject;
+ unsigned int m_borderProgramObject;
+ unsigned int m_scrollProgramObject;
+
+ unsigned int m_rootLayerTextureId;
+ int m_rootLayerTextureWidth;
+ int m_rootLayerTextureHeight;
+
+ // Shader uniform and attribute locations.
+ const int m_positionLocation;
+ const int m_texCoordLocation;
+ int m_samplerLocation;
+ int m_matrixLocation;
+ int m_alphaLocation;
+ int m_scrollMatrixLocation;
+ int m_scrollSamplerLocation;
+
+ int m_borderMatrixLocation;
+ int m_borderColorLocation;
+
+ unsigned int m_quadVboIds[3];
+ TransformationMatrix m_projectionMatrix;
RefPtr<LayerChromium> m_rootLayer;
bool m_needsDisplay;
- SkIRect m_scrollFrame;
+ IntPoint m_scrollPosition;
+ bool m_hardwareCompositing;
+
+ // Map associating layers with textures ids used by the GL compositor.
+ typedef HashMap<LayerChromium*, unsigned int> TextureIdMap;
+ TextureIdMap m_textureIdMap;
+
+ OwnPtr<GLES2Context> m_gles2Context;
+
+ // The WebCore Page that the compositor renders into.
+ Page* m_page;
};
}
diff --git a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp
new file mode 100644
index 0000000..c5022f9
--- /dev/null
+++ b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "GStreamerGWorld.h"
+
+#include "MediaPlayerPrivateGStreamer.h"
+
+using namespace std;
+
+namespace WebCore {
+
+PassRefPtr<GStreamerGWorld> GStreamerGWorld::createGWorld(MediaPlayerPrivateGStreamer* player)
+{
+ return adoptRef(new GStreamerGWorld(player));
+}
+
+GStreamerGWorld::GStreamerGWorld(MediaPlayerPrivateGStreamer* player)
+ : m_player(player)
+{
+}
+
+GStreamerGWorld::~GStreamerGWorld()
+{
+}
+
+}
diff --git a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h
new file mode 100644
index 0000000..b626298
--- /dev/null
+++ b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef GStreamerGWorld_h
+#define GStreamerGWorld_h
+
+#if ENABLE(VIDEO)
+
+#include "RefCounted.h"
+#include "RefPtr.h"
+#include <glib.h>
+
+
+namespace WebCore {
+
+class MediaPlayerPrivateGStreamer;
+
+
+class GStreamerGWorld : public RefCounted<GStreamerGWorld> {
+
+public:
+ static PassRefPtr<GStreamerGWorld> createGWorld(MediaPlayerPrivateGStreamer*);
+ ~GStreamerGWorld();
+
+private:
+ GStreamerGWorld(MediaPlayerPrivateGStreamer*);
+ MediaPlayerPrivateGStreamer* m_player;
+};
+
+}
+#endif
+#endif
diff --git a/WebCore/platform/graphics/gstreamer/ImageGStreamer.h b/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
index 2e97b4d..3d6d74a 100644
--- a/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
@@ -54,6 +54,10 @@ class ImageGStreamer : public RefCounted<ImageGStreamer> {
cairo_surface_t* m_surface;
#endif
+#if PLATFORM(MAC)
+ ImageGStreamer(GstBuffer*&, IntSize);
+#endif
+
};
}
diff --git a/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm b/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm
new file mode 100644
index 0000000..421b90f
--- /dev/null
+++ b/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "ImageGStreamer.h"
+
+using namespace WebCore;
+
+PassRefPtr<ImageGStreamer> ImageGStreamer::createImage(GstBuffer* buffer)
+{
+ int width = 0, height = 0;
+ GstCaps* caps = gst_buffer_get_caps(buffer);
+ GstVideoFormat format;
+ if (!gst_video_format_parse_caps(caps, &format, &width, &height)) {
+ gst_caps_unref(caps);
+ return NULL;
+ }
+
+ return adoptRef(new ImageGStreamer(buffer, IntSize(width, height)));
+}
+
+ImageGStreamer::ImageGStreamer(GstBuffer*& buffer, IntSize size)
+ : m_image(0)
+{
+ ASSERT(GST_BUFFER_SIZE(buffer));
+
+ RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(0, static_cast<UInt8*>(GST_BUFFER_DATA(buffer)), GST_BUFFER_SIZE(buffer), kCFAllocatorNull));
+ RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithCFData(data.get()));
+ static CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+ CGImageRef frameImage = CGImageCreate(size.width(), size.height(), 8, 32, size.width()*4, colorSpace,
+ kCGBitmapByteOrder32Little | kCGImageAlphaFirst, provider.get(), 0, false, kCGRenderingIntentDefault);
+ m_image = BitmapImage::create(frameImage);
+}
+
+ImageGStreamer::~ImageGStreamer()
+{
+ if (m_image)
+ m_image.clear();
+
+ m_image = 0;
+}
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index 8f6c9e0..d619e14 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -34,6 +34,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "GOwnPtrGStreamer.h"
+#include "GStreamerGWorld.h"
#include "GraphicsContext.h"
#include "GraphicsTypes.h"
#include "ImageGStreamer.h"
@@ -1348,6 +1349,15 @@ bool MediaPlayerPrivateGStreamer::supportsFullscreen() const
return true;
}
+
+PlatformMedia MediaPlayerPrivateGStreamer::platformMedia() const
+{
+ PlatformMedia p;
+ p.type = PlatformMedia::GStreamerGWorldType;
+ p.media.gstreamerGWorld = m_gstGWorld.get();
+ return p;
+}
+
void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
{
ASSERT(m_playBin);
@@ -1372,6 +1382,8 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
ASSERT(!m_playBin);
m_playBin = gst_element_factory_make("playbin2", "play");
+ m_gstGWorld = GStreamerGWorld::createGWorld(this);
+
GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_playBin));
gst_bus_add_signal_watch(bus);
g_signal_connect(bus, "message", G_CALLBACK(mediaPlayerPrivateMessageCallback), this);
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
index 06519fa..81f90b8 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
@@ -43,6 +43,7 @@ class GraphicsContext;
class IntSize;
class IntRect;
class String;
+class GStreamerGWorld;
gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data);
void mediaPlayerPrivateVolumeChangedCallback(GObject* element, GParamSpec* pspec, gpointer data);
@@ -116,6 +117,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
bool hasSingleSecurityOrigin() const;
bool supportsFullscreen() const;
+ PlatformMedia platformMedia() const;
GstElement* pipeline() const { return m_playBin; }
bool pipelineReset() const { return m_resetPipeline; }
@@ -172,6 +174,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
MediaPlayer::Preload m_preload;
bool m_delayingLoad;
bool m_mediaDurationKnown;
+ RefPtr<GStreamerGWorld> m_gstGWorld;
};
}
diff --git a/WebCore/platform/graphics/gtk/ImageGtk.cpp b/WebCore/platform/graphics/gtk/ImageGtk.cpp
index daa70ef..3de8495 100644
--- a/WebCore/platform/graphics/gtk/ImageGtk.cpp
+++ b/WebCore/platform/graphics/gtk/ImageGtk.cpp
@@ -158,7 +158,7 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name)
fileName = getThemeIconFileName(GTK_STOCK_MISSING_IMAGE, 16);
if (fileName.isNull()) {
gchar* imagename = g_strdup_printf("%s.png", name);
- gchar* glibFileName = g_build_filename(DATA_DIR, "webkit-1.0", "images", imagename, 0);
+ gchar* glibFileName = g_build_filename(DATA_DIR, "webkit-1.0", "images", imagename, NULL);
fileName = glibFileName;
g_free(imagename);
g_free(glibFileName);
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 3b3158f..80c0d03 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -840,10 +840,21 @@ void GraphicsContext3D::releaseShaderCompiler()
void GraphicsContext3D::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height)
{
ensureContext(m_contextObj);
- if (internalformat == DEPTH_STENCIL)
+ switch (internalformat) {
+ case DEPTH_STENCIL:
internalformat = GL_DEPTH24_STENCIL8_EXT;
- else if (internalformat == DEPTH_COMPONENT16)
+ break;
+ case DEPTH_COMPONENT16:
internalformat = GL_DEPTH_COMPONENT;
+ break;
+ case RGBA4:
+ case RGB5_A1:
+ internalformat = GL_RGBA;
+ break;
+ case RGB565:
+ internalformat = GL_RGB;
+ break;
+ }
::glRenderbufferStorageEXT(target, internalformat, width, height);
}
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
index 49aebba..26a5de6 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
@@ -165,6 +165,8 @@ private:
void commitLayerChangesBeforeSublayers();
void commitLayerChangesAfterSublayers();
+ FloatSize constrainedSize() const;
+
bool requiresTiledLayer(const FloatSize&) const;
void swapFromOrToTiledLayer(bool useTiledLayer);
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
index 294c82f..bd01353 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
@@ -1050,6 +1050,8 @@ void GraphicsLayerCA::updateSublayerList()
void GraphicsLayerCA::updateLayerPosition()
{
+ // FIXME: if constrained the size, the position will be wrong. Fixing this is not trivial.
+
// Position is offset on the layer by the layer anchor point.
CGPoint posPoint = CGPointMake(m_position.x() + m_anchorPoint.x() * m_size.width(),
m_position.y() + m_anchorPoint.y() * m_size.height());
@@ -1098,6 +1100,11 @@ void GraphicsLayerCA::updateLayerSize()
if (needTiledLayer != m_usingTiledLayer)
swapFromOrToTiledLayer(needTiledLayer);
+ if (m_usingTiledLayer) {
+ FloatSize sizeToUse = constrainedSize();
+ rect = CGRectMake(0, 0, sizeToUse.width(), sizeToUse.height());
+ }
+
[m_layer.get() setBounds:rect];
if (LayerMap* layerCloneMap = m_layerClones.get()) {
LayerMap::const_iterator end = layerCloneMap->end();
@@ -2144,6 +2151,29 @@ void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)
END_BLOCK_OBJC_EXCEPTIONS
}
+FloatSize GraphicsLayerCA::constrainedSize() const
+{
+ float tileColumns = ceilf(m_size.width() / cTiledLayerTileSize);
+ float tileRows = ceilf(m_size.height() / cTiledLayerTileSize);
+ double numTiles = tileColumns * tileRows;
+
+ FloatSize constrainedSize = m_size;
+ const unsigned cMaxTileCount = 512;
+ while (numTiles > cMaxTileCount) {
+ // Constrain the wider dimension.
+ if (constrainedSize.width() >= constrainedSize.height()) {
+ tileColumns = max(floorf(cMaxTileCount / tileRows), 1.0f);
+ constrainedSize.setWidth(tileColumns * cTiledLayerTileSize);
+ } else {
+ tileRows = max(floorf(cMaxTileCount / tileColumns), 1.0f);
+ constrainedSize.setHeight(tileRows * cTiledLayerTileSize);
+ }
+ numTiles = tileColumns * tileRows;
+ }
+
+ return constrainedSize;
+}
+
bool GraphicsLayerCA::requiresTiledLayer(const FloatSize& size) const
{
if (!m_drawsContent)
diff --git a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
index 7d60ca5..b2f2302 100644
--- a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
@@ -834,7 +834,7 @@ void PainterOpenVG::clipPath(const Path& path, PainterOpenVG::ClipOperation mask
vgSeti(VG_FILL_RULE, toVGFillRule(clipRule));
vgRenderToMask(path.platformPath()->vgPath(), VG_FILL_PATH, (VGMaskOperation) maskOp);
ASSERT_VG_NO_ERROR();
-#elseif
+#else
notImplemented();
#endif
}
diff --git a/WebCore/platform/graphics/openvg/PathOpenVG.cpp b/WebCore/platform/graphics/openvg/PathOpenVG.cpp
index 2c366ee..7e67036 100644
--- a/WebCore/platform/graphics/openvg/PathOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/PathOpenVG.cpp
@@ -459,8 +459,8 @@ void Path::transform(const AffineTransform& transformation)
delete m_path;
m_path = dst;
- m_path->m_currentPoint = transform.mapPoint(m_path->m_currentPoint);
- m_path->m_subpathStartPoint = transform.mapPoint(m_path->m_subpathStartPoint);
+ m_path->m_currentPoint = transformation.mapPoint(m_path->m_currentPoint);
+ m_path->m_subpathStartPoint = transformation.mapPoint(m_path->m_subpathStartPoint);
}
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 0100b72..69121c8 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -167,10 +167,13 @@ static inline Qt::FillRule toQtFillRule(WindRule rule)
}
struct TransparencyLayer : FastAllocBase {
- TransparencyLayer(const QPainter* p, const QRect &rect)
+ TransparencyLayer(const QPainter* p, const QRect &rect, qreal opacity, QPixmap& alphaMask)
: pixmap(rect.width(), rect.height())
+ , opacity(opacity)
+ , alphaMask(alphaMask)
+ , saveCounter(1) // see the comment for saveCounter
{
- offset = rect.topLeft();
+ offset = p->transform().mapRect(rect).topLeft();
pixmap.fill(Qt::transparent);
painter.begin(&pixmap);
painter.setRenderHint(QPainter::Antialiasing, p->testRenderHint(QPainter::Antialiasing));
@@ -182,7 +185,9 @@ struct TransparencyLayer : FastAllocBase {
painter.setFont(p->font());
if (painter.paintEngine()->hasFeature(QPaintEngine::PorterDuff))
painter.setCompositionMode(p->compositionMode());
- painter.setClipPath(p->clipPath());
+ // if the path is an empty region, this assignment disables all painting
+ if (!p->clipPath().isEmpty())
+ painter.setClipPath(p->clipPath());
}
TransparencyLayer()
@@ -193,6 +198,11 @@ struct TransparencyLayer : FastAllocBase {
QPoint offset;
QPainter painter;
qreal opacity;
+ // for clipToImageBuffer
+ QPixmap alphaMask;
+ // saveCounter is only used in combination with alphaMask
+ // otherwise, its value is unspecified
+ int saveCounter;
private:
TransparencyLayer(const TransparencyLayer &) {}
TransparencyLayer & operator=(const TransparencyLayer &) { return *this; }
@@ -217,6 +227,9 @@ public:
bool antiAliasingForRectsAndLines;
QStack<TransparencyLayer*> layers;
+ // Counting real layers. Required by inTransparencyLayer() calls
+ // For example, layers with valid alphaMask are not real layers
+ int layerCount;
QPainter* redirect;
// reuse this brush for solid color (to prevent expensive QBrush construction)
@@ -235,6 +248,7 @@ private:
GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p)
{
painter = p;
+ layerCount = 0;
redirect = 0;
solidColor = QBrush(Qt::black);
@@ -289,11 +303,17 @@ AffineTransform GraphicsContext::getCTM() const
void GraphicsContext::savePlatformState()
{
+ if (!m_data->layers.isEmpty() && !m_data->layers.top()->alphaMask.isNull())
+ ++m_data->layers.top()->saveCounter;
m_data->p()->save();
}
void GraphicsContext::restorePlatformState()
{
+ if (!m_data->layers.isEmpty() && !m_data->layers.top()->alphaMask.isNull())
+ if (!--m_data->layers.top()->saveCounter)
+ endTransparencyLayer();
+
m_data->p()->restore();
if (!m_data->currentPath.isEmpty() && m_common->state.pathTransform.isInvertible()) {
@@ -678,7 +698,7 @@ void GraphicsContext::addPath(const Path& path)
bool GraphicsContext::inTransparencyLayer() const
{
- return !m_data->layers.isEmpty();
+ return m_data->layerCount;
}
PlatformPath* GraphicsContext::currentPath()
@@ -837,10 +857,9 @@ void GraphicsContext::beginTransparencyLayer(float opacity)
w = int(qBound(qreal(0), deviceClip.width(), (qreal)w) + 2);
h = int(qBound(qreal(0), deviceClip.height(), (qreal)h) + 2);
- TransparencyLayer * layer = new TransparencyLayer(m_data->p(), QRect(x, y, w, h));
-
- layer->opacity = opacity;
- m_data->layers.push(layer);
+ QPixmap emptyAlphaMask;
+ m_data->layers.push(new TransparencyLayer(m_data->p(), QRect(x, y, w, h), opacity, emptyAlphaMask));
+ ++m_data->layerCount;
}
void GraphicsContext::endTransparencyLayer()
@@ -849,6 +868,12 @@ void GraphicsContext::endTransparencyLayer()
return;
TransparencyLayer* layer = m_data->layers.pop();
+ if (!layer->alphaMask.isNull()) {
+ layer->painter.resetTransform();
+ layer->painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+ layer->painter.drawPixmap(QPoint(), layer->alphaMask);
+ } else
+ --m_data->layerCount; // see the comment for layerCount
layer->painter.end();
QPainter* p = m_data->p();
@@ -1086,9 +1111,21 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect)
}
}
-void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)
+void GraphicsContext::clipToImageBuffer(const FloatRect& floatRect, const ImageBuffer* image)
{
- notImplemented();
+ if (paintingDisabled())
+ return;
+
+ QPixmap* nativeImage = image->image()->nativeImageForCurrentFrame();
+ if (!nativeImage)
+ return;
+
+ IntRect rect(floatRect);
+ QPixmap alphaMask = *nativeImage;
+ if (alphaMask.width() != rect.width() || alphaMask.height() != rect.height())
+ alphaMask = alphaMask.scaled(rect.width(), rect.height());
+
+ m_data->layers.push(new TransparencyLayer(m_data->p(), rect, 1.0, alphaMask));
}
void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect,
diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index aac1164..9f36b2a 100644
--- a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -43,23 +43,25 @@
namespace WebCore {
+#ifndef QT_NO_GRAPHICSEFFECT
class MaskEffectQt : public QGraphicsEffect {
public:
MaskEffectQt(QObject* parent, QGraphicsItem* maskLayer)
- : QGraphicsEffect(parent)
- , m_maskLayer(maskLayer)
+ : QGraphicsEffect(parent)
+ , m_maskLayer(maskLayer)
{
}
void draw(QPainter* painter)
{
- // this is a modified clone of QGraphicsOpacityEffect.
- // It's more efficient to do it this way because
- // (a) we don't need the QBrush abstraction - we always end up using QGraphicsItem::paint from the mask layer
+ // This is a modified clone of QGraphicsOpacityEffect.
+ // It's more efficient to do it this way because:
+ // (a) We don't need the QBrush abstraction - we always end up using QGraphicsItem::paint
+ // from the mask layer.
// (b) QGraphicsOpacityEffect detaches the pixmap, which is inefficient on OpenGL.
QPixmap maskPixmap(sourceBoundingRect().toAlignedRect().size());
- // we need to do this so the pixmap would have hasAlpha()
+ // We need to do this so the pixmap would have hasAlpha().
maskPixmap.fill(Qt::transparent);
QPainter maskPainter(&maskPixmap);
QStyleOptionGraphicsItem option;
@@ -67,11 +69,12 @@ public:
maskPainter.setRenderHints(painter->renderHints(), true);
m_maskLayer->paint(&maskPainter, &option, 0);
maskPainter.end();
+
QPoint offset;
QPixmap srcPixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, QGraphicsEffect::NoPad);
- // we have to use another intermediate pixmap, to make sure the mask applies only to this item
- // and doesn't modify pixels already painted into this paint-device
+ // We have to use another intermediate pixmap, to make sure the mask applies only to this item
+ // and doesn't modify pixels already painted into this paint-device.
QPixmap pixmap(srcPixmap.size());
pixmap.fill(Qt::transparent);
@@ -79,25 +82,29 @@ public:
return;
QPainter pixmapPainter(&pixmap);
+
pixmapPainter.setRenderHints(painter->renderHints());
pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
- // We use drawPixmap rather than detaching, because it's more efficient on OpenGL
+
+ // We use drawPixmap rather than detaching, because it's more efficient on OpenGL.
pixmapPainter.drawPixmap(0, 0, srcPixmap);
pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
pixmapPainter.drawPixmap(0, 0, maskPixmap);
+
pixmapPainter.end();
painter->drawPixmap(offset, pixmap);
}
QGraphicsItem* m_maskLayer;
};
+#endif // QT_NO_GRAPHICSEFFECT
class GraphicsLayerQtImpl : public QGraphicsObject {
Q_OBJECT
public:
- // this set of flags help us defer which properties of the layer have been
- // modified by the compositor, so we can know what to look for in the next flush
+ // This set of flags help us defer which properties of the layer have been
+ // modified by the compositor, so we can know what to look for in the next flush.
enum ChangeMask {
NoChanges = 0,
@@ -129,7 +136,7 @@ public:
DistributesOpacityChange = (1L << 20)
};
- // the compositor lets us special-case images and colors, so we try to do so
+ // The compositor lets us special-case images and colors, so we try to do so.
enum StaticContentType { HTMLContentType, PixmapContentType, ColorContentType, MediaContentType, Canvas3DContentType};
const GraphicsLayerQtImpl* rootLayer() const;
@@ -142,34 +149,36 @@ public:
virtual QRectF boundingRect() const;
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
- // We manage transforms ourselves because transform-origin acts differently in webkit and in Qt, and we need it as a fallback in case we encounter an un-invertible matrix
+ // We manage transforms ourselves because transform-origin acts differently in webkit and in Qt,
+ // and we need it as a fallback in case we encounter an un-invertible matrix.
void setBaseTransform(const TransformationMatrix&);
void updateTransform();
// let the compositor-API tell us which properties were changed
void notifyChange(ChangeMask);
- // actual rendering of the web-content into a QPixmap
- // We prefer to use our own caching because it gives us a higher level of granularity than QGraphicsItem cache modes -
- // sometimes we need to cache the contents even `though the item needs to be updated, e.g. when the background-color is changed.
+ // Actual rendering of the web-content into a QPixmap:
+ // We prefer to use our own caching because it gives us a higher level of granularity than
+ // QGraphicsItem cache modes - Sometimes we need to cache the contents even though the item
+ // needs to be updated, e.g. when the background-color is changed.
// TODO: investigate if QGraphicsItem caching can be improved to support that out of the box.
QPixmap recache(const QRegion&);
- // called when the compositor is ready for us to show the changes on screen
- // this is called indirectly from ChromeClientQt::setNeedsOneShotDrawingSynchronization
- // (meaning the sync would happen together with the next draw)
- // or ChromeClientQt::scheduleCompositingLayerSync (meaning the sync will happen ASAP)
+ // Called when the compositor is ready for us to show the changes on screen.
+ // This is called indirectly from ChromeClientQt::setNeedsOneShotDrawingSynchronization
+ // (meaning the sync would happen together with the next draw) or
+ // ChromeClientQt::scheduleCompositingLayerSync (meaning the sync will happen ASAP)
void flushChanges(bool recursive = true, bool forceTransformUpdate = false);
public slots:
- // we need to notify the client (aka the layer compositor) when the animation actually starts
+ // We need to notify the client (ie. the layer compositor) when the animation actually starts.
void notifyAnimationStarted();
- // we notify WebCore of a layer changed asynchronously; otherwise we end up calling flushChanges too often.
+ // We notify WebCore of a layer changed asynchronously; otherwise we end up calling flushChanges too often.
void notifySyncRequired();
signals:
- // optimization: we don't want to use QTimer::singleShot
+ // Optimization: Avoid using QTimer::singleShot().
void notifyAnimationStartedAsync();
public:
@@ -179,21 +188,27 @@ public:
TransformationMatrix m_transformRelativeToRootLayer;
bool m_transformAnimationRunning;
bool m_opacityAnimationRunning;
+#ifndef QT_NO_GRAPHICSEFFECT
QWeakPointer<MaskEffectQt> m_maskEffect;
+#endif
struct ContentData {
QPixmap pixmap;
QRegion regionToUpdate;
bool updateAll;
+
QColor contentsBackgroundColor;
QColor backgroundColor;
+
QWeakPointer<QGraphicsObject> mediaLayer;
StaticContentType contentType;
+
float opacity;
+
ContentData()
- : updateAll(false)
- , contentType(HTMLContentType)
- , opacity(1.f)
+ : updateAll(false)
+ , contentType(HTMLContentType)
+ , opacity(1.f)
{
}
@@ -232,9 +247,16 @@ public:
bool backfaceVisibility: 1;
bool distributeOpacity: 1;
bool align: 2;
- State(): maskLayer(0), opacity(1.f), preserves3D(false), masksToBounds(false),
- drawsContent(false), contentsOpaque(false), backfaceVisibility(false),
- distributeOpacity(false)
+
+ State()
+ : maskLayer(0)
+ , opacity(1.f)
+ , preserves3D(false)
+ , masksToBounds(false)
+ , drawsContent(false)
+ , contentsOpaque(false)
+ , backfaceVisibility(false)
+ , distributeOpacity(false)
{
}
} m_state;
@@ -248,6 +270,18 @@ public:
#endif
};
+inline GraphicsLayerQtImpl* toGraphicsLayerQtImpl(QGraphicsItem* item)
+{
+ ASSERT(item);
+ return qobject_cast<GraphicsLayerQtImpl*>(item->toGraphicsObject());
+}
+
+inline GraphicsLayerQtImpl* toGraphicsLayerQtImpl(QGraphicsObject* item)
+{
+ ASSERT(item);
+ return qobject_cast<GraphicsLayerQtImpl*>(item);
+}
+
GraphicsLayerQtImpl::GraphicsLayerQtImpl(GraphicsLayerQt* newLayer)
: QGraphicsObject(0)
, m_layer(newLayer)
@@ -258,11 +292,11 @@ GraphicsLayerQtImpl::GraphicsLayerQtImpl(GraphicsLayerQt* newLayer)
, m_gc3D(0)
#endif
{
- // we use graphics-view for compositing, not for interactivity
+ // We use graphics-view for compositing-only, not for interactivity.
setAcceptedMouseButtons(Qt::NoButton);
- // we need to have the item enabled, or else wheel events are not
- // passed to the parent class implementation of wheelEvent, where
- // they are ignored and passed to the item below.
+
+ // We need to have the item enabled, or else wheel events are not passed to the parent class
+ // implementation of wheelEvent, where they are ignored and passed to the item below.
setEnabled(true);
connect(this, SIGNAL(notifyAnimationStartedAsync()), this, SLOT(notifyAnimationStarted()), Qt::QueuedConnection);
@@ -270,12 +304,12 @@ GraphicsLayerQtImpl::GraphicsLayerQtImpl(GraphicsLayerQt* newLayer)
GraphicsLayerQtImpl::~GraphicsLayerQtImpl()
{
- // the compositor manages item lifecycle - we don't want the graphics-view
- // system to automatically delete our items
-
+ // The compositor manages lifecycle of item, so we do not want the graphicsview system to delete
+ // our items automatically.
const QList<QGraphicsItem*> children = childItems();
- for (QList<QGraphicsItem*>::const_iterator it = children.begin(); it != children.end(); ++it) {
- if (QGraphicsItem* item = *it) {
+ QList<QGraphicsItem*>::const_iterator cit;
+ for (cit = children.begin(); cit != children.end(); ++cit) {
+ if (QGraphicsItem* item = *cit) {
if (scene())
scene()->removeItem(item);
item->setParentItem(0);
@@ -283,8 +317,9 @@ GraphicsLayerQtImpl::~GraphicsLayerQtImpl()
}
#ifndef QT_NO_ANIMATION
- // we do, however, own the animations...
- for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_animations.begin(); it != m_animations.end(); ++it)
+ // We do, however, own the animations.
+ QList<QWeakPointer<QAbstractAnimation> >::iterator it;
+ for (it = m_animations.begin(); it != m_animations.end(); ++it)
if (QAbstractAnimation* anim = it->data())
delete anim;
#endif
@@ -292,13 +327,11 @@ GraphicsLayerQtImpl::~GraphicsLayerQtImpl()
const GraphicsLayerQtImpl* GraphicsLayerQtImpl::rootLayer() const
{
- if (const GraphicsLayerQtImpl* parent = qobject_cast<const GraphicsLayerQtImpl*>(parentObject()))
+ if (const GraphicsLayerQtImpl* parent = toGraphicsLayerQtImpl(parentObject()))
return parent->rootLayer();
return this;
}
-
-
QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
{
if (!m_layer->drawsContent())
@@ -329,7 +362,7 @@ QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
m_layer->paintGraphicsLayerContents(gc, region.boundingRect());
- m_backingStoreKey = QPixmapCache::insert(pixmap);
+ m_backingStoreKey = QPixmapCache::insert(pixmap);
return pixmap;
}
@@ -340,14 +373,16 @@ void GraphicsLayerQtImpl::updateTransform()
TransformationMatrix localTransform;
- GraphicsLayerQtImpl* parent = qobject_cast<GraphicsLayerQtImpl*>(parentObject());
+ GraphicsLayerQtImpl* parent = toGraphicsLayerQtImpl(parentObject());
- // webkit has relative-to-size originPoint, graphics-view has a pixel originPoint, here we convert
- // we have to manage this ourselves because QGraphicsView's transformOrigin is incompatible
+ // WebCore has relative-to-size originPoint, where as the QGraphicsView has a pixel originPoint.
+ // Thus, we need to convert here as we have to manage this outselves due to the fact that the
+ // transformOrigin of the graphicsview is imcompatible.
const qreal originX = m_state.anchorPoint.x() * m_size.width();
const qreal originY = m_state.anchorPoint.y() * m_size.height();
- // We ignore QGraphicsItem::pos completely, and use only transforms - because we have to maintain that ourselves for 3D.
+ // We ignore QGraphicsItem::pos completely, and use transforms only, due to the fact that we
+ // have to maintain that ourselves for 3D.
localTransform
.translate3d(originX + m_state.pos.x(), originY + m_state.pos.y(), m_state.anchorPoint.z())
.multLeft(m_baseTransform)
@@ -378,29 +413,32 @@ void GraphicsLayerQtImpl::updateTransform()
m_transformRelativeToRootLayer.setM43(0);
}
- // Apply perspective for the use of this item's children. Perspective is always applied from the item's center.
- if (!m_state.childrenTransform.isIdentity())
+ // Apply perspective for the use of this item's children. Perspective is always applied from the item's
+ // center.
+ if (!m_state.childrenTransform.isIdentity()) {
m_transformRelativeToRootLayer
.translate(m_size.width() / 2, m_size.height() /2)
.multLeft(m_state.childrenTransform)
.translate(-m_size.width() / 2, -m_size.height() /2);
+ }
bool inverseOk = true;
- // Use QTransform::inverse to extrapolate the relative transform of this item, based on the parent's transform relative to
- // the root layer and the desired transform for this item relative to the root layer.
+ // Use QTransform::inverse to extrapolate the relative transform of this item, based on the parent's
+ // transform relative to the root layer and the desired transform for this item relative to the root layer.
const QTransform parentTransform = parent ? parent->itemTransform(rootLayer()) : QTransform();
const QTransform transform2D = QTransform(m_transformRelativeToRootLayer) * parentTransform.inverted(&inverseOk);
- // In rare cases the transformation cannot be inversed - in that case we don't apply the transformation at all, otherwise we'd flicker.
- // FIXME: This should be amended when Qt moves to a real 3D scene-graph.
+ // In rare cases the transformation cannot be inversed - in that case we don't apply the transformation at
+ // all, otherwise we'd flicker. FIXME: This should be amended when Qt moves to a real 3D scene-graph.
if (!inverseOk)
return;
setTransform(transform2D);
const QList<QGraphicsItem*> children = childItems();
- for (QList<QGraphicsItem*>::const_iterator it = children.begin(); it != children.end(); ++it)
- if (GraphicsLayerQtImpl* layer= qobject_cast<GraphicsLayerQtImpl*>((*it)->toGraphicsObject()))
+ QList<QGraphicsItem*>::const_iterator it;
+ for (it = children.begin(); it != children.end(); ++it)
+ if (GraphicsLayerQtImpl* layer= toGraphicsLayerQtImpl(*it))
layer->updateTransform();
}
@@ -414,7 +452,7 @@ QPainterPath GraphicsLayerQtImpl::opaqueArea() const
{
QPainterPath painterPath;
- // we try out best to return the opaque area, maybe it will help graphics-view render less items
+ // We try out best to return the opaque area, maybe it will help graphics-view render less items.
if (m_currentContent.backgroundColor.isValid() && m_currentContent.backgroundColor.alpha() == 0xff)
painterPath.addRect(boundingRect());
else {
@@ -422,7 +460,6 @@ QPainterPath GraphicsLayerQtImpl::opaqueArea() const
|| (m_currentContent.contentType == ColorContentType && m_currentContent.contentsBackgroundColor.alpha() == 0xff)
|| (m_currentContent.contentType == MediaContentType)
|| (m_currentContent.contentType == PixmapContentType && !m_currentContent.pixmap.hasAlpha())) {
-
painterPath.addRect(m_state.contentsRect);
}
}
@@ -481,14 +518,14 @@ void GraphicsLayerQtImpl::notifyChange(ChangeMask changeMask)
void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform)
{
- // this is the bulk of the work. understanding what the compositor is trying to achieve,
- // what graphics-view can do, and trying to find a sane common-grounds
+ // This is the bulk of the work. understanding what the compositor is trying to achieve, what
+ // graphicsview can do, and trying to find a sane common-ground.
if (!m_layer || m_changeMask == NoChanges)
goto afterLayerChanges;
if (m_currentContent.contentType == HTMLContentType && (m_changeMask & ParentChange)) {
- // the WebCore compositor manages item ownership. We have to make sure
- // graphics-view doesn't try to snatch that ownership...
+ // The WebCore compositor manages item ownership. We have to make sure graphicsview doesn't
+ // try to snatch that ownership.
if (!m_layer->parent() && !parentItem())
setParentItem(0);
else if (m_layer && m_layer->parent() && m_layer->parent()->nativeLayer() != parentItem())
@@ -496,8 +533,8 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
}
if (m_changeMask & ChildrenChange) {
- // we basically do an XOR operation on the list of current children
- // and the list of wanted children, and remove/add
+ // We basically do an XOR operation on the list of current children and the list of wanted
+ // children, and remove/add.
QSet<QGraphicsItem*> newChildren;
const Vector<GraphicsLayer*> newChildrenVector = (m_layer->children());
newChildren.reserve(newChildrenVector.size());
@@ -509,31 +546,38 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
const QSet<QGraphicsItem*> childrenToAdd = newChildren - currentChildren;
const QSet<QGraphicsItem*> childrenToRemove = currentChildren - newChildren;
- for (QSet<QGraphicsItem*>::const_iterator it = childrenToAdd.begin(); it != childrenToAdd.end(); ++it)
+ QSet<QGraphicsItem*>::const_iterator it;
+ for (it = childrenToAdd.begin(); it != childrenToAdd.end(); ++it) {
if (QGraphicsItem* w = *it)
w->setParentItem(this);
+ }
- for (QSet<QGraphicsItem*>::const_iterator it = childrenToRemove.begin(); it != childrenToRemove.end(); ++it)
- if (GraphicsLayerQtImpl* w = qobject_cast<GraphicsLayerQtImpl*>((*it)->toGraphicsObject()))
+ QSet<QGraphicsItem*>::const_iterator rit;
+ for (rit = childrenToRemove.begin(); rit != childrenToRemove.end(); ++rit) {
+ if (GraphicsLayerQtImpl* w = toGraphicsLayerQtImpl(*rit))
w->setParentItem(0);
+ }
- // children are ordered by z-value, let graphics-view know.
- for (size_t i = 0; i < newChildrenVector.size(); ++i)
+ // Children are ordered by z-value, let graphicsview know.
+ for (size_t i = 0; i < newChildrenVector.size(); ++i) {
if (newChildrenVector[i]->platformLayer())
newChildrenVector[i]->platformLayer()->setZValue(i);
+ }
}
if (m_changeMask & MaskLayerChange) {
- // we can't paint here, because we don't know if the mask layer
- // itself is ready... we'll have to wait till this layer tries to paint
+ // We can't paint here, because we don't know if the mask layer itself is ready... we'll have
+ // to wait till this layer tries to paint.
setFlag(ItemClipsChildrenToShape, m_layer->maskLayer() || m_layer->masksToBounds());
+#ifndef QT_NO_GRAPHICSEFFECT
setGraphicsEffect(0);
if (m_layer->maskLayer()) {
- if (GraphicsLayerQtImpl* mask = qobject_cast<GraphicsLayerQtImpl*>(m_layer->maskLayer()->platformLayer()->toGraphicsObject())) {
+ if (GraphicsLayerQtImpl* mask = toGraphicsLayerQtImpl(m_layer->maskLayer()->platformLayer())) {
mask->m_maskEffect = new MaskEffectQt(this, mask);
setGraphicsEffect(mask->m_maskEffect.data());
}
}
+#endif
}
if (m_changeMask & SizeChange) {
@@ -542,14 +586,15 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
m_size = QSizeF(m_layer->size().width(), m_layer->size().height());
}
}
- // FIXME: this is a hack, due to a probable QGraphicsScene bug when rapidly modifying the perspective
- // but without this line we get graphic artifacts
+
+ // FIXME: This is a hack, due to a probable QGraphicsScene bug when rapidly modifying the perspective
+ // but without this line we get graphic artifacts.
if ((m_changeMask & ChildrenTransformChange) && m_state.childrenTransform != m_layer->childrenTransform())
if (scene())
scene()->update();
if (m_changeMask & (ChildrenTransformChange | Preserves3DChange | TransformChange | AnchorPointChange | SizeChange | BackfaceVisibilityChange | PositionChange)) {
- // due to the differences between the way WebCore handles transforms and the way Qt handles transforms,
+ // Due to the differences between the way WebCore handles transforms and the way Qt handles transforms,
// all these elements affect the transforms of all the descendants.
forceUpdateTransform = true;
}
@@ -559,20 +604,21 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
case PixmapContentType:
update();
setFlag(ItemHasNoContents, false);
-
break;
+
case MediaContentType:
setFlag(ItemHasNoContents, true);
m_pendingContent.mediaLayer.data()->setParentItem(this);
break;
case ColorContentType:
- if (m_pendingContent.contentType != m_currentContent.contentType || m_pendingContent.contentsBackgroundColor != m_currentContent.contentsBackgroundColor)
+ if (m_pendingContent.contentType != m_currentContent.contentType
+ || m_pendingContent.contentsBackgroundColor != m_currentContent.contentsBackgroundColor)
update();
m_state.drawsContent = false;
setFlag(ItemHasNoContents, false);
- // we only use ItemUsesExtendedStyleOption for HTML content - colors don't gain much from that anyway
+ // Only use ItemUsesExtendedStyleOption for HTML content as colors don't gain much from that.
setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, false);
break;
@@ -608,9 +654,7 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
}
}
- if ((m_changeMask & MasksToBoundsChange)
- && m_state.masksToBounds != m_layer->masksToBounds()) {
-
+ if ((m_changeMask & MasksToBoundsChange) && m_state.masksToBounds != m_layer->masksToBounds()) {
setFlag(QGraphicsItem::ItemClipsToShape, m_layer->masksToBounds());
setFlag(QGraphicsItem::ItemClipsChildrenToShape, m_layer->masksToBounds());
}
@@ -618,18 +662,22 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
if ((m_changeMask & ContentsOpaqueChange) && m_state.contentsOpaque != m_layer->contentsOpaque())
prepareGeometryChange();
+#ifndef QT_NO_GRAPHICSEFFECT
if (m_maskEffect)
m_maskEffect.data()->update();
- else if (m_changeMask & DisplayChange) {
- // Recache now: all the content is ready and we don't want to wait until the paint event. We only need to do this for HTML content,
- // there's no point in caching directly composited content like images or solid rectangles.
+ else if (m_changeMask & DisplayChange) {
+ // Recache now: all the content is ready and we don't want to wait until the paint event.
+ // We only need to do this for HTML content, there's no point in caching directly composited
+ // content like images or solid rectangles.
if (m_pendingContent.contentType == HTMLContentType)
recache(m_pendingContent.regionToUpdate);
update(m_pendingContent.regionToUpdate.boundingRect());
m_pendingContent.regionToUpdate = QRegion();
}
+#endif
- if ((m_changeMask & BackgroundColorChange) && (m_pendingContent.backgroundColor != m_currentContent.backgroundColor))
+ if ((m_changeMask & BackgroundColorChange)
+ && (m_pendingContent.backgroundColor != m_currentContent.backgroundColor))
update();
m_state.maskLayer = m_layer->maskLayer();
@@ -655,30 +703,30 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
m_pendingContent.regionToUpdate = QRegion();
m_changeMask = NoChanges;
-
afterLayerChanges:
if (forceUpdateTransform)
updateTransform();
if (!recursive)
- return;
+ return;
QList<QGraphicsItem*> children = childItems();
if (m_state.maskLayer)
children.append(m_state.maskLayer->platformLayer());
- for (QList<QGraphicsItem*>::const_iterator it = children.begin(); it != children.end(); ++it) {
- if (QGraphicsItem* item = *it)
- if (GraphicsLayerQtImpl* layer = qobject_cast<GraphicsLayerQtImpl*>(item->toGraphicsObject()))
+ QList<QGraphicsItem*>::const_iterator it;
+ for (it = children.begin(); it != children.end(); ++it) {
+ if (QGraphicsItem* item = *it) {
+ if (GraphicsLayerQtImpl* layer = toGraphicsLayerQtImpl(item))
layer->flushChanges(true, forceUpdateTransform);
+ }
}
}
void GraphicsLayerQtImpl::notifyAnimationStarted()
{
- // WebCore notifies javascript when the animation starts
- // here we're letting it know
- m_layer->client()->notifyAnimationStarted(m_layer, WTF::currentTime());
+ // WebCore notifies javascript when the animation starts. Here we're letting it know.
+ m_layer->client()->notifyAnimationStarted(m_layer, /* DOM time */ WTF::currentTime());
}
GraphicsLayerQt::GraphicsLayerQt(GraphicsLayerClient* client)
@@ -691,75 +739,85 @@ GraphicsLayerQt::~GraphicsLayerQt()
{
}
-// this is the hook for WebCore compositor to know that Qt implements compositing with GraphicsLayerQt
+// This is the hook for WebCore compositor to know that Qt implements compositing with GraphicsLayerQt.
PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
{
return new GraphicsLayerQt(client);
}
-// reimp from GraphicsLayer.h: Qt is top-down
+/* \reimp (GraphicsLayer.h): Qt is top-down
+*/
GraphicsLayer::CompositingCoordinatesOrientation GraphicsLayer::compositingCoordinatesOrientation()
{
return CompositingCoordinatesTopDown;
}
-// reimp from GraphicsLayer.h: we'll need to update the whole display, and we can't count on the current size because it might change
+/* \reimp (GraphicsLayer.h): The current size might change, thus we need to update the whole display.
+*/
void GraphicsLayerQt::setNeedsDisplay()
{
m_impl->m_pendingContent.regionToUpdate = QRegion(QRect(QPoint(0, 0), QSize(size().width(), size().height())));
m_impl->notifyChange(GraphicsLayerQtImpl::DisplayChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setNeedsDisplayInRect(const FloatRect& rect)
{
- m_impl->m_pendingContent.regionToUpdate|= QRectF(rect).toAlignedRect();
+ m_impl->m_pendingContent.regionToUpdate |= QRectF(rect).toAlignedRect();
m_impl->notifyChange(GraphicsLayerQtImpl::DisplayChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setName(const String& name)
{
m_impl->setObjectName(name);
GraphicsLayer::setName(name);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setParent(GraphicsLayer* layer)
{
m_impl->notifyChange(GraphicsLayerQtImpl::ParentChange);
GraphicsLayer::setParent(layer);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
bool GraphicsLayerQt::setChildren(const Vector<GraphicsLayer*>& children)
{
m_impl->notifyChange(GraphicsLayerQtImpl::ChildrenChange);
return GraphicsLayer::setChildren(children);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::addChild(GraphicsLayer* layer)
{
m_impl->notifyChange(GraphicsLayerQtImpl::ChildrenChange);
GraphicsLayer::addChild(layer);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::addChildAtIndex(GraphicsLayer* layer, int index)
{
GraphicsLayer::addChildAtIndex(layer, index);
m_impl->notifyChange(GraphicsLayerQtImpl::ChildrenChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling)
{
GraphicsLayer::addChildAbove(layer, sibling);
m_impl->notifyChange(GraphicsLayerQtImpl::ChildrenChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling)
{
@@ -767,7 +825,8 @@ void GraphicsLayerQt::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling
m_impl->notifyChange(GraphicsLayerQtImpl::ChildrenChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
bool GraphicsLayerQt::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild)
{
if (GraphicsLayer::replaceChild(oldChild, newChild)) {
@@ -778,7 +837,8 @@ bool GraphicsLayerQt::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newCh
return false;
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::removeFromParent()
{
if (parent())
@@ -786,7 +846,8 @@ void GraphicsLayerQt::removeFromParent()
GraphicsLayer::removeFromParent();
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setMaskLayer(GraphicsLayer* value)
{
if (value == maskLayer())
@@ -795,7 +856,8 @@ void GraphicsLayerQt::setMaskLayer(GraphicsLayer* value)
m_impl->notifyChange(GraphicsLayerQtImpl::MaskLayerChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setPosition(const FloatPoint& value)
{
if (value == position())
@@ -804,7 +866,8 @@ void GraphicsLayerQt::setPosition(const FloatPoint& value)
m_impl->notifyChange(GraphicsLayerQtImpl::PositionChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setAnchorPoint(const FloatPoint3D& value)
{
if (value == anchorPoint())
@@ -813,7 +876,8 @@ void GraphicsLayerQt::setAnchorPoint(const FloatPoint3D& value)
m_impl->notifyChange(GraphicsLayerQtImpl::AnchorPointChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setSize(const FloatSize& value)
{
if (value == size())
@@ -822,7 +886,8 @@ void GraphicsLayerQt::setSize(const FloatSize& value)
m_impl->notifyChange(GraphicsLayerQtImpl::SizeChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setTransform(const TransformationMatrix& value)
{
if (value == transform())
@@ -831,7 +896,8 @@ void GraphicsLayerQt::setTransform(const TransformationMatrix& value)
m_impl->notifyChange(GraphicsLayerQtImpl::TransformChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setChildrenTransform(const TransformationMatrix& value)
{
if (value == childrenTransform())
@@ -840,7 +906,8 @@ void GraphicsLayerQt::setChildrenTransform(const TransformationMatrix& value)
m_impl->notifyChange(GraphicsLayerQtImpl::ChildrenTransformChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setPreserves3D(bool value)
{
if (value == preserves3D())
@@ -849,7 +916,8 @@ void GraphicsLayerQt::setPreserves3D(bool value)
m_impl->notifyChange(GraphicsLayerQtImpl::Preserves3DChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setMasksToBounds(bool value)
{
if (value == masksToBounds())
@@ -858,7 +926,8 @@ void GraphicsLayerQt::setMasksToBounds(bool value)
m_impl->notifyChange(GraphicsLayerQtImpl::MasksToBoundsChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setDrawsContent(bool value)
{
if (value == drawsContent())
@@ -867,7 +936,8 @@ void GraphicsLayerQt::setDrawsContent(bool value)
GraphicsLayer::setDrawsContent(value);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setBackgroundColor(const Color& value)
{
if (value == m_impl->m_pendingContent.backgroundColor)
@@ -877,7 +947,8 @@ void GraphicsLayerQt::setBackgroundColor(const Color& value)
m_impl->notifyChange(GraphicsLayerQtImpl::BackgroundColorChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::clearBackgroundColor()
{
if (!m_impl->m_pendingContent.backgroundColor.isValid())
@@ -887,7 +958,8 @@ void GraphicsLayerQt::clearBackgroundColor()
m_impl->notifyChange(GraphicsLayerQtImpl::BackgroundColorChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setContentsOpaque(bool value)
{
if (value == contentsOpaque())
@@ -896,7 +968,8 @@ void GraphicsLayerQt::setContentsOpaque(bool value)
GraphicsLayer::setContentsOpaque(value);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setBackfaceVisibility(bool value)
{
if (value == backfaceVisibility())
@@ -905,7 +978,8 @@ void GraphicsLayerQt::setBackfaceVisibility(bool value)
m_impl->notifyChange(GraphicsLayerQtImpl::BackfaceVisibilityChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setOpacity(float value)
{
if (value == opacity())
@@ -914,7 +988,8 @@ void GraphicsLayerQt::setOpacity(float value)
m_impl->notifyChange(GraphicsLayerQtImpl::OpacityChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setContentsRect(const IntRect& value)
{
if (value == contentsRect())
@@ -923,7 +998,8 @@ void GraphicsLayerQt::setContentsRect(const IntRect& value)
m_impl->notifyChange(GraphicsLayerQtImpl::ContentsRectChange);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setContentsToImage(Image* image)
{
m_impl->notifyChange(GraphicsLayerQtImpl::ContentChange);
@@ -935,12 +1011,13 @@ void GraphicsLayerQt::setContentsToImage(Image* image)
m_impl->m_pendingContent.pixmap = *pxm;
m_impl->m_pendingContent.contentType = GraphicsLayerQtImpl::PixmapContentType;
return;
- }
+ }
}
m_impl->m_pendingContent.pixmap = QPixmap();
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setContentsBackgroundColor(const Color& color)
{
m_impl->notifyChange(GraphicsLayerQtImpl::ContentChange);
@@ -978,54 +1055,60 @@ void GraphicsLayerQt::setContentsToMedia(PlatformLayer* media)
GraphicsLayer::setContentsToMedia(media);
}
-
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setGeometryOrientation(CompositingCoordinatesOrientation orientation)
{
m_impl->notifyChange(GraphicsLayerQtImpl::GeometryOrientationChange);
GraphicsLayer::setGeometryOrientation(orientation);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::setContentsOrientation(CompositingCoordinatesOrientation orientation)
{
m_impl->notifyChange(GraphicsLayerQtImpl::ContentsOrientationChange);
GraphicsLayer::setContentsOrientation(orientation);
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::distributeOpacity(float o)
{
m_impl->notifyChange(GraphicsLayerQtImpl::OpacityChange);
m_impl->m_state.distributeOpacity = true;
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
float GraphicsLayerQt::accumulatedOpacity() const
{
return m_impl->effectiveOpacity();
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
void GraphicsLayerQt::syncCompositingState()
{
m_impl->flushChanges();
GraphicsLayer::syncCompositingState();
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+ */
NativeLayer GraphicsLayerQt::nativeLayer() const
{
return m_impl.get();
}
-// reimp from GraphicsLayer.h
+/* \reimp (GraphicsLayer.h)
+*/
PlatformLayer* GraphicsLayerQt::platformLayer() const
{
return m_impl.get();
}
-// now we start dealing with WebCore animations translated to Qt animations
+// Now we start dealing with WebCore animations translated to Qt animations
template <typename T>
struct KeyframeValueQt {
@@ -1033,7 +1116,8 @@ struct KeyframeValueQt {
T value;
};
-// we copy this from the AnimationBase.cpp
+/* Copied from AnimationBase.cpp
+*/
static inline double solveEpsilon(double duration)
{
return 1.0 / (200.0 * duration);
@@ -1045,10 +1129,13 @@ static inline double solveCubicBezierFunction(qreal p1x, qreal p1y, qreal p2x, q
return bezier.solve(t, solveEpsilon(duration));
}
-// we want the timing function to be as close as possible to what the web-developer intended, so we're using the same function used by WebCore when compositing is disabled
-// Using easing-curves would probably work for some of the cases, but wouldn't really buy us anything as we'd have to convert the bezier function back to an easing curve
static inline qreal applyTimingFunction(const TimingFunction& timingFunction, qreal progress, double duration)
{
+ // We want the timing function to be as close as possible to what the web-developer intended, so
+ // we're using the same function used by WebCore when compositing is disabled. Using easing-curves
+ // would probably work for some of the cases, but wouldn't really buy us anything as we'd have to
+ // convert the bezier function back to an easing curve.
+
if (timingFunction.type() == LinearTimingFunction)
return progress;
if (timingFunction.type() == CubicBezierTimingFunction) {
@@ -1061,7 +1148,8 @@ static inline qreal applyTimingFunction(const TimingFunction& timingFunction, qr
return progress;
}
-// helper functions to safely get a value out of WebCore's AnimationValue*
+// Helper functions to safely get a value out of WebCore's AnimationValue*.
+
static void webkitAnimationToQtAnimationValue(const AnimationValue* animationValue, TransformOperations& transformOperations)
{
transformOperations = TransformOperations();
@@ -1078,7 +1166,8 @@ static void webkitAnimationToQtAnimationValue(const AnimationValue* animationVal
}
#ifndef QT_NO_ANIMATION
-// we put a bit of the functionality in a base class to allow casting and to save some code size
+// We put a bit of the functionality in a base class to allow casting and to save some code size.
+
class AnimationQtBase : public QAbstractAnimation {
public:
AnimationQtBase(GraphicsLayerQtImpl* layer, const KeyframeValueList& values, const IntSize& boxSize, const Animation* anim, const QString & name)
@@ -1098,7 +1187,7 @@ public:
{
QAbstractAnimation::updateState(newState, oldState);
- // for some reason I have do this asynchronously - or the animation won't work
+ // For some reason we have do this asynchronously - or the animation won't work.
if (newState == Running && oldState == Stopped && m_layer.data())
m_layer.data()->notifyAnimationStartedAsync();
}
@@ -1111,23 +1200,23 @@ public:
bool m_isAlternate;
AnimatedPropertyID m_webkitPropertyID;
- // we might need this in case the same animation is added again (i.e. resumed by WebCore)
+ // We might need this in case the same animation is added again (i.e. resumed by WebCore).
const Animation* m_webkitAnimation;
QString m_keyframesName;
bool m_fillsForwards;
};
-// we'd rather have a templatized QAbstractAnimation than QPropertyAnimation / QVariantAnimation;
+// We'd rather have a templatized QAbstractAnimation than QPropertyAnimation / QVariantAnimation;
// Since we know the types that we're dealing with, the QObject/QProperty/QVariant abstraction
-// buys us very little in this case, for too much overhead
+// buys us very little in this case, for too much overhead.
template <typename T>
class AnimationQt : public AnimationQtBase {
public:
AnimationQt(GraphicsLayerQtImpl* layer, const KeyframeValueList& values, const IntSize& boxSize, const Animation* anim, const QString & name)
- :AnimationQtBase(layer, values, boxSize, anim, name)
+ : AnimationQtBase(layer, values, boxSize, anim, name)
{
- // copying those WebCore structures is not trivial, we have to do it like this
+ // Copying those WebCore structures is not trivial, we have to do it like this.
for (size_t i = 0; i < values.size(); ++i) {
const AnimationValue* animationValue = values.at(i);
KeyframeValueQt<T> keyframeValue;
@@ -1142,7 +1231,7 @@ public:
protected:
- // this is the part that differs between animated properties
+ // This is the part that differs between animated properties.
virtual void applyFrame(const T& fromValue, const T& toValue, qreal progress) = 0;
virtual void updateCurrentTime(int currentTime)
@@ -1158,18 +1247,18 @@ protected:
if (m_keyframeValues.isEmpty())
return;
- // we find the current from-to keyframes in our little map
+ // Find the current from-to keyframes in our little map.
typename QMap<qreal, KeyframeValueQt<T> >::iterator it = m_keyframeValues.find(progress);
- // we didn't find an exact match, we try the closest match (lower bound)
+ // We didn't find an exact match, we try the closest match (lower bound).
if (it == m_keyframeValues.end())
it = m_keyframeValues.lowerBound(progress)-1;
- // we didn't find any match - we use the first keyframe
+ // We didn't find any match; use the first keyframe.
if (it == m_keyframeValues.end())
it = m_keyframeValues.begin();
- typename QMap<qreal, KeyframeValueQt<T> >::iterator it2 = it+1;
+ typename QMap<qreal, KeyframeValueQt<T> >::iterator it2 = it + 1;
if (it2 == m_keyframeValues.end())
it2 = it;
const KeyframeValueQt<T>& fromKeyframe = it.value();
@@ -1179,11 +1268,10 @@ protected:
const T& fromValue = fromKeyframe.value;
const T& toValue = toKeyframe.value;
- // now we have a source keyframe, origin keyframe and a timing function
- // we can now process the progress and apply the frame
- progress = (!progress || progress == 1 || it.key() == it2.key())
- ? progress
- : applyTimingFunction(timingFunc, (progress - it.key()) / (it2.key() - it.key()), duration());
+ // Now we have a source keyframe, origin keyframe and a timing function.
+ // We can now process the progress and apply the frame.
+ progress = (!progress || progress == 1 || it.key() == it2.key()) ?
+ progress : applyTimingFunction(timingFunc, (progress - it.key()) / (it2.key() - it.key()), duration());
applyFrame(fromValue, toValue, progress);
}
@@ -1203,10 +1291,10 @@ public:
setCurrentTime(1);
}
- // the idea is that we let WebCore manage the transform-operations
- // and Qt just manages the animation heartbeat and the bottom-line QTransform
- // we get the performance not by using QTransform instead of TransformationMatrix, but by proper caching of
- // items that are expensive for WebCore to render. We want the rest to be as close to WebCore's idea as possible.
+ // The idea is that we let WebCore manage the transform operations and Qt just manage the
+ // animation heartbeat and the bottom-line QTransform. We gain performance, not by using
+ // Transform instead of TransformationMatrix, but by proper caching of items that are
+ // expensive for WebCore to render. We want the rest to be as close to WebCore's idea as possible.
virtual void applyFrame(const TransformOperations& sourceOperations, const TransformOperations& targetOperations, qreal progress)
{
TransformationMatrix transformMatrix;
@@ -1216,10 +1304,12 @@ public:
if (sourceOperationCount) {
if (targetOperations.size() != sourceOperationCount)
validTransformLists = false;
- else
- for (size_t j = 0; j < sourceOperationCount && validTransformLists; ++j)
+ else {
+ for (size_t j = 0; j < sourceOperationCount && validTransformLists; ++j) {
if (!sourceOperations.operations()[j]->isSameType(*targetOperations.operations()[j]))
validTransformLists = false;
+ }
+ }
}
if (validTransformLists) {
@@ -1230,9 +1320,9 @@ public:
transformMatrix.blend(m_sourceMatrix, progress);
}
+ m_layer.data()->m_layer->setTransform(transformMatrix);
+ // We force the actual opacity change, otherwise it would be ignored because of the animation.
m_layer.data()->setBaseTransform(transformMatrix);
- if (m_fillsForwards)
- m_layer.data()->m_layer->setTransform(m_layer.data()->m_baseTransform);
}
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
@@ -1240,10 +1330,11 @@ public:
AnimationQtBase::updateState(newState, oldState);
if (!m_layer)
return;
+
m_layer.data()->flushChanges(true);
- // to increase FPS, we use a less accurate caching mechanism while animation is going on
- // this is a UX choice that should probably be customizable
+ // To increase FPS, we use a less accurate caching mechanism while animation is going on
+ // this is a UX choice that should probably be customizable.
if (newState == QAbstractAnimation::Running) {
m_sourceMatrix = m_layer.data()->m_layer->transform();
m_layer.data()->m_transformAnimationRunning = true;
@@ -1260,7 +1351,7 @@ public:
class OpacityAnimationQt : public AnimationQt<qreal> {
public:
- OpacityAnimationQt(GraphicsLayerQtImpl* layer, const KeyframeValueList& values, const IntSize& boxSize, const Animation* anim, const QString & name)
+ OpacityAnimationQt(GraphicsLayerQtImpl* layer, const KeyframeValueList& values, const IntSize& boxSize, const Animation* anim, const QString& name)
: AnimationQt<qreal>(layer, values, boxSize, anim, name)
{
}
@@ -1272,16 +1363,16 @@ public:
}
virtual void applyFrame(const qreal& fromValue, const qreal& toValue, qreal progress)
{
- qreal opacity = qBound(qreal(0), fromValue + (toValue-fromValue)*progress, qreal(1));
+ qreal opacity = qBound(qreal(0), fromValue + (toValue - fromValue) * progress, qreal(1));
- // FIXME: this is a hack, due to a probable QGraphicsScene bug.
+ // FIXME: This is a hack, due to a probable QGraphicsScene bug.
// Without this the opacity change doesn't always have immediate effect.
if (!m_layer.data()->opacity() && opacity)
m_layer.data()->scene()->update();
+ m_layer.data()->m_layer->setOpacity(opacity);
+ // We force the actual opacity change, otherwise it would be ignored because of the animation.
m_layer.data()->setOpacity(opacity);
- if (m_fillsForwards)
- m_layer.data()->m_layer->setOpacity(opacity);
}
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
@@ -1306,8 +1397,9 @@ bool GraphicsLayerQt::addAnimation(const KeyframeValueList& values, const IntSiz
AnimationQtBase* newAnim = 0;
- // fixed: we might already have the Qt animation object associated with this WebCore::Animation object
- for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
+ // Fixed: we might already have the Qt animation object associated with this WebCore::Animation object.
+ QList<QWeakPointer<QAbstractAnimation> >::iterator it;
+ for (it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
if (*it) {
AnimationQtBase* curAnimation = static_cast<AnimationQtBase*>(it->data());
if (curAnimation && curAnimation->m_webkitAnimation == anim)
@@ -1327,17 +1419,17 @@ bool GraphicsLayerQt::addAnimation(const KeyframeValueList& values, const IntSiz
return false;
}
- // we make sure WebCore::Animation and QAnimation are on the same terms
+ // We make sure WebCore::Animation and QAnimation are on the same terms.
newAnim->setLoopCount(anim->iterationCount());
newAnim->m_fillsForwards = anim->fillsForwards();
m_impl->m_animations.append(QWeakPointer<QAbstractAnimation>(newAnim));
QObject::connect(&m_impl->m_suspendTimer, SIGNAL(timeout()), newAnim, SLOT(resume()));
}
- // flush now or flicker...
+ // Flush now to avoid flicker.
m_impl->flushChanges(false);
- // when fill-mode is backwards/both, we set the value to 0 before the delay takes place
+ // Qhen fill-mode is backwards/both, we set the value to 0 before the delay takes place.
if (anim->fillsBackwards())
newAnim->setCurrentTime(0);
@@ -1346,10 +1438,10 @@ bool GraphicsLayerQt::addAnimation(const KeyframeValueList& values, const IntSiz
else
newAnim->start();
- // we synchronize the animation's clock to WebCore's timeOffset
+ // We synchronize the animation's clock to WebCore's timeOffset.
newAnim->setCurrentTime(timeOffset * 1000);
- // we don't need to manage the animation object's lifecycle:
+ // We don't need to manage the animation object's lifecycle:
// WebCore would call removeAnimations when it's time to delete.
return true;
@@ -1357,43 +1449,48 @@ bool GraphicsLayerQt::addAnimation(const KeyframeValueList& values, const IntSiz
void GraphicsLayerQt::removeAnimationsForProperty(AnimatedPropertyID id)
{
- for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
- if (*it) {
- AnimationQtBase* anim = static_cast<AnimationQtBase*>(it->data());
- if (anim && anim->m_webkitPropertyID == id) {
- // We need to stop the animation right away, or it might flicker before it's deleted.
- anim->stop();
- anim->deleteLater();
- it = m_impl->m_animations.erase(it);
- --it;
- }
+ QList<QWeakPointer<QAbstractAnimation> >::iterator it;
+ for (it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
+ if (!(*it))
+ continue;
+
+ AnimationQtBase* anim = static_cast<AnimationQtBase*>(it->data());
+ if (anim && anim->m_webkitPropertyID == id) {
+ // We need to stop the animation right away, or it might flicker before it's deleted.
+ anim->stop();
+ anim->deleteLater();
+ it = m_impl->m_animations.erase(it);
+ --it;
}
}
}
void GraphicsLayerQt::removeAnimationsForKeyframes(const String& name)
{
- for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
- if (*it) {
- AnimationQtBase* anim = static_cast<AnimationQtBase*>((*it).data());
- if (anim && anim->m_keyframesName == QString(name)) {
- // We need to stop the animation right away, or it might flicker before it's deleted.
- anim->stop();
- anim->deleteLater();
- it = m_impl->m_animations.erase(it);
- --it;
- }
+ QList<QWeakPointer<QAbstractAnimation> >::iterator it;
+ for (it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
+ if (!(*it))
+ continue;
+
+ AnimationQtBase* anim = static_cast<AnimationQtBase*>(it->data());
+ if (anim && anim->m_keyframesName == QString(name)) {
+ // We need to stop the animation right away, or it might flicker before it's deleted.
+ anim->stop();
+ anim->deleteLater();
+ it = m_impl->m_animations.erase(it);
+ --it;
}
}
}
void GraphicsLayerQt::pauseAnimation(const String& name, double timeOffset)
{
- for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
+ QList<QWeakPointer<QAbstractAnimation> >::iterator it;
+ for (it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
if (!(*it))
continue;
- AnimationQtBase* anim = static_cast<AnimationQtBase*>((*it).data());
+ AnimationQtBase* anim = static_cast<AnimationQtBase*>(it->data());
if (anim && anim->m_keyframesName == QString(name)) {
// we synchronize the animation's clock to WebCore's timeOffset
anim->setCurrentTime(timeOffset * 1000);
@@ -1408,9 +1505,9 @@ void GraphicsLayerQt::suspendAnimations(double time)
m_impl->m_suspendTimer.stop();
m_impl->m_suspendTimer.start(time * 1000);
} else {
- for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
- QAbstractAnimation* anim = it->data();
- if (anim)
+ QList<QWeakPointer<QAbstractAnimation> >::iterator it;
+ for (it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
+ if (QAbstractAnimation* anim = it->data())
anim->pause();
}
}
@@ -1420,9 +1517,9 @@ void GraphicsLayerQt::resumeAnimations()
{
if (m_impl->m_suspendTimer.isActive()) {
m_impl->m_suspendTimer.stop();
- for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
- QAbstractAnimation* anim = (*it).data();
- if (anim)
+ QList<QWeakPointer<QAbstractAnimation> >::iterator it;
+ for (it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
+ if (QAbstractAnimation* anim = it->data())
anim->resume();
}
}
diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index 4b85a18..4245ee5 100644
--- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -46,12 +46,19 @@ namespace WebCore {
ImageBufferData::ImageBufferData(const IntSize& size)
: m_pixmap(size)
+ , m_painter(0)
{
+ if (m_pixmap.isNull())
+ return;
+
m_pixmap.fill(QColor(Qt::transparent));
- QPainter* painter = new QPainter(&m_pixmap);
+ QPainter* painter = new QPainter;
m_painter.set(painter);
+ if (!painter->begin(&m_pixmap))
+ return;
+
// Since ImageBuffer is used mainly for Canvas, explicitly initialize
// its painter's pen and brush with the corresponding canvas defaults
// NOTE: keep in sync with CanvasRenderingContext2D::State
@@ -72,8 +79,11 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace, bool& success)
: m_data(size)
, m_size(size)
{
+ success = m_data.m_painter && m_data.m_painter->isActive();
+ if (!success)
+ return;
+
m_context.set(new GraphicsContext(m_data.m_painter.get()));
- success = true;
}
ImageBuffer::~ImageBuffer()
diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp
index 4b0c21f..a7351a0 100644
--- a/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/WebCore/platform/graphics/qt/PathQt.cpp
@@ -298,9 +298,10 @@ void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool antic
span += ea - sa;
}
- // connect to the previous point by a straight line
- m_path.lineTo(QPointF(xc + radius * cos(sar),
- yc - radius * sin(sar)));
+ // If the path is empty, move to where the arc will start to avoid painting a line from (0,0)
+ // NOTE: QPainterPath::isEmpty() won't work here since it ignores a lone MoveToElement
+ if (!m_path.elementCount())
+ m_path.arcMoveTo(xs, ys, width, height, sa);
m_path.arcTo(xs, ys, width, height, sa, span);
diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
index 58fa7d3..4abf914 100644
--- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp
+++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
@@ -77,15 +77,15 @@ struct CachedOutlineKeyHash {
static const bool safeToCompareToEmptyOrDeleted = true;
};
-typedef ListHashSet<CachedOutlineKey, CachedOutlineKeyHash> OutlineCache;
+// The global number of glyph outlines we'll cache.
+static const int outlineCacheSize = 256;
+
+typedef ListHashSet<CachedOutlineKey, outlineCacheSize+1, CachedOutlineKeyHash> OutlineCache;
// FIXME: Convert from static constructor to accessor function. WebCore tries to
// avoid global constructors to save on start-up time.
static OutlineCache outlineCache;
-// The global number of glyph outlines we'll cache.
-static const int outlineCacheSize = 256;
-
static SkScalar FIXEDToSkScalar(FIXED fixed)
{
SkFixed skFixed;
diff --git a/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp b/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp
index 0065191..20d76ef 100644
--- a/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp
+++ b/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp
@@ -36,7 +36,8 @@
#include "Image.h"
#include "PlatformString.h"
#include "SystemTime.h"
-#include "WKCACFLayer.h"
+#include "WebLayer.h"
+#include "WebTiledLayer.h"
#include <wtf/CurrentTime.h>
#include <wtf/StringExtras.h>
#include <wtf/text/CString.h>
@@ -45,115 +46,15 @@ using namespace std;
namespace WebCore {
-class WebLayer : public WKCACFLayer {
-public:
- static PassRefPtr<WKCACFLayer> create(LayerType layerType, GraphicsLayerCACF* owner)
- {
- return adoptRef(new WebLayer(layerType, owner));
- }
-
- virtual void setNeedsDisplay(const CGRect* dirtyRect)
- {
- if (m_owner) {
- if (m_owner->showRepaintCounter()) {
- CGRect layerBounds = bounds();
- CGRect repaintCounterRect = layerBounds;
- // We assume a maximum of 4 digits and a font size of 22.
- repaintCounterRect.size.width = 48;
- repaintCounterRect.size.height = 25;
- if (m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown)
- repaintCounterRect.origin.y = layerBounds.size.height - (layerBounds.origin.y + repaintCounterRect.size.height);
- WKCACFLayer::setNeedsDisplay(&repaintCounterRect);
- }
- if (dirtyRect && m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
- CGRect flippedDirtyRect = *dirtyRect;
- flippedDirtyRect.origin.y = bounds().size.height - (flippedDirtyRect.origin.y + flippedDirtyRect.size.height);
- WKCACFLayer::setNeedsDisplay(&flippedDirtyRect);
- return;
- }
- }
- WKCACFLayer::setNeedsDisplay(dirtyRect);
- }
-
- virtual void drawInContext(PlatformGraphicsContext* context)
- {
- if (!m_owner)
- return;
-
- CGContextSaveGState(context);
-
- CGRect layerBounds = bounds();
- if (m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
- CGContextScaleCTM(context, 1, -1);
- CGContextTranslateCTM(context, 0, -layerBounds.size.height);
- }
-
- if (m_owner->client()) {
- GraphicsContext graphicsContext(context);
-
- // It's important to get the clip from the context, because it may be significantly
- // smaller than the layer bounds (e.g. tiled layers)
- CGRect clipBounds = CGContextGetClipBoundingBox(context);
- IntRect clip(enclosingIntRect(clipBounds));
- m_owner->paintGraphicsLayerContents(graphicsContext, clip);
- }
-#ifndef NDEBUG
- else {
- ASSERT_NOT_REACHED();
-
- // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is a plain color,
- // so CA never makes backing store for it (which is what -setNeedsDisplay will do above).
- CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f);
- CGContextFillRect(context, layerBounds);
- }
-#endif
-
- if (m_owner->showRepaintCounter()) {
- String text = String::format("%d", m_owner->incrementRepaintCount());;
-
- CGContextSaveGState(context);
- CGContextSetRGBFillColor(context, 1.0f, 0.0f, 0.0f, 0.8f);
-
- CGRect aBounds = layerBounds;
-
- aBounds.size.width = 10 + 12 * text.length();
- aBounds.size.height = 25;
- CGContextFillRect(context, aBounds);
-
- FontDescription desc;
-
- NONCLIENTMETRICS metrics;
- metrics.cbSize = sizeof(metrics);
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
- FontFamily family;
- family.setFamily(metrics.lfSmCaptionFont.lfFaceName);
- desc.setFamily(family);
-
- desc.setComputedSize(22);
-
- Font font = Font(desc, 0, 0);
- font.update(0);
-
- GraphicsContext cg(context);
- cg.setFillColor(Color::black, DeviceColorSpace);
- cg.drawText(font, TextRun(text), IntPoint(aBounds.origin.x + 3, aBounds.origin.y + 20));
-
- CGContextRestoreGState(context);
- }
-
- CGContextRestoreGState(context);
- }
-
-protected:
- WebLayer(LayerType layerType, GraphicsLayerCACF* owner)
- : WKCACFLayer(layerType)
- , m_owner(owner)
- {
- }
+// The threshold width or height above which a tiled layer will be used. This should be
+// large enough to avoid tiled layers for most GraphicsLayers, but less than the D3D
+// texture size limit on all supported hardware.
+static const int cMaxPixelDimension = 2000;
-private:
- GraphicsLayer* m_owner;
-};
+// The width and height of a single tile in a tiled layer. Should be large enough to
+// avoid lots of small tiles (and therefore lots of drawing callbacks), but small enough
+// to keep the overall tile cost low.
+static const int cTiledLayerTileSize = 512;
static inline void copyTransform(CATransform3D& toT3D, const TransformationMatrix& t)
{
@@ -537,6 +438,64 @@ void GraphicsLayerCACF::setDebugBorder(const Color& color, float borderWidth)
}
}
+bool GraphicsLayerCACF::requiresTiledLayer(const FloatSize& size) const
+{
+ if (!m_drawsContent)
+ return false;
+
+ // FIXME: catch zero-size height or width here (or earlier)?
+ return size.width() > cMaxPixelDimension || size.height() > cMaxPixelDimension;
+}
+
+void GraphicsLayerCACF::swapFromOrToTiledLayer(bool useTiledLayer)
+{
+ if (useTiledLayer == m_usingTiledLayer)
+ return;
+
+ CGSize tileSize = CGSizeMake(cTiledLayerTileSize, cTiledLayerTileSize);
+
+ RefPtr<WKCACFLayer> oldLayer = m_layer;
+ if (useTiledLayer)
+ m_layer = WebTiledLayer::create(tileSize, this);
+ else
+ m_layer = WebLayer::create(WKCACFLayer::Layer, this);
+
+ m_usingTiledLayer = useTiledLayer;
+
+ if (useTiledLayer) {
+ if (GraphicsLayer::compositingCoordinatesOrientation() == GraphicsLayer::CompositingCoordinatesBottomUp)
+ m_layer->setContentsGravity(WKCACFLayer::BottomLeft);
+ else
+ m_layer->setContentsGravity(WKCACFLayer::TopLeft);
+ }
+
+ m_layer->adoptSublayers(oldLayer.get());
+ if (oldLayer->superlayer())
+ oldLayer->superlayer()->replaceSublayer(oldLayer.get(), m_layer.get());
+
+ updateLayerPosition();
+ updateLayerSize();
+ updateAnchorPoint();
+ updateTransform();
+ updateChildrenTransform();
+ updateMasksToBounds();
+ updateContentsOpaque();
+ updateBackfaceVisibility();
+ updateLayerBackgroundColor();
+
+ updateOpacityOnLayer();
+
+#ifndef NDEBUG
+ String name = String::format("CALayer(%p) GraphicsLayer(%p) %s", m_layer.get(), this, m_usingTiledLayer ? "[Tiled Layer] " : "") + m_name;
+ m_layer->setName(name);
+#endif
+
+ // need to tell new layer to draw itself
+ setNeedsDisplay();
+
+ updateDebugIndicators();
+}
+
GraphicsLayer::CompositingCoordinatesOrientation GraphicsLayerCACF::defaultContentsOrientation() const
{
return CompositingCoordinatesTopDown;
@@ -600,6 +559,10 @@ void GraphicsLayerCACF::updateLayerSize()
m_layer->setPosition(centerPoint);
}
+ bool needTiledLayer = requiresTiledLayer(m_size);
+ if (needTiledLayer != m_usingTiledLayer)
+ swapFromOrToTiledLayer(needTiledLayer);
+
m_layer->setBounds(rect);
// Note that we don't resize m_contentsLayer. It's up the caller to do that.
@@ -699,6 +662,10 @@ void GraphicsLayerCACF::updateLayerPreserves3D()
void GraphicsLayerCACF::updateLayerDrawsContent()
{
+ bool needTiledLayer = requiresTiledLayer(m_size);
+ if (needTiledLayer != m_usingTiledLayer)
+ swapFromOrToTiledLayer(needTiledLayer);
+
if (m_drawsContent)
m_layer->setNeedsDisplay();
else
diff --git a/WebCore/platform/graphics/win/GraphicsLayerCACF.h b/WebCore/platform/graphics/win/GraphicsLayerCACF.h
index 8c3f848..171cdbf 100644
--- a/WebCore/platform/graphics/win/GraphicsLayerCACF.h
+++ b/WebCore/platform/graphics/win/GraphicsLayerCACF.h
@@ -98,6 +98,9 @@ private:
WKCACFLayer* hostLayerForSublayers() const;
WKCACFLayer* layerForSuperlayer() const;
+ bool requiresTiledLayer(const FloatSize&) const;
+ void swapFromOrToTiledLayer(bool useTiledLayer);
+
CompositingCoordinatesOrientation defaultContentsOrientation() const;
void updateSublayerList();
void updateLayerPosition();
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
index 87625d3..e1d457f 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
@@ -45,6 +45,7 @@
#include "StringHash.h"
#include "TimeRanges.h"
#include "Timer.h"
+#include <CoreGraphics/CGContext.h>
#include <Wininet.h>
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
@@ -64,6 +65,8 @@ const CFStringRef kMinCoreVideoVersion = CFSTR("1.0.0.2");
namespace WebCore {
+static CGImageRef CreateCGImageFromPixelBuffer(QTPixelBuffer buffer);
+
SOFT_LINK_LIBRARY(Wininet)
SOFT_LINK(Wininet, InternetSetCookieExW, DWORD, WINAPI, (LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData, DWORD dwFlags, DWORD_PTR dwReserved), (lpszUrl, lpszCookieName, lpszCookieData, dwFlags, dwReserved))
@@ -141,12 +144,13 @@ MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualConte
MediaPlayerPrivateQuickTimeVisualContext::~MediaPlayerPrivateQuickTimeVisualContext()
{
tearDownVideoRendering();
+ m_visualContext->setMovie(0);
cancelCallOnMainThread(&VisualContextClient::retrieveCurrentImageProc, this);
}
bool MediaPlayerPrivateQuickTimeVisualContext::supportsFullscreen() const
{
- return true;
+ return false;
}
PlatformMedia MediaPlayerPrivateQuickTimeVisualContext::platformMedia() const
@@ -284,6 +288,7 @@ void MediaPlayerPrivateQuickTimeVisualContext::load(const String& url)
CFDictionaryRef options = QTMovieVisualContext::getCGImageOptions();
m_visualContext = adoptRef(new QTMovieVisualContext(m_visualContextClient.get(), options));
+ m_visualContext->setMovie(m_movie.get());
}
void MediaPlayerPrivateQuickTimeVisualContext::play()
@@ -629,7 +634,20 @@ void MediaPlayerPrivateQuickTimeVisualContext::paint(GraphicsContext* p, const I
if (m_qtVideoLayer)
return;
#endif
+ QTPixelBuffer buffer = m_visualContext->imageForTime(0);
+ if (buffer.pixelBufferRef()) {
+ CGImageRef image = CreateCGImageFromPixelBuffer(buffer);
+
+ CGContextRef context = p->platformContext();
+ CGContextSaveGState(context);
+ CGContextTranslateCTM(context, r.x(), r.y());
+ CGContextTranslateCTM(context, 0, r.height());
+ CGContextScaleCTM(context, 1, -1);
+ CGContextDrawImage(context, CGRectMake(0, 0, r.width(), r.height()), image);
+ CGContextRestoreGState(context);
+ CGImageRelease(image);
+ }
paintCompleted(*p, r);
}
@@ -654,16 +672,17 @@ void MediaPlayerPrivateQuickTimeVisualContext::VisualContextClient::imageAvailab
void MediaPlayerPrivateQuickTimeVisualContext::visualContextTimerFired(Timer<MediaPlayerPrivateQuickTimeVisualContext>*)
{
- retrieveCurrentImage();
+ if (m_visualContext && m_visualContext->isImageAvailableForTime(0))
+ retrieveCurrentImage();
}
static CFDictionaryRef QTCFDictionaryCreateWithDataCallback(CFAllocatorRef allocator, const UInt8* bytes, CFIndex length)
{
- CFDataRef data = CFDataCreateWithBytesNoCopy(allocator, bytes, length, 0);
+ RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(allocator, bytes, length, kCFAllocatorNull));
if (!data)
return 0;
- return reinterpret_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(allocator, data, kCFPropertyListImmutable, 0));
+ return reinterpret_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(allocator, data.get(), kCFPropertyListImmutable, 0));
}
static CGImageRef CreateCGImageFromPixelBuffer(QTPixelBuffer buffer)
@@ -729,38 +748,29 @@ void MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage()
return;
#if USE(ACCELERATED_COMPOSITING)
- if (!m_qtVideoLayer)
- return;
+ if (m_qtVideoLayer) {
- QTPixelBuffer buffer = m_visualContext->imageForTime(0);
- if (!buffer.pixelBufferRef())
- return;
+ QTPixelBuffer buffer = m_visualContext->imageForTime(0);
+ if (!buffer.pixelBufferRef())
+ return;
- WKCACFLayer* layer = static_cast<WKCACFLayer*>(m_qtVideoLayer->platformLayer());
+ WKCACFLayer* layer = static_cast<WKCACFLayer*>(m_qtVideoLayer->platformLayer());
- if (!buffer.lockBaseAddress()) {
-#ifndef NDEBUG
- // Debug QuickTime links against a non-Debug version of CoreFoundation, so the CFDictionary attached to the CVPixelBuffer cannot be directly passed on into the CAImageQueue without being converted to a non-Debug CFDictionary:
- CFDictionaryRef attachments = QTCFDictionaryCreateCopyWithDataCallback(kCFAllocatorDefault, buffer.attachments(), &QTCFDictionaryCreateWithDataCallback);
-#else
- // However, this is unnecssesary in the non-Debug case:
- CFDictionaryRef attachments = static_cast<CFDictionaryRef>(CFRetain(buffer.attachments()));
-#endif
+ if (!buffer.lockBaseAddress()) {
+ CFTimeInterval imageTime = QTMovieVisualContext::currentHostTime();
- CFTimeInterval imageTime = QTMovieVisualContext::currentHostTime();
+ CGImageRef image = CreateCGImageFromPixelBuffer(buffer);
+ layer->setContents(image);
+ CGImageRelease(image);
- CGImageRef image = CreateCGImageFromPixelBuffer(buffer);
- layer->setContents(image);
- CGImageRelease(image);
-
- if (attachments)
- CFRelease(attachments);
+ buffer.unlockBaseAddress();
+ layer->rootLayer()->setNeedsRender();
+ }
+ } else
+#endif
+ m_player->repaint();
- buffer.unlockBaseAddress();
- layer->rootLayer()->setNeedsRender();
- }
m_visualContext->task();
-#endif
}
static HashSet<String> mimeTypeCache()
@@ -886,8 +896,6 @@ void MediaPlayerPrivateQuickTimeVisualContext::setUpVideoRendering()
if (currentMode == MediaRenderingMovieLayer || preferredMode == MediaRenderingMovieLayer)
m_player->mediaPlayerClient()->mediaPlayerRenderingModeChanged(m_player);
#endif
-
- m_visualContext->setMovie(m_movie.get());
}
void MediaPlayerPrivateQuickTimeVisualContext::tearDownVideoRendering()
@@ -896,8 +904,6 @@ void MediaPlayerPrivateQuickTimeVisualContext::tearDownVideoRendering()
if (m_qtVideoLayer)
destroyLayerForMovie();
#endif
-
- m_visualContext->setMovie(0);
}
bool MediaPlayerPrivateQuickTimeVisualContext::hasSetUpVideoRendering() const
diff --git a/WebCore/platform/graphics/win/QTMovieVisualContext.h b/WebCore/platform/graphics/win/QTMovieVisualContext.h
index 7afe589..8846416 100644
--- a/WebCore/platform/graphics/win/QTMovieVisualContext.h
+++ b/WebCore/platform/graphics/win/QTMovieVisualContext.h
@@ -38,6 +38,7 @@
#include <WTF/OwnPtr.h>
#include <WTF/RefCounted.h>
+typedef const struct __CFDictionary* CFDictionaryRef;
typedef struct OpaqueQTVisualContext* QTVisualContextRef;
// QTCVTimeStamp is a struct containing only a CVTimeStamp. This is to
diff --git a/WebCore/platform/graphics/win/QTPixelBuffer.cpp b/WebCore/platform/graphics/win/QTPixelBuffer.cpp
index 657b68e..f874287 100644
--- a/WebCore/platform/graphics/win/QTPixelBuffer.cpp
+++ b/WebCore/platform/graphics/win/QTPixelBuffer.cpp
@@ -172,11 +172,6 @@ void QTPixelBuffer::getExtendedPixels(size_t* left, size_t* right, size_t* top,
return CVPixelBufferGetExtendedPixels(m_pixelBuffer, left, right, top, bottom);
}
-CFDictionaryRef QTPixelBuffer::attachments() const
-{
- return CVBufferGetAttachments(m_pixelBuffer, kCVAttachmentMode_ShouldPropagate);
-}
-
void QTPixelBuffer::retainCallback(void* refcon)
{
CVPixelBufferRetain(static_cast<CVPixelBufferRef>(refcon));
diff --git a/WebCore/platform/graphics/win/QTPixelBuffer.h b/WebCore/platform/graphics/win/QTPixelBuffer.h
index 22f8ba4..3af2197 100644
--- a/WebCore/platform/graphics/win/QTPixelBuffer.h
+++ b/WebCore/platform/graphics/win/QTPixelBuffer.h
@@ -38,7 +38,6 @@ typedef struct __CVBuffer *CVBufferRef;
typedef CVBufferRef CVPixelBufferRef;
typedef struct CGImage* CGImageRef;
typedef int32_t CVReturn;
-typedef const struct __CFDictionary * CFDictionaryRef;
// QTPixelBuffer wraps QuickTime's implementation of CVPixelBuffer, so its functions are
// safe to call within WebKit.
@@ -75,7 +74,6 @@ public:
size_t bytesPerRowOfPlane(size_t) const;
void getExtendedPixels(size_t* left, size_t* right, size_t* top, size_t* bottom) const;
- CFDictionaryRef attachments() const;
// Generic CFRetain/CFRelease callbacks
static void releaseCallback(void* refcon);
diff --git a/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp b/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp
index e97b530..1685a30 100644
--- a/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp
+++ b/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp
@@ -52,8 +52,8 @@ void WKCACFContextFlusher::addContext(CACFContextRef context)
{
ASSERT(context);
- m_contexts.add(context);
- CFRetain(context);
+ if (m_contexts.add(context).second)
+ CFRetain(context);
}
void WKCACFContextFlusher::removeContext(CACFContextRef context)
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp
index 4a0461d..3f332d8 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp
@@ -200,12 +200,12 @@ bool WKCACFLayer::isTransformLayer() const
void WKCACFLayer::addSublayer(PassRefPtr<WKCACFLayer> sublayer)
{
- insertSublayer(sublayer, numSublayers());
+ insertSublayer(sublayer, sublayerCount());
}
-void WKCACFLayer::insertSublayer(PassRefPtr<WKCACFLayer> sublayer, size_t index)
+void WKCACFLayer::internalInsertSublayer(PassRefPtr<WKCACFLayer> sublayer, size_t index)
{
- index = min(index, numSublayers());
+ index = min(index, sublayerCount());
sublayer->removeFromSuperlayer();
CACFLayerInsertSublayer(layer(), sublayer->layer(), index);
setNeedsCommit();
@@ -218,7 +218,7 @@ void WKCACFLayer::insertSublayerAboveLayer(PassRefPtr<WKCACFLayer> sublayer, con
return;
}
- int referenceIndex = indexOfSublayer(reference);
+ int referenceIndex = internalIndexOfSublayer(reference);
if (referenceIndex == -1) {
addSublayer(sublayer);
return;
@@ -234,7 +234,7 @@ void WKCACFLayer::insertSublayerBelowLayer(PassRefPtr<WKCACFLayer> sublayer, con
return;
}
- int referenceIndex = indexOfSublayer(reference);
+ int referenceIndex = internalIndexOfSublayer(reference);
if (referenceIndex == -1) {
addSublayer(sublayer);
return;
@@ -251,7 +251,7 @@ void WKCACFLayer::replaceSublayer(WKCACFLayer* reference, PassRefPtr<WKCACFLayer
if (reference == newLayer)
return;
- int referenceIndex = indexOfSublayer(reference);
+ int referenceIndex = internalIndexOfSublayer(reference);
ASSERT(referenceIndex != -1);
if (referenceIndex == -1)
return;
@@ -264,6 +264,25 @@ void WKCACFLayer::replaceSublayer(WKCACFLayer* reference, PassRefPtr<WKCACFLayer
}
}
+size_t WKCACFLayer::internalSublayerCount() const
+{
+ CFArrayRef sublayers = CACFLayerGetSublayers(layer());
+ return sublayers ? CFArrayGetCount(sublayers) : 0;
+}
+
+void WKCACFLayer::adoptSublayers(WKCACFLayer* source)
+{
+ // We will use setSublayers() because it properly nulls
+ // out the superlayer pointer.
+ Vector<RefPtr<WKCACFLayer> > sublayers;
+ size_t n = source->sublayerCount();
+
+ for (size_t i = 0; i < n; ++i)
+ sublayers.append(source->internalSublayerAtIndex(i));
+
+ setSublayers(sublayers);
+}
+
void WKCACFLayer::removeFromSuperlayer()
{
WKCACFLayer* superlayer = this->superlayer();
@@ -274,22 +293,25 @@ void WKCACFLayer::removeFromSuperlayer()
superlayer->setNeedsCommit();
}
-const WKCACFLayer* WKCACFLayer::sublayerAtIndex(int index) const
+WKCACFLayer* WKCACFLayer::internalSublayerAtIndex(int index) const
{
CFArrayRef sublayers = CACFLayerGetSublayers(layer());
- if (index < 0 || CFArrayGetCount(sublayers) <= index)
+ if (!sublayers || index < 0 || CFArrayGetCount(sublayers) <= index)
return 0;
return layer(static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(sublayers, index))));
}
-int WKCACFLayer::indexOfSublayer(const WKCACFLayer* reference)
+int WKCACFLayer::internalIndexOfSublayer(const WKCACFLayer* reference)
{
CACFLayerRef ref = reference->layer();
if (!ref)
return -1;
CFArrayRef sublayers = CACFLayerGetSublayers(layer());
+ if (!sublayers)
+ return -1;
+
size_t n = CFArrayGetCount(sublayers);
for (size_t i = 0; i < n; ++i)
@@ -321,19 +343,6 @@ void WKCACFLayer::setBounds(const CGRect& rect)
setNeedsDisplay();
}
-void WKCACFLayer::setFrame(const CGRect& rect)
-{
- CGRect oldFrame = frame();
- if (CGRectEqualToRect(rect, oldFrame))
- return;
-
- CACFLayerSetFrame(layer(), rect);
- setNeedsCommit();
-
- if (m_needsDisplayOnBoundsChange)
- setNeedsDisplay();
-}
-
void WKCACFLayer::setContentsGravity(ContentsGravityType type)
{
CACFLayerSetContentsGravity(layer(), toCACFContentsGravityType(type));
@@ -374,13 +383,13 @@ WKCACFLayer* WKCACFLayer::rootLayer() const
return layer;
}
-void WKCACFLayer::removeAllSublayers()
+void WKCACFLayer::internalRemoveAllSublayers()
{
CACFLayerSetSublayers(layer(), 0);
setNeedsCommit();
}
-void WKCACFLayer::setSublayers(const Vector<RefPtr<WKCACFLayer> >& sublayers)
+void WKCACFLayer::internalSetSublayers(const Vector<RefPtr<WKCACFLayer> >& sublayers)
{
// Remove all the current sublayers and add the passed layers
CACFLayerSetSublayers(layer(), 0);
@@ -404,15 +413,9 @@ WKCACFLayer* WKCACFLayer::superlayer() const
return WKCACFLayer::layer(super);
}
-void WKCACFLayer::setNeedsDisplay(const CGRect* dirtyRect)
+void WKCACFLayer::internalSetNeedsDisplay(const CGRect* dirtyRect)
{
CACFLayerSetNeedsDisplay(layer(), dirtyRect);
- setNeedsCommit();
-}
-
-void WKCACFLayer::setNeedsDisplay()
-{
- setNeedsDisplay(0);
}
#ifndef NDEBUG
@@ -502,12 +505,12 @@ void WKCACFLayer::printLayer(int indent) const
}
// Print sublayers if needed
- int n = numSublayers();
+ int n = sublayerCount();
if (n > 0) {
printIndent(indent + 1);
fprintf(stderr, "(sublayers\n");
for (int i = 0; i < n; ++i)
- sublayerAtIndex(i)->printLayer(indent + 2);
+ internalSublayerAtIndex(i)->printLayer(indent + 2);
printIndent(indent + 1);
fprintf(stderr, ")\n");
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.h b/WebCore/platform/graphics/win/WKCACFLayer.h
index f1b2613..bdc427e 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.h
+++ b/WebCore/platform/graphics/win/WKCACFLayer.h
@@ -60,9 +60,14 @@ public:
virtual ~WKCACFLayer();
virtual void setNeedsRender() { }
+
virtual void drawInContext(PlatformGraphicsContext*) { }
- virtual void setNeedsDisplay(const CGRect* dirtyRect);
- void setNeedsDisplay();
+
+ void setNeedsDisplay(const CGRect* dirtyRect = 0)
+ {
+ internalSetNeedsDisplay(dirtyRect);
+ setNeedsCommit();
+ }
// Makes this layer the root when the passed context is rendered
void becomeRootLayerForContext(CACFContextRef);
@@ -113,10 +118,18 @@ public:
bool isTransformLayer() const;
void addSublayer(PassRefPtr<WKCACFLayer> sublayer);
- void insertSublayer(PassRefPtr<WKCACFLayer>, size_t index);
void insertSublayerAboveLayer(PassRefPtr<WKCACFLayer>, const WKCACFLayer* reference);
void insertSublayerBelowLayer(PassRefPtr<WKCACFLayer>, const WKCACFLayer* reference);
void replaceSublayer(WKCACFLayer* reference, PassRefPtr<WKCACFLayer>);
+ void adoptSublayers(WKCACFLayer* source);
+
+ void removeAllSublayers() { internalRemoveAllSublayers(); }
+ void setSublayers(const Vector<RefPtr<WKCACFLayer> >& sublayers) { internalSetSublayers(sublayers); }
+
+ void insertSublayer(PassRefPtr<WKCACFLayer> layer, size_t index) { internalInsertSublayer(layer, index); }
+
+ size_t sublayerCount() const { return internalSublayerCount(); }
+
void removeFromSuperlayer();
WKCACFLayer* ancestorOrSelfWithSuperlayer(WKCACFLayer*) const;
@@ -136,7 +149,7 @@ public:
void setBorderWidth(CGFloat width) { CACFLayerSetBorderWidth(layer(), width); setNeedsCommit(); }
CGFloat borderWidth() const { return CACFLayerGetBorderWidth(layer()); }
- void setBounds(const CGRect&);
+ virtual void setBounds(const CGRect&);
CGRect bounds() const { return CACFLayerGetBounds(layer()); }
void setClearsContext(bool clears) { CACFLayerSetClearsContext(layer(), clears); setNeedsCommit(); }
@@ -160,9 +173,6 @@ public:
void setFilters(CFArrayRef filters) { CACFLayerSetFilters(layer(), filters); setNeedsCommit(); }
CFArrayRef filters() const { return CACFLayerGetFilters(layer()); }
- void setFrame(const CGRect&);
- CGRect frame() const { return CACFLayerGetFrame(layer()); }
-
void setHidden(bool hidden) { CACFLayerSetHidden(layer(), hidden); setNeedsCommit(); }
bool isHidden() const { return CACFLayerIsHidden(layer()); }
@@ -206,10 +216,6 @@ public:
void setSortsSublayers(bool sorts) { CACFLayerSetSortsSublayers(layer(), sorts); setNeedsCommit(); }
bool sortsSublayers() const { return CACFLayerGetSortsSublayers(layer()); }
- void removeAllSublayers();
-
- void setSublayers(const Vector<RefPtr<WKCACFLayer> >&);
-
void setSublayerTransform(const CATransform3D& transform) { CACFLayerSetSublayerTransform(layer(), transform); setNeedsCommit(); }
CATransform3D sublayerTransform() const { return CACFLayerGetSublayerTransform(layer()); }
@@ -231,28 +237,30 @@ protected:
void setNeedsCommit();
-private:
CACFLayerRef layer() const { return m_layer.get(); }
- size_t numSublayers() const
- {
- CFArrayRef sublayers = CACFLayerGetSublayers(layer());
- return sublayers ? CFArrayGetCount(sublayers) : 0;
- }
+ // This should only be called from removeFromSuperlayer.
+ void removeSublayer(const WKCACFLayer*);
+
+ // Methods to be overridden for sublayer and rendering management
+ virtual WKCACFLayer* internalSublayerAtIndex(int) const;
- const WKCACFLayer* sublayerAtIndex(int) const;
-
// Returns the index of the passed layer in this layer's sublayers list
// or -1 if not found
- int indexOfSublayer(const WKCACFLayer*);
+ virtual int internalIndexOfSublayer(const WKCACFLayer*);
- // This should only be called from removeFromSuperlayer.
- void removeSublayer(const WKCACFLayer*);
+ virtual size_t internalSublayerCount() const;
+ virtual void internalInsertSublayer(PassRefPtr<WKCACFLayer>, size_t index);
+ virtual void internalRemoveAllSublayers();
+ virtual void internalSetSublayers(const Vector<RefPtr<WKCACFLayer> >&);
+
+ virtual void internalSetNeedsDisplay(const CGRect* dirtyRect);
#ifndef NDEBUG
// Print this layer and its children to the console
void printLayer(int indent) const;
#endif
+private:
RetainPtr<CACFLayerRef> m_layer;
bool m_needsDisplayOnBoundsChange;
};
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
index 994d079..0ee61f3 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
@@ -198,7 +198,7 @@ bool WKCACFLayerRenderer::acceleratedCompositingAvailable()
return available;
}
- OwnPtr<WKCACFLayerRenderer> testLayerRenderer = WKCACFLayerRenderer::create();
+ OwnPtr<WKCACFLayerRenderer> testLayerRenderer = WKCACFLayerRenderer::create(0);
testLayerRenderer->setHostWindow(testWindow);
available = testLayerRenderer->createRenderer();
::DestroyWindow(testWindow);
@@ -215,16 +215,21 @@ void WKCACFLayerRenderer::didFlushContext(CACFContextRef context)
window->renderSoon();
}
-PassOwnPtr<WKCACFLayerRenderer> WKCACFLayerRenderer::create()
+PassOwnPtr<WKCACFLayerRenderer> WKCACFLayerRenderer::create(WKCACFLayerRendererClient* client)
{
if (!acceleratedCompositingAvailable())
return 0;
- return new WKCACFLayerRenderer;
+ return new WKCACFLayerRenderer(client);
}
-WKCACFLayerRenderer::WKCACFLayerRenderer()
- : m_triedToCreateD3DRenderer(false)
- , m_renderContext(0)
+WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client)
+ : m_client(client)
+ , m_mightBeAbleToCreateDeviceLater(true)
+ , m_rootLayer(WKCACFRootLayer::create(this))
+ , m_scrollLayer(WKCACFLayer::create(WKCACFLayer::Layer))
+ , m_clipLayer(WKCACFLayer::create(WKCACFLayer::Layer))
+ , m_context(AdoptCF, CACFContextCreate(0))
+ , m_renderContext(static_cast<CARenderContext*>(CACFContextGetRenderContext(m_context.get())))
, m_renderer(0)
, m_hostWindow(0)
, m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired)
@@ -233,6 +238,37 @@ WKCACFLayerRenderer::WKCACFLayerRenderer()
, m_backingStoreDirty(false)
, m_mustResetLostDeviceBeforeRendering(false)
{
+ windowsForContexts().set(m_context.get(), this);
+
+ // Under the root layer, we have a clipping layer to clip the content,
+ // that contains a scroll layer that we use for scrolling the content.
+ // The root layer is the size of the client area of the window.
+ // The clipping layer is the size of the WebView client area (window less the scrollbars).
+ // The scroll layer is the size of the root child layer.
+ // Resizing the window will change the bounds of the rootLayer and the clip layer and will not
+ // cause any repositioning.
+ // Scrolling will affect only the position of the scroll layer without affecting the bounds.
+
+ m_rootLayer->setName("WKCACFLayerRenderer rootLayer");
+ m_clipLayer->setName("WKCACFLayerRenderer clipLayer");
+ m_scrollLayer->setName("WKCACFLayerRenderer scrollLayer");
+
+ m_rootLayer->addSublayer(m_clipLayer);
+ m_clipLayer->addSublayer(m_scrollLayer);
+ m_clipLayer->setMasksToBounds(true);
+ m_rootLayer->setAnchorPoint(CGPointMake(0, 0));
+ m_scrollLayer->setAnchorPoint(CGPointMake(0, 1));
+ m_clipLayer->setAnchorPoint(CGPointMake(0, 1));
+
+#ifndef NDEBUG
+ CGColorRef debugColor = createCGColor(Color(255, 0, 0, 204));
+ m_rootLayer->setBackgroundColor(debugColor);
+ CGColorRelease(debugColor);
+#endif
+
+ if (m_context)
+ m_rootLayer->becomeRootLayerForContext(m_context.get());
+
#ifndef NDEBUG
char* printTreeFlag = getenv("CA_PRINT_TREE");
m_printTree = printTreeFlag && atoi(printTreeFlag);
@@ -306,10 +342,10 @@ void WKCACFLayerRenderer::setNeedsDisplay()
bool WKCACFLayerRenderer::createRenderer()
{
- if (m_triedToCreateD3DRenderer)
+ if (m_d3dDevice || !m_mightBeAbleToCreateDeviceLater)
return m_d3dDevice;
- m_triedToCreateD3DRenderer = true;
+ m_mightBeAbleToCreateDeviceLater = false;
D3DPRESENT_PARAMETERS parameters = initialPresentationParameters();
if (!d3d() || !::IsWindow(m_hostWindow))
@@ -326,9 +362,31 @@ bool WKCACFLayerRenderer::createRenderer()
parameters.BackBufferHeight = 1;
}
+ D3DCAPS9 d3dCaps;
+ if (FAILED(d3d()->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps)))
+ return false;
+
+ DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE;
+ if ((d3dCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) && d3dCaps.VertexProcessingCaps)
+ behaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
+ else
+ behaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
+
COMPtr<IDirect3DDevice9> device;
- if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hostWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &parameters, &device)))
+ if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hostWindow, behaviorFlags, &parameters, &device))) {
+ // In certain situations (e.g., shortly after waking from sleep), Direct3DCreate9() will
+ // return an IDirect3D9 for which IDirect3D9::CreateDevice will always fail. In case we
+ // have one of these bad IDirect3D9s, get rid of it so we'll fetch a new one the next time
+ // we want to call CreateDevice.
+ s_d3d->Release();
+ s_d3d = 0;
+
+ // Even if we don't have a bad IDirect3D9, in certain situations (e.g., shortly after
+ // waking from sleep), CreateDevice will fail, but will later succeed if called again.
+ m_mightBeAbleToCreateDeviceLater = true;
+
return false;
+ }
// Now that we've created the IDirect3DDevice9 based on the capabilities we
// got from the IDirect3D9 global object, we requery the device for its
@@ -349,48 +407,10 @@ bool WKCACFLayerRenderer::createRenderer()
m_d3dDevice->SetTransform(D3DTS_PROJECTION, &projection);
- m_context.adoptCF(CACFContextCreate(0));
- windowsForContexts().set(m_context.get(), this);
-
- m_renderContext = static_cast<CARenderContext*>(CACFContextGetRenderContext(m_context.get()));
m_renderer = CARenderOGLNew(&kCARenderDX9Callbacks, m_d3dDevice.get(), 0);
- // Create the root hierarchy.
- // Under the root layer, we have a clipping layer to clip the content,
- // that contains a scroll layer that we use for scrolling the content.
- // The root layer is the size of the client area of the window.
- // The clipping layer is the size of the WebView client area (window less the scrollbars).
- // The scroll layer is the size of the root child layer.
- // Resizing the window will change the bounds of the rootLayer and the clip layer and will not
- // cause any repositioning.
- // Scrolling will affect only the position of the scroll layer without affecting the bounds.
-
- m_rootLayer = WKCACFRootLayer::create(this);
- m_rootLayer->setName("WKCACFLayerRenderer rootLayer");
-
- m_clipLayer = WKCACFLayer::create(WKCACFLayer::Layer);
- m_clipLayer->setName("WKCACFLayerRenderer clipLayer");
-
- m_scrollLayer = WKCACFLayer::create(WKCACFLayer::Layer);
- m_scrollLayer->setName("WKCACFLayerRenderer scrollLayer");
-
- m_rootLayer->addSublayer(m_clipLayer);
- m_clipLayer->addSublayer(m_scrollLayer);
- m_clipLayer->setMasksToBounds(true);
- m_scrollLayer->setAnchorPoint(CGPointMake(0, 1));
- m_clipLayer->setAnchorPoint(CGPointMake(0, 1));
-
-#ifndef NDEBUG
- CGColorRef debugColor = createCGColor(Color(255, 0, 0, 204));
- m_rootLayer->setBackgroundColor(debugColor);
- CGColorRelease(debugColor);
-#endif
-
if (IsWindow(m_hostWindow))
- m_rootLayer->setFrame(bounds());
-
- if (m_context)
- m_rootLayer->becomeRootLayerForContext(m_context.get());
+ m_rootLayer->setBounds(bounds());
return true;
}
@@ -398,6 +418,7 @@ bool WKCACFLayerRenderer::createRenderer()
void WKCACFLayerRenderer::destroyRenderer()
{
if (m_context) {
+ CACFContextSetLayer(m_context.get(), 0);
windowsForContexts().remove(m_context.get());
WKCACFContextFlusher::shared().removeContext(m_context.get());
}
@@ -415,7 +436,7 @@ void WKCACFLayerRenderer::destroyRenderer()
m_scrollLayer = 0;
m_rootChildLayer = 0;
- m_triedToCreateD3DRenderer = false;
+ m_mightBeAbleToCreateDeviceLater = true;
}
void WKCACFLayerRenderer::resize()
@@ -428,7 +449,7 @@ void WKCACFLayerRenderer::resize()
resetDevice(ChangedWindowSize);
if (m_rootLayer) {
- m_rootLayer->setFrame(bounds());
+ m_rootLayer->setBounds(bounds());
WKCACFContextFlusher::shared().flushAllContexts();
updateScrollFrame();
}
@@ -442,8 +463,8 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
if (!GetClientRect(window, &clientRect))
return;
- HRGN region = CreateRectRgn(0, 0, 0, 0);
- int regionType = GetUpdateRgn(window, region, false);
+ OwnPtr<HRGN> region(CreateRectRgn(0, 0, 0, 0));
+ int regionType = GetUpdateRgn(window, region.get(), false);
if (regionType != COMPLEXREGION) {
RECT dirtyRect;
if (GetUpdateRect(window, &dirtyRect, false))
@@ -451,10 +472,10 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
return;
}
- DWORD dataSize = GetRegionData(region, 0, 0);
+ DWORD dataSize = GetRegionData(region.get(), 0, 0);
OwnArrayPtr<unsigned char> regionDataBuffer(new unsigned char[dataSize]);
RGNDATA* regionData = reinterpret_cast<RGNDATA*>(regionDataBuffer.get());
- if (!GetRegionData(region, dataSize, regionData))
+ if (!GetRegionData(region.get(), dataSize, regionData))
return;
outRects.resize(regionData->rdh.nCount);
@@ -462,8 +483,6 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
RECT* rect = reinterpret_cast<RECT*>(regionData->Buffer);
for (size_t i = 0; i < outRects.size(); ++i, ++rect)
outRects[i] = winRectToCGRect(*rect, clientRect);
-
- DeleteObject(region);
}
void WKCACFLayerRenderer::renderTimerFired(Timer<WKCACFLayerRenderer>*)
@@ -473,8 +492,12 @@ void WKCACFLayerRenderer::renderTimerFired(Timer<WKCACFLayerRenderer>*)
void WKCACFLayerRenderer::paint()
{
- if (!m_d3dDevice)
+ createRenderer();
+ if (!m_d3dDevice) {
+ if (m_mightBeAbleToCreateDeviceLater)
+ renderSoon();
return;
+ }
if (m_backingStoreDirty) {
// If the backing store is still dirty when we are about to draw the
@@ -500,6 +523,11 @@ void WKCACFLayerRenderer::render(const Vector<CGRect>& dirtyRects)
return;
}
+ if (m_client && !m_client->shouldRender()) {
+ renderSoon();
+ return;
+ }
+
// Flush the root layer to the render tree.
WKCACFContextFlusher::shared().flushAllContexts();
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
index 259c52f..1ff955a 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
@@ -49,12 +49,18 @@ namespace WebCore {
class WKCACFRootLayer;
+class WKCACFLayerRendererClient {
+public:
+ virtual ~WKCACFLayerRendererClient() { }
+ virtual bool shouldRender() const = 0;
+};
+
// FIXME: Currently there is a WKCACFLayerRenderer for each WebView and each
// has its own CARenderOGLContext and Direct3DDevice9, which is inefficient.
// (https://bugs.webkit.org/show_bug.cgi?id=31855)
class WKCACFLayerRenderer : public Noncopyable {
public:
- static PassOwnPtr<WKCACFLayerRenderer> create();
+ static PassOwnPtr<WKCACFLayerRenderer> create(WKCACFLayerRendererClient*);
~WKCACFLayerRenderer();
static bool acceleratedCompositingAvailable();
@@ -77,7 +83,7 @@ protected:
WKCACFLayer* rootLayer() const;
private:
- WKCACFLayerRenderer();
+ WKCACFLayerRenderer(WKCACFLayerRendererClient*);
void renderTimerFired(Timer<WKCACFLayerRenderer>*);
@@ -94,10 +100,10 @@ private:
void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>());
void paint();
- bool m_triedToCreateD3DRenderer;
+ WKCACFLayerRendererClient* m_client;
+ bool m_mightBeAbleToCreateDeviceLater;
COMPtr<IDirect3DDevice9> m_d3dDevice;
RefPtr<WKCACFRootLayer> m_rootLayer;
- RefPtr<WKCACFLayer> m_viewLayer;
RefPtr<WKCACFLayer> m_scrollLayer;
RefPtr<WKCACFLayer> m_rootChildLayer;
RefPtr<WKCACFLayer> m_clipLayer;
diff --git a/WebCore/platform/graphics/win/WebLayer.cpp b/WebCore/platform/graphics/win/WebLayer.cpp
new file mode 100755
index 0000000..70a522d
--- /dev/null
+++ b/WebCore/platform/graphics/win/WebLayer.cpp
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "WebLayer.h"
+
+#include "Font.h"
+#include "GraphicsLayer.h"
+
+namespace WebCore {
+
+using namespace std;
+
+void WebLayer::internalSetNeedsDisplay(const CGRect* dirtyRect)
+{
+ if (m_owner) {
+ if (m_owner->showRepaintCounter()) {
+ CGRect layerBounds = bounds();
+ CGRect repaintCounterRect = layerBounds;
+ // We assume a maximum of 4 digits and a font size of 18.
+ repaintCounterRect.size.width = 80;
+ repaintCounterRect.size.height = 22;
+ if (m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown)
+ repaintCounterRect.origin.y = layerBounds.size.height - (layerBounds.origin.y + repaintCounterRect.size.height);
+ WKCACFLayer::internalSetNeedsDisplay(&repaintCounterRect);
+ }
+ if (dirtyRect && m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
+ CGRect flippedDirtyRect = *dirtyRect;
+ flippedDirtyRect.origin.y = bounds().size.height - (flippedDirtyRect.origin.y + flippedDirtyRect.size.height);
+ WKCACFLayer::internalSetNeedsDisplay(&flippedDirtyRect);
+ return;
+ }
+ }
+
+ WKCACFLayer::internalSetNeedsDisplay(dirtyRect);
+}
+
+void WebLayer::drawInContext(PlatformGraphicsContext* context)
+{
+ if (!m_owner)
+ return;
+
+ CGContextSaveGState(context);
+
+ CGRect layerBounds = bounds();
+ if (m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
+ CGContextScaleCTM(context, 1, -1);
+ CGContextTranslateCTM(context, 0, -layerBounds.size.height);
+ }
+
+ if (m_owner->client()) {
+ GraphicsContext graphicsContext(context);
+
+ // It's important to get the clip from the context, because it may be significantly
+ // smaller than the layer bounds (e.g. tiled layers)
+ CGRect clipBounds = CGContextGetClipBoundingBox(context);
+ IntRect clip(enclosingIntRect(clipBounds));
+ m_owner->paintGraphicsLayerContents(graphicsContext, clip);
+ }
+#ifndef NDEBUG
+ else {
+ ASSERT_NOT_REACHED();
+
+ // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is a plain color,
+ // so CA never makes backing store for it (which is what -setNeedsDisplay will do above).
+ CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f);
+ CGContextFillRect(context, layerBounds);
+ }
+#endif
+
+ if (m_owner->showRepaintCounter()) {
+ String text = String::format("%d", m_owner->incrementRepaintCount());;
+
+ CGContextSaveGState(context);
+
+ // Make the background of the counter the same as the border color,
+ // unless there is no border, then make it red
+ float borderWidth = CACFLayerGetBorderWidth(layer());
+ if (borderWidth > 0) {
+ CGColorRef borderColor = CACFLayerGetBorderColor(layer());
+ const CGFloat* colors = CGColorGetComponents(borderColor);
+ CGContextSetRGBFillColor(context, colors[0], colors[1], colors[2], colors[3]);
+ } else
+ CGContextSetRGBFillColor(context, 1.0f, 0.0f, 0.0f, 0.8f);
+
+ CGRect aBounds = layerBounds;
+
+ aBounds.size.width = 10 + 10 * text.length();
+ aBounds.size.height = 22;
+ CGContextFillRect(context, aBounds);
+
+ FontDescription desc;
+
+ NONCLIENTMETRICS metrics;
+ metrics.cbSize = sizeof(metrics);
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
+ FontFamily family;
+ family.setFamily(metrics.lfSmCaptionFont.lfFaceName);
+ desc.setFamily(family);
+
+ desc.setComputedSize(18);
+
+ Font font = Font(desc, 0, 0);
+ font.update(0);
+
+ GraphicsContext cg(context);
+ cg.setFillColor(Color::black, DeviceColorSpace);
+ cg.drawText(font, TextRun(text), IntPoint(aBounds.origin.x + 5, aBounds.origin.y + 17));
+
+ CGContextRestoreGState(context);
+ }
+
+ CGContextRestoreGState(context);
+}
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/win/WebLayer.h b/WebCore/platform/graphics/win/WebLayer.h
new file mode 100755
index 0000000..8dab5cc
--- /dev/null
+++ b/WebCore/platform/graphics/win/WebLayer.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebLayer_h
+#define WebLayer_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "WKCACFLayer.h"
+
+namespace WebCore {
+
+class GraphicsLayer;
+
+class WebLayer : public WKCACFLayer {
+public:
+ static PassRefPtr<WKCACFLayer> create(LayerType layerType, GraphicsLayer* owner)
+ {
+ return adoptRef(new WebLayer(layerType, owner));
+ }
+
+ virtual void drawInContext(PlatformGraphicsContext*);
+
+protected:
+ WebLayer(LayerType layerType, GraphicsLayer* owner)
+ : WKCACFLayer(layerType)
+ , m_owner(owner)
+ {
+ }
+
+ virtual void internalSetNeedsDisplay(const CGRect* dirtyRect);
+
+ GraphicsLayer* m_owner;
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // WebLayer_h
diff --git a/WebCore/platform/graphics/win/WebTiledLayer.cpp b/WebCore/platform/graphics/win/WebTiledLayer.cpp
new file mode 100755
index 0000000..0cf3f9d
--- /dev/null
+++ b/WebCore/platform/graphics/win/WebTiledLayer.cpp
@@ -0,0 +1,274 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "WebTiledLayer.h"
+
+#include "GraphicsLayer.h"
+#include "WKCACFLayerRenderer.h"
+
+namespace WebCore {
+
+using namespace std;
+
+void WebTiledLayer::tileDisplayCallback(CACFLayerRef layer, CGContextRef context)
+{
+ static_cast<WebTiledLayer*>(CACFLayerGetUserData(layer))->drawTile(layer, context);
+}
+
+PassRefPtr<WebTiledLayer> WebTiledLayer::create(const CGSize& tileSize, GraphicsLayer* owner)
+{
+ ASSERT(WKCACFLayerRenderer::acceleratedCompositingAvailable());
+ return adoptRef(new WebTiledLayer(tileSize, owner));
+}
+
+WebTiledLayer::WebTiledLayer(const CGSize& tileSize, GraphicsLayer* owner)
+ : WebLayer(WKCACFLayer::Layer, owner)
+ , m_tileSize(tileSize)
+ , m_constrainedSize(constrainedSize(bounds().size))
+{
+ // Tiled layers are placed in a child layer that is always the first child of the TiledLayer
+ m_tileParent.adoptCF(CACFLayerCreate(kCACFLayer));
+ CACFLayerInsertSublayer(layer(), m_tileParent.get(), 0);
+
+ updateTiles();
+}
+
+WebTiledLayer::~WebTiledLayer()
+{
+}
+
+void WebTiledLayer::setBounds(const CGRect& rect)
+{
+ if (CGRectEqualToRect(rect, bounds()))
+ return;
+
+ WebLayer::setBounds(rect);
+ m_constrainedSize = constrainedSize(rect.size);
+ updateTiles();
+}
+
+void WebTiledLayer::internalSetNeedsDisplay(const CGRect* dirtyRect)
+{
+ // FIXME: Only setNeedsDisplay for tiles that are currently visible
+ int numTileLayers = tileCount();
+ for (int i = 0; i < numTileLayers; ++i)
+ CACFLayerSetNeedsDisplay(tileAtIndex(i), dirtyRect);
+
+ if (m_owner->showRepaintCounter()) {
+ CGRect layerBounds = bounds();
+ CGRect indicatorRect = CGRectMake(layerBounds.origin.x, layerBounds.origin.y, 80, 25);
+ CACFLayerSetNeedsDisplay(tileAtIndex(0), &indicatorRect);
+ }
+}
+
+size_t WebTiledLayer::internalSublayerCount() const
+{
+ ASSERT(WebLayer::internalSublayerCount() > 0);
+
+ // Subtract 1 to account for the tile parent layer
+ return WebLayer::internalSublayerCount() - 1;
+}
+
+void WebTiledLayer::internalRemoveAllSublayers()
+{
+ // Restore the tile parent after removal
+ WebLayer::internalRemoveAllSublayers();
+ CACFLayerInsertSublayer(layer(), m_tileParent.get(), 0);
+}
+
+void WebTiledLayer::internalSetSublayers(const Vector<RefPtr<WKCACFLayer> >& sublayers)
+{
+ // Preserve the tile parent after set
+ WebLayer::internalSetSublayers(sublayers);
+ CACFLayerInsertSublayer(layer(), m_tileParent.get(), 0);
+}
+
+void WebTiledLayer::internalInsertSublayer(PassRefPtr<WKCACFLayer> layer, size_t index)
+{
+ // Add 1 to account for the tile parent layer
+ WebLayer::internalInsertSublayer(layer, index + 1);
+}
+
+WKCACFLayer* WebTiledLayer::internalSublayerAtIndex(int i) const
+{
+ // Add 1 to account for the tile parent layer
+ return WebLayer::internalSublayerAtIndex(i + 1);
+}
+
+int WebTiledLayer::internalIndexOfSublayer(const WKCACFLayer* layer)
+{
+ int i = WebLayer::internalIndexOfSublayer(layer);
+
+ // Add 1 to account for the tile parent layer (but be safe about it)
+ return (i > 0) ? i - 1 : -1;
+}
+
+CGSize WebTiledLayer::constrainedSize(const CGSize& size) const
+{
+ const int cMaxTileCount = 512;
+ const float cSqrtMaxTileCount = sqrtf(cMaxTileCount);
+
+ CGSize constrainedSize = size;
+
+ int tileColumns = ceilf(constrainedSize.width / m_tileSize.width);
+ int tileRows = ceilf(constrainedSize.height / m_tileSize.height);
+ int numTiles = tileColumns * tileRows;
+
+ // If number of tiles vertically or horizontally is < sqrt(cMaxTileCount)
+ // just shorten the longer dimension. Otherwise shorten both dimensions
+ // according to the ratio of width to height
+
+ if (numTiles > cMaxTileCount) {
+ if (tileRows < cSqrtMaxTileCount)
+ tileColumns = floorf(cMaxTileCount / tileRows);
+ else if (tileColumns < cSqrtMaxTileCount)
+ tileRows = floorf(cMaxTileCount / tileColumns);
+ else {
+ tileRows = ceilf(sqrtf(cMaxTileCount * constrainedSize.height / constrainedSize.width));
+ tileColumns = floorf(cMaxTileCount / tileRows);
+ }
+
+ constrainedSize.width = tileColumns * m_tileSize.width;
+ constrainedSize.height = tileRows * m_tileSize.height;
+ }
+
+ return constrainedSize;
+}
+
+void WebTiledLayer::addTile()
+{
+ RetainPtr<CACFLayerRef> newLayer(AdoptCF, CACFLayerCreate(kCACFLayer));
+ CACFLayerSetAnchorPoint(newLayer.get(), CGPointMake(0, 1));
+ CACFLayerSetUserData(newLayer.get(), this);
+ CACFLayerSetDisplayCallback(newLayer.get(), tileDisplayCallback);
+
+ CFArrayRef sublayers = CACFLayerGetSublayers(m_tileParent.get());
+ CACFLayerInsertSublayer(m_tileParent.get(), newLayer.get(), sublayers ? CFArrayGetCount(sublayers) : 0);
+
+ if (m_owner->showDebugBorders()) {
+ CGColorRef borderColor = createCGColor(Color(128, 0, 128, 180));
+ CACFLayerSetBorderColor(newLayer.get(), borderColor);
+ CGColorRelease(borderColor);
+ CACFLayerSetBorderWidth(newLayer.get(), 2);
+ }
+}
+
+void WebTiledLayer::removeTile()
+{
+ CACFLayerRemoveFromSuperlayer(tileAtIndex(tileCount() - 1));
+}
+
+CACFLayerRef WebTiledLayer::tileAtIndex(int index)
+{
+ CFArrayRef sublayers = CACFLayerGetSublayers(m_tileParent.get());
+ if (!sublayers || index < 0 || index >= tileCount() )
+ return 0;
+
+ return static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(sublayers, index)));
+}
+
+int WebTiledLayer::tileCount() const
+{
+ CFArrayRef sublayers = CACFLayerGetSublayers(m_tileParent.get());
+ return sublayers ? CFArrayGetCount(sublayers) : 0;
+}
+
+void WebTiledLayer::updateTiles()
+{
+ // FIXME: In addition to redoing the number of tiles, we need to only render and have backing
+ // store for visible layers
+ int numTilesHorizontal = ceil(m_constrainedSize.width / m_tileSize.width);
+ int numTilesVertical = ceil(m_constrainedSize.height / m_tileSize.height);
+ int numTilesTotal = numTilesHorizontal * numTilesVertical;
+
+ int numTilesToChange = numTilesTotal - tileCount();
+ if (numTilesToChange >= 0) {
+ // Add new tiles
+ for (int i = 0; i < numTilesToChange; ++i)
+ addTile();
+ } else {
+ // Remove old tiles
+ numTilesToChange = -numTilesToChange;
+ for (int i = 0; i < numTilesToChange; ++i)
+ removeTile();
+ }
+
+ // Set coordinates for all tiles
+ CFArrayRef tileArray = CACFLayerGetSublayers(m_tileParent.get());
+
+ for (int i = 0; i < numTilesHorizontal; ++i) {
+ for (int j = 0; j < numTilesVertical; ++j) {
+ CACFLayerRef tile = static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(tileArray, i * numTilesVertical + j)));
+ CACFLayerSetPosition(tile, CGPointMake(i * m_tileSize.width, j * m_tileSize.height));
+ int width = min(m_tileSize.width, m_constrainedSize.width - i * m_tileSize.width);
+ int height = min(m_tileSize.height, m_constrainedSize.height - j * m_tileSize.height);
+ CACFLayerSetBounds(tile, CGRectMake(i * m_tileSize.width, j * m_tileSize.height, width, height));
+
+ // Flip Y to compensate for the flipping that happens during render to match the CG context coordinate space
+ CATransform3D transform = CATransform3DMakeScale(1, -1, 1);
+ CATransform3DTranslate(transform, 0, height, 0);
+ CACFLayerSetTransform(tile, transform);
+
+#ifndef NDEBUG
+ String name = "Tile (" + String::number(i) + "," + String::number(j) + ")";
+ CACFLayerSetName(tile, RetainPtr<CFStringRef>(AdoptCF, name.createCFString()).get());
+#endif
+ }
+ }
+}
+
+void WebTiledLayer::drawTile(CACFLayerRef tile, CGContextRef context)
+{
+ CGPoint tilePosition = CACFLayerGetPosition(tile);
+ CGRect tileBounds = CACFLayerGetBounds(tile);
+
+ CGContextSaveGState(context);
+
+ // Transform context to be at the origin of the parent layer
+ CGContextTranslateCTM(context, -tilePosition.x, -tilePosition.y);
+
+ // Set the context clipping rectangle to the current tile
+ CGContextClipToRect(context, CGRectMake(tilePosition.x, tilePosition.y, tileBounds.size.width, tileBounds.size.height));
+
+ if (m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
+ // If the layer is rendering top-down, it will flip the coordinates in y. Tiled layers are
+ // already flipping, so we need to undo that here.
+ CGContextTranslateCTM(context, 0, bounds().size.height);
+ CGContextScaleCTM(context, 1, -1);
+ }
+
+ // Draw the tile
+ drawInContext(context);
+
+ CGContextRestoreGState(context);
+}
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/win/WebTiledLayer.h b/WebCore/platform/graphics/win/WebTiledLayer.h
new file mode 100755
index 0000000..ed61656
--- /dev/null
+++ b/WebCore/platform/graphics/win/WebTiledLayer.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebTiledLayer_h
+#define WebTiledLayer_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "WebLayer.h"
+
+namespace WebCore {
+
+class WebTiledLayer : public WebLayer {
+public:
+ static PassRefPtr<WebTiledLayer> create(const CGSize& tileSize, GraphicsLayer* owner);
+
+ virtual ~WebTiledLayer();
+
+ virtual void setBounds(const CGRect&);
+
+protected:
+ WebTiledLayer(const CGSize& tileSize, GraphicsLayer* owner);
+
+ // Overridden from WKCACFLayer
+ virtual WKCACFLayer* internalSublayerAtIndex(int) const;
+ virtual int internalIndexOfSublayer(const WKCACFLayer*);
+
+ virtual size_t internalSublayerCount() const;
+ virtual void internalInsertSublayer(PassRefPtr<WKCACFLayer>, size_t index);
+
+ virtual void internalRemoveAllSublayers();
+ virtual void internalSetSublayers(const Vector<RefPtr<WKCACFLayer> >&);
+
+ virtual void internalSetNeedsDisplay(const CGRect* dirtyRect);
+
+private:
+ static void tileDisplayCallback(CACFLayerRef, CGContextRef);
+ void drawTile(CACFLayerRef, CGContextRef);
+
+ CGSize constrainedSize(const CGSize& size) const;
+
+ void addTile();
+ void removeTile();
+ CACFLayerRef tileAtIndex(int);
+ int tileCount() const;
+
+ void updateTiles();
+
+ CGSize m_tileSize;
+ CGSize m_constrainedSize;
+ RetainPtr<CACFLayerRef> m_tileParent;
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // WebTiledLayer_h
diff --git a/WebCore/platform/graphics/wx/FontCacheWx.cpp b/WebCore/platform/graphics/wx/FontCacheWx.cpp
index 5b02bdb..c594975 100644
--- a/WebCore/platform/graphics/wx/FontCacheWx.cpp
+++ b/WebCore/platform/graphics/wx/FontCacheWx.cpp
@@ -48,13 +48,33 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
if (!fontData->containsCharacters(characters, length))
fontData = getLastResortFallbackFont(font.fontDescription());
- ASSERT(fontData->containsCharacters(characters, length));
+ ASSERT(fontData);
return fontData;
}
SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
- return getCachedFontData(font.fontDescription(), font.family().family());
+ SimpleFontData* simpleFontData = 0;
+#if OS(DARWIN)
+ // Attempt to find an appropriate font using a match based on
+ // the presence of keywords in the the requested names. For example, we'll
+ // match any name that contains "Arabic" to Geeza Pro.
+ const FontFamily* currFamily = &font.fontDescription().family();
+ while (currFamily && !simpleFontData) {
+ if (currFamily->family().length()) {
+ static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") };
+ DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro"));
+ for (int j = 0; j < 3 && !simpleFontData; ++j)
+ if (currFamily->family().contains(*matchWords[j], false))
+ simpleFontData = getCachedFontData(font.fontDescription(), geezaStr);
+ }
+ currFamily = currFamily->next();
+ }
+#endif
+ if (!simpleFontData)
+ simpleFontData = getCachedFontData(font.fontDescription(), font.family().family());
+
+ return simpleFontData;
}
SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
@@ -62,12 +82,13 @@ SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& font
// FIXME: Would be even better to somehow get the user's default font here. For now we'll pick
// the default that the user would get without changing any prefs.
SimpleFontData* fallback = 0;
-#if OS(WINDOWS) || (OS(DARWIN) && !defined(BUILDING_ON_TIGER))
+#if OS(WINDOWS)
static AtomicString fallbackName("Arial Unicode MS");
#else
static AtomicString fallbackName("Times New Roman");
#endif
fallback = getCachedFontData(fontDescription, fallbackName);
+ ASSERT(fallback);
return fallback;
}
diff --git a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
index 6c5b300..2951223 100644
--- a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
+++ b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
@@ -105,6 +105,7 @@ FontPlatformData::FontPlatformData(const FontDescription& desc, const AtomicStri
#else
m_atsuFontID = m_font->font()->MacGetATSUFontID();
#endif
+ m_nsFont = 0;
cacheNSFont();
#endif
m_size = desc.computedPixelSize();
diff --git a/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp b/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp
new file mode 100644
index 0000000..f6dea79
--- /dev/null
+++ b/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010, Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "ClipboardUtilitiesGtk.h"
+
+namespace WebCore {
+
+GdkDragAction dragOperationToGdkDragActions(DragOperation coreAction)
+{
+ GdkDragAction gdkAction = static_cast<GdkDragAction>(0);
+ if (coreAction == DragOperationNone)
+ return gdkAction;
+
+ if (coreAction & DragOperationCopy)
+ gdkAction = static_cast<GdkDragAction>(GDK_ACTION_COPY | gdkAction);
+ if (coreAction & DragOperationMove)
+ gdkAction = static_cast<GdkDragAction>(GDK_ACTION_MOVE | gdkAction);
+ if (coreAction & DragOperationLink)
+ gdkAction = static_cast<GdkDragAction>(GDK_ACTION_LINK | gdkAction);
+ if (coreAction & DragOperationPrivate)
+ gdkAction = static_cast<GdkDragAction>(GDK_ACTION_PRIVATE | gdkAction);
+
+ return gdkAction;
+}
+
+DragOperation gdkDragActionToDragOperation(GdkDragAction gdkAction)
+{
+ unsigned int action = DragOperationNone;
+ if (gdkAction & GDK_ACTION_COPY)
+ action |= DragOperationCopy;
+ if (gdkAction & GDK_ACTION_MOVE)
+ action |= DragOperationMove;
+ if (gdkAction & GDK_ACTION_LINK)
+ action |= DragOperationLink;
+ if (gdkAction & GDK_ACTION_PRIVATE)
+ action |= DragOperationPrivate;
+ return static_cast<DragOperation>(action);
+}
+
+}
diff --git a/WebCore/platform/gtk/ClipboardUtilitiesGtk.h b/WebCore/platform/gtk/ClipboardUtilitiesGtk.h
new file mode 100644
index 0000000..bdb2aec
--- /dev/null
+++ b/WebCore/platform/gtk/ClipboardUtilitiesGtk.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010, Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef ClipboardUtilitiesGtk_h
+#define ClipboardUtilitiesGtk_h
+
+#include "DragActions.h"
+#include <gdk/gdk.h>
+
+namespace WebCore {
+
+GdkDragAction dragOperationToGdkDragActions(DragOperation);
+DragOperation gdkDragActionToDragOperation(GdkDragAction);
+
+}
+
+#endif // ClipboardUtilitiesGtk_h
diff --git a/WebCore/platform/image-decoders/openvg/ImageDecoderOpenVG.cpp b/WebCore/platform/image-decoders/openvg/ImageDecoderOpenVG.cpp
new file mode 100644
index 0000000..3d8f749
--- /dev/null
+++ b/WebCore/platform/image-decoders/openvg/ImageDecoderOpenVG.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "ImageDecoder.h"
+
+#include "IntRect.h"
+#include "IntSize.h"
+#include "SurfaceOpenVG.h"
+#include "TiledImageOpenVG.h"
+#include "VGUtils.h"
+
+#if PLATFORM(EGL)
+#include "EGLDisplayOpenVG.h"
+#endif
+
+#include <openvg.h>
+
+namespace WebCore {
+
+NativeImagePtr RGBA32Buffer::asNewNativeImage() const
+{
+ static const VGImageFormat bufferFormat = VG_sARGB_8888_PRE;
+ // Save memory by using 16-bit images for fully opaque images.
+ const VGImageFormat imageFormat = hasAlpha() ? bufferFormat : VG_sRGB_565;
+
+#if PLATFORM(EGL)
+ EGLDisplayOpenVG::current()->sharedPlatformSurface()->makeCurrent();
+#endif
+
+ const IntSize vgMaxImageSize(vgGeti(VG_MAX_IMAGE_WIDTH), vgGeti(VG_MAX_IMAGE_HEIGHT));
+ ASSERT_VG_NO_ERROR();
+
+ TiledImageOpenVG* tiledImage = new TiledImageOpenVG(IntSize(width(), height()), vgMaxImageSize);
+
+ const int numColumns = tiledImage->numColumns();
+ const int numRows = tiledImage->numRows();
+
+ for (int yIndex = 0; yIndex < numRows; ++yIndex) {
+ for (int xIndex = 0; xIndex < numColumns; ++xIndex) {
+ IntRect tileRect = tiledImage->tileRect(xIndex, yIndex);
+ VGImage image = vgCreateImage(imageFormat,
+ tileRect.width(), tileRect.height(), VG_IMAGE_QUALITY_FASTER);
+ ASSERT_VG_NO_ERROR();
+
+ PixelData* pixelData = const_cast<PixelData*>(m_bytes.data());
+ pixelData += (tileRect.y() * width()) + tileRect.x();
+
+ vgImageSubData(image, reinterpret_cast<unsigned char*>(pixelData),
+ width() * sizeof(PixelData), bufferFormat,
+ 0, 0, tileRect.width(), tileRect.height());
+ ASSERT_VG_NO_ERROR();
+
+ tiledImage->setTile(xIndex, yIndex, image);
+ }
+ }
+
+ return tiledImage;
+}
+
+}
diff --git a/WebCore/platform/mac/EmptyProtocolDefinitions.h b/WebCore/platform/mac/EmptyProtocolDefinitions.h
index 4d4d373..b73177b 100644
--- a/WebCore/platform/mac/EmptyProtocolDefinitions.h
+++ b/WebCore/platform/mac/EmptyProtocolDefinitions.h
@@ -25,10 +25,6 @@
#if defined(__OBJC__)
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-#include <Foundation/NSPrivateDecls.h>
-#endif
-
#define EMPTY_PROTOCOL(NAME) \
@protocol NAME <NSObject> \
@end
@@ -41,7 +37,7 @@ EMPTY_PROTOCOL(NSWindowDelegate)
#endif
-#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) || !defined(__COCOA_FORMAL_PROTOCOLS_2__)
+#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
EMPTY_PROTOCOL(NSURLConnectionDelegate)
EMPTY_PROTOCOL(NSURLDownloadDelegate)
diff --git a/WebCore/platform/network/qt/ResourceRequestQt.cpp b/WebCore/platform/network/qt/ResourceRequestQt.cpp
index fea64a0..637c71f 100644
--- a/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -80,6 +80,14 @@ QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) con
break;
}
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ if (!allowCookies()) {
+ request.setAttribute(QNetworkRequest::CookieLoadControlAttribute, QNetworkRequest::Manual);
+ request.setAttribute(QNetworkRequest::CookieSaveControlAttribute, QNetworkRequest::Manual);
+ request.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual);
+ }
+#endif
+
return request;
}
diff --git a/WebCore/platform/posix/SharedBufferPOSIX.cpp b/WebCore/platform/posix/SharedBufferPOSIX.cpp
new file mode 100644
index 0000000..ea0589d
--- /dev/null
+++ b/WebCore/platform/posix/SharedBufferPOSIX.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SharedBuffer.h"
+
+#include "FileSystem.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& filePath)
+{
+ if (filePath.isEmpty())
+ return 0;
+
+ char* filename = filenameFromString(filePath);
+ int fd = open(filename, O_RDONLY);
+ fastFree(filename);
+ if (fd == -1)
+ return 0;
+
+ struct stat fileStat;
+ if (fstat(fd, &fileStat)) {
+ close(fd);
+ return 0;
+ }
+
+ size_t bytesToRead = fileStat.st_size;
+ if (bytesToRead != fileStat.st_size) {
+ close(fd);
+ return 0;
+ }
+
+ RefPtr<SharedBuffer> result = create();
+ result->m_buffer.grow(bytesToRead);
+
+ size_t totalBytesRead = 0;
+ ssize_t bytesRead;
+ while ((bytesRead = read(fd, result->m_buffer.data() + totalBytesRead, bytesToRead - totalBytesRead)) > 0)
+ totalBytesRead += bytesRead;
+
+ close(fd);
+
+ return totalBytesRead == bytesToRead ? result.release() : 0;
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h
index 5608069..9e32d31 100644
--- a/WebCore/platform/qt/QWebPageClient.h
+++ b/WebCore/platform/qt/QWebPageClient.h
@@ -89,6 +89,8 @@ public:
virtual QStyle* style() const = 0;
virtual QRectF graphicsItemVisibleRect() const { return QRectF(); }
+
+ virtual bool viewResizesToContentsEnabled() const = 0;
protected:
#ifndef QT_NO_CURSOR
diff --git a/WebCore/platform/qt/SharedBufferQt.cpp b/WebCore/platform/qt/SharedBufferQt.cpp
index 029d9d6..6b7f9c9 100644
--- a/WebCore/platform/qt/SharedBufferQt.cpp
+++ b/WebCore/platform/qt/SharedBufferQt.cpp
@@ -39,16 +39,9 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi
if (!file.exists() || !file.open(QFile::ReadOnly))
return 0;
-
- RefPtr<SharedBuffer> result = SharedBuffer::create();
- result->m_buffer.resize(file.size());
- if (result->m_buffer.size() != file.size())
- return 0;
-
- result->m_size = result->m_buffer.size();
-
- file.read(result->m_buffer.data(), result->m_buffer.size());
- return result.release();
+ Vector<char> buffer(file.size());
+ file.read(buffer.data(), buffer.size());
+ return SharedBuffer::adoptVector(buffer);
}
-}
+} // namespace WebCore
diff --git a/WebCore/platform/text/CharacterNames.h b/WebCore/platform/text/CharacterNames.h
index f97ba96..687bfb4 100644
--- a/WebCore/platform/text/CharacterNames.h
+++ b/WebCore/platform/text/CharacterNames.h
@@ -64,6 +64,7 @@ const UChar rightToLeftOverride = 0x202E;
const UChar softHyphen = 0x00AD;
const UChar space = 0x0020;
const UChar whiteBullet = 0x25E6;
+const UChar yenSign = 0x00A5;
const UChar zeroWidthJoiner = 0x200D;
const UChar zeroWidthNonJoiner = 0x200C;
const UChar zeroWidthSpace = 0x200B;
diff --git a/WebCore/platform/text/SegmentedString.h b/WebCore/platform/text/SegmentedString.h
index 79ed1f0..c5daaaa 100644
--- a/WebCore/platform/text/SegmentedString.h
+++ b/WebCore/platform/text/SegmentedString.h
@@ -103,6 +103,25 @@ public:
bool isEmpty() const { return !current(); }
unsigned length() const;
+ enum LookAheadResult {
+ DidNotMatch,
+ DidMatch,
+ NotEnoughCharacters,
+ };
+
+ // WARNING: This method is currently used only by the HTML5 parser and is incomplete.
+ LookAheadResult lookAhead(const String& string)
+ {
+ if (!m_pushedChar1 && string.length() <= (unsigned) m_currentString.m_length) {
+ if (memcmp(string.characters(), m_currentString.m_current, string.length() * sizeof(UChar)))
+ return DidNotMatch;
+ return DidMatch;
+ }
+ // We haven't implemented the slow case yet.
+ ASSERT_NOT_REACHED();
+ return DidNotMatch;
+ }
+
void advance()
{
if (!m_pushedChar1 && m_currentString.m_length > 1) {
@@ -112,7 +131,13 @@ public:
}
advanceSlowCase();
}
-
+
+ void advanceAndASSERT(UChar expectedCharacter)
+ {
+ ASSERT_UNUSED(expectedCharacter, *current() == expectedCharacter);
+ advance();
+ }
+
void advancePastNewline(int& lineNumber)
{
ASSERT(*current() == '\n');
diff --git a/WebCore/platform/text/transcoder/FontTranscoder.cpp b/WebCore/platform/text/transcoder/FontTranscoder.cpp
new file mode 100644
index 0000000..12678e8
--- /dev/null
+++ b/WebCore/platform/text/transcoder/FontTranscoder.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FontTranscoder.h"
+
+#include "CharacterNames.h"
+#include "TextEncoding.h"
+
+namespace WebCore {
+
+FontTranscoder::FontTranscoder()
+{
+ m_converterTypes.add("MS PGothic", BackslashToYenSign);
+ UChar unicodeNameMSPGothic[] = {0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF};
+ m_converterTypes.add(AtomicString(unicodeNameMSPGothic, sizeof(unicodeNameMSPGothic) / sizeof(UChar)), BackslashToYenSign);
+
+ m_converterTypes.add("MS PMincho", BackslashToYenSign);
+ UChar unicodeNameMSPMincho[] = {0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x660E, 0x671D};
+ m_converterTypes.add(AtomicString(unicodeNameMSPMincho, sizeof(unicodeNameMSPMincho) / sizeof(UChar)), BackslashToYenSign);
+
+ m_converterTypes.add("MS Gothic", BackslashToYenSign);
+ UChar unicodeNameMSGothic[] = {0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF};
+ m_converterTypes.add(AtomicString(unicodeNameMSGothic, sizeof(unicodeNameMSGothic) / sizeof(UChar)), BackslashToYenSign);
+
+ m_converterTypes.add("MS Mincho", BackslashToYenSign);
+ UChar unicodeNameMSMincho[] = {0xFF2D, 0xFF33, 0x0020, 0x660E, 0x671D};
+ m_converterTypes.add(AtomicString(unicodeNameMSMincho, sizeof(unicodeNameMSMincho) / sizeof(UChar)), BackslashToYenSign);
+
+ m_converterTypes.add("Meiryo", BackslashToYenSign);
+ UChar unicodeNameMeiryo[] = {0x30E1, 0x30A4, 0x30EA, 0x30AA};
+ m_converterTypes.add(AtomicString(unicodeNameMeiryo, sizeof(unicodeNameMeiryo) / sizeof(UChar)), BackslashToYenSign);
+}
+
+FontTranscoder::ConverterType FontTranscoder::converterType(const AtomicString& fontFamily, const TextEncoding* encoding) const
+{
+ if (!fontFamily.isNull()) {
+ HashMap<AtomicString, ConverterType>::const_iterator found = m_converterTypes.find(fontFamily);
+ if (found != m_converterTypes.end())
+ return found->second;
+ }
+
+ // IE's default fonts for Japanese encodings change backslashes into yen signs.
+ // FIXME: We don't need transcoding when the document explicitly
+ // specifies a font which doesn't change backslashes into yen signs.
+ if (encoding && encoding->backslashAsCurrencySymbol() != '\\')
+ return BackslashToYenSign;
+
+ return NoConversion;
+}
+
+void FontTranscoder::convert(String& text, const AtomicString& fontFamily, const TextEncoding* encoding) const
+{
+ switch (converterType(fontFamily, encoding)) {
+ case BackslashToYenSign: {
+ // FIXME: TextEncoding.h has similar code. We need to factor them out.
+ text.replace('\\', yenSign);
+ break;
+ }
+ case NoConversion:
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+bool FontTranscoder::needsTranscoding(const AtomicString& fontFamily, const TextEncoding* encoding) const
+{
+ ConverterType type = converterType(fontFamily, encoding);
+ return type != NoConversion;
+}
+
+FontTranscoder& fontTranscoder()
+{
+ static FontTranscoder* transcoder = new FontTranscoder;
+ return *transcoder;
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8AttrCustom.cpp b/WebCore/platform/text/transcoder/FontTranscoder.h
index 0da4ae4..f013453 100644
--- a/WebCore/bindings/v8/custom/V8AttrCustom.cpp
+++ b/WebCore/platform/text/transcoder/FontTranscoder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
+ * Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,31 +28,39 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "V8Attr.h"
+#ifndef FontTranscoder_h
+#define FontTranscoder_h
-#include "Attr.h"
-#include "Element.h"
-#include "ExceptionCode.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8Proxy.h"
+#include "AtomicStringHash.h"
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
namespace WebCore {
-void V8Attr::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- Attr* imp = V8Attr::toNative(info.Holder());
- String attrValue = toWebCoreStringWithNullCheck(value);
- Element* ownerElement = imp->ownerElement();
+class TextEncoding;
- if (ownerElement && !V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), ownerElement, imp->name(), attrValue))
- return;
+class FontTranscoder : public Noncopyable {
+public:
+ void convert(String& text, const AtomicString& fontFamily, const TextEncoding* = 0) const;
+ bool needsTranscoding(const AtomicString& fontFamily, const TextEncoding* = 0) const;
- ExceptionCode ec = 0;
- imp->setValue(attrValue, ec);
- if (ec)
- throwError(ec);
-}
+private:
+ FontTranscoder();
+ ~FontTranscoder(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons.
+
+ enum ConverterType {
+ NoConversion, BackslashToYenSign,
+ };
+
+ ConverterType converterType(const AtomicString& fontFamily, const TextEncoding*) const;
+
+ HashMap<AtomicString, ConverterType> m_converterTypes;
+
+ friend FontTranscoder& fontTranscoder();
+};
+
+FontTranscoder& fontTranscoder();
} // namespace WebCore
+
+#endif // FontTranscoder_h
diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.cpp b/WebCore/platform/win/ClipboardUtilitiesWin.cpp
index 6f9476a..d340c89 100644
--- a/WebCore/platform/win/ClipboardUtilitiesWin.cpp
+++ b/WebCore/platform/win/ClipboardUtilitiesWin.cpp
@@ -202,17 +202,6 @@ void markupToCF_HTML(const String& markup, const String& srcURL, Vector<char>& r
#undef NUMBER_FORMAT
}
-String urlToMarkup(const KURL& url, const String& title)
-{
- Vector<UChar> markup;
- append(markup, "<a href=\"");
- append(markup, url.string());
- append(markup, "\">");
- append(markup, title);
- append(markup, "</a>");
- return String::adopt(markup);
-}
-
void replaceNewlinesWithWindowsStyleNewlines(String& str)
{
static const UChar Newline = '\n';
diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.h b/WebCore/platform/win/ClipboardUtilitiesWin.h
index a92a4bf..ec15231 100644
--- a/WebCore/platform/win/ClipboardUtilitiesWin.h
+++ b/WebCore/platform/win/ClipboardUtilitiesWin.h
@@ -50,7 +50,6 @@ FORMATETC* cfHDropFormat();
FORMATETC* smartPasteFormat();
void markupToCF_HTML(const String& markup, const String& srcURL, Vector<char>& result);
-String urlToMarkup(const KURL& url, const String& title);
void replaceNewlinesWithWindowsStyleNewlines(String&);
void replaceNBSPWithSpace(String&);
diff --git a/WebCore/platform/win/SystemTimeWin.cpp b/WebCore/platform/win/SystemTimeWin.cpp
index 8c25c32..451262d 100644
--- a/WebCore/platform/win/SystemTimeWin.cpp
+++ b/WebCore/platform/win/SystemTimeWin.cpp
@@ -38,7 +38,7 @@ namespace WebCore {
float userIdleTime()
{
#if !OS(WINCE)
- LASTINPUTINFO lastInputInfo = {0};
+ LASTINPUTINFO lastInputInfo;
lastInputInfo.cbSize = sizeof(LASTINPUTINFO);
if (::GetLastInputInfo(&lastInputInfo))
return (GetTickCount() - lastInputInfo.dwTime) * 0.001; // ::GetTickCount returns ms of uptime valid for up to 49.7 days.
diff --git a/WebCore/platform/win/WebCoreInstanceHandle.h b/WebCore/platform/win/WebCoreInstanceHandle.h
index 81f4571..9b6ce66 100644
--- a/WebCore/platform/win/WebCoreInstanceHandle.h
+++ b/WebCore/platform/win/WebCoreInstanceHandle.h
@@ -1,41 +1,41 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebCoreInstanceHandle_h
-#define WebCoreInstanceHandle_h
-
-typedef struct HINSTANCE__* HINSTANCE;
-
-namespace WebCore {
-
- // The global DLL or application instance used for all windows.
- extern HINSTANCE s_instanceHandle;
-
- static void setInstanceHandle(HINSTANCE instanceHandle) { s_instanceHandle = instanceHandle; }
- static HINSTANCE instanceHandle() { return s_instanceHandle; }
-
-}
-
-#endif // WebCoreInstanceHandle_h
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCoreInstanceHandle_h
+#define WebCoreInstanceHandle_h
+
+typedef struct HINSTANCE__* HINSTANCE;
+
+namespace WebCore {
+
+// The global DLL or application instance used for all windows.
+extern HINSTANCE s_instanceHandle;
+
+inline void setInstanceHandle(HINSTANCE instanceHandle) { s_instanceHandle = instanceHandle; }
+inline HINSTANCE instanceHandle() { return s_instanceHandle; }
+
+}
+
+#endif // WebCoreInstanceHandle_h
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index ae1a0a9..42d98a8 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -65,10 +65,13 @@
#include "PluginMessageThrottlerWin.h"
#endif
+<<<<<<< HEAD
#if defined(ANDROID_PLUGINS)
#include "TouchEvent.h"
#endif
+=======
+>>>>>>> webkit.org at r60074
#if USE(JSC)
#include "JSDOMBinding.h"
#include "JSDOMWindow.h"
@@ -799,6 +802,7 @@ PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance()
return 0;
#endif // NETSCAPE_PLUGIN_API
}
+<<<<<<< HEAD
#endif // JSC
#if USE(V8)
@@ -831,6 +835,9 @@ NPObject* PluginView::getNPObject() {
#endif // NETSCAPE_PLUGIN_API
}
#endif // V8
+=======
+#endif
+>>>>>>> webkit.org at r60074
void PluginView::disconnectStream(PluginStream* stream)
{
@@ -920,6 +927,7 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
, m_isJavaScriptPaused(false)
, m_isHalted(false)
, m_hasBeenHalted(false)
+ , m_haveCalledSetWindow(false)
{
#if defined(ANDROID_PLUGINS)
platformInit();
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index 0849c59..f4474cc 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -70,8 +70,11 @@ namespace JSC {
}
}
#endif
+<<<<<<< HEAD
class NPObject;
+=======
+>>>>>>> webkit.org at r60074
namespace WebCore {
class Element;
@@ -434,6 +437,8 @@ private:
bool m_isHalted;
bool m_hasBeenHalted;
+ bool m_haveCalledSetWindow;
+
static PluginView* s_currentPluginView;
};
diff --git a/WebCore/plugins/win/PluginMessageThrottlerWin.cpp b/WebCore/plugins/win/PluginMessageThrottlerWin.cpp
index 46fee62..dd1f05b 100644
--- a/WebCore/plugins/win/PluginMessageThrottlerWin.cpp
+++ b/WebCore/plugins/win/PluginMessageThrottlerWin.cpp
@@ -45,9 +45,9 @@ static const double MessageThrottleTimeInterval = 0.016;
static const double MessageDirectProcessingInterval = 0.005;
PluginMessageThrottlerWin::PluginMessageThrottlerWin(PluginView* pluginView)
- : m_back(0)
+ : m_pluginView(pluginView)
+ , m_back(0)
, m_front(0)
- , m_pluginView(pluginView)
, m_lastMessageTime(0)
, m_messageThrottleTimer(this, &PluginMessageThrottlerWin::messageThrottleTimerFired)
{
diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp
index 96fa9e4..1765939 100644
--- a/WebCore/plugins/win/PluginViewWin.cpp
+++ b/WebCore/plugins/win/PluginViewWin.cpp
@@ -524,23 +524,14 @@ void PluginView::paintIntoTransformedContext(HDC hdc)
m_npWindow.type = NPWindowTypeDrawable;
m_npWindow.window = hdc;
- WINDOWPOS windowpos = { 0 };
+ WINDOWPOS windowpos = { 0, 0, 0, 0, 0, 0, 0 };
-#if OS(WINCE)
IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(frameRect());
windowpos.x = r.x();
windowpos.y = r.y();
windowpos.cx = r.width();
windowpos.cy = r.height();
-#else
- IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location());
-
- windowpos.x = p.x();
- windowpos.y = p.y();
- windowpos.cx = frameRect().width();
- windowpos.cy = frameRect().height();
-#endif
NPEvent npEvent;
npEvent.event = WM_WINDOWPOSCHANGED;
@@ -610,6 +601,10 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
if (context->paintingDisabled())
return;
+ // Ensure that we have called SetWindow before we try to paint.
+ if (!m_haveCalledSetWindow)
+ setNPWindowRect(frameRect());
+
if (m_isWindowed) {
#if !OS(WINCE)
if (context->shouldIncludeChildWindows())
@@ -815,6 +810,8 @@ void PluginView::setNPWindowRect(const IntRect& rect)
m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow);
setCallingPlugin(false);
+ m_haveCalledSetWindow = true;
+
if (!m_isWindowed)
return;
diff --git a/WebCore/rendering/EllipsisBox.cpp b/WebCore/rendering/EllipsisBox.cpp
index 4a64fe4..9d36086 100644
--- a/WebCore/rendering/EllipsisBox.cpp
+++ b/WebCore/rendering/EllipsisBox.cpp
@@ -31,7 +31,7 @@ void EllipsisBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = m_renderer->style(m_firstLine);
- Color textColor = style->color();
+ Color textColor = style->visitedDependentColor(CSSPropertyColor);
if (textColor != context->fillColor())
context->setFillColor(textColor, style->colorSpace());
bool setShadow = false;
@@ -78,7 +78,7 @@ IntRect EllipsisBox::selectionRect(int tx, int ty)
void EllipsisBox::paintSelection(GraphicsContext* context, int tx, int ty, RenderStyle* style, const Font& font)
{
- Color textColor = style->color();
+ Color textColor = style->visitedDependentColor(CSSPropertyColor);
Color c = m_renderer->selectionBackgroundColor();
if (!c.isValid() || !c.alpha())
return;
diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp
index 05d8fcd..c329b23 100644
--- a/WebCore/rendering/InlineFlowBox.cpp
+++ b/WebCore/rendering/InlineFlowBox.cpp
@@ -213,7 +213,7 @@ void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, RenderObject* en
// Check to see if all initial lines are unconstructed. If so, then
// we know the inline began on this line (unless we are a continuation).
RenderLineBoxList* lineBoxList = rendererLineBoxes();
- if (!lineBoxList->firstLineBox()->isConstructed() && !renderer()->isInlineContinuation()) {
+ if (!lineBoxList->firstLineBox()->isConstructed() && !renderer()->isInlineElementContinuation()) {
if (ltr && lineBoxList->firstLineBox() == this)
includeLeftEdge = true;
else if (!ltr && lineBoxList->lastLineBox() == this)
@@ -663,12 +663,12 @@ void InlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
// outlines.
if (renderer()->style()->visibility() == VISIBLE && renderer()->hasOutline() && !isRootInlineBox()) {
RenderInline* inlineFlow = toRenderInline(renderer());
- if ((inlineFlow->continuation() || inlineFlow->isInlineContinuation()) && !boxModelObject()->hasSelfPaintingLayer()) {
+ if ((inlineFlow->continuation() || inlineFlow->isInlineElementContinuation()) && !boxModelObject()->hasSelfPaintingLayer()) {
// Add ourselves to the containing block of the entire continuation so that it can
// paint us atomically.
RenderBlock* block = renderer()->containingBlock()->containingBlock();
block->addContinuationWithOutline(toRenderInline(renderer()->node()->renderer()));
- } else if (!inlineFlow->isInlineContinuation())
+ } else if (!inlineFlow->isInlineElementContinuation())
paintInfo.outlineObjects->add(inlineFlow);
}
} else if (paintInfo.phase == PaintPhaseMask) {
diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp
index 292a9ac..0933ae4 100644
--- a/WebCore/rendering/InlineTextBox.cpp
+++ b/WebCore/rendering/InlineTextBox.cpp
@@ -467,9 +467,7 @@ void InlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
selectionStrokeWidth = strokeWidth;
}
- Color stroke = paintInfo.forceBlackText ? Color::black : pseudoStyle->textStrokeColor();
- if (!stroke.isValid())
- stroke = pseudoStyle->color();
+ Color stroke = paintInfo.forceBlackText ? Color::black : pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextStrokeColor);
if (stroke != selectionStrokeColor) {
if (!paintSelectedTextOnly)
paintSelectedTextSeparately = true;
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 7b6c817..9ea5209 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -124,7 +124,7 @@ RenderBlock::RenderBlock(Node* node)
: RenderBox(node)
, m_floatingObjects(0)
, m_positionedObjects(0)
- , m_inlineContinuation(0)
+ , m_continuation(0)
, m_maxMargin(0)
, m_lineHeight(-1)
{
@@ -169,9 +169,9 @@ void RenderBlock::destroy()
// Destroy our continuation before anything other than anonymous children.
// The reason we don't destroy it before anonymous children is that they may
// have continuations of their own that are anonymous children of our continuation.
- if (m_inlineContinuation) {
- m_inlineContinuation->destroy();
- m_inlineContinuation = 0;
+ if (m_continuation) {
+ m_continuation->destroy();
+ m_continuation = 0;
}
if (!documentBeingDestroyed()) {
@@ -500,7 +500,7 @@ void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child)
ASSERT(child->isAnonymousBlock());
ASSERT(!child->childrenInline());
- if (child->inlineContinuation())
+ if (child->continuation())
return;
RenderObject* firstAnChild = child->m_children.firstChild();
@@ -544,10 +544,10 @@ void RenderBlock::removeChild(RenderObject* oldChild)
// fold the inline content back together.
RenderObject* prev = oldChild->previousSibling();
RenderObject* next = oldChild->nextSibling();
- bool canDeleteAnonymousBlocks = !documentBeingDestroyed() && !isInline() && !oldChild->isInline() &&
- (!oldChild->isRenderBlock() || !toRenderBlock(oldChild)->inlineContinuation()) &&
- (!prev || (prev->isAnonymousBlock() && prev->childrenInline())) &&
- (!next || (next->isAnonymousBlock() && next->childrenInline()));
+ bool canDeleteAnonymousBlocks = !documentBeingDestroyed() && !isInline() && !oldChild->isInline()
+ && (!oldChild->isRenderBlock() || !toRenderBlock(oldChild)->continuation())
+ && (!prev || (prev->isAnonymousBlock() && prev->childrenInline()))
+ && (!next || (next->isAnonymousBlock() && next->childrenInline()));
if (canDeleteAnonymousBlocks && prev && next) {
// Take all the children out of the |next| block and put them in
// the |prev| block.
@@ -756,7 +756,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
int repaintTop = 0;
int repaintBottom = 0;
int maxFloatBottom = 0;
- if (!firstChild())
+ if (!firstChild() && !isAnonymousBlock())
setChildrenInline(true);
if (childrenInline())
layoutInlineChildren(relayoutChildren, repaintTop, repaintBottom);
@@ -1628,24 +1628,27 @@ void RenderBlock::paintColumnContents(PaintInfo& paintInfo, int tx, int ty, bool
// For each rect, we clip to the rect, and then we adjust our coords.
IntRect colRect = colRects->at(i);
colRect.move(tx, ty);
- context->save();
-
- // Each strip pushes a clip, since column boxes are specified as being
- // like overflow:hidden.
- context->clip(colRect);
-
- // Adjust tx and ty to change where we paint.
PaintInfo info(paintInfo);
info.rect.intersect(colRect);
- // Adjust our x and y when painting.
- int finalX = tx + currXOffset;
- int finalY = ty + currYOffset;
- if (paintingFloats)
- paintFloats(info, finalX, finalY, paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip);
- else
- paintContents(info, finalX, finalY);
+ if (!info.rect.isEmpty()) {
+ context->save();
+
+ // Each strip pushes a clip, since column boxes are specified as being
+ // like overflow:hidden.
+ context->clip(colRect);
+
+ // Adjust our x and y when painting.
+ int finalX = tx + currXOffset;
+ int finalY = ty + currYOffset;
+ if (paintingFloats)
+ paintFloats(info, finalX, finalY, paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip);
+ else
+ paintContents(info, finalX, finalY);
+ context->restore();
+ }
+
// Move to the next position.
if (style()->direction() == LTR)
currXOffset += colRect.width() + colGap;
@@ -1653,8 +1656,6 @@ void RenderBlock::paintColumnContents(PaintInfo& paintInfo, int tx, int ty, bool
currXOffset -= (colRect.width() + colGap);
currYOffset -= colRect.height();
-
- context->restore();
}
}
@@ -1791,8 +1792,9 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, int tx, int ty)
// 6. paint continuation outlines.
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines)) {
- if (inlineContinuation() && inlineContinuation()->hasOutline() && inlineContinuation()->style()->visibility() == VISIBLE) {
- RenderInline* inlineRenderer = toRenderInline(inlineContinuation()->node()->renderer());
+ RenderInline* inlineCont = inlineElementContinuation();
+ if (inlineCont && inlineCont->hasOutline() && inlineCont->style()->visibility() == VISIBLE) {
+ RenderInline* inlineRenderer = toRenderInline(inlineCont->node()->renderer());
if (!inlineRenderer->hasSelfPaintingLayer())
containingBlock()->addContinuationWithOutline(inlineRenderer);
else if (!inlineRenderer->firstLineBox())
@@ -1865,6 +1867,21 @@ void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty)
}
}
+RenderInline* RenderBlock::inlineElementContinuation() const
+{
+ return m_continuation && m_continuation->isInline() ? toRenderInline(m_continuation) : 0;
+}
+
+RenderBlock* RenderBlock::blockElementContinuation() const
+{
+ if (!m_continuation || m_continuation->isInline())
+ return 0;
+ RenderBlock* nextContinuation = toRenderBlock(m_continuation);
+ if (nextContinuation->isAnonymousBlock())
+ return nextContinuation->blockElementContinuation();
+ return 0;
+}
+
static ContinuationOutlineTableMap* continuationOutlineTable()
{
DEFINE_STATIC_LOCAL(ContinuationOutlineTableMap, table, ());
@@ -1875,7 +1892,7 @@ void RenderBlock::addContinuationWithOutline(RenderInline* flow)
{
// We can't make this work if the inline is in a layer. We'll just rely on the broken
// way of painting.
- ASSERT(!flow->layer() && !flow->isInlineContinuation());
+ ASSERT(!flow->layer() && !flow->isInlineElementContinuation());
ContinuationOutlineTableMap* table = continuationOutlineTable();
ListHashSet<RenderInline*>* continuations = table->get(this);
@@ -2009,13 +2026,13 @@ void RenderBlock::paintSelection(PaintInfo& paintInfo, int tx, int ty)
}
#ifndef BUILDING_ON_TIGER
-static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, ListHashSet<RenderBox*>* positionedObjects)
+static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, RenderBlock::PositionedObjectsListHashSet* positionedObjects)
{
if (!positionedObjects)
return;
- ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end();
- for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
+ for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
RenderBox* r = *it;
paintInfo->context->clipOut(IntRect(tx + r->x(), ty + r->y(), r->width(), r->height()));
}
@@ -2301,7 +2318,7 @@ void RenderBlock::insertPositionedObject(RenderBox* o)
{
// Create the list of special objects if we don't aleady have one
if (!m_positionedObjects)
- m_positionedObjects = new ListHashSet<RenderBox*>;
+ m_positionedObjects = new PositionedObjectsListHashSet;
m_positionedObjects->add(o);
}
@@ -3420,17 +3437,19 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction)
{
// We need to do multiple passes, breaking up our hit testing into strips.
- // We can always go left to right, since column contents are clipped (meaning that there
- // can't be any overlap).
Vector<IntRect>* colRects = columnRects();
- unsigned colCount = colRects->size();
+ int colCount = colRects->size();
if (!colCount)
return false;
- int currXOffset = style()->direction() == LTR ? 0 : contentWidth() - colRects->at(0).width();
+ int left = borderLeft() + paddingLeft();
int currYOffset = 0;
- int colGap = columnGap();
- for (unsigned i = 0; i < colCount; i++) {
+ int i;
+ for (i = 0; i < colCount; i++)
+ currYOffset -= colRects->at(i).height();
+ for (i = colCount - 1; i >= 0; i--) {
IntRect colRect = colRects->at(i);
+ int currXOffset = colRect.x() - left;
+ currYOffset += colRect.height();
colRect.move(tx, ty);
#ifdef ANDROID_HITTEST_WITHSIZE
@@ -3450,14 +3469,6 @@ bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& r
#endif
return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction);
}
-
- // Move to the next position.
- if (style()->direction() == LTR)
- currXOffset += colRect.width() + colGap;
- else
- currXOffset -= (colRect.width() + colGap);
-
- currYOffset -= colRect.height();
}
return false;
@@ -3962,11 +3973,13 @@ void RenderBlock::adjustRectForColumns(IntRect& r) const
unsigned colCount = colRects->size();
if (!colCount)
return;
- int currXOffset = style()->direction() == LTR ? 0 : contentWidth() - colRects->at(0).width();
+
+ int left = borderLeft() + paddingLeft();
+
int currYOffset = 0;
- int colGap = columnGap();
for (unsigned i = 0; i < colCount; i++) {
IntRect colRect = colRects->at(i);
+ int currXOffset = colRect.x() - left;
IntRect repaintRect = r;
repaintRect.move(currXOffset, currYOffset);
@@ -3976,11 +3989,6 @@ void RenderBlock::adjustRectForColumns(IntRect& r) const
result.unite(repaintRect);
// Move to the next position.
- if (style()->direction() == LTR)
- currXOffset += colRect.width() + colGap;
- else
- currXOffset -= (colRect.width() + colGap);
-
currYOffset -= colRect.height();
}
@@ -3993,23 +4001,18 @@ void RenderBlock::adjustForColumns(IntSize& offset, const IntPoint& point) const
return;
Vector<IntRect>& columnRects = *this->columnRects();
-
- int gapWidth = columnGap();
-
- int xOffset = style()->direction() == LTR ? 0 : contentWidth() - columnRects[0].width();
+
+ int left = borderLeft() + paddingLeft();
int yOffset = 0;
size_t columnCount = columnRects.size();
for (size_t i = 0; i < columnCount; ++i) {
IntRect columnRect = columnRects[i];
+ int xOffset = columnRect.x() - left;
if (point.y() < columnRect.bottom() + yOffset) {
offset.expand(xOffset, -yOffset);
return;
}
- if (style()->direction() == LTR)
- xOffset += columnRect.width() + gapWidth;
- else
- xOffset -= columnRect.width() + gapWidth;
yOffset += columnRect.height();
}
}
@@ -5009,12 +5012,12 @@ void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
// For blocks inside inlines, we go ahead and include margins so that we run right up to the
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
- if (inlineContinuation()) {
+ if (isAnonymousBlockContinuation()) {
rects.append(IntRect(tx, ty - collapsedMarginTop(),
width(), height() + collapsedMarginTop() + collapsedMarginBottom()));
- inlineContinuation()->absoluteRects(rects,
- tx - x() + inlineContinuation()->containingBlock()->x(),
- ty - y() + inlineContinuation()->containingBlock()->y());
+ continuation()->absoluteRects(rects,
+ tx - x() + inlineElementContinuation()->containingBlock()->x(),
+ ty - y() + inlineElementContinuation()->containingBlock()->y());
} else
rects.append(IntRect(tx, ty, width(), height()));
}
@@ -5024,11 +5027,11 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads)
// For blocks inside inlines, we go ahead and include margins so that we run right up to the
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
- if (inlineContinuation()) {
+ if (isAnonymousBlockContinuation()) {
FloatRect localRect(0, -collapsedMarginTop(),
width(), height() + collapsedMarginTop() + collapsedMarginBottom());
quads.append(localToAbsoluteQuad(localRect));
- inlineContinuation()->absoluteQuads(quads);
+ continuation()->absoluteQuads(quads);
} else
quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width(), height())));
}
@@ -5036,26 +5039,26 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads)
IntRect RenderBlock::rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth)
{
IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth));
- if (inlineContinuation())
+ if (isAnonymousBlockContinuation())
r.inflateY(collapsedMarginTop());
return r;
}
RenderObject* RenderBlock::hoverAncestor() const
{
- return inlineContinuation() ? inlineContinuation() : RenderBox::hoverAncestor();
+ return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAncestor();
}
void RenderBlock::updateDragState(bool dragOn)
{
RenderBox::updateDragState(dragOn);
- if (inlineContinuation())
- inlineContinuation()->updateDragState(dragOn);
+ if (continuation())
+ continuation()->updateDragState(dragOn);
}
RenderStyle* RenderBlock::outlineStyleForRepaint() const
{
- return inlineContinuation() ? inlineContinuation()->style() : style();
+ return isAnonymousBlockContinuation() ? continuation()->style() : style();
}
void RenderBlock::childBecameNonInline(RenderObject*)
@@ -5072,11 +5075,11 @@ void RenderBlock::updateHitTestResult(HitTestResult& result, const IntPoint& poi
return;
Node* n = node();
- if (inlineContinuation())
+ if (isAnonymousBlockContinuation())
// We are in the margins of block elements that are part of a continuation. In
- // this case we're actually still inside the enclosing inline element that was
+ // this case we're actually still inside the enclosing element that was
// split. Go ahead and set our inner node accordingly.
- n = inlineContinuation()->node();
+ n = continuation()->node();
if (n) {
result.setInnerNode(n);
@@ -5169,11 +5172,11 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
// For blocks inside inlines, we go ahead and include margins so that we run right up to the
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
- if (inlineContinuation()) {
+ if (inlineElementContinuation()) {
// FIXME: This check really isn't accurate.
- bool nextInlineHasLineBox = inlineContinuation()->firstLineBox();
+ bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox();
// FIXME: This is wrong. The principal renderer may not be the continuation preceding this block.
- bool prevInlineHasLineBox = toRenderInline(inlineContinuation()->node()->renderer())->firstLineBox();
+ bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->node()->renderer())->firstLineBox();
int topMargin = prevInlineHasLineBox ? collapsedMarginTop() : 0;
int bottomMargin = nextInlineHasLineBox ? collapsedMarginBottom() : 0;
IntRect rect(tx, ty - topMargin, width(), height() + topMargin + bottomMargin);
@@ -5205,10 +5208,10 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
}
}
- if (inlineContinuation())
- inlineContinuation()->addFocusRingRects(rects,
- tx - x() + inlineContinuation()->containingBlock()->x(),
- ty - y() + inlineContinuation()->containingBlock()->y());
+ if (inlineElementContinuation())
+ inlineElementContinuation()->addFocusRingRects(rects,
+ tx - x() + inlineElementContinuation()->containingBlock()->x(),
+ ty - y() + inlineElementContinuation()->containingBlock()->y());
}
RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index b54f66d..9eb1c0f 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -74,7 +74,9 @@ public:
void insertPositionedObject(RenderBox*);
void removePositionedObject(RenderBox*);
void removePositionedObjects(RenderBlock*);
- ListHashSet<RenderBox*>* positionedObjects() const { return m_positionedObjects; }
+
+ typedef ListHashSet<RenderBox*, 4> PositionedObjectsListHashSet;
+ PositionedObjectsListHashSet* positionedObjects() const { return m_positionedObjects; }
void addPercentHeightDescendant(RenderBox*);
static void removePercentHeightDescendant(RenderBox*);
@@ -131,8 +133,12 @@ public:
void addContinuationWithOutline(RenderInline*);
- RenderInline* inlineContinuation() const { return m_inlineContinuation; }
- void setInlineContinuation(RenderInline* c) { m_inlineContinuation = c; }
+ RenderBoxModelObject* continuation() const { return m_continuation; }
+ void setContinuation(RenderBoxModelObject* c) { m_continuation = c; }
+ virtual RenderBoxModelObject* virtualContinuation() const { return continuation(); }
+ bool isAnonymousBlockContinuation() const { return continuation() && isAnonymousBlock(); }
+ RenderInline* inlineElementContinuation() const;
+ RenderBlock* blockElementContinuation() const;
// This function is a convenience helper for creating an anonymous block that inherits its
// style from this RenderBlock.
@@ -141,6 +147,9 @@ public:
static void appendRunsForObject(int start, int end, RenderObject*, InlineBidiResolver&);
static bool requiresLineBox(const InlineIterator&, bool isLineEmpty = true, bool previousLineBrokeCleanly = true);
+ Vector<IntRect>* columnRects() const;
+ int columnGap() const;
+
protected:
void moveChildTo(RenderObject* to, RenderObjectChildList* toChildList, RenderObject* child);
void moveChildTo(RenderObject* to, RenderObjectChildList* toChildList, RenderObject* beforeChild, RenderObject* child);
@@ -198,7 +207,7 @@ protected:
virtual bool hasLineIfEmpty() const;
bool layoutOnlyPositionedObjects();
-
+
private:
virtual RenderObjectChildList* virtualChildren() { return children(); }
virtual const RenderObjectChildList* virtualChildren() const { return children(); }
@@ -346,6 +355,7 @@ private:
int desiredColumnWidth() const;
unsigned desiredColumnCount() const;
+<<<<<<< HEAD
#if PLATFORM(ANDROID)
public:
#endif
@@ -362,6 +372,10 @@ public:
private:
#endif
+=======
+ void setDesiredColumnCountAndWidth(int count, int width);
+
+>>>>>>> webkit.org at r60074
void paintContinuationOutlines(PaintInfo&, int tx, int ty);
virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
@@ -495,15 +509,16 @@ private:
void setCollapsedBottomMargin(const MarginInfo&);
// End helper functions and structs used by layoutBlockChildren.
- typedef ListHashSet<RenderBox*>::const_iterator Iterator;
+ typedef PositionedObjectsListHashSet::const_iterator Iterator;
DeprecatedPtrList<FloatingObject>* m_floatingObjects;
- ListHashSet<RenderBox*>* m_positionedObjects;
+
+ PositionedObjectsListHashSet* m_positionedObjects;
// An inline can be split with blocks occurring in between the inline content.
// When this occurs we need a pointer to our next object. We can basically be
// split into a sequence of inlines and blocks. The continuation will either be
// an anonymous block (that houses other blocks) or it will be an inline flow.
- RenderInline* m_inlineContinuation;
+ RenderBoxModelObject* m_continuation;
// Allocated only when some of these fields have non-default values
struct MaxMargin : Noncopyable {
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 4c5d702..12bfced 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -193,7 +193,7 @@ void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
// Set the text color if we're the body.
if (isBody())
- document()->setTextColor(style()->color());
+ document()->setTextColor(style()->visitedDependentColor(CSSPropertyColor));
}
void RenderBox::updateBoxModelInfoFromStyle()
@@ -599,9 +599,9 @@ void RenderBox::paint(PaintInfo& paintInfo, int tx, int ty)
void RenderBox::paintRootBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
const FillLayer* bgLayer = style()->backgroundLayers();
- Color bgColor = style()->backgroundColor();
+ Color bgColor = style()->visitedDependentColor(CSSPropertyBackgroundColor);
RenderObject* bodyObject = 0;
- if (!style()->hasBackground() && node() && node()->hasTagName(HTMLNames::htmlTag)) {
+ if (!hasBackground() && node() && node()->hasTagName(HTMLNames::htmlTag)) {
// Locate the <body> element using the DOM. This is easier than trying
// to crawl around a render tree with potential :before/:after content and
// anonymous blocks created by inline <body> tags etc. We can locate the <body>
@@ -610,7 +610,7 @@ void RenderBox::paintRootBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0;
if (bodyObject) {
bgLayer = bodyObject->style()->backgroundLayers();
- bgColor = bodyObject->style()->backgroundColor();
+ bgColor = bodyObject->style()->visitedDependentColor(CSSPropertyBackgroundColor);
}
}
@@ -671,8 +671,8 @@ void RenderBox::paintBoxDecorationsWithSize(PaintInfo& paintInfo, int tx, int ty
// The <body> only paints its background if the root element has defined a background
// independent of the body. Go through the DOM to get to the root element's render object,
// since the root could be inline and wrapped in an anonymous block.
- if (!isBody() || document()->documentElement()->renderer()->style()->hasBackground())
- paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), tx, ty, width, height);
+ if (!isBody() || document()->documentElement()->renderer()->hasBackground())
+ paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, width, height);
if (style()->hasAppearance())
theme()->paintDecorations(this, paintInfo, IntRect(tx, ty, width, height));
}
@@ -818,7 +818,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer
// Now that we know this image is being used, compute the renderer and the rect
// if we haven't already
if (!layerRenderer) {
- bool drawingRootBackground = drawingBackground && (isRoot() || (isBody() && !document()->documentElement()->renderer()->style()->hasBackground()));
+ bool drawingRootBackground = drawingBackground && (isRoot() || (isBody() && !document()->documentElement()->renderer()->hasBackground()));
if (drawingRootBackground) {
layerRenderer = view();
@@ -1210,22 +1210,11 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, In
EPosition position = style()->position();
- if (o->isBlockFlow() && position != AbsolutePosition && position != FixedPosition) {
- RenderBlock* cb = toRenderBlock(o);
- if (cb->hasColumns()) {
- IntRect repaintRect(topLeft, rect.size());
- cb->adjustRectForColumns(repaintRect);
- topLeft = repaintRect.location();
- rect = repaintRect;
- }
- }
-
// We are now in our parent container's coordinate space. Apply our transform to obtain a bounding box
// in the parent's coordinate space that encloses us.
if (layer() && layer()->transform()) {
fixed = position == FixedPosition;
rect = layer()->transform()->mapRect(rect);
- // FIXME: this clobbers topLeft adjustment done for multicol above
topLeft = rect.location();
topLeft.move(x(), y());
} else if (position == FixedPosition)
@@ -1241,6 +1230,16 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, In
topLeft += layer()->relativePositionOffset();
}
+ if (o->isBlockFlow() && position != AbsolutePosition && position != FixedPosition) {
+ RenderBlock* cb = toRenderBlock(o);
+ if (cb->hasColumns()) {
+ IntRect repaintRect(topLeft, rect.size());
+ cb->adjustRectForColumns(repaintRect);
+ topLeft = repaintRect.location();
+ rect = repaintRect;
+ }
+ }
+
// FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout,
// its controlClipRect will be wrong. For overflow clip we use the values cached by the layer.
if (o->hasOverflowClip()) {
diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp
index 9caf46f..1a72957 100644
--- a/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/WebCore/rendering/RenderBoxModelObject.cpp
@@ -304,7 +304,7 @@ void RenderBoxModelObject::updateBoxModelInfoFromStyle()
{
// Set the appropriate bits for a box model object. Since all bits are cleared in styleWillChange,
// we only check for bits that could possibly be set to true.
- setHasBoxDecorations(style()->hasBorder() || style()->hasBackground() || style()->hasAppearance() || style()->boxShadow());
+ setHasBoxDecorations(hasBackground() || style()->hasBorder() || style()->hasAppearance() || style()->boxShadow());
setInline(style()->isDisplayInlineType());
setRelPositioned(style()->position() == RelativePosition);
}
@@ -1321,7 +1321,7 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
rect.setHeight(rect.height() - borderTop() - borderBottom());
}
- bool hasOpaqueBackground = s->backgroundColor().isValid() && s->backgroundColor().alpha() == 255;
+ bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255;
for (const ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next()) {
if (shadow->style() != shadowStyle)
continue;
diff --git a/WebCore/rendering/RenderButton.h b/WebCore/rendering/RenderButton.h
index 7fd6ab0..1fc5eb6 100644
--- a/WebCore/rendering/RenderButton.h
+++ b/WebCore/rendering/RenderButton.h
@@ -57,12 +57,14 @@ public:
virtual bool canHaveChildren() const;
-protected:
+private:
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool hasLineIfEmpty() const { return true; }
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
void timerFired(Timer<RenderButton>*);
RenderTextFragment* m_buttonText;
diff --git a/WebCore/rendering/RenderDataGrid.h b/WebCore/rendering/RenderDataGrid.h
index 467edcc..ce221ea 100644
--- a/WebCore/rendering/RenderDataGrid.h
+++ b/WebCore/rendering/RenderDataGrid.h
@@ -53,6 +53,8 @@ public:
private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
RenderStyle* columnStyle(DataGridColumn*);
RenderStyle* headerStyle(DataGridColumn*);
void recalcStyleForColumns();
diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp
index 306e111..734c348 100644
--- a/WebCore/rendering/RenderFieldset.cpp
+++ b/WebCore/rendering/RenderFieldset.cpp
@@ -136,7 +136,7 @@ void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);
- paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), tx, ty, w, h);
+ paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h);
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);
if (!style()->hasBorder())
diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp
index fa2a998..1ae149b 100644
--- a/WebCore/rendering/RenderFileUploadControl.cpp
+++ b/WebCore/rendering/RenderFileUploadControl.cpp
@@ -228,7 +228,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty)
+ buttonRenderer->marginTop() + buttonRenderer->borderTop() + buttonRenderer->paddingTop()
+ buttonRenderer->baselinePosition(true, false);
- paintInfo.context->setFillColor(style()->color(), style()->colorSpace());
+ paintInfo.context->setFillColor(style()->visitedDependentColor(CSSPropertyColor), style()->colorSpace());
// Draw the filename
paintInfo.context->drawBidiText(style()->font(), textRun, IntPoint(textX, textY));
diff --git a/WebCore/rendering/RenderFileUploadControl.h b/WebCore/rendering/RenderFileUploadControl.h
index 1427dbf..25d2639 100644
--- a/WebCore/rendering/RenderFileUploadControl.h
+++ b/WebCore/rendering/RenderFileUploadControl.h
@@ -56,6 +56,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
// FileChooserClient methods.
void valueChanged();
void repaint() { RenderBlock::repaint(); }
diff --git a/WebCore/rendering/RenderFrameSet.cpp b/WebCore/rendering/RenderFrameSet.cpp
index 35867f5..3ab2fff 100644
--- a/WebCore/rendering/RenderFrameSet.cpp
+++ b/WebCore/rendering/RenderFrameSet.cpp
@@ -90,7 +90,7 @@ void RenderFrameSet::paintColumnBorder(const PaintInfo& paintInfo, const IntRect
// Fill first.
GraphicsContext* context = paintInfo.context;
ColorSpace colorSpace = style()->colorSpace();
- context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()->borderLeftColor() : borderFillColor(), colorSpace);
+ context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()->visitedDependentColor(CSSPropertyBorderLeftColor) : borderFillColor(), colorSpace);
// Now stroke the edges but only if we have enough room to paint both edges with a little
// bit of the fill color showing through.
@@ -110,7 +110,7 @@ void RenderFrameSet::paintRowBorder(const PaintInfo& paintInfo, const IntRect& b
// Fill first.
GraphicsContext* context = paintInfo.context;
ColorSpace colorSpace = style()->colorSpace();
- context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()->borderLeftColor() : borderFillColor(), colorSpace);
+ context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()->visitedDependentColor(CSSPropertyBorderLeftColor) : borderFillColor(), colorSpace);
// Now stroke the edges but only if we have enough room to paint both edges with a little
// bit of the fill color showing through.
diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp
index 6fd38a6..2e376e7 100644
--- a/WebCore/rendering/RenderImage.cpp
+++ b/WebCore/rendering/RenderImage.cpp
@@ -407,7 +407,7 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
if (!m_altText.isEmpty()) {
String text = document()->displayStringModifiedByEncoding(m_altText);
- context->setFillColor(style()->color(), style()->colorSpace());
+ context->setFillColor(style()->visitedDependentColor(CSSPropertyColor), style()->colorSpace());
int ax = tx + leftBorder + leftPad;
int ay = ty + topBorder + topPad;
const Font& font = style()->font();
diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp
index 69e6eab..7531f93 100644
--- a/WebCore/rendering/RenderInline.cpp
+++ b/WebCore/rendering/RenderInline.cpp
@@ -92,11 +92,11 @@ void RenderInline::destroy()
RenderBoxModelObject::destroy();
}
-RenderInline* RenderInline::inlineContinuation() const
+RenderInline* RenderInline::inlineElementContinuation() const
{
if (!m_continuation || m_continuation->isInline())
return toRenderInline(m_continuation);
- return toRenderBlock(m_continuation)->inlineContinuation();
+ return toRenderBlock(m_continuation)->inlineElementContinuation();
}
void RenderInline::updateBoxModelInfoFromStyle()
@@ -120,7 +120,7 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
// e.g., <font>foo <h4>goo</h4> moo</font>. The <font> inlines before
// and after the block share the same style, but the block doesn't
// need to pass its style on to anyone else.
- for (RenderInline* currCont = inlineContinuation(); currCont; currCont = currCont->inlineContinuation()) {
+ for (RenderInline* currCont = inlineElementContinuation(); currCont; currCont = currCont->inlineElementContinuation()) {
RenderBoxModelObject* nextCont = currCont->continuation();
currCont->setContinuation(0);
currCont->setStyle(style());
@@ -147,7 +147,7 @@ static RenderBoxModelObject* nextContinuation(RenderObject* renderer)
{
if (renderer->isInline() && !renderer->isReplaced())
return toRenderInline(renderer)->continuation();
- return toRenderBlock(renderer)->inlineContinuation();
+ return toRenderBlock(renderer)->inlineElementContinuation();
}
RenderBoxModelObject* RenderInline::continuationBefore(RenderObject* beforeChild)
@@ -240,7 +240,7 @@ void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock,
}
// Hook |clone| up as the continuation of the middle block.
- middleBlock->setInlineContinuation(clone);
+ middleBlock->setContinuation(clone);
// We have been reparented and are now under the fromBlock. We need
// to walk up our inline parent chain until we hit the containing block.
@@ -516,7 +516,7 @@ VisiblePosition RenderInline::positionForPoint(const IntPoint& point)
RenderBox* contBlock = c->isInline() ? c->containingBlock() : toRenderBlock(c);
if (c->isInline() || c->firstChild())
return c->positionForCoordinates(parentBlockX - contBlock->x(), parentBlockY - contBlock->y());
- c = toRenderBlock(c)->inlineContinuation();
+ c = toRenderBlock(c)->inlineElementContinuation();
}
return RenderBoxModelObject::positionForPoint(point);
@@ -815,7 +815,7 @@ void RenderInline::updateHitTestResult(HitTestResult& result, const IntPoint& po
Node* n = node();
IntPoint localPoint(point);
if (n) {
- if (isInlineContinuation()) {
+ if (isInlineElementContinuation()) {
// We're in the continuation of a split inline. Adjust our local point to be in the coordinate space
// of the principal renderer's containing block. This will end up being the innerNonSharedNode.
RenderBlock* firstBlock = n->renderer()->containingBlock();
diff --git a/WebCore/rendering/RenderInline.h b/WebCore/rendering/RenderInline.h
index 4084b6e..a719a50 100644
--- a/WebCore/rendering/RenderInline.h
+++ b/WebCore/rendering/RenderInline.h
@@ -60,6 +60,9 @@ public:
InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); }
RenderBoxModelObject* continuation() const { return m_continuation; }
+ void setContinuation(RenderBoxModelObject* c) { m_continuation = c; }
+ virtual RenderBoxModelObject* virtualContinuation() const { return continuation(); }
+ RenderInline* inlineElementContinuation() const;
virtual void updateDragState(bool dragOn);
@@ -71,8 +74,6 @@ public:
int verticalPositionFromCache(bool firstLine) const;
void invalidateVerticalPosition() { m_verticalPosition = PositionUndefined; }
- RenderInline* inlineContinuation() const;
-
private:
virtual RenderObjectChildList* virtualChildren() { return children(); }
virtual const RenderObjectChildList* virtualChildren() const { return children(); }
@@ -127,8 +128,6 @@ private:
virtual void dirtyLinesFromChangedChild(RenderObject* child) { m_lineBoxes.dirtyLinesFromChangedChild(this, child); }
virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
-
- void setContinuation(RenderBoxModelObject* c) { m_continuation = c; }
virtual void childBecameNonInline(RenderObject* child);
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 80e334a..8c7f23d 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -166,6 +166,7 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer)
, m_hasVisibleContent(false)
, m_visibleDescendantStatusDirty(false)
, m_hasVisibleDescendant(false)
+ , m_isPaginated(false)
, m_3DTransformedDescendantStatusDirty(true)
, m_has3DTransformedDescendant(false)
#if USE(ACCELERATED_COMPOSITING)
@@ -308,7 +309,12 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags, IntPoint
updateVisibilityStatus();
updateTransform();
-
+
+ if (flags & UpdatePagination)
+ updatePagination();
+ else
+ m_isPaginated = false;
+
if (m_hasVisibleContent) {
RenderView* view = renderer()->view();
ASSERT(view);
@@ -351,6 +357,9 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags, IntPoint
flags &= ~IsCompositingUpdateRoot;
#endif
+ if (renderer()->hasColumns())
+ flags |= UpdatePagination;
+
for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
child->updateLayerPositions(flags, cachedOffset);
@@ -449,6 +458,30 @@ TransformationMatrix RenderLayer::renderableTransform(PaintBehavior paintBehavio
return *m_transform;
}
+void RenderLayer::updatePagination()
+{
+ m_isPaginated = false;
+ if (isComposited() || !parent() || renderer()->isPositioned())
+ return; // FIXME: We will have to deal with paginated compositing layers someday.
+ // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though.
+
+ if (isNormalFlowOnly()) {
+ m_isPaginated = parent()->renderer()->hasColumns();
+ return;
+ }
+
+ // If we're not normal flow, then we need to look for a multi-column object between us and our stacking context.
+ RenderLayer* ancestorStackingContext = stackingContext();
+ for (RenderLayer* curr = parent(); curr; curr = curr->parent()) {
+ if (curr->renderer()->hasColumns()) {
+ m_isPaginated = true;
+ return;
+ }
+ if (curr == ancestorStackingContext || (curr->parent() && curr->parent()->renderer()->isPositioned()))
+ return;
+ }
+}
+
void RenderLayer::setHasVisibleContent(bool b)
{
if (m_hasVisibleContent == b && !m_visibleContentStatusDirty)
@@ -644,10 +677,14 @@ void RenderLayer::updateLayerPosition()
localPoint += offset;
}
} else if (parent()) {
- IntSize columnOffset;
- parent()->renderer()->adjustForColumns(columnOffset, localPoint);
- localPoint += columnOffset;
-
+ if (isComposited()) {
+ // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column.
+ // They won't split across columns properly.
+ IntSize columnOffset;
+ parent()->renderer()->adjustForColumns(columnOffset, localPoint);
+ localPoint += columnOffset;
+ }
+
IntSize scrollOffset = parent()->scrolledContentOffset();
localPoint -= scrollOffset;
}
@@ -2386,10 +2423,8 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
}
// Now walk the sorted list of children with negative z-indices.
- if (m_negZOrderList)
- for (Vector<RenderLayer*>::iterator it = m_negZOrderList->begin(); it != m_negZOrderList->end(); ++it)
- it[0]->paintLayer(rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, localPaintFlags);
-
+ paintList(m_negZOrderList, rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, localPaintFlags);
+
// Now establish the appropriate clip and paint our child RenderObjects.
if (shouldPaint && !clipRectToApply.isEmpty()) {
// Begin transparency layers lazily now that we know we have to paint something.
@@ -2425,15 +2460,11 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
}
// Paint any child layers that have overflow.
- if (m_normalFlowList)
- for (Vector<RenderLayer*>::iterator it = m_normalFlowList->begin(); it != m_normalFlowList->end(); ++it)
- it[0]->paintLayer(rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, localPaintFlags);
-
- // Now walk the sorted list of children with positive z-indices.
- if (m_posZOrderList)
- for (Vector<RenderLayer*>::iterator it = m_posZOrderList->begin(); it != m_posZOrderList->end(); ++it)
- it[0]->paintLayer(rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, localPaintFlags);
+ paintList(m_normalFlowList, rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, localPaintFlags);
+ // Now walk the sorted list of children with positive z-indices.
+ paintList(m_posZOrderList, rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, localPaintFlags);
+
if (renderer()->hasMask() && shouldPaint && !selectionOnly && !damageRect.isEmpty()) {
setClip(p, paintDirtyRect, damageRect);
@@ -2453,6 +2484,119 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
}
}
+void RenderLayer::paintList(Vector<RenderLayer*>* list, RenderLayer* rootLayer, GraphicsContext* p,
+ const IntRect& paintDirtyRect, PaintBehavior paintBehavior,
+ RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests,
+ PaintLayerFlags paintFlags)
+{
+ if (!list)
+ return;
+
+ for (size_t i = 0; i < list->size(); ++i) {
+ RenderLayer* childLayer = list->at(i);
+ if (!childLayer->isPaginated())
+ childLayer->paintLayer(rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, paintFlags);
+ else
+ paintPaginatedChildLayer(childLayer, rootLayer, p, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, paintFlags);
+ }
+}
+
+void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext* context,
+ const IntRect& paintDirtyRect, PaintBehavior paintBehavior,
+ RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests,
+ PaintLayerFlags paintFlags)
+{
+ // We need to do multiple passes, breaking up our child layer into strips.
+ ASSERT(!renderer()->isPositioned());
+ Vector<RenderLayer*> columnLayers;
+ RenderLayer* ancestorLayer = isNormalFlowOnly() ? parent() : stackingContext();
+ for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) {
+ if (curr->renderer()->hasColumns())
+ columnLayers.append(curr);
+ if (curr == ancestorLayer || (curr->parent() && curr->parent()->renderer()->isPositioned()))
+ break;
+ }
+
+ ASSERT(columnLayers.size());
+
+ paintChildLayerIntoColumns(childLayer, rootLayer, context, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, paintFlags, columnLayers, columnLayers.size() - 1);
+}
+
+void RenderLayer::paintChildLayerIntoColumns(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext* context,
+ const IntRect& paintDirtyRect, PaintBehavior paintBehavior,
+ RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests,
+ PaintLayerFlags paintFlags, const Vector<RenderLayer*>& columnLayers, size_t colIndex)
+{
+ RenderBlock* columnBlock = toRenderBlock(columnLayers[colIndex]->renderer());
+
+ ASSERT(columnBlock && columnBlock->hasColumns());
+ if (!columnBlock || !columnBlock->hasColumns())
+ return;
+
+ int layerX = 0;
+ int layerY = 0;
+ columnBlock->layer()->convertToLayerCoords(rootLayer, layerX, layerY);
+
+ Vector<IntRect>* colRects = columnBlock->columnRects();
+ unsigned colCount = colRects->size();
+ int currYOffset = 0;
+ for (unsigned i = 0; i < colCount; i++) {
+ // For each rect, we clip to the rect, and then we adjust our coords.
+ IntRect colRect = colRects->at(i);
+ int currXOffset = colRect.x() - (columnBlock->borderLeft() + columnBlock->paddingLeft());
+ colRect.move(layerX, layerY);
+
+ IntRect localDirtyRect(paintDirtyRect);
+ localDirtyRect.intersect(colRect);
+
+ if (!localDirtyRect.isEmpty()) {
+ context->save();
+
+ // Each strip pushes a clip, since column boxes are specified as being
+ // like overflow:hidden.
+ context->clip(colRect);
+
+ if (!colIndex) {
+ // Apply a translation transform to change where the layer paints.
+ TransformationMatrix oldTransform;
+ bool oldHasTransform = childLayer->transform();
+ if (oldHasTransform)
+ oldTransform = *childLayer->transform();
+ TransformationMatrix newTransform(oldTransform);
+ newTransform.translateRight(currXOffset, currYOffset);
+
+ childLayer->m_transform.set(new TransformationMatrix(newTransform));
+ childLayer->paintLayer(rootLayer, context, localDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, paintFlags);
+ if (oldHasTransform)
+ childLayer->m_transform.set(new TransformationMatrix(oldTransform));
+ else
+ childLayer->m_transform.clear();
+ } else {
+ // Adjust the transform such that the renderer's upper left corner will paint at (0,0) in user space.
+ // This involves subtracting out the position of the layer in our current coordinate space.
+ int childX = 0;
+ int childY = 0;
+ columnLayers[colIndex - 1]->convertToLayerCoords(rootLayer, childX, childY);
+ TransformationMatrix transform;
+ transform.translateRight(childX + currXOffset, childY + currYOffset);
+
+ // Apply the transform.
+ context->concatCTM(transform.toAffineTransform());
+
+ // Now do a paint with the root layer shifted to be the next multicol block.
+ paintChildLayerIntoColumns(childLayer, columnLayers[colIndex - 1], context, transform.inverse().mapRect(localDirtyRect), paintBehavior,
+ paintingRoot, overlapTestRequests, paintFlags,
+ columnLayers, colIndex - 1);
+ }
+
+ context->restore();
+ }
+
+ // Move to the next position.
+ currYOffset -= colRect.height();
+ }
+}
+
static inline IntRect frameVisibleRect(RenderObject* renderer)
{
FrameView* frameView = renderer->document()->view();
@@ -2585,8 +2729,8 @@ static bool isHitCandidate(const RenderLayer* hitLayer, bool canDepthSort, doubl
// If zOffset is non-null (which indicates that the caller wants z offset information),
// *zOffset on return is the z offset of the hit point relative to the containing flattening layer.
RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
- const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
- const HitTestingTransformState* transformState, double* zOffset)
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
+ const HitTestingTransformState* transformState, double* zOffset)
{
// The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate.
@@ -2700,6 +2844,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
RenderLayer* candidateLayer = 0;
// Begin by walking our list of positive layers from highest z-index down to the lowest z-index.
+<<<<<<< HEAD
if (m_posZOrderList) {
for (int i = m_posZOrderList->size() - 1; i >= 0; --i) {
#ifdef ANDROID_HITTEST_WITHSIZE
@@ -2750,6 +2895,23 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
candidateLayer = hitLayer;
}
}
+=======
+ RenderLayer* hitLayer = hitTestList(m_posZOrderList, rootLayer, request, result, hitTestRect, hitTestPoint,
+ localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
+ if (hitLayer) {
+ if (!depthSortDescendants)
+ return hitLayer;
+ candidateLayer = hitLayer;
+ }
+
+ // Now check our overflow objects.
+ hitLayer = hitTestList(m_normalFlowList, rootLayer, request, result, hitTestRect, hitTestPoint,
+ localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
+ if (hitLayer) {
+ if (!depthSortDescendants)
+ return hitLayer;
+ candidateLayer = hitLayer;
+>>>>>>> webkit.org at r60074
}
// Next we want to see if the mouse pos is inside the child RenderObjects of the layer.
@@ -2784,6 +2946,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
}
// Now check our negative z-index children.
+<<<<<<< HEAD
if (m_negZOrderList) {
for (int i = m_negZOrderList->size() - 1; i >= 0; --i) {
#ifdef ANDROID_HITTEST_WITHSIZE
@@ -2807,8 +2970,16 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
candidateLayer = hitLayer;
}
}
+=======
+ hitLayer = hitTestList(m_negZOrderList, rootLayer, request, result, hitTestRect, hitTestPoint,
+ localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
+ if (hitLayer) {
+ if (!depthSortDescendants)
+ return hitLayer;
+ candidateLayer = hitLayer;
+>>>>>>> webkit.org at r60074
}
-
+
// If we found a layer, return. Child layers, and foreground always render in front of background.
if (candidateLayer)
return candidateLayer;
@@ -2865,6 +3036,127 @@ bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult&
return true;
}
+RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* rootLayer,
+ const HitTestRequest& request, HitTestResult& result,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+ const HitTestingTransformState* transformState,
+ double* zOffsetForDescendants, double* zOffset,
+ const HitTestingTransformState* unflattenedTransformState,
+ bool depthSortDescendants)
+{
+ if (!list)
+ return 0;
+
+ RenderLayer* resultLayer = 0;
+ for (int i = list->size() - 1; i >= 0; --i) {
+ RenderLayer* childLayer = list->at(i);
+ RenderLayer* hitLayer = 0;
+ HitTestResult tempResult(result.point());
+ if (childLayer->isPaginated())
+ hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestPoint, transformState, zOffsetForDescendants);
+ else
+ hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempResult, hitTestRect, hitTestPoint, false, transformState, zOffsetForDescendants);
+ if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) {
+ resultLayer = hitLayer;
+ result = tempResult;
+ if (!depthSortDescendants)
+ break;
+ }
+ }
+
+ return resultLayer;
+}
+
+RenderLayer* RenderLayer::hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset)
+{
+ ASSERT(!renderer()->isPositioned());
+ Vector<RenderLayer*> columnLayers;
+ RenderLayer* ancestorLayer = isNormalFlowOnly() ? parent() : stackingContext();
+ for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) {
+ if (curr->renderer()->hasColumns())
+ columnLayers.append(curr);
+ if (curr == ancestorLayer || (curr->parent() && curr->parent()->renderer()->isPositioned()))
+ break;
+ }
+
+ ASSERT(columnLayers.size());
+ return hitTestChildLayerColumns(childLayer, rootLayer, request, result, hitTestRect, hitTestPoint, transformState, zOffset,
+ columnLayers, columnLayers.size() - 1);
+}
+
+RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset,
+ const Vector<RenderLayer*>& columnLayers, size_t columnIndex)
+{
+ RenderBlock* columnBlock = toRenderBlock(columnLayers[columnIndex]->renderer());
+
+ ASSERT(columnBlock && columnBlock->hasColumns());
+ if (!columnBlock || !columnBlock->hasColumns())
+ return 0;
+
+ int layerX = 0;
+ int layerY = 0;
+ columnBlock->layer()->convertToLayerCoords(rootLayer, layerX, layerY);
+
+ Vector<IntRect>* colRects = columnBlock->columnRects();
+ int colCount = colRects->size();
+
+ // We have to go backwards from the last column to the first.
+ int left = columnBlock->borderLeft() + columnBlock->paddingLeft();
+ int currYOffset = 0;
+ int i;
+ for (i = 0; i < colCount; i++)
+ currYOffset -= colRects->at(i).height();
+ for (i = colCount - 1; i >= 0; i--) {
+ // For each rect, we clip to the rect, and then we adjust our coords.
+ IntRect colRect = colRects->at(i);
+ int currXOffset = colRect.x() - left;
+ currYOffset += colRect.height();
+ colRect.move(layerX, layerY);
+
+ IntRect localClipRect(hitTestRect);
+ localClipRect.intersect(colRect);
+
+ if (!localClipRect.isEmpty() && localClipRect.contains(hitTestPoint)) {
+ RenderLayer* hitLayer = 0;
+ if (!columnIndex) {
+ // Apply a translation transform to change where the layer paints.
+ TransformationMatrix oldTransform;
+ bool oldHasTransform = childLayer->transform();
+ if (oldHasTransform)
+ oldTransform = *childLayer->transform();
+ TransformationMatrix newTransform(oldTransform);
+ newTransform.translateRight(currXOffset, currYOffset);
+
+ childLayer->m_transform.set(new TransformationMatrix(newTransform));
+ hitLayer = childLayer->hitTestLayer(rootLayer, columnLayers[0], request, result, localClipRect, hitTestPoint, false, transformState, zOffset);
+ if (oldHasTransform)
+ childLayer->m_transform.set(new TransformationMatrix(oldTransform));
+ else
+ childLayer->m_transform.clear();
+ } else {
+ // Adjust the transform such that the renderer's upper left corner will be at (0,0) in user space.
+ // This involves subtracting out the position of the layer in our current coordinate space.
+ RenderLayer* nextLayer = columnLayers[columnIndex - 1];
+ RefPtr<HitTestingTransformState> newTransformState = nextLayer->createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestPoint, transformState);
+ newTransformState->translate(currXOffset, currYOffset, HitTestingTransformState::AccumulateTransform);
+ IntPoint localPoint = roundedIntPoint(newTransformState->mappedPoint());
+ IntRect localHitTestRect = newTransformState->mappedQuad().enclosingBoundingBox();
+ newTransformState->flatten();
+
+ hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[columnIndex - 1], request, result, localHitTestRect, localPoint,
+ newTransformState.get(), zOffset, columnLayers, columnIndex - 1);
+ }
+
+ if (hitLayer)
+ return hitLayer;
+ }
+ }
+
+ return 0;
+}
+
void RenderLayer::updateClipRects(const RenderLayer* rootLayer)
{
if (m_clipRects) {
diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h
index 746c6fa..f300d76 100644
--- a/WebCore/rendering/RenderLayer.h
+++ b/WebCore/rendering/RenderLayer.h
@@ -303,6 +303,7 @@ public:
CheckForRepaint = 1 << 1,
IsCompositingUpdateRoot = 1 << 2,
UpdateCompositingLayers = 1 << 3,
+ UpdatePagination = 1 << 4
};
typedef unsigned UpdateLayerPositionsFlags;
void updateLayerPositions(UpdateLayerPositionsFlags = DoFullRepaint | IsCompositingUpdateRoot | UpdateCompositingLayers, IntPoint* cachedOffset = 0);
@@ -486,12 +487,35 @@ private:
void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
PaintBehavior, RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* = 0,
- PaintLayerFlags paintFlags = 0);
+ PaintLayerFlags = 0);
+ void paintList(Vector<RenderLayer*>*, RenderLayer* rootLayer, GraphicsContext* p,
+ const IntRect& paintDirtyRect, PaintBehavior,
+ RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap*,
+ PaintLayerFlags);
+ void paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*,
+ const IntRect& paintDirtyRect, PaintBehavior,
+ RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap*,
+ PaintLayerFlags);
+ void paintChildLayerIntoColumns(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*,
+ const IntRect& paintDirtyRect, PaintBehavior,
+ RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap*,
+ PaintLayerFlags, const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
- const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
- const HitTestingTransformState* transformState = 0, double* zOffset = 0);
-
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
+ const HitTestingTransformState* transformState = 0, double* zOffset = 0);
+ RenderLayer* hitTestList(Vector<RenderLayer*>*, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+ const HitTestingTransformState* transformState, double* zOffsetForDescendants, double* zOffset,
+ const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
+ RenderLayer* hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+ const HitTestingTransformState* transformState, double* zOffset);
+ RenderLayer* hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+ const HitTestingTransformState* transformState, double* zOffset,
+ const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
+
PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
const IntRect& hitTestRect, const IntPoint& hitTestPoint,
const HitTestingTransformState* containerTransformState) const;
@@ -548,6 +572,9 @@ private:
void updateScrollCornerStyle();
void updateResizerStyle();
+ void updatePagination();
+ bool isPaginated() const { return m_isPaginated; }
+
#if USE(ACCELERATED_COMPOSITING)
bool hasCompositingDescendant() const { return m_hasCompositingDescendant; }
void setHasCompositingDescendant(bool b) { m_hasCompositingDescendant = b; }
@@ -641,6 +668,8 @@ protected:
bool m_visibleDescendantStatusDirty : 1;
bool m_hasVisibleDescendant : 1;
+ bool m_isPaginated : 1; // If we think this layer is split by a multi-column ancestor, then this bit will be set.
+
bool m_3DTransformedDescendantStatusDirty : 1;
bool m_has3DTransformedDescendant : 1; // Set on a stacking context layer that has 3D descendants anywhere
// in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index 4957265..97c5544 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -62,7 +62,7 @@ namespace WebCore {
using namespace HTMLNames;
static bool hasBorderOutlineOrShadow(const RenderStyle*);
-static bool hasBoxDecorationsOrBackground(const RenderStyle*);
+static bool hasBoxDecorationsOrBackground(const RenderObject*);
static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*);
static inline bool is3DCanvas(RenderObject* renderer)
@@ -96,19 +96,7 @@ void RenderLayerBacking::createGraphicsLayer()
m_graphicsLayer = GraphicsLayer::create(this);
#ifndef NDEBUG
- if (renderer()->node()) {
- if (renderer()->node()->isDocumentNode())
- m_graphicsLayer->setName("Document Node");
- else {
- if (renderer()->node()->isHTMLElement() && renderer()->node()->hasID())
- m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->getIDAttribute());
- else
- m_graphicsLayer->setName(renderer()->renderName());
- }
- } else if (m_owningLayer->isReflection())
- m_graphicsLayer->setName("Reflection");
- else
- m_graphicsLayer->setName("Anonymous Node");
+ m_graphicsLayer->setName(nameForLayer());
#endif // NDEBUG
updateLayerOpacity(renderer()->style());
@@ -466,7 +454,7 @@ bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
if (!m_foregroundLayer) {
m_foregroundLayer = GraphicsLayer::create(this);
#ifndef NDEBUG
- m_foregroundLayer->setName("Foreground");
+ m_foregroundLayer->setName(nameForLayer() + " (foreground)");
#endif
m_foregroundLayer->setDrawsContent(true);
m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
@@ -545,9 +533,9 @@ static bool hasBorderOutlineOrShadow(const RenderStyle* style)
return style->hasBorder() || style->hasBorderRadius() || style->hasOutline() || style->hasAppearance() || style->boxShadow();
}
-static bool hasBoxDecorationsOrBackground(const RenderStyle* style)
+static bool hasBoxDecorationsOrBackground(const RenderObject* renderer)
{
- return hasBorderOutlineOrShadow(style) || style->hasBackground();
+ return hasBorderOutlineOrShadow(renderer->style()) || renderer->hasBackground();
}
static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle* style)
@@ -563,36 +551,32 @@ bool RenderLayerBacking::rendererHasBackground() const
if (!htmlObject)
return false;
- RenderStyle* style = htmlObject->style();
- if (style->hasBackground())
+ if (htmlObject->hasBackground())
return true;
RenderObject* bodyObject = htmlObject->firstChild();
if (!bodyObject)
return false;
- style = bodyObject->style();
- return style->hasBackground();
+ return bodyObject->hasBackground();
}
- return renderer()->style()->hasBackground();
+ return renderer()->hasBackground();
}
-const Color& RenderLayerBacking::rendererBackgroundColor() const
+const Color RenderLayerBacking::rendererBackgroundColor() const
{
// FIXME: share more code here
if (renderer()->node() && renderer()->node()->isDocumentNode()) {
RenderObject* htmlObject = renderer()->firstChild();
- RenderStyle* style = htmlObject->style();
- if (style->hasBackground())
- return style->backgroundColor();
+ if (htmlObject->hasBackground())
+ return htmlObject->style()->visitedDependentColor(CSSPropertyBackgroundColor);
RenderObject* bodyObject = htmlObject->firstChild();
- style = bodyObject->style();
- return style->backgroundColor();
+ return bodyObject->style()->visitedDependentColor(CSSPropertyBackgroundColor);
}
- return renderer()->style()->backgroundColor();
+ return renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
}
// A "simple container layer" is a RenderLayer which has no visible content to render.
@@ -610,7 +594,7 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
// Reject anything that has a border, a border-radius or outline,
// or any background (color or image).
// FIXME: we could optimize layers for simple backgrounds.
- if (hasBoxDecorationsOrBackground(style))
+ if (hasBoxDecorationsOrBackground(renderObject))
return false;
// If we have got this far and the renderer has no children, then we're ok.
@@ -720,7 +704,7 @@ bool RenderLayerBacking::containsPaintedContent() const
// FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
// and set background color on the layer in that case, instead of allocating backing store and painting.
if (renderer()->isVideo() || is3DCanvas(renderer()))
- return hasBoxDecorationsOrBackground(renderer()->style());
+ return hasBoxDecorationsOrBackground(renderer());
return true;
}
@@ -730,7 +714,7 @@ bool RenderLayerBacking::containsPaintedContent() const
bool RenderLayerBacking::isDirectlyCompositedImage() const
{
RenderObject* renderObject = renderer();
- return renderObject->isImage() && !hasBoxDecorationsOrBackground(renderObject->style());
+ return renderObject->isImage() && !hasBoxDecorationsOrBackground(renderObject);
}
void RenderLayerBacking::rendererContentChanged()
@@ -1262,6 +1246,25 @@ AnimatedPropertyID RenderLayerBacking::cssToGraphicsLayerProperty(int cssPropert
return AnimatedPropertyInvalid;
}
+#ifndef NDEBUG
+String RenderLayerBacking::nameForLayer() const
+{
+ String name = renderer()->renderName();
+ if (Node* node = renderer()->node()) {
+ if (node->isElementNode())
+ name += " " + static_cast<Element *>(node)->tagName();
+
+ if (node->isHTMLElement() && static_cast<HTMLElement *>(node)->hasID())
+ name += " \'" + static_cast<Element *>(node)->getIDAttribute() + "\'";
+ }
+
+ if (m_owningLayer->isReflection())
+ name += " (reflection)";
+
+ return name;
+}
+#endif
+
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h
index ff8c76c..faa553c 100644
--- a/WebCore/rendering/RenderLayerBacking.h
+++ b/WebCore/rendering/RenderLayerBacking.h
@@ -159,7 +159,7 @@ private:
void updateImageContents();
bool rendererHasBackground() const;
- const Color& rendererBackgroundColor() const;
+ const Color rendererBackgroundColor() const;
bool hasNonCompositingContent() const;
@@ -169,6 +169,10 @@ private:
static int graphicsLayerToCSSProperty(AnimatedPropertyID);
static AnimatedPropertyID cssToGraphicsLayerProperty(int);
+#ifndef NDEBUG
+ String nameForLayer() const;
+#endif
+
private:
RenderLayer* m_owningLayer;
diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp
index 68591d6..1c21af4 100644
--- a/WebCore/rendering/RenderListBox.cpp
+++ b/WebCore/rendering/RenderListBox.cpp
@@ -312,7 +312,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, in
if (!itemStyle)
itemStyle = style();
- Color textColor = element->renderStyle() ? element->renderStyle()->color() : style()->color();
+ Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor);
if (optionElement && optionElement->selected()) {
if (document()->frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node())
textColor = theme()->activeListBoxSelectionForegroundColor();
@@ -355,7 +355,7 @@ void RenderListBox::paintItemBackground(PaintInfo& paintInfo, int tx, int ty, in
else
backColor = theme()->inactiveListBoxSelectionBackgroundColor();
} else
- backColor = element->renderStyle() ? element->renderStyle()->backgroundColor() : style()->backgroundColor();
+ backColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyBackgroundColor) : style()->visitedDependentColor(CSSPropertyBackgroundColor);
// Draw the background for this list box item
if (!element->renderStyle() || element->renderStyle()->visibility() != HIDDEN) {
diff --git a/WebCore/rendering/RenderListItem.h b/WebCore/rendering/RenderListItem.h
index 2ad9a41..13d81f2 100644
--- a/WebCore/rendering/RenderListItem.h
+++ b/WebCore/rendering/RenderListItem.h
@@ -65,6 +65,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
void updateMarkerLocation();
inline int calcValue() const;
void updateValueNow() const;
diff --git a/WebCore/rendering/RenderListMarker.cpp b/WebCore/rendering/RenderListMarker.cpp
index d0353ee..e148c81 100644
--- a/WebCore/rendering/RenderListMarker.cpp
+++ b/WebCore/rendering/RenderListMarker.cpp
@@ -101,8 +101,10 @@ static inline String toAlphabeticOrNumeric(int number, const UChar* sequence, in
int length = 1;
if (type == AlphabeticSequence) {
- while ((numberShadow /= sequenceSize) > 0)
- letters[lettersSize - ++length] = sequence[numberShadow % sequenceSize - 1];
+ while ((numberShadow /= sequenceSize) > 0) {
+ --numberShadow;
+ letters[lettersSize - ++length] = sequence[numberShadow % sequenceSize];
+ }
} else {
while ((numberShadow /= sequenceSize) > 0)
letters[lettersSize - ++length] = sequence[numberShadow % sequenceSize];
@@ -1007,7 +1009,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
context->fillRect(selRect, selectionBackgroundColor(), style()->colorSpace());
}
- const Color color(style()->color());
+ const Color color(style()->visitedDependentColor(CSSPropertyColor));
context->setStrokeColor(color, style()->colorSpace());
context->setStrokeStyle(SolidStroke);
context->setStrokeThickness(1.0f);
diff --git a/WebCore/rendering/RenderMedia.h b/WebCore/rendering/RenderMedia.h
index 0d24c4c..32d6d65 100644
--- a/WebCore/rendering/RenderMedia.h
+++ b/WebCore/rendering/RenderMedia.h
@@ -118,6 +118,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
RefPtr<HTMLElement> m_controlsShadowRoot;
RefPtr<MediaControlElement> m_panel;
RefPtr<MediaControlMuteButtonElement> m_muteButton;
diff --git a/WebCore/rendering/RenderMediaControlsChromium.cpp b/WebCore/rendering/RenderMediaControlsChromium.cpp
index 50feb46..ede3d11 100644
--- a/WebCore/rendering/RenderMediaControlsChromium.cpp
+++ b/WebCore/rendering/RenderMediaControlsChromium.cpp
@@ -99,6 +99,12 @@ static bool paintMediaPlayButton(RenderObject* object, const RenderObject::Paint
return paintMediaButton(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause);
}
+static Image* getMediaSliderThumb()
+{
+ static Image* mediaSliderThumb = platformResource("mediaSliderThumb");
+ return mediaSliderThumb;
+}
+
static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
{
HTMLMediaElement* mediaElement = toParentMediaElement(object);
@@ -114,9 +120,9 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo
context->save();
context->setShouldAntialias(true);
context->setStrokeStyle(SolidStroke);
- context->setStrokeColor(style->borderLeftColor(), DeviceColorSpace);
+ context->setStrokeColor(style->visitedDependentColor(CSSPropertyBorderLeftColor), DeviceColorSpace);
context->setStrokeThickness(style->borderLeftWidth());
- context->setFillColor(style->backgroundColor(), DeviceColorSpace);
+ context->setFillColor(style->visitedDependentColor(CSSPropertyBackgroundColor), DeviceColorSpace);
context->drawRect(rect);
context->restore();
@@ -124,7 +130,18 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo
// FIXME: Draw multiple ranges if there are multiple buffered ranges.
IntRect bufferedRect = rect;
bufferedRect.inflate(-style->borderLeftWidth());
- bufferedRect.setWidth((bufferedRect.width() * mediaElement->percentLoaded()));
+
+ double bufferedWidth = 0.0;
+ if (mediaElement->percentLoaded() > 0.0) {
+ // Account for the width of the slider thumb.
+ Image* mediaSliderThumb = getMediaSliderThumb();
+ double thumbWidth = mediaSliderThumb->width() / 2.0 + 1.0;
+ double rectWidth = bufferedRect.width() - thumbWidth;
+ if (rectWidth < 0.0)
+ rectWidth = 0.0;
+ bufferedWidth = rectWidth * mediaElement->percentLoaded() + thumbWidth;
+ }
+ bufferedRect.setWidth(bufferedWidth);
// Don't bother drawing an empty area.
if (!bufferedRect.isEmpty()) {
@@ -133,7 +150,7 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo
sliderTopRight.move(0, bufferedRect.height());
RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight);
- Color startColor = object->style()->color();
+ Color startColor = object->style()->visitedDependentColor(CSSPropertyColor);
gradient->addColorStop(0.0, startColor);
gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha()));
@@ -159,7 +176,7 @@ static bool paintMediaSliderThumb(RenderObject* object, const RenderObject::Pain
if (!hasSource(mediaElement))
return true;
- static Image* mediaSliderThumb = platformResource("mediaSliderThumb");
+ Image* mediaSliderThumb = getMediaSliderThumb();
return paintMediaButton(paintInfo.context, rect, mediaSliderThumb);
}
@@ -207,13 +224,13 @@ static bool paintMediaTimelineContainer(RenderObject* object, const RenderObject
// Draw the left border using CSS defined width and color.
context->setStrokeThickness(object->style()->borderLeftWidth());
- context->setStrokeColor(object->style()->borderLeftColor().rgb(), DeviceColorSpace);
+ context->setStrokeColor(object->style()->visitedDependentColor(CSSPropertyBorderLeftColor).rgb(), DeviceColorSpace);
context->drawLine(IntPoint(rect.x() + 1, rect.y()),
IntPoint(rect.x() + 1, rect.y() + rect.height()));
// Draw the right border using CSS defined width and color.
context->setStrokeThickness(object->style()->borderRightWidth());
- context->setStrokeColor(object->style()->borderRightColor().rgb(), DeviceColorSpace);
+ context->setStrokeColor(object->style()->visitedDependentColor(CSSPropertyBorderRightColor).rgb(), DeviceColorSpace);
context->drawLine(IntPoint(rect.x() + rect.width() - 1, rect.y()),
IntPoint(rect.x() + rect.width() - 1, rect.y() + rect.height()));
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index e2c6fd5..871c10f 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -409,7 +409,7 @@ PopupMenuStyle RenderMenuList::itemStyle(unsigned listIndex) const
Element* element = listItems[listIndex];
RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
- return style ? PopupMenuStyle(style->color(), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE, style->textIndent(), style->direction()) : menuStyle();
+ return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE, style->textIndent(), style->direction()) : menuStyle();
}
Color RenderMenuList::itemBackgroundColor(unsigned listIndex) const
@@ -417,18 +417,18 @@ Color RenderMenuList::itemBackgroundColor(unsigned listIndex) const
SelectElement* select = toSelectElement(static_cast<Element*>(node()));
const Vector<Element*>& listItems = select->listItems();
if (listIndex >= listItems.size())
- return style()->backgroundColor();
+ return style()->visitedDependentColor(CSSPropertyBackgroundColor);
Element* element = listItems[listIndex];
Color backgroundColor;
if (element->renderStyle())
- backgroundColor = element->renderStyle()->backgroundColor();
+ backgroundColor = element->renderStyle()->visitedDependentColor(CSSPropertyBackgroundColor);
// If the item has an opaque background color, return that.
if (!backgroundColor.hasAlpha())
return backgroundColor;
// Otherwise, the item's background is overlayed on top of the menu background.
- backgroundColor = style()->backgroundColor().blend(backgroundColor);
+ backgroundColor = style()->visitedDependentColor(CSSPropertyBackgroundColor).blend(backgroundColor);
if (!backgroundColor.hasAlpha())
return backgroundColor;
@@ -439,7 +439,7 @@ Color RenderMenuList::itemBackgroundColor(unsigned listIndex) const
PopupMenuStyle RenderMenuList::menuStyle() const
{
RenderStyle* s = m_innerBlock ? m_innerBlock->style() : style();
- return PopupMenuStyle(s->color(), s->backgroundColor(), s->font(), s->visibility() == VISIBLE, s->textIndent(), s->direction());
+ return PopupMenuStyle(s->visitedDependentColor(CSSPropertyColor), s->visitedDependentColor(CSSPropertyBackgroundColor), s->font(), s->visibility() == VISIBLE, s->textIndent(), s->direction());
}
HostWindow* RenderMenuList::hostWindow() const
diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h
index aeb6205..5ee8588 100644
--- a/WebCore/rendering/RenderMenuList.h
+++ b/WebCore/rendering/RenderMenuList.h
@@ -78,6 +78,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
// PopupMenuClient methods
virtual String itemText(unsigned listIndex) const;
virtual String itemToolTip(unsigned listIndex) const;
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index d7df436..2893d67 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -1385,9 +1385,9 @@ Color RenderObject::selectionBackgroundColor() const
{
Color color;
if (style()->userSelect() != SELECT_NONE) {
- RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(SELECTION);
- if (pseudoStyle && pseudoStyle->backgroundColor().isValid())
- color = pseudoStyle->backgroundColor().blendWithWhite();
+ RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(SELECTION);
+ if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
+ color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite();
else
color = document()->frame()->selection()->isFocusedAndActive() ?
theme()->activeSelectionBackgroundColor() :
@@ -1404,9 +1404,9 @@ Color RenderObject::selectionForegroundColor() const
return color;
if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(SELECTION)) {
- color = pseudoStyle->textFillColor();
+ color = pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextFillColor);
if (!color.isValid())
- color = pseudoStyle->color();
+ color = pseudoStyle->visitedDependentColor(CSSPropertyColor);
} else
color = document()->frame()->selection()->isFocusedAndActive() ?
theme()->activeSelectionForegroundColor() :
@@ -2224,8 +2224,8 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co
}
}
curr = curr->parent();
- if (curr && curr->isRenderBlock() && toRenderBlock(curr)->inlineContinuation())
- curr = toRenderBlock(curr)->inlineContinuation();
+ if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuation())
+ curr = toRenderBlock(curr)->continuation();
} while (curr && decorations && (!quirksMode || !curr->node() ||
(!curr->node()->hasTagName(aTag) && !curr->node()->hasTagName(fontTag))));
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index 3fce1ee..0c3e66d 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -325,6 +325,8 @@ public:
bool cellWidthChanged() const { return m_cellWidthChanged; }
void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
+ virtual bool requiresForcedStyleRecalcPropagation() const { return false; }
+
#if ENABLE(MATHML)
virtual bool isRenderMathMLBlock() const { return false; }
#endif // ENABLE(MATHML)
@@ -384,7 +386,11 @@ public:
{
return m_isAnonymous && style()->display() == BLOCK && style()->styleType() == NOPSEUDO && !isListMarker();
}
- bool isInlineContinuation() const { return (node() ? node()->renderer() != this : false) && isRenderInline(); }
+ bool isElementContinuation() const { return node() && node()->renderer() != this; }
+ bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); }
+ bool isBlockElementContinuation() const { return isElementContinuation() && !isInline(); }
+ virtual RenderBoxModelObject* virtualContinuation() const { return 0; }
+
bool isFloating() const { return m_floating; }
bool isPositioned() const { return m_positioned; } // absolute or fixed positioning
bool isRelPositioned() const { return m_relPositioned; } // relative positioning
@@ -399,6 +405,13 @@ public:
bool hasBoxDecorations() const { return m_paintBackground; }
bool mustRepaintBackgroundOrBorder() const;
+ bool hasBackground() const
+ {
+ Color color = style()->visitedDependentColor(CSSPropertyBackgroundColor);
+ if (color.isValid() && color.alpha() > 0)
+ return true;
+ return style()->hasBackgroundImage();
+ }
bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout || m_needsPositionedMovementLayout; }
bool selfNeedsLayout() const { return m_needsLayout; }
@@ -422,7 +435,6 @@ public:
void drawArcForBoxSide(GraphicsContext*, int x, int y, float thickness, IntSize radius, int angleStart,
int angleSpan, BoxSide, Color, EBorderStyle, bool firstCorner);
-public:
// The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect
// any pseudo classes (and therefore has no concept of changing state).
RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;
@@ -870,7 +882,7 @@ private:
bool m_isDragging : 1;
bool m_hasLayer : 1;
- bool m_hasOverflowClip : 1;
+ bool m_hasOverflowClip : 1; // Set in the case of overflow:auto/scroll/hidden
bool m_hasTransform : 1;
bool m_hasReflection : 1;
diff --git a/WebCore/rendering/RenderObjectChildList.cpp b/WebCore/rendering/RenderObjectChildList.cpp
index 6d76f34..aa8f50f 100644
--- a/WebCore/rendering/RenderObjectChildList.cpp
+++ b/WebCore/rendering/RenderObjectChildList.cpp
@@ -340,12 +340,12 @@ void RenderObjectChildList::updateBeforeAfterContent(RenderObject* owner, Pseudo
// For <q><p/></q>, if this object is the inline continuation of the <q>, we only want to generate
// :after content and not :before content.
- if (newContentWanted && type == BEFORE && owner->isRenderInline() && toRenderInline(owner)->isInlineContinuation())
+ if (newContentWanted && type == BEFORE && owner->isElementContinuation())
newContentWanted = false;
// Similarly, if we're the beginning of a <q>, and there's an inline continuation for our object,
// then we don't generate the :after content.
- if (newContentWanted && type == AFTER && owner->isRenderInline() && toRenderInline(owner)->continuation())
+ if (newContentWanted && type == AFTER && owner->virtualContinuation())
newContentWanted = false;
// If we don't want generated content any longer, or if we have generated content, but it's no longer
diff --git a/WebCore/rendering/RenderProgress.h b/WebCore/rendering/RenderProgress.h
index 2070974..1137e99 100644
--- a/WebCore/rendering/RenderProgress.h
+++ b/WebCore/rendering/RenderProgress.h
@@ -36,6 +36,8 @@ public:
double position() const { return m_position; }
double animationProgress() const;
+ double animationStartTime() const { return m_animationStartTime; }
+
bool isDeterminate() const;
HTMLProgressElement* progressElement() const;
@@ -48,6 +50,8 @@ private:
virtual void paint(PaintInfo&, int tx, int ty);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
void animationTimerFired(Timer<RenderProgress>*);
void updateAnimationState();
void updateValuePartState();
diff --git a/WebCore/rendering/RenderRubyBase.cpp b/WebCore/rendering/RenderRubyBase.cpp
index 9b2dc9e..b088937 100644
--- a/WebCore/rendering/RenderRubyBase.cpp
+++ b/WebCore/rendering/RenderRubyBase.cpp
@@ -118,7 +118,7 @@ void RenderRubyBase::moveBlockChildren(RenderRubyBase* toBase, RenderObject* fro
if (child->isAnonymousBlock()) {
RenderBlock* anonBlock = toRenderBlock(child);
ASSERT(anonBlock->childrenInline());
- ASSERT(!anonBlock->inlineContinuation());
+ ASSERT(!anonBlock->inlineElementContinuation());
anonBlock->moveAllChildrenTo(toBase, toBase->children());
anonBlock->deleteLineBoxTree();
anonBlock->destroy();
@@ -145,7 +145,7 @@ void RenderRubyBase::moveBlockChildren(RenderRubyBase* toBase, RenderObject* fro
RenderBlock* anonBlock = toRenderBlock(child);
ASSERT(anonBlock->childrenInline());
- ASSERT(!anonBlock->inlineContinuation());
+ ASSERT(!anonBlock->inlineElementContinuation());
// Move inline children out of anonymous block.
anonBlock->moveAllChildrenTo(this, children(), anonBlock);
anonBlock->deleteLineBoxTree();
diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp
index 821e58a..129d800 100644
--- a/WebCore/rendering/RenderSVGResource.cpp
+++ b/WebCore/rendering/RenderSVGResource.cpp
@@ -44,7 +44,7 @@ static inline void registerPendingResource(const AtomicString& id, const SVGPain
object->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement));
}
-static inline void adjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color)
+inline void RenderSVGResource::adjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color)
{
if (style->insideLink() != InsideVisitedLink)
return;
@@ -95,7 +95,7 @@ RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* o
Color fillColor;
if (fillPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
- fillColor = style->color();
+ fillColor = style->visitedDependentColor(CSSPropertyColor);
else
fillColor = fillPaint->color();
@@ -149,7 +149,7 @@ RenderSVGResource* RenderSVGResource::strokePaintingResource(const RenderObject*
Color strokeColor;
if (strokePaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
- strokeColor = style->color();
+ strokeColor = style->visitedDependentColor(CSSPropertyColor);
else
strokeColor = strokePaint->color();
diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h
index 4e33e55..5334025 100644
--- a/WebCore/rendering/RenderSVGResource.h
+++ b/WebCore/rendering/RenderSVGResource.h
@@ -44,6 +44,7 @@ enum RenderSVGResourceMode {
ApplyToTextMode = 1 << 3 // used in combination with ApplyTo{Fill|Stroke}Mode
};
+class Color;
class FloatRect;
class GraphicsContext;
class RenderObject;
@@ -78,6 +79,9 @@ public:
static RenderSVGResource* strokePaintingResource(const RenderObject*, const RenderStyle*);
static RenderSVGResourceSolidColor* sharedSolidPaintingResource();
+private:
+ static void adjustColorForPseudoRules(const RenderStyle*, bool useFillPaint, Color&);
+
protected:
void markForLayoutAndResourceInvalidation(RenderObject*);
};
diff --git a/WebCore/rendering/RenderSlider.h b/WebCore/rendering/RenderSlider.h
index 92ad73b..fc8ce24 100644
--- a/WebCore/rendering/RenderSlider.h
+++ b/WebCore/rendering/RenderSlider.h
@@ -58,6 +58,8 @@ namespace WebCore {
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
PassRefPtr<RenderStyle> createThumbStyle(const RenderStyle* parentStyle);
int trackSize();
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index eac5c5d..6541ccd 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -571,7 +571,7 @@ void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);
- paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), tx, ty, w, h);
+ paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h);
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);
if (style()->hasBorder() && !collapseBorders())
diff --git a/WebCore/rendering/RenderTable.h b/WebCore/rendering/RenderTable.h
index ea81d64..3d0714f 100644
--- a/WebCore/rendering/RenderTable.h
+++ b/WebCore/rendering/RenderTable.h
@@ -25,6 +25,7 @@
#ifndef RenderTable_h
#define RenderTable_h
+#include "CSSPropertyNames.h"
#include "RenderBlock.h"
#include <wtf/Vector.h>
@@ -50,7 +51,7 @@ public:
int borderTop() const;
int borderBottom() const;
- const Color& bgColor() const { return style()->backgroundColor(); }
+ const Color bgColor() const { return style()->visitedDependentColor(CSSPropertyBackgroundColor); }
int outerBorderTop() const;
int outerBorderBottom() const;
diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp
index 5779422..bce659a 100644
--- a/WebCore/rendering/RenderTableCell.cpp
+++ b/WebCore/rendering/RenderTableCell.cpp
@@ -876,7 +876,7 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, i
int w = width();
int h = height();
- Color c = backgroundObject->style()->backgroundColor();
+ Color c = backgroundObject->style()->visitedDependentColor(CSSPropertyBackgroundColor);
const FillLayer* bgLayer = backgroundObject->style()->backgroundLayers();
if (bgLayer->hasImage() || c.isValid()) {
diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp
index bede6a6..cfd6026 100644
--- a/WebCore/rendering/RenderText.cpp
+++ b/WebCore/rendering/RenderText.cpp
@@ -29,6 +29,7 @@
#include "CharacterNames.h"
#include "EllipsisBox.h"
#include "FloatQuad.h"
+#include "FontTranscoder.h"
#include "FrameView.h"
#include "InlineTextBox.h"
#include "Range.h"
@@ -139,7 +140,9 @@ bool RenderText::isWordBreak() const
void RenderText::updateNeedsTranscoding()
{
- m_needsTranscoding = document()->decoder() && document()->decoder()->encoding().backslashAsCurrencySymbol() != '\\';
+ const AtomicString& fontFamily = style()->font().family().family();
+ const TextEncoding* encoding = document()->decoder() ? &document()->decoder()->encoding() : 0;
+ m_needsTranscoding = fontTranscoder().needsTranscoding(fontFamily, encoding);
}
void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
@@ -157,6 +160,9 @@ void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
if (!oldStyle) {
updateNeedsTranscoding();
needsResetText = m_needsTranscoding;
+ } else if (oldStyle->font().needsTranscoding() != style()->font().needsTranscoding() || (style()->font().needsTranscoding() && oldStyle->font().family().family() != style()->font().family().family())) {
+ updateNeedsTranscoding();
+ needsResetText = true;
}
ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE;
@@ -252,7 +258,7 @@ void RenderText::deleteTextBoxes()
PassRefPtr<StringImpl> RenderText::originalText() const
{
Node* e = node();
- return e ? static_cast<Text*>(e)->dataImpl() : 0;
+ return (e && e->isTextNode()) ? static_cast<Text*>(e)->dataImpl() : 0;
}
void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
@@ -1036,10 +1042,12 @@ void RenderText::transformText(String& text) const
void RenderText::setTextInternal(PassRefPtr<StringImpl> text)
{
ASSERT(text);
- if (m_needsTranscoding)
- m_text = document()->displayStringModifiedByEncoding(text);
- else
- m_text = text;
+ m_text = text;
+ if (m_needsTranscoding) {
+ const AtomicString& fontFamily = style()->font().family().family();
+ const TextEncoding* encoding = document()->decoder() ? &document()->decoder()->encoding() : 0;
+ fontTranscoder().convert(m_text, fontFamily, encoding);
+ }
ASSERT(m_text);
#if ENABLE(SVG)
diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp
index 1e80ff0..deb7168 100644
--- a/WebCore/rendering/RenderTextControl.cpp
+++ b/WebCore/rendering/RenderTextControl.cpp
@@ -134,7 +134,7 @@ void RenderTextControl::adjustInnerTextStyle(const RenderStyle* startStyle, Rend
bool disabled = updateUserModifyProperty(node(), textBlockStyle);
if (disabled)
- textBlockStyle->setColor(disabledTextColor(textBlockStyle->color(), startStyle->backgroundColor()));
+ textBlockStyle->setColor(disabledTextColor(textBlockStyle->visitedDependentColor(CSSPropertyColor), startStyle->visitedDependentColor(CSSPropertyBackgroundColor)));
}
void RenderTextControl::createSubtreeIfNeeded(TextControlInnerElement* innerBlock)
diff --git a/WebCore/rendering/RenderTextControl.h b/WebCore/rendering/RenderTextControl.h
index b76d1f2..de0b21b 100644
--- a/WebCore/rendering/RenderTextControl.h
+++ b/WebCore/rendering/RenderTextControl.h
@@ -105,6 +105,8 @@ private:
virtual bool canBeProgramaticallyScrolled(bool) const { return true; }
+ virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
String finishText(Vector<UChar>&) const;
bool m_wasChangedSinceLastChangeEvent;
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index f454c63..8c8bf7f 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -799,7 +799,7 @@ PopupMenuStyle RenderTextControlSingleLine::itemStyle(unsigned) const
PopupMenuStyle RenderTextControlSingleLine::menuStyle() const
{
- return PopupMenuStyle(style()->color(), style()->backgroundColor(), style()->font(), style()->visibility() == VISIBLE, style()->textIndent(), style()->direction());
+ return PopupMenuStyle(style()->visitedDependentColor(CSSPropertyColor), style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->font(), style()->visibility() == VISIBLE, style()->textIndent(), style()->direction());
}
int RenderTextControlSingleLine::clientInsetLeft() const
diff --git a/WebCore/rendering/RenderTextFragment.cpp b/WebCore/rendering/RenderTextFragment.cpp
index 2164ae1..0556284 100644
--- a/WebCore/rendering/RenderTextFragment.cpp
+++ b/WebCore/rendering/RenderTextFragment.cpp
@@ -47,7 +47,7 @@ RenderTextFragment::RenderTextFragment(Node* node, StringImpl* str)
PassRefPtr<StringImpl> RenderTextFragment::originalText() const
{
Node* e = node();
- RefPtr<StringImpl> result = (e ? static_cast<Text*>(e)->dataImpl() : contentString());
+ RefPtr<StringImpl> result = ((e && e->isTextNode()) ? static_cast<Text*>(e)->dataImpl() : contentString());
if (result && (start() > 0 || start() < result->length()))
result = result->substring(start(), end());
return result.release();
@@ -80,7 +80,7 @@ UChar RenderTextFragment::previousCharacter() const
{
if (start()) {
Node* e = node();
- StringImpl* original = (e ? static_cast<Text*>(e)->dataImpl() : contentString());
+ StringImpl* original = ((e && e->isTextNode()) ? static_cast<Text*>(e)->dataImpl() : contentString());
if (original)
return (*original)[start() - 1];
}
diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp
index b1c23b1..7a1afda 100644
--- a/WebCore/rendering/RenderTheme.cpp
+++ b/WebCore/rendering/RenderTheme.cpp
@@ -646,7 +646,7 @@ bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& bo
// Test the style to see if the UA border and background match.
return (style->border() != border ||
*style->backgroundLayers() != background ||
- style->backgroundColor() != backgroundColor);
+ style->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor);
default:
return false;
}
diff --git a/WebCore/rendering/RenderThemeChromiumSkia.cpp b/WebCore/rendering/RenderThemeChromiumSkia.cpp
index 8b3b388..0956e38 100644
--- a/WebCore/rendering/RenderThemeChromiumSkia.cpp
+++ b/WebCore/rendering/RenderThemeChromiumSkia.cpp
@@ -308,8 +308,8 @@ static void paintButtonLike(RenderTheme* theme, RenderObject* o, const RenderObj
const int right = rect.x() + rect.width();
const int bottom = rect.y() + rect.height();
SkColor baseColor = SkColorSetARGB(0xff, 0xdd, 0xdd, 0xdd);
- if (o->style()->hasBackground())
- baseColor = o->style()->backgroundColor().rgb();
+ if (o->hasBackground())
+ baseColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
double h, s, l;
Color(baseColor).getHSL(h, s, l);
// Our standard gradient is from 0xdd to 0xf8. This is the amount of
diff --git a/WebCore/rendering/RenderThemeChromiumWin.cpp b/WebCore/rendering/RenderThemeChromiumWin.cpp
index 5d39698..cc7570c 100644
--- a/WebCore/rendering/RenderThemeChromiumWin.cpp
+++ b/WebCore/rendering/RenderThemeChromiumWin.cpp
@@ -31,6 +31,7 @@
#include "ChromiumBridge.h"
#include "CSSValueKeywords.h"
+#include "CurrentTime.h"
#include "FontSelector.h"
#include "FontUtilsChromiumWin.h"
#include "GraphicsContext.h"
@@ -615,8 +616,8 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o,
// Fallback to white if the specified color object is invalid.
// (Note ChromiumBridge::paintTextField duplicates this check).
Color backgroundColor(Color::white);
- if (o->style()->backgroundColor().isValid())
- backgroundColor = o->style()->backgroundColor();
+ if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
+ backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
// If we have background-image, don't fill the content area to expose the
// parent's background. Also, we shouldn't fill the content area if the
@@ -659,11 +660,6 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o,
// MSDN says that update intervals for the bar is 30ms.
// http://msdn.microsoft.com/en-us/library/bb760842(v=VS.85).aspx
static const double progressAnimationFrameRate = 0.033;
-// There is no documentation about the animation speed, frame-rate, nor
-// size of moving overlay of the indeterminate progress bar.
-// So we just observed real-world programs and guessed following parameters.
-static const double progressIndeterminateOverlayPixelsPerSecond = 175;
-static const int progressIndeterminateOverlayWidth = 120;
double RenderThemeChromiumWin::animationRepeatIntervalForProgressBar(RenderProgress*) const
{
@@ -672,9 +668,9 @@ double RenderThemeChromiumWin::animationRepeatIntervalForProgressBar(RenderProgr
double RenderThemeChromiumWin::animationDurationForProgressBar(RenderProgress* renderProgress) const
{
- if (renderProgress->isDeterminate())
- return 0;
- return (renderProgress->width() + progressIndeterminateOverlayWidth) / progressIndeterminateOverlayPixelsPerSecond;
+ // On Chromium Windows port, animationProgress() and associated values aren't used.
+ // So here we can return arbitrary positive value.
+ return progressAnimationFrameRate;
}
void RenderThemeChromiumWin::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const
@@ -685,26 +681,22 @@ bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const RenderObjec
{
RenderProgress* renderProgress = toRenderProgress(o);
- int valuePart;
IntRect valueRect;
if (renderProgress->isDeterminate()) {
- valuePart = PP_FILL;
int dx = r.width() * renderProgress->position();
if (renderProgress->style()->direction() == RTL)
valueRect = IntRect(r.x() + r.width() - dx, r.y(), dx, r.height());
else
valueRect = IntRect(r.x(), r.y(), dx, r.height());
} else {
- valuePart = PP_MOVEOVERLAY;
- int dx = (r.width() + progressIndeterminateOverlayWidth) * renderProgress->animationProgress() - progressIndeterminateOverlayWidth;
- valueRect = IntRect(r.x() + dx, r.y(), progressIndeterminateOverlayWidth, r.height());
+ // For indeterminate bar, valueRect is ignored and it is computed by the theme engine
+ // because the animation is a platform detail and WebKit doesn't need to know how.
+ valueRect = IntRect(0, 0, 0, 0);
}
+ double animatedSeconds = renderProgress->animationStartTime() ? WTF::currentTime() - renderProgress->animationStartTime() : 0;
ThemePainter painter(i.context, r);
- ChromiumBridge::paintProgressBar(painter.context(),
- r,
- valuePart,
- valueRect);
+ ChromiumBridge::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds);
return true;
}
diff --git a/WebCore/rendering/RenderThemeMac.mm b/WebCore/rendering/RenderThemeMac.mm
index d1a3965..f1de775 100644
--- a/WebCore/rendering/RenderThemeMac.mm
+++ b/WebCore/rendering/RenderThemeMac.mm
@@ -994,7 +994,7 @@ bool RenderThemeMac::paintMenuListButton(RenderObject* o, const RenderObject::Pa
paintInfo.context->save();
- paintInfo.context->setFillColor(o->style()->color(), o->style()->colorSpace());
+ paintInfo.context->setFillColor(o->style()->visitedDependentColor(CSSPropertyColor), o->style()->colorSpace());
paintInfo.context->setStrokeStyle(NoStroke);
FloatPoint arrow1[3];
diff --git a/WebCore/rendering/RenderThemeSafari.cpp b/WebCore/rendering/RenderThemeSafari.cpp
index 9e97079..6a62384 100644
--- a/WebCore/rendering/RenderThemeSafari.cpp
+++ b/WebCore/rendering/RenderThemeSafari.cpp
@@ -830,7 +830,7 @@ bool RenderThemeSafari::paintMenuListButton(RenderObject* o, const RenderObject:
paintInfo.context->save();
- paintInfo.context->setFillColor(o->style()->color(), DeviceColorSpace);
+ paintInfo.context->setFillColor(o->style()->visitedDependentColor(CSSPropertyColor), DeviceColorSpace);
paintInfo.context->setStrokeColor(NoStroke, DeviceColorSpace);
FloatPoint arrow[3];
diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp
index fd63c0e..cf76f0b 100644
--- a/WebCore/rendering/RenderTreeAsText.cpp
+++ b/WebCore/rendering/RenderTreeAsText.cpp
@@ -180,7 +180,7 @@ String quoteAndEscapeNonPrintables(const String& s)
return String::adopt(result);
}
-static void writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior)
+void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior)
{
ts << o.renderName();
@@ -429,7 +429,7 @@ void write(TextStream& ts, const RenderObject& o, int indent, RenderAsTextBehavi
writeIndent(ts, indent);
- writeRenderObject(ts, o, behavior);
+ RenderTreeAsText::writeRenderObject(ts, o, behavior);
ts << "\n";
if (o.isText() && !o.isBR()) {
diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h
index ecee7f9..1635e79 100644
--- a/WebCore/rendering/RenderTreeAsText.h
+++ b/WebCore/rendering/RenderTreeAsText.h
@@ -49,6 +49,14 @@ String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehavio
void write(TextStream&, const RenderObject&, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
void writeIndent(TextStream&, int indent);
+class RenderTreeAsText {
+// FIXME: This is a cheesy hack to allow easy access to RenderStyle colors. It won't be needed if we convert
+// it to use visitedDependentColor instead. (This just involves rebaselining many results though, so for now it's
+// not being done).
+public:
+static void writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior);
+};
+
// Helper function shared with SVGRenderTreeAsText
String quoteAndEscapeNonPrintables(const String&);
diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp
index 3ae272e..8bd7fef 100644
--- a/WebCore/rendering/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/SVGInlineTextBox.cpp
@@ -477,7 +477,7 @@ void SVGInlineTextBox::paintSelection(int boxStartOffset, const SVGChar& svgChar
if (startPos >= endPos)
return;
- Color textColor = style->color();
+ Color textColor = style->visitedDependentColor(CSSPropertyColor);
Color color = renderer()->selectionBackgroundColor();
if (!color.isValid() || !color.alpha())
return;
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index 8b4c563..8668780 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -433,8 +433,8 @@ static void writeRenderSVGTextBox(TextStream& ts, const RenderBlock& text)
Vector<SVGTextChunk>& chunks = const_cast<Vector<SVGTextChunk>& >(box->svgTextChunks());
ts << " at (" << text.x() << "," << text.y() << ") size " << box->width() << "x" << box->height() << " contains " << chunks.size() << " chunk(s)";
- if (text.parent() && (text.parent()->style()->color() != text.style()->color()))
- writeNameValuePair(ts, "color", text.style()->color().name());
+ if (text.parent() && (text.parent()->style()->visitedDependentColor(CSSPropertyColor) != text.style()->visitedDependentColor(CSSPropertyColor)))
+ writeNameValuePair(ts, "color", text.style()->visitedDependentColor(CSSPropertyColor).name());
}
static inline bool containsInlineTextBox(SVGTextChunk& chunk, SVGInlineTextBox* box)
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 7ef580f..220e657 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -995,42 +995,42 @@ static EBorderStyle borderStyleForColorProperty(const RenderStyle* style, int co
return borderStyle;
}
-static Color colorIncludingFallback(const RenderStyle* style, int colorProperty, EBorderStyle borderStyle)
+const Color RenderStyle::colorIncludingFallback(int colorProperty, EBorderStyle borderStyle) const
{
Color result;
switch (colorProperty) {
case CSSPropertyBackgroundColor:
- return style->backgroundColor(); // Background color doesn't fall back.
+ return backgroundColor(); // Background color doesn't fall back.
case CSSPropertyBorderLeftColor:
- result = style->borderLeftColor();
- borderStyle = style->borderLeftStyle();
+ result = borderLeftColor();
+ borderStyle = borderLeftStyle();
break;
case CSSPropertyBorderRightColor:
- result = style->borderRightColor();
- borderStyle = style->borderRightStyle();
+ result = borderRightColor();
+ borderStyle = borderRightStyle();
break;
case CSSPropertyBorderTopColor:
- result = style->borderTopColor();
- borderStyle = style->borderTopStyle();
+ result = borderTopColor();
+ borderStyle = borderTopStyle();
break;
case CSSPropertyBorderBottomColor:
- result = style->borderBottomColor();
- borderStyle = style->borderBottomStyle();
+ result = borderBottomColor();
+ borderStyle = borderBottomStyle();
break;
case CSSPropertyColor:
- result = style->color();
+ result = color();
break;
case CSSPropertyOutlineColor:
- result = style->outlineColor();
+ result = outlineColor();
break;
case CSSPropertyWebkitColumnRuleColor:
- result = style->columnRuleColor();
+ result = columnRuleColor();
break;
case CSSPropertyWebkitTextFillColor:
- result = style->textFillColor();
+ result = textFillColor();
break;
case CSSPropertyWebkitTextStrokeColor:
- result = style->textStrokeColor();
+ result = textStrokeColor();
break;
default:
ASSERT_NOT_REACHED();
@@ -1043,23 +1043,23 @@ static Color colorIncludingFallback(const RenderStyle* style, int colorProperty,
&& (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE))
result.setRGB(238, 238, 238);
else
- result = style->color();
+ result = color();
}
return result;
}
-Color RenderStyle::visitedDependentColor(int colorProperty) const
+const Color RenderStyle::visitedDependentColor(int colorProperty) const
{
EBorderStyle borderStyle = borderStyleForColorProperty(this, colorProperty);
- Color unvisitedColor = colorIncludingFallback(this, colorProperty, borderStyle);
+ Color unvisitedColor = colorIncludingFallback(colorProperty, borderStyle);
if (insideLink() != InsideVisitedLink)
return unvisitedColor;
RenderStyle* visitedStyle = getCachedPseudoStyle(VISITED_LINK);
if (!visitedStyle)
return unvisitedColor;
- Color visitedColor = colorIncludingFallback(visitedStyle, colorProperty, borderStyle);
+ Color visitedColor = visitedStyle->colorIncludingFallback(colorProperty, borderStyle);
// Take the alpha from the unvisited color, but get the RGB values from the visited color.
return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), unvisitedColor.alpha());
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 970b26a..e8f4d2f 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -32,6 +32,7 @@
#include "CSSHelper.h"
#include "CSSImageGeneratorValue.h"
#include "CSSPrimitiveValue.h"
+#include "CSSPropertyNames.h"
#include "CSSReflectionDirection.h"
#include "CSSValueList.h"
#include "CachedImage.h"
@@ -113,7 +114,13 @@ class StyleImage;
typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
class RenderStyle: public RefCounted<RenderStyle> {
- friend class CSSStyleSelector;
+ friend class AnimationBase; // Used by CSS animations. We can't allow them to animate based off visited colors.
+ friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
+ friend class CSSStyleSelector; // Sets members directly.
+ friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info.
+ friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
+ friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
+ friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors. Rebaselining would allow this to be yanked.
protected:
// The following bitfield is 32-bits long, which optimizes padding with the
@@ -341,12 +348,6 @@ public:
bool hasPadding() const { return surround->padding.nonZero(); }
bool hasOffset() const { return surround->offset.nonZero(); }
- bool hasBackground() const
- {
- if (backgroundColor().isValid() && backgroundColor().alpha() > 0)
- return true;
- return m_background->background().hasImage();
- }
bool hasBackgroundImage() const { return m_background->background().hasImage(); }
bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
bool hasAppearance() const { return appearance() != NoControlPart; }
@@ -401,19 +402,15 @@ public:
unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
- const Color& borderLeftColor() const { return surround->border.left().color(); }
bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); }
EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
- const Color& borderRightColor() const { return surround->border.right().color(); }
bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); }
EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
- const Color& borderTopColor() const { return surround->border.top().color(); }
bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); }
EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
- const Color& borderBottomColor() const { return surround->border.bottom().color(); }
bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
@@ -426,8 +423,7 @@ public:
bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
EBorderStyle outlineStyle() const { return m_background->outline().style(); }
bool outlineStyleIsAuto() const { return m_background->outline().isAuto(); }
- const Color& outlineColor() const { return m_background->outline().color(); }
-
+
EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
@@ -451,7 +447,6 @@ public:
const FontDescription& fontDescription() const { return inherited->font.fontDescription(); }
int fontSize() const { return inherited->font.pixelSize(); }
- const Color& color() const { return inherited->color; }
Length textIndent() const { return rareInheritedData->indent; }
ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
@@ -535,7 +530,6 @@ public:
return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap;
}
- const Color& backgroundColor() const { return m_background->color(); }
StyleImage* backgroundImage() const { return m_background->background().image(); }
EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
@@ -616,9 +610,7 @@ public:
}
const ShadowData* textShadow() const { return rareInheritedData->textShadow; }
- const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
- const Color& textFillColor() const { return rareInheritedData->textFillColor; }
ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
float opacity() const { return rareNonInheritedData->opacity; }
ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
@@ -664,10 +656,10 @@ public:
bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth(); }
float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
- const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
+ bool columnSpan() const { return rareNonInheritedData->m_multiCol->m_columnSpan; }
EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
@@ -1002,6 +994,7 @@ public:
void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
+ void setColumnSpan(bool b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, b); }
void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
void setColumnBreakInside(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
@@ -1120,7 +1113,7 @@ public:
unsigned childIndex() const { return m_childIndex; }
void setChildIndex(unsigned index) { m_childIndex = index; }
- Color visitedDependentColor(int colorProperty) const;
+ const Color visitedDependentColor(int colorProperty) const;
// Initial values for all the properties
static bool initialBorderCollapse() { return false; }
@@ -1200,6 +1193,7 @@ public:
static bool initialVisuallyOrdered() { return false; }
static float initialTextStrokeWidth() { return 0; }
static unsigned short initialColumnCount() { return 1; }
+ static bool initialColumnSpan() { return false; }
static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
static Length initialTransformOriginX() { return Length(50.0, Percent); }
static Length initialTransformOriginY() { return Length(50.0, Percent); }
@@ -1221,9 +1215,26 @@ public:
static const Vector<StyleDashboardRegion>& noneDashboardRegions();
#endif
+<<<<<<< HEAD
#ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
static Color initialTapHighlightColor() { return Color::tap; }
#endif
+=======
+private:
+ // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
+ const Color& borderLeftColor() const { return surround->border.left().color(); }
+ const Color& borderRightColor() const { return surround->border.right().color(); }
+ const Color& borderTopColor() const { return surround->border.top().color(); }
+ const Color& borderBottomColor() const { return surround->border.bottom().color(); }
+ const Color& backgroundColor() const { return m_background->color(); }
+ const Color& color() const { return inherited->color; }
+ const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
+ const Color& outlineColor() const { return m_background->outline().color(); }
+ const Color& textFillColor() const { return rareInheritedData->textFillColor; }
+ const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
+
+ const Color colorIncludingFallback(int colorProperty, EBorderStyle borderStyle) const;
+>>>>>>> webkit.org at r60074
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/StyleMultiColData.cpp b/WebCore/rendering/style/StyleMultiColData.cpp
index bff4fb3..3366e9f 100644
--- a/WebCore/rendering/style/StyleMultiColData.cpp
+++ b/WebCore/rendering/style/StyleMultiColData.cpp
@@ -33,6 +33,7 @@ StyleMultiColData::StyleMultiColData()
, m_autoWidth(true)
, m_autoCount(true)
, m_normalGap(true)
+ , m_columnSpan(false)
, m_breakBefore(RenderStyle::initialPageBreak())
, m_breakAfter(RenderStyle::initialPageBreak())
, m_breakInside(RenderStyle::initialPageBreak())
@@ -48,6 +49,7 @@ StyleMultiColData::StyleMultiColData(const StyleMultiColData& o)
, m_autoWidth(o.m_autoWidth)
, m_autoCount(o.m_autoCount)
, m_normalGap(o.m_normalGap)
+ , m_columnSpan(o.m_columnSpan)
, m_breakBefore(o.m_breakBefore)
, m_breakAfter(o.m_breakAfter)
, m_breakInside(o.m_breakInside)
@@ -56,10 +58,10 @@ StyleMultiColData::StyleMultiColData(const StyleMultiColData& o)
bool StyleMultiColData::operator==(const StyleMultiColData& o) const
{
- return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap &&
- m_rule == o.m_rule && m_breakBefore == o.m_breakBefore &&
- m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap &&
- m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside;
+ return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap
+ && m_rule == o.m_rule && m_breakBefore == o.m_breakBefore
+ && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
+ && m_columnSpan == o.m_columnSpan && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside;
}
} // namespace WebCore
diff --git a/WebCore/rendering/style/StyleMultiColData.h b/WebCore/rendering/style/StyleMultiColData.h
index d3fe720..9948846 100644
--- a/WebCore/rendering/style/StyleMultiColData.h
+++ b/WebCore/rendering/style/StyleMultiColData.h
@@ -57,10 +57,11 @@ public:
unsigned short m_count;
float m_gap;
BorderValue m_rule;
-
+
bool m_autoWidth : 1;
bool m_autoCount : 1;
bool m_normalGap : 1;
+ bool m_columnSpan : 1;
unsigned m_breakBefore : 2; // EPageBreak
unsigned m_breakAfter : 2; // EPageBreak
unsigned m_breakInside : 2; // EPageBreak
diff --git a/WebCore/storage/DatabaseSync.cpp b/WebCore/storage/DatabaseSync.cpp
index fd1376a..224a75d 100644
--- a/WebCore/storage/DatabaseSync.cpp
+++ b/WebCore/storage/DatabaseSync.cpp
@@ -107,6 +107,7 @@ ScriptExecutionContext* DatabaseSync::scriptExecutionContext() const
return m_scriptExecutionContext.get();
}
+} // namespace WebCore
+
#endif // ENABLE(DATABASE)
-} // namespace WebCore
diff --git a/WebCore/storage/IndexedDatabase.h b/WebCore/storage/IndexedDatabase.h
index 1e43781..6bc9b6e 100644
--- a/WebCore/storage/IndexedDatabase.h
+++ b/WebCore/storage/IndexedDatabase.h
@@ -39,6 +39,7 @@ namespace WebCore {
class Frame;
class IDBDatabase;
+class SecurityOrigin;
// This class is shared by IndexedDatabaseRequest (async) and IndexedDatabaseSync (sync).
// This is implemented by IndexedDatabaseImpl and optionally others (in order to proxy
@@ -49,7 +50,7 @@ public:
static PassRefPtr<IndexedDatabase> create();
virtual ~IndexedDatabase() { }
- virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, Frame*, ExceptionCode&) = 0;
+ virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&) = 0;
};
} // namespace WebCore
diff --git a/WebCore/storage/IndexedDatabaseImpl.cpp b/WebCore/storage/IndexedDatabaseImpl.cpp
index b3051c9..ae4fd1e 100644
--- a/WebCore/storage/IndexedDatabaseImpl.cpp
+++ b/WebCore/storage/IndexedDatabaseImpl.cpp
@@ -30,6 +30,7 @@
#include "IDBDatabase.h"
#include "IDBDatabaseError.h"
+#include "SecurityOrigin.h"
#include <wtf/Threading.h>
#include <wtf/UnusedParam.h>
@@ -50,7 +51,7 @@ IndexedDatabaseImpl::~IndexedDatabaseImpl()
{
}
-void IndexedDatabaseImpl::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, Frame*, ExceptionCode&)
+void IndexedDatabaseImpl::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&)
{
// FIXME: Write for realz.
UNUSED_PARAM(name);
diff --git a/WebCore/storage/IndexedDatabaseImpl.h b/WebCore/storage/IndexedDatabaseImpl.h
index 73edf6b..8d73694 100644
--- a/WebCore/storage/IndexedDatabaseImpl.h
+++ b/WebCore/storage/IndexedDatabaseImpl.h
@@ -39,7 +39,7 @@ public:
static PassRefPtr<IndexedDatabaseImpl> create();
virtual ~IndexedDatabaseImpl();
- virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, Frame*, ExceptionCode&);
+ virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&);
private:
IndexedDatabaseImpl();
diff --git a/WebCore/storage/IndexedDatabaseRequest.cpp b/WebCore/storage/IndexedDatabaseRequest.cpp
index 2210a8d..b549bd6 100644
--- a/WebCore/storage/IndexedDatabaseRequest.cpp
+++ b/WebCore/storage/IndexedDatabaseRequest.cpp
@@ -29,6 +29,7 @@
#include "config.h"
#include "IndexedDatabaseRequest.h"
+#include "Document.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "IDBDatabase.h"
@@ -54,7 +55,7 @@ IndexedDatabaseRequest::~IndexedDatabaseRequest()
PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(const String& name, const String& description, bool modifyDatabase, ExceptionCode& exception)
{
RefPtr<IDBRequest> request = IDBRequest::create(m_frame->document(), m_this);
- m_indexedDatabase->open(name, description, modifyDatabase, request, m_frame, exception);
+ m_indexedDatabase->open(name, description, modifyDatabase, request, m_frame->document()->securityOrigin(), m_frame, exception);
return request;
}
diff --git a/WebCore/svg/SVGAElement.cpp b/WebCore/svg/SVGAElement.cpp
index 4a1f18a..da2190b 100644
--- a/WebCore/svg/SVGAElement.cpp
+++ b/WebCore/svg/SVGAElement.cpp
@@ -25,6 +25,7 @@
#include "SVGAElement.h"
#include "Attr.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "Document.h"
#include "EventHandler.h"
@@ -33,7 +34,6 @@
#include "FrameLoader.h"
#include "FrameLoaderTypes.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "PlatformMouseEvent.h"
#include "RenderSVGInline.h"
@@ -69,7 +69,7 @@ String SVGAElement::title() const
return SVGStyledElement::title();
}
-void SVGAElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::targetAttr)
setTargetBaseValue(attr->value());
diff --git a/WebCore/svg/SVGAElement.h b/WebCore/svg/SVGAElement.h
index 36046d3..d9d7fa7 100644
--- a/WebCore/svg/SVGAElement.h
+++ b/WebCore/svg/SVGAElement.h
@@ -44,7 +44,7 @@ namespace WebCore {
virtual String title() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGAnimateMotionElement.cpp b/WebCore/svg/SVGAnimateMotionElement.cpp
index 868a48d..9a0da7f 100644
--- a/WebCore/svg/SVGAnimateMotionElement.cpp
+++ b/WebCore/svg/SVGAnimateMotionElement.cpp
@@ -26,7 +26,7 @@
#if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
#include "SVGAnimateMotionElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderObject.h"
#include "SVGElementInstance.h"
#include "SVGMPathElement.h"
@@ -83,7 +83,7 @@ bool SVGAnimateMotionElement::hasValidTarget() const
return false;
}
-void SVGAnimateMotionElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAnimateMotionElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::pathAttr) {
m_path = Path();
diff --git a/WebCore/svg/SVGAnimateMotionElement.h b/WebCore/svg/SVGAnimateMotionElement.h
index f401220..385e3b3 100644
--- a/WebCore/svg/SVGAnimateMotionElement.h
+++ b/WebCore/svg/SVGAnimateMotionElement.h
@@ -36,7 +36,7 @@ namespace WebCore {
virtual bool hasValidTarget() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
private:
virtual void resetToBaseValue(const String&);
diff --git a/WebCore/svg/SVGAnimateTransformElement.cpp b/WebCore/svg/SVGAnimateTransformElement.cpp
index 96485a6..1a305bb 100644
--- a/WebCore/svg/SVGAnimateTransformElement.cpp
+++ b/WebCore/svg/SVGAnimateTransformElement.cpp
@@ -28,10 +28,11 @@
#include "SVGAnimateTransformElement.h"
#include "AffineTransform.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderObject.h"
#include "SVGAngle.h"
#include "SVGElementInstance.h"
+#include "SVGGradientElement.h"
#include "SVGParserUtilities.h"
#include "SVGSVGElement.h"
#include "SVGStyledTransformableElement.h"
@@ -60,10 +61,14 @@ SVGAnimateTransformElement::~SVGAnimateTransformElement()
bool SVGAnimateTransformElement::hasValidTarget() const
{
SVGElement* targetElement = this->targetElement();
- return SVGAnimationElement::hasValidTarget() && (targetElement->isStyledTransformable() || targetElement->hasTagName(SVGNames::textTag));
+ return SVGAnimationElement::hasValidTarget()
+ && (targetElement->isStyledTransformable()
+ || targetElement->hasTagName(SVGNames::textTag)
+ || targetElement->hasTagName(SVGNames::linearGradientTag)
+ || targetElement->hasTagName(SVGNames::radialGradientTag));
}
-void SVGAnimateTransformElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAnimateTransformElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::typeAttr) {
if (attr->value() == "translate")
@@ -88,6 +93,8 @@ static PassRefPtr<SVGTransformList> transformListFor(SVGElement* element)
return static_cast<SVGStyledTransformableElement*>(element)->transform();
if (element->hasTagName(SVGNames::textTag))
return static_cast<SVGTextElement*>(element)->transform();
+ if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTagName(SVGNames::radialGradientTag))
+ return static_cast<SVGGradientElement*>(element)->gradientTransform();
return 0;
}
@@ -95,6 +102,12 @@ void SVGAnimateTransformElement::resetToBaseValue(const String& baseValue)
{
if (!hasValidTarget())
return;
+
+ if (targetElement()->hasTagName(SVGNames::linearGradientTag) || targetElement()->hasTagName(SVGNames::radialGradientTag)) {
+ targetElement()->setAttribute(SVGNames::gradientTransformAttr, baseValue.isEmpty() ? "matrix(1 0 0 1 0 0)" : baseValue);
+ return;
+ }
+
if (baseValue.isEmpty()) {
ExceptionCode ec;
RefPtr<SVGTransformList> list = transformListFor(targetElement());
@@ -175,6 +188,8 @@ void SVGAnimateTransformElement::applyResultsToTarget()
static_cast<SVGStyledTransformableElement*>(shadowTreeElement)->setTransformBaseValue(transformList.get());
else if (shadowTreeElement->hasTagName(SVGNames::textTag))
static_cast<SVGTextElement*>(shadowTreeElement)->setTransformBaseValue(transformList.get());
+ else if (shadowTreeElement->hasTagName(SVGNames::linearGradientTag) || shadowTreeElement->hasTagName(SVGNames::radialGradientTag))
+ static_cast<SVGGradientElement*>(shadowTreeElement)->setGradientTransformBaseValue(transformList.get());
if (RenderObject* renderer = shadowTreeElement->renderer()) {
renderer->setNeedsTransformUpdate();
renderer->setNeedsLayout(true);
diff --git a/WebCore/svg/SVGAnimateTransformElement.h b/WebCore/svg/SVGAnimateTransformElement.h
index c93e694..a06953a 100644
--- a/WebCore/svg/SVGAnimateTransformElement.h
+++ b/WebCore/svg/SVGAnimateTransformElement.h
@@ -39,7 +39,7 @@ public:
virtual bool hasValidTarget() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
private:
virtual void resetToBaseValue(const String&);
diff --git a/WebCore/svg/SVGAnimationElement.cpp b/WebCore/svg/SVGAnimationElement.cpp
index 4b4d5bb..48e0880 100644
--- a/WebCore/svg/SVGAnimationElement.cpp
+++ b/WebCore/svg/SVGAnimationElement.cpp
@@ -27,16 +27,16 @@
#if ENABLE(SVG_ANIMATION)
#include "SVGAnimationElement.h"
-#include "Color.h"
+#include "Attribute.h"
#include "CSSComputedStyleDeclaration.h"
#include "CSSParser.h"
#include "CSSPropertyNames.h"
+#include "Color.h"
#include "Document.h"
#include "Event.h"
#include "EventListener.h"
#include "FloatConversion.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "PlatformString.h"
#include "RenderObject.h"
#include "SVGElementInstance.h"
@@ -140,7 +140,7 @@ static void parseKeySplines(const String& parse, Vector<UnitBezier>& result)
result.clear();
}
-void SVGAnimationElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAnimationElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::valuesAttr)
attr->value().string().split(';', m_values);
@@ -502,7 +502,7 @@ static inline void adjustForCurrentColor(String& value, SVGElement* target)
return;
if (RenderObject* targetRenderer = target->renderer())
- value = targetRenderer->style()->color().name();
+ value = targetRenderer->style()->visitedDependentColor(CSSPropertyColor).name();
}
void SVGAnimationElement::startedActiveInterval()
diff --git a/WebCore/svg/SVGAnimationElement.h b/WebCore/svg/SVGAnimationElement.h
index 27cec88..74148c5 100644
--- a/WebCore/svg/SVGAnimationElement.h
+++ b/WebCore/svg/SVGAnimationElement.h
@@ -47,7 +47,7 @@ namespace WebCore {
SVGAnimationElement(const QualifiedName&, Document*);
virtual ~SVGAnimationElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attributeChanged(Attribute*, bool preserveDecls);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGCircleElement.cpp b/WebCore/svg/SVGCircleElement.cpp
index 12ccf69..135a96f 100644
--- a/WebCore/svg/SVGCircleElement.cpp
+++ b/WebCore/svg/SVGCircleElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(SVG)
#include "SVGCircleElement.h"
+#include "Attribute.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -46,7 +46,7 @@ SVGCircleElement::~SVGCircleElement()
{
}
-void SVGCircleElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGCircleElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::cxAttr)
setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGCircleElement.h b/WebCore/svg/SVGCircleElement.h
index 027918c..eb2714c 100644
--- a/WebCore/svg/SVGCircleElement.h
+++ b/WebCore/svg/SVGCircleElement.h
@@ -39,7 +39,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp
index dd880f5..c3a514e 100644
--- a/WebCore/svg/SVGClipPathElement.cpp
+++ b/WebCore/svg/SVGClipPathElement.cpp
@@ -24,9 +24,9 @@
#if ENABLE(SVG)
#include "SVGClipPathElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "RenderSVGResourceClipper.h"
#include "SVGNames.h"
#include "SVGTransformList.h"
@@ -47,7 +47,7 @@ SVGClipPathElement::~SVGClipPathElement()
{
}
-void SVGClipPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGClipPathElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::clipPathUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h
index 40e34f0..eb74f72 100644
--- a/WebCore/svg/SVGClipPathElement.h
+++ b/WebCore/svg/SVGClipPathElement.h
@@ -40,7 +40,7 @@ public:
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/WebCore/svg/SVGComponentTransferFunctionElement.cpp
index f61b2ea..5169411 100644
--- a/WebCore/svg/SVGComponentTransferFunctionElement.cpp
+++ b/WebCore/svg/SVGComponentTransferFunctionElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGComponentTransferFunctionElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGFEComponentTransferElement.h"
#include "SVGNames.h"
#include "SVGNumberList.h"
@@ -44,7 +44,7 @@ SVGComponentTransferFunctionElement::~SVGComponentTransferFunctionElement()
{
}
-void SVGComponentTransferFunctionElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGComponentTransferFunctionElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::typeAttr) {
diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.h b/WebCore/svg/SVGComponentTransferFunctionElement.h
index 9862a99..1c719f9 100644
--- a/WebCore/svg/SVGComponentTransferFunctionElement.h
+++ b/WebCore/svg/SVGComponentTransferFunctionElement.h
@@ -34,7 +34,7 @@ namespace WebCore {
SVGComponentTransferFunctionElement(const QualifiedName&, Document*);
virtual ~SVGComponentTransferFunctionElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
ComponentTransferFunction transferFunction() const;
diff --git a/WebCore/svg/SVGCursorElement.cpp b/WebCore/svg/SVGCursorElement.cpp
index e904516..2c51925 100644
--- a/WebCore/svg/SVGCursorElement.cpp
+++ b/WebCore/svg/SVGCursorElement.cpp
@@ -25,7 +25,6 @@
#include "Attr.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -48,7 +47,7 @@ SVGCursorElement::~SVGCursorElement()
(*it)->setCursorElement(0);
}
-void SVGCursorElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGCursorElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGCursorElement.h b/WebCore/svg/SVGCursorElement.h
index 0978124..f10f464 100644
--- a/WebCore/svg/SVGCursorElement.h
+++ b/WebCore/svg/SVGCursorElement.h
@@ -43,7 +43,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp
index ab146bb..a94329e 100644
--- a/WebCore/svg/SVGElement.cpp
+++ b/WebCore/svg/SVGElement.cpp
@@ -26,6 +26,7 @@
#if ENABLE(SVG)
#include "SVGElement.h"
+#include "Attribute.h"
#include "CSSCursorImageValue.h"
#include "DOMImplementation.h"
#include "Document.h"
@@ -34,7 +35,6 @@
#include "EventNames.h"
#include "FrameView.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RegisteredEventListener.h"
#include "RenderObject.h"
#include "SVGCursorElement.h"
@@ -189,7 +189,7 @@ void SVGElement::setCursorImageValue(CSSCursorImageValue* cursorImageValue)
ensureRareSVGData()->setCursorImageValue(cursorImageValue);
}
-void SVGElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGElement::parseMappedAttribute(Attribute* attr)
{
// standard events
if (attr->name() == onloadAttr)
diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h
index 9467250..64afe8e 100644
--- a/WebCore/svg/SVGElement.h
+++ b/WebCore/svg/SVGElement.h
@@ -49,7 +49,7 @@ namespace WebCore {
SVGDocumentExtensions* accessDocumentSVGExtensions() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool isStyled() const { return false; }
virtual bool isStyledTransformable() const { return false; }
diff --git a/WebCore/svg/SVGEllipseElement.cpp b/WebCore/svg/SVGEllipseElement.cpp
index 76f374f..d811b56 100644
--- a/WebCore/svg/SVGEllipseElement.cpp
+++ b/WebCore/svg/SVGEllipseElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(SVG)
#include "SVGEllipseElement.h"
+#include "Attribute.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -47,7 +47,7 @@ SVGEllipseElement::~SVGEllipseElement()
{
}
-void SVGEllipseElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGEllipseElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::cxAttr)
setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGEllipseElement.h b/WebCore/svg/SVGEllipseElement.h
index adaa0d2..4b2c38d 100644
--- a/WebCore/svg/SVGEllipseElement.h
+++ b/WebCore/svg/SVGEllipseElement.h
@@ -39,7 +39,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGExternalResourcesRequired.cpp b/WebCore/svg/SVGExternalResourcesRequired.cpp
index 99bc5eb..b82b113 100644
--- a/WebCore/svg/SVGExternalResourcesRequired.cpp
+++ b/WebCore/svg/SVGExternalResourcesRequired.cpp
@@ -24,7 +24,6 @@
#include "SVGExternalResourcesRequired.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "SVGElement.h"
#include "SVGNames.h"
@@ -38,7 +37,7 @@ SVGExternalResourcesRequired::~SVGExternalResourcesRequired()
{
}
-bool SVGExternalResourcesRequired::parseMappedAttribute(MappedAttribute* attr)
+bool SVGExternalResourcesRequired::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::externalResourcesRequiredAttr) {
setExternalResourcesRequiredBaseValue(attr->value() == "true");
diff --git a/WebCore/svg/SVGExternalResourcesRequired.h b/WebCore/svg/SVGExternalResourcesRequired.h
index b2a741d..971c65c 100644
--- a/WebCore/svg/SVGExternalResourcesRequired.h
+++ b/WebCore/svg/SVGExternalResourcesRequired.h
@@ -27,7 +27,7 @@
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
// Notes on a SVG 1.1 spec discrepancy:
// The SVG DOM defines the attribute externalResourcesRequired as being of type SVGAnimatedBoolean, whereas the
@@ -39,7 +39,7 @@ namespace WebCore {
SVGExternalResourcesRequired();
virtual ~SVGExternalResourcesRequired();
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
protected:
diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp
index 561eb30..c97feed 100644
--- a/WebCore/svg/SVGFEBlendElement.cpp
+++ b/WebCore/svg/SVGFEBlendElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEBlendElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
namespace WebCore {
@@ -37,7 +37,7 @@ SVGFEBlendElement::~SVGFEBlendElement()
{
}
-void SVGFEBlendElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEBlendElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::modeAttr) {
diff --git a/WebCore/svg/SVGFEBlendElement.h b/WebCore/svg/SVGFEBlendElement.h
index be97755..6a7b52f 100644
--- a/WebCore/svg/SVGFEBlendElement.h
+++ b/WebCore/svg/SVGFEBlendElement.h
@@ -31,7 +31,7 @@ public:
SVGFEBlendElement(const QualifiedName&, Document*);
virtual ~SVGFEBlendElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp
index 4911f4c..c644fd6 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.cpp
+++ b/WebCore/svg/SVGFEColorMatrixElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEColorMatrixElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGNumberList.h"
@@ -40,7 +40,7 @@ SVGFEColorMatrixElement::~SVGFEColorMatrixElement()
{
}
-void SVGFEColorMatrixElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEColorMatrixElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::typeAttr) {
diff --git a/WebCore/svg/SVGFEColorMatrixElement.h b/WebCore/svg/SVGFEColorMatrixElement.h
index 29cd81f..a0b1abb 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.h
+++ b/WebCore/svg/SVGFEColorMatrixElement.h
@@ -33,7 +33,7 @@ public:
SVGFEColorMatrixElement(const QualifiedName&, Document*);
virtual ~SVGFEColorMatrixElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFEComponentTransferElement.cpp b/WebCore/svg/SVGFEComponentTransferElement.cpp
index 5076d3c..805431c 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.cpp
+++ b/WebCore/svg/SVGFEComponentTransferElement.cpp
@@ -24,7 +24,6 @@
#include "SVGFEComponentTransferElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "SVGFEFuncAElement.h"
#include "SVGFEFuncBElement.h"
#include "SVGFEFuncGElement.h"
@@ -43,7 +42,7 @@ SVGFEComponentTransferElement::~SVGFEComponentTransferElement()
{
}
-void SVGFEComponentTransferElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEComponentTransferElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
diff --git a/WebCore/svg/SVGFEComponentTransferElement.h b/WebCore/svg/SVGFEComponentTransferElement.h
index cab195b..62677e6 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.h
+++ b/WebCore/svg/SVGFEComponentTransferElement.h
@@ -32,7 +32,7 @@ public:
SVGFEComponentTransferElement(const QualifiedName&, Document*);
virtual ~SVGFEComponentTransferElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFECompositeElement.cpp b/WebCore/svg/SVGFECompositeElement.cpp
index d213bd5..1571122 100644
--- a/WebCore/svg/SVGFECompositeElement.cpp
+++ b/WebCore/svg/SVGFECompositeElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFECompositeElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
namespace WebCore {
@@ -38,7 +38,7 @@ SVGFECompositeElement::~SVGFECompositeElement()
{
}
-void SVGFECompositeElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGFECompositeElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::operatorAttr) {
diff --git a/WebCore/svg/SVGFECompositeElement.h b/WebCore/svg/SVGFECompositeElement.h
index b275d25..642330f 100644
--- a/WebCore/svg/SVGFECompositeElement.h
+++ b/WebCore/svg/SVGFECompositeElement.h
@@ -32,7 +32,7 @@ public:
SVGFECompositeElement(const QualifiedName&, Document*);
virtual ~SVGFECompositeElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index 5415bea..efe4d5e 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -23,7 +23,6 @@
#include "SVGFEDiffuseLightingElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "RenderObject.h"
#include "SVGColor.h"
#include "SVGFEDiffuseLighting.h"
@@ -48,7 +47,7 @@ SVGFEDiffuseLightingElement::~SVGFEDiffuseLightingElement()
{
}
-void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGFEDiffuseLightingElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.h b/WebCore/svg/SVGFEDiffuseLightingElement.h
index f12dfad..5815cfe 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.h
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.h
@@ -39,7 +39,7 @@ public:
SVGFEDiffuseLightingElement(const QualifiedName&, Document*);
virtual ~SVGFEDiffuseLightingElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.cpp b/WebCore/svg/SVGFEDisplacementMapElement.cpp
index dfaf2dc..82004dc 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.cpp
+++ b/WebCore/svg/SVGFEDisplacementMapElement.cpp
@@ -22,7 +22,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEDisplacementMapElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
namespace WebCore {
@@ -51,7 +51,7 @@ ChannelSelectorType SVGFEDisplacementMapElement::stringToChannel(const String& k
return CHANNEL_UNKNOWN;
}
-void SVGFEDisplacementMapElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEDisplacementMapElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::xChannelSelectorAttr)
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.h b/WebCore/svg/SVGFEDisplacementMapElement.h
index ae3a525..40457ff 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.h
+++ b/WebCore/svg/SVGFEDisplacementMapElement.h
@@ -33,7 +33,7 @@ public:
static ChannelSelectorType stringToChannel(const String&);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFEFloodElement.cpp b/WebCore/svg/SVGFEFloodElement.cpp
index a443071..13ae32f 100644
--- a/WebCore/svg/SVGFEFloodElement.cpp
+++ b/WebCore/svg/SVGFEFloodElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEFloodElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderStyle.h"
#include "SVGRenderStyle.h"
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.cpp b/WebCore/svg/SVGFEGaussianBlurElement.cpp
index 78fc505..f8dd1a5 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.cpp
+++ b/WebCore/svg/SVGFEGaussianBlurElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEGaussianBlurElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -46,7 +46,7 @@ void SVGFEGaussianBlurElement::setStdDeviation(float, float)
// FIXME: Needs an implementation.
}
-void SVGFEGaussianBlurElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEGaussianBlurElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::stdDeviationAttr) {
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.h b/WebCore/svg/SVGFEGaussianBlurElement.h
index ddddb8a..fb196d1 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.h
+++ b/WebCore/svg/SVGFEGaussianBlurElement.h
@@ -37,7 +37,7 @@ public:
void setStdDeviation(float stdDeviationX, float stdDeviationY);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFEImageElement.cpp b/WebCore/svg/SVGFEImageElement.cpp
index bdc1911..7fa4c51 100644
--- a/WebCore/svg/SVGFEImageElement.cpp
+++ b/WebCore/svg/SVGFEImageElement.cpp
@@ -28,7 +28,6 @@
#include "CachedImage.h"
#include "DocLoader.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "SVGPreserveAspectRatio.h"
@@ -67,7 +66,7 @@ void SVGFEImageElement::requestImageResource()
m_cachedImage->addClient(this);
}
-void SVGFEImageElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEImageElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::preserveAspectRatioAttr)
diff --git a/WebCore/svg/SVGFEImageElement.h b/WebCore/svg/SVGFEImageElement.h
index 515dcf5..561044b 100644
--- a/WebCore/svg/SVGFEImageElement.h
+++ b/WebCore/svg/SVGFEImageElement.h
@@ -43,7 +43,7 @@ public:
SVGFEImageElement(const QualifiedName&, Document*);
virtual ~SVGFEImageElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual void notifyFinished(CachedResource*);
diff --git a/WebCore/svg/SVGFELightElement.cpp b/WebCore/svg/SVGFELightElement.cpp
index dc711cf..7534df2 100644
--- a/WebCore/svg/SVGFELightElement.cpp
+++ b/WebCore/svg/SVGFELightElement.cpp
@@ -24,7 +24,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFELightElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
namespace WebCore {
@@ -39,7 +39,7 @@ SVGFELightElement::~SVGFELightElement()
{
}
-void SVGFELightElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFELightElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::azimuthAttr)
diff --git a/WebCore/svg/SVGFELightElement.h b/WebCore/svg/SVGFELightElement.h
index 4e9c389..9d3a269 100644
--- a/WebCore/svg/SVGFELightElement.h
+++ b/WebCore/svg/SVGFELightElement.h
@@ -35,7 +35,7 @@ namespace WebCore {
virtual ~SVGFELightElement();
virtual PassRefPtr<LightSource> lightSource() const = 0;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGFEMergeNodeElement.cpp b/WebCore/svg/SVGFEMergeNodeElement.cpp
index 9551d29..64a1226 100644
--- a/WebCore/svg/SVGFEMergeNodeElement.cpp
+++ b/WebCore/svg/SVGFEMergeNodeElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEMergeNodeElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
namespace WebCore {
@@ -36,7 +36,7 @@ SVGFEMergeNodeElement::~SVGFEMergeNodeElement()
{
}
-void SVGFEMergeNodeElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEMergeNodeElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
diff --git a/WebCore/svg/SVGFEMergeNodeElement.h b/WebCore/svg/SVGFEMergeNodeElement.h
index 5ccfe94..3367f79 100644
--- a/WebCore/svg/SVGFEMergeNodeElement.h
+++ b/WebCore/svg/SVGFEMergeNodeElement.h
@@ -32,7 +32,7 @@ namespace WebCore {
SVGFEMergeNodeElement(const QualifiedName&, Document*);
virtual ~SVGFEMergeNodeElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGFEMorphologyElement.cpp b/WebCore/svg/SVGFEMorphologyElement.cpp
index 5457b29..dc12f04 100644
--- a/WebCore/svg/SVGFEMorphologyElement.cpp
+++ b/WebCore/svg/SVGFEMorphologyElement.cpp
@@ -22,7 +22,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEMorphologyElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -46,7 +46,7 @@ void SVGFEMorphologyElement::setRadius(float, float)
// FIXME: Needs an implementation.
}
-void SVGFEMorphologyElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEMorphologyElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::operatorAttr) {
@@ -91,16 +91,16 @@ void SVGFEMorphologyElement::synchronizeProperty(const QualifiedName& attrName)
PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder)
{
FilterEffect* input1 = filterBuilder->getEffectById(in1());
- SVGAnimatedPropertyTraits<float>::ReturnType radX = radiusX(),
- radY = radiusY();
+ float xRadius = radiusX();
+ float yRadius = radiusY();
if (!input1)
return 0;
- if (radX < 0 || radY < 0)
+ if (xRadius < 0 || yRadius < 0)
return 0;
- return FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), radX, radY);
+ return FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);
}
} //namespace WebCore
diff --git a/WebCore/svg/SVGFEMorphologyElement.h b/WebCore/svg/SVGFEMorphologyElement.h
index 7013444..4377213 100644
--- a/WebCore/svg/SVGFEMorphologyElement.h
+++ b/WebCore/svg/SVGFEMorphologyElement.h
@@ -36,7 +36,7 @@ public:
void setRadius(float radiusX, float radiusY);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFEOffsetElement.cpp b/WebCore/svg/SVGFEOffsetElement.cpp
index 35025ab..db96fce 100644
--- a/WebCore/svg/SVGFEOffsetElement.cpp
+++ b/WebCore/svg/SVGFEOffsetElement.cpp
@@ -24,7 +24,6 @@
#include "SVGFEOffsetElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -37,7 +36,7 @@ SVGFEOffsetElement::~SVGFEOffsetElement()
{
}
-void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEOffsetElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::dxAttr)
diff --git a/WebCore/svg/SVGFEOffsetElement.h b/WebCore/svg/SVGFEOffsetElement.h
index 06b76fa..4fbb698 100644
--- a/WebCore/svg/SVGFEOffsetElement.h
+++ b/WebCore/svg/SVGFEOffsetElement.h
@@ -32,7 +32,7 @@ public:
SVGFEOffsetElement(const QualifiedName&, Document*);
virtual ~SVGFEOffsetElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFESpecularLightingElement.cpp b/WebCore/svg/SVGFESpecularLightingElement.cpp
index 767460e..3a82502 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.cpp
+++ b/WebCore/svg/SVGFESpecularLightingElement.cpp
@@ -24,7 +24,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFESpecularLightingElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderObject.h"
#include "SVGColor.h"
#include "SVGFELightElement.h"
@@ -45,7 +45,7 @@ SVGFESpecularLightingElement::~SVGFESpecularLightingElement()
{
}
-void SVGFESpecularLightingElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFESpecularLightingElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
diff --git a/WebCore/svg/SVGFESpecularLightingElement.h b/WebCore/svg/SVGFESpecularLightingElement.h
index 0b4c8fd..c85ce09 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.h
+++ b/WebCore/svg/SVGFESpecularLightingElement.h
@@ -36,7 +36,7 @@ public:
SVGFESpecularLightingElement(const QualifiedName&, Document*);
virtual ~SVGFESpecularLightingElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFETileElement.cpp b/WebCore/svg/SVGFETileElement.cpp
index 133cddc..2c23061 100644
--- a/WebCore/svg/SVGFETileElement.cpp
+++ b/WebCore/svg/SVGFETileElement.cpp
@@ -24,7 +24,6 @@
#include "SVGFETileElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "SVGRenderStyle.h"
namespace WebCore {
@@ -38,7 +37,7 @@ SVGFETileElement::~SVGFETileElement()
{
}
-void SVGFETileElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFETileElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
diff --git a/WebCore/svg/SVGFETileElement.h b/WebCore/svg/SVGFETileElement.h
index 0568d28..60b4d29 100644
--- a/WebCore/svg/SVGFETileElement.h
+++ b/WebCore/svg/SVGFETileElement.h
@@ -32,7 +32,7 @@ public:
SVGFETileElement(const QualifiedName&, Document*);
virtual ~SVGFETileElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp
index f1baeef..e5b5419 100644
--- a/WebCore/svg/SVGFETurbulenceElement.cpp
+++ b/WebCore/svg/SVGFETurbulenceElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFETurbulenceElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGParserUtilities.h"
namespace WebCore {
@@ -43,7 +43,7 @@ SVGFETurbulenceElement::~SVGFETurbulenceElement()
{
}
-void SVGFETurbulenceElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFETurbulenceElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::typeAttr) {
diff --git a/WebCore/svg/SVGFETurbulenceElement.h b/WebCore/svg/SVGFETurbulenceElement.h
index 72003a3..d8b5304 100644
--- a/WebCore/svg/SVGFETurbulenceElement.h
+++ b/WebCore/svg/SVGFETurbulenceElement.h
@@ -41,7 +41,7 @@ public:
SVGFETurbulenceElement(const QualifiedName&, Document*);
virtual ~SVGFETurbulenceElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp
index 7abe756..f3ed90c 100644
--- a/WebCore/svg/SVGFilterElement.cpp
+++ b/WebCore/svg/SVGFilterElement.cpp
@@ -28,7 +28,6 @@
#include "Attr.h"
#include "FloatSize.h"
-#include "MappedAttribute.h"
#include "PlatformString.h"
#include "RenderSVGResourceFilter.h"
#include "SVGFilterBuilder.h"
@@ -67,7 +66,7 @@ void SVGFilterElement::setFilterRes(unsigned long, unsigned long) const
{
}
-void SVGFilterElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFilterElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::filterUnitsAttr) {
diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h
index d8b6653..3dad97f 100644
--- a/WebCore/svg/SVGFilterElement.h
+++ b/WebCore/svg/SVGFilterElement.h
@@ -46,7 +46,7 @@ public:
void setFilterRes(unsigned long filterResX, unsigned long filterResY) const;
FloatRect filterBoundingBox(const FloatRect&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
index 4f13e5e..9b6b747 100644
--- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
+++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
@@ -24,8 +24,8 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFilterPrimitiveStandardAttributes.h"
+#include "Attribute.h"
#include "FilterEffect.h"
-#include "MappedAttribute.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "SVGStyledElement.h"
@@ -48,7 +48,7 @@ SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes()
{
}
-void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(MappedAttribute* attr)
+void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(Attribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
index a2e7af6..6d1adad 100644
--- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
+++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
@@ -39,7 +39,7 @@ public:
virtual bool isFilterEffect() const { return true; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*) = 0;
diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp
index 64c978f..f4de46b 100644
--- a/WebCore/svg/SVGFitToViewBox.cpp
+++ b/WebCore/svg/SVGFitToViewBox.cpp
@@ -27,7 +27,6 @@
#include "Attr.h"
#include "Document.h"
#include "FloatRect.h"
-#include "MappedAttribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include "SVGPreserveAspectRatio.h"
@@ -83,7 +82,7 @@ AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBox
return preserveAspectRatio.getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), 0, 0, viewWidth, viewHeight);
}
-bool SVGFitToViewBox::parseMappedAttribute(Document* document, MappedAttribute* attr)
+bool SVGFitToViewBox::parseMappedAttribute(Document* document, Attribute* attr)
{
if (attr->name() == SVGNames::viewBoxAttr) {
float x = 0.0f, y = 0.0f, w = 0.0f, h = 0.0f;
diff --git a/WebCore/svg/SVGFitToViewBox.h b/WebCore/svg/SVGFitToViewBox.h
index ef7e54b..c4a0d11 100644
--- a/WebCore/svg/SVGFitToViewBox.h
+++ b/WebCore/svg/SVGFitToViewBox.h
@@ -37,7 +37,7 @@ public:
bool parseViewBox(Document*, const UChar*& start, const UChar* end, float& x, float& y, float& w, float& h, bool validate = true);
static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio&, float viewWidth, float viewHeight);
- bool parseMappedAttribute(Document*, MappedAttribute*);
+ bool parseMappedAttribute(Document*, Attribute*);
bool isKnownAttribute(const QualifiedName&);
virtual void setViewBoxBaseValue(SVGAnimatedPropertyTraits<FloatRect>::PassType) = 0;
diff --git a/WebCore/svg/SVGFontFaceElement.cpp b/WebCore/svg/SVGFontFaceElement.cpp
index d1e1661..94f3bd5 100644
--- a/WebCore/svg/SVGFontFaceElement.cpp
+++ b/WebCore/svg/SVGFontFaceElement.cpp
@@ -24,6 +24,7 @@
#if ENABLE(SVG_FONTS)
#include "SVGFontFaceElement.h"
+#include "Attribute.h"
#include "CSSFontFaceRule.h"
#include "CSSFontFaceSrcValue.h"
#include "CSSParser.h"
@@ -35,7 +36,6 @@
#include "CSSValueList.h"
#include "Document.h"
#include "Font.h"
-#include "MappedAttribute.h"
#include "SVGFontElement.h"
#include "SVGFontFaceSrcElement.h"
#include "SVGGlyphElement.h"
@@ -109,7 +109,7 @@ static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
return propertyNameToIdMap->get(attrName.localName().impl());
}
-void SVGFontFaceElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFontFaceElement::parseMappedAttribute(Attribute* attr)
{
int propId = cssPropertyIdForSVGAttributeName(attr->name());
if (propId > 0) {
diff --git a/WebCore/svg/SVGFontFaceElement.h b/WebCore/svg/SVGFontFaceElement.h
index 3c28a89..035a6ed 100644
--- a/WebCore/svg/SVGFontFaceElement.h
+++ b/WebCore/svg/SVGFontFaceElement.h
@@ -36,7 +36,7 @@ namespace WebCore {
SVGFontFaceElement(const QualifiedName&, Document*);
virtual ~SVGFontFaceElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual void insertedIntoDocument();
diff --git a/WebCore/svg/SVGFontFaceUriElement.cpp b/WebCore/svg/SVGFontFaceUriElement.cpp
index bfcda70..ad70b40 100644
--- a/WebCore/svg/SVGFontFaceUriElement.cpp
+++ b/WebCore/svg/SVGFontFaceUriElement.cpp
@@ -23,11 +23,11 @@
#if ENABLE(SVG_FONTS)
#include "SVGFontFaceUriElement.h"
+#include "Attribute.h"
#include "CSSFontFaceSrcValue.h"
#include "CachedFont.h"
#include "DocLoader.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "SVGFontFaceElement.h"
#include "SVGNames.h"
#include "XLinkNames.h"
@@ -55,7 +55,7 @@ PassRefPtr<CSSFontFaceSrcValue> SVGFontFaceUriElement::srcValue() const
return src.release();
}
-void SVGFontFaceUriElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFontFaceUriElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == XLinkNames::hrefAttr)
diff --git a/WebCore/svg/SVGFontFaceUriElement.h b/WebCore/svg/SVGFontFaceUriElement.h
index 3d1f89f..03e44d6 100644
--- a/WebCore/svg/SVGFontFaceUriElement.h
+++ b/WebCore/svg/SVGFontFaceUriElement.h
@@ -37,7 +37,7 @@ namespace WebCore {
PassRefPtr<CSSFontFaceSrcValue> srcValue() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual void insertedIntoDocument();
diff --git a/WebCore/svg/SVGForeignObjectElement.cpp b/WebCore/svg/SVGForeignObjectElement.cpp
index f9ab057..9dc61c9 100644
--- a/WebCore/svg/SVGForeignObjectElement.cpp
+++ b/WebCore/svg/SVGForeignObjectElement.cpp
@@ -25,8 +25,8 @@
#if ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
#include "SVGForeignObjectElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
-#include "MappedAttribute.h"
#include "RenderForeignObject.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -50,7 +50,7 @@ SVGForeignObjectElement::~SVGForeignObjectElement()
{
}
-void SVGForeignObjectElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGForeignObjectElement::parseMappedAttribute(Attribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
diff --git a/WebCore/svg/SVGForeignObjectElement.h b/WebCore/svg/SVGForeignObjectElement.h
index fe36a20..2cd60a4 100644
--- a/WebCore/svg/SVGForeignObjectElement.h
+++ b/WebCore/svg/SVGForeignObjectElement.h
@@ -40,7 +40,7 @@ namespace WebCore {
virtual ~SVGForeignObjectElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGGElement.cpp b/WebCore/svg/SVGGElement.cpp
index d429400..eceac41 100644
--- a/WebCore/svg/SVGGElement.cpp
+++ b/WebCore/svg/SVGGElement.cpp
@@ -40,7 +40,7 @@ SVGGElement::~SVGGElement()
{
}
-void SVGGElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGGElement::parseMappedAttribute(Attribute* attr)
{
if (SVGTests::parseMappedAttribute(attr))
return;
diff --git a/WebCore/svg/SVGGElement.h b/WebCore/svg/SVGGElement.h
index b90eddb..aaed269 100644
--- a/WebCore/svg/SVGGElement.h
+++ b/WebCore/svg/SVGGElement.h
@@ -40,7 +40,7 @@ namespace WebCore {
virtual bool isShadowTreeContainerElement() const { return false; }
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGGlyphElement.cpp b/WebCore/svg/SVGGlyphElement.cpp
index 2d15569..d5b7531 100644
--- a/WebCore/svg/SVGGlyphElement.cpp
+++ b/WebCore/svg/SVGGlyphElement.cpp
@@ -24,7 +24,7 @@
#if ENABLE(SVG_FONTS)
#include "SVGGlyphElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGFontData.h"
#include "SVGFontElement.h"
#include "SVGFontFaceElement.h"
@@ -55,7 +55,7 @@ void SVGGlyphElement::invalidateGlyphCache()
}
}
-void SVGGlyphElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGGlyphElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::dAttr)
invalidateGlyphCache();
diff --git a/WebCore/svg/SVGGlyphElement.h b/WebCore/svg/SVGGlyphElement.h
index 0662097..a5edd67 100644
--- a/WebCore/svg/SVGGlyphElement.h
+++ b/WebCore/svg/SVGGlyphElement.h
@@ -106,7 +106,7 @@ namespace WebCore {
SVGGlyphElement(const QualifiedName&, Document*);
virtual ~SVGGlyphElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp
index b4bdb16..b314674 100644
--- a/WebCore/svg/SVGGradientElement.cpp
+++ b/WebCore/svg/SVGGradientElement.cpp
@@ -24,8 +24,8 @@
#if ENABLE(SVG)
#include "SVGGradientElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "RenderSVGHiddenContainer.h"
#include "RenderSVGResourceLinearGradient.h"
@@ -51,7 +51,7 @@ SVGGradientElement::~SVGGradientElement()
{
}
-void SVGGradientElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGGradientElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::gradientUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h
index 4447ec4..2736ab3 100644
--- a/WebCore/svg/SVGGradientElement.h
+++ b/WebCore/svg/SVGGradientElement.h
@@ -37,7 +37,7 @@ namespace WebCore {
SVGGradientElement(const QualifiedName&, Document*);
virtual ~SVGGradientElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGImageElement.cpp b/WebCore/svg/SVGImageElement.cpp
index 82bf3bd..e67c337 100644
--- a/WebCore/svg/SVGImageElement.cpp
+++ b/WebCore/svg/SVGImageElement.cpp
@@ -24,8 +24,8 @@
#if ENABLE(SVG)
#include "SVGImageElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
-#include "MappedAttribute.h"
#include "RenderSVGImage.h"
#include "SVGDocument.h"
#include "SVGLength.h"
@@ -53,7 +53,7 @@ SVGImageElement::~SVGImageElement()
{
}
-void SVGImageElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGImageElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGImageElement.h b/WebCore/svg/SVGImageElement.h
index e5b603c..06e3bdb 100644
--- a/WebCore/svg/SVGImageElement.h
+++ b/WebCore/svg/SVGImageElement.h
@@ -45,7 +45,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGLangSpace.cpp b/WebCore/svg/SVGLangSpace.cpp
index f0d6997..21bb643 100644
--- a/WebCore/svg/SVGLangSpace.cpp
+++ b/WebCore/svg/SVGLangSpace.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "SVGLangSpace.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGElement.h"
#include "XMLNames.h"
#include <wtf/StdLibExtras.h>
@@ -63,7 +63,7 @@ void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace)
m_space = xmlSpace;
}
-bool SVGLangSpace::parseMappedAttribute(MappedAttribute* attr)
+bool SVGLangSpace::parseMappedAttribute(Attribute* attr)
{
if (attr->name().matches(XMLNames::langAttr)) {
setXmllang(attr->value());
diff --git a/WebCore/svg/SVGLangSpace.h b/WebCore/svg/SVGLangSpace.h
index 1613998..f76b990 100644
--- a/WebCore/svg/SVGLangSpace.h
+++ b/WebCore/svg/SVGLangSpace.h
@@ -26,7 +26,7 @@
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
class QualifiedName;
class SVGLangSpace {
@@ -40,7 +40,7 @@ namespace WebCore {
const AtomicString& xmlspace() const;
void setXmlspace(const AtomicString& xmlSpace);
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGLineElement.cpp b/WebCore/svg/SVGLineElement.cpp
index 68b8259..a840858 100644
--- a/WebCore/svg/SVGLineElement.cpp
+++ b/WebCore/svg/SVGLineElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(SVG)
#include "SVGLineElement.h"
+#include "Attribute.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -47,7 +47,7 @@ SVGLineElement::~SVGLineElement()
{
}
-void SVGLineElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGLineElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::x1Attr)
setX1BaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGLineElement.h b/WebCore/svg/SVGLineElement.h
index c5ecafa..1fbe421 100644
--- a/WebCore/svg/SVGLineElement.h
+++ b/WebCore/svg/SVGLineElement.h
@@ -41,7 +41,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp
index 87021b1..29ee85e 100644
--- a/WebCore/svg/SVGLinearGradientElement.cpp
+++ b/WebCore/svg/SVGLinearGradientElement.cpp
@@ -26,10 +26,10 @@
#if ENABLE(SVG)
#include "SVGLinearGradientElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "FloatPoint.h"
#include "LinearGradientAttributes.h"
-#include "MappedAttribute.h"
#include "RenderSVGResourceLinearGradient.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -53,7 +53,7 @@ SVGLinearGradientElement::~SVGLinearGradientElement()
{
}
-void SVGLinearGradientElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGLinearGradientElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::x1Attr)
setX1BaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGLinearGradientElement.h b/WebCore/svg/SVGLinearGradientElement.h
index f92fe80..b248c48 100644
--- a/WebCore/svg/SVGLinearGradientElement.h
+++ b/WebCore/svg/SVGLinearGradientElement.h
@@ -34,7 +34,7 @@ namespace WebCore {
SVGLinearGradientElement(const QualifiedName&, Document*);
virtual ~SVGLinearGradientElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGMPathElement.cpp b/WebCore/svg/SVGMPathElement.cpp
index dfe7e99..65b2cc2 100644
--- a/WebCore/svg/SVGMPathElement.cpp
+++ b/WebCore/svg/SVGMPathElement.cpp
@@ -38,7 +38,7 @@ SVGMPathElement::~SVGMPathElement()
{
}
-void SVGMPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGMPathElement::parseMappedAttribute(Attribute* attr)
{
if (SVGURIReference::parseMappedAttribute(attr))
return;
diff --git a/WebCore/svg/SVGMPathElement.h b/WebCore/svg/SVGMPathElement.h
index 50a7dd1..b25fc19 100644
--- a/WebCore/svg/SVGMPathElement.h
+++ b/WebCore/svg/SVGMPathElement.h
@@ -35,7 +35,7 @@ namespace WebCore {
SVGMPathElement(const QualifiedName&, Document*);
virtual ~SVGMPathElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
SVGPathElement* pathElement();
diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp
index 79a445c..9ffbd8d 100644
--- a/WebCore/svg/SVGMarkerElement.cpp
+++ b/WebCore/svg/SVGMarkerElement.cpp
@@ -24,7 +24,7 @@
#if ENABLE(SVG)
#include "SVGMarkerElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "PlatformString.h"
#include "RenderSVGResourceMarker.h"
#include "SVGFitToViewBox.h"
@@ -62,7 +62,7 @@ AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float
return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight);
}
-void SVGMarkerElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGMarkerElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::markerUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h
index 491cac5..bd397b5 100644
--- a/WebCore/svg/SVGMarkerElement.h
+++ b/WebCore/svg/SVGMarkerElement.h
@@ -61,7 +61,7 @@ public:
void setOrientToAuto();
void setOrientToAngle(const SVGAngle&);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index 6eb19fc..07afe08 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -26,8 +26,8 @@
#if ENABLE(SVG)
#include "SVGMaskElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
-#include "MappedAttribute.h"
#include "RenderSVGResourceMasker.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -59,7 +59,7 @@ SVGMaskElement::~SVGMaskElement()
{
}
-void SVGMaskElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGMaskElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::maskUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h
index 7730e37..79e0bf0 100644
--- a/WebCore/svg/SVGMaskElement.h
+++ b/WebCore/svg/SVGMaskElement.h
@@ -43,7 +43,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
FloatRect maskBoundingBox(const FloatRect&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/svg/SVGPathElement.cpp b/WebCore/svg/SVGPathElement.cpp
index d28f2e5..40996d1 100644
--- a/WebCore/svg/SVGPathElement.cpp
+++ b/WebCore/svg/SVGPathElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "SVGPathElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderPath.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -167,7 +167,7 @@ PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSeg
return SVGPathSegCurvetoQuadraticSmoothRel::create(x, y);
}
-void SVGPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGPathElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::dAttr) {
ExceptionCode ec;
diff --git a/WebCore/svg/SVGPathElement.h b/WebCore/svg/SVGPathElement.h
index e46ed92..a8523ce 100644
--- a/WebCore/svg/SVGPathElement.h
+++ b/WebCore/svg/SVGPathElement.h
@@ -90,7 +90,7 @@ namespace WebCore {
virtual SVGPathSegList* animatedPathSegList() const;
virtual SVGPathSegList* animatedNormalizedPathSegList() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp
index 3df6198..fe889e3 100644
--- a/WebCore/svg/SVGPatternElement.cpp
+++ b/WebCore/svg/SVGPatternElement.cpp
@@ -25,11 +25,11 @@
#include "SVGPatternElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "Document.h"
#include "FloatConversion.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
-#include "MappedAttribute.h"
#include "PatternAttributes.h"
#include "RenderSVGContainer.h"
#include "RenderSVGResourcePattern.h"
@@ -70,7 +70,7 @@ SVGPatternElement::~SVGPatternElement()
{
}
-void SVGPatternElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGPatternElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::patternUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h
index 014d2b4..56f7238 100644
--- a/WebCore/svg/SVGPatternElement.h
+++ b/WebCore/svg/SVGPatternElement.h
@@ -48,7 +48,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/svg/SVGPolyElement.cpp b/WebCore/svg/SVGPolyElement.cpp
index 73940dc..053b700 100644
--- a/WebCore/svg/SVGPolyElement.cpp
+++ b/WebCore/svg/SVGPolyElement.cpp
@@ -23,9 +23,9 @@
#if ENABLE(SVG)
#include "SVGPolyElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -60,7 +60,7 @@ SVGPointList* SVGPolyElement::animatedPoints() const
return 0;
}
-void SVGPolyElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGPolyElement::parseMappedAttribute(Attribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::pointsAttr) {
diff --git a/WebCore/svg/SVGPolyElement.h b/WebCore/svg/SVGPolyElement.h
index 88947de..b2f9a3e 100644
--- a/WebCore/svg/SVGPolyElement.h
+++ b/WebCore/svg/SVGPolyElement.h
@@ -44,7 +44,7 @@ namespace WebCore {
virtual SVGPointList* points() const;
virtual SVGPointList* animatedPoints() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp
index 29cc1cc..14e0163 100644
--- a/WebCore/svg/SVGRadialGradientElement.cpp
+++ b/WebCore/svg/SVGRadialGradientElement.cpp
@@ -26,9 +26,9 @@
#if ENABLE(SVG)
#include "SVGRadialGradientElement.h"
+#include "Attribute.h"
#include "FloatConversion.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RadialGradientAttributes.h"
#include "RenderSVGResourceRadialGradient.h"
#include "SVGLength.h"
@@ -55,7 +55,7 @@ SVGRadialGradientElement::~SVGRadialGradientElement()
{
}
-void SVGRadialGradientElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGRadialGradientElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::cxAttr)
setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGRadialGradientElement.h b/WebCore/svg/SVGRadialGradientElement.h
index 25219db..0db08a3 100644
--- a/WebCore/svg/SVGRadialGradientElement.h
+++ b/WebCore/svg/SVGRadialGradientElement.h
@@ -34,7 +34,7 @@ namespace WebCore {
SVGRadialGradientElement(const QualifiedName&, Document*);
virtual ~SVGRadialGradientElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGRectElement.cpp b/WebCore/svg/SVGRectElement.cpp
index 30d278a..b4dc624 100644
--- a/WebCore/svg/SVGRectElement.cpp
+++ b/WebCore/svg/SVGRectElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "SVGRectElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderPath.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -48,7 +48,7 @@ SVGRectElement::~SVGRectElement()
{
}
-void SVGRectElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGRectElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGRectElement.h b/WebCore/svg/SVGRectElement.h
index df382f9..16f8408 100644
--- a/WebCore/svg/SVGRectElement.h
+++ b/WebCore/svg/SVGRectElement.h
@@ -39,7 +39,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp
index f30067c..af3e5b6 100644
--- a/WebCore/svg/SVGSVGElement.cpp
+++ b/WebCore/svg/SVGSVGElement.cpp
@@ -25,6 +25,7 @@
#include "SVGSVGElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "Document.h"
@@ -34,7 +35,6 @@
#include "FloatRect.h"
#include "Frame.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderSVGRoot.h"
#include "RenderSVGViewportContainer.h"
#include "SMILTimeContainer.h"
@@ -220,7 +220,7 @@ void SVGSVGElement::setCurrentTranslate(const FloatPoint &translation)
document()->renderer()->repaint();
}
-void SVGSVGElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGSVGElement::parseMappedAttribute(Attribute* attr)
{
if (!nearestViewportElement()) {
bool setListener = true;
@@ -282,7 +282,7 @@ static void updateCSSForAttribute(SVGSVGElement* element, const QualifiedName& a
Attribute* attribute = element->attributes(false)->getAttributeItem(attrName);
if (!attribute || !attribute->isMappedAttribute())
return;
- element->addCSSProperty(static_cast<MappedAttribute*>(attribute), property, value.valueAsString());
+ element->addCSSProperty(attribute, property, value.valueAsString());
}
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
diff --git a/WebCore/svg/SVGSVGElement.h b/WebCore/svg/SVGSVGElement.h
index 94300bc..e941034 100644
--- a/WebCore/svg/SVGSVGElement.h
+++ b/WebCore/svg/SVGSVGElement.h
@@ -112,7 +112,7 @@ namespace WebCore {
static SVGTransform createSVGTransform();
static SVGTransform createSVGTransformFromMatrix(const AffineTransform&);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp
index a6d0f47..61c68b6 100644
--- a/WebCore/svg/SVGScriptElement.cpp
+++ b/WebCore/svg/SVGScriptElement.cpp
@@ -23,10 +23,10 @@
#if ENABLE(SVG)
#include "SVGScriptElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
-#include "MappedAttribute.h"
#include "SVGNames.h"
namespace WebCore {
@@ -49,7 +49,7 @@ String SVGScriptElement::scriptContent() const
return m_data.scriptContent();
}
-void SVGScriptElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGScriptElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h
index 623228c..b864ad5 100644
--- a/WebCore/svg/SVGScriptElement.h
+++ b/WebCore/svg/SVGScriptElement.h
@@ -39,7 +39,7 @@ namespace WebCore {
virtual String scriptContent() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/svg/SVGStopElement.cpp b/WebCore/svg/SVGStopElement.cpp
index 3ac2d5b..672b082 100644
--- a/WebCore/svg/SVGStopElement.cpp
+++ b/WebCore/svg/SVGStopElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(SVG)
#include "SVGStopElement.h"
+#include "Attribute.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "RenderSVGGradientStop.h"
#include "SVGGradientElement.h"
#include "SVGNames.h"
@@ -41,7 +41,7 @@ SVGStopElement::~SVGStopElement()
{
}
-void SVGStopElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStopElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::offsetAttr) {
const String& value = attr->value();
diff --git a/WebCore/svg/SVGStopElement.h b/WebCore/svg/SVGStopElement.h
index 222dd4d..db5eff0 100644
--- a/WebCore/svg/SVGStopElement.h
+++ b/WebCore/svg/SVGStopElement.h
@@ -32,7 +32,7 @@ namespace WebCore {
SVGStopElement(const QualifiedName&, Document*);
virtual ~SVGStopElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
Color stopColorIncludingOpacity() const;
diff --git a/WebCore/svg/SVGStyleElement.cpp b/WebCore/svg/SVGStyleElement.cpp
index 2a21670..d997074 100644
--- a/WebCore/svg/SVGStyleElement.cpp
+++ b/WebCore/svg/SVGStyleElement.cpp
@@ -25,10 +25,10 @@
#if ENABLE(SVG)
#include "SVGStyleElement.h"
+#include "Attribute.h"
#include "CSSStyleSheet.h"
#include "Document.h"
#include "ExceptionCode.h"
-#include "MappedAttribute.h"
#include "SVGNames.h"
#include <wtf/StdLibExtras.h>
@@ -77,7 +77,7 @@ void SVGStyleElement::setTitle(const AtomicString& title, ExceptionCode& ec)
setAttribute(SVGNames::titleAttr, title, ec);
}
-void SVGStyleElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStyleElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::titleAttr && m_sheet)
m_sheet->setTitle(attr->value());
diff --git a/WebCore/svg/SVGStyleElement.h b/WebCore/svg/SVGStyleElement.h
index de37f5d..ae7ed57 100644
--- a/WebCore/svg/SVGStyleElement.h
+++ b/WebCore/svg/SVGStyleElement.h
@@ -35,7 +35,7 @@ namespace WebCore {
SVGStyleElement(const QualifiedName&, Document*, bool createdByParser);
// Derived from: 'Element'
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index 9a3f950..94ddf0b 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -28,7 +28,6 @@
#include "CSSStyleSelector.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "PlatformString.h"
#include "RenderObject.h"
#include "RenderSVGResource.h"
@@ -203,7 +202,7 @@ bool SVGStyledElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
return SVGElement::mapToEntry(attrName, result);
}
-void SVGStyledElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStyledElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
// NOTE: Any subclass which overrides parseMappedAttribute for a property handled by
@@ -326,7 +325,7 @@ PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& na
if (!attr || !attr->isMappedAttribute() || !attr->style())
return 0;
- MappedAttribute* cssSVGAttr = static_cast<MappedAttribute*>(attr);
+ Attribute* cssSVGAttr = attr;
// This function returns a pointer to a CSSValue which can be mutated from JavaScript.
// If the associated MappedAttribute uses the same CSSMappedAttributeDeclaration
// as StyledElement's mappedAttributeDecls cache, create a new CSSMappedAttributeDeclaration
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index 69d7e96..cf78050 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -51,7 +51,7 @@ namespace WebCore {
virtual bool rendererIsNeeded(RenderStyle*);
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp
index cc92cc4..2dca164 100644
--- a/WebCore/svg/SVGStyledTransformableElement.cpp
+++ b/WebCore/svg/SVGStyledTransformableElement.cpp
@@ -25,7 +25,6 @@
#include "AffineTransform.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "SVGDocument.h"
#include "SVGStyledElement.h"
@@ -66,7 +65,7 @@ AffineTransform* SVGStyledTransformableElement::supplementalTransform()
return m_supplementalTransform.get();
}
-void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStyledTransformableElement::parseMappedAttribute(Attribute* attr)
{
if (SVGTransformable::isKnownAttribute(attr->name())) {
SVGTransformList* localTransforms = transformBaseValue();
diff --git a/WebCore/svg/SVGStyledTransformableElement.h b/WebCore/svg/SVGStyledTransformableElement.h
index d83c0c5..d16995c 100644
--- a/WebCore/svg/SVGStyledTransformableElement.h
+++ b/WebCore/svg/SVGStyledTransformableElement.h
@@ -49,7 +49,7 @@ public:
virtual FloatRect getBBox() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
bool isKnownAttribute(const QualifiedName&);
diff --git a/WebCore/svg/SVGSymbolElement.cpp b/WebCore/svg/SVGSymbolElement.cpp
index c7edae1..40dab91 100644
--- a/WebCore/svg/SVGSymbolElement.cpp
+++ b/WebCore/svg/SVGSymbolElement.cpp
@@ -39,7 +39,7 @@ SVGSymbolElement::~SVGSymbolElement()
{
}
-void SVGSymbolElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGSymbolElement::parseMappedAttribute(Attribute* attr)
{
if (SVGLangSpace::parseMappedAttribute(attr))
return;
diff --git a/WebCore/svg/SVGSymbolElement.h b/WebCore/svg/SVGSymbolElement.h
index 907bf0f..9db81c4 100644
--- a/WebCore/svg/SVGSymbolElement.h
+++ b/WebCore/svg/SVGSymbolElement.h
@@ -37,7 +37,7 @@ namespace WebCore {
SVGSymbolElement(const QualifiedName&, Document*);
virtual ~SVGSymbolElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
diff --git a/WebCore/svg/SVGTRefElement.cpp b/WebCore/svg/SVGTRefElement.cpp
index 06ae896..4faa633 100644
--- a/WebCore/svg/SVGTRefElement.cpp
+++ b/WebCore/svg/SVGTRefElement.cpp
@@ -51,7 +51,7 @@ void SVGTRefElement::updateReferencedText()
setTextContent(textContent, ignore);
}
-void SVGTRefElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTRefElement::parseMappedAttribute(Attribute* attr)
{
if (SVGURIReference::parseMappedAttribute(attr)) {
updateReferencedText();
diff --git a/WebCore/svg/SVGTRefElement.h b/WebCore/svg/SVGTRefElement.h
index ff6eac0..261e2ce 100644
--- a/WebCore/svg/SVGTRefElement.h
+++ b/WebCore/svg/SVGTRefElement.h
@@ -33,7 +33,7 @@ namespace WebCore {
SVGTRefElement(const QualifiedName&, Document*);
virtual ~SVGTRefElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGTests.cpp b/WebCore/svg/SVGTests.cpp
index 258c12c..5f32403 100644
--- a/WebCore/svg/SVGTests.cpp
+++ b/WebCore/svg/SVGTests.cpp
@@ -23,9 +23,9 @@
#if ENABLE(SVG)
#include "SVGTests.h"
+#include "Attribute.h"
#include "DOMImplementation.h"
#include "Language.h"
-#include "MappedAttribute.h"
#include "SVGElement.h"
#include "SVGNames.h"
#include "SVGStringList.h"
@@ -93,7 +93,7 @@ bool SVGTests::isValid() const
return true;
}
-bool SVGTests::parseMappedAttribute(MappedAttribute* attr)
+bool SVGTests::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::requiredFeaturesAttr) {
requiredFeatures()->reset(attr->value());
diff --git a/WebCore/svg/SVGTests.h b/WebCore/svg/SVGTests.h
index a2abddf..503f6c7 100644
--- a/WebCore/svg/SVGTests.h
+++ b/WebCore/svg/SVGTests.h
@@ -26,10 +26,10 @@
namespace WebCore {
- class MappedAttribute;
- class String;
- class SVGStringList;
+ class Attribute;
class QualifiedName;
+ class SVGStringList;
+ class String;
class SVGTests {
public:
@@ -44,7 +44,7 @@ namespace WebCore {
bool isValid() const;
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp
index 3f1ec49..4fef0ee 100644
--- a/WebCore/svg/SVGTextContentElement.cpp
+++ b/WebCore/svg/SVGTextContentElement.cpp
@@ -23,13 +23,13 @@
#if ENABLE(SVG)
#include "SVGTextContentElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "ExceptionCode.h"
#include "FloatPoint.h"
#include "FloatRect.h"
#include "Frame.h"
-#include "MappedAttribute.h"
#include "Position.h"
#include "RenderSVGText.h"
#include "SVGCharacterData.h"
@@ -482,7 +482,7 @@ void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
controller->setSelection(VisibleSelection(start, end));
}
-void SVGTextContentElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextContentElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::lengthAdjustAttr) {
if (attr->value() == "spacing")
diff --git a/WebCore/svg/SVGTextContentElement.h b/WebCore/svg/SVGTextContentElement.h
index 7dff3d5..f73d5e4 100644
--- a/WebCore/svg/SVGTextContentElement.h
+++ b/WebCore/svg/SVGTextContentElement.h
@@ -58,7 +58,7 @@ namespace WebCore {
int getCharNumAtPosition(const FloatPoint&) const;
void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
bool isKnownAttribute(const QualifiedName&);
diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp
index 25729cf..f62dc68 100644
--- a/WebCore/svg/SVGTextElement.cpp
+++ b/WebCore/svg/SVGTextElement.cpp
@@ -24,8 +24,8 @@
#include "SVGTextElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "FloatRect.h"
-#include "MappedAttribute.h"
#include "RenderSVGText.h"
#include "SVGLengthList.h"
#include "SVGRenderStyle.h"
@@ -45,7 +45,7 @@ SVGTextElement::~SVGTextElement()
{
}
-void SVGTextElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextElement::parseMappedAttribute(Attribute* attr)
{
if (SVGTransformable::isKnownAttribute(attr->name())) {
SVGTransformList* localTransforms = transformBaseValue();
diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h
index 5e3f5d9..4c7db90 100644
--- a/WebCore/svg/SVGTextElement.h
+++ b/WebCore/svg/SVGTextElement.h
@@ -33,7 +33,7 @@ namespace WebCore {
SVGTextElement(const QualifiedName&, Document*);
virtual ~SVGTextElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual SVGElement* nearestViewportElement() const;
virtual SVGElement* farthestViewportElement() const;
diff --git a/WebCore/svg/SVGTextPathElement.cpp b/WebCore/svg/SVGTextPathElement.cpp
index a428a44..4a2cea5 100644
--- a/WebCore/svg/SVGTextPathElement.cpp
+++ b/WebCore/svg/SVGTextPathElement.cpp
@@ -23,8 +23,8 @@
#include "SVGTextPathElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "FloatRect.h"
-#include "MappedAttribute.h"
#include "RenderSVGTextPath.h"
#include "SVGLengthList.h"
#include "SVGPathElement.h"
@@ -46,7 +46,7 @@ SVGTextPathElement::~SVGTextPathElement()
{
}
-void SVGTextPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextPathElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
diff --git a/WebCore/svg/SVGTextPathElement.h b/WebCore/svg/SVGTextPathElement.h
index 0862335..943d795 100644
--- a/WebCore/svg/SVGTextPathElement.h
+++ b/WebCore/svg/SVGTextPathElement.h
@@ -56,7 +56,7 @@ namespace WebCore {
virtual void insertedIntoDocument();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/svg/SVGTextPositioningElement.cpp b/WebCore/svg/SVGTextPositioningElement.cpp
index dd99b49..12b1975 100644
--- a/WebCore/svg/SVGTextPositioningElement.cpp
+++ b/WebCore/svg/SVGTextPositioningElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "SVGTextPositioningElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderObject.h"
#include "SVGLengthList.h"
#include "SVGNames.h"
@@ -45,7 +45,7 @@ SVGTextPositioningElement::~SVGTextPositioningElement()
{
}
-void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextPositioningElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
xBaseValue()->parse(attr->value(), LengthModeWidth);
diff --git a/WebCore/svg/SVGTextPositioningElement.h b/WebCore/svg/SVGTextPositioningElement.h
index 71e8900..f3e11bc 100644
--- a/WebCore/svg/SVGTextPositioningElement.h
+++ b/WebCore/svg/SVGTextPositioningElement.h
@@ -33,7 +33,7 @@ namespace WebCore {
SVGTextPositioningElement(const QualifiedName&, Document*);
virtual ~SVGTextPositioningElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGURIReference.cpp b/WebCore/svg/SVGURIReference.cpp
index 5dbdfb8..8ceba80 100644
--- a/WebCore/svg/SVGURIReference.cpp
+++ b/WebCore/svg/SVGURIReference.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "SVGURIReference.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
namespace WebCore {
@@ -35,7 +35,7 @@ SVGURIReference::~SVGURIReference()
{
}
-bool SVGURIReference::parseMappedAttribute(MappedAttribute* attr)
+bool SVGURIReference::parseMappedAttribute(Attribute* attr)
{
if (attr->name().matches(XLinkNames::hrefAttr)) {
setHrefBaseValue(attr->value());
diff --git a/WebCore/svg/SVGURIReference.h b/WebCore/svg/SVGURIReference.h
index ea09f2e..e8f317d 100644
--- a/WebCore/svg/SVGURIReference.h
+++ b/WebCore/svg/SVGURIReference.h
@@ -27,14 +27,14 @@
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
class SVGURIReference {
public:
SVGURIReference();
virtual ~SVGURIReference();
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
static String getTarget(const String& url);
diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp
index 324d849..a33a56e 100644
--- a/WebCore/svg/SVGUseElement.cpp
+++ b/WebCore/svg/SVGUseElement.cpp
@@ -24,12 +24,12 @@
#if ENABLE(SVG)
#include "SVGUseElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
#include "Document.h"
#include "Event.h"
#include "EventListener.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "NodeRenderStyle.h"
#include "RegisteredEventListener.h"
#include "RenderSVGShadowTreeRootContainer.h"
@@ -38,9 +38,9 @@
#include "SVGGElement.h"
#include "SVGLength.h"
#include "SVGPreserveAspectRatio.h"
-#include "SVGShadowTreeElements.h"
#include "SVGSMILElement.h"
#include "SVGSVGElement.h"
+#include "SVGShadowTreeElements.h"
#include "SVGSymbolElement.h"
#include "XLinkNames.h"
#include "XMLSerializer.h"
@@ -90,7 +90,7 @@ SVGElementInstance* SVGUseElement::animatedInstanceRoot() const
return 0;
}
-void SVGUseElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGUseElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGUseElement.h b/WebCore/svg/SVGUseElement.h
index 5519274..01a193b 100644
--- a/WebCore/svg/SVGUseElement.h
+++ b/WebCore/svg/SVGUseElement.h
@@ -52,7 +52,7 @@ namespace WebCore {
virtual void removedFromDocument();
virtual void buildPendingResource();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGViewElement.cpp b/WebCore/svg/SVGViewElement.cpp
index aba7283..c19c7cf 100644
--- a/WebCore/svg/SVGViewElement.cpp
+++ b/WebCore/svg/SVGViewElement.cpp
@@ -24,7 +24,6 @@
#include "SVGViewElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "PlatformString.h"
#include "SVGFitToViewBox.h"
#include "SVGNames.h"
@@ -53,7 +52,7 @@ SVGStringList* SVGViewElement::viewTarget() const
return m_viewTarget.get();
}
-void SVGViewElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGViewElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::viewTargetAttr)
viewTarget()->reset(attr->value());
diff --git a/WebCore/svg/SVGViewElement.h b/WebCore/svg/SVGViewElement.h
index f913fcd..b834cee 100644
--- a/WebCore/svg/SVGViewElement.h
+++ b/WebCore/svg/SVGViewElement.h
@@ -38,7 +38,7 @@ namespace WebCore {
SVGViewElement(const QualifiedName&, Document*);
virtual ~SVGViewElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
SVGStringList* viewTarget() const;
diff --git a/WebCore/svg/SVGZoomAndPan.cpp b/WebCore/svg/SVGZoomAndPan.cpp
index b1ea995..782da0b 100644
--- a/WebCore/svg/SVGZoomAndPan.cpp
+++ b/WebCore/svg/SVGZoomAndPan.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "SVGZoomAndPan.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -48,7 +48,7 @@ void SVGZoomAndPan::setZoomAndPan(unsigned short zoomAndPan)
m_zoomAndPan = zoomAndPan;
}
-bool SVGZoomAndPan::parseMappedAttribute(MappedAttribute* attr)
+bool SVGZoomAndPan::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::zoomAndPanAttr) {
const UChar* start = attr->value().characters();
diff --git a/WebCore/svg/SVGZoomAndPan.h b/WebCore/svg/SVGZoomAndPan.h
index c11f8e2..95c0772 100644
--- a/WebCore/svg/SVGZoomAndPan.h
+++ b/WebCore/svg/SVGZoomAndPan.h
@@ -26,7 +26,7 @@
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
class QualifiedName;
class SVGZoomAndPan {
@@ -43,7 +43,7 @@ namespace WebCore {
unsigned short zoomAndPan() const;
virtual void setZoomAndPan(unsigned short zoomAndPan);
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
bool parseZoomAndPan(const UChar*& start, const UChar* end);
diff --git a/WebCore/svg/animation/SVGSMILElement.cpp b/WebCore/svg/animation/SVGSMILElement.cpp
index 2bd33dd..e51fb58 100644
--- a/WebCore/svg/animation/SVGSMILElement.cpp
+++ b/WebCore/svg/animation/SVGSMILElement.cpp
@@ -28,6 +28,7 @@
#if ENABLE(SVG_ANIMATION)
#include "SVGSMILElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "Document.h"
#include "Event.h"
@@ -35,7 +36,6 @@
#include "FloatConversion.h"
#include "FrameView.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "SMILTimeContainer.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -342,7 +342,7 @@ void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin
sortTimeList(timeList);
}
-void SVGSMILElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGSMILElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::beginAttr) {
if (!m_conditions.isEmpty()) {
diff --git a/WebCore/svg/animation/SVGSMILElement.h b/WebCore/svg/animation/SVGSMILElement.h
index 8fcc2fc..c2e6125 100644
--- a/WebCore/svg/animation/SVGSMILElement.h
+++ b/WebCore/svg/animation/SVGSMILElement.h
@@ -45,7 +45,7 @@ namespace WebCore {
static bool isSMILElement(Node* node);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attributeChanged(Attribute*, bool preserveDecls);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp
index 97ef710..0737112 100644
--- a/WebCore/svg/graphics/SVGImage.cpp
+++ b/WebCore/svg/graphics/SVGImage.cpp
@@ -255,7 +255,7 @@ bool SVGImage::dataChanged(bool allDataReceived)
// FIXME: If this SVG ends up loading itself, we might leak the world.
// The comment said that the Cache code does not know about CachedImages
// holding Frames and won't know to break the cycle. But
- m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, 0, 0));
+ m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, 0, 0, 0));
m_page->settings()->setMediaEnabled(false);
m_page->settings()->setJavaScriptEnabled(false);
m_page->settings()->setPluginsEnabled(false);
diff --git a/WebCore/svg/graphics/filters/SVGFELighting.cpp b/WebCore/svg/graphics/filters/SVGFELighting.cpp
index 980e936..2bfcfae 100644
--- a/WebCore/svg/graphics/filters/SVGFELighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFELighting.cpp
@@ -254,7 +254,6 @@ void FELighting::apply(Filter* filter)
setIsAlphaImage(false);
IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-
RefPtr<ImageData> srcImageData(m_in->resultImage()->getUnmultipliedImageData(effectDrawingRect));
CanvasPixelArray* srcPixelArray(srcImageData->data());
@@ -264,7 +263,7 @@ void FELighting::apply(Filter* filter)
// Anyway, feConvolveMatrix should also use the implementation
if (drawLighting(srcPixelArray, effectDrawingRect.width(), effectDrawingRect.height()))
- resultImage()->putUnmultipliedImageData(srcImageData.get(), IntRect(IntPoint(), effectDrawingRect.size()), effectDrawingRect.location());
+ resultImage()->putUnmultipliedImageData(srcImageData.get(), IntRect(IntPoint(), resultImage()->size()), IntPoint());
}
} // namespace WebCore
diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp
index 1449c89..ea4f5e5 100644
--- a/WebCore/websockets/WebSocketHandshake.cpp
+++ b/WebCore/websockets/WebSocketHandshake.cpp
@@ -44,22 +44,25 @@
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
#include "StringBuilder.h"
-#include <wtf/text/CString.h>
+
+#include <wtf/MD5.h>
+#include <wtf/RandomNumber.h>
+#include <wtf/StdLibExtras.h>
#include <wtf/StringExtras.h>
#include <wtf/Vector.h>
+#include <wtf/text/CString.h>
namespace WebCore {
-const char webSocketServerHandshakeHeader[] = "HTTP/1.1 101 Web Socket Protocol Handshake\r\n";
-const char webSocketUpgradeHeader[] = "Upgrade: WebSocket\r\n";
-const char webSocketConnectionHeader[] = "Connection: Upgrade\r\n";
+static const char randomCharacterInSecWebSocketKey[] = "!\"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
-static String extractResponseCode(const char* header, int len)
+static String extractResponseCode(const char* header, int len, size_t& lineLength)
{
const char* space1 = 0;
const char* space2 = 0;
const char* p;
- for (p = header; p - header < len; p++) {
+ lineLength = 0;
+ for (p = header; p - header < len; p++, lineLength++) {
if (*p == ' ') {
if (!space1)
space1 = p;
@@ -87,6 +90,18 @@ static String resourceName(const KURL& url)
return name;
}
+static String hostName(const KURL& url, bool secure)
+{
+ ASSERT(url.protocolIs("wss") == secure);
+ StringBuilder builder;
+ builder.append(url.host().lower());
+ if (url.port() && ((!secure && url.port() != 80) || (secure && url.port() != 443))) {
+ builder.append(":");
+ builder.append(String::number(url.port()));
+ }
+ return builder.toString();
+}
+
static String trimConsoleMessage(const char* p, size_t len)
{
String s = String(p, std::min<size_t>(len, 128));
@@ -95,6 +110,58 @@ static String trimConsoleMessage(const char* p, size_t len)
return s;
}
+static void generateSecWebSocketKey(uint32_t& number, String& key)
+{
+ uint32_t space = static_cast<uint32_t>(randomNumber() * 12) + 1;
+ uint32_t max = 4294967295U / space;
+ number = static_cast<uint32_t>(randomNumber() * max);
+ uint32_t product = number * space;
+
+ String s = String::number(product);
+ int n = static_cast<int>(randomNumber() * 12) + 1;
+ DEFINE_STATIC_LOCAL(String, randomChars, (randomCharacterInSecWebSocketKey));
+ for (int i = 0; i < n; i++) {
+ int pos = static_cast<int>(randomNumber() * (s.length() + 1));
+ int chpos = static_cast<int>(randomNumber() * randomChars.length());
+ s.insert(randomChars.substring(chpos, 1), pos);
+ }
+ DEFINE_STATIC_LOCAL(String, spaceChar, (" "));
+ for (uint32_t i = 0; i < space; i++) {
+ int pos = static_cast<int>(randomNumber() * s.length() - 1) + 1;
+ s.insert(spaceChar, pos);
+ }
+ key = s;
+}
+
+static void generateKey3(unsigned char key3[8])
+{
+ for (int i = 0; i < 8; i++)
+ key3[i] = randomNumber() * 256;
+}
+
+static void setChallengeNumber(unsigned char* buf, uint32_t number)
+{
+ unsigned char* p = buf + 3;
+ for (int i = 0; i < 4; i++) {
+ *p = number & 0xFF;
+ --p;
+ number >>= 8;
+ }
+}
+
+static void generateExpectedChallengeResponse(uint32_t number1, uint32_t number2, unsigned char key3[8], unsigned char expectedChallenge[16])
+{
+ unsigned char challenge[16];
+ setChallengeNumber(&challenge[0], number1);
+ setChallengeNumber(&challenge[4], number2);
+ memcpy(&challenge[8], key3, 8);
+ MD5 md5;
+ md5.addBytes(challenge, sizeof(challenge));
+ Vector<uint8_t, 16> digest;
+ md5.checksum(digest);
+ memcpy(expectedChallenge, digest.data(), 16);
+}
+
WebSocketHandshake::WebSocketHandshake(const KURL& url, const String& protocol, ScriptExecutionContext* context)
: m_url(url)
, m_clientProtocol(protocol)
@@ -102,6 +169,12 @@ WebSocketHandshake::WebSocketHandshake(const KURL& url, const String& protocol,
, m_context(context)
, m_mode(Incomplete)
{
+ uint32_t number1;
+ uint32_t number2;
+ generateSecWebSocketKey(number1, m_secWebSocketKey1);
+ generateSecWebSocketKey(number2, m_secWebSocketKey2);
+ generateKey3(m_key3);
+ generateExpectedChallengeResponse(number1, number2, m_key3, m_expectedChallengeResponse);
}
WebSocketHandshake::~WebSocketHandshake()
@@ -148,13 +221,7 @@ String WebSocketHandshake::clientLocation() const
StringBuilder builder;
builder.append(m_secure ? "wss" : "ws");
builder.append("://");
- builder.append(m_url.host().lower());
- if (m_url.port()) {
- if ((!m_secure && m_url.port() != 80) || (m_secure && m_url.port() != 443)) {
- builder.append(":");
- builder.append(String::number(m_url.port()));
- }
- }
+ builder.append(hostName(m_url, m_secure));
builder.append(resourceName(m_url));
return builder.toString();
}
@@ -167,43 +234,51 @@ CString WebSocketHandshake::clientHandshakeMessage() const
builder.append("GET ");
builder.append(resourceName(m_url));
builder.append(" HTTP/1.1\r\n");
- builder.append("Upgrade: WebSocket\r\n");
- builder.append("Connection: Upgrade\r\n");
- builder.append("Host: ");
- builder.append(m_url.host().lower());
- if (m_url.port() && ((!m_secure && m_url.port() != 80) || (m_secure && m_url.port() != 443))) {
- builder.append(":");
- builder.append(String::number(m_url.port()));
- }
- builder.append("\r\n");
- builder.append("Origin: ");
- builder.append(clientOrigin());
- builder.append("\r\n");
- if (!m_clientProtocol.isEmpty()) {
- builder.append("WebSocket-Protocol: ");
- builder.append(m_clientProtocol);
- builder.append("\r\n");
- }
+
+ Vector<String> fields;
+ fields.append("Upgrade: WebSocket");
+ fields.append("Connection: Upgrade");
+ fields.append("Host: " + hostName(m_url, m_secure));
+ fields.append("Origin: " + clientOrigin());
+ if (!m_clientProtocol.isEmpty())
+ fields.append("Sec-WebSocket-Protocol: " + m_clientProtocol);
KURL url = httpURLForAuthenticationAndCookies();
if (m_context->isDocument()) {
Document* document = static_cast<Document*>(m_context);
String cookie = cookieRequestHeaderFieldValue(document, url);
- if (!cookie.isEmpty()) {
- builder.append("Cookie: ");
- builder.append(cookie);
- builder.append("\r\n");
- }
+ if (!cookie.isEmpty())
+ fields.append("Cookie: " + cookie);
// Set "Cookie2: <cookie>" if cookies 2 exists for url?
}
+ fields.append("Sec-WebSocket-Key1: " + m_secWebSocketKey1);
+ fields.append("Sec-WebSocket-Key2: " + m_secWebSocketKey2);
+
+ // Fields in the handshake are sent by the client in a random order; the
+ // order is not meaningful. Thus, it's ok to send the order we constructed
+ // the fields.
+
+ for (size_t i = 0; i < fields.size(); i++) {
+ builder.append(fields[i]);
+ builder.append("\r\n");
+ }
+
builder.append("\r\n");
- return builder.toString().utf8();
+
+ CString handshakeHeader = builder.toString().utf8();
+ char* characterBuffer = 0;
+ CString msg = CString::newUninitialized(handshakeHeader.length() + sizeof(m_key3), characterBuffer);
+ memcpy(characterBuffer, handshakeHeader.data(), handshakeHeader.length());
+ memcpy(characterBuffer + handshakeHeader.length(), m_key3, sizeof(m_key3));
+ return msg;
}
WebSocketHandshakeRequest WebSocketHandshake::clientHandshakeRequest() const
{
// Keep the following consistent with clientHandshakeMessage().
+ // FIXME: do we need to store m_secWebSocketKey1, m_secWebSocketKey2 and
+ // m_key3 in WebSocketHandshakeRequest?
WebSocketHandshakeRequest request(m_url, clientOrigin(), m_clientProtocol);
KURL url = httpURLForAuthenticationAndCookies();
@@ -237,89 +312,55 @@ void WebSocketHandshake::clearScriptExecutionContext()
int WebSocketHandshake::readServerHandshake(const char* header, size_t len)
{
m_mode = Incomplete;
- if (len < sizeof(webSocketServerHandshakeHeader) - 1) {
- // Just hasn't been received fully yet.
+ size_t lineLength;
+ const String& code = extractResponseCode(header, len, lineLength);
+ if (code.isNull()) {
+ // Just hasn't been received yet.
return -1;
}
- if (!memcmp(header, webSocketServerHandshakeHeader, sizeof(webSocketServerHandshakeHeader) - 1))
- m_mode = Normal;
- else {
- const String& code = extractResponseCode(header, len);
- if (code.isNull()) {
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Short server handshake: " + trimConsoleMessage(header, len), 0, clientOrigin());
- return -1;
- }
- if (code.isEmpty()) {
- m_mode = Failed;
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "No response code found: " + trimConsoleMessage(header, len), 0, clientOrigin());
- return len;
- }
- LOG(Network, "response code: %s", code.utf8().data());
- if (code == "401") {
- m_mode = Failed;
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Authentication required, but not implemented yet.", 0, clientOrigin());
- return len;
- } else {
- m_mode = Failed;
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected response code:" + code, 0, clientOrigin());
- return len;
- }
+ if (code.isEmpty()) {
+ m_mode = Failed;
+ m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "No response code found: " + trimConsoleMessage(header, lineLength), 0, clientOrigin());
+ return len;
}
- const char* p = header + sizeof(webSocketServerHandshakeHeader) - 1;
- const char* end = header + len;
-
- if (m_mode == Normal) {
- size_t headerSize = end - p;
- if (headerSize < sizeof(webSocketUpgradeHeader) - 1) {
- m_mode = Incomplete;
- return 0;
- }
- if (memcmp(p, webSocketUpgradeHeader, sizeof(webSocketUpgradeHeader) - 1)) {
- m_mode = Failed;
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Bad Upgrade header: " + trimConsoleMessage(p, end - p), 0, clientOrigin());
- return p - header + sizeof(webSocketUpgradeHeader) - 1;
- }
- p += sizeof(webSocketUpgradeHeader) - 1;
-
- headerSize = end - p;
- if (headerSize < sizeof(webSocketConnectionHeader) - 1) {
- m_mode = Incomplete;
- return -1;
- }
- if (memcmp(p, webSocketConnectionHeader, sizeof(webSocketConnectionHeader) - 1)) {
- m_mode = Failed;
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Bad Connection header: " + trimConsoleMessage(p, end - p), 0, clientOrigin());
- return p - header + sizeof(webSocketConnectionHeader) - 1;
- }
- p += sizeof(webSocketConnectionHeader) - 1;
+ LOG(Network, "response code: %s", code.utf8().data());
+ if (code != "101") {
+ m_mode = Failed;
+ m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected response code:" + code, 0, clientOrigin());
+ return len;
}
-
- if (!strnstr(p, "\r\n\r\n", end - p)) {
+ m_mode = Normal;
+ if (!strnstr(header, "\r\n\r\n", len)) {
// Just hasn't been received fully yet.
m_mode = Incomplete;
return -1;
}
HTTPHeaderMap headers;
- p = readHTTPHeaders(p, end, &headers);
+ const char* headerFields = strnstr(header, "\r\n", len); // skip status line
+ ASSERT(headerFields);
+ headerFields += 2; // skip "\r\n".
+ const char* p = readHTTPHeaders(headerFields, header + len, &headers);
if (!p) {
LOG(Network, "readHTTPHeaders failed");
m_mode = Failed;
return len;
}
- if (!processHeaders(headers)) {
+ if (!processHeaders(headers) || !checkResponseHeaders()) {
LOG(Network, "header process failed");
m_mode = Failed;
return p - header;
}
- switch (m_mode) {
- case Normal:
- checkResponseHeaders();
- break;
- default:
+ if (len < static_cast<size_t>(p - header + sizeof(m_expectedChallengeResponse))) {
+ // Just hasn't been received /expected/ yet.
+ m_mode = Incomplete;
+ return -1;
+ }
+ if (memcmp(p, m_expectedChallengeResponse, sizeof(m_expectedChallengeResponse))) {
m_mode = Failed;
- break;
+ return (p - header) + sizeof(m_expectedChallengeResponse);
}
- return p - header;
+ m_mode = Connected;
+ return (p - header) + sizeof(m_expectedChallengeResponse);
}
WebSocketHandshake::Mode WebSocketHandshake::mode() const
@@ -402,10 +443,10 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e
m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "CR doesn't follow LF at " + trimConsoleMessage(p, end - p), 0, clientOrigin());
return 0;
}
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected CR in name at " + trimConsoleMessage(p, end - p), 0, clientOrigin());
+ m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected CR in name at " + trimConsoleMessage(name.data(), name.size()), 0, clientOrigin());
return 0;
case '\n':
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in name at " + trimConsoleMessage(p, end - p), 0, clientOrigin());
+ m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in name at " + trimConsoleMessage(name.data(), name.size()), 0, clientOrigin());
return 0;
case ':':
break;
@@ -429,7 +470,7 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e
case '\r':
break;
case '\n':
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in value at " + trimConsoleMessage(p, end - p), 0, clientOrigin());
+ m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in value at " + trimConsoleMessage(value.data(), value.size()), 0, clientOrigin());
return 0;
default:
value.append(*p);
@@ -465,11 +506,11 @@ bool WebSocketHandshake::processHeaders(const HTTPHeaderMap& headers)
for (HTTPHeaderMap::const_iterator it = headers.begin(); it != headers.end(); ++it) {
switch (m_mode) {
case Normal:
- if (it->first == "websocket-origin")
+ if (it->first == "sec-websocket-origin")
m_wsOrigin = it->second;
- else if (it->first == "websocket-location")
+ else if (it->first == "sec-websocket-location")
m_wsLocation = it->second;
- else if (it->first == "websocket-protocol")
+ else if (it->first == "sec-websocket-protocol")
m_wsProtocol = it->second;
else if (it->first == "set-cookie")
m_setCookie = it->second;
@@ -486,35 +527,32 @@ bool WebSocketHandshake::processHeaders(const HTTPHeaderMap& headers)
return true;
}
-void WebSocketHandshake::checkResponseHeaders()
+bool WebSocketHandshake::checkResponseHeaders()
{
- ASSERT(m_mode == Normal);
- m_mode = Failed;
if (m_wsOrigin.isNull()) {
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'websocket-origin' header is missing", 0, clientOrigin());
- return;
+ m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'sec-websocket-origin' header is missing", 0, clientOrigin());
+ return false;
}
if (m_wsLocation.isNull()) {
- m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'websocket-location' header is missing", 0, clientOrigin());
- return;
+ m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'sec-websocket-location' header is missing", 0, clientOrigin());
+ return false;
}
if (clientOrigin() != m_wsOrigin) {
m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: origin mismatch: " + clientOrigin() + " != " + m_wsOrigin, 0, clientOrigin());
- return;
+ return false;
}
if (clientLocation() != m_wsLocation) {
m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: location mismatch: " + clientLocation() + " != " + m_wsLocation, 0, clientOrigin());
- return;
+ return false;
}
if (!m_clientProtocol.isEmpty() && m_clientProtocol != m_wsProtocol) {
m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: protocol mismatch: " + m_clientProtocol + " != " + m_wsProtocol, 0, clientOrigin());
- return;
+ return false;
}
- m_mode = Connected;
- return;
+ return true;
}
-} // namespace WebCore
+} // namespace WebCore
-#endif // ENABLE(WEB_SOCKETS)
+#endif // ENABLE(WEB_SOCKETS)
diff --git a/WebCore/websockets/WebSocketHandshake.h b/WebCore/websockets/WebSocketHandshake.h
index df199ff..3e0c66a 100644
--- a/WebCore/websockets/WebSocketHandshake.h
+++ b/WebCore/websockets/WebSocketHandshake.h
@@ -40,8 +40,8 @@
namespace WebCore {
- class ScriptExecutionContext;
class HTTPHeaderMap;
+ class ScriptExecutionContext;
class WebSocketHandshake : public Noncopyable {
public:
@@ -92,7 +92,7 @@ namespace WebCore {
// Reads all headers except for the two predefined ones.
const char* readHTTPHeaders(const char* start, const char* end, HTTPHeaderMap* headers);
bool processHeaders(const HTTPHeaderMap& headers);
- void checkResponseHeaders();
+ bool checkResponseHeaders();
KURL m_url;
String m_clientProtocol;
@@ -106,6 +106,11 @@ namespace WebCore {
String m_wsProtocol;
String m_setCookie;
String m_setCookie2;
+
+ String m_secWebSocketKey1;
+ String m_secWebSocketKey2;
+ unsigned char m_key3[8];
+ unsigned char m_expectedChallengeResponse[16];
};
} // namespace WebCore
diff --git a/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp b/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp
index fd86604..f8d1230 100644
--- a/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp
+++ b/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp
@@ -34,7 +34,7 @@
#include "WorkerThreadableWebSocketChannel.h"
-#include "GenericWorkerTask.h"
+#include "CrossThreadTask.h"
#include "PlatformString.h"
#include "ScriptExecutionContext.h"
#include "ThreadableWebSocketChannelClientWrapper.h"
diff --git a/WebCore/wml/WMLAElement.cpp b/WebCore/wml/WMLAElement.cpp
index 55b2698..99e30e9 100644
--- a/WebCore/wml/WMLAElement.cpp
+++ b/WebCore/wml/WMLAElement.cpp
@@ -29,6 +29,7 @@
#if ENABLE(WML)
#include "WMLAElement.h"
+#include "Attribute.h"
#include "Event.h"
#include "EventHandler.h"
#include "EventNames.h"
@@ -36,7 +37,6 @@
#include "FrameLoader.h"
#include "HTMLNames.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "RenderBox.h"
#include "ResourceHandle.h"
@@ -51,7 +51,7 @@ WMLAElement::WMLAElement(const QualifiedName& tagName, Document* doc)
{
}
-void WMLAElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLAElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::hrefAttr) {
bool wasLink = isLink();
@@ -140,7 +140,7 @@ void WMLAElement::defaultEventHandler(Event* event)
}
if (!event->defaultPrevented() && document()->frame()) {
- String url = document()->completeURL(deprecatedParseURL(getAttribute(HTMLNames::hrefAttr)));
+ KURL url = document()->completeURL(deprecatedParseURL(getAttribute(HTMLNames::hrefAttr)));
document()->frame()->loader()->urlSelected(url, target(), event, false, false, true, SendReferrer);
}
diff --git a/WebCore/wml/WMLAElement.h b/WebCore/wml/WMLAElement.h
index 7b19081..b21ebb6 100644
--- a/WebCore/wml/WMLAElement.h
+++ b/WebCore/wml/WMLAElement.h
@@ -39,7 +39,7 @@ public:
virtual bool isMouseFocusable() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void defaultEventHandler(Event*);
virtual void accessKeyAction(bool fullAction);
diff --git a/WebCore/wml/WMLAccessElement.cpp b/WebCore/wml/WMLAccessElement.cpp
index a633260..d6e6768 100644
--- a/WebCore/wml/WMLAccessElement.cpp
+++ b/WebCore/wml/WMLAccessElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(WML)
#include "WMLAccessElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "WMLDocument.h"
#include "WMLNames.h"
#include "WMLVariables.h"
@@ -37,7 +37,7 @@ WMLAccessElement::WMLAccessElement(const QualifiedName& tagName, Document* doc)
{
}
-void WMLAccessElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLAccessElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == domainAttr) {
String value = parseValueForbiddingVariableReferences(attr->value());
diff --git a/WebCore/wml/WMLAccessElement.h b/WebCore/wml/WMLAccessElement.h
index 1bc44ab..83290e4 100644
--- a/WebCore/wml/WMLAccessElement.h
+++ b/WebCore/wml/WMLAccessElement.h
@@ -30,7 +30,7 @@ class WMLAccessElement : public WMLElement {
public:
WMLAccessElement(const QualifiedName& tagName, Document*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
private:
diff --git a/WebCore/wml/WMLBRElement.cpp b/WebCore/wml/WMLBRElement.cpp
index 035619f..d24d2a2 100644
--- a/WebCore/wml/WMLBRElement.cpp
+++ b/WebCore/wml/WMLBRElement.cpp
@@ -28,9 +28,9 @@
#if ENABLE(WML)
#include "WMLBRElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderBR.h"
namespace WebCore {
@@ -50,7 +50,7 @@ bool WMLBRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntr
return WMLElement::mapToEntry(attrName, result);
}
-void WMLBRElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLBRElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::clearAttr) {
// If the string is empty, then don't add the clear property.
diff --git a/WebCore/wml/WMLBRElement.h b/WebCore/wml/WMLBRElement.h
index 4d65ed4..41c8776 100644
--- a/WebCore/wml/WMLBRElement.h
+++ b/WebCore/wml/WMLBRElement.h
@@ -35,7 +35,7 @@ public:
WMLBRElement(const QualifiedName& tagName, Document*);
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
};
diff --git a/WebCore/wml/WMLCardElement.cpp b/WebCore/wml/WMLCardElement.cpp
index 45752cd..539dcd3 100644
--- a/WebCore/wml/WMLCardElement.cpp
+++ b/WebCore/wml/WMLCardElement.cpp
@@ -23,15 +23,15 @@
#if ENABLE(WML)
#include "WMLCardElement.h"
+#include "Attribute.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "NodeList.h"
#include "Page.h"
#include "RenderStyle.h"
-#include "WMLDocument.h"
#include "WMLDoElement.h"
+#include "WMLDocument.h"
#include "WMLInputElement.h"
#include "WMLIntrinsicEventHandler.h"
#include "WMLNames.h"
@@ -209,7 +209,7 @@ void WMLCardElement::handleDeckLevelTaskOverridesIfNeeded()
(*it)->setActive(!cardDoElementNames.contains((*it)->name()));
}
-void WMLCardElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLCardElement::parseMappedAttribute(Attribute* attr)
{
WMLIntrinsicEventType eventType = WMLIntrinsicEventUnknown;
diff --git a/WebCore/wml/WMLCardElement.h b/WebCore/wml/WMLCardElement.h
index 972961e..40eec36 100644
--- a/WebCore/wml/WMLCardElement.h
+++ b/WebCore/wml/WMLCardElement.h
@@ -47,7 +47,7 @@ public:
void handleIntrinsicEventIfNeeded();
void handleDeckLevelTaskOverridesIfNeeded();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/wml/WMLDoElement.cpp b/WebCore/wml/WMLDoElement.cpp
index 38ad5dd..6a40fc9 100644
--- a/WebCore/wml/WMLDoElement.cpp
+++ b/WebCore/wml/WMLDoElement.cpp
@@ -23,19 +23,19 @@
#if ENABLE(WML)
#include "WMLDoElement.h"
+#include "Attribute.h"
#include "Event.h"
#include "EventNames.h"
#include "HTMLNames.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "Page.h"
#include "RenderButton.h"
#include "WMLCardElement.h"
#include "WMLDocument.h"
-#include "WMLTaskElement.h"
-#include "WMLTimerElement.h"
#include "WMLNames.h"
#include "WMLPageState.h"
+#include "WMLTaskElement.h"
+#include "WMLTimerElement.h"
#include "WMLVariables.h"
namespace WebCore {
@@ -95,7 +95,7 @@ void WMLDoElement::defaultEventHandler(Event* event)
}
}
-void WMLDoElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLDoElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::typeAttr)
m_type = parseValueForbiddingVariableReferences(attr->value());
diff --git a/WebCore/wml/WMLDoElement.h b/WebCore/wml/WMLDoElement.h
index fe48eae..024ef80 100644
--- a/WebCore/wml/WMLDoElement.h
+++ b/WebCore/wml/WMLDoElement.h
@@ -33,7 +33,7 @@ public:
WMLDoElement(const QualifiedName& tagName, Document*);
virtual void defaultEventHandler(Event*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/wml/WMLElement.cpp b/WebCore/wml/WMLElement.cpp
index 89fd07a..dbe55a9 100644
--- a/WebCore/wml/WMLElement.cpp
+++ b/WebCore/wml/WMLElement.cpp
@@ -23,9 +23,9 @@
#if ENABLE(WML)
#include "WMLElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderObject.h"
#include "WMLErrorHandling.h"
#include "WMLNames.h"
@@ -58,7 +58,7 @@ bool WMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry&
return StyledElement::mapToEntry(attrName, result);
}
-void WMLElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == idAttributeName()
|| attr->name() == HTMLNames::classAttr
diff --git a/WebCore/wml/WMLElement.h b/WebCore/wml/WMLElement.h
index 0bfaceb..a7c82c0 100644
--- a/WebCore/wml/WMLElement.h
+++ b/WebCore/wml/WMLElement.h
@@ -35,7 +35,7 @@ public:
virtual bool isWMLTaskElement() const { return false; }
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual String title() const;
diff --git a/WebCore/wml/WMLFieldSetElement.cpp b/WebCore/wml/WMLFieldSetElement.cpp
index 3930de2..c89e669 100644
--- a/WebCore/wml/WMLFieldSetElement.cpp
+++ b/WebCore/wml/WMLFieldSetElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(WML)
#include "WMLFieldSetElement.h"
+#include "Attribute.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderFieldset.h"
#include "Text.h"
#include "WMLElementFactory.h"
diff --git a/WebCore/wml/WMLGoElement.cpp b/WebCore/wml/WMLGoElement.cpp
index 4378f34..db4880c 100644
--- a/WebCore/wml/WMLGoElement.cpp
+++ b/WebCore/wml/WMLGoElement.cpp
@@ -23,11 +23,11 @@
#if ENABLE(WML)
#include "WMLGoElement.h"
+#include "Attribute.h"
#include "FormData.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "ResourceRequest.h"
#include "TextEncoding.h"
#include "WMLCardElement.h"
@@ -61,7 +61,7 @@ void WMLGoElement::deregisterPostfieldElement(WMLPostfieldElement* postfield)
m_postfieldElements.remove(position);
}
-void WMLGoElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLGoElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::methodAttr)
m_formDataBuilder.parseMethodType(attr->value());
diff --git a/WebCore/wml/WMLGoElement.h b/WebCore/wml/WMLGoElement.h
index 36c7be2..f602a39 100644
--- a/WebCore/wml/WMLGoElement.h
+++ b/WebCore/wml/WMLGoElement.h
@@ -38,7 +38,7 @@ public:
void registerPostfieldElement(WMLPostfieldElement*);
void deregisterPostfieldElement(WMLPostfieldElement*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void executeTask();
private:
diff --git a/WebCore/wml/WMLImageElement.cpp b/WebCore/wml/WMLImageElement.cpp
index e577218..f6b3f1e 100644
--- a/WebCore/wml/WMLImageElement.cpp
+++ b/WebCore/wml/WMLImageElement.cpp
@@ -23,11 +23,11 @@
#if ENABLE(WML)
#include "WMLImageElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RenderImage.h"
#include "WMLNames.h"
#include "WMLVariables.h"
@@ -65,7 +65,7 @@ bool WMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttributeE
return WMLElement::mapToEntry(attrName, result);
}
-void WMLImageElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLImageElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
diff --git a/WebCore/wml/WMLImageElement.h b/WebCore/wml/WMLImageElement.h
index 8ace3ba..2ec5031 100644
--- a/WebCore/wml/WMLImageElement.h
+++ b/WebCore/wml/WMLImageElement.h
@@ -33,7 +33,7 @@ public:
virtual ~WMLImageElement();
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/wml/WMLInputElement.cpp b/WebCore/wml/WMLInputElement.cpp
index 979a294..bf407c1 100644
--- a/WebCore/wml/WMLInputElement.cpp
+++ b/WebCore/wml/WMLInputElement.cpp
@@ -23,12 +23,12 @@
#if ENABLE(WML)
#include "WMLInputElement.h"
+#include "Attribute.h"
#include "EventNames.h"
#include "FormDataList.h"
#include "Frame.h"
#include "HTMLNames.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "RenderTextControlSingleLine.h"
#include "TextEvent.h"
#include "WMLDocument.h"
@@ -195,7 +195,7 @@ void WMLInputElement::accessKeyAction(bool)
focus(false);
}
-void WMLInputElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLInputElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::nameAttr)
m_data.setName(parseValueForbiddingVariableReferences(attr->value()));
diff --git a/WebCore/wml/WMLInputElement.h b/WebCore/wml/WMLInputElement.h
index bd4e175..b8748fd 100644
--- a/WebCore/wml/WMLInputElement.h
+++ b/WebCore/wml/WMLInputElement.h
@@ -67,7 +67,7 @@ public:
virtual void select();
virtual void accessKeyAction(bool sendToAnyElement);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void copyNonAttributeProperties(const Element* source);
diff --git a/WebCore/wml/WMLMetaElement.cpp b/WebCore/wml/WMLMetaElement.cpp
index 81109ae..e28afaf 100644
--- a/WebCore/wml/WMLMetaElement.cpp
+++ b/WebCore/wml/WMLMetaElement.cpp
@@ -23,9 +23,9 @@
#if ENABLE(WML)
#include "WMLMetaElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
namespace WebCore {
@@ -38,7 +38,7 @@ WMLMetaElement::~WMLMetaElement()
{
}
-void WMLMetaElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLMetaElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::http_equivAttr)
m_equiv = parseValueForbiddingVariableReferences(attr->value());
diff --git a/WebCore/wml/WMLMetaElement.h b/WebCore/wml/WMLMetaElement.h
index 713e225..765490d 100644
--- a/WebCore/wml/WMLMetaElement.h
+++ b/WebCore/wml/WMLMetaElement.h
@@ -31,7 +31,7 @@ public:
WMLMetaElement(const QualifiedName& tagName, Document*);
virtual ~WMLMetaElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
private:
diff --git a/WebCore/wml/WMLOnEventElement.cpp b/WebCore/wml/WMLOnEventElement.cpp
index 6fc4e8b..34518c3 100644
--- a/WebCore/wml/WMLOnEventElement.cpp
+++ b/WebCore/wml/WMLOnEventElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(WML)
#include "WMLOnEventElement.h"
+#include "Attribute.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "WMLErrorHandling.h"
#include "WMLEventHandlingElement.h"
#include "WMLIntrinsicEventHandler.h"
@@ -41,7 +41,7 @@ WMLOnEventElement::WMLOnEventElement(const QualifiedName& tagName, Document* doc
{
}
-void WMLOnEventElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLOnEventElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::typeAttr) {
String parsedValue = parseValueForbiddingVariableReferences(attr->value());
diff --git a/WebCore/wml/WMLOnEventElement.h b/WebCore/wml/WMLOnEventElement.h
index de33600..4bc4bca 100644
--- a/WebCore/wml/WMLOnEventElement.h
+++ b/WebCore/wml/WMLOnEventElement.h
@@ -33,7 +33,7 @@ class WMLOnEventElement : public WMLElement {
public:
WMLOnEventElement(const QualifiedName& tagName, Document*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
void registerTask(WMLTaskElement*);
void deregisterTask(WMLTaskElement*);
diff --git a/WebCore/wml/WMLOptGroupElement.cpp b/WebCore/wml/WMLOptGroupElement.cpp
index 9a7ea88..fde3474 100644
--- a/WebCore/wml/WMLOptGroupElement.cpp
+++ b/WebCore/wml/WMLOptGroupElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(WML)
#include "WMLOptGroupElement.h"
+#include "Attribute.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "HTMLNames.h"
#include "NodeRenderStyle.h"
#include "RenderStyle.h"
@@ -118,7 +118,7 @@ void WMLOptGroupElement::childrenChanged(bool changedByParser, Node* beforeChang
WMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
-void WMLOptGroupElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLOptGroupElement::parseMappedAttribute(Attribute* attr)
{
WMLFormControlElement::parseMappedAttribute(attr);
recalcSelectOptions();
diff --git a/WebCore/wml/WMLOptGroupElement.h b/WebCore/wml/WMLOptGroupElement.h
index e1b9217..682c68c 100644
--- a/WebCore/wml/WMLOptGroupElement.h
+++ b/WebCore/wml/WMLOptGroupElement.h
@@ -44,7 +44,7 @@ public:
virtual void accessKeyAction(bool sendToAnyElement);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual void detach();
diff --git a/WebCore/wml/WMLOptionElement.cpp b/WebCore/wml/WMLOptionElement.cpp
index ac41a06..ca4ea91 100644
--- a/WebCore/wml/WMLOptionElement.cpp
+++ b/WebCore/wml/WMLOptionElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(WML)
#include "WMLOptionElement.h"
+#include "Attribute.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "NodeRenderStyle.h"
#include "RenderStyle.h"
#include "WMLNames.h"
@@ -75,7 +75,7 @@ void WMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange,
WMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
-void WMLOptionElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLOptionElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::valueAttr)
m_data.setValue(parseValueSubstitutingVariableReferences(attr->value()));
diff --git a/WebCore/wml/WMLOptionElement.h b/WebCore/wml/WMLOptionElement.h
index 6283070..3831f7d 100644
--- a/WebCore/wml/WMLOptionElement.h
+++ b/WebCore/wml/WMLOptionElement.h
@@ -39,7 +39,7 @@ public:
virtual void accessKeyAction(bool sendToAnyElement);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attach();
virtual void detach();
diff --git a/WebCore/wml/WMLPElement.cpp b/WebCore/wml/WMLPElement.cpp
index 0cec653..ca76022 100644
--- a/WebCore/wml/WMLPElement.cpp
+++ b/WebCore/wml/WMLPElement.cpp
@@ -26,11 +26,11 @@
#if ENABLE(WML)
#include "WMLPElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "NodeList.h"
#include "WMLNames.h"
@@ -53,7 +53,7 @@ bool WMLPElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry
return WMLElement::mapToEntry(attrName, result);
}
-void WMLPElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLPElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::alignAttr) {
const AtomicString& value = attr->value();
diff --git a/WebCore/wml/WMLPElement.h b/WebCore/wml/WMLPElement.h
index 292e54f..48f98f8 100644
--- a/WebCore/wml/WMLPElement.h
+++ b/WebCore/wml/WMLPElement.h
@@ -34,7 +34,7 @@ public:
WMLPElement(const QualifiedName& tagName, Document*);
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
diff --git a/WebCore/wml/WMLSelectElement.cpp b/WebCore/wml/WMLSelectElement.cpp
index bc86d12..2f8ebf6 100644
--- a/WebCore/wml/WMLSelectElement.cpp
+++ b/WebCore/wml/WMLSelectElement.cpp
@@ -22,8 +22,9 @@
#if ENABLE(WML)
#include "WMLSelectElement.h"
+
+#include "Attribute.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "OptionElement.h"
#include "RenderListBox.h"
#include "RenderMenuList.h"
@@ -129,7 +130,7 @@ void WMLSelectElement::childrenChanged(bool changedByParser, Node* beforeChange,
WMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
-void WMLSelectElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLSelectElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::multipleAttr)
SelectElement::parseMultipleAttribute(m_data, this, attr);
diff --git a/WebCore/wml/WMLSelectElement.h b/WebCore/wml/WMLSelectElement.h
index 3ec7fd2..09a96f9 100644
--- a/WebCore/wml/WMLSelectElement.h
+++ b/WebCore/wml/WMLSelectElement.h
@@ -59,7 +59,7 @@ public:
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool appendFormData(FormDataList&, bool);
diff --git a/WebCore/wml/WMLSetvarElement.cpp b/WebCore/wml/WMLSetvarElement.cpp
index 5e10ca8..1407b3f 100644
--- a/WebCore/wml/WMLSetvarElement.cpp
+++ b/WebCore/wml/WMLSetvarElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(WML)
#include "WMLSetvarElement.h"
+#include "Attribute.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "WMLErrorHandling.h"
#include "WMLTaskElement.h"
#include "WMLVariables.h"
@@ -40,7 +40,7 @@ WMLSetvarElement::~WMLSetvarElement()
{
}
-void WMLSetvarElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLSetvarElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::nameAttr) {
if (!isValidVariableName(parseValueSubstitutingVariableReferences(attr->value(), WMLErrorInvalidVariableName))) {
diff --git a/WebCore/wml/WMLSetvarElement.h b/WebCore/wml/WMLSetvarElement.h
index 0171b95..410db70 100644
--- a/WebCore/wml/WMLSetvarElement.h
+++ b/WebCore/wml/WMLSetvarElement.h
@@ -31,7 +31,7 @@ public:
WMLSetvarElement(const QualifiedName& tagName, Document*);
virtual ~WMLSetvarElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/wml/WMLTableElement.cpp b/WebCore/wml/WMLTableElement.cpp
index b589fe8..4d5e785 100644
--- a/WebCore/wml/WMLTableElement.cpp
+++ b/WebCore/wml/WMLTableElement.cpp
@@ -23,12 +23,12 @@
#if ENABLE(WML)
#include "WMLTableElement.h"
-#include "CharacterNames.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "NodeList.h"
#include "RenderObject.h"
#include "Text.h"
@@ -59,7 +59,7 @@ bool WMLTableElement::mapToEntry(const QualifiedName& attrName, MappedAttributeE
return WMLElement::mapToEntry(attrName, result);
}
-void WMLTableElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLTableElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == columnsAttr) {
bool isNumber = false;
diff --git a/WebCore/wml/WMLTableElement.h b/WebCore/wml/WMLTableElement.h
index baf46af..22a9676 100644
--- a/WebCore/wml/WMLTableElement.h
+++ b/WebCore/wml/WMLTableElement.h
@@ -34,7 +34,7 @@ public:
virtual ~WMLTableElement();
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void finishParsingChildren();
diff --git a/WebCore/wml/WMLTemplateElement.cpp b/WebCore/wml/WMLTemplateElement.cpp
index 2575c9a..2537c3b 100644
--- a/WebCore/wml/WMLTemplateElement.cpp
+++ b/WebCore/wml/WMLTemplateElement.cpp
@@ -23,7 +23,7 @@
#if ENABLE(WML)
#include "WMLTemplateElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "NodeList.h"
#include "WMLCardElement.h"
#include "WMLDocument.h"
@@ -43,7 +43,7 @@ WMLTemplateElement::~WMLTemplateElement()
{
}
-void WMLTemplateElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLTemplateElement::parseMappedAttribute(Attribute* attr)
{
WMLIntrinsicEventType eventType = WMLIntrinsicEventUnknown;
diff --git a/WebCore/wml/WMLTemplateElement.h b/WebCore/wml/WMLTemplateElement.h
index 3fc0eda..e11d089 100644
--- a/WebCore/wml/WMLTemplateElement.h
+++ b/WebCore/wml/WMLTemplateElement.h
@@ -32,7 +32,7 @@ public:
WMLTemplateElement(const QualifiedName&, Document*);
virtual ~WMLTemplateElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
static void registerTemplatesInDocument(Document*);
};
diff --git a/WebCore/wml/WMLTimerElement.cpp b/WebCore/wml/WMLTimerElement.cpp
index c6476f7..48eed34 100644
--- a/WebCore/wml/WMLTimerElement.cpp
+++ b/WebCore/wml/WMLTimerElement.cpp
@@ -23,8 +23,8 @@
#if ENABLE(WML)
#include "WMLTimerElement.h"
+#include "Attribute.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "WMLCardElement.h"
#include "WMLDocument.h"
#include "WMLNames.h"
@@ -42,7 +42,7 @@ WMLTimerElement::WMLTimerElement(const QualifiedName& tagName, Document* doc)
{
}
-void WMLTimerElement::parseMappedAttribute(MappedAttribute* attr)
+void WMLTimerElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == HTMLNames::nameAttr)
m_name = parseValueForbiddingVariableReferences(attr->value());
diff --git a/WebCore/wml/WMLTimerElement.h b/WebCore/wml/WMLTimerElement.h
index 8402027..09f3fbf 100644
--- a/WebCore/wml/WMLTimerElement.h
+++ b/WebCore/wml/WMLTimerElement.h
@@ -33,7 +33,7 @@ class WMLTimerElement : public WMLElement {
public:
WMLTimerElement(const QualifiedName& tagName, Document*);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/workers/DefaultSharedWorkerRepository.cpp b/WebCore/workers/DefaultSharedWorkerRepository.cpp
index 88aea2d..8186f30 100644
--- a/WebCore/workers/DefaultSharedWorkerRepository.cpp
+++ b/WebCore/workers/DefaultSharedWorkerRepository.cpp
@@ -35,8 +35,8 @@
#include "DefaultSharedWorkerRepository.h"
#include "ActiveDOMObject.h"
+#include "CrossThreadTask.h"
#include "Document.h"
-#include "GenericWorkerTask.h"
#include "InspectorController.h"
#include "MessageEvent.h"
#include "MessagePort.h"
diff --git a/WebCore/workers/WorkerMessagingProxy.cpp b/WebCore/workers/WorkerMessagingProxy.cpp
index 1b19775..2180dd4 100644
--- a/WebCore/workers/WorkerMessagingProxy.cpp
+++ b/WebCore/workers/WorkerMessagingProxy.cpp
@@ -31,13 +31,13 @@
#include "WorkerMessagingProxy.h"
+#include "CrossThreadTask.h"
#include "DedicatedWorkerContext.h"
#include "DedicatedWorkerThread.h"
#include "DOMWindow.h"
#include "Document.h"
#include "ErrorEvent.h"
#include "ExceptionCode.h"
-#include "GenericWorkerTask.h"
#include "InspectorController.h"
#include "MessageEvent.h"
#include "ScriptExecutionContext.h"
diff --git a/WebCore/workers/WorkerScriptLoader.cpp b/WebCore/workers/WorkerScriptLoader.cpp
index ee0771f..1786b89 100644
--- a/WebCore/workers/WorkerScriptLoader.cpp
+++ b/WebCore/workers/WorkerScriptLoader.cpp
@@ -31,7 +31,7 @@
#include "WorkerScriptLoader.h"
-#include "GenericWorkerTask.h"
+#include "CrossThreadTask.h"
#include "ResourceRequest.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 6efc8e5..07e6edb 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,365 @@
+2010-05-21 Tony Chang <tony@chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ [chromium] if keydown is prevented, don't update the IME and clear the IME state
+ https://bugs.webkit.org/show_bug.cgi?id=39475
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::handleCompositionEvent):
+
+2010-05-23 Roman Gershman <romange@google.com>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Suggestion popup is not closed when the view is scrolled.
+ https://bugs.webkit.org/show_bug.cgi?id=38640
+
+ This bug appears on both Windows and Linux platforms.
+ Mac OS, however handles window messages differently and
+ closes popup menu in RenderWidgetHostViewMac::Destroy().
+
+ No tests were added because test_shell does not support suggestion
+ popup.
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::invalidateContentsForSlowScroll):
+ (WebKit::ChromeClientImpl::scroll):
+
+2010-05-23 Marcus Bulach <bulach@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ [chromium] Adds Geolocation support to DumpRenderTree.
+ https://bugs.webkit.org/show_bug.cgi?id=39440
+
+ Existing LayoutTests/fast/dom/Geolocation/* should pass.
+
+ * public/WebGeolocationServiceMock.h:
+ * src/WebGeolocationServiceMock.cpp:
+ (WebKit::WebGeolocationServiceMock::setMockGeolocationPermission):
+ (WebKit::WebGeolocationServiceMock::requestPermissionForFrame):
+ (WebKit::WebGeolocationServiceMock::attachBridge):
+ (WebKit::WebGeolocationServiceMock::detachBridge):
+
+2010-05-22 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Link resources and load Ahem font for Windows
+ https://bugs.webkit.org/show_bug.cgi?id=39473
+
+ * WebKit.gyp:
+ Add net and webkit resources for Windows.
+ Copy AHEM____.TTF to DumpRenderTree.exe directory.
+
+2010-05-21 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Add DeviceOrientation and DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=39479
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
+2010-05-20 Viet-Trung Luu <viettrungluu@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Don't rely on focused node to route mouse events to plugins.
+ https://bugs.webkit.org/show_bug.cgi?id=39375
+ http://crbug.com/43935
+
+ On mouse down, do a hit test and check if a plugin was hit. If so, then
+ save the node for future mouse events (until mouse up or capture lost).
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::mouseDown):
+ (WebKit::WebViewImpl::handleInputEvent):
+ (WebKit::WebViewImpl::mouseCaptureLost):
+ * src/WebViewImpl.h: Remove m_haveMouseCapture; add m_mouseCaptureNode.
+
+2010-05-20 Dominic Mazzoni <dmazzoni@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Add headingLevel and setFocused methods.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39238
+
+ * public/WebAccessibilityObject.h:
+ * src/WebAccessibilityObject.cpp:
+ (WebKit::WebAccessibilityObject::headingLevel):
+ (WebKit::WebAccessibilityObject::setFocused):
+
+2010-05-20 Zhenyao Mo <zmo@google.com>
+
+ Reviewed by Dimitri Glazkov.
+
+ Map RGBA4/RGB5_A1 to RGBA and RGB565 to RGB in RenderbufferStorage
+ https://bugs.webkit.org/show_bug.cgi?id=39077
+
+ * src/WebGraphicsContext3DDefaultImpl.cpp:
+ (WebKit::WebGraphicsContext3DDefaultImpl::renderbufferStorage): Mapping the enums.
+
+2010-05-20 Abhishek Arya <inferno@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Added method to WebSecurityOrigin for invoking
+ SecurityOrigin::canAccessPasswordManager.
+ https://bugs.webkit.org/show_bug.cgi?id=38916
+
+ * public/WebSecurityOrigin.h:
+ * src/WebSecurityOrigin.cpp:
+ (WebKit::WebSecurityOrigin::canAccessPasswordManager):
+
+2010-05-20 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ [chromium] Provide a way to catch exceptions thrown while interacting
+ with a NPObject via WebBindings methods.
+ https://bugs.webkit.org/show_bug.cgi?id=39378
+
+ * public/WebBindings.h:
+ * src/WebBindings.cpp:
+ (WebKit::WebBindings::pushExceptionHandler):
+ (WebKit::WebBindings::popExceptionHandler):
+
+2010-05-20 Jian Li <jianli@chromium.org>
+
+ Reviewed by David Levin.
+
+ Rename GenericWorkerTask.h to CrossThreadTask.h and move it to dom directory.
+ https://bugs.webkit.org/show_bug.cgi?id=39135
+
+ * src/WebSharedWorkerImpl.cpp:
+ * src/WebWorkerBase.cpp:
+ * src/WebWorkerClientImpl.cpp:
+ * src/WebWorkerImpl.cpp:
+
+2010-05-20 Martin Robinson <mrobinson@webkit.org>
+
+ Reviewed by Ojan Vafai.
+
+ Expose the editing behavior setting in DRT to test all editing code paths
+ https://bugs.webkit.org/show_bug.cgi?id=38603
+
+ * public/WebSettings.h:
+ (WebKit::WebSettings::): Added an enum for EditingBehavior types.
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::setEditingBehavior): Added.
+ * src/WebSettingsImpl.h:
+
+2010-05-19 Vangelis Kokkevis <vangelis@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Modifying WebViewImpl to support new hardware compositing for
+ LayerChromium layers.
+ https://bugs.webkit.org/show_bug.cgi?id=38783
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::paint):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit::WebViewImpl::updateRootLayerContents):
+ (WebKit::WebViewImpl::setRootLayerNeedsDisplay):
+
+2010-05-19 Tony Chang <tony@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ [chromium] disable spelling suggestions if spellcheck=false
+ https://bugs.webkit.org/show_bug.cgi?id=39402
+
+ This is the Chromium fix for bug 25639 that was fixed in the
+ other ports in r59585.
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+
+2010-05-19 Darin Fisher <darin@chromium.org>
+
+ Revert r59790 due to failing Chromium npruntime tests.
+
+ * public/WebBindings.h:
+ * src/WebBindings.cpp:
+
+2010-05-19 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ [chromium] Provide a way to catch exceptions thrown while interacting
+ with a NPObject via WebBindings methods.
+ https://bugs.webkit.org/show_bug.cgi?id=39378
+
+ * public/WebBindings.h:
+ * src/WebBindings.cpp:
+ (WebKit::WebBindings::pushExceptionHandler):
+ (WebKit::WebBindings::popExceptionHandler):
+
+2010-05-19 Dirk Pranke <dpranke@chromium.org>
+
+ Try again to roll out r58765.
+
+ * public/WebNotification.h:
+ * src/WebNotification.cpp:
+
+2010-05-19 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r59782.
+ http://trac.webkit.org/changeset/59782
+ https://bugs.webkit.org/show_bug.cgi?id=39379
+
+ broke DRT build (Requested by dpranke on #webkit).
+
+ * public/WebNotification.h:
+ * src/WebNotification.cpp:
+ (WebKit::WebNotification::dir):
+ (WebKit::WebNotification::replaceId):
+
+2010-05-18 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Attempt to revert r58765 to see if it was causing a performance
+ regression.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39328
+
+ * public/WebNotification.h:
+ * src/WebNotification.cpp:
+
+2010-05-19 Jian Li <jianli@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Remove obsolete ChromiumBridge code that routes FileSystem calls to WebKitClient.
+ https://bugs.webkit.org/show_bug.cgi?id=39332
+
+ * public/WebKitClient.h:
+ * src/ChromiumBridge.cpp:
+ (WebCore::ChromiumBridge::fileExists):
+ (WebCore::ChromiumBridge::deleteFile):
+ (WebCore::ChromiumBridge::deleteEmptyDirectory):
+ (WebCore::ChromiumBridge::getFileSize):
+ (WebCore::ChromiumBridge::getFileModificationTime):
+ (WebCore::ChromiumBridge::directoryName):
+ (WebCore::ChromiumBridge::pathByAppendingComponent):
+ (WebCore::ChromiumBridge::makeAllDirectories):
+ (WebCore::ChromiumBridge::getAbsolutePath):
+ (WebCore::ChromiumBridge::isDirectory):
+ (WebCore::ChromiumBridge::filePathToURL):
+
+2010-05-19 Marcus Bulach <bulach@chromium.org>
+
+ Reviewed by Steve Block.
+
+ [chromium] Adds supports for layout tests using GeolocationServiceMock.
+ https://bugs.webkit.org/show_bug.cgi?id=39081
+
+ Allows injection of GeolocationServiceMock factory.
+ Tests: existing fast/dom/Geolocation/*
+
+ * WebKit.gyp:
+ * public/WebGeolocationServiceMock.h: Added.
+ * src/WebGeolocationServiceMock.cpp: Added.
+ (WebCore::GeolocationServiceChromiumMock::create):
+ (WebCore::GeolocationServiceChromiumMock::GeolocationServiceChromiumMock):
+ (WebCore::GeolocationServiceChromiumMock::startUpdating):
+ (WebCore::GeolocationServiceChromiumMock::stopUpdating):
+ (WebCore::GeolocationServiceChromiumMock::lastPosition):
+ (WebCore::GeolocationServiceChromiumMock::lastError):
+ (WebCore::GeolocationServiceChromiumMock::geolocationServicePositionChanged):
+ (WebCore::GeolocationServiceChromiumMock::geolocationServiceErrorOccurred):
+ (WebKit::WebGeolocationServiceMock::setMockGeolocationPosition):
+ (WebKit::WebGeolocationServiceMock::setMockGeolocationError):
+
+2010-05-17 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Hook Chromium's WebIndexedDatabaseImpl up to IndexedDatabaseImpl
+ https://bugs.webkit.org/show_bug.cgi?id=39216
+
+ Web____Impl is for re-entering the WebKit layer from the browser layer.
+ Thus the previous IDBCallbacksProxy was mis-named (and should have been
+ WebIDBCallbacksImpl). This patch renames it and then implements the
+ proper proxy (which is for going from WebCore to WebKit).
+
+ Also change using security origin strings to using WebSecurityOrigin
+ objects.
+
+ This patch also implements the glue between WebIndexedDatabaseImpl and
+ IndexedDatabaseImpl.
+
+ * WebKit.gyp:
+ * src/IDBCallbacksProxy.cpp:
+ (WebCore::IDBCallbacksProxy::create):
+ (WebCore::IDBCallbacksProxy::IDBCallbacksProxy):
+ (WebCore::IDBCallbacksProxy::onError):
+ (WebCore::IDBCallbacksProxy::onSuccess):
+ * src/IDBCallbacksProxy.h:
+ * src/IndexedDatabaseProxy.cpp:
+ (WebCore::IndexedDatabaseProxy::open):
+ * src/IndexedDatabaseProxy.h:
+ * src/WebIDBCallbacksImpl.cpp: Added.
+ (WebCore::WebIDBCallbacksImpl::WebIDBCallbacksImpl):
+ (WebCore::WebIDBCallbacksImpl::~WebIDBCallbacksImpl):
+ (WebCore::WebIDBCallbacksImpl::onError):
+ (WebCore::WebIDBCallbacksImpl::onSuccess):
+ * src/WebIDBCallbacksImpl.h: Added.
+ * src/WebIDBDatabaseImpl.cpp: Added.
+ (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl):
+ (WebKit::WebIDBDatabaseImpl::~WebIDBDatabaseImpl):
+ * src/WebIDBDatabaseImpl.h: Added.
+ * src/WebIndexedDatabaseImpl.cpp:
+ (WebKit::WebIndexedDatabaseImpl::WebIndexedDatabaseImpl):
+ (WebKit::WebIndexedDatabaseImpl::open):
+ * src/WebIndexedDatabaseImpl.h:
+
+2010-05-18 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Fix a repaint issue and textarea tests
+ https://bugs.webkit.org/show_bug.cgi?id=39054
+
+ * DEPS: Update to Chromium r47248 to use a fix for CommandLine assertion
+ and textAreaResizeCorner.png
+ * WebKit.gyp: Add textAreaResizeCorner.png as a Mac resource
+
+2010-05-18 Tony Chang <tony@chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ [chromium] ignore IME events if the keydown event was prevented
+ https://bugs.webkit.org/show_bug.cgi?id=37692
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::handleCompositionEvent):
+
+2010-05-18 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Kent Tamura.
+
+ [Chromium] Windows: Determinate progress bar should have glossy overlay
+ https://bugs.webkit.org/show_bug.cgi?id=39269
+
+ Changed WebThemeEngine::drawProgressBar() signature to delegate
+ theme implementation detail to the engine.
+ Chromium side will come to http://crbug.com/44430.
+
+ No new tests, animation effect can be confirmed only manually.
+
+ * public/WebThemeEngine.h:
+ (WebKit::WebThemeEngine::paintProgressBar):
+ * src/ChromiumBridge.cpp:
+ (WebCore::ChromiumBridge::paintProgressBar):
+
2010-05-16 Mike Belshe <mbelshe@chromium.org>
Reviewed by Dimitri Glazkov.
diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS
index 9e34fe4..c633a79 100644
--- a/WebKit/chromium/DEPS
+++ b/WebKit/chromium/DEPS
@@ -32,7 +32,7 @@
vars = {
'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
- 'chromium_rev': '46899',
+ 'chromium_rev': '47248',
'pthreads-win32_rev': '26716',
}
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 8ac5a90..94d7a46 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -47,6 +47,7 @@
'chromium_src_dir': '../../../..',
}],
],
+ 'ahem_path': '../../WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF',
},
'targets': [
{
@@ -126,6 +127,7 @@
'public/WebFormElement.h',
'public/WebGeolocationService.h',
'public/WebGeolocationServiceBridge.h',
+ 'public/WebGeolocationServiceMock.h',
'public/WebGlyphCache.h',
'public/WebGLES2Context.h',
'public/WebGraphicsContext3D.h',
@@ -337,13 +339,18 @@
'src/WebFrameImpl.h',
'src/WebGeolocationServiceBridgeImpl.cpp',
'src/WebGeolocationServiceBridgeImpl.h',
+ 'src/WebGeolocationServiceMock.cpp',
'src/WebGlyphCache.cpp',
'src/WebGraphicsContext3D.cpp',
'src/WebGraphicsContext3DDefaultImpl.cpp',
'src/WebGraphicsContext3DDefaultImpl.h',
'src/WebHistoryItem.cpp',
'src/WebHTTPBody.cpp',
+ 'src/WebIDBCallbacksImpl.cpp',
+ 'src/WebIDBCallbacksImpl.h',
'src/WebIDBDatabaseError.cpp',
+ 'src/WebIDBDatabaseImpl.cpp',
+ 'src/WebIDBDatabaseImpl.h',
'src/WebImageCG.cpp',
'src/WebImageDecoder.cpp',
'src/WebImageSkia.cpp',
@@ -573,11 +580,24 @@
'<@(drt_files)',
],
'conditions': [
+ ['OS=="win"', {
+ 'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'],
+ 'sources': [
+ '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc',
+ ],
+ 'copies': [{
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': ['<(ahem_path)'],
+ }],
+ }],
['OS=="mac"', {
'dependencies': ['LayoutTestHelper'],
'mac_bundle_resources': [
- '../../WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF',
+ '<(ahem_path)',
'../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf',
'../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf',
'../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf',
@@ -587,6 +607,7 @@
'../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf',
'../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf',
'../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png',
],
'actions': [
{
diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h
index f46c0d8..191d40f 100644
--- a/WebKit/chromium/public/WebAccessibilityObject.h
+++ b/WebKit/chromium/public/WebAccessibilityObject.h
@@ -94,10 +94,12 @@ public:
WebRect boundingBoxRect() const;
WebString helpText() const;
+ int headingLevel() const;
WebAccessibilityObject hitTest(const WebPoint&) const;
WebString keyboardShortcut() const;
bool performDefaultAction() const;
WebAccessibilityRole roleValue() const;
+ void setFocused(bool) const;
WebString stringValue() const;
WebString title() const;
diff --git a/WebKit/chromium/public/WebBindings.h b/WebKit/chromium/public/WebBindings.h
index 4e66a8f..0fa3bfd 100644
--- a/WebKit/chromium/public/WebBindings.h
+++ b/WebKit/chromium/public/WebBindings.h
@@ -117,7 +117,7 @@ public:
// NPN_UTF8FromIdentifier
WEBKIT_API static NPUTF8* utf8FromIdentifier(NPIdentifier);
- // Miscellaneous utility functions ------------------------------------
+ // Miscellaneous utility functions ----------------------------------------
// Complement to NPN_Get___Identifier functions. Extracts data from the NPIdentifier data
// structure. If isString is true upon return, string will be set but number's value is
@@ -138,6 +138,15 @@ public:
// Return true (success) if the given npobj is a range object.
// If so, return that range as a WebRange object.
WEBKIT_API static bool getRange(NPObject* range, WebRange*);
+
+ // Exceptions -------------------------------------------------------------
+
+ typedef void (ExceptionHandler)(void* data, const NPUTF8* message);
+
+ // The exception handler will be notified of any exceptions thrown while
+ // operating on a NPObject.
+ WEBKIT_API static void pushExceptionHandler(ExceptionHandler, void* data);
+ WEBKIT_API static void popExceptionHandler();
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebGeolocationServiceMock.h b/WebKit/chromium/public/WebGeolocationServiceMock.h
new file mode 100644
index 0000000..285f70c
--- /dev/null
+++ b/WebKit/chromium/public/WebGeolocationServiceMock.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebGeolocationServiceMock_h
+#define WebGeolocationServiceMock_h
+
+#include "WebGeolocationService.h"
+#include <wtf/HashMap.h>
+
+namespace WebKit {
+
+class WebString;
+
+class WebGeolocationServiceMock : public WebGeolocationService {
+public:
+ static void setMockGeolocationPermission(bool allowed);
+ static void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+ static void setMockGeolocationError(int errorCode, const WebString& message);
+
+ virtual void requestPermissionForFrame(int bridgeId, const WebURL& url);
+ virtual int attachBridge(WebGeolocationServiceBridge*);
+ virtual void detachBridge(int bridgeId);
+
+private:
+ typedef HashMap<int, WebGeolocationServiceBridge*> IdToBridgeMap;
+ IdToBridgeMap m_idToBridgeMap;
+
+ static bool s_mockGeolocationPermission;
+};
+
+} // namespace WebKit
+
+#endif // WebGeolocationServiceMock_h
diff --git a/WebKit/chromium/public/WebIndexedDatabase.h b/WebKit/chromium/public/WebIndexedDatabase.h
index 8861456..61b77a0 100644
--- a/WebKit/chromium/public/WebIndexedDatabase.h
+++ b/WebKit/chromium/public/WebIndexedDatabase.h
@@ -31,12 +31,15 @@
#include "WebCommon.h"
#include "WebIDBCallbacks.h"
+#include "WebSecurityOrigin.h"
+#include "WebString.h"
namespace WebKit {
class WebFrame;
class WebIDBDatabase;
class WebString;
+class WebSecurityOrigin;
// The entry point into the IndexedDatabase API. These classes match their _____Request and
// _____Sync counterparts in the spec, but operate only in an async manner.
@@ -48,7 +51,17 @@ public:
virtual ~WebIndexedDatabase() { }
// The WebKit implementation of open ignores the WebFrame* parameter.
- virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks*, const WebString& origin, WebFrame*, int& exceptionCode) = 0;
+ virtual void open(const WebString& name, const WebString& description, bool modifyDatabase,
+ WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, int& exceptionCode)
+ {
+ open(name, description, modifyDatabase, callbacks, origin.toString(), webFrame, exceptionCode);
+ }
+ // FIXME: Delete soon. Compatability hack.
+ virtual void open(const WebString& name, const WebString& description, bool modifyDatabase,
+ WebIDBCallbacks* callbacks, const WebString& origin, WebFrame* webFrame, int& exceptionCode)
+ {
+ open(name, description, modifyDatabase, callbacks, WebSecurityOrigin::createFromString(origin), webFrame, exceptionCode);
+ }
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h
index 584679d..d1da883 100644
--- a/WebKit/chromium/public/WebKitClient.h
+++ b/WebKit/chromium/public/WebKitClient.h
@@ -95,23 +95,6 @@ public:
const WebURL& url, bool isLocalStorage) { }
- // File ----------------------------------------------------------------
-
- // Various file/directory related functions. These map 1:1 with
- // functions in WebCore's FileSystem.h.
- virtual bool fileExists(const WebString& path) { return false; }
- virtual bool deleteFile(const WebString& path) { return false; }
- virtual bool deleteEmptyDirectory(const WebString& path) { return false; }
- virtual bool getFileSize(const WebString& path, long long& result) { return false; }
- virtual bool getFileModificationTime(const WebString& path, double& result) { return false; }
- virtual WebString directoryName(const WebString& path) { return WebString(); }
- virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); }
- virtual bool makeAllDirectories(const WebString& path) { return false; }
- virtual WebString getAbsolutePath(const WebString& path) { return WebString(); }
- virtual bool isDirectory(const WebString& path) { return false; }
- virtual WebURL filePathToURL(const WebString& path) { return WebURL(); }
-
-
// History -------------------------------------------------------------
// Returns the hash for the given canonicalized URL for use in visited
diff --git a/WebKit/chromium/public/WebNotification.h b/WebKit/chromium/public/WebNotification.h
index ab747e3..9d64e2a 100644
--- a/WebKit/chromium/public/WebNotification.h
+++ b/WebKit/chromium/public/WebNotification.h
@@ -75,9 +75,6 @@ public:
WEBKIT_API WebString title() const;
WEBKIT_API WebString body() const;
- WEBKIT_API WebString dir() const;
- WEBKIT_API WebString replaceId() const;
-
// Called to indicate the notification has been displayed.
WEBKIT_API void dispatchDisplayEvent();
diff --git a/WebKit/chromium/public/WebSecurityOrigin.h b/WebKit/chromium/public/WebSecurityOrigin.h
index 76012a1..efcb2e9 100644
--- a/WebKit/chromium/public/WebSecurityOrigin.h
+++ b/WebKit/chromium/public/WebSecurityOrigin.h
@@ -90,7 +90,11 @@ public:
// Returns a string representation of this WebSecurityOrigin that can
// be used as a file. Should be used in storage APIs only.
- WEBKIT_API WebString databaseIdentifier();
+ WEBKIT_API WebString databaseIdentifier() const;
+
+ // Returns true if this WebSecurityOrigin can access usernames and
+ // passwords stored in password manager.
+ WEBKIT_API bool canAccessPasswordManager() const;
#if WEBKIT_IMPLEMENTATION
WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>&);
diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h
index 356d9fa..dd31ea0 100644
--- a/WebKit/chromium/public/WebSettings.h
+++ b/WebKit/chromium/public/WebSettings.h
@@ -43,6 +43,11 @@ class WebURL;
// these functions have a 1:1 mapping with the methods in WebCore/page/settings.h.
class WebSettings {
public:
+ enum EditingBehavior {
+ EditingBehaviorMac,
+ EditingBehaviorWin
+ };
+
virtual void setStandardFontFamily(const WebString&) = 0;
virtual void setFixedFontFamily(const WebString&) = 0;
virtual void setSerifFontFamily(const WebString&) = 0;
@@ -84,6 +89,7 @@ public:
virtual void setOfflineWebApplicationCacheEnabled(bool) = 0;
virtual void setExperimentalWebGLEnabled(bool) = 0;
virtual void setShowDebugBorders(bool) = 0;
+ virtual void setEditingBehavior(EditingBehavior) = 0;
protected:
~WebSettings() { }
diff --git a/WebKit/chromium/public/WebThemeEngine.h b/WebKit/chromium/public/WebThemeEngine.h
index 606de09..9638c2f 100644
--- a/WebKit/chromium/public/WebThemeEngine.h
+++ b/WebKit/chromium/public/WebThemeEngine.h
@@ -77,8 +77,8 @@ public:
const WebRect&) = 0;
virtual void paintProgressBar(
- WebCanvas*, const WebRect& barRect,
- int valuePart, const WebRect& valueRect) {}
+ WebCanvas*, const WebRect& barRect, const WebRect& valueRect,
+ bool determinate, double animatedSeconds) {}
#endif
};
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp
index e7aeb49..fa7d73a 100644
--- a/WebKit/chromium/src/AssertMatchingEnums.cpp
+++ b/WebKit/chromium/src/AssertMatchingEnums.cpp
@@ -41,6 +41,7 @@
#include "NotificationPresenter.h"
#include "PasteboardPrivate.h"
#include "PlatformCursor.h"
+#include "Settings.h"
#include "StringImpl.h"
#include "TextAffinity.h"
#include "WebAccessibilityObject.h"
@@ -52,6 +53,7 @@
#include "WebMediaPlayer.h"
#include "WebNotificationPresenter.h"
#include "WebScrollbar.h"
+#include "WebSettings.h"
#include "WebTextAffinity.h"
#include "WebTextCaseSensitivity.h"
#include <wtf/Assertions.h>
@@ -300,6 +302,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPage, ScrollByPage);
COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByDocument, ScrollByDocument);
COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPixel, ScrollByPixel);
+COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorMac, EditingMacBehavior);
+COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorWin, EditingWindowsBehavior);
+
COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM);
COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM);
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 1a366bc..d54f328 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -500,6 +500,7 @@ void ChromeClientImpl::invalidateContentsAndWindow(const IntRect& updateRect, bo
void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate)
{
+ m_webView->hidePopups();
invalidateContentsAndWindow(updateRect, immediate);
}
@@ -507,6 +508,7 @@ void ChromeClientImpl::scroll(
const IntSize& scrollDelta, const IntRect& scrollRect,
const IntRect& clipRect)
{
+ m_webView->hidePopups();
if (m_webView->client()) {
int dx = scrollDelta.width();
int dy = scrollDelta.height();
diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp
index d188016..01e91a6 100644
--- a/WebKit/chromium/src/ChromiumBridge.cpp
+++ b/WebKit/chromium/src/ChromiumBridge.cpp
@@ -278,86 +278,61 @@ void ChromiumBridge::prefetchDNS(const String& hostname)
bool ChromiumBridge::fileExists(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->fileExists(path);
- return webKitClient()->fileExists(path);
+ return webKitClient()->fileSystem()->fileExists(path);
}
bool ChromiumBridge::deleteFile(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->deleteFile(path);
- return webKitClient()->deleteFile(path);
+ return webKitClient()->fileSystem()->deleteFile(path);
}
bool ChromiumBridge::deleteEmptyDirectory(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->deleteEmptyDirectory(path);
- return webKitClient()->deleteEmptyDirectory(path);
+ return webKitClient()->fileSystem()->deleteEmptyDirectory(path);
}
bool ChromiumBridge::getFileSize(const String& path, long long& result)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->getFileSize(path, result);
- return webKitClient()->getFileSize(path, result);
+ return webKitClient()->fileSystem()->getFileSize(path, result);
}
bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result)
{
double modificationTime;
- if (webKitClient()->fileSystem()) {
- if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime))
- return false;
- } else {
- if (!webKitClient()->getFileModificationTime(path, modificationTime))
- return false;
- }
+ if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime))
+ return false;
result = static_cast<time_t>(modificationTime);
return true;
}
String ChromiumBridge::directoryName(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->directoryName(path);
- return webKitClient()->directoryName(path);
+ return webKitClient()->fileSystem()->directoryName(path);
}
String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->pathByAppendingComponent(path, component);
- return webKitClient()->pathByAppendingComponent(path, component);
+ return webKitClient()->fileSystem()->pathByAppendingComponent(path, component);
}
bool ChromiumBridge::makeAllDirectories(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->makeAllDirectories(path);
- return webKitClient()->makeAllDirectories(path);
+ return webKitClient()->fileSystem()->makeAllDirectories(path);
}
String ChromiumBridge::getAbsolutePath(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->getAbsolutePath(path);
- return webKitClient()->getAbsolutePath(path);
+ return webKitClient()->fileSystem()->getAbsolutePath(path);
}
bool ChromiumBridge::isDirectory(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->isDirectory(path);
- return webKitClient()->isDirectory(path);
+ return webKitClient()->fileSystem()->isDirectory(path);
}
KURL ChromiumBridge::filePathToURL(const String& path)
{
- if (webKitClient()->fileSystem())
- return webKitClient()->fileSystem()->filePathToURL(path);
- return webKitClient()->filePathToURL(path);
+ return webKitClient()->fileSystem()->filePathToURL(path);
}
PlatformFileHandle ChromiumBridge::openFile(const String& path, FileOpenMode mode)
@@ -680,10 +655,10 @@ void ChromiumBridge::paintTrackbar(
}
void ChromiumBridge::paintProgressBar(
- GraphicsContext* gc, const IntRect& barRect, int valuePart, const IntRect& valueRect)
+ GraphicsContext* gc, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds)
{
webKitClient()->themeEngine()->paintProgressBar(
- gc->platformContext()->canvas(), barRect, valuePart, valueRect);
+ gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds);
}
#endif
diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp
index b6005f9..8dd3393 100644
--- a/WebKit/chromium/src/ContextMenuClientImpl.cpp
+++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp
@@ -203,7 +203,9 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
data.isEditable = true;
if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) {
data.isSpellCheckingEnabled = true;
- data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
+ // Spellchecking might be enabled for the field, but could be disabled on the node.
+ if (m_webView->focusedWebCoreFrame()->editor()->spellCheckingEnabledInFocusedNode())
+ data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
}
}
diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp
index 0346b58..2bdf140 100644
--- a/WebKit/chromium/src/IDBCallbacksProxy.cpp
+++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp
@@ -29,11 +29,10 @@
#include "config.h"
#include "IDBCallbacksProxy.h"
-#include "IDBCallbacks.h"
#include "IDBDatabaseError.h"
#include "IDBDatabaseProxy.h"
#include "WebIDBCallbacks.h"
-#include "WebIDBDatabase.h"
+#include "WebIDBDatabaseImpl.h"
#include "WebIDBDatabaseError.h"
#include "WebSerializedScriptValue.h"
@@ -41,7 +40,12 @@
namespace WebCore {
-IDBCallbacksProxy::IDBCallbacksProxy(PassRefPtr<IDBCallbacks> callbacks)
+PassRefPtr<IDBCallbacksProxy> IDBCallbacksProxy::create(PassOwnPtr<WebKit::WebIDBCallbacks> callbacks)
+{
+ return new IDBCallbacksProxy(callbacks);
+}
+
+IDBCallbacksProxy::IDBCallbacksProxy(PassOwnPtr<WebKit::WebIDBCallbacks> callbacks)
: m_callbacks(callbacks)
{
}
@@ -50,21 +54,21 @@ IDBCallbacksProxy::~IDBCallbacksProxy()
{
}
-void IDBCallbacksProxy::onError(const WebKit::WebIDBDatabaseError& error)
+void IDBCallbacksProxy::onError(PassRefPtr<IDBDatabaseError> idbDatabaseError)
{
- m_callbacks->onError(error);
+ m_callbacks->onError(WebKit::WebIDBDatabaseError(idbDatabaseError));
m_callbacks.clear();
}
-void IDBCallbacksProxy::onSuccess(WebKit::WebIDBDatabase* webKitInstance)
+void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabase> idbDatabase)
{
- m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance));
+ m_callbacks->onSuccess(new WebKit::WebIDBDatabaseImpl(idbDatabase));
m_callbacks.clear();
}
-void IDBCallbacksProxy::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue)
+void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue)
{
- m_callbacks->onSuccess(serializedScriptValue);
+ m_callbacks->onSuccess(WebKit::WebSerializedScriptValue(serializedScriptValue));
m_callbacks.clear();
}
diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h
index 692b0a3..5d4bc0b 100644
--- a/WebKit/chromium/src/IDBCallbacksProxy.h
+++ b/WebKit/chromium/src/IDBCallbacksProxy.h
@@ -29,33 +29,35 @@
#ifndef IDBCallbacksProxy_h
#define IDBCallbacksProxy_h
-#include "WebIDBCallbacks.h"
+#include "IDBCallbacks.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebKit {
-class WebIDBDatabase;
-class WebIDBDatabaseError;
-class WebSerializedScriptValue;
+class WebIDBCallbacks;
}
namespace WebCore {
-class IDBCallbacks;
+class IDBDatabaseError;
+class IDBDatabase;
+class SerializedScriptValue;
-class IDBCallbacksProxy : public WebKit::WebIDBCallbacks {
+class IDBCallbacksProxy : public IDBCallbacks {
public:
- IDBCallbacksProxy(PassRefPtr<IDBCallbacks> callbacks);
+ static PassRefPtr<IDBCallbacksProxy> create(PassOwnPtr<WebKit::WebIDBCallbacks>);
virtual ~IDBCallbacksProxy();
- virtual void onError(const WebKit::WebIDBDatabaseError& error);
- virtual void onSuccess(WebKit::WebIDBDatabase* webKitInstance);
- virtual void onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue);
+ virtual void onError(PassRefPtr<IDBDatabaseError>);
+ virtual void onSuccess(PassRefPtr<IDBDatabase>);
+ virtual void onSuccess(PassRefPtr<SerializedScriptValue>);
private:
- RefPtr<IDBCallbacks> m_callbacks;
+ IDBCallbacksProxy(PassOwnPtr<WebKit::WebIDBCallbacks>);
+
+ OwnPtr<WebKit::WebIDBCallbacks> m_callbacks;
};
diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.cpp b/WebKit/chromium/src/IndexedDatabaseProxy.cpp
index a4bd0b1..aed7c13 100644
--- a/WebKit/chromium/src/IndexedDatabaseProxy.cpp
+++ b/WebKit/chromium/src/IndexedDatabaseProxy.cpp
@@ -29,13 +29,10 @@
#include "config.h"
#include "IndexedDatabaseProxy.h"
-#include "Document.h"
-#include "Frame.h"
-#include "IDBCallbacksProxy.h"
#include "IDBDatabaseError.h"
#include "IDBDatabaseProxy.h"
-#include "SecurityOrigin.h"
#include "WebFrameImpl.h"
+#include "WebIDBCallbacksImpl.h"
#include "WebIDBDatabase.h"
#include "WebIDBDatabaseError.h"
#include "WebIndexedDatabase.h"
@@ -60,12 +57,12 @@ IndexedDatabaseProxy::~IndexedDatabaseProxy()
{
}
-void IndexedDatabaseProxy::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, Frame* frame, ExceptionCode& ec)
+void IndexedDatabaseProxy::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame, ExceptionCode& ec)
{
if (!frame || !frame->document())
return;
WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame);
- m_webIndexedDatabase->open(name, description, modifyDatabase, new IDBCallbacksProxy(callbacks), frame->document()->securityOrigin()->toString(), webFrame, ec);
+ m_webIndexedDatabase->open(name, description, modifyDatabase, new WebIDBCallbacksImpl(callbacks), origin, webFrame, ec);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.h b/WebKit/chromium/src/IndexedDatabaseProxy.h
index 0c8674a..e372e9a 100644
--- a/WebKit/chromium/src/IndexedDatabaseProxy.h
+++ b/WebKit/chromium/src/IndexedDatabaseProxy.h
@@ -42,7 +42,7 @@ public:
static PassRefPtr<IndexedDatabase> create();
virtual ~IndexedDatabaseProxy();
- virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, Frame*, ExceptionCode&);
+ virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&);
private:
IndexedDatabaseProxy();
diff --git a/WebKit/chromium/src/WebAccessibilityObject.cpp b/WebKit/chromium/src/WebAccessibilityObject.cpp
index c386d44..e59a1a2 100644
--- a/WebKit/chromium/src/WebAccessibilityObject.cpp
+++ b/WebKit/chromium/src/WebAccessibilityObject.cpp
@@ -303,6 +303,15 @@ WebString WebAccessibilityObject::helpText() const
return m_private->helpText();
}
+int WebAccessibilityObject::headingLevel() const
+{
+ if (!m_private)
+ return 0;
+
+ m_private->updateBackingStore();
+ return m_private->headingLevel();
+}
+
WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) const
{
if (!m_private)
@@ -368,6 +377,12 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const
return static_cast<WebAccessibilityRole>(m_private->roleValue());
}
+void WebAccessibilityObject::setFocused(bool on) const
+{
+ if (m_private)
+ m_private->setFocused(on);
+}
+
WebString WebAccessibilityObject::stringValue() const
{
if (!m_private)
diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp
index 99e82a7..2b20c0a 100644
--- a/WebKit/chromium/src/WebBindings.cpp
+++ b/WebKit/chromium/src/WebBindings.cpp
@@ -45,6 +45,7 @@
#include "V8DOMWrapper.h"
#include "V8Event.h"
#include "V8Helpers.h"
+#include "V8NPUtils.h"
#include "V8Proxy.h"
#include "V8Range.h"
#elif USE(JSC)
@@ -322,4 +323,14 @@ bool WebBindings::getRange(NPObject* range, WebRange* webrange)
#endif
}
+void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data)
+{
+ WebCore::pushExceptionHandler(handler, data);
+}
+
+void WebBindings::popExceptionHandler()
+{
+ WebCore::popExceptionHandler();
+}
+
} // namespace WebKit
diff --git a/WebKit/chromium/src/WebGeolocationServiceMock.cpp b/WebKit/chromium/src/WebGeolocationServiceMock.cpp
new file mode 100644
index 0000000..2eed352
--- /dev/null
+++ b/WebKit/chromium/src/WebGeolocationServiceMock.cpp
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebGeolocationServiceMock.h"
+
+#include "GeolocationService.h"
+#include "GeolocationServiceChromium.h"
+#include "GeolocationServiceMock.h"
+#include "WebString.h"
+#include <wtf/CurrentTime.h>
+
+#if ENABLE(GEOLOCATION)
+
+using WebCore::Coordinates;
+using WebCore::Frame;
+using WebCore::Geolocation;
+using WebCore::GeolocationServiceBridge;
+using WebCore::GeolocationServiceChromium;
+using WebCore::GeolocationServiceClient;
+using WebCore::GeolocationServiceMock;
+using WebCore::Geoposition;
+using WebCore::PositionError;
+using WebCore::PositionOptions;
+using WebCore::String;
+
+namespace WebCore {
+class GeolocationServiceChromiumMock : public GeolocationServiceChromium, public GeolocationServiceClient {
+public:
+ static GeolocationService* create(GeolocationServiceClient*);
+ virtual bool startUpdating(PositionOptions*);
+ virtual void stopUpdating();
+ virtual Geoposition* lastPosition() const;
+ virtual PositionError* lastError() const;
+
+ virtual void geolocationServicePositionChanged(GeolocationService*);
+ virtual void geolocationServiceErrorOccurred(GeolocationService*);
+
+private:
+ explicit GeolocationServiceChromiumMock(GeolocationServiceClient*);
+
+ GeolocationServiceClient* m_geolocationServiceClient;
+ OwnPtr<GeolocationService> m_geolocationServiceMock;
+};
+
+GeolocationService* GeolocationServiceChromiumMock::create(GeolocationServiceClient* geolocationServiceClient)
+{
+ return new GeolocationServiceChromiumMock(geolocationServiceClient);
+}
+
+GeolocationServiceChromiumMock::GeolocationServiceChromiumMock(GeolocationServiceClient* geolocationServiceClient)
+ : GeolocationServiceChromium(geolocationServiceClient),
+ m_geolocationServiceClient(geolocationServiceClient)
+{
+ m_geolocationServiceMock.set(GeolocationServiceMock::create(this));
+}
+
+bool GeolocationServiceChromiumMock::startUpdating(PositionOptions* positionOptions)
+{
+ GeolocationServiceChromium::startUpdating(positionOptions);
+ return m_geolocationServiceMock->startUpdating(positionOptions);
+}
+
+void GeolocationServiceChromiumMock::stopUpdating()
+{
+ GeolocationServiceChromium::stopUpdating();
+ m_geolocationServiceMock->stopUpdating();
+}
+
+Geoposition* GeolocationServiceChromiumMock::lastPosition() const
+{
+ return m_geolocationServiceMock->lastPosition();
+}
+
+PositionError* GeolocationServiceChromiumMock::lastError() const
+{
+ return m_geolocationServiceMock->lastError();
+}
+
+void GeolocationServiceChromiumMock::geolocationServicePositionChanged(GeolocationService* geolocationService)
+{
+ ASSERT_UNUSED(geolocationService, geolocationService == m_geolocationServiceMock);
+ m_geolocationServiceClient->geolocationServicePositionChanged(this);
+
+}
+
+void GeolocationServiceChromiumMock::geolocationServiceErrorOccurred(GeolocationService* geolocationService)
+{
+ ASSERT_UNUSED(geolocationService, geolocationService == m_geolocationServiceMock);
+ m_geolocationServiceClient->geolocationServiceErrorOccurred(this);
+}
+
+} // namespace WebCore
+
+namespace WebKit {
+
+bool WebGeolocationServiceMock::s_mockGeolocationPermission = false;
+
+void WebGeolocationServiceMock::setMockGeolocationPermission(bool allowed)
+{
+ s_mockGeolocationPermission = allowed;
+}
+
+void WebGeolocationServiceMock::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
+{
+ WebCore::GeolocationService::setCustomMockFactory(&WebCore::GeolocationServiceChromiumMock::create);
+ RefPtr<Geoposition> geoposition = Geoposition::create(Coordinates::create(latitude, longitude, false, 0, accuracy, true, 0, false, 0, false, 0), currentTime() * 1000.0);
+ GeolocationServiceMock::setPosition(geoposition);
+}
+
+void WebGeolocationServiceMock::setMockGeolocationError(int errorCode, const WebString& message)
+{
+ WebCore::GeolocationService::setCustomMockFactory(&WebCore::GeolocationServiceChromiumMock::create);
+ RefPtr<PositionError> positionError = PositionError::create(static_cast<PositionError::ErrorCode>(errorCode), message);
+ GeolocationServiceMock::setError(positionError);
+}
+
+void WebGeolocationServiceMock::requestPermissionForFrame(int bridgeId, const WebURL& url)
+{
+ IdToBridgeMap::iterator iter = m_idToBridgeMap.find(bridgeId);
+ if (iter == m_idToBridgeMap.end())
+ return;
+ iter->second->setIsAllowed(s_mockGeolocationPermission);
+}
+
+int WebGeolocationServiceMock::attachBridge(WebGeolocationServiceBridge* bridge)
+{
+ static int nextAvailableWatchId = 1;
+ // In case of overflow, make sure the ID remains positive, but reuse the ID values.
+ if (nextAvailableWatchId < 1)
+ nextAvailableWatchId = 1;
+ m_idToBridgeMap.set(nextAvailableWatchId, bridge);
+ return nextAvailableWatchId++;
+}
+
+void WebGeolocationServiceMock::detachBridge(int bridgeId)
+{
+ m_idToBridgeMap.remove(bridgeId);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(GEOLOCATION)
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
index 52bc645..e7e0c32 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
@@ -1215,10 +1215,21 @@ void WebGraphicsContext3DDefaultImpl::renderbufferStorage(unsigned long target,
unsigned long height)
{
makeContextCurrent();
- if (internalformat == GL_DEPTH_STENCIL)
+ switch (internalformat) {
+ case GL_DEPTH_STENCIL:
internalformat = GL_DEPTH24_STENCIL8_EXT;
- else if (internalformat == GL_DEPTH_COMPONENT16)
+ break;
+ case GL_DEPTH_COMPONENT16:
internalformat = GL_DEPTH_COMPONENT;
+ break;
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ internalformat = GL_RGBA;
+ break;
+ case 0x8D62: // GL_RGB565
+ internalformat = GL_RGB;
+ break;
+ }
glRenderbufferStorageEXT(target, internalformat, width, height);
}
diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
new file mode 100644
index 0000000..8f88cb6
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebIDBCallbacksImpl.h"
+
+#include "IDBCallbacks.h"
+#include "IDBDatabaseError.h"
+#include "IDBDatabaseProxy.h"
+#include "WebIDBCallbacks.h"
+#include "WebIDBDatabase.h"
+#include "WebIDBDatabaseError.h"
+#include "WebSerializedScriptValue.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks)
+ : m_callbacks(callbacks)
+{
+}
+
+WebIDBCallbacksImpl::~WebIDBCallbacksImpl()
+{
+}
+
+void WebIDBCallbacksImpl::onError(const WebKit::WebIDBDatabaseError& error)
+{
+ m_callbacks->onError(error);
+ m_callbacks.clear();
+}
+
+void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBDatabase* webKitInstance)
+{
+ m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance));
+ m_callbacks.clear();
+}
+
+void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue)
+{
+ m_callbacks->onSuccess(serializedScriptValue);
+ m_callbacks.clear();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.h b/WebKit/chromium/src/WebIDBCallbacksImpl.h
new file mode 100644
index 0000000..9b53117
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBCallbacksImpl.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebIDBCallbacksImpl_h
+#define WebIDBCallbacksImpl_h
+
+#include "WebIDBCallbacks.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebKit {
+class WebIDBDatabase;
+class WebIDBDatabaseError;
+class WebSerializedScriptValue;
+}
+
+namespace WebCore {
+
+class IDBCallbacks;
+
+class WebIDBCallbacksImpl : public WebKit::WebIDBCallbacks {
+public:
+ WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks);
+ virtual ~WebIDBCallbacksImpl();
+
+ virtual void onError(const WebKit::WebIDBDatabaseError& error);
+ virtual void onSuccess(WebKit::WebIDBDatabase* webKitInstance);
+ virtual void onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue);
+
+private:
+ RefPtr<IDBCallbacks> m_callbacks;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // WebIDBCallbacksImpl_h
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
new file mode 100644
index 0000000..e33edc2
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebIDBDatabaseImpl.h"
+
+#include "IDBDatabase.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabase> idbDatabase)
+{
+}
+
+WebIDBDatabaseImpl::~WebIDBDatabaseImpl()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h
new file mode 100644
index 0000000..758f84a
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebIDBDatabaseImpl_h
+#define WebIDBDatabaseImpl_h
+
+#include "WebCommon.h"
+#include "WebIDBDatabase.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore { class IDBDatabase; }
+
+namespace WebKit {
+
+// See comment in WebIndexedDatabase for a high level overview these classes.
+class WebIDBDatabaseImpl : public WebIDBDatabase {
+public:
+ WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabase> idbDatabase);
+ virtual ~WebIDBDatabaseImpl();
+
+ // FIXME: Implement.
+
+private:
+ WTF::RefPtr<WebCore::IDBDatabase> m_idbDatabase;
+};
+
+} // namespace WebKit
+
+#endif // WebIDBDatabaseImpl_h
diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp
index 4820cfb..99aad39 100644
--- a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp
+++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp
@@ -31,11 +31,16 @@
#include "config.h"
#include "WebIndexedDatabaseImpl.h"
+#include "IDBCallbacksProxy.h"
+#include "IndexedDatabaseImpl.h"
+#include "SecurityOrigin.h"
#include "WebIDBDatabaseError.h"
#include <wtf/OwnPtr.h>
#if ENABLE(INDEXED_DATABASE)
+using namespace WebCore;
+
namespace WebKit {
WebIndexedDatabase* WebIndexedDatabase::create()
@@ -43,15 +48,18 @@ WebIndexedDatabase* WebIndexedDatabase::create()
return new WebIndexedDatabaseImpl();
}
+WebIndexedDatabaseImpl::WebIndexedDatabaseImpl()
+ : m_indexedDatabase(WebCore::IndexedDatabaseImpl::create())
+{
+}
+
WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl()
{
}
-void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks* callbacksPtr, const WebString& origin, WebFrame*, int& exceptionCode)
+void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, int& exceptionCode)
{
- OwnPtr<WebIDBCallbacks> callbacks(callbacksPtr);
- callbacks->onError(WebIDBDatabaseError(0, "Not implemented"));
- // FIXME: Implement for realz.
+ m_indexedDatabase->open(name, description, modifyDatabase, IDBCallbacksProxy::create(callbacks), origin, 0, exceptionCode);
}
} // namespace WebKit
diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.h b/WebKit/chromium/src/WebIndexedDatabaseImpl.h
index 0402ede..57d20a6 100644
--- a/WebKit/chromium/src/WebIndexedDatabaseImpl.h
+++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.h
@@ -30,14 +30,21 @@
#define WebIndexedDatabaseImpl_h
#include "WebIndexedDatabase.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore { class IndexedDatabase; }
namespace WebKit {
class WebIndexedDatabaseImpl : public WebIndexedDatabase {
public:
+ WebIndexedDatabaseImpl();
virtual ~WebIndexedDatabaseImpl();
- virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks*, const WebString& origin, WebFrame*, int& exceptionCode);
+ virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, int& exceptionCode);
+
+private:
+ WTF::RefPtr<WebCore::IndexedDatabase> m_indexedDatabase;
};
} // namespace WebKit
diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp
index 5ae1557..5200d17 100644
--- a/WebKit/chromium/src/WebNotification.cpp
+++ b/WebKit/chromium/src/WebNotification.cpp
@@ -94,16 +94,6 @@ WebString WebNotification::body() const
return m_private->contents().body();
}
-WebString WebNotification::dir() const
-{
- return m_private->dir();
-}
-
-WebString WebNotification::replaceId() const
-{
- return m_private->replaceId();
-}
-
void WebNotification::dispatchDisplayEvent()
{
RefPtr<Event> event = Event::create("display", false, true);
diff --git a/WebKit/chromium/src/WebSecurityOrigin.cpp b/WebKit/chromium/src/WebSecurityOrigin.cpp
index bc36be7..8685738 100644
--- a/WebKit/chromium/src/WebSecurityOrigin.cpp
+++ b/WebKit/chromium/src/WebSecurityOrigin.cpp
@@ -115,12 +115,18 @@ WebString WebSecurityOrigin::toString() const
return m_private->toString();
}
-WebString WebSecurityOrigin::databaseIdentifier()
+WebString WebSecurityOrigin::databaseIdentifier() const
{
ASSERT(m_private);
return m_private->databaseIdentifier();
}
+bool WebSecurityOrigin::canAccessPasswordManager() const
+{
+ ASSERT(m_private);
+ return m_private->canAccessPasswordManager();
+}
+
WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin)
: m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef()))
{
diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp
index 3adf3ac..5f32346 100644
--- a/WebKit/chromium/src/WebSettingsImpl.cpp
+++ b/WebKit/chromium/src/WebSettingsImpl.cpp
@@ -269,4 +269,9 @@ void WebSettingsImpl::setShowDebugBorders(bool show)
m_settings->setShowDebugBorders(show);
}
+void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior)
+{
+ m_settings->setEditingBehavior(static_cast<WebCore::EditingBehavior>(behavior));
+}
+
} // namespace WebKit
diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h
index fdc03f0..0a90091 100644
--- a/WebKit/chromium/src/WebSettingsImpl.h
+++ b/WebKit/chromium/src/WebSettingsImpl.h
@@ -85,6 +85,7 @@ public:
virtual void setOfflineWebApplicationCacheEnabled(bool);
virtual void setExperimentalWebGLEnabled(bool);
virtual void setShowDebugBorders(bool);
+ virtual void setEditingBehavior(EditingBehavior);
private:
WebCore::Settings* m_settings;
diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/WebKit/chromium/src/WebSharedWorkerImpl.cpp
index 91636d9..51bbf1b 100644
--- a/WebKit/chromium/src/WebSharedWorkerImpl.cpp
+++ b/WebKit/chromium/src/WebSharedWorkerImpl.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "WebSharedWorkerImpl.h"
-#include "GenericWorkerTask.h"
+#include "CrossThreadTask.h"
#include "KURL.h"
#include "MessageEvent.h"
#include "MessagePortChannel.h"
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 94cf36c..4e8b7c8 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -239,7 +239,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_suggestionsPopup(0)
, m_isTransparent(false)
, m_tabsToLinks(false)
- , m_haveMouseCapture(false)
#if USE(ACCELERATED_COMPOSITING)
, m_layerRenderer(0)
, m_isAcceleratedCompositingActive(false)
@@ -255,13 +254,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
m_lastMousePosition = WebPoint(-1, -1);
// the page will take ownership of the various clients
- m_page.set(new Page(&m_chromeClientImpl,
- &m_contextMenuClientImpl,
- &m_editorClientImpl,
- &m_dragClientImpl,
- &m_inspectorClientImpl,
- 0,
- 0));
+ m_page.set(new Page(&m_chromeClientImpl, &m_contextMenuClientImpl, &m_editorClientImpl, &m_dragClientImpl, &m_inspectorClientImpl, 0, 0, 0));
m_page->backForwardList()->setClient(&m_backForwardListClientImpl);
m_page->setGroupName(pageGroupName);
@@ -337,19 +330,23 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event)
}
m_lastMouseDownPoint = WebPoint(event.x, event.y);
- m_haveMouseCapture = true;
- // If a text field that has focus is clicked again, we should display the
- // suggestions popup.
RefPtr<Node> clickedNode;
if (event.button == WebMouseEvent::ButtonLeft) {
+ IntPoint point(event.x, event.y);
+ point = m_page->mainFrame()->view()->windowToContents(point);
+ HitTestResult result(m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false));
+ Node* hitNode = result.innerNonSharedNode();
+
+ // Take capture on a mouse down on a plugin so we can send it mouse events.
+ if (hitNode && hitNode->renderer() && hitNode->renderer()->isEmbeddedObject())
+ m_mouseCaptureNode = hitNode;
+
+ // If a text field that has focus is clicked again, we should display the
+ // suggestions popup.
RefPtr<Node> focusedNode = focusedWebCoreNode();
if (focusedNode.get() && toHTMLInputElement(focusedNode.get())) {
- IntPoint point(event.x, event.y);
- point = m_page->mainFrame()->view()->windowToContents(point);
- HitTestResult result(point);
- result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false);
- if (result.innerNonSharedNode() == focusedNode) {
+ if (hitNode == focusedNode) {
// Already focused text field was clicked, let's remember this. If
// focus has not changed after the mouse event is processed, we'll
// trigger the autocomplete.
@@ -970,12 +967,19 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
// Draw the contents of the root layer.
updateRootLayerContents(rect);
- // Composite everything into the canvas that's passed to us.
-#if PLATFORM(SKIA)
- m_layerRenderer->drawLayersInCanvas(static_cast<skia::PlatformCanvas*>(canvas), IntRect(rect));
-#elif PLATFORM(CG)
-#error "Need to implement CG version"
-#endif
+ WebFrameImpl* webframe = mainFrameImpl();
+ if (!webframe)
+ return;
+ FrameView* view = webframe->frameView();
+ if (!view)
+ return;
+
+ // The visibleRect includes scrollbars whereas the contentRect doesn't.
+ IntRect visibleRect = view->visibleContentRect(true);
+ IntRect contentRect = view->visibleContentRect(false);
+
+ // Ask the layer compositor to redraw all the layers.
+ m_layerRenderer->drawLayers(rect, visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY()));
}
#endif
}
@@ -994,36 +998,36 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
if (m_ignoreInputEvents)
return true;
- if (m_haveMouseCapture && WebInputEvent::isMouseEventType(inputEvent.type)) {
+ if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.type)) {
+ // Save m_mouseCaptureNode since mouseCaptureLost() will clear it.
+ RefPtr<Node> node = m_mouseCaptureNode;
+
// Not all platforms call mouseCaptureLost() directly.
if (inputEvent.type == WebInputEvent::MouseUp)
mouseCaptureLost();
- Node* node = focusedWebCoreNode();
- if (node && node->renderer() && node->renderer()->isEmbeddedObject()) {
- AtomicString eventType;
- switch (inputEvent.type) {
- case WebInputEvent::MouseMove:
- eventType = eventNames().mousemoveEvent;
- break;
- case WebInputEvent::MouseLeave:
- eventType = eventNames().mouseoutEvent;
- break;
- case WebInputEvent::MouseDown:
- eventType = eventNames().mousedownEvent;
- break;
- case WebInputEvent::MouseUp:
- eventType = eventNames().mouseupEvent;
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-
- node->dispatchMouseEvent(
- PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)),
- eventType);
- return true;
+ AtomicString eventType;
+ switch (inputEvent.type) {
+ case WebInputEvent::MouseMove:
+ eventType = eventNames().mousemoveEvent;
+ break;
+ case WebInputEvent::MouseLeave:
+ eventType = eventNames().mouseoutEvent;
+ break;
+ case WebInputEvent::MouseDown:
+ eventType = eventNames().mousedownEvent;
+ break;
+ case WebInputEvent::MouseUp:
+ eventType = eventNames().mouseupEvent;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
}
+
+ node->dispatchMouseEvent(
+ PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)),
+ eventType);
+ return true;
}
// FIXME: Remove m_currentInputEvent.
@@ -1090,7 +1094,7 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
void WebViewImpl::mouseCaptureLost()
{
- m_haveMouseCapture = false;
+ m_mouseCaptureNode = 0;
}
void WebViewImpl::setFocus(bool enable)
@@ -1178,7 +1182,11 @@ bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command,
return false;
}
- if (command == WebCompositionCommandDiscard) {
+ // If we're not going to fire a keypress event, then the keydown event was
+ // canceled. In that case, cancel any existing composition.
+ // FIXME: Ideally, we would only cancel a single keypress, rather than the
+ // whole composition.
+ if ((command == WebCompositionCommandDiscard) || m_suppressNextKeypressEvent) {
// A browser process sent an IPC message which does not contain a valid
// string, which means an ongoing composition has been canceled.
// If the ongoing composition has been canceled, replace the ongoing
@@ -2072,9 +2080,13 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
return;
if (active) {
- m_layerRenderer = LayerRendererChromium::create();
- if (m_layerRenderer)
+ m_layerRenderer = LayerRendererChromium::create(page());
+ if (m_layerRenderer->hardwareCompositing())
m_isAcceleratedCompositingActive = true;
+ else {
+ m_layerRenderer.clear();
+ m_isAcceleratedCompositingActive = false;
+ }
} else {
m_layerRenderer = 0;
m_isAcceleratedCompositingActive = false;
@@ -2086,6 +2098,12 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect)
if (!isAcceleratedCompositingActive())
return;
+ // FIXME: The accelerated compositing path invalidates a 1x1 rect at (0, 0)
+ // in order to get the renderer to ask the compositor to redraw. This is only
+ // temporary until we get the compositor to render directly from its own thread.
+ if (!rect.x && !rect.y && rect.width == 1 && rect.height == 1)
+ return;
+
WebFrameImpl* webframe = mainFrameImpl();
if (!webframe)
return;
@@ -2093,24 +2111,28 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect)
if (!view)
return;
- WebRect viewRect = view->frameRect();
- SkIRect scrollFrame;
- scrollFrame.set(view->scrollX(), view->scrollY(), view->layoutWidth() + view->scrollX(), view->layoutHeight() + view->scrollY());
- m_layerRenderer->setScrollFrame(scrollFrame);
LayerChromium* rootLayer = m_layerRenderer->rootLayer();
if (rootLayer) {
IntRect visibleRect = view->visibleContentRect(true);
- // Set the backing store size used by the root layer to be the size of the visible
- // area. Note that the root layer bounds could be larger than the backing store size,
- // but there's no reason to waste memory by allocating backing store larger than the
- // visible portion.
- rootLayer->setBackingStoreRect(IntSize(visibleRect.width(), visibleRect.height()));
+ // Update the root layer's backing store to be the size of the dirty rect.
+ // Unlike other layers the root layer doesn't have persistent storage for its
+ // contents in system memory.
+ rootLayer->setBackingStoreSize(IntSize(rect.width, rect.height));
GraphicsContext* rootLayerContext = rootLayer->graphicsContext();
+ skia::PlatformCanvas* platformCanvas = rootLayer->platformCanvas();
+
+ platformCanvas->save();
+
+ // Bring the canvas into the coordinate system of the paint rect.
+ platformCanvas->translate(static_cast<SkScalar>(-rect.x), static_cast<SkScalar>(-rect.y));
+
rootLayerContext->save();
webframe->paintWithContext(*(rootLayer->graphicsContext()), rect);
rootLayerContext->restore();
+
+ platformCanvas->restore();
}
}
@@ -2119,8 +2141,10 @@ void WebViewImpl::setRootLayerNeedsDisplay()
// FIXME: For now we're posting a repaint event for the entire page which is an overkill.
if (WebFrameImpl* webframe = mainFrameImpl()) {
if (FrameView* view = webframe->frameView()) {
+ // FIXME: Temporary hack to invalidate part of the page so that we get called to render
+ // again.
IntRect visibleRect = view->visibleContentRect(true);
- m_client->didInvalidateRect(visibleRect);
+ m_client->didInvalidateRect(IntRect(0, 0, 1, 1));
}
}
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index b561e49..d545a42 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -490,7 +490,8 @@ private:
NotificationPresenterImpl m_notificationPresenter;
#endif
- bool m_haveMouseCapture;
+ // If set, the (plugin) node which has mouse capture.
+ RefPtr<WebCore::Node> m_mouseCaptureNode;
#if USE(ACCELERATED_COMPOSITING)
OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer;
diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp
index 1fedeb2..244cceb 100644
--- a/WebKit/chromium/src/WebWorkerBase.cpp
+++ b/WebKit/chromium/src/WebWorkerBase.cpp
@@ -31,8 +31,8 @@
#include "config.h"
#include "WebWorkerBase.h"
+#include "CrossThreadTask.h"
#include "DatabaseTask.h"
-#include "GenericWorkerTask.h"
#include "MessagePortChannel.h"
#include "PlatformMessagePortChannel.h"
diff --git a/WebKit/chromium/src/WebWorkerClientImpl.cpp b/WebKit/chromium/src/WebWorkerClientImpl.cpp
index d0dda8e..13b7fe6 100644
--- a/WebKit/chromium/src/WebWorkerClientImpl.cpp
+++ b/WebKit/chromium/src/WebWorkerClientImpl.cpp
@@ -33,11 +33,11 @@
#if ENABLE(WORKERS)
+#include "CrossThreadTask.h"
#include "DedicatedWorkerThread.h"
#include "ErrorEvent.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
-#include "GenericWorkerTask.h"
#include "MessageEvent.h"
#include "MessagePort.h"
#include "MessagePortChannel.h"
diff --git a/WebKit/chromium/src/WebWorkerImpl.cpp b/WebKit/chromium/src/WebWorkerImpl.cpp
index 5b5e053..857c50f 100644
--- a/WebKit/chromium/src/WebWorkerImpl.cpp
+++ b/WebKit/chromium/src/WebWorkerImpl.cpp
@@ -31,9 +31,9 @@
#include "config.h"
#include "WebWorkerImpl.h"
+#include "CrossThreadTask.h"
#include "DedicatedWorkerContext.h"
#include "DedicatedWorkerThread.h"
-#include "GenericWorkerTask.h"
#include "KURL.h"
#include "MessageEvent.h"
#include "MessagePort.h"
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index e166b52..9db2729 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,104 @@
+2010-05-22 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] webkit_web_view_drag_end should call EventHandler::dragSourceEndedAt
+ https://bugs.webkit.org/show_bug.cgi?id=39465
+
+ Properly call EventHandler::dragSourceEndedAt so that dragEnd events are processed in the DOM.
+ dragSourceEndedAt is responsible for calling the dragEnd DOM event as well as cleaning up assets
+ (such as the Clipboard) associated with the drag source.
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_drag_end): Remember to call dragSourceEndedAt here.
+
+2010-05-22 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] WebKit/gtk/WebCoreSupport/DragClientGtk::startDrag should use the Clipboard::sourceOperation
+ https://bugs.webkit.org/show_bug.cgi?id=39459
+
+ * WebCoreSupport/DragClientGtk.cpp:
+ (WebKit::DragClient::startDrag):
+ Use Clipboard::sourceOperation instead of trying to figure out the GdkDragAction
+ manually. The DOM may have changed the appropriate list of actions anyhow.
+
+2010-05-21 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Add DeviceOrientation and DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=39479
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_init):
+
+2010-05-19 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r59240.
+ http://trac.webkit.org/changeset/59240
+ https://bugs.webkit.org/show_bug.cgi?id=39377
+
+ "Might cause crashes in GTK+ bots" (Requested by xan_ on
+ #webkit).
+
+ * WebCoreSupport/ContextMenuClientGtk.cpp:
+ (WebKit::inputMethodsMenuItem):
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::EditorClient::setInputMethodState):
+ (WebKit::EditorClient::respondToChangedSelection):
+ (WebKit::EditorClient::handleInputMethodKeydown):
+ (WebKit::EditorClient::EditorClient):
+ (WebKit::EditorClient::~EditorClient):
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::postCommitFrameViewSetup):
+ * webkit/webkitprivate.h:
+ * webkit/webkitwebview.cpp:
+ (destroy_menu_cb):
+ (webkit_web_view_forward_context_menu_event):
+ (webkit_web_view_key_release_event):
+ (webkit_web_view_button_release_event):
+ (webkit_web_view_focus_in_event):
+ (webkit_web_view_focus_out_event):
+ (webkit_web_view_realize):
+ (webkit_web_view_set_scroll_adjustments):
+ (webkit_web_view_dispose):
+ (webkit_web_view_finalize):
+ (webViewGetDPI):
+ (webkit_web_view_screen_changed):
+ (webkit_web_view_query_tooltip):
+ (webkit_web_view_get_im_context):
+ (webkit_web_view_update_settings):
+ (webkit_web_view_init):
+ (webkit_web_view_set_settings):
+ (webkit_web_view_get_settings):
+ (webkit_web_view_get_inspector):
+ (webkit_web_view_set_window_features):
+ (webkit_web_view_get_window_features):
+ (webkit_web_view_get_back_forward_list):
+ (webkit_web_view_zoom_in):
+ (webkit_web_view_zoom_out):
+ (webkit_web_view_get_encoding):
+ (webkit_web_view_get_custom_encoding):
+ (webkit_web_view_add_resource):
+ (webkit_web_view_get_resource):
+ (webkit_web_view_get_main_resource):
+ (webkit_web_view_clear_resources):
+ (webkit_web_view_get_subresources):
+ (webkit_web_view_set_tooltip_text):
+ (webkit_web_view_get_icon_uri):
+
+2010-05-18 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] DragClientGtk::startDrag leaks GdkEvents
+ https://bugs.webkit.org/show_bug.cgi?id=39322
+
+ * WebCoreSupport/DragClientGtk.cpp:
+ (WebKit::DragClient::startDrag): Properly clean up allocated GdkEvent.
+
2010-05-12 Martin Robinson <mrobinson@igalia.com>
Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
index 069fb19..5c1bc0b 100644
--- a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
@@ -62,7 +62,7 @@ static GtkWidget* inputMethodsMenuItem (WebKitWebView* webView)
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
GtkWidget* imContextMenu = gtk_menu_new();
- gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(priv->imContext.get()), GTK_MENU_SHELL(imContextMenu));
+ gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(priv->imContext), GTK_MENU_SHELL(imContextMenu));
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), imContextMenu);
diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
index 900fb61..c1e8e74 100644
--- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
@@ -20,8 +20,10 @@
#include "DragClientGtk.h"
#include "ClipboardGtk.h"
+#include "ClipboardUtilitiesGtk.h"
#include "DataObjectGtk.h"
#include "Document.h"
+#include "DragController.h"
#include "Element.h"
#include "Frame.h"
#include "GRefPtrGtk.h"
@@ -71,25 +73,24 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin,
{
ClipboardGtk* clipboardGtk = reinterpret_cast<ClipboardGtk*>(clipboard);
- GdkDragAction dragAction = GDK_ACTION_COPY;
- if (linkDrag)
- dragAction = (GdkDragAction) (dragAction | GDK_ACTION_LINK);
-
WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame));
RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject();
GRefPtr<GtkTargetList> targetList(clipboardGtk->helper()->targetListForDataObject(dataObject.get()));
GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
- reinterpret_cast<GdkEventButton*>(event)->window = gtk_widget_get_window(GTK_WIDGET(m_webView));
- reinterpret_cast<GdkEventButton*>(event)->time = GDK_CURRENT_TIME;
+ // This will be decremented by gdk_event_free() below.
+ event->button.window = static_cast<GdkWindow*>(g_object_ref(gtk_widget_get_window(GTK_WIDGET(m_webView))));
+ event->button.time = GDK_CURRENT_TIME;
- GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragAction, 1, event);
+ GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, event);
webView->priv->draggingDataObjects.set(context, dataObject);
if (image)
gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y());
else
gtk_drag_set_icon_default(context);
+
+ gdk_event_free(event);
}
DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*)
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index d3f8fa1..a5c36e8 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -220,15 +220,15 @@ void EditorClient::setInputMethodState(bool active)
WebKitWebViewPrivate* priv = m_webView->priv;
if (active)
- gtk_im_context_focus_in(priv->imContext.get());
+ gtk_im_context_focus_in(priv->imContext);
else
- gtk_im_context_focus_out(priv->imContext.get());
+ gtk_im_context_focus_out(priv->imContext);
#ifdef MAEMO_CHANGES
if (active)
- hildon_gtk_im_context_show(priv->imContext.get());
+ hildon_gtk_im_context_show(priv->imContext);
else
- hildon_gtk_im_context_hide(priv->imContext.get());
+ hildon_gtk_im_context_hide(priv->imContext);
#endif
}
@@ -367,7 +367,7 @@ void EditorClient::respondToChangedSelection()
unsigned end;
if (!targetFrame->editor()->getCompositionSelection(start, end)) {
// gtk_im_context_reset() clears the composition for us.
- gtk_im_context_reset(priv->imContext.get());
+ gtk_im_context_reset(priv->imContext);
targetFrame->editor()->confirmCompositionWithoutDisturbingSelection();
}
}
@@ -700,7 +700,7 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
m_treatContextCommitAsKeyEvent = (!targetFrame->editor()->hasComposition())
&& event->keyEvent()->gdkEventKey()->keyval;
clearPendingComposition();
- if ((gtk_im_context_filter_keypress(priv->imContext.get(), event->keyEvent()->gdkEventKey()) && !m_pendingComposition)
+ if ((gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey()) && !m_pendingComposition)
|| (!m_treatContextCommitAsKeyEvent && !targetFrame->editor()->hasComposition()))
event->preventDefault();
@@ -714,8 +714,8 @@ EditorClient::EditorClient(WebKitWebView* webView)
, m_nativeWidget(gtk_text_view_new())
{
WebKitWebViewPrivate* priv = m_webView->priv;
- g_signal_connect(priv->imContext.get(), "commit", G_CALLBACK(imContextCommitted), this);
- g_signal_connect(priv->imContext.get(), "preedit-changed", G_CALLBACK(imContextPreeditChanged), this);
+ g_signal_connect(priv->imContext, "commit", G_CALLBACK(imContextCommitted), this);
+ g_signal_connect(priv->imContext, "preedit-changed", G_CALLBACK(imContextPreeditChanged), this);
g_signal_connect(m_nativeWidget.get(), "backspace", G_CALLBACK(backspaceCallback), this);
g_signal_connect(m_nativeWidget.get(), "cut-clipboard", G_CALLBACK(cutClipboardCallback), this);
@@ -729,8 +729,8 @@ EditorClient::EditorClient(WebKitWebView* webView)
EditorClient::~EditorClient()
{
WebKitWebViewPrivate* priv = m_webView->priv;
- g_signal_handlers_disconnect_by_func(priv->imContext.get(), (gpointer)imContextCommitted, this);
- g_signal_handlers_disconnect_by_func(priv->imContext.get(), (gpointer)imContextPreeditChanged, this);
+ g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextCommitted, this);
+ g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextPreeditChanged, this);
}
void EditorClient::textFieldDidBeginEditing(Element*)
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 1fe6b0f..fd2d7ed 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -1135,11 +1135,14 @@ static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, boo
{
WebKitWebView* containingWindow = getViewFromFrame(frame);
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow);
- view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues);
+ view->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment, resetValues);
if (priv->currentMenu) {
- gtk_menu_popdown(priv->currentMenu.get());
- priv->currentMenu.clear();
+ GtkMenu* menu = priv->currentMenu;
+ priv->currentMenu = 0;
+
+ gtk_menu_popdown(menu);
+ g_object_unref(menu);
}
}
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index abca3c8..057b0e5 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -115,42 +115,42 @@ extern "C" {
typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate;
struct _WebKitWebViewPrivate {
WebCore::Page* corePage;
- GRefPtr<WebKitWebSettings> webSettings;
- GRefPtr<WebKitWebInspector> webInspector;
- GRefPtr<WebKitWebWindowFeatures> webWindowFeatures;
+ WebKitWebSettings* webSettings;
+ WebKitWebInspector* webInspector;
+ WebKitWebWindowFeatures* webWindowFeatures;
WebKitWebFrame* mainFrame;
- GRefPtr<WebKitWebBackForwardList> backForwardList;
+ WebKitWebBackForwardList* backForwardList;
- GRefPtr<GtkMenu> currentMenu;
+ GtkMenu* currentMenu;
gint lastPopupXPosition;
gint lastPopupYPosition;
HashSet<GtkWidget*> children;
bool editable;
- GRefPtr<GtkIMContext> imContext;
+ GtkIMContext* imContext;
gboolean transparent;
- GRefPtr<GtkAdjustment> horizontalAdjustment;
- GRefPtr<GtkAdjustment> verticalAdjustment;
+ GtkAdjustment* horizontalAdjustment;
+ GtkAdjustment* verticalAdjustment;
gboolean zoomFullContent;
WebKitLoadStatus loadStatus;
- GOwnPtr<char> encoding;
- GOwnPtr<char> customEncoding;
+ char* encoding;
+ char* customEncoding;
- GOwnPtr<char> iconURI;
+ char* iconURI;
gboolean disposing;
gboolean usePrimaryForPaste;
// These are hosted here because the DataSource object is
// created too late in the frame loading process.
- GRefPtr<WebKitWebResource> mainResource;
- GOwnPtr<char> mainResourceIdentifier;
- GRefPtr<GHashTable> subResources;
- GOwnPtr<char> tooltipText;
+ WebKitWebResource* mainResource;
+ char* mainResourceIdentifier;
+ GHashTable* subResources;
+ char* tooltipText;
HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> > draggingDataObjects;
};
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index ca72665..f3bb5e6 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -44,6 +44,7 @@
#include "BackForwardList.h"
#include "Cache.h"
#include "ChromeClientGtk.h"
+#include "ClipboardUtilitiesGtk.h"
#include "ContextMenuClientGtk.h"
#include "ContextMenuController.h"
#include "ContextMenu.h"
@@ -204,7 +205,9 @@ static void destroy_menu_cb(GtkObject* object, gpointer data)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(data);
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
- priv->currentMenu = 0;
+
+ g_object_unref(priv->currentMenu);
+ priv->currentMenu = NULL;
}
static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData)
@@ -294,7 +297,7 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
return FALSE;
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
- priv->currentMenu = menu;
+ priv->currentMenu = GTK_MENU(g_object_ref(menu));
priv->lastPopupXPosition = event.globalX();
priv->lastPopupYPosition = event.globalY();
@@ -568,7 +571,7 @@ static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey
// the event if we don't have a pending composition, because that means we
// are using a context like 'simple' which marks every keystroke as filtered.
WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient());
- if (gtk_im_context_filter_keypress(webView->priv->imContext.get(), event) && !client->hasPendingComposition())
+ if (gtk_im_context_filter_keypress(webView->priv->imContext, event) && !client->hasPendingComposition())
return TRUE;
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
@@ -625,7 +628,7 @@ static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEvent
if (focusedFrame && focusedFrame->editor()->canEdit()) {
#ifdef MAEMO_CHANGES
WebKitWebViewPrivate* priv = webView->priv;
- hildon_gtk_im_context_filter_event(priv->imContext.get(), (GdkEvent*)event);
+ hildon_gtk_im_context_filter_event(priv->imContext, (GdkEvent*)event);
#endif
}
@@ -728,7 +731,7 @@ static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus*
else
focusController->setFocusedFrame(core(webView)->mainFrame());
- gtk_im_context_focus_in(webView->priv->imContext.get());
+ gtk_im_context_focus_in(webView->priv->imContext);
}
return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event);
}
@@ -746,7 +749,7 @@ static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus
}
if (webView->priv->imContext)
- gtk_im_context_focus_out(webView->priv->imContext.get());
+ gtk_im_context_focus_out(webView->priv->imContext);
return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event);
}
@@ -785,7 +788,7 @@ static void webkit_web_view_realize(GtkWidget* widget)
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
WebKitWebViewPrivate* priv = webView->priv;
- gtk_im_context_set_client_window(priv->imContext.get(), widget->window);
+ gtk_im_context_set_client_window(priv->imContext, widget->window);
}
static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj)
@@ -794,7 +797,19 @@ static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAd
return;
FrameView* view = core(webkit_web_view_get_main_frame(webView))->view();
+
+ if (hadj)
+ g_object_ref(hadj);
+ if (vadj)
+ g_object_ref(vadj);
+
WebKitWebViewPrivate* priv = webView->priv;
+
+ if (priv->horizontalAdjustment)
+ g_object_unref(priv->horizontalAdjustment);
+ if (priv->verticalAdjustment)
+ g_object_unref(priv->verticalAdjustment);
+
priv->horizontalAdjustment = hadj;
priv->verticalAdjustment = vadj;
@@ -1062,6 +1077,21 @@ static void webkit_web_view_dispose(GObject* object)
priv->disposing = TRUE;
+ if (priv->horizontalAdjustment) {
+ g_object_unref(priv->horizontalAdjustment);
+ priv->horizontalAdjustment = NULL;
+ }
+
+ if (priv->verticalAdjustment) {
+ g_object_unref(priv->verticalAdjustment);
+ priv->verticalAdjustment = NULL;
+ }
+
+ if (priv->backForwardList) {
+ g_object_unref(priv->backForwardList);
+ priv->backForwardList = NULL;
+ }
+
if (priv->corePage) {
webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object));
@@ -1071,18 +1101,30 @@ static void webkit_web_view_dispose(GObject* object)
}
if (priv->webSettings) {
- g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView);
- priv->webSettings.clear();
+ g_signal_handlers_disconnect_by_func(priv->webSettings, (gpointer)webkit_web_view_settings_notify, webView);
+ g_object_unref(priv->webSettings);
+ priv->webSettings = NULL;
+
+ g_object_unref(priv->webInspector);
+ priv->webInspector = NULL;
+
+ g_object_unref(priv->webWindowFeatures);
+ priv->webWindowFeatures = NULL;
+
+ g_object_unref(priv->imContext);
+ priv->imContext = NULL;
+ }
+
+ if (priv->mainResource) {
+ g_object_unref(priv->mainResource);
+ priv->mainResource = NULL;
+ }
+
+ if (priv->subResources) {
+ g_hash_table_unref(priv->subResources);
+ priv->subResources = NULL;
}
- priv->horizontalAdjustment.clear();
- priv->verticalAdjustment.clear();
- priv->backForwardList.clear();
- priv->webInspector.clear();
- priv->webWindowFeatures.clear();
- priv->imContext.clear();
- priv->mainResource.clear();
- priv->subResources.clear();
priv->draggingDataObjects.clear();
G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object);
@@ -1093,11 +1135,11 @@ static void webkit_web_view_finalize(GObject* object)
WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
WebKitWebViewPrivate* priv = webView->priv;
- priv->tooltipText.clear();
- priv->mainResourceIdentifier.clear();
- priv->encoding.clear();
- priv->customEncoding.clear();
- priv->iconURI.clear();
+ g_free(priv->tooltipText);
+ g_free(priv->mainResourceIdentifier);
+ g_free(priv->encoding);
+ g_free(priv->customEncoding);
+ g_free(priv->iconURI);
G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object);
}
@@ -1148,7 +1190,7 @@ static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget)
static gdouble webViewGetDPI(WebKitWebView* webView)
{
WebKitWebViewPrivate* priv = webView->priv;
- WebKitWebSettings* webSettings = priv->webSettings.get();
+ WebKitWebSettings* webSettings = priv->webSettings;
gboolean enforce96DPI;
g_object_get(webSettings, "enforce-96-dpi", &enforce96DPI, NULL);
if (enforce96DPI)
@@ -1174,7 +1216,7 @@ static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previou
if (priv->disposing)
return;
- WebKitWebSettings* webSettings = priv->webSettings.get();
+ WebKitWebSettings* webSettings = priv->webSettings;
Settings* settings = core(webView)->settings();
gdouble DPI = webViewGetDPI(webView);
@@ -1195,14 +1237,37 @@ static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previou
static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context)
{
- WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(WEBKIT_WEB_VIEW(widget));
+ WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
+ WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
// This might happen if a drag is still in progress after a WebKitWebView
- // is diposed and before it is finalized.
+ // is disposed and before it is finalized.
if (!priv->draggingDataObjects.contains(context))
return;
priv->draggingDataObjects.remove(context);
+
+ Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
+ if (!frame)
+ return;
+
+ GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE);
+ int x, y, xRoot, yRoot;
+ GdkModifierType modifiers;
+ GdkDisplay* display = gdk_display_get_default();
+ gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers);
+
+ event->button.window = static_cast<GdkWindow*>(g_object_ref(gdk_display_get_window_at_pointer(display, &x, &y)));
+ event->button.x = x;
+ event->button.y = y;
+ event->button.x_root = xRoot;
+ event->button.y_root = yRoot;
+ event->button.state = modifiers;
+
+ PlatformMouseEvent platformEvent(&event->button);
+ frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(context->action));
+
+ gdk_event_free(event);
}
static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint)
@@ -1223,7 +1288,7 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y,
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(widget);
if (priv->tooltipText) {
- gtk_tooltip_set_text(tooltip, priv->tooltipText.get());
+ gtk_tooltip_set_text(tooltip, priv->tooltipText);
return TRUE;
}
@@ -1234,7 +1299,7 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y,
static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
- return GTK_IM_CONTEXT(webView->priv->imContext.get());
+ return GTK_IM_CONTEXT(webView->priv->imContext);
}
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
@@ -2550,7 +2615,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
static void webkit_web_view_update_settings(WebKitWebView* webView)
{
WebKitWebViewPrivate* priv = webView->priv;
- WebKitWebSettings* webSettings = priv->webSettings.get();
+ WebKitWebSettings* webSettings = priv->webSettings;
Settings* settings = core(webView)->settings();
gchar* defaultEncoding, *cursiveFontFamily, *defaultFontFamily, *fantasyFontFamily, *monospaceFontFamily, *sansSerifFontFamily, *serifFontFamily, *userStylesheetUri;
@@ -2754,36 +2819,40 @@ static void webkit_web_view_init(WebKitWebView* webView)
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
webView->priv = priv;
- priv->imContext = adoptGRef(gtk_im_multicontext_new());
+ priv->imContext = gtk_im_multicontext_new();
WebKit::InspectorClient* inspectorClient = new WebKit::InspectorClient(webView);
- priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0, 0);
+ priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0, 0, 0);
// We also add a simple wrapper class to provide the public
// interface for the Web Inspector.
- priv->webInspector = adoptGRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL)));
- webkit_web_inspector_set_inspector_client(priv->webInspector.get(), priv->corePage);
+ priv->webInspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL));
+ webkit_web_inspector_set_inspector_client(priv->webInspector, priv->corePage);
- // These are create with floating references, so they should not be wrapped in adoptGref.
priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
+ g_object_ref_sink(priv->horizontalAdjustment);
+ g_object_ref_sink(priv->verticalAdjustment);
+
GTK_WIDGET_SET_FLAGS(webView, GTK_CAN_FOCUS);
priv->mainFrame = WEBKIT_WEB_FRAME(webkit_web_frame_new(webView));
priv->lastPopupXPosition = priv->lastPopupYPosition = -1;
priv->editable = false;
- priv->backForwardList = adoptGRef(webkit_web_back_forward_list_new_with_web_view(webView));
+ priv->backForwardList = webkit_web_back_forward_list_new_with_web_view(webView);
priv->zoomFullContent = FALSE;
- priv->webSettings = adoptGRef(webkit_web_settings_new());
+ priv->webSettings = webkit_web_settings_new();
webkit_web_view_update_settings(webView);
- g_signal_connect(priv->webSettings.get(), "notify", G_CALLBACK(webkit_web_view_settings_notify), webView);
+ g_signal_connect(priv->webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView);
- priv->webWindowFeatures = adoptGRef(webkit_web_window_features_new());
+ priv->webWindowFeatures = webkit_web_window_features_new();
- priv->subResources = adoptGRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref));
+ priv->subResources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref);
+
+ priv->tooltipText = 0;
}
GtkWidget* webkit_web_view_new(void)
@@ -2839,7 +2908,9 @@ void webkit_web_view_set_settings(WebKitWebView* webView, WebKitWebSettings* web
g_return_if_fail(WEBKIT_IS_WEB_SETTINGS(webSettings));
WebKitWebViewPrivate* priv = webView->priv;
- g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView);
+ g_signal_handlers_disconnect_by_func(priv->webSettings, (gpointer)webkit_web_view_settings_notify, webView);
+ g_object_unref(priv->webSettings);
+ g_object_ref(webSettings);
priv->webSettings = webSettings;
webkit_web_view_update_settings(webView);
g_signal_connect(webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView);
@@ -2851,7 +2922,7 @@ WebKitWebSettings* webkit_web_view_get_settings(WebKitWebView* webView)
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
WebKitWebViewPrivate* priv = webView->priv;
- return priv->webSettings.get();
+ return priv->webSettings;
}
/**
@@ -2875,7 +2946,7 @@ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView)
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
WebKitWebViewPrivate* priv = webView->priv;
- return priv->webInspector.get();
+ return priv->webInspector;
}
// internal
@@ -2886,9 +2957,11 @@ static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWe
if (!webWindowFeatures)
return;
- if (webkit_web_window_features_equal(priv->webWindowFeatures.get(), webWindowFeatures))
+ if (webkit_web_window_features_equal(priv->webWindowFeatures, webWindowFeatures))
return;
+ g_object_unref(priv->webWindowFeatures);
+ g_object_ref(webWindowFeatures);
priv->webWindowFeatures = webWindowFeatures;
}
@@ -2908,7 +2981,7 @@ WebKitWebWindowFeatures* webkit_web_view_get_window_features(WebKitWebView* webV
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
WebKitWebViewPrivate* priv = webView->priv;
- return priv->webWindowFeatures.get();
+ return priv->webWindowFeatures;
}
/**
@@ -2978,7 +3051,7 @@ WebKitWebBackForwardList* webkit_web_view_get_back_forward_list(WebKitWebView* w
if (!core(webView) || !core(webView)->backForwardList()->enabled())
return NULL;
- return priv->backForwardList.get();
+ return priv->backForwardList;
}
/**
@@ -3738,7 +3811,7 @@ void webkit_web_view_zoom_in(WebKitWebView* webView)
WebKitWebViewPrivate* priv = webView->priv;
gfloat zoomMultiplierRatio;
- g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL);
+ g_object_get(priv->webSettings, "zoom-step", &zoomMultiplierRatio, NULL);
webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) + zoomMultiplierRatio);
}
@@ -3759,7 +3832,7 @@ void webkit_web_view_zoom_out(WebKitWebView* webView)
WebKitWebViewPrivate* priv = webView->priv;
gfloat zoomMultiplierRatio;
- g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL);
+ g_object_get(priv->webSettings, "zoom-step", &zoomMultiplierRatio, NULL);
webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) - zoomMultiplierRatio);
}
@@ -3874,8 +3947,9 @@ const gchar* webkit_web_view_get_encoding(WebKitWebView* webView)
if (!encoding.isEmpty()) {
WebKitWebViewPrivate* priv = webView->priv;
- priv->encoding.set(g_strdup(encoding.utf8().data()));
- return priv->encoding.get();
+ g_free(priv->encoding);
+ priv->encoding = g_strdup(encoding.utf8().data());
+ return priv->encoding;
} else
return NULL;
}
@@ -3916,8 +3990,9 @@ const char* webkit_web_view_get_custom_encoding(WebKitWebView* webView)
if (!overrideEncoding.isEmpty()) {
WebKitWebViewPrivate* priv = webView->priv;
- priv->customEncoding.set(g_strdup(overrideEncoding.utf8().data()));
- return priv->customEncoding.get();
+ g_free (priv->customEncoding);
+ priv->customEncoding = g_strdup(overrideEncoding.utf8().data());
+ return priv->customEncoding;
} else
return NULL;
}
@@ -4072,11 +4147,11 @@ void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebK
if (!priv->mainResource) {
priv->mainResource = webResource;
- priv->mainResourceIdentifier.set(g_strdup(identifier));
+ priv->mainResourceIdentifier = g_strdup(identifier);
return;
}
- g_hash_table_insert(priv->subResources.get(), identifier, webResource);
+ g_hash_table_insert(priv->subResources, identifier, webResource);
}
WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* identifier)
@@ -4084,13 +4159,13 @@ WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* id
WebKitWebViewPrivate* priv = webView->priv;
gpointer webResource = NULL;
- gboolean resourceFound = g_hash_table_lookup_extended(priv->subResources.get(), identifier, NULL, &webResource);
+ gboolean resourceFound = g_hash_table_lookup_extended(priv->subResources, identifier, NULL, &webResource);
// The only resource we do not store in this hash table is the
// main! If we did not find a request, it probably means the load
// has been interrupted while while a resource was still being
// loaded.
- if (!resourceFound && !g_str_equal(identifier, priv->mainResourceIdentifier.get()))
+ if (!resourceFound && !g_str_equal(identifier, priv->mainResourceIdentifier))
return NULL;
if (!webResource)
@@ -4101,24 +4176,30 @@ WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* id
WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView* webView)
{
- return webView->priv->mainResource.get();
+ return webView->priv->mainResource;
}
void webkit_web_view_clear_resources(WebKitWebView* webView)
{
WebKitWebViewPrivate* priv = webView->priv;
- priv->mainResourceIdentifier.clear();
- priv->mainResource.clear();
+
+ g_free(priv->mainResourceIdentifier);
+ priv->mainResourceIdentifier = NULL;
+
+ if (priv->mainResource) {
+ g_object_unref(priv->mainResource);
+ priv->mainResource = NULL;
+ }
if (priv->subResources)
- g_hash_table_remove_all(priv->subResources.get());
+ g_hash_table_remove_all(priv->subResources);
}
GList* webkit_web_view_get_subresources(WebKitWebView* webView)
{
WebKitWebViewPrivate* priv = webView->priv;
- GList* subResources = g_hash_table_get_values(priv->subResources.get());
- return g_list_remove(subResources, priv->mainResource.get());
+ GList* subResources = g_hash_table_get_values(priv->subResources);
+ return g_list_remove(subResources, priv->mainResource);
}
/* From EventHandler.cpp */
@@ -4134,11 +4215,12 @@ void webkit_web_view_set_tooltip_text(WebKitWebView* webView, const char* toolti
{
#if GTK_CHECK_VERSION(2, 12, 0)
WebKitWebViewPrivate* priv = webView->priv;
+ g_free(priv->tooltipText);
if (tooltip && *tooltip != '\0') {
- priv->tooltipText.set(g_strdup(tooltip));
+ priv->tooltipText = g_strdup(tooltip);
gtk_widget_set_has_tooltip(GTK_WIDGET(webView), TRUE);
} else {
- priv->tooltipText.clear();
+ priv->tooltipText = 0;
gtk_widget_set_has_tooltip(GTK_WIDGET(webView), FALSE);
}
@@ -4196,8 +4278,9 @@ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
String iconURL = iconDatabase()->iconURLForPageURL(corePage->mainFrame()->loader()->url().prettyURL());
WebKitWebViewPrivate* priv = webView->priv;
- priv->iconURI.set(g_strdup(iconURL.utf8().data()));
- return priv->iconURI.get();
+ g_free(priv->iconURI);
+ priv->iconURI = g_strdup(iconURL.utf8().data());
+ return priv->iconURI;
}
/**
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index f43aa5a..510ccfd 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,198 @@
+2010-05-21 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39420
+
+ Make sure everyone who needs to is using visitedDependentColor rather than accessing styles
+ directly.
+
+ * Misc/WebNSAttributedStringExtras.mm:
+ (+[NSAttributedString _web_attributedStringFromRange:]):
+ * WebView/WebFrame.mm:
+ (-[WebFrame _bodyBackgroundColor]):
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ All callable objects should have a global object reference
+ https://bugs.webkit.org/show_bug.cgi?id=39495
+
+ Update the plugin proxy to handle the need for global object.
+
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::newRuntimeObject):
+ (WebKit::ProxyRuntimeMethod::ProxyRuntimeMethod):
+ (WebKit::ProxyInstance::getMethod):
+ * Plugins/Hosted/ProxyRuntimeObject.h:
+ * Plugins/Hosted/ProxyRuntimeObject.mm:
+ (WebKit::ProxyRuntimeObject::ProxyRuntimeObject):
+
+2010-05-21 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Add DeviceOrientation and DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=39479
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+
+2010-05-20 Mike Thole <mthole@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ When using a scale factor > 1, scrollbars sometimes appear when not necessary
+ https://bugs.webkit.org/show_bug.cgi?id=39458
+
+ * WebView/WebDynamicScrollBarsView.mm:
+ (-[WebDynamicScrollBarsView updateScrollers]): Round up non-integral sizes from AppKit
+ so that they can be compared against the integral document size.
+
+2010-05-20 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39441
+ <rdar://problem/7985715> Flash context menu is both horizontally and vertically offset from point of click
+ <rdar://problem/7986109> Youtube video controller UI entirely missing
+ <rdar://problem/7986154> Flash content paints at horizontally and vertically shifted locations (within the plug-in region)
+
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ (-[WebHostedNetscapePluginView updateAndSetWindow]): The base coordinates of a window and
+ it's contentView happen to be the equal at a userSpaceScaleFactor of 1. For non-1.0 scale
+ factors this assumption is false. Accordingly we now convert to the window contentView
+ coordinate system when computing bounds in "window" and the visible rect.
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): Ditto.
+
+2010-05-20 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Provide bindings for DeviceOrientation
+ https://bugs.webkit.org/show_bug.cgi?id=39210
+
+ Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-05-20 Martin Robinson <mrobinson@webkit.org>
+
+ Reviewed by Ojan Vafai.
+
+ Expose the editing behavior setting in DRT to test all editing code paths
+ https://bugs.webkit.org/show_bug.cgi?id=38603
+
+ * WebView/WebFrame.mm:
+ (core):
+ * WebView/WebFrameInternal.h: Added a conversion method from the API enum to the WebCore enum.
+ * WebView/WebPreferenceKeysPrivate.h: Added a preference key for the new setting.
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]): Initialize the EditingBehavior to Mac style.
+ (-[WebPreferences editingBehavior]): Added.
+ (-[WebPreferences setEditingBehavior:]): Added.
+ * WebView/WebPreferencesPrivate.h: Added the new API points to the private API.
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]): Set the editing behavior via the WebPreferences setting.
+
+2010-05-19 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Kevin Decker and Simon Fraser.
+
+ <rdar://problem/8004528>
+ REGRESSION: Coordinate system for Core Animation NPAPI plug-ins is flipped with accelerated compositing turned on
+
+ When needed, create a new CALayer and set it's geometry to be flipped. Add the plug-in layer as a sublayer and then return
+ the newly created layer.
+
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ (-[WebHostedNetscapePluginView createPlugin]):
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView createPlugin]):
+
+2010-05-18 Tony Chang <tony@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24943
+ Command-B and Command-I do not generate keydown events in contentEditable regions.
+
+ Manual test because performKeyEquivalent is not called by DRT.
+
+ Test: manual-tests/style-keypress-events.html
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView performKeyEquivalent:]): Move style key handling until after webcore gets a chance to handle the event
+
+2010-05-18 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by Darin Adler, Jian Li.
+
+ DragData::asURL() shouldn't do file validity checks
+ https://bugs.webkit.org/show_bug.cgi?id=38711
+
+ Change [NSPasteboard _web_bestURL] to still return a file URL for paths
+ that don't exist. Callers who care about the existence of the file or
+ whether or not it is a directory should check themselves when they
+ want to use the file. The directory check has been left in for now,
+ since the Mac implementation of ResourceHandle, which uses this function
+ indirectly via DragController::performDrag) handles directories somewhat
+ non-intuitively: it opens the parent directory in the Finder, rather
+ than opening the directory itself.
+
+ * Misc/WebNSPasteboardExtras.mm:
+ (-[NSPasteboard _web_bestURL]):
+
+2010-05-18 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth (and Maciej Stachowiak).
+
+ Make it possible to enable the new HTML5Tokenizer for testing
+ https://bugs.webkit.org/show_bug.cgi?id=39275
+
+ Expose the WebCore::Settings::html5ParserEnabled as a private WebKit setting.
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (-[WebPreferences html5ParserEnabled]):
+ (-[WebPreferences setHTML5ParserEnabled:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]):
+
+2010-05-17 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r59652.
+ http://trac.webkit.org/changeset/59652
+ https://bugs.webkit.org/show_bug.cgi?id=39268
+
+ file-input-files-access test is broken on Mac (Requested by
+ dcheng on #webkit).
+
+ * Misc/WebNSPasteboardExtras.mm:
+ (-[NSPasteboard _web_bestURL]):
+
+2010-05-17 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ DragData::asURL() shouldn't do file validity checks
+ https://bugs.webkit.org/show_bug.cgi?id=38711
+
+ Change [NSPasteboard _web_bestURL] to still return a file URL for paths
+ that don't exist. Callers who care about the existence of the file or
+ whether or not it is a directory should check themselves when they
+ want to use the file. The directory check has been left in for now,
+ since the Mac implementation of ResourceHandle, which uses this function
+ indirectly via DragController::performDrag) handles directories somewhat
+ non-intuitively: it opens the parent directory in the Finder, rather
+ than opening the directory itself.
+
+ * Misc/WebNSPasteboardExtras.mm:
+ (-[NSPasteboard _web_bestURL]):
+
2010-05-14 Stephanie Lewis <slewis@apple.com>
Rubber-stamped by Mark Rowe.
diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig
index 947f371..c64d94c 100644
--- a/WebKit/mac/Configurations/FeatureDefines.xcconfig
+++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig
@@ -47,6 +47,7 @@ ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
ENABLE_DATABASE = ENABLE_DATABASE;
ENABLE_DATAGRID = ;
ENABLE_DATALIST = ENABLE_DATALIST;
+ENABLE_DEVICE_ORIENTATION = ;
ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
ENABLE_FILTERS = ENABLE_FILTERS;
@@ -78,4 +79,4 @@ ENABLE_XHTMLMP = ;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig
index daa79a9..6f999af 100644
--- a/WebKit/mac/Configurations/Version.xcconfig
+++ b/WebKit/mac/Configurations/Version.xcconfig
@@ -22,7 +22,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MAJOR_VERSION = 534;
-MINOR_VERSION = 0;
+MINOR_VERSION = 1;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/WebKit/mac/Misc/WebNSAttributedStringExtras.mm b/WebKit/mac/Misc/WebNSAttributedStringExtras.mm
index eb422f1..35b2524 100644
--- a/WebKit/mac/Misc/WebNSAttributedStringExtras.mm
+++ b/WebKit/mac/Misc/WebNSAttributedStringExtras.mm
@@ -154,12 +154,12 @@ static NSFileWrapper *fileWrapperForElement(Element* e)
RenderStyle* style = renderer->style();
NSFont *font = style->font().primaryFont()->getNSFont();
[attrs.get() setObject:font forKey:NSFontAttributeName];
- if (style->color().isValid())
- [attrs.get() setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
+ if (style->visitedDependentColor(CSSPropertyColor).isValid())
+ [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
else
[attrs.get() removeObjectForKey:NSForegroundColorAttributeName];
- if (style->backgroundColor().isValid())
- [attrs.get() setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
+ if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
+ [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
else
[attrs.get() removeObjectForKey:NSBackgroundColorAttributeName];
diff --git a/WebKit/mac/Misc/WebNSPasteboardExtras.mm b/WebKit/mac/Misc/WebNSPasteboardExtras.mm
index 8cebeb6..ab3baf7 100644
--- a/WebKit/mac/Misc/WebNSPasteboardExtras.mm
+++ b/WebKit/mac/Misc/WebNSPasteboardExtras.mm
@@ -141,12 +141,17 @@ static NSArray *_writableTypesForImageWithArchive (void)
if ([types containsObject:NSFilenamesPboardType]) {
NSArray *files = [self propertyListForType:NSFilenamesPboardType];
+ // FIXME: Maybe it makes more sense to allow multiple files and only use the first one?
if ([files count] == 1) {
NSString *file = [files objectAtIndex:0];
+ // FIXME: We are filtering out directories because that's what the original code used to
+ // do. Without this check, if the URL points to a local directory, Safari will open the
+ // parent directory of the directory in Finder. This check should go away as soon as
+ // possible.
BOOL isDirectory;
- if([[NSFileManager defaultManager] fileExistsAtPath:file isDirectory:&isDirectory] && !isDirectory){
- return [[NSURL fileURLWithPath:file] _webkit_canonicalize];
- }
+ if ([[NSFileManager defaultManager] fileExistsAtPath:file isDirectory:&isDirectory] && isDirectory)
+ return nil;
+ return [[NSURL fileURLWithPath:file] _webkit_canonicalize];
}
}
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 9a976f9..b569a4f 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -133,7 +133,7 @@ ProxyInstance::~ProxyInstance()
RuntimeObject* ProxyInstance::newRuntimeObject(ExecState* exec)
{
- return new (exec) ProxyRuntimeObject(exec, this);
+ return new (exec) ProxyRuntimeObject(exec, exec->lexicalGlobalObject(), this);
}
JSC::Bindings::Class* ProxyInstance::getClass() const
@@ -178,8 +178,8 @@ JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t id
class ProxyRuntimeMethod : public RuntimeMethod {
public:
- ProxyRuntimeMethod(ExecState* exec, const Identifier& name, Bindings::MethodList& list)
- : RuntimeMethod(exec, name, list)
+ ProxyRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
+ : RuntimeMethod(exec, globalObject, name, list)
{
}
@@ -193,7 +193,7 @@ const ClassInfo ProxyRuntimeMethod::s_info = { "ProxyRuntimeMethod", &RuntimeMet
JSValue ProxyInstance::getMethod(JSC::ExecState* exec, const JSC::Identifier& propertyName)
{
MethodList methodList = getClass()->methodsNamed(propertyName, this);
- return new (exec) ProxyRuntimeMethod(exec, propertyName, methodList);
+ return new (exec) ProxyRuntimeMethod(exec, exec->lexicalGlobalObject(), propertyName, methodList);
}
JSValue ProxyInstance::invokeMethod(ExecState* exec, JSC::RuntimeMethod* runtimeMethod, const ArgList& args)
diff --git a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h
index af3c5db..81d9b42 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h
+++ b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h
@@ -36,7 +36,7 @@ class ProxyInstance;
class ProxyRuntimeObject : public JSC::Bindings::RuntimeObject {
public:
- ProxyRuntimeObject(JSC::ExecState*, PassRefPtr<ProxyInstance>);
+ ProxyRuntimeObject(JSC::ExecState*, JSC::JSGlobalObject*, PassRefPtr<ProxyInstance>);
virtual ~ProxyRuntimeObject();
ProxyInstance* getInternalProxyInstance() const;
diff --git a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm
index 5ba6e15..96855b3 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm
@@ -35,8 +35,8 @@ namespace WebKit {
const ClassInfo ProxyRuntimeObject::s_info = { "ProxyRuntimeObject", &RuntimeObject::s_info, 0, 0 };
-ProxyRuntimeObject::ProxyRuntimeObject(ExecState* exec, PassRefPtr<ProxyInstance> instance)
- : RuntimeObject(exec, instance)
+ProxyRuntimeObject::ProxyRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<ProxyInstance> instance)
+ : RuntimeObject(exec, globalObject, instance)
{
}
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 519e274..6917e5f 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -122,6 +122,20 @@ extern "C" {
_pluginLayer = WKMakeRenderLayer(_proxy->renderContextID());
if (accleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) {
+ // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView.
+#ifndef BUILDING_ON_LEOPARD
+ // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry
+ // in order to get the coordinate system right.
+ RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.releaseRef());
+
+ _pluginLayer.adoptNS([[CALayer alloc] init]);
+ _pluginLayer.get().bounds = realPluginLayer.get().bounds;
+ _pluginLayer.get().geometryFlipped = YES;
+
+ realPluginLayer.get().autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
+ [_pluginLayer.get() addSublayer:realPluginLayer.get()];
+#endif
+
// Eagerly enter compositing mode, since we know we'll need it. This avoids firing setNeedsStyleRecalc()
// for iframes that contain composited plugins at bad times. https://bugs.webkit.org/show_bug.cgi?id=39033
core([self webFrame])->view()->enterCompositingMode();
@@ -166,8 +180,11 @@ extern "C" {
if (!_proxy)
return;
- // Use AppKit to convert view coordinates to NSWindow coordinates.
- NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
+ // The base coordinates of a window and it's contentView happen to be the equal at a userSpaceScaleFactor
+ // of 1. For non-1.0 scale factors this assumption is false.
+ NSView *windowContentView = [[self window] contentView];
+ NSRect boundsInWindow = [self convertRect:[self bounds] toView:windowContentView];
+
NSRect visibleRectInWindow;
// Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when
@@ -176,7 +193,7 @@ extern "C" {
// compatible with this behavior.
BOOL shouldClipOutPlugin = _pluginLayer && [self shouldClipOutPlugin];
if (!shouldClipOutPlugin)
- visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
+ visibleRectInWindow = [self convertRect:[self visibleRect] toView:windowContentView];
else
visibleRectInWindow = NSZeroRect;
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 9f5a6c2..8b4d998 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -274,12 +274,14 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
- (PortState)saveAndSetNewPortStateForUpdate:(BOOL)forUpdate
{
ASSERT([self currentWindow] != nil);
-
- // Use AppKit to convert view coordinates to NSWindow coordinates.
- NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
- NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
- // Flip Y to convert NSWindow coordinates to top-left-based window coordinates.
+ // The base coordinates of a window and it's contentView happen to be the equal at a userSpaceScaleFactor
+ // of 1. For non-1.0 scale factors this assumption is false.
+ NSView *windowContentView = [[self window] contentView];
+ NSRect boundsInWindow = [self convertRect:[self bounds] toView:windowContentView];
+ NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:windowContentView];
+
+ // Flip Y to convert -[NSWindow contentView] coordinates to top-left-based window coordinates.
float borderViewHeight = [[self currentWindow] frame].size.height;
boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow);
visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
@@ -1091,6 +1093,19 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
accleratedCompositingEnabled = [[[self webView] preferences] acceleratedCompositingEnabled];
#endif
if (accleratedCompositingEnabled) {
+ // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView.
+#ifndef BUILDING_ON_LEOPARD
+ // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry
+ // in order to get the coordinate system right.
+ RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.releaseRef());
+
+ _pluginLayer.adoptNS([[CALayer alloc] init]);
+ _pluginLayer.get().bounds = realPluginLayer.get().bounds;
+ _pluginLayer.get().geometryFlipped = YES;
+
+ realPluginLayer.get().autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
+ [_pluginLayer.get() addSublayer:realPluginLayer.get()];
+#endif
// Eagerly enter compositing mode, since we know we'll need it. This avoids firing setNeedsStyleRecalc()
// for iframes that contain composited plugins at bad times. https://bugs.webkit.org/show_bug.cgi?id=39033
core([self webFrame])->view()->enterCompositingMode();
diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
index 3aaea46..2041ac0 100644
--- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
+++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
@@ -262,6 +262,15 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
NSSize documentSize = [documentView frame].size;
NSSize visibleSize = [self documentVisibleRect].size;
NSSize frameSize = [self frame].size;
+
+ // When in HiDPI with a scale factor > 1, the visibleSize and frameSize may be non-integral values,
+ // while the documentSize (set by WebCore) will be integral. Round up the non-integral sizes so that
+ // the mismatch won't cause unwanted scrollbars to appear. This can result in slightly cut off content,
+ // but it will always be less than one pixel, which should not be noticeable.
+ visibleSize.width = ceilf(visibleSize.width);
+ visibleSize.height = ceilf(visibleSize.height);
+ frameSize.width = ceilf(frameSize.width);
+ frameSize.height = ceilf(frameSize.height);
if (_private->hScroll == ScrollbarAuto) {
newHasHorizontalScroller = documentSize.width > visibleSize.width;
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index 7545bd8..999f177 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -196,6 +196,18 @@ EditableLinkBehavior core(WebKitEditableLinkBehavior editableLinkBehavior)
return EditableLinkDefaultBehavior;
}
+WebCore::EditingBehavior core(WebKitEditingBehavior behavior)
+{
+ switch (behavior) {
+ case WebKitEditingMacBehavior:
+ return WebCore::EditingMacBehavior;
+ case WebKitEditingWinBehavior:
+ return WebCore::EditingWindowsBehavior;
+ }
+ ASSERT_NOT_REACHED();
+ return WebCore::EditingMacBehavior;
+}
+
TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior behavior)
{
switch (behavior) {
@@ -1025,7 +1037,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
RenderObject* bodyRenderer = body->renderer();
if (!bodyRenderer)
return nil;
- Color color = bodyRenderer->style()->backgroundColor();
+ Color color = bodyRenderer->style()->visitedDependentColor(CSSPropertyBackgroundColor);
if (!color.isValid())
return nil;
return nsColor(color);
diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h
index 4c1ee40..9b2248a 100644
--- a/WebKit/mac/WebView/WebFrameInternal.h
+++ b/WebKit/mac/WebView/WebFrameInternal.h
@@ -71,6 +71,7 @@ WebView *kit(WebCore::Page*);
WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior);
WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior);
+WebCore::EditingBehavior core(WebKitEditingBehavior);
WebView *getWebView(WebFrame *webFrame);
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 83d2e7b..5f9134f 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -4344,9 +4344,6 @@ static BOOL isInPasswordField(Frame* coreFrame)
// the current event prevents that from causing a problem inside WebKit or AppKit code.
[[event retain] autorelease];
- if ([self _handleStyleKeyEquivalent:event])
- return YES;
-
BOOL eventWasSentToWebCore = (_private->keyDownEvent == event);
BOOL ret = NO;
@@ -4364,7 +4361,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
ret = frame->eventHandler()->keyEvent(event);
if (!ret)
- ret = [super performKeyEquivalent:event];
+ ret = [self _handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event];
[self release];
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index f4ae333..ba4df8f 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -93,6 +93,7 @@
#define WebKitUsesProxiedOpenPanelPreferenceKey @"WebKitUsesProxiedOpenPanel"
#define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime"
#define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled"
+#define WebKitHTML5ParserEnabledPreferenceKey @"WebKitHTML5ParserEnabled"
// These are private both because callers should be using the cover methods and because the
// cover methods themselves are private.
@@ -104,6 +105,7 @@
#define WebKitEditableLinkBehaviorPreferenceKey @"WebKitEditableLinkBehavior"
#define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey"
#define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey"
+#define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior"
// CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
// to NO, or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are OFF by
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index 9de8495..ac98282 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -334,6 +334,7 @@ static WebCacheModel cacheModelForMainBundle(void)
@"0", WebKitPDFScaleFactorPreferenceKey,
@"0", WebKitUseSiteSpecificSpoofingPreferenceKey,
[NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
+ [NSNumber numberWithInt:WebKitEditingMacBehavior], WebKitEditingBehaviorPreferenceKey,
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
[NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
#else
@@ -1237,6 +1238,26 @@ static NSString *classIBCreatorID = nil;
[self _setBoolValue:flag forKey:WebKitFrameFlatteningEnabledPreferenceKey];
}
+- (BOOL)html5ParserEnabled
+{
+ return [self _boolValueForKey:WebKitHTML5ParserEnabledPreferenceKey];
+}
+
+- (void)setHTML5ParserEnabled:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitHTML5ParserEnabledPreferenceKey];
+}
+
+- (WebKitEditingBehavior)editingBehavior
+{
+ return static_cast<WebKitEditingBehavior>([self _integerValueForKey:WebKitEditingBehaviorPreferenceKey]);
+}
+
+- (void)setEditingBehavior:(WebKitEditingBehavior)behavior
+{
+ [self _setIntegerValue:behavior forKey:WebKitEditingBehaviorPreferenceKey];
+}
+
- (void)didRemoveFromWebView
{
ASSERT(_private->numWebViews);
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index ee785e9..0031860 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -43,6 +43,11 @@ typedef enum {
WebTextDirectionSubmenuAlwaysIncluded
} WebTextDirectionSubmenuInclusionBehavior;
+typedef enum {
+ WebKitEditingMacBehavior,
+ WebKitEditingWinBehavior
+} WebKitEditingBehavior;
+
extern NSString *WebPreferencesChangedNotification;
extern NSString *WebPreferencesRemovedNotification;
@@ -129,6 +134,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (WebKitEditableLinkBehavior)editableLinkBehavior;
- (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior;
+- (WebKitEditingBehavior)editingBehavior;
+- (void)setEditingBehavior:(WebKitEditingBehavior)behavior;
+
- (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior;
- (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior;
@@ -167,6 +175,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)webGLEnabled;
- (void)setWebGLEnabled:(BOOL)enabled;
+- (BOOL)html5ParserEnabled;
+- (void)setHTML5ParserEnabled:(BOOL)flag;
+
- (BOOL)usesProxiedOpenPanel;
- (void)setUsesProxiedOpenPanel:(BOOL)enabled;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 36313b4..0df62ea 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -662,7 +662,8 @@ static bool shouldEnableLoadDeferring()
#else
WebGeolocationControllerClient* geolocationControllerClient = 0;
#endif
- _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient);
+ DeviceOrientationClient* deviceOrientationClient = 0;
+ _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient, deviceOrientationClient);
_private->page->setCanStartMedia([self window]);
_private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
@@ -1368,6 +1369,7 @@ static bool fastDocumentTeardownEnabled()
settings->setTextAreasAreResizable([preferences textAreasAreResizable]);
settings->setShrinksStandaloneImagesToFit([preferences shrinksStandaloneImagesToFit]);
settings->setEditableLinkBehavior(core([preferences editableLinkBehavior]));
+ settings->setEditingBehavior(core([preferences editingBehavior]));
settings->setTextDirectionSubmenuInclusionBehavior(core([preferences textDirectionSubmenuInclusionBehavior]));
settings->setDOMPasteAllowed([preferences isDOMPasteAllowed]);
settings->setUsesPageCache([self usesPageCache]);
@@ -1405,6 +1407,7 @@ static bool fastDocumentTeardownEnabled()
settings->setWebGLEnabled([preferences webGLEnabled]);
settings->setLoadDeferringEnabled(shouldEnableLoadDeferring());
settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]);
+ settings->setHTML5ParserEnabled([preferences html5ParserEnabled]);
}
static inline IMP getMethod(id o, SEL s)
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index 904201e..178f5c2 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -60,8 +60,6 @@ public:
void syncLayers();
void updateResizesToContentsForPage();
- virtual QRectF graphicsItemVisibleRect() const;
-
void detachCurrentPage();
@@ -157,25 +155,6 @@ void QGraphicsWebViewPrivate::_q_scaleChanged()
#endif
}
-QRectF QGraphicsWebViewPrivate::graphicsItemVisibleRect() const
-{
- if (!q->scene())
- return QRectF();
- QList<QGraphicsView*> views = q->scene()->views();
- if (views.size() > 1) {
-#ifndef QT_NO_DEBUG_STREAM
- qDebug() << "QGraphicsWebView is in more than one graphics views, unable to compute the visible rect";
-#endif
- return QRectF();
- }
- if (views.size() < 1)
- return QRectF();
-
- int xPosition = views[0]->horizontalScrollBar()->value();
- int yPosition = views[0]->verticalScrollBar()->value();
- return q->mapRectFromScene(QRectF(QPoint(xPosition, yPosition), views[0]->viewport()->size()));
-}
-
/*!
\class QGraphicsWebView
\brief The QGraphicsWebView class allows Web content to be added to a GraphicsView.
diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp
index d852012..06e6cfa 100644
--- a/WebKit/qt/Api/qwebhistory.cpp
+++ b/WebKit/qt/Api/qwebhistory.cpp
@@ -540,6 +540,8 @@ QDataStream& operator>>(QDataStream& source, QWebHistory& history)
d->lst->addItem(item);
}
d->lst->removeItem(nullItem);
+ // Update the HistoryController.
+ history.d->lst->page()->mainFrame()->loader()->history()->setCurrentItem(history.d->lst->entries()[currentIndex].get());
history.goToItem(history.itemAt(currentIndex));
}
}
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 3810155..1ae8e35 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -272,7 +272,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
contextMenuClient = new ContextMenuClientQt();
editorClient = new EditorClientQt(q);
page = new Page(chromeClient, contextMenuClient, editorClient,
- new DragClientQt(q), new InspectorClientQt(q), 0, 0);
+ new DragClientQt(q), new InspectorClientQt(q), 0, 0, 0);
settings = new QWebSettings(page->settings());
@@ -1369,7 +1369,7 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
RefPtr<Range> range = editor->compositionRange();
return QVariant(renderTextControl->selectionEnd() - TextIterator::rangeLength(range.get()));
}
- return QVariant(renderTextControl->selectionEnd());
+ return QVariant(frame->selection()->extent().offsetInContainerNode());
}
return QVariant();
}
@@ -1401,7 +1401,7 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
RefPtr<Range> range = editor->compositionRange();
return QVariant(renderTextControl->selectionStart() - TextIterator::rangeLength(range.get()));
}
- return QVariant(renderTextControl->selectionStart());
+ return QVariant(frame->selection()->base().offsetInContainerNode());
}
return QVariant();
}
@@ -3180,12 +3180,37 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
#elif defined Q_WS_X11
"X11"
#elif defined Q_OS_SYMBIAN
- "SymbianOS"
+ "Symbian"
#else
"Unknown"
#endif
);
+#if defined Q_OS_SYMBIAN
+ QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
+ switch (symbianVersion) {
+ case QSysInfo::SV_9_2:
+ firstPartTemp += QString::fromLatin1("OS/9.2");
+ break;
+ case QSysInfo::SV_9_3:
+ firstPartTemp += QString::fromLatin1("OS/9.3");
+ break;
+ case QSysInfo::SV_9_4:
+ firstPartTemp += QString::fromLatin1("OS/9.4");
+ break;
+ case QSysInfo::SV_SF_2:
+ firstPartTemp += QString::fromLatin1("/2");
+ break;
+ case QSysInfo::SV_SF_3:
+ firstPartTemp += QString::fromLatin1("/3");
+ break;
+ case QSysInfo::SV_SF_4:
+ firstPartTemp += QString::fromLatin1("/4");
+ default:
+ break;
+ }
+#endif
+
firstPartTemp += QString::fromLatin1("; ");
// SSL support
@@ -3309,51 +3334,22 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
firstPartTemp += QString::fromLatin1("Sun Solaris");
#elif defined Q_OS_ULTRIX
firstPartTemp += QString::fromLatin1("DEC Ultrix");
-#elif defined Q_OS_SYMBIAN
- firstPartTemp += QString::fromLatin1("SymbianOS");
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
- switch (symbianVersion) {
- case QSysInfo::SV_9_2:
- firstPartTemp += QString::fromLatin1("/9.2");
- break;
- case QSysInfo::SV_9_3:
- firstPartTemp += QString::fromLatin1("/9.3");
- break;
- case QSysInfo::SV_9_4:
- firstPartTemp += QString::fromLatin1("/9.4");
- break;
- case QSysInfo::SV_SF_2:
- firstPartTemp += QString::fromLatin1("^2");
- break;
- case QSysInfo::SV_SF_3:
- firstPartTemp += QString::fromLatin1("^3");
- break;
- case QSysInfo::SV_SF_4:
- firstPartTemp += QString::fromLatin1("^4");
- break;
- default:
- firstPartTemp += QString::fromLatin1("/Unknown");
- }
-
-#if defined Q_WS_S60
+#elif defined Q_WS_S60
firstPartTemp += QLatin1Char(' ');
- firstPartTemp += QString::fromLatin1("Series60");
QSysInfo::S60Version s60Version = QSysInfo::s60Version();
switch (s60Version) {
case QSysInfo::SV_S60_3_1:
- firstPartTemp += QString::fromLatin1("/3.1");
+ firstPartTemp += QString::fromLatin1("Series60/3.1");
break;
case QSysInfo::SV_S60_3_2:
- firstPartTemp += QString::fromLatin1("/3.2");
+ firstPartTemp += QString::fromLatin1("Series60/3.2");
break;
case QSysInfo::SV_S60_5_0:
- firstPartTemp += QString::fromLatin1("/5.0");
+ firstPartTemp += QString::fromLatin1("Series60/5.0");
break;
default:
- firstPartTemp += QString::fromLatin1("/Unknown");
+ break;
}
-#endif
-
#elif defined Q_OS_UNIX
firstPartTemp += QString::fromLatin1("UNIX BSD/SYSV system");
#elif defined Q_OS_UNIXWARE
@@ -3383,8 +3379,8 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
QString thirdPartTemp;
thirdPartTemp.reserve(150);
-#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
- thirdPartTemp + QLatin1String(" Mobile Safari/");
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
+ thirdPartTemp += QLatin1String(" Mobile Safari/");
#else
thirdPartTemp += QLatin1String(" Safari/");
#endif
@@ -3402,7 +3398,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
languageName = d->client->ownerWidget()->locale().name();
else
languageName = QLocale().name();
- languageName[2] = QLatin1Char('-');
+ languageName.replace(QLatin1Char('_'), QLatin1Char('-'));
// Application name/version
QString appName = QCoreApplication::applicationName();
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index e5fabd8..bc1f45d 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,203 @@
+2010-05-23 Noam Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] GraphicsLayer: The rocket animation doesn't scroll together with the page
+ https://bugs.webkit.org/show_bug.cgi?id=39517
+
+ A previous fix to this issue was overridden by the PageClientQt refactor. Reapplying.
+
+ * WebCoreSupport/PageClientQt.cpp:
+ (WebCore::PageClientQGraphicsWidget::update):
+
+2010-05-23 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Update the Symbian version for the user agent
+ https://bugs.webkit.org/show_bug.cgi?id=38389
+
+ Fixes a regression introduced by r58648. Ensure that the "Symbian" string
+ is only listed one time in the User Agent string.
+
+ In addition make an effort to align the User Agent string to already
+ released WebKit based products for Symbian.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+
+2010-05-21 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Add DeviceOrientation and DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=39479
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+
+2010-05-21 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Symbian build fix.
+
+ [Qt] Updated the wins def file with one new export.
+
+ The DRT symbols are still missing, but I can't build DRT ;(
+
+ * symbian/bwins/QtWebKitu.def:
+
+2010-05-20 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] WINSCW compile fix for qwebframe test
+ https://bugs.webkit.org/show_bug.cgi?id=38722
+
+ WINSCW cannot determine template type up the hierarchy
+ to common base class.
+
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2010-05-20 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Remove unused "old style" private APIs
+
+ These symbols were introduced after QtWebKit v4.6
+ so no-one should be using them
+
+ * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+
+2010-05-20 Rajiv Ramanasankaran <rajiv.ramanasankaran@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] QWebPage::inputMethodQuery() returns wrong values for Qt::ImCursorPosition, Qt::ImAnchorPosition
+ https://bugs.webkit.org/show_bug.cgi?id=38779
+
+ The earlier implementation was written with the assumption that in this scenario the
+ anchor position always corresponds to the START index and that the current cursor position
+ always corresponds to the END index in WebKit.
+
+ Updated the implementation of QWebPage::inputMethodQuery(Qt::ImCursorPosition) and
+ QWebPage::inputMethodQuery(Qt::ImAnchorPosition) for the case where the Editor is not in
+ composition mode. In the non-composition mode, the Anchor and the Current cursor positions
+ correspond to the Base and Extent position offsets in WebKit.
+
+ Also added the auto-tests for the RIGHT to LEFT and LEFT to RIGHT selections.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::inputMethodQuery): Now returning correct values for Qt::ImCursorPosition and
+ Qt::ImAnchorPosition when the Editor is not in composition mode.
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::inputMethods): Added auto-tests for RIGHT to LEFT and LEFT to RIGHT selections
+
+2010-05-20 Luiz Agostini <luiz.agostini@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Skipping popup focus test for maemo
+ https://bugs.webkit.org/show_bug.cgi?id=39314
+
+ Skipping popup focus test for maemo in qwebframe auto test.
+
+ The test method tst_QWebFrame::popupFocus() was testing popup focus AND input
+ field focus. The input field focus has been removed from the method popupFocus()
+ and a new test method named inputFieldFocus() has been added. Finally the test
+ method popupFocus() has been skipped for maemo.
+
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2010-05-19 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Crash fix in the HistoryController.
+
+ The problem was casued by a documented feature of the QWebFrame::setHtml().
+ The method doesn't affect a browsing history (doesn't create a HistoryItem instance), so
+ m_currentItem and m_previousItem are not set.
+
+ A null check was added.
+
+ [Qt] The QWebPage crashes on history.pushState().
+ https://bugs.webkit.org/show_bug.cgi?id=38840
+
+ * tests/qwebhistory/tst_qwebhistory.cpp:
+ (tst_QWebHistory::popPushState_data):
+ (tst_QWebHistory::popPushState):
+
+2010-05-19 Antti Koivisto <koivisto@iki.fi>
+
+ Rubber-stamped by Kenneth Rohde Christiansen.
+
+ [Qt] TiledBackingStore updates broken when not using resizesToContents mode
+ https://bugs.webkit.org/show_bug.cgi?id=39359
+
+ Put the back logic that was lost in refactoring.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::visibleRectForTiledBackingStore):
+ * WebCoreSupport/PageClientQt.cpp:
+ (WebCore::PageClientQGraphicsWidget::graphicsItemVisibleRect):
+ * WebCoreSupport/PageClientQt.h:
+ (WebCore::PageClientQWidget::viewResizesToContentsEnabled):
+ (WebCore::PageClientQGraphicsWidget::viewResizesToContentsEnabled):
+
+2010-05-19 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Symbian build fix.
+
+ [Qt] Updated the def file with exports needed for DumpRenderTree.
+
+ * symbian/eabi/QtWebKitu.def:
+
+2010-05-19 Denis Dzyubenko <denis.dzyubenko@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ When creating the UA, do not sassmue the language code is a
+ two-letter iso639-1 code.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+
+2010-05-18 Antti Koivisto <koivisto@iki.fi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Move visible rect calculation from QGraphicsWebViewPrivate to PageClientQGraphicsWidget
+ https://bugs.webkit.org/show_bug.cgi?id=39294
+
+ * Api/qgraphicswebview.cpp:
+ * WebCoreSupport/PageClientQt.cpp:
+ (WebCore::PageClientQGraphicsWidget::graphicsItemVisibleRect):
+ * WebCoreSupport/PageClientQt.h:
+
+2010-05-18 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Symbian build fix.
+
+ [Qt] Updated the def file with new exports after r59335.
+
+ * symbian/eabi/QtWebKitu.def:
+
+2010-05-18 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix QWebHistory serialization.
+
+ Regression was caused by bug 33224. The streaming function
+ should generate a documentSequenceNumber for all loaded values.
+
+ [Qt] tst_QWebHistory::serialize_2() fails
+ https://bugs.webkit.org/show_bug.cgi?id=37322
+
+ * Api/qwebhistory.cpp:
+ (operator>>):
+
2010-05-17 Tasuku Suzuki <tasuku.suzuki@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 1c475b3..bcb07ee 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -571,8 +571,12 @@ bool ChromeClientQt::allowsAcceleratedCompositing() const
#if ENABLE(TILED_BACKING_STORE)
IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
{
- if (!platformPageClient())
+ if (!platformPageClient() || !m_webPage)
return IntRect();
+
+ if (!platformPageClient()->viewResizesToContentsEnabled())
+ return QRect(m_webPage->mainFrame()->scrollPosition(), m_webPage->mainFrame()->geometry().size());
+
return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect()));
}
#endif
diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index 6e59a20..9d335b8 100644
--- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -604,27 +604,6 @@ void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b)
DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b);
}
-void QWEBKIT_EXPORT qt_dump_resource_load_callbacks_path(const QString& path)
-{
- DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(path);
-}
-
-void QWEBKIT_EXPORT qt_set_will_send_request_returns_null_on_redirect(bool b)
-{
- DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(b);
-
-}
-
-void QWEBKIT_EXPORT qt_set_will_send_request_returns_null(bool b)
-{
- DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(b);
-}
-
-void QWEBKIT_EXPORT qt_set_will_send_request_clear_headers(const QStringList& headers)
-{
- DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(headers);
-}
-
void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b)
{
DumpRenderTreeSupportQt::dumpEditingCallbacks(b);
@@ -635,7 +614,3 @@ void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b);
}
-void QWEBKIT_EXPORT qt_dump_notification(bool b)
-{
- DumpRenderTreeSupportQt::dumpNotification(b);
-}
diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp
index e19f44f..4ccf34a 100644
--- a/WebKit/qt/WebCoreSupport/PageClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp
@@ -132,6 +132,8 @@ void PageClientQGraphicsWidget::update(const QRect& dirtyRect)
overlay->update(QRectF(dirtyRect));
#if USE(ACCELERATED_COMPOSITING)
syncLayers();
+ // This might be a slow-scroll. We ensure that the compositing layers are in the right position.
+ updateCompositingScrollPosition();
#endif
}
@@ -288,6 +290,23 @@ QRect PageClientQGraphicsWidget::geometryRelativeToOwnerWidget() const
return graphicsView->mapFromScene(view->boundingRect()).boundingRect();
}
+#if ENABLE(TILED_BACKING_STORE)
+QRectF PageClientQGraphicsWidget::graphicsItemVisibleRect() const
+{
+ if (!view->scene())
+ return QRectF();
+
+ QList<QGraphicsView*> views = view->scene()->views();
+ if (views.isEmpty())
+ return QRectF();
+
+ QGraphicsView* graphicsView = views.at(0);
+ int xOffset = graphicsView->horizontalScrollBar()->value();
+ int yOffset = graphicsView->verticalScrollBar()->value();
+ return view->mapRectFromScene(QRectF(QPointF(xOffset, yOffset), graphicsView->viewport()->size()));
+}
+#endif
+
QObject* PageClientQGraphicsWidget::pluginParent() const
{
return view;
diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h
index 9341b19..6dab4e1 100644
--- a/WebKit/qt/WebCoreSupport/PageClientQt.h
+++ b/WebKit/qt/WebCoreSupport/PageClientQt.h
@@ -76,6 +76,8 @@ public:
virtual QObject* pluginParent() const;
virtual QStyle* style() const;
+
+ virtual bool viewResizesToContentsEnabled() const { return false; }
QWidget* view;
};
@@ -161,10 +163,13 @@ public:
virtual QStyle* style() const;
+ virtual bool viewResizesToContentsEnabled() const { return viewResizesToContents; }
+
void createOrDeleteOverlay();
#if ENABLE(TILED_BACKING_STORE)
void updateTiledBackingStoreScale();
+ virtual QRectF graphicsItemVisibleRect() const;
#endif
#if USE(ACCELERATED_COMPOSITING)
diff --git a/WebKit/qt/symbian/bwins/QtWebKitu.def b/WebKit/qt/symbian/bwins/QtWebKitu.def
index 729b97c..0f4e4b2 100644
--- a/WebKit/qt/symbian/bwins/QtWebKitu.def
+++ b/WebKit/qt/symbian/bwins/QtWebKitu.def
@@ -649,4 +649,5 @@ EXPORTS
?setInspectorUrl@QWebSettings@@QAEXABVQUrl@@@Z @ 648 NONAME ABSENT ; void QWebSettings::setInspectorUrl(class QUrl const &)
?setResizesToContents@QGraphicsWebView@@QAEX_N@Z @ 649 NONAME ; void QGraphicsWebView::setResizesToContents(bool)
?setTiledBackingStoreFrozen@QGraphicsWebView@@QAEX_N@Z @ 650 NONAME ; void QGraphicsWebView::setTiledBackingStoreFrozen(bool)
+ ?qtwebkit_webframe_scrollOverflow@@YA_NPAVQWebFrame@@HHABVQPoint@@@Z @ 651 NONAME ; bool qtwebkit_webframe_scrollOverflow(QWebFrame *, int, int, const QPoint&)
diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def
index a9c2825..203261a 100644
--- a/WebKit/qt/symbian/eabi/QtWebKitu.def
+++ b/WebKit/qt/symbian/eabi/QtWebKitu.def
@@ -723,3 +723,50 @@ EXPORTS
_ZN23DumpRenderTreeSupportQt19webPageSetGroupNameEP8QWebPageRK7QString @ 722 NONAME
_ZN23DumpRenderTreeSupportQt16webPageGroupNameEP8QWebPage @ 723 NONAME
_ZN23DumpRenderTreeSupportQt23garbageCollectorCollectEv @ 724 NONAME
+ _Z32qtwebkit_webframe_scrollOverflowP9QWebFrameiiRK6QPoint @ 725 NONAME
+ _ZN23DumpRenderTreeSupportQt12setMediaTypeEP9QWebFrameRK7QString @ 726 NONAME
+ _ZN23DumpRenderTreeSupportQt13numberOfPagesEP9QWebFrameff @ 727 NONAME
+ _ZN23DumpRenderTreeSupportQt13selectedRangeEP8QWebPage @ 728 NONAME
+ _ZN23DumpRenderTreeSupportQt14clearFrameNameEP9QWebFrame @ 729 NONAME
+ _ZN23DumpRenderTreeSupportQt14pauseAnimationEP9QWebFrameRK7QStringdS4_ @ 730 NONAME
+ _ZN23DumpRenderTreeSupportQt15dumpFrameLoaderEb @ 731 NONAME
+ _ZN23DumpRenderTreeSupportQt16dumpNotificationEb @ 732 NONAME
+ _ZN23DumpRenderTreeSupportQt16isCommandEnabledEP8QWebPageRK7QString @ 733 NONAME
+ _ZN23DumpRenderTreeSupportQt16webInspectorShowEP8QWebPage @ 734 NONAME
+ _ZN23DumpRenderTreeSupportQt17pauseSVGAnimationEP9QWebFrameRK7QStringdS4_ @ 735 NONAME
+ _ZN23DumpRenderTreeSupportQt17webInspectorCloseEP8QWebPage @ 736 NONAME
+ _ZN23DumpRenderTreeSupportQt17workerThreadCountEv @ 737 NONAME
+ _ZN23DumpRenderTreeSupportQt18hasDocumentElementEP9QWebFrame @ 738 NONAME
+ _ZN23DumpRenderTreeSupportQt20dumpEditingCallbacksEb @ 739 NONAME
+ _ZN23DumpRenderTreeSupportQt21markerTextForListItemERK11QWebElement @ 740 NONAME
+ _ZN23DumpRenderTreeSupportQt22javaScriptObjectsCountEv @ 741 NONAME
+ _ZN23DumpRenderTreeSupportQt23setCaretBrowsingEnabledEP8QWebPageb @ 742 NONAME
+ _ZN23DumpRenderTreeSupportQt24executeCoreCommandByNameEP8QWebPageRK7QStringS4_ @ 743 NONAME
+ _ZN23DumpRenderTreeSupportQt21dumpSetAcceptsEditingEb @744 NONAME
+ _ZN23DumpRenderTreeSupportQt22resumeActiveDOMObjectsEP9QWebFrame @745 NONAME
+ _ZN23DumpRenderTreeSupportQt23suspendActiveDOMObjectsEP9QWebFrame @746 NONAME
+ _ZN23DumpRenderTreeSupportQt24numberOfActiveAnimationsEP9QWebFrame @747 NONAME
+ _ZN23DumpRenderTreeSupportQt24pageNumberForElementByIdEP9QWebFrameRK7QStringff @748 NONAME
+ _ZN23DumpRenderTreeSupportQt25dumpResourceLoadCallbacksEb @749 NONAME
+ _ZN23DumpRenderTreeSupportQt25pauseTransitionOfPropertyEP9QWebFrameRK7QStringdS4_ @750 NONAME
+ _ZN23DumpRenderTreeSupportQt25setFrameFlatteningEnabledEP8QWebPageb @751 NONAME
+ _ZN23DumpRenderTreeSupportQt25webInspectorExecuteScriptEP8QWebPagelRK7QString @752 NONAME
+ _ZN23DumpRenderTreeSupportQt25whiteListAccessFromOriginERK7QStringS2_S2_b @753 NONAME
+ _ZN23DumpRenderTreeSupportQt26counterValueForElementByIdEP9QWebFrameRK7QString @754 NONAME
+ _ZN23DumpRenderTreeSupportQt26firstRectForCharacterRangeEP8QWebPageii @755 NONAME
+ _ZN23DumpRenderTreeSupportQt26overwritePluginDirectoriesEv @756 NONAME
+ _ZN23DumpRenderTreeSupportQt27resetOriginAccessWhiteListsEv @757 NONAME
+ _ZN23DumpRenderTreeSupportQt27setSmartInsertDeleteEnabledEP8QWebPageb @758 NONAME
+ _ZN23DumpRenderTreeSupportQt27setTimelineProfilingEnabledEP8QWebPageb @759 NONAME
+ _ZN23DumpRenderTreeSupportQt28setDumpRenderTreeModeEnabledEb @760 NONAME
+ _ZN23DumpRenderTreeSupportQt29dumpResourceLoadCallbacksPathERK7QString @761 NONAME
+ _ZN23DumpRenderTreeSupportQt29evaluateScriptInIsolatedWorldEP9QWebFrameiRK7QString @762 NONAME
+ _ZN23DumpRenderTreeSupportQt29setJavaScriptProfilingEnabledEP9QWebFrameb @763 NONAME
+ _ZN23DumpRenderTreeSupportQt29setWillSendRequestReturnsNullEb @764 NONAME
+ _ZN23DumpRenderTreeSupportQt30setWillSendRequestClearHeadersERK11QStringList @765 NONAME
+ _ZN23DumpRenderTreeSupportQt33computedStyleIncludingVisitedInfoERK11QWebElement @766 NONAME
+ _ZN23DumpRenderTreeSupportQt34setSelectTrailingWhitespaceEnabledEP8QWebPageb @767 NONAME
+ _ZN23DumpRenderTreeSupportQt39elementDoesAutoCompleteForElementWithIdEP9QWebFrameRK7QString @768 NONAME
+ _ZN23DumpRenderTreeSupportQt39setWillSendRequestReturnsNullOnRedirectEb @769 NONAME
+ _ZN23DumpRenderTreeSupportQt40garbageCollectorCollectOnAlternateThreadEb @770 NONAME
+ _ZN23DumpRenderTreeSupportQt40setDomainRelaxationForbiddenForURLSchemeEbRK7QString @771 NONAME
diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index bea7a67..76fdba3 100644
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -600,7 +600,12 @@ private slots:
void setHtmlWithBaseURL();
void ipv6HostEncoding();
void metaData();
+#if !defined(Q_WS_MAEMO_5)
+ // as maemo 5 does not use QComboBoxes to implement the popups
+ // this test does not make sense for it.
void popupFocus();
+#endif
+ void inputFieldFocus();
void hitTestContent();
void jsByteArray();
void ownership();
@@ -686,13 +691,13 @@ private:
QWebView* m_view;
QWebPage* m_page;
MyQObject* m_myObject;
- QWebView* m_popupTestView;
- int m_popupTestPaintCount;
+ QWebView* m_inputFieldsTestView;
+ int m_inputFieldTestPaintCount;
};
tst_QWebFrame::tst_QWebFrame()
: sTrue("true"), sFalse("false"), sUndefined("undefined"), sArray("array"), sFunction("function"), sError("error"),
- sString("string"), sObject("object"), sNumber("number"), m_popupTestView(0), m_popupTestPaintCount(0)
+ sString("string"), sObject("object"), sNumber("number"), m_inputFieldsTestView(0), m_inputFieldTestPaintCount(0)
{
}
@@ -702,10 +707,10 @@ tst_QWebFrame::~tst_QWebFrame()
bool tst_QWebFrame::eventFilter(QObject* watched, QEvent* event)
{
- // used on the popupFocus test
- if (watched == m_popupTestView) {
+ // used on the inputFieldFocus test
+ if (watched == m_inputFieldsTestView) {
if (event->type() == QEvent::Paint)
- m_popupTestPaintCount++;
+ m_inputFieldTestPaintCount++;
}
return QObject::eventFilter(watched, event);
}
@@ -780,7 +785,7 @@ void tst_QWebFrame::getSetStaticProperty()
QCOMPARE(vm.size(), 3);
QCOMPARE(vm.value("a").toInt(), 123);
QCOMPARE(vm.value("b").toString(), QLatin1String("foo"));
- QCOMPARE(vm.value("c").value<QObject*>(), m_myObject);
+ QCOMPARE(vm.value("c").value<QObject*>(), static_cast<QObject*>(m_myObject));
}
QCOMPARE(evalJS("myObject.variantMapProperty.a === 123"), sTrue);
QCOMPARE(evalJS("myObject.variantMapProperty.b === 'foo'"), sTrue);
@@ -2549,6 +2554,7 @@ void tst_QWebFrame::metaData()
QCOMPARE(metaData.value("nonexistant"), QString());
}
+#if !defined(Q_WS_MAEMO_5)
void tst_QWebFrame::popupFocus()
{
QWebView view;
@@ -2580,16 +2586,27 @@ void tst_QWebFrame::popupFocus()
// hide the popup and check if focus is on the page
combo->hidePopup();
QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView
+}
+#endif
+
+void tst_QWebFrame::inputFieldFocus()
+{
+ QWebView view;
+ view.setHtml("<html><body><input type=\"text\"></input></body></html>");
+ view.resize(400, 100);
+ view.show();
+ view.setFocus();
+ QTRY_VERIFY(view.hasFocus());
// double the flashing time, should at least blink once already
int delay = qApp->cursorFlashTime() * 2;
// focus the lineedit and check if it blinks
- QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(200, 25));
- m_popupTestView = &view;
+ QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25));
+ m_inputFieldsTestView = &view;
view.installEventFilter( this );
QTest::qWait(delay);
- QVERIFY2(m_popupTestPaintCount >= 3,
+ QVERIFY2(m_inputFieldTestPaintCount >= 3,
"The input field should have a blinking caret");
}
diff --git a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
index e967dcc..49a606b 100644
--- a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
+++ b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
@@ -59,6 +59,8 @@ private slots:
void saveAndRestore_crash_1();
void saveAndRestore_crash_2();
void saveAndRestore_crash_3();
+ void popPushState_data();
+ void popPushState();
void clear();
@@ -349,6 +351,25 @@ void tst_QWebHistory::saveAndRestore_crash_3()
delete page2;
}
+void tst_QWebHistory::popPushState_data()
+{
+ QTest::addColumn<QString>("script");
+ QTest::newRow("pushState") << "history.pushState(123, \"foo\");";
+ QTest::newRow("replaceState") << "history.replaceState(\"a\", \"b\");";
+ QTest::newRow("back") << "history.back();";
+ QTest::newRow("forward") << "history.forward();";
+ QTest::newRow("clearState") << "history.clearState();";
+}
+
+/** Crash test, WebKit bug 38840 (https://bugs.webkit.org/show_bug.cgi?id=38840) */
+void tst_QWebHistory::popPushState()
+{
+ QFETCH(QString, script);
+ QWebPage page;
+ page.mainFrame()->setHtml("<html><body>long live Qt!</body></html>");
+ page.mainFrame()->evaluateJavaScript(script);
+}
+
/** ::clear */
void tst_QWebHistory::clear()
{
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index bbbfe09..ceb8aff 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1494,6 +1494,98 @@ void tst_QWebPage::inputMethods()
QCOMPARE(value, QString("QtWebKit"));
#endif
+ // Cancel current composition first
+ inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
+ QInputMethodEvent eventSelection4("", inputAttributes);
+ page->event(&eventSelection4);
+
+ // START - Tests for Selection when the Editor is NOT in Composition mode
+
+ // LEFT to RIGHT selection
+ // Deselect the selection by sending MouseButtonPress events
+ // This moves the current cursor to the end of the text
+ page->event(&evpres);
+ page->event(&evrel);
+
+ //Move to the start of the line
+ page->triggerAction(QWebPage::MoveToStartOfLine);
+
+ QKeyEvent keyRightEventPress(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier);
+ QKeyEvent keyRightEventRelease(QEvent::KeyRelease, Qt::Key_Right, Qt::NoModifier);
+
+ //Move 2 characters RIGHT
+ for (int j = 0; j < 2; ++j) {
+ page->event(&keyRightEventPress);
+ page->event(&keyRightEventRelease);
+ }
+
+ //Select to the end of the line
+ page->triggerAction(QWebPage::SelectEndOfLine);
+
+ //ImAnchorPosition QtWebKit
+ variant = page->inputMethodQuery(Qt::ImAnchorPosition);
+ anchorPosition = variant.toInt();
+ QCOMPARE(anchorPosition, 2);
+
+ //ImCursorPosition
+ variant = page->inputMethodQuery(Qt::ImCursorPosition);
+ cursorPosition = variant.toInt();
+ QCOMPARE(cursorPosition, 8);
+
+ //ImCurrentSelection
+ variant = page->inputMethodQuery(Qt::ImCurrentSelection);
+ selectionValue = variant.value<QString>();
+ QCOMPARE(selectionValue, QString("WebKit"));
+
+ //RIGHT to LEFT selection
+ //Deselect the selection (this moves the current cursor to the end of the text)
+ page->event(&evpres);
+ page->event(&evrel);
+
+ //ImAnchorPosition
+ variant = page->inputMethodQuery(Qt::ImAnchorPosition);
+ anchorPosition = variant.toInt();
+ QCOMPARE(anchorPosition, 8);
+
+ //ImCursorPosition
+ variant = page->inputMethodQuery(Qt::ImCursorPosition);
+ cursorPosition = variant.toInt();
+ QCOMPARE(cursorPosition, 8);
+
+ //ImCurrentSelection
+ variant = page->inputMethodQuery(Qt::ImCurrentSelection);
+ selectionValue = variant.value<QString>();
+ QCOMPARE(selectionValue, QString(""));
+
+ QKeyEvent keyLeftEventPress(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier);
+ QKeyEvent keyLeftEventRelease(QEvent::KeyRelease, Qt::Key_Left, Qt::NoModifier);
+
+ //Move 2 characters LEFT
+ for (int i = 0; i < 2; ++i) {
+ page->event(&keyLeftEventPress);
+ page->event(&keyLeftEventRelease);
+ }
+
+ //Select to the start of the line
+ page->triggerAction(QWebPage::SelectStartOfLine);
+
+ //ImAnchorPosition
+ variant = page->inputMethodQuery(Qt::ImAnchorPosition);
+ anchorPosition = variant.toInt();
+ QCOMPARE(anchorPosition, 6);
+
+ //ImCursorPosition
+ variant = page->inputMethodQuery(Qt::ImCursorPosition);
+ cursorPosition = variant.toInt();
+ QCOMPARE(cursorPosition, 0);
+
+ //ImCurrentSelection
+ variant = page->inputMethodQuery(Qt::ImCurrentSelection);
+ selectionValue = variant.value<QString>();
+ QCOMPARE(selectionValue, QString("QtWebK"));
+
+ //END - Tests for Selection when the Editor is not in Composition mode
+
//ImhHiddenText
QMouseEvent evpresPassword(QEvent::MouseButtonPress, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
page->event(&evpresPassword);
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index a67e10f..69d7ea9 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,139 @@
+2010-05-21 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Add DeviceOrientation and DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=39479
+
+ * WebView.cpp:
+ (WebView::initWithFrame):
+
+2010-05-20 Simon Fraser <simon.fraser@apple.com>
+
+ Build fix, no review.
+
+ Fix the non-accelerated-compositing Windows build with some
+ #if USE(ACCELERATED_COMPOSITING) loving.
+
+ * WebView.cpp:
+ * WebView.h:
+
+2010-05-20 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Avoid flushing CA layers when a layout is pending
+ https://bugs.webkit.org/show_bug.cgi?id=39463
+
+ <rdar://problem/7999463>
+
+ Avoid rendering the compositing layers to the screen if there's a layout pending,
+ since the layer tree not in a state that should be presented to the user.
+
+ This fixes flashes in some types of content that dynamically add and remove layers.
+
+ Have the WebView implement WKCACFLayerRendererClient so that the
+ WKCACFLayerRenderer can ask whether it's a good time to render. If the FrameView
+ has a layout pending, say no.
+
+ * WebView.h:
+ * WebView.cpp:
+ (WebView::setAcceleratedCompositing):
+ (WebView::shouldRender):
+
+2010-05-18 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ [WinCairo] Correct scaling for print preview
+ https://bugs.webkit.org/show_bug.cgi?id=39329
+
+ Cairo does not properly deal with Windows HDCs that have been
+ scaled using MM_ANISOTROPIC mapping mode, and a WindowExt and
+ ViewportExt setting.
+ (see http://bugs.freedesktop.org/show_bug.cgi?id=28161)
+
+ Instead, reset the HDC's WorldTransform to be unscaled, then
+ scale the cairo context to the desired scaling, and perform
+ the drawing operation.
+
+ * WebFrame.cpp:
+ (WebFrame::drawHeader): Use pre-positioned context to simplify
+ this method.
+ (WebFrame::drawFooter): Use pre-positioned context to simplify
+ this method.
+ (WebFrame::spoolPage): Revise scaling logic to turn off HDC
+ scaling, and scale using only Cairo. Revert scaling at end
+ so that user-defined GDI-based routines (e.g., header/footer)
+ will draw in the right position.
+ (WebFrame::spoolPages): Identify print preview case, and
+ retrieve scaling factors from preview context. Set the
+ Cairo context to use these factors during the spoolPage
+ operation.
+
+2010-05-20 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed.
+
+ Touch WebKit.idl to ensure that interfaces rebuild.
+
+ * Interfaces/WebKit.idl: Touched.
+
+2010-05-20 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Adam Roben.
+
+ Fix the Windows build and move new IDL declarations to the bottom of the file.
+
+ * Interfaces/IWebPreferences.idl: Move new API to the bottom of the IDL file to prevent vtable mismatch.
+ * WebPreferences.cpp:
+ (WebPreferences::setEditingBehavior): Change the type of the parameter to setEditingBehavior to the proper type.
+
+2010-05-20 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed.
+
+ Fix the Windows build.
+
+ * WebView.cpp:
+ (WebView::notifyPreferencesChanged): Change behavior to 'editingBehavior'.
+
+2010-05-20 Martin Robinson <mrobinson@webkit.org>
+
+ Reviewed by Ojan Vafai.
+
+ Expose the editing behavior setting in DRT to test all editing code paths
+ https://bugs.webkit.org/show_bug.cgi?id=38603
+
+ Expose the EditingBehavior setting in the Windows API.
+
+ * Interfaces/IWebPreferences.idl: Add the API point for setting the editing behavior.
+ * WebPreferenceKeysPrivate.h: Add a key for the editing behavior setting.
+ * WebPreferences.cpp:
+ (WebPreferences::editingBehavior): Added.
+ (WebPreferences::setEditingBehavior): Added.
+ * WebPreferences.h: Add method declarations.
+ * WebView.cpp:
+ (WebView::notifyPreferencesChanged): Update the WebCore setting based on the WebPreferences setting.
+
+2010-05-20 Chris Jerdonek <cjerdonek@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Modified FrameLoader::urlSelected() to accept a KURL instead of a
+ ResourceRequest.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39320
+
+ Since ResourceRequest has non-explicit single-parameter constructors for
+ String and KURL, urlSelected() previously accepted any of String, KURL,
+ and ResourceRequest. This revision changes urlSelected() to accept only
+ a KURL to make the API tighter and easier to refactor.
+
+ * WebCoreSupport/WebContextMenuClient.cpp:
+ (WebContextMenuClient::searchWithGoogle):
+ - Updated the call to urlSelected().
+
2010-05-13 Brian Weinstein <bweinstein@apple.com>
Reviewed by Tim Hatcher.
diff --git a/WebKit/win/Interfaces/IWebPreferences.idl b/WebKit/win/Interfaces/IWebPreferences.idl
index 1c43135..4fb3de8 100644
--- a/WebKit/win/Interfaces/IWebPreferences.idl
+++ b/WebKit/win/Interfaces/IWebPreferences.idl
@@ -47,6 +47,12 @@ typedef enum WebKitEditableLinkBehavior {
WebKitEditableLinkNeverLive
} WebKitEditableLinkBehavior;
+typedef enum WebKitEditingBehavior {
+ WebKitEditingMacBehavior = 0,
+ WebKitEditingWinBehavior
+} WebKitEditingBehavior;
+
+
typedef enum WebKitCookieStorageAcceptPolicy {
WebKitCookieStorageAcceptPolicyAlways = 0,
WebKitCookieStorageAcceptPolicyNever,
@@ -189,4 +195,7 @@ interface IWebPreferences : IUnknown
HRESULT setAcceleratedCompositingEnabled(BOOL acceleratedCompositingEnabled);
HRESULT acceleratedCompositingEnabled(BOOL *acceleratedCompositingEnabled);
+
+ HRESULT editingBehavior([out, retval] WebKitEditingBehavior* editingBehavior);
+ HRESULT setEditingBehavior([in] WebKitEditingBehavior behavior);
}
diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
index 241c35d..078b725 100644
--- a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
@@ -140,9 +140,8 @@ void WebContextMenuClient::searchWithGoogle(const Frame* frame)
url.append(encoded);
url.append("&ie=UTF-8&oe=UTF-8");
- ResourceRequest request = ResourceRequest(url);
if (Page* page = frame->page())
- page->mainFrame()->loader()->urlSelected(request, String(), 0, false, false, true, SendReferrer);
+ page->mainFrame()->loader()->urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, true, SendReferrer);
}
void WebContextMenuClient::lookUpInDictionary(Frame*)
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index 0e8ee80..319fbbc 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -2150,12 +2150,10 @@ static HDC hdcFromContext(PlatformGraphicsContext* pctx)
void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, float headerHeight)
{
HDC hdc = hdcFromContext(pctx);
- const IntRect& marginRect = printerMarginRect(hdc);
- const float scale = scaleFactor(hdc, marginRect, pageRect);
- int x = static_cast<int>(scale * pageRect.x());
+ int x = pageRect.x();
int y = 0;
- RECT headerRect = {x, y, x + static_cast<int>(scale * pageRect.width()), y + static_cast<int>(scale * headerHeight)};
+ RECT headerRect = {x, y, x + pageRect.width(), y + static_cast<int>(headerHeight)};
ui->drawHeaderInRect(d->webView, &headerRect, static_cast<OLE_HANDLE>(reinterpret_cast<LONG64>(hdc)));
}
@@ -2163,16 +2161,29 @@ void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, con
void WebFrame::drawFooter(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, UINT page, UINT pageCount, float headerHeight, float footerHeight)
{
HDC hdc = hdcFromContext(pctx);
- const IntRect& marginRect = printerMarginRect(hdc);
-
- const float scale = scaleFactor(hdc, marginRect, pageRect);
- int x = static_cast<int>(scale * pageRect.x());
- int y = static_cast<int>(scale * max(static_cast<int>(headerHeight) + pageRect.height(), m_pageHeight-static_cast<int>(footerHeight)));
- RECT footerRect = {x, y, x + static_cast<int>(scale * pageRect.width()), y + static_cast<int>(scale * footerHeight)};
+
+ int x = pageRect.x();
+ int y = max(static_cast<int>(headerHeight) + pageRect.height(), m_pageHeight -static_cast<int>(footerHeight));
+ RECT footerRect = {x, y, x + pageRect.width(), y + static_cast<int>(footerHeight)};
ui->drawFooterInRect(d->webView, &footerRect, static_cast<OLE_HANDLE>(reinterpret_cast<LONG64>(hdc)), page+1, pageCount);
}
+static XFORM buildXFORMFromCairo(HDC targetDC, cairo_t* previewContext)
+{
+ XFORM scaled;
+ GetWorldTransform(targetDC, &scaled);
+
+ cairo_matrix_t ctm;
+ cairo_get_matrix(previewContext, &ctm);
+
+ // Scale to the preview screen bounds
+ scaled.eM11 = ctm.xx;
+ scaled.eM22 = ctm.yy;
+
+ return scaled;
+}
+
void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCtx, HDC printDC, IWebUIDelegate* ui, float headerHeight, float footerHeight, UINT page, UINT pageCount)
{
Frame* coreFrame = core(this);
@@ -2180,48 +2191,83 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt
const IntRect& pageRect = m_pageRects[page];
const IntRect& marginRect = printerMarginRect(printDC);
- cairo_save(pctx);
+ // In preview, the printDC is a placeholder, so just always use the HDC backing the graphics context.
+ HDC hdc = hdcFromContext(pctx);
+
spoolCtx->save();
- float scale = scaleFactor(printDC, marginRect, pageRect);
- cairo_scale(pctx, scale, scale);
+
+ XFORM original, scaled;
+ GetWorldTransform(hdc, &original);
+
+ bool preview = (hdc != printDC);
+ if (preview) {
+ // If this is a preview, the Windows HDC was set to a non-scaled state so that Cairo will
+ // draw correctly. We need to retain the correct preview scale here for use when the Cairo
+ // drawing completes so that we can scale our GDI-based header/footer calls. This is a
+ // workaround for a bug in Cairo (see https://bugs.freedesktop.org/show_bug.cgi?id=28161)
+ scaled = buildXFORMFromCairo(hdc, pctx);
+ }
- IntRect cairoMarginRect (marginRect);
- cairoMarginRect.scale (1 / scale);
+ float scale = scaleFactor(printDC, marginRect, pageRect);
+
+ IntRect cairoMarginRect(marginRect);
+ cairoMarginRect.scale(1 / scale);
- // Modify Cairo and GDI World Transform to account for margin in the
- // subsequent WebKit-controlled 'paintContents' drawing operations:
- spoolCtx->translate(cairoMarginRect.x(), cairoMarginRect.y() + headerHeight);
+ // We cannot scale the display HDC because the print surface also scales fonts,
+ // resulting in invalid printing (and print preview)
+ cairo_scale(pctx, scale, scale);
+ cairo_translate(pctx, cairoMarginRect.x(), cairoMarginRect.y() + headerHeight);
// Modify Cairo (only) to account for page position.
cairo_translate(pctx, -pageRect.x(), -pageRect.y());
coreFrame->view()->paintContents(spoolCtx, pageRect);
-
cairo_translate(pctx, pageRect.x(), pageRect.y());
-
- XFORM originalWorld;
- ::GetWorldTransform(printDC, &originalWorld);
-
- // Position GDI world transform to account for margin in GDI-only
- // header/footer calls
- XFORM newWorld = originalWorld;
- newWorld.eDx = marginRect.x();
- newWorld.eDy = marginRect.y();
-
- ::SetWorldTransform(printDC, &newWorld);
-
+
+ if (preview) {
+ // If this is a preview, the Windows HDC was set to a non-scaled state so that Cairo would
+ // draw correctly. We need to rescale the HDC to the correct preview scale so our GDI-based
+ // header/footer calls will draw properly. This is a workaround for a bug in Cairo.
+ // (see https://bugs.freedesktop.org/show_bug.cgi?id=28161)
+ SetWorldTransform(hdc, &scaled);
+ }
+
+ XFORM xform = TransformationMatrix().translate(marginRect.x(), marginRect.y()).scale(scale);
+ ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY);
+
if (headerHeight)
drawHeader(pctx, ui, pageRect, headerHeight);
if (footerHeight)
drawFooter(pctx, ui, pageRect, page, pageCount, headerHeight, footerHeight);
- ::SetWorldTransform(printDC, &originalWorld);
+ SetWorldTransform(hdc, &original);
cairo_show_page(pctx);
ASSERT(!cairo_status(pctx));
spoolCtx->restore();
- cairo_restore(pctx);
}
+
+static void setCairoTransformToPreviewHDC(cairo_t* previewCtx, HDC previewDC)
+{
+ XFORM passedCTM;
+ GetWorldTransform(previewDC, &passedCTM);
+
+ // Reset HDC WorldTransform to unscaled state. Scaling must be
+ // done in Cairo to avoid drawing errors.
+ XFORM unscaledCTM = passedCTM;
+ unscaledCTM.eM11 = 1.0;
+ unscaledCTM.eM22 = 1.0;
+
+ SetWorldTransform(previewDC, &unscaledCTM);
+
+ // Make the Cairo transform match the information passed to WebKit
+ // in the HDC's WorldTransform.
+ cairo_matrix_t ctm = { passedCTM.eM11, passedCTM.eM12, passedCTM.eM21,
+ passedCTM.eM22, passedCTM.eDx, passedCTM.eDy };
+
+ cairo_set_matrix(previewCtx, &ctm);
+}
+
#endif
HRESULT STDMETHODCALLTYPE WebFrame::spoolPages(
@@ -2240,13 +2286,28 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages(
ASSERT_NOT_REACHED();
return E_POINTER;
}
+
+ HDC targetDC = (ctx) ? (HDC)ctx : printDC;
- cairo_surface_t* printSurface = cairo_win32_printing_surface_create(printDC);
- ctx = cairo_create(printSurface);
- if (!ctx) {
+ cairo_surface_t* printSurface = 0;
+ if (ctx)
+ printSurface = cairo_win32_surface_create(targetDC); // in-memory
+ else
+ printSurface = cairo_win32_printing_surface_create(targetDC); // metafile
+
+ PlatformGraphicsContext* pctx = (PlatformGraphicsContext*)cairo_create(printSurface);
+ if (!pctx) {
cairo_surface_destroy(printSurface);
return E_FAIL;
}
+
+ if (ctx) {
+ // If this is a preview, the Windows HDC was sent with scaling information.
+ // Retrieve it and reset it so that it draws properly. This is a workaround
+ // for a bug in Cairo (see https://bugs.freedesktop.org/show_bug.cgi?id=28161)
+ setCairoTransformToPreviewHDC(pctx, targetDC);
+ }
+
cairo_surface_set_fallback_resolution(printSurface, 72.0, 72.0);
#endif
@@ -2260,7 +2321,9 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages(
return E_FAIL;
UINT pageCount = (UINT) m_pageRects.size();
+#if PLATFORM(CG)
PlatformGraphicsContext* pctx = (PlatformGraphicsContext*)ctx;
+#endif
if (!pageCount || startPage > pageCount) {
ASSERT_NOT_REACHED();
diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h
index c49a96d..da63754 100644
--- a/WebKit/win/WebPreferenceKeysPrivate.h
+++ b/WebKit/win/WebPreferenceKeysPrivate.h
@@ -74,6 +74,7 @@
#define WebKitPDFDisplayModePreferenceKey "WebKitPDFDisplayMode"
#define WebKitPDFScaleFactorPreferenceKey "WebKitPDFScaleFactor"
#define WebKitEditableLinkBehaviorPreferenceKey "WebKitEditableLinkBehavior"
+#define WebKitEditingBehaviorPreferenceKey "WebKitEditingBehavior"
// Window display is throttled to 60 frames per second if WebKitThrottleWindowDisplayPreferenceKey
// is set to YES. The window display throttle is OFF by default for compatibility with Mac OS X
diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp
index 33e904d..e49bd20 100644
--- a/WebKit/win/WebPreferences.cpp
+++ b/WebKit/win/WebPreferences.cpp
@@ -1130,6 +1130,21 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setEditableLinkBehavior(
return S_OK;
}
+HRESULT STDMETHODCALLTYPE WebPreferences::editingBehavior(
+ /* [out, retval] */ WebKitEditingBehavior* editingBehavior)
+{
+ *editingBehavior = (WebKitEditingBehavior) integerValueForKey(CFSTR(WebKitEditingBehaviorPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setEditingBehavior(
+ /* [in] */ WebKitEditingBehavior behavior)
+{
+ setIntegerValue(CFSTR(WebKitEditingBehaviorPreferenceKey), behavior);
+ return S_OK;
+}
+
+
HRESULT STDMETHODCALLTYPE WebPreferences::cookieStorageAcceptPolicy(
/* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy )
{
diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h
index cfdefa8..1ea69c7 100644
--- a/WebKit/win/WebPreferences.h
+++ b/WebKit/win/WebPreferences.h
@@ -238,6 +238,12 @@ public:
virtual HRESULT STDMETHODCALLTYPE setEditableLinkBehavior(
/* [in] */ WebKitEditableLinkBehavior behavior);
+ virtual HRESULT STDMETHODCALLTYPE editingBehavior(
+ /* [retval][out] */ WebKitEditingBehavior* behavior);
+
+ virtual HRESULT STDMETHODCALLTYPE setEditingBehavior(
+ /* [in] */ WebKitEditingBehavior behavior);
+
virtual HRESULT STDMETHODCALLTYPE cookieStorageAcceptPolicy(
/* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy);
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 1fbd8d3..20f0f06 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -2561,12 +2561,13 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
#else
WebGeolocationControllerClient* geolocationControllerClient = 0;
#endif
+ DeviceOrientationClient* deviceOrientationClient = 0;
BOOL useHighResolutionTimer;
if (SUCCEEDED(m_preferences->shouldUseHighResolutionTimers(&useHighResolutionTimer)))
Settings::setShouldUseHighResolutionTimers(useHighResolutionTimer);
- m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), geolocationControllerClient);
+ m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), geolocationControllerClient, deviceOrientationClient);
BSTR localStoragePath;
if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) {
@@ -4593,6 +4594,12 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
settings->setEditableLinkBehavior((EditableLinkBehavior)behavior);
+ WebKitEditingBehavior editingBehavior;
+ hr = preferences->editingBehavior(&editingBehavior);
+ if (FAILED(hr))
+ return hr;
+ settings->setEditingBehavior((EditingBehavior)editingBehavior);
+
hr = preferences->usesPageCache(&enabled);
if (FAILED(hr))
return hr;
@@ -6155,7 +6162,7 @@ void WebView::setAcceleratedCompositing(bool accelerated)
return;
if (accelerated) {
- m_layerRenderer = WKCACFLayerRenderer::create();
+ m_layerRenderer = WKCACFLayerRenderer::create(this);
if (m_layerRenderer) {
m_isAcceleratedCompositing = true;
@@ -6371,6 +6378,20 @@ HRESULT WebView::nextDisplayIsSynchronous()
return S_OK;
}
+#if USE(ACCELERATED_COMPOSITING)
+bool WebView::shouldRender() const
+{
+ Frame* coreFrame = core(m_mainFrame);
+ if (!coreFrame)
+ return true;
+ FrameView* frameView = coreFrame->view();
+ if (!frameView)
+ return true;
+
+ return !frameView->layoutPending();
+}
+#endif
+
class EnumTextMatches : public IEnumTextMatches
{
long m_ref;
diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h
index 29f8705..752c16d 100644
--- a/WebKit/win/WebView.h
+++ b/WebKit/win/WebView.h
@@ -66,6 +66,9 @@ class WebView
, public IWebNotificationObserver
, public IDropTarget
, WebCore::WindowMessageListener
+#if USE(ACCELERATED_COMPOSITING)
+ , WebCore::WKCACFLayerRendererClient
+#endif
{
public:
static WebView* createInstance();
@@ -921,6 +924,11 @@ private:
// (see https://bugs.webkit.org/show_bug.cgi?id=29264)
DWORD m_lastDropEffect;
+#if USE(ACCELERATED_COMPOSITING)
+ // WKCACFLayerRendererClient
+ virtual bool shouldRender() const;
+#endif
+
protected:
static bool registerWebViewWindowClass();
static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog
index ce443c0..83297ec 100644
--- a/WebKitLibraries/ChangeLog
+++ b/WebKitLibraries/ChangeLog
@@ -1,3 +1,15 @@
+2010-05-20 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Provide bindings for DeviceOrientation
+ https://bugs.webkit.org/show_bug.cgi?id=39210
+
+ Adds ENABLE_DEVICE_ORIENTATION to VisualStudio project files, always disabled.
+
+ * win/tools/vsprops/FeatureDefines.vsprops:
+ * win/tools/vsprops/FeatureDefinesCairo.vsprops:
+
2010-04-09 Alexey Proskuryakov <ap@apple.com>
Reviewed by Maciej Stachowiak.
diff --git a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
index 2184f46..02ee348 100644
--- a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
+++ b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
@@ -9,7 +9,7 @@
>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_RUBY);$(ENABLE_SANDBOX);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
+ PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_RUBY);$(ENABLE_SANDBOX);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
/>
<UserMacro
Name="ENABLE_3D_CANVAS"
@@ -52,6 +52,11 @@
PerformEnvironmentSet="true"
/>
<UserMacro
+ Name="ENABLE_DEVICE_ORIENTATION"
+ Value=""
+ PerformEnvironmentSet="true"
+ />
+ <UserMacro
Name="ENABLE_DOM_STORAGE"
Value="ENABLE_DOM_STORAGE"
PerformEnvironmentSet="true"
diff --git a/WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops b/WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops
index 14644d4..cf97a9f 100644
--- a/WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops
+++ b/WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops
@@ -9,7 +9,7 @@
>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
+ PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
/>
<UserMacro
Name="ENABLE_3D_CANVAS"
@@ -52,6 +52,11 @@
PerformEnvironmentSet="true"
/>
<UserMacro
+ Name="ENABLE_DEVICE_ORIENTATION"
+ Value=""
+ PerformEnvironmentSet="true"
+ />
+ <UserMacro
Name="ENABLE_DOM_STORAGE"
Value="ENABLE_DOM_STORAGE"
PerformEnvironmentSet="true"
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 3596d14..f48e031 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,668 @@
+2010-05-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Chris Jerdonek.
+
+ webkit-patch needs --verbose flag to enable DEBUG logging
+ https://bugs.webkit.org/show_bug.cgi?id=39208
+
+ I also added some code to print out how long commands take to run.
+
+ * Scripts/webkit-patch:
+ - Add hackish -v/--verbose parsing (similar to check-webkit-style)
+ * Scripts/webkitpy/common/system/executive.py:
+ - Log how long commands take to run.
+ * Scripts/webkitpy/tool/main.py:
+ - Add -v/--verbose option to global options.
+
+2010-05-23 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Daniel Bates.
+
+ Split PatchReader out into its own file
+ https://bugs.webkit.org/show_bug.cgi?id=39576
+
+ This is in preparation for making check-webkit-style
+ support being passed paths to patch files on the command line.
+
+ * Scripts/check-webkit-style:
+ * Scripts/webkitpy/style/checker.py:
+ * Scripts/webkitpy/style/checker_unittest.py:
+ * Scripts/webkitpy/style/patchreader.py: Added.
+ * Scripts/webkitpy/style/patchreader_unittest.py: Added.
+ * Scripts/webkitpy/style_references.py:
+
+2010-05-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Daniel Bates.
+
+ webkit-patch should let you add a comment when uploading a patch
+ https://bugs.webkit.org/show_bug.cgi?id=39552
+
+ As requested by Dan "the man" Bates.
+
+ * Scripts/webkitpy/tool/steps/options.py:
+ * Scripts/webkitpy/tool/steps/postdiff.py:
+
+2010-05-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ webkit-patch should assign newly created bugs to their creator
+ https://bugs.webkit.org/show_bug.cgi?id=39548
+
+ As requested on webkit-dev.
+
+ * Scripts/webkitpy/common/net/bugzilla.py:
+
+2010-05-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Hide prepare and post commands for webkit-patch
+ https://bugs.webkit.org/show_bug.cgi?id=39539
+
+ It turns out these commands aren't very popular and they confuse new
+ users. They'll still be there for advanced users, however.
+
+ * Scripts/webkitpy/tool/commands/upload.py:
+
+2010-05-23 Jesus Sanchez-Palencia <jesus@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] QtTestBrowser has two graphicsview options that aren't enabled correctly
+ https://bugs.webkit.org/show_bug.cgi?id=39491
+
+ Making toggleResizesToContents and toggleTiledBackingStore checkable when
+ QtTestBrowser is started on graphics view mode.
+
+ * QtTestBrowser/main.cpp:
+ (LauncherWindow::createChrome):
+
+2010-05-23 Jesus Sanchez-Palencia <jesus@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] QtTestBrowser is still called QtLauncher in the code
+ https://bugs.webkit.org/show_bug.cgi?id=39488
+
+ Finish the name change of QtLauncher to QtTestBrowser.
+
+ * QtTestBrowser/main.cpp:
+ (LauncherApplication::LauncherApplication):
+ (LauncherApplication::handleUserOptions):
+ * QtTestBrowser/mainwindow.cpp:
+ (MainWindow::MainWindow):
+ * QtTestBrowser/useragentlist.txt:
+
+2010-05-23 Marcus Bulach <bulach@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ [chromium] Adds Geolocation support to DumpRenderTree.
+ https://bugs.webkit.org/show_bug.cgi?id=39440
+
+ Existing LayoutTests/fast/dom/Geolocation/* should pass.
+
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::setGeolocationPermission):
+ (LayoutTestController::setMockGeolocationPosition):
+ (LayoutTestController::setMockGeolocationError):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ * DumpRenderTree/chromium/TestShell.cpp:
+ (TestShell::TestShell):
+ * DumpRenderTree/chromium/WebViewHost.cpp:
+ (WebViewHost::geolocationService):
+ * DumpRenderTree/chromium/WebViewHost.h:
+
+2010-05-22 Adam Barth <abarth@webkit.org>
+
+ Unreviewed.
+
+ Re-order Yong's email addresses because his gmail account is the one he
+ uses for bugs.webkit.org.
+
+ * Scripts/webkitpy/common/config/committers.py:
+
+2010-05-22 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Chris Jerdonek.
+
+ Add infrastructure to parse SVN property changes
+ https://bugs.webkit.org/show_bug.cgi?id=38885
+
+ Adds function VCSUtils::parseSvnDiffFooter to parse an SVN footer
+ that consists of one or more properties.
+
+ Note, the first line of an SVN footer begins with "Property changes on".
+
+ * Scripts/VCSUtils.pm:
+ - Added function parseSvnDiffFooter. Will use this function
+ towards resolving Bug #39409 <https://bugs.webkit.org/show_bug.cgi?id=39409>.
+ - Removed FIXME comment above function parseSvnProperty, since
+ it is being used by parseSvnDiffFooter.
+ * Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl: Added.
+ - Added unit tests.
+
+2010-05-22 Eric Seidel <eric@webkit.org>
+
+ Unreviewed, fixing test results only.
+
+ Disable compositing tests on the commit-queue as a workaround for bug 38912
+ https://bugs.webkit.org/show_bug.cgi?id=39067
+
+ * Scripts/webkitpy/tool/steps/steps_unittest.py:
+ - Update test results after my previous change.
+
+2010-05-22 Eric Seidel <eric@webkit.org>
+
+ Unreviewed.
+
+ Disable compositing tests on the commit-queue as a workaround for bug 38912
+ https://bugs.webkit.org/show_bug.cgi?id=39067
+
+ * Scripts/webkitpy/tool/steps/runtests.py:
+ - Disable all of compositing, not just compositing/iframes
+
+2010-05-22 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Link resources and load Ahem font for Windows
+ https://bugs.webkit.org/show_bug.cgi?id=39473
+
+ * DumpRenderTree/chromium/DumpRenderTree.cpp:
+ (main): Call platformInit().
+ * DumpRenderTree/chromium/TestShell.h:
+ Declare platformInit(). It is not related to TestShell class, but the
+ implementation of paltformInit() is placed at TestShell*.{cpp,mm}.
+ * DumpRenderTree/chromium/TestShellGtk.cpp:
+ (platformInit):
+ * DumpRenderTree/chromium/TestShellMac.mm:
+ (platformInit):
+ * DumpRenderTree/chromium/TestShellWin.cpp:
+ (platformInit):
+ - Make stdout/stderr binary mode
+ - Load Ahem font
+
+2010-05-21 Eric Seidel <eric@webkit.org>
+
+ Unreviewed, EWS build fix only.
+
+ QueueStatusServer returns 500 error when EWS bots post empty queues
+ https://bugs.webkit.org/show_bug.cgi?id=39523
+
+ Mac python seems to have some built-in timezone support
+ however other python installs don't. So we need to ignore
+ timezones in our parsing.
+
+ Date parsing is tested by existing unit tests.
+
+ * QueueStatusServer/handlers/updateworkitems.py:
+ - Fix typo causing exception on server.
+ * Scripts/webkitpy/common/net/bugzilla.py:
+ - Fix exception due to python's lack of timezone support.
+
+2010-05-21 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ QueueStatusServer returns 500 error when EWS bots post empty queues
+ https://bugs.webkit.org/show_bug.cgi?id=39523
+
+ updateworkitems handler was raising an exception because
+ int() couldn't convert "" to a number.
+
+ I attempted to unit test this but we don't yet have a system by
+ which to load unit tests for appengine classes which depend on
+ google.appengine libraries which are not in the python default install.
+
+ We'll need to write a wrapper script to load those into the python path
+ and then run the unit test files.
+
+ * QueueStatusServer/handlers/statusbubble.py:
+ - Hide cr-win-ews since we're not currently running this bot.
+ * QueueStatusServer/handlers/updateworkitems.py:
+ - Fix the parsing logic to be able to understand "".
+ * Scripts/webkitpy/common/net/statusserver.py:
+ - Only log the work items posted to the server to the debug log channel.
+
+2010-05-21 Eric Seidel <eric@webkit.org>
+
+ Unreviewed, fixing the commit-queue to run again.
+
+ Make the EWSes report queue position in white bubbles
+ https://bugs.webkit.org/show_bug.cgi?id=39519
+
+ * Scripts/webkitpy/common/net/statusserver.py:
+ - Fix exception in _post_work_items_to_server when passed
+ integers. Unfortunately we have no good way to mock
+ the Browser object yet, and after several attempts I was
+ not able to create a good one, so no tests. :(
+
+2010-05-14 Ojan Vafai <ojan@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ webkit-patch land --squash commits too much if branch is not up to date
+ https://bugs.webkit.org/show_bug.cgi?id=38852
+
+ * Scripts/webkitpy/common/checkout/scm.py:
+ * Scripts/webkitpy/common/checkout/scm_unittest.py:
+
+2010-05-21 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Make the EWSes report queue position in white bubbles
+ https://bugs.webkit.org/show_bug.cgi?id=39519
+
+ This also fixes sorting of commit-queue patches
+ to be in order of patch attachment.
+ https://bugs.webkit.org/show_bug.cgi?id=33395
+
+ This makes the various Queues post what patches they are about to process
+ so that we can display a list of patches on status server pages, as well
+ as report queue position in status bubbles.
+
+ This is the first step towards creating a control-channel for the queues.
+ Next step will be to have them read back the patches in order from the server
+ and finally we will add the ability for the server to control that order.
+
+ * Scripts/webkitpy/common/net/bugzilla.py:
+ - Teach bugzilla how to parse attach_date for attachments.
+ * Scripts/webkitpy/common/net/bugzilla_unittest.py:
+ - Test that we're parsing dates correctly.
+ This may have timezone issues for non-PST contributers, unsure.
+ * Scripts/webkitpy/common/net/statusserver.py:
+ - Post work items to the status server for display.
+ * Scripts/webkitpy/tool/bot/patchcollection.py:
+ - Call StatusServer.update_work_items
+ * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
+ - Update unit test results now that we're posting work item list.
+ * Scripts/webkitpy/tool/commands/queues.py:
+ - Call StatusSever.update_work_items
+ - Sort patches so that the server's list understands
+ that the commit-queue gives priority to rollout patches.
+ - I also fixed patch sorting per bug 33395 while I was here.
+ * Scripts/webkitpy/tool/commands/queues_unittest.py:
+ - Update results after update_work_items changes.
+ - Test attachment sorting.
+ * Scripts/webkitpy/tool/mocktool.py:
+ - Add mock for update_work_items
+
+2010-05-21 Robin Cao <robin.cao@torchmobile.com.cn>
+
+ Reviewed by Adam Roben.
+
+ fast/dom/HTMLObjectElement/children-changed.html times out on Windows run-webkit-tests
+ https://bugs.webkit.org/show_bug.cgi?id=31315
+
+ * DumpRenderTree/win/FrameLoadDelegate.cpp:
+ (FrameLoadDelegate::didFailProvisionalLoadWithError): Need to invoke locationChangeDone here as mac port does.
+
+2010-05-20 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Dan Bernstein.
+
+ <rdar://problem/7848154> Remove the dependency on Foundation's private __COCOA_FORMAL_PROTOCOLS_2__ define.
+
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+
+2010-05-20 Tony Gentilcore <tonyg@chromium.org>
+
+ Reviewed by Daniel Bates.
+
+ Look in /proc/registry64 for the Platform SDK on 64-bit Windows.
+ https://bugs.webkit.org/show_bug.cgi?id=39296
+
+ The build-webkit script failed for me on Vista 64. A web search turned
+ up this blog post with a patch that worked for me:
+ http://www.nicholaswilson.me.uk/2010/04/hacking-webkit-fail/
+
+ * Scripts/webkitdirs.pm:
+
+2010-05-20 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ ThreadedMessageQueue should use with_statement for exception safety
+ https://bugs.webkit.org/show_bug.cgi?id=39233
+
+ * Scripts/webkitpy/common/thread/threadedmessagequeue.py:
+
+2010-05-20 Diego Gonzalez <diegohcg@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] QtTestBrowser does not support websites which requires HTTP Authentication via dialogs
+ https://bugs.webkit.org/show_bug.cgi?id=38456
+
+ * QtTestBrowser/webpage.cpp:
+ (WebPage::WebPage):
+ (WebPage::authenticationRequired):
+ * QtTestBrowser/webpage.h:
+
+2010-05-20 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Eric Seidel.
+
+ editingBehavior settings needs to be set back to a reasonable default between tests
+ https://bugs.webkit.org/show_bug.cgi?id=39433
+
+ For now, hard code the default setting during reset, so that the serialized
+ version of the setting stays in sync with expectations.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetDefaultsToConsistentValues): Reset editing behavior to the appropriate platform default.
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (resetDefaultsToConsistentValues): Ditto.
+
+2010-05-20 Brent Fulgham <bfulgham@webkit.org>
+
+ Build fix. No review.
+
+ The WebKitAPITest targets do not use the "_debug" suffix needed
+ by the WinCairo port. Added Debug_Cairo target to correct this.
+
+ * WebKitAPITest/WebKitAPITest.vcproj:
+
+2010-05-20 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Ojan Vafai.
+
+ editing/selection/extend-selection-after-double-click.html crashes on the Leopard Intel release bot
+ https://bugs.webkit.org/show_bug.cgi?id=39431
+
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setEditingBehavior):
+ Prevent a double-free by not having this variable be in the auto-release pool.
+
+2010-05-20 Martin Robinson <mrobinson@webkit.org>
+
+ Reviewed by Ojan Vafai.
+
+ Expose the editing behavior setting in DRT to test all editing code paths
+ https://bugs.webkit.org/show_bug.cgi?id=38603
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (setEditingBehaviorCallback): Added.
+ (LayoutTestController::staticFunctions): Expose the setEditingBehaviorCallback function.
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/chromium/LayoutTestController.cpp: Add callback method for setting editing behavior.
+ * DumpRenderTree/chromium/LayoutTestController.h: Declaration for this method.
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::setEditingBehavior): Implementation of editing behavior control.
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setEditingBehavior): Ditto
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::setEditingBehavior): Added stub implementation of editing behavior control.
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+ (LayoutTestController::setEditingBehavior): Add slot for controlling editor behavior.
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::setEditingBehavior): Implementation of editing behavior control.
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::setEditingBehavior): Added stub implementation of editing behavior control.
+
+2010-05-20 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ [DRT/Chromium] Increase the time out value
+ https://bugs.webkit.org/show_bug.cgi?id=39203
+
+ Change the time out value of Chromium DRT to 30 seconds, which is
+ the same as other ports.
+ If a DRT process exits before new-run-webkit-tests detects time
+ out, new-run-webkit-tests assumes the DRT process crashed.
+
+ * DumpRenderTree/chromium/TestShell.cpp:
+ (TestShell::layoutTestTimeout):
+ Change the time out value from 10 seconds to 30 seconds.
+
+2010-05-20 Chris Evans <cevans@google.com>
+
+ Unreviewed.
+
+ Marking myself as a committer.
+
+ * Scripts/webkitpy/common/config/committers.py: Add cevans@google.com.
+
+2010-05-20 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbo.
+
+ [Qt] Weekly binary builds on Mac OS X don't work when launched in the Finder
+ https://bugs.webkit.org/show_bug.cgi?id=37273
+
+ * QtTestBrowser/QtTestBrowser.pro: Build QtLauncher as bundle in package builds
+
+2010-05-20 Fumitoshi Ukai <ukai@chromium.org>
+
+ Unreviewed fix for websocket test failures.
+
+ * Scripts/new-run-webkit-websocketserver:
+ options is named parameter for factory.get().
+
+2010-05-20 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Chromium: Add --chromium option to new-run-webkit-websocketserver
+ https://bugs.webkit.org/show_bug.cgi?id=37664
+
+ Missed to pass options to factory.get() in r59595
+
+ * Scripts/new-run-webkit-websocketserver:
+ Pass options to factory.get().
+
+2010-05-19 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ WinEWS should build Debug instead of Release
+ https://bugs.webkit.org/show_bug.cgi?id=39242
+
+ This is a workaround for
+ https://bugs.webkit.org/show_bug.cgi?id=39197
+ Adam Roben and Brian Weinstein believe this may
+ also make building faster since Debug builds
+ take less time to link.
+
+ * Scripts/webkitpy/tool/commands/earlywarningsystem.py:
+
+2010-05-19 Dirk Pranke <dpranke@chromium.org>
+
+ Unreviewed, build fix.
+
+ * DumpRenderTree/chromium/NotificationPresenter.cpp:
+ (NotificationPresenter::show):
+
+2010-05-19 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ user.py throws exception when readline module is missing
+ https://bugs.webkit.org/show_bug.cgi?id=39239
+
+ * Scripts/webkitpy/common/system/user.py:
+ - The error handling path requires the "sys" module,
+ so added an import sys at the top of the file.
+
+2010-05-18 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Fix a repaint issue and textarea tests
+ https://bugs.webkit.org/show_bug.cgi?id=39054
+
+ * DumpRenderTree/chromium/WebViewHost.cpp:
+ (WebViewHost::canvas): Remove m_paintRect initialization in canvas().
+ This line updated m_paintRect unexpectedly during paintRect().
+ We don't need to initialize m_paintRect because show() does it.
+
+2010-05-18 Tony Chang <tony@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ [chromium] new-run-webkit-tests --use-drt should run on Linux
+ https://bugs.webkit.org/show_bug.cgi?id=37845
+
+ * Scripts/webkitpy/layout_tests/port/chromium.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+
+2010-05-18 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Fix some initialization/reset issues
+ https://bugs.webkit.org/show_bug.cgi?id=39281
+
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::reset): Reset m_userStyleSheetLocation.
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ Remove unused variable, m_workQueueFrozen.
+ (LayoutTestController::WorkQueue::WorkQueue): Initialize m_frozen.
+ * DumpRenderTree/chromium/TestShell.cpp:
+ (TestShell::resetTestController): Reset WebSettings too.
+
+2010-05-18 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ new-run-webkit-tests: implement '--reset-results' flag to complement
+ the '--new-baseline' flag. '--new-baseline' will always write the
+ results into the platform directory; '--reset-results' will update the
+ existing baseline wherever it happens to be. Both sets of behavior
+ are useful in different circumstances.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38879
+
+ * Scripts/webkitpy/layout_tests/data/image/canvas-bg.html: Added.
+ * Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.checksum: Added.
+ * Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.png: Added.
+ * Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.txt: Added.
+ * Scripts/webkitpy/layout_tests/data/image/canvas-zoom.html: Added.
+ * Scripts/webkitpy/layout_tests/data/misc/crash-expected.txt: Added.
+ * Scripts/webkitpy/layout_tests/data/misc/crash.html: Added.
+ * Scripts/webkitpy/layout_tests/data/misc/missing-expectation.html: Added.
+ * Scripts/webkitpy/layout_tests/data/misc/passing-expected.txt: Added.
+ * Scripts/webkitpy/layout_tests/data/misc/passing.html: Added.
+ * Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.checksum: Added.
+ * Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.png: Added.
+ * Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.txt: Added.
+ * Scripts/webkitpy/layout_tests/data/platform/test/test_expectations.txt: Added.
+ * Scripts/webkitpy/layout_tests/data/text/article-element-expected.txt: Added.
+ * Scripts/webkitpy/layout_tests/data/text/article-element.html: Added.
+ * Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py:
+ * Scripts/webkitpy/layout_tests/port/test.py:
+ * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
+ * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
+ * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py:
+ * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
+ * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+ * Scripts/webkitpy/layout_tests/port/test.py:
+ * Scripts/webkitpy/layout_tests/port/dryrun.py:
+
+2010-05-18 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Add an --html5-parser option to DumpRenderTree to allow testing the new HTML5Lexer
+ https://bugs.webkit.org/show_bug.cgi?id=39311
+
+ This flag allows us to run the new HTML5Lexer code.
+ Right now all documents parse as empty documents, but
+ now that we're able to run the code we can fix that.
+
+ Once we're able to lex a few basic documents I'll add
+ an --html5-parser flag to run-webkit-tests so that we test
+ running all of the layout tests with the HTML5 parser.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetDefaultsToConsistentValues):
+ (initializeGlobalsFromCommandLineOptions):
+
+2010-05-08 Robert Hogan <robert@roberthogan.net>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix http/tests/xmlhttprequest/cross-origin-no-authorization.html
+ and http/tests/xmlhttprequest/cross-origin-authorization.html
+
+ QHttpNetworkRequest adds Authorization and Cookie headers to XHRs
+ without knowing if this is valid behaviour or not. In order to allow
+ Qt to decide whether Cookie/Authorization headers should be added
+ to an XHR QtWebKit needs to use an attribute added to QNetworkRequest.
+ These new attributes are: QNetworkRequest::CookieLoadControlAttribute,
+ QNetworkRequest::CookieSaveControlAttribute,and
+ QNetworkRequest::AuthenticationReuseControlAttribute.
+
+ In order to properly support the tests, Qt's DRT needs to use one
+ NetworkAccessManager for all pages. This allows it to use cached
+ credentials where appropriate.
+
+ The tests now pass when run individually but there seems to be a problem with
+ leaking the results of requests across tests when run with the others in
+ http/tests. This will be addressed in a separate patch.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32967
+
+
+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+ (WebCore::WebPage::WebPage):
+ (WebCore::DumpRenderTree::DumpRenderTree):
+ * DumpRenderTree/qt/DumpRenderTreeQt.h:
+
+
+2010-05-18 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ run_webkit_tests_unittest fails on SnowLeopard
+ https://bugs.webkit.org/show_bug.cgi?id=39279
+
+ * Scripts/webkitpy/layout_tests/port/base.py:
+ Return copy of os.environ.
+ * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
+ Check os.environ was not modified.
+
+2010-05-18 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Chromium: new-run-webkit-httpd fails to setup_mount
+ https://bugs.webkit.org/show_bug.cgi?id=39257
+
+ * Scripts/webkitpy/common/system/executive.py:
+ Assert type of args in run_command.
+ * Scripts/webkitpy/common/system/executive_unittest.py:
+ Add test_run_command_args_type
+ * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+ Executive.run_command takes array for command line.
+ * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
+ Test if setup_environ_for_server() run setup_mount.bat.
+
+2010-05-17 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by David Levin.
+
+ Chromium Windows build system does not rebuild correctly when
+ enabling/disabling a feature
+ https://bugs.webkit.org/show_bug.cgi?id=38926
+
+ Add a workaround of this issue.
+
+ * Scripts/update-webkit:
+ Chromium-Windows only: If WebKit/chromium/features.gyp has been
+ updated, remove WebKit/chromium/Debug and WebKit/chromium/Release.
+
2010-05-17 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r59631.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index f564afa..b96a9c9 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -31,6 +31,7 @@
#include "WorkQueue.h"
#include "WorkQueueItem.h"
+#include <cstring>
#include <JavaScriptCore/JSContextRef.h>
#include <JavaScriptCore/JSObjectRef.h>
#include <JavaScriptCore/JSRetainPtr.h>
@@ -1453,6 +1454,33 @@ static JSValueRef authenticateSessionCallback(JSContextRef context, JSObjectRef,
return JSValueMakeUndefined(context);
}
+static JSValueRef setEditingBehaviorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // The editing behavior string.
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ JSRetainPtr<JSStringRef> editingBehavior(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+ ASSERT(!*exception);
+
+ size_t maxLength = JSStringGetMaximumUTF8CStringSize(editingBehavior.get());
+ char* behaviorBuffer = new char[maxLength + 1];
+ JSStringGetUTF8CString(editingBehavior.get(), behaviorBuffer, maxLength);
+
+ if (strcmp(behaviorBuffer, "mac") && strcmp(behaviorBuffer, "win")) {
+ JSRetainPtr<JSStringRef> invalidArgument(JSStringCreateWithUTF8CString("Passed invalid editing behavior. Must be 'mac' or 'win'."));
+ *exception = JSValueMakeString(context, invalidArgument.get());
+ return JSValueMakeUndefined(context);
+ }
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setEditingBehavior(behaviorBuffer);
+
+ delete [] behaviorBuffer;
+
+ return JSValueMakeUndefined(context);
+}
+
// Static Values
static JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
@@ -1602,6 +1630,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setEditingBehavior", setEditingBehaviorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index c6da2ff..8ff38d1 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -99,6 +99,7 @@ public:
void setFrameFlatteningEnabled(bool enable);
void setSpatialNavigationEnabled(bool enable);
void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy);
+ void setEditingBehavior(const char* editingBehavior);
void waitForPolicyDelegate();
size_t webHistoryItemCount();
diff --git a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
index a964518..8f292ed 100644
--- a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -36,6 +36,8 @@
using namespace std;
+void platformInit();
+
static const char optionComplexText[] = "--complex-text";
static const char optionDumpAllPixels[] = "--dump-all-pixels";
static const char optionNotree[] = "--notree";
@@ -59,6 +61,7 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName
int main(int argc, char* argv[])
{
webkit_support::SetUpTestEnvironment();
+ platformInit();
TestParams params;
Vector<string> tests;
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index 4413ff2..b4e3764 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -39,6 +39,7 @@
#include "public/WebConsoleMessage.h"
#include "public/WebDocument.h"
#include "public/WebFrame.h"
+#include "public/WebGeolocationServiceMock.h"
#include "public/WebInputElement.h"
#include "public/WebKit.h"
#include "public/WebNotificationPresenter.h"
@@ -159,6 +160,11 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelineProfilingEnabled);
bindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspector);
bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
+ bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
+
+ bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
+ bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
+ bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
// The fallback method is called when an unknown method is invoked.
bindFallbackMethod(&LayoutTestController::fallbackMethod);
@@ -477,6 +483,7 @@ void LayoutTestController::reset()
m_stopProvisionalFrameLoads = false;
m_globalFlag.set(false);
m_webHistoryItemCount.set(0);
+ m_userStyleSheetLocation = WebURL();
webkit_support::SetAcceptAllCookies(false);
WebSecurityPolicy::resetOriginAccessWhitelists();
@@ -852,7 +859,7 @@ void LayoutTestController::grantDesktopNotificationPermission(const CppArgumentL
result->set(false);
return;
}
- m_shell->notificationPresenter()->grantPermission(WebString::fromUTF8(arguments[0].toString()));
+ m_shell->notificationPresenter()->grantPermission(cppVariantToWebString(arguments[0]));
result->set(true);
}
@@ -955,7 +962,7 @@ void LayoutTestController::setXSSAuditorEnabled(const CppArgumentList& arguments
void LayoutTestController::evaluateScriptInIsolatedWorld(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) {
- WebScriptSource source(WebString::fromUTF8(arguments[1].toString()));
+ WebScriptSource source(cppVariantToWebString(arguments[1]));
// This relies on the iframe focusing itself when it loads. This is a bit
// sketchy, but it seems to be what other tests do.
m_shell->webView()->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1);
@@ -1110,8 +1117,8 @@ void LayoutTestController::addOriginAccessWhitelistEntry(const CppArgumentList&
WebSecurityPolicy::addOriginAccessWhitelistEntry(
url,
- WebString::fromUTF8(arguments[1].toString()),
- WebString::fromUTF8(arguments[2].toString()),
+ cppVariantToWebString(arguments[1]),
+ cppVariantToWebString(arguments[2]),
arguments[3].toBoolean());
}
@@ -1129,8 +1136,8 @@ void LayoutTestController::removeOriginAccessWhitelistEntry(const CppArgumentLis
WebSecurityPolicy::removeOriginAccessWhitelistEntry(
url,
- WebString::fromUTF8(arguments[1].toString()),
- WebString::fromUTF8(arguments[2].toString()),
+ cppVariantToWebString(arguments[1]),
+ cppVariantToWebString(arguments[2]),
arguments[3].toBoolean());
}
@@ -1261,7 +1268,7 @@ void LayoutTestController::addUserScript(const CppArgumentList& arguments, CppVa
result->setNull();
if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isBool())
return;
- m_shell->webView()->addUserScript(WebString::fromUTF8(arguments[0].toString()), arguments[1].toBoolean());
+ m_shell->webView()->addUserScript(cppVariantToWebString(arguments[0]), arguments[1].toBoolean());
}
void LayoutTestController::addUserStyleSheet(const CppArgumentList& arguments, CppVariant* result)
@@ -1269,5 +1276,41 @@ void LayoutTestController::addUserStyleSheet(const CppArgumentList& arguments, C
result->setNull();
if (arguments.size() < 1 || !arguments[0].isString())
return;
- m_shell->webView()->addUserStyleSheet(WebString::fromUTF8(arguments[0].toString()));
+ m_shell->webView()->addUserStyleSheet(cppVariantToWebString(arguments[0]));
+}
+
+void LayoutTestController::setEditingBehavior(const CppArgumentList& arguments, CppVariant* results)
+{
+ WebSettings* settings = m_shell->webView()->settings();
+ string key = arguments[0].toString();
+ if (key == "mac")
+ settings->setEditingBehavior(WebSettings::EditingBehaviorMac);
+ else if (key == "win")
+ settings->setEditingBehavior(WebSettings::EditingBehaviorWin);
+ else
+ logErrorToConsole("Passed invalid editing behavior. Should be 'mac' or 'win'.");
+}
+
+void LayoutTestController::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 1 || !arguments[0].isBool())
+ return;
+ WebGeolocationServiceMock::setMockGeolocationPermission(arguments[0].toBoolean());
+}
+
+void LayoutTestController::setMockGeolocationPosition(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 3 || !arguments[0].isNumber() || !arguments[1].isNumber() || !arguments[2].isNumber())
+ return;
+ WebGeolocationServiceMock::setMockGeolocationPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble());
+}
+
+void LayoutTestController::setMockGeolocationError(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 2 || !arguments[0].isInt32() || !arguments[1].isString())
+ return;
+ WebGeolocationServiceMock::setMockGeolocationError(arguments[0].toInt32(), cppVariantToWebString(arguments[1]));
}
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index e7a48e2..0e66087 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -209,6 +209,8 @@ public:
// Grants permission for desktop notifications to an origin
void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
+ void setEditingBehavior(const CppArgumentList&, CppVariant*);
+
// The following are only stubs. TODO(pamg): Implement any of these that
// are needed to pass the layout tests.
void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
@@ -279,6 +281,11 @@ public:
void addUserScript(const CppArgumentList&, CppVariant*);
void addUserStyleSheet(const CppArgumentList&, CppVariant*);
+ // Geolocation related functions.
+ void setGeolocationPermission(const CppArgumentList&, CppVariant*);
+ void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
+ void setMockGeolocationError(const CppArgumentList&, CppVariant*);
+
public:
// The following methods are not exposed to JavaScript.
void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
@@ -331,7 +338,7 @@ private:
// queueScript.
class WorkQueue {
public:
- WorkQueue(LayoutTestController* controller) : m_controller(controller) {}
+ WorkQueue(LayoutTestController* controller) : m_frozen(false), m_controller(controller) {}
virtual ~WorkQueue();
void processWorkSoon();
@@ -441,10 +448,6 @@ private:
// If true, don't dump output until notifyDone is called.
bool m_waitUntilDone;
- // To prevent infinite loops, only the first page of a test can add to a
- // work queue (since we may well come back to that same page).
- bool m_workQueueFrozen;
-
WorkQueue m_workQueue;
CppVariant m_globalFlag;
diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
index 86903be..501b513 100644
--- a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
@@ -52,23 +52,11 @@ void NotificationPresenter::grantPermission(const WebString& origin)
// The output from all these methods matches what DumpRenderTree produces.
bool NotificationPresenter::show(const WebNotification& notification)
{
- if (!notification.replaceId().isEmpty()) {
- String replaceId(notification.replaceId().data(), notification.replaceId().length());
- if (m_replacements.find(replaceId) != m_replacements.end())
- printf("REPLACING NOTIFICATION %s\n",
- m_replacements.find(replaceId)->second.utf8().data());
-
- WebString identifier = notification.isHTML() ?
- notification.url().spec().utf16() : notification.title();
- m_replacements.set(replaceId, String(identifier.data(), identifier.length()));
- }
-
if (notification.isHTML()) {
printf("DESKTOP NOTIFICATION: contents at %s\n",
notification.url().spec().data());
} else {
- printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n",
- notification.dir() == "rtl" ? "(RTL)" : "",
+ printf("DESKTOP NOTIFICATION: icon %s, title %s, text %s\n",
notification.iconURL().isEmpty() ? "" :
notification.iconURL().spec().data(),
notification.title().isEmpty() ? "" :
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
index 24a895a..29bd596 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
@@ -80,6 +80,7 @@ TestShell::TestShell()
, m_testIsPreparing(false)
, m_focusedWidget(0)
{
+ WebRuntimeFeatures::enableGeolocation(true);
m_accessibilityController.set(new AccessibilityController(this));
m_layoutTestController.set(new LayoutTestController(this));
m_eventSender.set(new EventSender(this));
@@ -211,6 +212,7 @@ void TestShell::resizeWindowForTest(WebViewHost* window, const WebURL& url)
void TestShell::resetTestController()
{
+ resetWebSettings(*webView());
m_accessibilityController->reset();
m_layoutTestController->reset();
m_eventSender->reset();
@@ -565,7 +567,11 @@ void TestShell::bindJSObjectsToWindow(WebFrame* frame)
int TestShell::layoutTestTimeout()
{
- return 10 * 1000;
+ // 30 second is the same as the value in Mac DRT.
+ // If we use a value smaller than the timeout value of
+ // (new-)run-webkit-tests, (new-)run-webkit-tests misunderstands that a
+ // timed-out DRT process was crashed.
+ return 30 * 1000;
}
WebViewHost* TestShell::createWebView()
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h
index 283cbd4..6dd0198 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h
@@ -153,3 +153,5 @@ private:
HANDLE m_finishedEvent;
#endif
};
+
+void platformInit();
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
index d71881a..e31ca0a 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
@@ -62,3 +62,7 @@ void TestShell::waitTestFinished()
alarm(0);
signal(SIGALRM, SIG_DFL);
}
+
+void platformInit()
+{
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
index ec8dbac..218b6d0 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
@@ -123,3 +123,7 @@ void TestShell::waitTestFinished()
[thread cancel];
[thread release];
}
+
+void platformInit()
+{
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
index 2d806a2..e0e0af1 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
@@ -32,7 +32,11 @@
#include "TestShell.h"
#include "webkit/support/webkit_support.h"
+#include <fcntl.h>
+#include <io.h>
#include <process.h>
+#include <shlwapi.h>
+#include <sys/stat.h>
// Default timeout in ms for file page loads when in layout test mode.
const int kDefaultFileTestTimeoutMillisecs = 10 * 1000;
@@ -98,3 +102,47 @@ void TestShell::waitTestFinished()
// Wait to join the watchdog thread. (up to 1s, then quit)
WaitForSingleObject(threadHandle, 1000);
}
+
+void platformInit()
+{
+ // Set stdout/stderr binary mode.
+ _setmode(_fileno(stdout), _O_BINARY);
+ _setmode(_fileno(stderr), _O_BINARY);
+
+ // Load Ahem font.
+ // AHEM____.TTF is copied to the directory of DumpRenderTree.exe by WebKit.gyp.
+ WCHAR path[_MAX_PATH];
+ if (!::GetModuleFileName(0, path, _MAX_PATH)) {
+ fprintf(stderr, "Can't get the module path.\n");
+ exit(1);
+ }
+ ::PathRemoveFileSpec(path);
+ wcscat_s(path, _MAX_PATH, L"/AHEM____.TTF");
+ struct _stat ahemStat;
+ if (_wstat(path, &ahemStat) == -1) {
+ fprintf(stderr, "Can't access: '%S'\n", path);
+ exit(1);
+ }
+
+ FILE* fp = _wfopen(path, L"rb");
+ if (!fp) {
+ _wperror(path);
+ exit(1);
+ }
+ size_t size = ahemStat.st_size;
+ char* fontBuffer = new char[size];
+ if (fread(fontBuffer, 1, size, fp) != size) {
+ fprintf(stderr, "Can't read the font: '%S'\n", path);
+ fclose(fp);
+ exit(1);
+ }
+ fclose(fp);
+ DWORD numFonts = 1;
+ HANDLE fontHandle = ::AddFontMemResourceEx(fontBuffer, size, 0, &numFonts);
+ delete[] fontBuffer; // OS owns a copy of the buffer.
+ if (!fontHandle) {
+ fprintf(stderr, "Failed to register Ahem font: '%S'\n", path);
+ exit(1);
+ }
+ // We don't need to release the font explicitly.
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
index 4761b1a..eb44c2a 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -42,6 +42,7 @@
#include "public/WebDataSource.h"
#include "public/WebDragData.h"
#include "public/WebFrame.h"
+#include "public/WebGeolocationServiceMock.h"
#include "public/WebHistoryItem.h"
#include "public/WebNode.h"
#include "public/WebRange.h"
@@ -527,6 +528,13 @@ WebNotificationPresenter* WebViewHost::notificationPresenter()
return m_shell->notificationPresenter();
}
+WebKit::WebGeolocationService* WebViewHost::geolocationService()
+{
+ if (!m_geolocationServiceMock.get())
+ m_geolocationServiceMock.set(new WebGeolocationServiceMock);
+ return m_geolocationServiceMock.get();
+}
+
// WebWidgetClient -----------------------------------------------------------
void WebViewHost::didInvalidateRect(const WebRect& rect)
@@ -1321,7 +1329,6 @@ PlatformCanvas* WebViewHost::canvas()
return m_canvas.get();
WebSize widgetSize = webWidget()->size();
resetScrollRect();
- m_paintRect = WebRect(0, 0, widgetSize.width, widgetSize.height);
m_canvas.set(new PlatformCanvas(widgetSize.width, widgetSize.height, true));
return m_canvas.get();
}
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
index 5227b28..8fb9d04 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
@@ -45,6 +45,7 @@ class LayoutTestController;
class TestShell;
namespace WebKit {
class WebFrame;
+class WebGeolocationServiceMock;
class WebURL;
struct WebRect;
struct WebURLError;
@@ -125,6 +126,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual int historyForwardListCount();
virtual void focusAccessibilityObject(const WebKit::WebAccessibilityObject&);
virtual WebKit::WebNotificationPresenter* notificationPresenter();
+ virtual WebKit::WebGeolocationService* geolocationService();
// WebKit::WebWidgetClient
virtual void didInvalidateRect(const WebKit::WebRect&);
@@ -278,6 +280,9 @@ private:
WebKit::WebRect m_paintRect;
bool m_isPainting;
+ // Geolocation
+ OwnPtr<WebKit::WebGeolocationServiceMock> m_geolocationServiceMock;
+
OwnPtr<TestNavigationController*> m_navigationController;
};
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 4ffab88..e8b8627 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -39,6 +39,7 @@
#include <JavaScriptCore/JSRetainPtr.h>
#include <JavaScriptCore/JSStringRef.h>
+#include <cstring>
#include <iostream>
#include <sstream>
#include <stdio.h>
@@ -693,3 +694,14 @@ JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRe
void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
{
}
+
+void LayoutTestController::setEditingBehavior(const char* editingBehavior)
+{
+ WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+ WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
+
+ if (!strcmp(editingBehavior, "win"))
+ g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_WINDOWS, NULL);
+ if (!strcmp(editingBehavior, "mac"))
+ g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_MAC, NULL);
+}
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index 6572a8e..8fd5298 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -135,6 +135,7 @@ static int dumpPixels;
static int threaded;
static int dumpTree = YES;
static int forceComplexText;
+static int useHTML5Parser;
static BOOL printSeparators;
static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
@@ -440,6 +441,7 @@ static void resetDefaultsToConsistentValues()
[preferences setDeveloperExtrasEnabled:NO];
[preferences setLoadsImagesAutomatically:YES];
[preferences setFrameFlatteningEnabled:NO];
+ [preferences setEditingBehavior:WebKitEditingMacBehavior];
if (persistentUserStyleSheetLocation) {
[preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]];
[preferences setUserStyleSheetEnabled:YES];
@@ -451,6 +453,7 @@ static void resetDefaultsToConsistentValues()
[preferences setUsesPageCache:NO];
[preferences setAcceleratedCompositingEnabled:YES];
[preferences setWebGLEnabled:NO];
+ [preferences setHTML5ParserEnabled:useHTML5Parser];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
@@ -557,6 +560,7 @@ static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[]
{"tree", no_argument, &dumpTree, YES},
{"threaded", no_argument, &threaded, YES},
{"complex-text", no_argument, &forceComplexText, YES},
+ {"html5-parser", no_argument, &useHTML5Parser, YES},
{NULL, 0, NULL, 0}
};
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 44aea81..898235b 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -66,10 +66,6 @@
#import <wtf/HashMap.h>
#import <wtf/RetainPtr.h>
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-#include <Foundation/NSPrivateDecls.h>
-#endif
-
@interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem>
{
SEL _action;
@@ -762,7 +758,7 @@ void LayoutTestController::setWebViewEditable(bool editable)
#ifndef BUILDING_ON_TIGER
static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoaderRunLoopMode";
-#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) || !defined(__COCOA_FORMAL_PROTOCOLS_2__)
+#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
@protocol NSURLConnectionDelegate <NSObject>
@end
#endif
@@ -849,3 +845,13 @@ void LayoutTestController::authenticateSession(JSStringRef url, JSStringRef user
[SynchronousLoader makeRequest:request withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()];
#endif
}
+
+void LayoutTestController::setEditingBehavior(const char* editingBehavior)
+{
+ NSString* editingBehaviorNS = [[NSString alloc] initWithUTF8String:editingBehavior];
+ if ([editingBehaviorNS isEqualToString:@"mac"])
+ [[WebPreferences standardPreferences] setEditingBehavior:WebKitEditingMacBehavior];
+ if ([editingBehaviorNS isEqualToString:@"win"])
+ [[WebPreferences standardPreferences] setEditingBehavior:WebKitEditingWinBehavior];
+ [editingBehaviorNS release];
+}
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index f9caca6..f119dd0 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -156,7 +156,7 @@ WebPage::WebPage(QObject* parent, DumpRenderTree* drt)
connect(this, SIGNAL(geometryChangeRequested(const QRect &)),
this, SLOT(setViewGeometry(const QRect & )));
- setNetworkAccessManager(new NetworkAccessManager(this));
+ setNetworkAccessManager(m_drt->networkAccessManager());
setPluginFactory(new TestPlugin(this));
}
@@ -346,6 +346,7 @@ DumpRenderTree::DumpRenderTree()
QWebSettings::enablePersistentStorage(m_persistentStoragePath);
+ m_networkAccessManager = new NetworkAccessManager(this);
// create our primary testing page/view.
m_mainView = new QWebView(0);
m_mainView->resize(QSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight));
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
index e6449b7..ad41e3a 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
@@ -61,6 +61,7 @@ class GCController;
namespace WebCore {
class WebPage;
+class NetworkAccessManager;
class DumpRenderTree : public QObject {
Q_OBJECT
@@ -87,6 +88,7 @@ public:
EventSender *eventSender() const { return m_eventSender; }
TextInputController *textInputController() const { return m_textInputController; }
QString persistentStoragePath() const { return m_persistentStoragePath; }
+ NetworkAccessManager *networkAccessManager() const { return m_networkAccessManager; }
QWebPage *createWindow();
int windowCount() const;
@@ -95,7 +97,6 @@ public:
WebPage *webPage() const { return m_page; }
-
#if defined(Q_WS_X11)
static void initializeFonts();
#endif
@@ -136,6 +137,7 @@ private:
EventSender *m_eventSender;
TextInputController *m_textInputController;
GCController* m_gcController;
+ NetworkAccessManager* m_networkAccessManager;
QFile *m_stdin;
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 1fadd61..9616835 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -638,5 +638,10 @@ void LayoutTestController::setIconDatabaseEnabled(bool enable)
QWebSettings::setIconDatabasePath(QString());
}
+void LayoutTestController::setEditingBehavior(const QString& editingBehavior)
+{
+ // FIXME: Implement.
+}
+
const unsigned LayoutTestController::maxViewWidth = 800;
const unsigned LayoutTestController::maxViewHeight = 600;
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 1359a6f..5fb40b6 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -193,6 +193,8 @@ public slots:
// Simulate a request an embedding application could make, populating per-session credential storage.
void authenticateSession(const QString& url, const QString& username, const QString& password);
+ void setEditingBehavior(const QString& editingBehavior);
+
private slots:
void processWork();
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index dfa4de0..b22f342 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -787,6 +787,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
preferences->setTabsToLinks(FALSE);
preferences->setShouldPrintBackgrounds(TRUE);
preferences->setLoadsImagesAutomatically(TRUE);
+ preferences->setEditingBehavior(WebKitEditingWinBehavior);
if (persistentUserStyleSheetLocation) {
Vector<wchar_t> urlCharacters(CFStringGetLength(persistentUserStyleSheetLocation.get()));
diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
index 9b9e3c1..a84e0f3 100644
--- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -146,6 +147,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailProvisionalLoadWithError(
if (!done && gLayoutTestController->dumpFrameLoadCallbacks())
printf("%s - didFailProvisionalLoadWithError\n", descriptionSuitableForTestResult(frame).c_str());
+ locationChangeDone(error, frame);
return S_OK;
}
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 112b355..c70b517 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -1267,3 +1267,20 @@ void LayoutTestController::setWebViewEditable(bool)
void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
{
}
+
+void LayoutTestController::setEditingBehavior(const char* editingBehavior)
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebPreferences> preferences;
+ if (FAILED(webView->preferences(&preferences)))
+ return;
+
+ string behaviorString(editingBehavior);
+ if (behaviorString == "mac")
+ preferences->setEditingBehavior(WebKitEditingMacBehavior);
+ if (behaviorString == "win")
+ preferences->setEditingBehavior(WebKitEditingWinBehavior);
+}
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index bc157be..d34e40a 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -446,3 +446,8 @@ JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef,
void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
{
}
+
+void LayoutTestController::setEditingBehavior(JSStringRef editingBehavior)
+{
+ // FIXME: Implement
+}
diff --git a/WebKitTools/QtTestBrowser/QtTestBrowser.pro b/WebKitTools/QtTestBrowser/QtTestBrowser.pro
index 4c4d83f..fa16c82 100644
--- a/WebKitTools/QtTestBrowser/QtTestBrowser.pro
+++ b/WebKitTools/QtTestBrowser/QtTestBrowser.pro
@@ -20,13 +20,13 @@ HEADERS += \
webview.h \
fpstimer.h \
-CONFIG -= app_bundle
CONFIG += uitools
isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..
include(../../WebKit.pri)
DESTDIR = $$OUTPUT_DIR/bin
+!CONFIG(standalone_package): CONFIG -= app_bundle
QT += network
macx:QT+=xml
diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp
index 49c08d9..ca3bf7a 100644
--- a/WebKitTools/QtTestBrowser/main.cpp
+++ b/WebKitTools/QtTestBrowser/main.cpp
@@ -883,13 +883,13 @@ void LauncherWindow::createChrome()
QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool)));
toggleResizesToContents->setCheckable(true);
toggleResizesToContents->setChecked(false);
- toggleResizesToContents->setEnabled(false);
+ toggleResizesToContents->setEnabled(isGraphicsBased());
toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool)));
toggleTiledBackingStore->setCheckable(true);
toggleTiledBackingStore->setChecked(false);
- toggleTiledBackingStore->setEnabled(false);
+ toggleTiledBackingStore->setEnabled(isGraphicsBased());
toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool)));
@@ -1063,7 +1063,7 @@ LauncherApplication::LauncherApplication(int& argc, char** argv)
{
// To allow QWebInspector's configuration persistence
setOrganizationName("Nokia");
- setApplicationName("QtLauncher");
+ setApplicationName("QtTestBrowser");
setApplicationVersion("0.1");
applyDefaultSettings();
@@ -1082,7 +1082,7 @@ void LauncherApplication::handleUserOptions()
{
QStringList args = arguments();
QFileInfo program(args.at(0));
- QString programName("QtLauncher");
+ QString programName("QtTestBrowser");
if (program.exists())
programName = program.baseName();
diff --git a/WebKitTools/QtTestBrowser/mainwindow.cpp b/WebKitTools/QtTestBrowser/mainwindow.cpp
index aa6aa26..941ef79 100644
--- a/WebKitTools/QtTestBrowser/mainwindow.cpp
+++ b/WebKitTools/QtTestBrowser/mainwindow.cpp
@@ -39,7 +39,7 @@ MainWindow::MainWindow(const QString& url)
: m_page(new WebPage(this))
{
setAttribute(Qt::WA_DeleteOnClose);
- if (qgetenv("QTLAUNCHER_USE_ARGB_VISUALS").toInt() == 1)
+ if (qgetenv("QTTESTBROWSER_USE_ARGB_VISUALS").toInt() == 1)
setAttribute(Qt::WA_TranslucentBackground);
buildUI();
diff --git a/WebKitTools/QtTestBrowser/useragentlist.txt b/WebKitTools/QtTestBrowser/useragentlist.txt
index ca53693..b4b00f6 100644
--- a/WebKitTools/QtTestBrowser/useragentlist.txt
+++ b/WebKitTools/QtTestBrowser/useragentlist.txt
@@ -1,5 +1,5 @@
-Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/533.3 (KHTML, like Gecko) QtLauncher/0.1 Safari/533.3
-Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0; en-GB) AppleWebKit/533.3 (KHTML, like Gecko) QtLauncher/0.1 Mobile Safari/533.3
+Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/533.3 (KHTML, like Gecko) QtTestBrowser/0.1 Safari/533.3
+Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0; en-GB) AppleWebKit/533.3 (KHTML, like Gecko) QtTestBrowser/0.1 Mobile Safari/533.3
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8
Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2
Mozilla/5.0 (iPhone; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
diff --git a/WebKitTools/QtTestBrowser/webpage.cpp b/WebKitTools/QtTestBrowser/webpage.cpp
index 624a66f..2a3aae6 100644
--- a/WebKitTools/QtTestBrowser/webpage.cpp
+++ b/WebKitTools/QtTestBrowser/webpage.cpp
@@ -32,8 +32,10 @@
#include "webpage.h"
+#include <QAuthenticator>
#include <QDesktopServices>
#include <QtGui>
+#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkProxy>
@@ -43,6 +45,9 @@ WebPage::WebPage(QObject* parent)
, m_interruptingJavaScriptEnabled(false)
{
applyProxy();
+
+ connect(networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
+ this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*)));
}
void WebPage::applyProxy()
@@ -118,3 +123,42 @@ bool WebPage::shouldInterruptJavaScript()
return false;
return QWebPage::shouldInterruptJavaScript();
}
+
+void WebPage::authenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator)
+{
+ QDialog* dialog = new QDialog(QApplication::activeWindow());
+ dialog->setWindowTitle("HTTP Authentication");
+
+ QGridLayout* layout = new QGridLayout(dialog);
+ dialog->setLayout(layout);
+
+ QLabel* messageLabel = new QLabel(dialog);
+ messageLabel->setWordWrap(true);
+ QString messageStr = QString("Enter with username and password for: %1");
+ messageLabel->setText(messageStr.arg(reply->url().toString()));
+ layout->addWidget(messageLabel, 0, 1);
+
+ QLabel* userLabel = new QLabel("Username:", dialog);
+ layout->addWidget(userLabel, 1, 0);
+ QLineEdit* userInput = new QLineEdit(dialog);
+ layout->addWidget(userInput, 1, 1);
+
+ QLabel* passLabel = new QLabel("Password:", dialog);
+ layout->addWidget(passLabel, 2, 0);
+ QLineEdit* passInput = new QLineEdit(dialog);
+ passInput->setEchoMode(QLineEdit::Password);
+ layout->addWidget(passInput, 2, 1);
+
+ QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
+ | QDialogButtonBox::Cancel, Qt::Horizontal, dialog);
+ connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
+ layout->addWidget(buttonBox, 3, 1);
+
+ if (dialog->exec() == QDialog::Accepted) {
+ authenticator->setUser(userInput->text());
+ authenticator->setPassword(passInput->text());
+ }
+
+ delete dialog;
+}
diff --git a/WebKitTools/QtTestBrowser/webpage.h b/WebKitTools/QtTestBrowser/webpage.h
index 061deb5..03cde43 100644
--- a/WebKitTools/QtTestBrowser/webpage.h
+++ b/WebKitTools/QtTestBrowser/webpage.h
@@ -56,6 +56,7 @@ public slots:
void openUrlInDefaultBrowser(const QUrl& url = QUrl());
void setUserAgent(const QString& ua) { m_userAgent = ua; }
bool shouldInterruptJavaScript();
+ void authenticationRequired(QNetworkReply*, QAuthenticator*);
private:
void applyProxy();
diff --git a/WebKitTools/QueueStatusServer/handlers/statusbubble.py b/WebKitTools/QueueStatusServer/handlers/statusbubble.py
index 0e2b8de..bfbe958 100644
--- a/WebKitTools/QueueStatusServer/handlers/statusbubble.py
+++ b/WebKitTools/QueueStatusServer/handlers/statusbubble.py
@@ -42,7 +42,6 @@ class StatusBubble(webapp.RequestHandler):
_queues_to_display = [
["style", "style-queue"],
["cr-linux", "chromium-ews"],
- ["cr-win", "cr-win-ews"],
["gtk", "gtk-ews"],
["qt", "qt-ews"],
["mac", "mac-ews"],
diff --git a/WebKitTools/QueueStatusServer/handlers/updateworkitems.py b/WebKitTools/QueueStatusServer/handlers/updateworkitems.py
index b58e743..f91beb4 100644
--- a/WebKitTools/QueueStatusServer/handlers/updateworkitems.py
+++ b/WebKitTools/QueueStatusServer/handlers/updateworkitems.py
@@ -42,23 +42,32 @@ class UpdateWorkItems(UpdateBase):
def _work_items_for_queue(self, queue_name):
if queue_name not in queues:
- self.response.set_status(500)
- return
+ self.response.out.write("\"%s\" is not in queues %s" % (queue_name, queues))
+ return None
work_items = WorkItems.all().filter("queue_name =", queue_name).get()
if not work_items:
work_items = WorkItems()
work_items.queue_name = queue_name
return work_items
+ def _parse_work_items_string(self, items_string):
+ # Our parsing could be much more robust.
+ item_strings = items_string.split(" ") if items_string else []
+ return map(int, item_strings)
+
def _work_items_from_request(self):
queue_name = self.request.get("queue_name")
work_items = self._work_items_for_queue(queue_name)
+ if not work_items:
+ return None
items_string = self.request.get("work_items")
- # Our parsing could be much more robust.
- work_items.item_ids = map(int, items_string.split(" "))
+ work_items.item_ids = self._parse_work_items_string(items_string)
work_items.date = datetime.now()
return work_items
def post(self):
work_items = self._work_items_from_request()
+ if not work_items:
+ self.response.set_status(500)
+ return
work_items.put()
diff --git a/WebKitTools/Scripts/VCSUtils.pm b/WebKitTools/Scripts/VCSUtils.pm
index 41bbf40..24911ab 100644
--- a/WebKitTools/Scripts/VCSUtils.pm
+++ b/WebKitTools/Scripts/VCSUtils.pm
@@ -838,6 +838,81 @@ sub parseDiff($$)
return (\@diffHashRefs, $line);
}
+# Parse an SVN property change diff from the given file handle, and advance
+# the handle so the last line read is the first line after this diff.
+#
+# For the case of an SVN binary diff, the binary contents will follow the
+# the property changes.
+#
+# This subroutine dies if the first line does not begin with "Property changes on"
+# or if the separator line that follows this line is missing.
+#
+# Args:
+# $fileHandle: advanced so the last line read from the handle is the first
+# line of the footer to parse. This line begins with
+# "Property changes on".
+# $line: the line last read from $fileHandle.
+#
+# Returns ($propertyHashRef, $lastReadLine):
+# $propertyHashRef: a hash reference representing an SVN diff footer.
+# propertyPath: the path of the target file.
+# executableBitDelta: the value 1 or -1 if the executable bit was added or
+# removed from the target file, respectively.
+# $lastReadLine: the line last read from $fileHandle.
+#
+# FIXME: This method is unused as of (05/22/2010). We will call this function
+# as part of parsing a diff. See <https://bugs.webkit.org/show_bug.cgi?id=39409>.
+sub parseSvnDiffProperties($$)
+{
+ my ($fileHandle, $line) = @_;
+
+ $_ = $line;
+
+ my $svnFooterDiffStartRegEx = qr#Property changes on: ([^\r\n]+)#; # $1 is normally the same as the index path.
+
+ my %footer;
+ if (/$svnFooterDiffStartRegEx/) {
+ $footer{propertyPath} = $1;
+ } else {
+ die("Failed to find start of SVN property change, \"Property changes on \": \"$_\"");
+ }
+
+ # We advance $fileHandle two lines so that the next line that
+ # we process is $svnPropertyStartRegEx in a well-formed footer.
+ # A well-formed footer has the form:
+ # Property changes on: FileA
+ # ___________________________________________________________________
+ # Added: svn:executable
+ # + *
+ $_ = <$fileHandle>; # Not defined if end-of-file reached.
+ my $separator = "_" x 67;
+ if (defined($_) && /^$separator[\r\n]+$/) {
+ $_ = <$fileHandle>;
+ } else {
+ die("Failed to find separator line: \"$_\".");
+ }
+
+ # FIXME: We should expand this to support other SVN properties
+ # (e.g. return a hash of property key-values that represents
+ # all properties).
+ #
+ # Notice, we keep processing until we hit end-of-file or some
+ # line that does not resemble $svnPropertyStartRegEx, such as
+ # the empty line that precedes the start of the binary contents
+ # of a patch, or the start of the next diff (e.g. "Index:").
+ my $propertyHashRef;
+ while (defined($_) && /$svnPropertyStartRegEx/) {
+ ($propertyHashRef, $_) = parseSvnProperty($fileHandle, $_);
+ if ($propertyHashRef->{name} eq "svn:executable") {
+ # Notice, for SVN properties, propertyChangeDelta is always non-zero
+ # because a property can only be added or removed.
+ $footer{executableBitDelta} = $propertyHashRef->{propertyChangeDelta};
+ }
+ }
+
+ return(\%footer, $_);
+}
+
# Parse the next SVN property from the given file handle, and advance the handle so the last
# line read is the first line after the property.
#
@@ -861,9 +936,6 @@ sub parseDiff($$)
# propertyChangeDelta: the value 1 or -1 if the property was added or
# removed, respectively.
# $lastReadLine: the line last read from $fileHandle.
-#
-# FIXME: This method is unused as of (05/16/2010). We will call this function
-# as part of parsing a SVN footer. See <https://bugs.webkit.org/show_bug.cgi?id=38885>.
sub parseSvnProperty($$)
{
my ($fileHandle, $line) = @_;
diff --git a/WebKitTools/Scripts/check-webkit-style b/WebKitTools/Scripts/check-webkit-style
index f74c3bd..19d3762 100755
--- a/WebKitTools/Scripts/check-webkit-style
+++ b/WebKitTools/Scripts/check-webkit-style
@@ -50,7 +50,7 @@ import sys
from webkitpy.style_references import detect_checkout
import webkitpy.style.checker as checker
-from webkitpy.style.checker import PatchReader
+from webkitpy.style.patchreader import PatchReader
from webkitpy.style.checker import StyleProcessor
from webkitpy.style.filereader import TextFileReader
from webkitpy.style.main import change_directory
diff --git a/WebKitTools/Scripts/new-run-webkit-websocketserver b/WebKitTools/Scripts/new-run-webkit-websocketserver
index 4f6deaa..3350582 100644
--- a/WebKitTools/Scripts/new-run-webkit-websocketserver
+++ b/WebKitTools/Scripts/new-run-webkit-websocketserver
@@ -91,7 +91,7 @@ def main():
if options.pidfile:
kwds['pidfile'] = options.pidfile
- port_obj = factory.get()
+ port_obj = factory.get(options=options)
pywebsocket = websocket_server.PyWebSocket(port_obj, options.output_dir, **kwds)
log_level = logging.WARN
diff --git a/WebKitTools/Scripts/update-webkit b/WebKitTools/Scripts/update-webkit
index 7602c41..3fc2efd 100755
--- a/WebKitTools/Scripts/update-webkit
+++ b/WebKitTools/Scripts/update-webkit
@@ -33,6 +33,7 @@ use strict;
use FindBin;
use lib $FindBin::Bin;
use File::Basename;
+use File::Path;
use File::Spec;
use Getopt::Long;
use VCSUtils;
@@ -67,6 +68,8 @@ __END__
exit 1;
}
+my $startTime = time();
+
my @svnOptions = ();
push @svnOptions, '-q' if $quiet;
@@ -83,6 +86,13 @@ if (-d "../Internal") {
runSvnUpdate() if $isSVN;
runGitUpdate() if $isGit;
} elsif (isChromium()) {
+ # Workaround for https://bugs.webkit.org/show_bug.cgi?id=38926
+ # We should remove the following "if" block when we find a right fix.
+ if ((isCygwin() || isWindows()) && (stat("WebKit/chromium/features.gypi"))[9] >= $startTime) {
+ print "features.gypi has been updated. Cleaning the build directories.\n";
+ rmtree(["WebKit/chromium/Debug", "WebKit/chromium/Release"]);
+ }
+
system("perl", "WebKitTools/Scripts/update-webkit-chromium") == 0 or die $!;
} elsif (isAppleWinWebKit()) {
system("perl", "WebKitTools/Scripts/update-webkit-auxiliary-libs") == 0 or die;
diff --git a/WebKitTools/Scripts/webkit-patch b/WebKitTools/Scripts/webkit-patch
index e0170ed..8300b9f 100755
--- a/WebKitTools/Scripts/webkit-patch
+++ b/WebKitTools/Scripts/webkit-patch
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (c) 2009, Google Inc. All rights reserved.
+# Copyright (c) 2010 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
@@ -31,6 +31,7 @@
#
# A tool for automating dealing with bugzilla, posting patches, committing patches, etc.
+import logging
import os
import sys
@@ -39,7 +40,14 @@ import webkitpy.python24.versioning as versioning
def main():
- configure_logging()
+ # This is a hack to let us enable DEBUG logging as early as possible.
+ # Note this can't be ternary as versioning.check_version()
+ # hasn't run yet and this python might be older than 2.5.
+ if set(["-v", "--verbose"]).intersection(set(sys.argv)):
+ logging_level = logging.DEBUG
+ else:
+ logging_level = logging.INFO
+ configure_logging(logging_level=logging_level)
versioning.check_version()
diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm
index c512009..ca17757 100644
--- a/WebKitTools/Scripts/webkitdirs.pm
+++ b/WebKitTools/Scripts/webkitdirs.pm
@@ -1051,12 +1051,16 @@ sub setupCygwinEnv()
sub dieIfWindowsPlatformSDKNotInstalled
{
- my $windowsPlatformSDKRegistryEntry = "/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1";
+ my $registry32Path = "/proc/registry/";
+ my $registry64Path = "/proc/registry64/";
+ my $windowsPlatformSDKRegistryEntry = "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1";
- return if -e $windowsPlatformSDKRegistryEntry;
+ # FIXME: It would be better to detect whether we are using 32- or 64-bit Windows
+ # and only check the appropriate entry. But for now we just blindly check both.
+ return if (-e $registry32Path . $windowsPlatformSDKRegistryEntry) || (-e $registry64Path . $windowsPlatformSDKRegistryEntry);
print "*************************************************************\n";
- print "Cannot find '$windowsPlatformSDKRegistryEntry'.\n";
+ print "Cannot find registry entry '$windowsPlatformSDKRegistryEntry'.\n";
print "Please download and install the Microsoft Windows Server 2003 R2\n";
print "Platform SDK from <http://www.microsoft.com/downloads/details.aspx?\n";
print "familyid=0baf2b35-c656-4969-ace8-e4c0c0716adb&displaylang=en>.\n\n";
diff --git a/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl b/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl
new file mode 100644
index 0000000..e305484
--- /dev/null
+++ b/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl
@@ -0,0 +1,348 @@
+#!/usr/bin/perl -w
+#
+# Copyright (C) Research in Motion Limited 2010. All Rights Reserved.
+# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Unit tests of parseSvnDiffProperties().
+
+use strict;
+use warnings;
+
+use Test::More;
+use VCSUtils;
+
+my @testCaseHashRefs = (
+####
+# Simple test cases
+##
+{
+ # New test
+ diffName => "simple: add svn:executable",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: svn:executable
+ + *
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+undef],
+ expectedNextLine => undef,
+},
+{
+ # New test
+ diffName => "simple: delete svn:executable",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Deleted: svn:executable
+ - *
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => -1,
+},
+undef],
+ expectedNextLine => undef,
+},
+{
+ # New test
+ diffName => "simple: delete svn:executable using SVN 1.4 syntax",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Name: svn:executable
+ - *
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => -1,
+},
+undef],
+ expectedNextLine => undef,
+},
+####
+# Property value followed by empty line and start of next diff
+##
+{
+ # New test
+ diffName => "add svn:executable, followed by empty line and start of next diff",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: svn:executable
+ + *
+
+Index: Makefile.shared
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+"\n"],
+ expectedNextLine => "Index: Makefile.shared\n",
+},
+{
+ # New test
+ diffName => "add svn:executable, followed by empty line and start of next property diff",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: svn:executable
+ + *
+
+Property changes on: Makefile.shared
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+"\n"],
+ expectedNextLine => "Property changes on: Makefile.shared\n",
+},
+####
+# Property value followed by empty line and start of the binary contents
+##
+{
+ # New test
+ diffName => "add svn:executable, followed by empty line and start of binary contents",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: svn:executable
+ + *
+
+Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+"\n"],
+ expectedNextLine => "Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==\n",
+},
+{
+ # New test
+ diffName => "custom property followed by svn:executable, empty line and start of binary contents",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: documentation
+ + This is an example sentence.
+Added: svn:executable
+ + *
+
+Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+"\n"],
+ expectedNextLine => "Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==\n",
+},
+####
+# Successive properties
+##
+{
+ # New test
+ diffName => "svn:executable followed by custom property",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: svn:executable
+ + *
+Added: documentation
+ + This is an example sentence.
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+undef],
+ expectedNextLine => undef,
+},
+{
+ # New test
+ diffName => "custom property followed by svn:executable",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: documentation
+ + This is an example sentence.
+Added: svn:executable
+ + *
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+undef],
+ expectedNextLine => undef,
+},
+####
+# Successive properties followed by empty line and start of next diff
+##
+{
+ # New test
+ diffName => "custom property followed by svn:executable, empty line and start of next property diff",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: documentation
+ + This is an example sentence.
+Added: svn:executable
+ + *
+
+Property changes on: Makefile.shared
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+"\n"],
+ expectedNextLine => "Property changes on: Makefile.shared\n",
+},
+{
+ # New test
+ diffName => "custom property followed by svn:executable, empty line and start of next index diff",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: documentation
+ + This is an example sentence.
+Added: svn:executable
+ + *
+
+Index: Makefile.shared
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => 1,
+},
+"\n"],
+ expectedNextLine => "Index: Makefile.shared\n",
+},
+####
+# Custom properties
+##
+# FIXME: We do not support anything other than the svn:executable property.
+# We should add support for handling other properties.
+{
+ # New test
+ diffName => "simple: custom property",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Name: documentation
+ + This is an example sentence.
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+},
+undef],
+ expectedNextLine => undef,
+},
+{
+ # New test
+ diffName => "custom property followed by custom property",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: copyright
+ + Copyright (C) Research in Motion Limited 2010. All Rights Reserved.
+Added: documentation
+ + This is an example sentence.
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+},
+undef],
+ expectedNextLine => undef,
+},
+####
+# Malformed property diffs
+##
+# We shouldn't encounter such diffs in practice.
+{
+ # New test
+ diffName => "svn:executable followed by custom property and svn:executable",
+ inputText => <<'END',
+Property changes on: FileA
+___________________________________________________________________
+Added: svn:executable
+ + *
+Added: documentation
+ + This is an example sentence.
+Deleted: svn:executable
+ - *
+END
+ expectedReturn => [
+{
+ propertyPath => "FileA",
+ executableBitDelta => -1,
+},
+undef],
+ expectedNextLine => undef,
+},
+);
+
+my $testCasesCount = @testCaseHashRefs;
+plan(tests => 2 * $testCasesCount); # Total number of assertions.
+
+foreach my $testCase (@testCaseHashRefs) {
+ my $testNameStart = "parseSvnDiffProperties(): $testCase->{diffName}: comparing";
+
+ my $fileHandle;
+ open($fileHandle, "<", \$testCase->{inputText});
+ my $line = <$fileHandle>;
+
+ my @got = VCSUtils::parseSvnDiffProperties($fileHandle, $line);
+ my $expectedReturn = $testCase->{expectedReturn};
+
+ is_deeply(\@got, $expectedReturn, "$testNameStart return value.");
+
+ my $gotNextLine = <$fileHandle>;
+ is($gotNextLine, $testCase->{expectedNextLine}, "$testNameStart next read line.");
+}
diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
index ac9c42e..e68ccfa 100644
--- a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
+++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
@@ -584,25 +584,32 @@ class Git(SCM):
def revert_files(self, file_paths):
self.run(['git', 'checkout', 'HEAD'] + file_paths)
+ def _get_squash_error_message(self, num_local_commits):
+ working_directory_message = "" if self.working_directory_is_clean() else " and working copy changes"
+ return ("""There are %s local commits%s. Do one of the following:
+ 1) Use --squash or --no-squash
+ 2) git config webkit-patch.squash true/false
+ """ % (num_local_commits, working_directory_message))
+
def should_squash(self, squash):
- if squash is not None:
- # Squash is specified on the command-line.
- return squash
-
- config_squash = Git.read_git_config('webkit-patch.squash')
- if (config_squash and config_squash is not ""):
- return config_squash.lower() == "true"
-
- # Only raise an error if there are actually multiple commits to squash.
- num_local_commits = len(self.local_commits())
- if num_local_commits > 1 or num_local_commits > 0 and not self.working_directory_is_clean():
- working_directory_message = "" if self.working_directory_is_clean() else " and working copy changes"
- raise ScriptError(message="""There are %s local commits%s. Do one of the following:
-1) Use --squash or --no-squash
-2) git config webkit-patch.squash true/false
-""" % (num_local_commits, working_directory_message))
-
- return None
+ if squash is None:
+ config_squash = Git.read_git_config('webkit-patch.squash')
+ if (config_squash and config_squash is not ""):
+ squash = config_squash.lower() == "true"
+ else:
+ # Only raise an error if there are actually multiple commits to squash.
+ num_local_commits = len(self.local_commits())
+ if num_local_commits > 1 or (num_local_commits > 0 and not self.working_directory_is_clean()):
+ raise ScriptError(message=self._get_squash_error_message(num_local_commits))
+
+ if squash and self._svn_branch_has_extra_commits():
+ raise ScriptError(message="Cannot use --squash when HEAD is not fully merged/rebased to %s. "
+ "This branch needs to be synced first." % self.svn_branch_name())
+
+ return squash
+
+ def _svn_branch_has_extra_commits(self):
+ return len(run_command(['git', 'rev-list', '--max-count=1', self.svn_branch_name(), '^head']))
def commit_with_message(self, message, username=None, git_commit=None, squash=None):
# Username is ignored during Git commits.
diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
index 5a2c094..b6ae388 100644
--- a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
@@ -875,6 +875,12 @@ class GitTest(SCMTest):
self.assertTrue(re.search(r'test_file_commit2', svn_log))
self.assertTrue(re.search(r'test_file_commit1', svn_log))
+ def test_commit_with_message_not_synced_squash(self):
+ run_command(['git', 'checkout', '-b', 'my-branch', 'trunk~3'])
+ self._two_local_commits()
+ scm = detect_scm_system(self.git_checkout_path)
+ self.assertRaises(ScriptError, scm.commit_with_message, "another test commit", squash=True)
+
def test_reverse_diff(self):
self._shared_test_reverse_diff()
@@ -937,6 +943,12 @@ class GitTest(SCMTest):
self.assertTrue(re.search(r'test_file_commit2', patch))
self.assertTrue(re.search(r'test_file_commit1', patch))
+ def test_create_patch_not_synced_squash(self):
+ run_command(['git', 'checkout', '-b', 'my-branch', 'trunk~3'])
+ self._two_local_commits()
+ scm = detect_scm_system(self.git_checkout_path)
+ self.assertRaises(ScriptError, scm.create_patch, squash=True)
+
def test_create_binary_patch(self):
# Create a git binary patch and check the contents.
scm = detect_scm_system(self.git_checkout_path)
@@ -1016,6 +1028,12 @@ class GitTest(SCMTest):
self.assertTrue('test_file_commit2' in files)
self.assertTrue('test_file_commit1' in files)
+ def test_changed_files_not_synced_squash(self):
+ run_command(['git', 'checkout', '-b', 'my-branch', 'trunk~3'])
+ self._two_local_commits()
+ scm = detect_scm_system(self.git_checkout_path)
+ self.assertRaises(ScriptError, scm.changed_files, squash=True)
+
def test_changed_files(self):
self._shared_test_changed_files()
diff --git a/WebKitTools/Scripts/webkitpy/common/config/committers.py b/WebKitTools/Scripts/webkitpy/common/config/committers.py
index c33d2a6..02f1aed 100644
--- a/WebKitTools/Scripts/webkitpy/common/config/committers.py
+++ b/WebKitTools/Scripts/webkitpy/common/config/committers.py
@@ -85,6 +85,7 @@ committers_unable_to_review = [
Committer("Cameron McCormack", "cam@webkit.org", "heycam"),
Committer("Carol Szabo", "carol.szabo@nokia.com"),
Committer("Chang Shu", "Chang.Shu@nokia.com"),
+ Committer("Chris Evans", "cevans@google.com"),
Committer("Chris Fleizach", "cfleizach@apple.com"),
Committer("Chris Marrin", "cmarrin@apple.com", "cmarrin"),
Committer("Chris Petersen", "cpetersen@apple.com", "cpetersen"),
@@ -163,7 +164,7 @@ committers_unable_to_review = [
Committer("Xiaomei Ji", "xji@chromium.org", "xji"),
Committer("Yael Aharon", "yael.aharon@nokia.com"),
Committer("Yaar Schnitman", ["yaar@chromium.org", "yaar@google.com"]),
- Committer("Yong Li", ["yong.li@torchmobile.com", "yong.li.webkit@gmail.com"], "yong"),
+ Committer("Yong Li", ["yong.li.webkit@gmail.com", "yong.li@torchmobile.com"], "yong"),
Committer("Yongjun Zhang", "yongjun.zhang@nokia.com"),
Committer("Yuzo Fujishima", "yuzo@google.com", "yuzo"),
Committer("Zoltan Herczeg", "zherczeg@webkit.org", "zherczeg"),
diff --git a/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py b/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py
index 074a021..26d3652 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py
@@ -104,6 +104,9 @@ class Attachment(object):
def name(self):
return self._attachment_dictionary.get("name")
+ def attach_date(self):
+ return self._attachment_dictionary.get("attach_date")
+
def review(self):
return self._attachment_dictionary.get("review")
@@ -430,6 +433,7 @@ class Bugzilla(object):
attachment[flag_name] = flag['status']
if flag['status'] == '+':
attachment[result_key] = flag['setter']
+ # Sadly show_bug.cgi?ctype=xml does not expose the flag modification date.
def _string_contents(self, soup):
# WebKit's bugzilla instance uses UTF-8.
@@ -439,8 +443,23 @@ class Bugzilla(object):
# convert from NavigableString to a real unicode() object using unicode().
return unicode(soup.string)
- def _parse_attachment_element(self, element, bug_id):
+ # Example: 2010-01-20 14:31 PST
+ # FIXME: Some bugzilla dates seem to have seconds in them?
+ # Python does not support timezones out of the box.
+ # Assume that bugzilla always uses PST (which is true for bugs.webkit.org)
+ _bugzilla_date_format = "%Y-%m-%d %H:%M"
+
+ @classmethod
+ def _parse_date(cls, date_string):
+ (date, time, time_zone) = date_string.split(" ")
+ # Ignore the timezone because python doesn't understand timezones out of the box.
+ date_string = "%s %s" % (date, time)
+ return datetime.strptime(date_string, cls._bugzilla_date_format)
+ def _date_contents(self, soup):
+ return self._parse_date(self._string_contents(soup))
+
+ def _parse_attachment_element(self, element, bug_id):
attachment = {}
attachment['bug_id'] = bug_id
attachment['is_obsolete'] = (element.has_key('isobsolete') and element['isobsolete'] == "1")
@@ -448,6 +467,7 @@ class Bugzilla(object):
attachment['id'] = int(element.find('attachid').string)
# FIXME: No need to parse out the url here.
attachment['url'] = self.attachment_url_for_id(attachment['id'])
+ attachment["attach_date"] = self._date_contents(element.find("date"))
attachment['name'] = self._string_contents(element.find('desc'))
attachment['attacher_email'] = self._string_contents(element.find('attacher'))
attachment['type'] = self._string_contents(element.find('type'))
@@ -564,6 +584,7 @@ class Bugzilla(object):
raise Exception(errorMessage)
else:
self.authenticated = True
+ self.username = username
def _fill_attachment_form(self,
description,
@@ -657,6 +678,7 @@ class Bugzilla(object):
patch_description=None,
cc=None,
blocked=None,
+ assignee=None,
mark_for_review=False,
mark_for_commit_queue=False):
self.authenticate()
@@ -679,6 +701,10 @@ class Bugzilla(object):
self.browser["cc"] = cc
if blocked:
self.browser["blocked"] = unicode(blocked)
+ if assignee == None:
+ assignee = self.username
+ if assignee:
+ self.browser["assigned_to"] = assignee
self.browser["short_desc"] = bug_title
self.browser["comment"] = bug_description
diff --git a/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py b/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py
index 62a0746..ce992e7 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py
@@ -28,6 +28,8 @@
import unittest
+import datetime
+
from webkitpy.common.config.committers import CommitterList, Reviewer, Committer
from webkitpy.common.net.bugzilla import Bugzilla, BugzillaQueries, parse_bug_id, CommitterValidator, Bug
from webkitpy.common.system.outputcapture import OutputCapture
@@ -97,6 +99,7 @@ class BugzillaTest(unittest.TestCase):
</attachment>
'''
_expected_example_attachment_parsing = {
+ 'attach_date': datetime.datetime(2009, 07, 29, 10, 23),
'bug_id' : 100,
'is_obsolete' : True,
'is_patch' : True,
@@ -204,6 +207,7 @@ ZEZpbmlzaExvYWRXaXRoUmVhc29uOnJlYXNvbl07Cit9CisKIEBlbmQKIAogI2VuZGlmCg==
"reporter_email" : "eric@webkit.org",
"assigned_to_email" : "webkit-unassigned@lists.webkit.org",
"attachments" : [{
+ "attach_date": datetime.datetime(2009, 12, 27, 23, 51),
'name': u'Patch',
'url' : "https://bugs.webkit.org/attachment.cgi?id=45548",
'is_obsolete': False,
diff --git a/WebKitTools/Scripts/webkitpy/common/net/statusserver.py b/WebKitTools/Scripts/webkitpy/common/net/statusserver.py
index d9b52a2..0bd68d1 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/statusserver.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/statusserver.py
@@ -31,9 +31,13 @@ from webkitpy.common.system.deprecated_logging import log
from webkitpy.thirdparty.autoinstalled.mechanize import Browser
from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup
+import logging
import urllib2
+_log = logging.getLogger("webkitpy.common.net.statusserver")
+
+
class StatusServer:
default_host = "webkit-commit-queue.appspot.com"
@@ -83,6 +87,19 @@ class StatusServer:
self.browser["broken_bot"] = broken_bot
return self.browser.submit().read()
+ def _post_work_items_to_server(self, queue_name, work_items):
+ update_work_items_url = "%s/update-work-items" % self.url
+ self.browser.open(update_work_items_url)
+ self.browser.select_form(name="update_work_items")
+ self.browser["queue_name"] = queue_name
+ work_items = map(unicode, work_items) # .join expects strings
+ self.browser["work_items"] = " ".join(work_items)
+ return self.browser.submit().read()
+
+ def update_work_items(self, queue_name, work_items):
+ _log.debug("Recording work items: %s for %s" % (work_items, queue_name))
+ return NetworkTransaction().run(lambda: self._post_work_items_to_server(queue_name, work_items))
+
def update_status(self, queue_name, status, patch=None, results_file=None):
log(status)
return NetworkTransaction().run(lambda: self._post_status_to_server(queue_name, status, patch, results_file))
diff --git a/WebKitTools/Scripts/webkitpy/common/system/executive.py b/WebKitTools/Scripts/webkitpy/common/system/executive.py
index c7a7aec..9c5889b 100644
--- a/WebKitTools/Scripts/webkitpy/common/system/executive.py
+++ b/WebKitTools/Scripts/webkitpy/common/system/executive.py
@@ -41,6 +41,7 @@ import StringIO
import signal
import subprocess
import sys
+import time
from webkitpy.common.system.deprecated_logging import tee
@@ -255,6 +256,18 @@ class Executive(object):
input = input.encode("utf-8")
return (subprocess.PIPE, input)
+ def _command_for_printing(self, args):
+ """Returns a print-ready string representing command args.
+ The string should be copy/paste ready for execution in a shell."""
+ escaped_args = []
+ for arg in args:
+ if isinstance(arg, unicode):
+ # Escape any non-ascii characters for easy copy/paste
+ arg = arg.encode("unicode_escape")
+ # FIXME: Do we need to fix quotes here?
+ escaped_args.append(arg)
+ return " ".join(escaped_args)
+
# FIXME: run_and_throw_if_fail should be merged into this method.
def run_command(self,
args,
@@ -265,6 +278,8 @@ class Executive(object):
return_stderr=True,
decode_output=True):
"""Popen wrapper for convenience and to work around python bugs."""
+ assert(isinstance(args, list) or isinstance(args, tuple))
+ start_time = time.time()
args = map(unicode, args) # Popen will throw an exception if args are non-strings (like int())
stdin, string_to_communicate = self._compute_stdin(input)
stderr = subprocess.STDOUT if return_stderr else None
@@ -283,6 +298,8 @@ class Executive(object):
# http://bugs.python.org/issue1731717
exit_code = process.wait()
+ _log.debug('"%s" took %.2fs' % (self._command_for_printing(args), time.time() - start_time))
+
if return_exit_code:
return exit_code
diff --git a/WebKitTools/Scripts/webkitpy/common/system/executive_unittest.py b/WebKitTools/Scripts/webkitpy/common/system/executive_unittest.py
index 30468ce..32f8f51 100644
--- a/WebKitTools/Scripts/webkitpy/common/system/executive_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/common/system/executive_unittest.py
@@ -32,7 +32,7 @@ import subprocess
import sys
import unittest
-from webkitpy.common.system.executive import Executive, run_command
+from webkitpy.common.system.executive import Executive, run_command, ScriptError
class ExecutiveTest(unittest.TestCase):
@@ -42,6 +42,13 @@ class ExecutiveTest(unittest.TestCase):
run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True)
self.failUnlessRaises(OSError, run_bad_command)
+ def test_run_command_args_type(self):
+ executive = Executive()
+ self.assertRaises(AssertionError, executive.run_command, "echo")
+ self.assertRaises(AssertionError, executive.run_command, u"echo")
+ executive.run_command(["echo", "foo"])
+ executive.run_command(("echo", "foo"))
+
def test_run_command_with_unicode(self):
"""Validate that it is safe to pass unicode() objects
to Executive.run* methods, and they will return unicode()
diff --git a/WebKitTools/Scripts/webkitpy/common/system/user.py b/WebKitTools/Scripts/webkitpy/common/system/user.py
index edce93d..4fa2fa3 100644
--- a/WebKitTools/Scripts/webkitpy/common/system/user.py
+++ b/WebKitTools/Scripts/webkitpy/common/system/user.py
@@ -30,6 +30,7 @@ import logging
import os
import shlex
import subprocess
+import sys
import webbrowser
diff --git a/WebKitTools/Scripts/webkitpy/common/thread/threadedmessagequeue.py b/WebKitTools/Scripts/webkitpy/common/thread/threadedmessagequeue.py
index 6cb6f8c..17b6277 100644
--- a/WebKitTools/Scripts/webkitpy/common/thread/threadedmessagequeue.py
+++ b/WebKitTools/Scripts/webkitpy/common/thread/threadedmessagequeue.py
@@ -26,6 +26,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import with_statement
+
import threading
@@ -36,20 +38,17 @@ class ThreadedMessageQueue(object):
self._lock = threading.Lock()
def post(self, message):
- self._lock.acquire()
- self._messages.append(message)
- self._lock.release()
+ with self._lock:
+ self._messages.append(message)
def stop(self):
- self._lock.acquire()
- self._is_running = False
- self._lock.release()
+ with self._lock:
+ self._is_running = False
def take_all(self):
- self._lock.acquire()
- messages = self._messages
- is_running = self._is_running
- self._messages = []
- self._lock.release()
+ with self._lock:
+ messages = self._messages
+ is_running = self._is_running
+ self._messages = []
return (messages, is_running)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-bg.html b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-bg.html
new file mode 100644
index 0000000..2022676
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-bg.html
@@ -0,0 +1,22 @@
+<html>
+ <head>
+ <style>
+ div { background: -webkit-canvas(squares); width:600px; height:600px; border:2px solid black }
+ </style>
+
+ <script type="application/x-javascript">
+function draw(w, h) {
+ var ctx = document.getCSSCanvasContext("2d", "squares", w, h);
+
+ ctx.fillStyle = "rgb(200,0,0)";
+ ctx.fillRect (10, 10, 55, 50);
+
+ ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
+ ctx.fillRect (30, 30, 55, 50);
+}
+ </script>
+ </head>
+ <body onload="draw(300, 300)">
+ <div></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.checksum b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.checksum
new file mode 100644
index 0000000..7373fe2
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.checksum
@@ -0,0 +1 @@
+afa0f2d246120c180005d67d47636b92 \ No newline at end of file
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.png b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.png
new file mode 100644
index 0000000..44952b4
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.png
Binary files differ
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.txt b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.txt
new file mode 100644
index 0000000..288458d
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom-expected.txt
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 624x18
+ text run at (0,0) width 624: "These should be four green hollow boxes with dimensions 600x300, 100x300, 600x100, 100x100."
+ RenderBlock (anonymous) at (0,34) size 784x420
+ RenderHTMLCanvas {CANVAS} at (0,0) size 606x306 [border: (3px solid #008000)]
+ RenderText {#text} at (606,292) size 4x18
+ text run at (606,292) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+ RenderHTMLCanvas {CANVAS} at (610,0) size 106x306 [border: (3px solid #008000)]
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+ RenderHTMLCanvas {CANVAS} at (0,310) size 606x106 [border: (3px solid #008000)]
+ RenderText {#text} at (606,402) size 4x18
+ text run at (606,402) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+ RenderHTMLCanvas {CANVAS} at (610,310) size 106x106 [border: (3px solid #008000)]
+ RenderText {#text} at (0,0) size 0x0
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom.html b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom.html
new file mode 100644
index 0000000..4dabce1
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/image/canvas-zoom.html
@@ -0,0 +1,15 @@
+<style>
+ canvas { border: solid green;
+ zoom: 2; }
+</style>
+<p>
+ These should be four green hollow boxes with dimensions 600x300, 100x300, 600x100, 100x100.
+</p>
+<!-- 300x150 -->
+<canvas id="canvas"></canvas>
+<!-- 50x150 -->
+<canvas id="canvas" width="50"></canvas>
+<!-- 300x50 -->
+<canvas id="canvas" height="50"></canvas>
+<!-- 50x50 -->
+<canvas id="canvas" width="50" height="50"></canvas>
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash-expected.txt b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash-expected.txt
new file mode 100644
index 0000000..521c3f5
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash-expected.txt
@@ -0,0 +1 @@
+This test is expected to crash.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash.html b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash.html
new file mode 100644
index 0000000..b9820d6
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/crash.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+This test is expected to crash.
+</body>
+</html>
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/missing-expectation.html b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/missing-expectation.html
new file mode 100644
index 0000000..1f00b50
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/missing-expectation.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+This test intentionally doesn't have an expected result checked in.
+</body>
+</html>
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing-expected.txt b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing-expected.txt
new file mode 100644
index 0000000..26bd316
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing-expected.txt
@@ -0,0 +1 @@
+This test is expected to pass.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing.html b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing.html
new file mode 100644
index 0000000..db7e3de
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/misc/passing.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+This test is expected to pass.
+</body>
+</html>
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.checksum b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.checksum
new file mode 100644
index 0000000..4cd8dac
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.checksum
@@ -0,0 +1 @@
+790b681a41697634fcf2a2587afb89c6 \ No newline at end of file
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.png b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.png
new file mode 100644
index 0000000..3d00450
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.png
Binary files differ
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.txt b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.txt
new file mode 100644
index 0000000..2411c0a
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/image/canvas-bg-expected.txt
@@ -0,0 +1,6 @@
+layer at (0,0) size 785x620
+ RenderView at (0,0) size 785x600
+layer at (0,0) size 785x620
+ RenderBlock {HTML} at (0,0) size 785x620
+ RenderBody {BODY} at (8,8) size 769x604
+ RenderBlock {DIV} at (0,0) size 604x604 [border: (2px solid #000000)]
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/test_expectations.txt b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/test_expectations.txt
new file mode 100644
index 0000000..b78a01c
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/platform/test/test_expectations.txt
@@ -0,0 +1 @@
+WONTFIX : misc/missing-expectation.html = MISSING PASS
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element-expected.txt b/WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element-expected.txt
new file mode 100644
index 0000000..f60ac38
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element-expected.txt
@@ -0,0 +1,20 @@
+Various tests for the article element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+<article> closes <p>:
+PASS article1.parentNode.nodeName == "p" is false
+<p> does not close <article>:
+PASS p1.parentNode.nodeName is "ARTICLE"
+<article> can be nested inside <article>:
+PASS article3.parentNode.id is "article2"
+Residual style:
+PASS getWeight("article4") is "bold"
+PASS getWeight("span1") is "bold"
+FormatBlock:
+PASS document.getElementById("span2").parentNode.nodeName is "ARTICLE"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element.html b/WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element.html
new file mode 100644
index 0000000..c0f4547
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/data/text/article-element.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/article-element.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
index 6957fcd..09f9ac7 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
@@ -425,7 +425,8 @@ class TestShellThread(threading.Thread):
# are generating a new baseline. (Otherwise, an image from a
# previous run will be copied into the baseline.)
image_hash = test_info.image_hash()
- if image_hash and self._test_args.new_baseline:
+ if (image_hash and
+ (self._test_args.new_baseline or self._test_args.reset_results)):
image_hash = ""
start = time.time()
crash, timeout, actual_checksum, output, error = \
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
index dba1194..3804210 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
@@ -239,6 +239,8 @@ class Testprinter(unittest.TestCase):
def test_print_test_result(self):
result = get_result('foo.html')
printer, err, out = self.get_printer(['--print', 'nothing'])
+ result = get_result(os.path.join(self._port.layout_tests_dir(),
+ 'foo.html'))
printer.print_test_result(result, expected=False, exp_str='',
got_str='')
self.assertTrue(err.empty())
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py
index d11f3e2..cf3c560 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py
@@ -98,19 +98,18 @@ class TestExpectationsTest(unittest.TestCase):
return os.path.join(self._port.layout_tests_dir(), test_name)
def get_basic_tests(self):
- return [self.get_test('fast/html/article-element.html'),
- self.get_test('fast/html/header-element.html'),
- self.get_test('fast/html/keygen.html'),
- self.get_test('fast/html/tab-order.html'),
- self.get_test('fast/events/space-scroll-event.html'),
- self.get_test('fast/events/tab-imagemap.html')]
+ return [self.get_test('text/article-element.html'),
+ self.get_test('image/canvas-bg.html'),
+ self.get_test('image/canvas-zoom.html'),
+ self.get_test('misc/crash.html'),
+ self.get_test('misc/passing.html')]
def get_basic_expectations(self):
return """
-BUG_TEST : fast/html/article-element.html = TEXT
-BUG_TEST SKIP : fast/html/keygen.html = CRASH
-BUG_TEST REBASELINE : fast/htmltab-order.html = MISSING
-BUG_TEST : fast/events = IMAGE
+BUG_TEST : text/article-element.html = TEXT
+BUG_TEST SKIP : misc/crash.html = CRASH
+BUG_TEST REBASELINE : misc/missing-expectation.html = MISSING
+BUG_TEST : image = IMAGE
"""
def parse_exp(self, expectations, overrides=None):
@@ -128,42 +127,42 @@ BUG_TEST : fast/events = IMAGE
set([result]))
def test_basic(self):
- self.parse_exp(self.get_basic_expectations())
- self.assert_exp('fast/html/article-element.html', TEXT)
- self.assert_exp('fast/events/tab-imagemap.html', IMAGE)
- self.assert_exp('fast/html/header-element.html', PASS)
+ self.parse_exp(self.get_basic_expectations())
+ self.assert_exp('text/article-element.html', TEXT)
+ self.assert_exp('image/canvas-zoom.html', IMAGE)
+ self.assert_exp('misc/passing.html', PASS)
def test_duplicates(self):
- self.assertRaises(SyntaxError, self.parse_exp, """
-BUG_TEST : fast/html/article-element.html = TEXT
-BUG_TEST : fast/html/article-element.html = IMAGE""")
- self.assertRaises(SyntaxError, self.parse_exp,
- self.get_basic_expectations(), """
-BUG_TEST : fast/html/article-element.html = TEXT
-BUG_TEST : fast/html/article-element.html = IMAGE""")
+ self.assertRaises(SyntaxError, self.parse_exp, """
+BUG_TEST : text/article-element.html = TEXT
+BUG_TEST : text/article-element.html = IMAGE""")
+ self.assertRaises(SyntaxError, self.parse_exp,
+ self.get_basic_expectations(), """
+BUG_TEST : text/article-element.html = TEXT
+BUG_TEST : text/article-element.html = IMAGE""")
def test_overrides(self):
- self.parse_exp(self.get_basic_expectations(), """
-BUG_OVERRIDE : fast/html/article-element.html = IMAGE""")
- self.assert_exp('fast/html/article-element.html', IMAGE)
+ self.parse_exp(self.get_basic_expectations(), """
+BUG_OVERRIDE : text/article-element.html = IMAGE""")
+ self.assert_exp('text/article-element.html', IMAGE)
def test_matches_an_expected_result(self):
- def match(test, result, pixel_tests_enabled):
- return self._exp.matches_an_expected_result(
- self.get_test(test), result, pixel_tests_enabled)
+ def match(test, result, pixel_tests_enabled):
+ return self._exp.matches_an_expected_result(
+ self.get_test(test), result, pixel_tests_enabled)
- self.parse_exp(self.get_basic_expectations())
- self.assertTrue(match('fast/html/article-element.html', TEXT, True))
- self.assertTrue(match('fast/html/article-element.html', TEXT, False))
- self.assertFalse(match('fast/html/article-element.html', CRASH, True))
- self.assertFalse(match('fast/html/article-element.html', CRASH, False))
+ self.parse_exp(self.get_basic_expectations())
+ self.assertTrue(match('text/article-element.html', TEXT, True))
+ self.assertTrue(match('text/article-element.html', TEXT, False))
+ self.assertFalse(match('text/article-element.html', CRASH, True))
+ self.assertFalse(match('text/article-element.html', CRASH, False))
- self.assertTrue(match('fast/events/tab-imagemap.html', IMAGE, True))
- self.assertTrue(match('fast/events/tab-imagemap.html', PASS, False))
+ self.assertTrue(match('image/canvas-bg.html', IMAGE, True))
+ self.assertTrue(match('image/canvas-bg.html', PASS, False))
- self.assertTrue(match('fast/html/keygen.html', SKIP, False))
- self.assertTrue(match('fast/html/tab-order.html', PASS, False))
+ self.assertTrue(match('misc/crash.html', SKIP, False))
+ self.assertTrue(match('misc/passing.html', PASS, False))
if __name__ == '__main__':
unittest.main()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
index a4cbe42..782c87c 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
@@ -423,7 +423,7 @@ class Port(object):
Returns:
Operating-system's environment.
"""
- return os.environ
+ return os.environ.copy()
def show_html_results_file(self, results_filename):
"""This routine should display the HTML file pointed at by
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
index bcbd498..b715f7b 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -158,9 +158,8 @@ class ChromiumPort(base.Port):
return self.path_from_chromium_base('webkit',
self._options.configuration, self._options.results_directory)
except AssertionError:
- return self.path_from_webkit_base('WebKit', 'chromium',
- 'xcodebuild', self._options.configuration,
- self._options.results_directory)
+ return self._build_path(self._options.configuration,
+ self._options.results_directory)
def setup_test_run(self):
# Delete the disk cache if any to ensure a clean test run.
@@ -273,6 +272,12 @@ class ChromiumPort(base.Port):
platform = self.name()
return self.path_from_webkit_base('LayoutTests', 'platform', platform)
+ def _path_to_image_diff(self):
+ binary_name = 'image_diff'
+ if self._options.use_drt:
+ binary_name = 'ImageDiff'
+ return self._build_path(self._options.configuration, binary_name)
+
class ChromiumDriver(base.Driver):
"""Abstract interface for test_shell."""
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
index 979e225..0818d51 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
@@ -81,11 +81,15 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
#
def _build_path(self, *comps):
- base = self.path_from_chromium_base()
+ if self._options.use_drt:
+ base = os.path.join(self.path_from_webkit_base(), 'WebKit',
+ 'chromium')
+ else:
+ base = self.path_from_chromium_base()
if os.path.exists(os.path.join(base, 'sconsbuild')):
- return self.path_from_chromium_base('sconsbuild', *comps)
+ return os.path.join(base, 'sconsbuild', *comps)
else:
- return self.path_from_chromium_base('out', *comps)
+ return os.path.join(base, 'out', *comps)
def _check_apache_install(self):
result = chromium.check_file_exists(self._path_to_apache(),
@@ -147,14 +151,14 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
def _path_to_driver(self, configuration=None):
if not configuration:
configuration = self._options.configuration
- return self._build_path(configuration, 'test_shell')
+ binary_name = 'test_shell'
+ if self._options.use_drt:
+ binary_name = 'DumpRenderTree'
+ return self._build_path(configuration, binary_name)
def _path_to_helper(self):
return None
- def _path_to_image_diff(self):
- return self._build_path(self._options.configuration, 'image_diff')
-
def _path_to_wdiff(self):
if self._is_redhat_based():
return '/usr/bin/dwdiff'
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
index ba67a3e..aa3ac8d 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
@@ -150,12 +150,6 @@ class ChromiumMacPort(chromium.ChromiumPort):
binary_name = 'LayoutTestHelper'
return self._build_path(self._options.configuration, binary_name)
- def _path_to_image_diff(self):
- binary_name = 'image_diff'
- if self._options.use_drt:
- binary_name = 'ImageDiff'
- return self._build_path(self._options.configuration, binary_name)
-
def _path_to_wdiff(self):
return 'wdiff'
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
index 95d6378..a32eafd 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
@@ -27,6 +27,9 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import chromium
+import chromium_linux
+import chromium_mac
+import chromium_win
import unittest
import StringIO
@@ -78,3 +81,17 @@ class ChromiumDriverTest(unittest.TestCase):
raise IOError
self.driver._proc.stdout.readline = mock_readline
self._assert_write_command_and_read_line(expected_crash=True)
+
+ def test_path_to_image_diff(self):
+ class MockOptions:
+ def __init__(self):
+ self.use_drt = True
+
+ port = chromium_linux.ChromiumLinuxPort('test-port', options=MockOptions())
+ self.assertTrue(port._path_to_image_diff().endswith(
+ '/out/Release/ImageDiff'))
+ port = chromium_mac.ChromiumMacPort('test-port', options=MockOptions())
+ self.assertTrue(port._path_to_image_diff().endswith(
+ '/xcodebuild/Release/ImageDiff'))
+ # FIXME: Figure out how this is going to work on Windows.
+ #port = chromium_win.ChromiumWinPort('test-port', options=MockOptions())
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
index ad78e61..3b11429 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
@@ -64,7 +64,7 @@ class ChromiumWinPort(chromium.ChromiumPort):
setup_mount = self.path_from_chromium_base("third_party",
"cygwin",
"setup_mount.bat")
- self._executive.run_command(setup_mount)
+ self._executive.run_command([setup_mount])
return env
def baseline_search_path(self):
@@ -117,6 +117,9 @@ class ChromiumWinPort(chromium.ChromiumPort):
#
def _build_path(self, *comps):
+ if self._options.use_drt:
+ return os.path.join(self.path_from_webkit_base(), 'WebKit',
+ 'chromium', *comps)
p = self.path_from_chromium_base('webkit', *comps)
if os.path.exists(p):
return p
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
new file mode 100644
index 0000000..81db32c
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import sys
+import unittest
+import chromium_win
+from webkitpy.common.system import outputcapture
+from webkitpy.tool import mocktool
+
+
+class ChromiumWinTest(unittest.TestCase):
+
+ class RegisterCygwinOption(object):
+ def __init__(self):
+ self.register_cygwin = True
+
+ def setUp(self):
+ self.orig_platform = sys.platform
+
+ def tearDown(self):
+ sys.platform = self.orig_platform
+
+ def _mock_path_from_chromium_base(self, *comps):
+ return os.path.join("/chromium/src", *comps)
+
+ def test_setup_environ_for_server(self):
+ port = chromium_win.ChromiumWinPort()
+ port._executive = mocktool.MockExecute(True)
+ port.path_from_chromium_base = self._mock_path_from_chromium_base
+ output = outputcapture.OutputCapture()
+ orig_environ = os.environ.copy()
+ env = output.assert_outputs(self, port.setup_environ_for_server)
+ self.assertEqual(orig_environ["PATH"], os.environ["PATH"])
+ self.assertNotEqual(env["PATH"], os.environ["PATH"])
+
+ def test_setup_environ_for_server_register_cygwin(self):
+ sys.platform = "win32"
+ port = chromium_win.ChromiumWinPort(
+ options=ChromiumWinTest.RegisterCygwinOption())
+ port._executive = mocktool.MockExecute(True)
+ port.path_from_chromium_base = self._mock_path_from_chromium_base
+ setup_mount = self._mock_path_from_chromium_base("third_party",
+ "cygwin",
+ "setup_mount.bat")
+ expected_stderr = "MOCK run_command: %s\n" % [setup_mount]
+ output = outputcapture.OutputCapture()
+ output.assert_outputs(self, port.setup_environ_for_server,
+ expected_stderr=expected_stderr)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
index 2c92865..e01bd2f 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
@@ -143,7 +143,7 @@ class DryrunDriver(base.Driver):
text_filename = self._port.expected_filename(test_name, '.txt')
text_output = _read_file(text_filename)
- if image_hash:
+ if image_hash is not None:
image_filename = self._port.expected_filename(test_name, '.png')
image = _read_file(image_filename, 'rb')
if self._image_path:
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
index 5d563cd..e6d4c99 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
@@ -28,7 +28,9 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Dummy Port implementation used for testing."""
+from __future__ import with_statement
+import codecs
import os
import time
@@ -45,9 +47,8 @@ class TestPort(base.Port):
return ('test',)
def baseline_path(self):
- curdir = os.path.abspath(__file__)
- self.topdir = curdir[0:curdir.index("WebKitTools")]
- return os.path.join(self.topdir, 'LayoutTests', 'platform', 'test')
+ return os.path.join(self.layout_tests_dir(), 'platform',
+ self.name())
def baseline_search_path(self):
return [self.baseline_path()]
@@ -66,12 +67,9 @@ class TestPort(base.Port):
expected_filename, actual_filename):
return ''
- def relative_test_filename(self, filename):
- return filename
-
- def expected_filename(self, filename, suffix):
- (basename, ext) = os.path.splitext(filename)
- return basename + '.' + suffix
+ def layout_tests_dir(self):
+ return self.path_from_webkit_base('WebKitTools', 'Scripts',
+ 'webkitpy', 'layout_tests', 'data')
def name(self):
return self._name
@@ -79,6 +77,11 @@ class TestPort(base.Port):
def options(self):
return self._options
+ def path_to_test_expectations_file(self):
+ return self.path_from_webkit_base('WebKitTools', 'Scripts',
+ 'webkitpy', 'layout_tests', 'data', 'platform', 'test',
+ 'test_expectations.txt')
+
def results_directory(self):
return '/tmp/' + self._options.results_directory
@@ -104,7 +107,13 @@ class TestPort(base.Port):
pass
def test_expectations(self):
- return ''
+ """Returns the test expectations for this port.
+
+ Basically this string should contain the equivalent of a
+ test_expectations file. See test_expectations.py for more details."""
+ expectations_path = self.path_to_test_expectations_file()
+ with codecs.open(expectations_path, "r", "utf-8") as file:
+ return file.read()
def test_base_platform_names(self):
return ('test',)
@@ -129,6 +138,7 @@ class TestDriver(base.Driver):
self._driver_options = test_driver_options
self._image_path = image_path
self._port = port
+ self._image_written = False
def poll(self):
return True
@@ -137,6 +147,15 @@ class TestDriver(base.Driver):
return 0
def run_test(self, uri, timeoutms, image_hash):
+ if not self._image_written and self._port._options.pixel_tests:
+ with open(self._image_path, "w") as f:
+ f.write("bad png file from TestDriver")
+ self._image_written = True
+
+ # We special-case this because we can't fake an image hash for a
+ # missing expectation.
+ if uri.find('misc/missing-expectation') != -1:
+ return (False, False, 'deadbeefdeadbeefdeadbeefdeadbeef', '', None)
return (False, False, image_hash, '', None)
def start(self):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
index 148174d..6d5543d 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -575,6 +575,7 @@ class TestRunner:
test_args.png_path = png_path
test_args.new_baseline = self._options.new_baseline
+ test_args.reset_results = self._options.reset_results
test_args.show_sources = self._options.sources
@@ -1521,6 +1522,9 @@ def parse_args(args=None):
default=False, help="Save all generated results as new baselines "
"into the platform directory, overwriting whatever's "
"already there."),
+ optparse.make_option("--reset-results", action="store_true",
+ default=False, help="Reset any existing baselines to the "
+ "generated results"),
optparse.make_option("--no-show-results", action="store_false",
default=True, dest="show_results",
help="Don't launch a browser with results after the tests "
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
index e050cba..1c751d6 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -29,6 +29,7 @@
"""Unit tests for run_webkit_tests."""
+import codecs
import os
import sys
import unittest
@@ -62,39 +63,99 @@ def logging_run(args):
class MainTest(unittest.TestCase):
def test_fast(self):
+ self.assertTrue(passing_run(['--platform', 'test']))
+ self.assertTrue(passing_run(['--platform', 'test', '--run-singly']))
self.assertTrue(passing_run(['--platform', 'test',
- 'fast/html']))
- self.assertTrue(passing_run(['--platform', 'test',
- '--run-singly',
- 'fast/html']))
- self.assertTrue(passing_run(['--platform', 'test',
- 'fast/html/article-element.html']))
+ 'text/article-element.html']))
self.assertTrue(passing_run(['--platform', 'test',
'--child-processes', '1',
- '--print', 'unexpected',
- 'fast/html']))
+ '--print', 'unexpected']))
def test_child_processes(self):
(res, buildbot_output, regular_output) = logging_run(
['--platform', 'test', '--print', 'config', '--child-processes',
- '1', 'fast/html'])
+ '1'])
self.assertTrue('Running one DumpRenderTree\n'
in regular_output.get())
(res, buildbot_output, regular_output) = logging_run(
['--platform', 'test', '--print', 'config', '--child-processes',
- '2', 'fast/html'])
+ '2'])
self.assertTrue('Running 2 DumpRenderTrees in parallel\n'
in regular_output.get())
def test_last_results(self):
- passing_run(['--platform', 'test', 'fast/html'])
+ passing_run(['--platform', 'test'])
(res, buildbot_output, regular_output) = logging_run(
['--platform', 'test', '--print-last-failures'])
self.assertEqual(regular_output.get(), ['\n\n'])
self.assertEqual(buildbot_output.get(), [])
+def _mocked_open(original_open, file_list):
+ def _wrapper(name, mode, encoding):
+ if name.find("-expected.") != -1 and mode == "w":
+ # we don't want to actually write new baselines, so stub these out
+ name.replace('\\', '/')
+ file_list.append(name)
+ return original_open(os.devnull, mode, encoding)
+ return original_open(name, mode, encoding)
+ return _wrapper
+
+
+class RebaselineTest(unittest.TestCase):
+ def assertBaselines(self, file_list, file):
+ "assert that the file_list contains the baselines."""
+ for ext in [".txt", ".png", ".checksum"]:
+ baseline = file + "-expected" + ext
+ self.assertTrue(any(f.find(baseline) != -1 for f in file_list))
+
+ def test_reset_results(self):
+ file_list = []
+ original_open = codecs.open
+ try:
+ # Test that we update expectations in place. If the expectation
+ # is mssing, update the expected generic location.
+ file_list = []
+ codecs.open = _mocked_open(original_open, file_list)
+ passing_run(['--platform', 'test', '--pixel-tests',
+ '--reset-results',
+ 'image/canvas-bg.html',
+ 'image/canvas-zoom.html',
+ 'misc/missing-expectation.html'])
+ self.assertEqual(len(file_list), 9)
+ self.assertBaselines(file_list,
+ "data/image/canvas-zoom")
+ self.assertBaselines(file_list,
+ "data/platform/test/image/canvas-bg")
+ self.assertBaselines(file_list,
+ "data/misc/missing-expectation")
+ finally:
+ codecs.open = original_open
+
+ def test_new_baseline(self):
+ file_list = []
+ original_open = codecs.open
+ try:
+ # Test that we update the platform expectations. If the expectation
+ # is mssing, then create a new expectation in the platform dir.
+ file_list = []
+ codecs.open = _mocked_open(original_open, file_list)
+ passing_run(['--platform', 'test', '--pixel-tests',
+ '--new-baseline',
+ 'image/canvas-zoom.html',
+ 'image/canvas-bg.html',
+ 'misc/missing-expectation.html'])
+ self.assertEqual(len(file_list), 9)
+ self.assertBaselines(file_list,
+ "data/platform/test/image/canvas-zoom")
+ self.assertBaselines(file_list,
+ "data/platform/test/image/canvas-bg")
+ self.assertBaselines(file_list,
+ "data/platform/test/misc/missing-expectation")
+ finally:
+ codecs.open = original_open
+
class TestRunnerTest(unittest.TestCase):
def test_results_html(self):
mock_port = Mock()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
index b37f4b3..fe73a7b 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
@@ -73,18 +73,24 @@ class ImageDiff(test_type_base.TestTypeBase):
if errno.ENOENT != e.errno:
raise
- def _save_baseline_files(self, filename, png_path, checksum):
+ def _save_baseline_files(self, filename, png_path, checksum,
+ generate_new_baseline):
"""Saves new baselines for the PNG and checksum.
Args:
filename: test filename
png_path: path to the actual PNG result file
checksum: value of the actual checksum result
+ generate_new_baseline: whether to generate a new, platform-specific
+ baseline, or update the existing one
"""
with open(png_path, "rb") as png_file:
png_data = png_file.read()
- self._save_baseline_data(filename, png_data, ".png", encoding=None)
- self._save_baseline_data(filename, checksum, ".checksum", encoding="ascii")
+ self._save_baseline_data(filename, png_data, ".png", encoding=None,
+ generate_new_baseline=generate_new_baseline)
+ self._save_baseline_data(filename, checksum, ".checksum",
+ encoding="ascii",
+ generate_new_baseline=generate_new_baseline)
def _create_image_diff(self, port, filename, configuration):
"""Creates the visual diff of the expected/actual PNGs.
@@ -128,9 +134,9 @@ class ImageDiff(test_type_base.TestTypeBase):
return failures
# If we're generating a new baseline, we pass.
- if test_args.new_baseline:
+ if test_args.new_baseline or test_args.reset_results:
self._save_baseline_files(filename, test_args.png_path,
- test_args.hash)
+ test_args.hash, test_args.new_baseline)
return failures
# Compare hashes.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
index cf0b9ec..8db2e3d 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
@@ -93,7 +93,8 @@ class TestTypeBase(object):
self._port.relative_test_filename(filename))
self._port.maybe_make_directory(os.path.split(output_filename)[0])
- def _save_baseline_data(self, filename, data, modifier, encoding):
+ def _save_baseline_data(self, filename, data, modifier, encoding,
+ generate_new_baseline=True):
"""Saves a new baseline file into the port's baseline directory.
The file will be named simply "<test>-expected<modifier>", suitable for
@@ -103,18 +104,25 @@ class TestTypeBase(object):
filename: path to the test file
data: result to be saved as the new baseline
modifier: type of the result file, e.g. ".txt" or ".png"
+ encoding: file encoding (none, "utf-8", etc.)
+ generate_new_baseline: whether to enerate a new, platform-specific
+ baseline, or update the existing one
"""
- relative_dir = os.path.dirname(
- self._port.relative_test_filename(filename))
- baseline_path = self._port.baseline_path()
- output_dir = os.path.join(baseline_path, relative_dir)
- output_file = os.path.basename(os.path.splitext(filename)[0] +
- self.FILENAME_SUFFIX_EXPECTED + modifier)
+ if generate_new_baseline:
+ relative_dir = os.path.dirname(
+ self._port.relative_test_filename(filename))
+ baseline_path = self._port.baseline_path()
+ output_dir = os.path.join(baseline_path, relative_dir)
+ output_file = os.path.basename(os.path.splitext(filename)[0] +
+ self.FILENAME_SUFFIX_EXPECTED + modifier)
+ self._port.maybe_make_directory(output_dir)
+ output_path = os.path.join(output_dir, output_file)
+ _log.debug('writing new baseline result "%s"' % (output_path))
+ else:
+ output_path = self._port.expected_filename(filename, modifier)
+ _log.debug('resetting baseline result "%s"' % output_path)
- self._port.maybe_make_directory(output_dir)
- output_path = os.path.join(output_dir, output_file)
- _log.debug('writing new baseline to "%s"' % (output_path))
self._write_into_file_at_path(output_path, data, encoding)
def output_filename(self, filename, modifier):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
index 9fed474..18f74b8 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
@@ -89,11 +89,12 @@ class TestTextDiff(test_type_base.TestTypeBase):
failures = []
# If we're generating a new baseline, we pass.
- if test_args.new_baseline:
+ if test_args.new_baseline or test_args.reset_results:
# Although all test_shell/DumpRenderTree output should be utf-8,
# we do not ever decode it inside run-webkit-tests. For some tests
# DumpRenderTree may not output utf-8 text (e.g. webarchives).
- self._save_baseline_data(filename, output, ".txt", encoding=None)
+ self._save_baseline_data(filename, output, ".txt", encoding=None,
+ generate_new_baseline=test_args.new_baseline)
return failures
# Normalize text to diff
diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py
index 59a3d39..8fc86c3 100644
--- a/WebKitTools/Scripts/webkitpy/style/checker.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker.py
@@ -43,7 +43,6 @@ from error_handlers import DefaultStyleErrorHandler
from filter import FilterConfiguration
from optparser import ArgumentParser
from optparser import DefaultCommandOptionValues
-from webkitpy.style_references import parse_patch
from webkitpy.style_references import configure_logging as _configure_logging
_log = logging.getLogger("webkitpy.style.checker")
@@ -697,42 +696,3 @@ class StyleProcessor(ProcessorBase):
_log.debug("Using class: " + checker.__class__.__name__)
checker.check(lines)
-
-
-class PatchReader(object):
-
- """Supports checking style in patches."""
-
- def __init__(self, text_file_reader):
- """Create a PatchReader instance.
-
- Args:
- text_file_reader: A TextFileReader instance.
-
- """
- self._text_file_reader = text_file_reader
-
- def check(self, patch_string):
- """Check style in the given patch."""
- patch_files = parse_patch(patch_string)
-
- # The diff variable is a DiffFile instance.
- for path, diff in patch_files.iteritems():
- line_numbers = set()
- for line in diff.lines:
- # When deleted line is not set, it means that
- # the line is newly added (or modified).
- if not line[0]:
- line_numbers.add(line[1])
-
- _log.debug('Found %s new or modified lines in: %s'
- % (len(line_numbers), path))
-
- # If line_numbers is empty, the file has no new or
- # modified lines. In this case, we don't check the file
- # because we'll never output errors for the file.
- # This optimization also prevents the program from exiting
- # due to a deleted file.
- if line_numbers:
- self._text_file_reader.process_file(file_path=path,
- line_numbers=line_numbers)
diff --git a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
index 6e1eaa2..e99ac68 100755
--- a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
@@ -39,7 +39,6 @@ import os
import unittest
import checker as style
-from webkitpy.style_references import parse_patch
from webkitpy.style_references import LogTesting
from webkitpy.style_references import TestLogStream
from checker import _BASE_FILTER_RULES
@@ -50,7 +49,6 @@ from checker import check_webkit_style_configuration
from checker import check_webkit_style_parser
from checker import configure_logging
from checker import CheckerDispatcher
-from checker import PatchReader
from checker import ProcessorBase
from checker import StyleProcessor
from checker import StyleProcessorConfiguration
@@ -769,52 +767,3 @@ class StyleProcessor_CodeCoverageTest(LoggingTestCase):
self.assertRaises(AssertionError, self._processor.process,
lines=['line1', 'line2'], file_path=path,
line_numbers=[100])
-
-
-class PatchReaderTest(unittest.TestCase):
-
- """Test the PatchReader class."""
-
- class MockTextFileReader(object):
-
- def __init__(self):
- self.passed_to_process_file = []
- """A list of (file_path, line_numbers) pairs."""
-
- def process_file(self, file_path, line_numbers):
- self.passed_to_process_file.append((file_path, line_numbers))
-
- def setUp(self):
- file_reader = self.MockTextFileReader()
- self._file_reader = file_reader
- self._patch_checker = PatchReader(file_reader)
-
- def _call_check_patch(self, patch_string):
- self._patch_checker.check(patch_string)
-
- def _assert_checked(self, passed_to_process_file):
- self.assertEquals(self._file_reader.passed_to_process_file,
- passed_to_process_file)
-
- def test_check_patch(self):
- # The modified line_numbers array for this patch is: [2].
- self._call_check_patch("""diff --git a/__init__.py b/__init__.py
-index ef65bee..e3db70e 100644
---- a/__init__.py
-+++ b/__init__.py
-@@ -1,1 +1,2 @@
- # Required for Python to search this directory for module files
-+# New line
-""")
- self._assert_checked([("__init__.py", set([2]))])
-
- def test_check_patch_with_deletion(self):
- self._call_check_patch("""Index: __init__.py
-===================================================================
---- __init__.py (revision 3593)
-+++ __init__.py (working copy)
-@@ -1 +0,0 @@
--foobar
-""")
- # _mock_check_file should not be called for the deletion patch.
- self._assert_checked([])
diff --git a/WebKitTools/Scripts/webkitpy/style/patchreader.py b/WebKitTools/Scripts/webkitpy/style/patchreader.py
new file mode 100644
index 0000000..7ba2b66
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/style/patchreader.py
@@ -0,0 +1,75 @@
+# Copyright (C) 2010 Google Inc. All rights reserved.
+# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
+# Copyright (C) 2010 ProFUSION embedded systems
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+
+from webkitpy.common.checkout.diff_parser import DiffParser
+
+
+_log = logging.getLogger("webkitpy.style.patchreader")
+
+
+class PatchReader(object):
+
+ """Supports checking style in patches."""
+
+ def __init__(self, text_file_reader):
+ """Create a PatchReader instance.
+
+ Args:
+ text_file_reader: A TextFileReader instance.
+
+ """
+ self._text_file_reader = text_file_reader
+
+ def check(self, patch_string):
+ """Check style in the given patch."""
+ patch_files = DiffParser(patch_string.splitlines()).files
+
+ # The diff variable is a DiffFile instance.
+ for path, diff in patch_files.iteritems():
+ line_numbers = set()
+ for line in diff.lines:
+ # When deleted line is not set, it means that
+ # the line is newly added (or modified).
+ if not line[0]:
+ line_numbers.add(line[1])
+
+ _log.debug('Found %s new or modified lines in: %s'
+ % (len(line_numbers), path))
+
+ # If line_numbers is empty, the file has no new or
+ # modified lines. In this case, we don't check the file
+ # because we'll never output errors for the file.
+ # This optimization also prevents the program from exiting
+ # due to a deleted file.
+ if line_numbers:
+ self._text_file_reader.process_file(file_path=path,
+ line_numbers=line_numbers)
diff --git a/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py b/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py
new file mode 100644
index 0000000..10791e4
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2010 Google Inc. All rights reserved.
+# Copyright (C) 2009 Torch Mobile Inc.
+# Copyright (C) 2009 Apple Inc. All rights reserved.
+# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+
+from webkitpy.style.patchreader import PatchReader
+
+
+class PatchReaderTest(unittest.TestCase):
+
+ """Test the PatchReader class."""
+
+ class MockTextFileReader(object):
+
+ def __init__(self):
+ self.passed_to_process_file = []
+ """A list of (file_path, line_numbers) pairs."""
+
+ def process_file(self, file_path, line_numbers):
+ self.passed_to_process_file.append((file_path, line_numbers))
+
+ def setUp(self):
+ file_reader = self.MockTextFileReader()
+ self._file_reader = file_reader
+ self._patch_checker = PatchReader(file_reader)
+
+ def _call_check_patch(self, patch_string):
+ self._patch_checker.check(patch_string)
+
+ def _assert_checked(self, passed_to_process_file):
+ self.assertEquals(self._file_reader.passed_to_process_file,
+ passed_to_process_file)
+
+ def test_check_patch(self):
+ # The modified line_numbers array for this patch is: [2].
+ self._call_check_patch("""diff --git a/__init__.py b/__init__.py
+index ef65bee..e3db70e 100644
+--- a/__init__.py
++++ b/__init__.py
+@@ -1,1 +1,2 @@
+ # Required for Python to search this directory for module files
++# New line
+""")
+ self._assert_checked([("__init__.py", set([2]))])
+
+ def test_check_patch_with_deletion(self):
+ self._call_check_patch("""Index: __init__.py
+===================================================================
+--- __init__.py (revision 3593)
++++ __init__.py (working copy)
+@@ -1 +0,0 @@
+-foobar
+""")
+ # _mock_check_file should not be called for the deletion patch.
+ self._assert_checked([])
diff --git a/WebKitTools/Scripts/webkitpy/style_references.py b/WebKitTools/Scripts/webkitpy/style_references.py
index 1bf087d..bab30ca 100644
--- a/WebKitTools/Scripts/webkitpy/style_references.py
+++ b/WebKitTools/Scripts/webkitpy/style_references.py
@@ -56,14 +56,6 @@ def detect_checkout():
return None if scm is None else WebKitCheckout(scm)
-def parse_patch(patch_string):
-
- """Parse a patch string and return the affected files."""
-
- patch = DiffParser(patch_string.splitlines())
- return patch.files
-
-
class WebKitCheckout(object):
"""Simple facade to the SCM class for use by style package."""
diff --git a/WebKitTools/Scripts/webkitpy/tool/bot/patchcollection.py b/WebKitTools/Scripts/webkitpy/tool/bot/patchcollection.py
index 9a2cdfa..6100cf8 100644
--- a/WebKitTools/Scripts/webkitpy/tool/bot/patchcollection.py
+++ b/WebKitTools/Scripts/webkitpy/tool/bot/patchcollection.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Google Inc. All rights reserved.
+# Copyright (c) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
class PersistentPatchCollectionDelegate:
def collection_name(self):
raise NotImplementedError, "subclasses must implement"
@@ -56,9 +57,22 @@ class PersistentPatchCollection:
self._status_cache[patch_id] = status
return status
- def next(self):
+ def _is_active_patch_id(self, patch_id):
+ """Active patches are patches waiting to be processed from this collection."""
+ status = self._cached_status(patch_id)
+ return not status or not self._delegate.is_terminal_status(status)
+
+ def _fetch_active_patch_ids(self):
patch_ids = self._delegate.fetch_potential_patch_ids()
- for patch_id in patch_ids:
- status = self._cached_status(patch_id)
- if not status or not self._delegate.is_terminal_status(status):
- return patch_id
+ return filter(lambda patch_id: self._is_active_patch_id(patch_id), patch_ids)
+
+ def next(self):
+ # Note: We only fetch all the ids so we can post them back to the server.
+ # This will go away once we have a feeder queue and all other queues are
+ # just pulling their next work item from the server.
+ patch_ids = self._fetch_active_patch_ids()
+ # FIXME: We're assuming self._name is a valid queue-name.
+ self._status.update_work_items(self._name, patch_ids)
+ if not patch_ids:
+ return None
+ return patch_ids[0]
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py b/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
index 7505c62..9fbfda6 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
@@ -116,6 +116,9 @@ class QtEWS(AbstractEarlyWarningSystem):
class WinEWS(AbstractEarlyWarningSystem):
name = "win-ews"
port_name = "win"
+ # Use debug, the Apple Win port fails to link Release on 32-bit Windows.
+ # https://bugs.webkit.org/show_bug.cgi?id=39197
+ _build_style = "debug"
class AbstractChromiumEWS(AbstractEarlyWarningSystem):
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py
index 3d0ddd1..27e09ba 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py
@@ -47,6 +47,7 @@ class EarlyWarningSytemTest(QueuesTest):
expected_stderr = {
"begin_work_queue": "CAUTION: %(name)s will discard all local changes in \"%(checkout_dir)s\"\nRunning WebKit %(name)s.\n" % string_replacemnts,
"handle_unexpected_error": "Mock error message\n",
+ "next_work_item": "MOCK: update_work_items: %(name)s [103]\n" % string_replacemnts,
"process_work_item": "MOCK: update_status: %(name)s Pass\n" % string_replacemnts,
}
return expected_stderr
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
index 78ca729..08bd3aa 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
@@ -135,6 +135,9 @@ class AbstractPatchQueue(AbstractQueue):
def _update_status(self, message, patch=None, results_file=None):
self.tool.status_server.update_status(self.name, message, patch, results_file)
+ def _update_work_items(self, patch_ids):
+ self.tool.status_server.update_work_items(self.name, patch_ids)
+
def _did_pass(self, patch):
self._update_status(self._pass_status, patch)
@@ -169,12 +172,21 @@ class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler):
all_patches = sum([self.tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True) for bug_id in bug_ids], [])
return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches)
+ def _patch_cmp(self, a, b):
+ # Sort first by is_rollout, then by attach_date.
+ # Reversing the order so that is_rollout is first.
+ rollout_cmp = cmp(b.is_rollout(), a.is_rollout())
+ if (rollout_cmp != 0):
+ return rollout_cmp
+ return cmp(a.attach_date(), b.attach_date())
+
def next_work_item(self):
patches = self._validate_patches_in_commit_queue()
+ patches = sorted(patches, self._patch_cmp)
+ self._update_work_items([patch.id() for patch in patches])
builders_are_green = self._builders_are_green()
if not builders_are_green:
patches = filter(lambda patch: patch.is_rollout(), patches)
- # FIXME: We could sort the patches in a specific order here, was suggested by https://bugs.webkit.org/show_bug.cgi?id=33395
if not patches:
queue_text = "queue" if builders_are_green else "rollout queue"
self._update_status("Empty %s" % queue_text)
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
index 0bd42fb..a5d56da 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
@@ -122,7 +122,8 @@ class CommitQueueTest(QueuesTest):
# FIXME: The commit-queue warns about bad committers twice. This is due to the fact that we access Attachment.reviewer() twice and it logs each time.
"next_work_item" : """Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)
Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)
-2 patches in commit-queue [197, 106]
+MOCK: update_work_items: commit-queue [106, 197]
+2 patches in commit-queue [106, 197]
""",
"process_work_item" : "MOCK: update_status: commit-queue Pass\n",
}
@@ -137,6 +138,7 @@ Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.c
# FIXME: The commit-queue warns about bad committers twice. This is due to the fact that we access Attachment.reviewer() twice and it logs each time.
"next_work_item" : """Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)
Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)
+MOCK: update_work_items: commit-queue [106, 197]
MOCK: update_status: commit-queue Builders ["Builder2"] are red. See http://build.webkit.org
1 patch in commit-queue [106]
""",
@@ -154,6 +156,7 @@ MOCK: update_status: commit-queue Builders ["Builder2"] are red. See http://buil
# FIXME: The commit-queue warns about bad committers twice. This is due to the fact that we access Attachment.reviewer() twice and it logs each time.
"next_work_item": """Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)
Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)
+MOCK: update_work_items: commit-queue [106, 197]
MOCK: update_status: commit-queue Builders ["Builder2"] are red. See http://build.webkit.org
1 patch in commit-queue [106]
""",
@@ -170,11 +173,31 @@ MOCK: update_status: commit-queue Builders ["Builder2"] are red. See http://buil
expected_run_args = ["echo", "--status-host=example.com", "build-and-test", "--force-clean", "--build", "--test", "--non-interactive", "--no-update", "--build-style=both", "--quiet"]
tool.executive.run_and_throw_if_fail.assert_called_with(expected_run_args)
+ def _mock_attachment(self, is_rollout, attach_date):
+ attachment = Mock()
+ attachment.is_rollout = lambda: is_rollout
+ attachment.attach_date = lambda: attach_date
+ return attachment
+
+ def test_patch_cmp(self):
+ long_ago_date = datetime(1900, 1, 21)
+ recent_date = datetime(2010, 1, 21)
+ attachment1 = self._mock_attachment(is_rollout=False, attach_date=recent_date)
+ attachment2 = self._mock_attachment(is_rollout=False, attach_date=long_ago_date)
+ attachment3 = self._mock_attachment(is_rollout=True, attach_date=recent_date)
+ attachment4 = self._mock_attachment(is_rollout=True, attach_date=long_ago_date)
+ attachments = [attachment1, attachment2, attachment3, attachment4]
+ expected_sort = [attachment4, attachment3, attachment2, attachment1]
+ queue = CommitQueue()
+ attachments.sort(queue._patch_cmp)
+ self.assertEqual(attachments, expected_sort)
+
class StyleQueueTest(QueuesTest):
def test_style_queue(self):
expected_stderr = {
"begin_work_queue" : "CAUTION: style-queue will discard all local changes in \"%s\"\nRunning WebKit style-queue.\n" % MockSCM.fake_checkout_root,
+ "next_work_item": "MOCK: update_work_items: style-queue [103]\n",
"should_proceed_with_work_item": "MOCK: update_status: style-queue Checking style\n",
"process_work_item" : "MOCK: update_status: style-queue Pass\n",
"handle_unexpected_error" : "Mock error message\n",
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
index 4797ef6..cf715b9 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
@@ -168,7 +168,6 @@ class Post(AbstractPatchUploadingCommand):
name = "post"
help_text = "Attach the current working directory diff to a bug as a patch file"
argument_names = "[BUGID]"
- show_in_main_help = True
steps = [
steps.CheckStyle,
steps.ConfirmDiff,
@@ -193,7 +192,6 @@ class Prepare(AbstractSequencedCommand):
name = "prepare"
help_text = "Creates a bug (or prompts for an existing bug) and prepares the ChangeLogs"
argument_names = "[BUGID]"
- show_in_main_help = True
steps = [
steps.PromptForBugOrTitle,
steps.CreateBug,
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py
index 8f6483a..d52775b 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py
@@ -55,6 +55,7 @@ class UploadCommandsTest(CommandsTest):
options.description = "MOCK description"
options.request_commit = False
options.review = True
+ options.comment = None
# Rietveld upload code requires a real SCM checkout.
options.fancy_review = False
options.cc = None
@@ -85,6 +86,7 @@ MOCK: user.open_url: http://example.com/42
options.description = "MOCK description"
options.request_commit = False
options.review = True
+ options.comment = None
# Rietveld upload code requires a real SCM checkout.
options.fancy_review = False
options.cc = None
diff --git a/WebKitTools/Scripts/webkitpy/tool/main.py b/WebKitTools/Scripts/webkitpy/tool/main.py
index 2dc177d..1f43145 100755
--- a/WebKitTools/Scripts/webkitpy/tool/main.py
+++ b/WebKitTools/Scripts/webkitpy/tool/main.py
@@ -56,6 +56,7 @@ from webkitpy.common.system.deprecated_logging import log
class WebKitPatch(MultiCommandTool):
global_options = [
+ make_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="enable all logging"),
make_option("--dry-run", action="store_true", dest="dry_run", default=False, help="do not touch remote servers"),
make_option("--status-host", action="store", dest="status_host", type="string", nargs=1, help="Hostname (e.g. localhost or commit.webkit.org) where status updates should be posted."),
make_option("--irc-password", action="store", dest="irc_password", type="string", nargs=1, help="Password to use when communicating via IRC."),
diff --git a/WebKitTools/Scripts/webkitpy/tool/mocktool.py b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
index 47fff1b..2f192d9 100644
--- a/WebKitTools/Scripts/webkitpy/tool/mocktool.py
+++ b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
@@ -477,6 +477,9 @@ class MockStatusServer(object):
def svn_revision(self, svn_revision):
return None
+ def update_work_items(self, queue_name, work_items):
+ log("MOCK: update_work_items: %s %s" % (queue_name, work_items))
+
def update_status(self, queue_name, status, patch=None, results_file=None):
log("MOCK: update_status: %s %s" % (queue_name, status))
return 187
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/options.py b/WebKitTools/Scripts/webkitpy/tool/steps/options.py
index 524a252..186d292 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/options.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/options.py
@@ -36,6 +36,7 @@ class Options(object):
check_style = make_option("--ignore-style", action="store_false", dest="check_style", default=True, help="Don't check to see if the patch has proper style before uploading.")
clean = make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches")
close_bug = make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing.")
+ comment = make_option("--comment", action="store", type="string", dest="comment", help="Comment to post to bug.")
component = make_option("--component", action="store", type="string", dest="component", help="Component for the new bug.")
confirm = make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Skip confirmation steps.")
description = make_option("-m", "--description", action="store", type="string", dest="description", help="Description string for the attachment (default: \"patch\")")
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/postdiff.py b/WebKitTools/Scripts/webkitpy/tool/steps/postdiff.py
index 79739cd..c40b6ff 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/postdiff.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/postdiff.py
@@ -35,6 +35,7 @@ class PostDiff(AbstractStep):
def options(cls):
return AbstractStep.options() + [
Options.description,
+ Options.comment,
Options.review,
Options.request_commit,
Options.open_bug,
@@ -43,7 +44,7 @@ class PostDiff(AbstractStep):
def run(self, state):
diff = self.cached_lookup(state, "diff")
description = self._options.description or "Patch"
- comment_text = None
+ comment_text = self._options.comment
self._tool.bugs.add_patch_to_bug(state["bug_id"], diff, description, comment_text=comment_text, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit)
if self._options.open_bug:
self._tool.user.open_url(self._tool.bugs.bug_url_for_bug_id(state["bug_id"]))
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py b/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py
index 0734d8f..22b9452 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py
@@ -58,9 +58,10 @@ class RunTests(AbstractStep):
args.append("--no-launch-safari")
args.append("--exit-after-n-failures=1")
# FIXME: Hack to work around https://bugs.webkit.org/show_bug.cgi?id=38912
- # when running the commit-queue on a mac leopard machine.
+ # when running the commit-queue on a mac leopard machine since compositing
+ # does not work reliably on Leopard due to various graphics driver/system bugs.
if self.port().name() == "Mac" and self.port().is_leopard():
- args.extend(["--ignore-tests", "compositing/iframes"])
+ args.extend(["--ignore-tests", "compositing"])
if self._options.quiet:
args.append("--quiet")
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py b/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py
index eee183b..1fd2bad 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py
@@ -78,6 +78,6 @@ MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/test-webkitperl']
Running JavaScriptCore tests
MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/run-javascriptcore-tests']
Running run-webkit-tests
-MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/run-webkit-tests', '--no-launch-safari', '--exit-after-n-failures=1', '--ignore-tests', 'compositing/iframes', '--quiet']
+MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/run-webkit-tests', '--no-launch-safari', '--exit-after-n-failures=1', '--ignore-tests', 'compositing', '--quiet']
"""
OutputCapture().assert_outputs(self, step.run, [{}], expected_stderr=expected_stderr)
diff --git a/WebKitTools/WebKitAPITest/WebKitAPITest.vcproj b/WebKitTools/WebKitAPITest/WebKitAPITest.vcproj
index 5473f10..9984389 100644
--- a/WebKitTools/WebKitAPITest/WebKitAPITest.vcproj
+++ b/WebKitTools/WebKitAPITest/WebKitAPITest.vcproj
@@ -197,6 +197,69 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Debug_Cairo|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_all.vsprops;.\WebKitAPITestCommon.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_wincairo.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
</References>