mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-12 22:09:19 +03:00
add document IDL and test for geteleemntbyid
This commit is contained in:
parent
b238791002
commit
6bbae1f228
@ -24,6 +24,80 @@
|
|||||||
#include "render/html_internal.h"
|
#include "render/html_internal.h"
|
||||||
#include "utils/log.h"
|
#include "utils/log.h"
|
||||||
|
|
||||||
|
/* IDL from http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html
|
||||||
|
|
||||||
|
|
||||||
|
interface Document : Node {
|
||||||
|
// Modified in DOM Level 3:
|
||||||
|
readonly attribute DocumentType doctype;
|
||||||
|
readonly attribute DOMImplementation implementation;
|
||||||
|
readonly attribute Element documentElement;
|
||||||
|
Element createElement(in DOMString tagName)
|
||||||
|
raises(DOMException);
|
||||||
|
DocumentFragment createDocumentFragment();
|
||||||
|
Text createTextNode(in DOMString data);
|
||||||
|
Comment createComment(in DOMString data);
|
||||||
|
CDATASection createCDATASection(in DOMString data)
|
||||||
|
raises(DOMException);
|
||||||
|
ProcessingInstruction createProcessingInstruction(in DOMString target,
|
||||||
|
in DOMString data)
|
||||||
|
raises(DOMException);
|
||||||
|
Attr createAttribute(in DOMString name)
|
||||||
|
raises(DOMException);
|
||||||
|
EntityReference createEntityReference(in DOMString name)
|
||||||
|
raises(DOMException);
|
||||||
|
NodeList getElementsByTagName(in DOMString tagname);
|
||||||
|
// Introduced in DOM Level 2:
|
||||||
|
Node importNode(in Node importedNode,
|
||||||
|
in boolean deep)
|
||||||
|
raises(DOMException);
|
||||||
|
// Introduced in DOM Level 2:
|
||||||
|
Element createElementNS(in DOMString namespaceURI,
|
||||||
|
in DOMString qualifiedName)
|
||||||
|
raises(DOMException);
|
||||||
|
// Introduced in DOM Level 2:
|
||||||
|
Attr createAttributeNS(in DOMString namespaceURI,
|
||||||
|
in DOMString qualifiedName)
|
||||||
|
raises(DOMException);
|
||||||
|
// Introduced in DOM Level 2:
|
||||||
|
NodeList getElementsByTagNameNS(in DOMString namespaceURI,
|
||||||
|
in DOMString localName);
|
||||||
|
// Introduced in DOM Level 2:
|
||||||
|
Element getElementById(in DOMString elementId);
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
readonly attribute DOMString inputEncoding;
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
readonly attribute DOMString xmlEncoding;
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
attribute boolean xmlStandalone;
|
||||||
|
// raises(DOMException) on setting
|
||||||
|
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
attribute DOMString xmlVersion;
|
||||||
|
// raises(DOMException) on setting
|
||||||
|
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
attribute boolean strictErrorChecking;
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
attribute DOMString documentURI;
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
Node adoptNode(in Node source)
|
||||||
|
raises(DOMException);
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
readonly attribute DOMConfiguration domConfig;
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
void normalizeDocument();
|
||||||
|
// Introduced in DOM Level 3:
|
||||||
|
Node renameNode(in Node n,
|
||||||
|
in DOMString namespaceURI,
|
||||||
|
in DOMString qualifiedName)
|
||||||
|
raises(DOMException);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static JSClass jsclass_document =
|
static JSClass jsclass_document =
|
||||||
{
|
{
|
||||||
"document",
|
"document",
|
||||||
@ -39,6 +113,12 @@ static JSClass jsclass_document =
|
|||||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static JSBool JSAPI_NATIVE(getElementById, JSContext *cx, uintN argc, jsval *vp)
|
||||||
|
{
|
||||||
|
JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||||
|
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
|
static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
|
||||||
{
|
{
|
||||||
@ -67,6 +147,7 @@ static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
|
|||||||
|
|
||||||
static JSFunctionSpec jsfunctions_document[] = {
|
static JSFunctionSpec jsfunctions_document[] = {
|
||||||
JSAPI_FS(write, 1, 0),
|
JSAPI_FS(write, 1, 0),
|
||||||
|
JSAPI_FS(getElementById, 1, 0),
|
||||||
JSAPI_FS_END
|
JSAPI_FS_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
<li><a href="inline-doc-write-simple.html">Simple docuemnt write</a></li>
|
<li><a href="inline-doc-write-simple.html">Simple docuemnt write</a></li>
|
||||||
<li><a href="inline-doc-write.html">Script within inline script</a></li>
|
<li><a href="inline-doc-write.html">Script within inline script</a></li>
|
||||||
<li><a href="sync-script.html">External syncronous script</a></li>
|
<li><a href="sync-script.html">External syncronous script</a></li>
|
||||||
|
<li><a href="sync-script-err.html">External syncronous script with missing js file</a></li>
|
||||||
<li><a href="sync-script-css.html">External syncronous script (with css)</a></li>
|
<li><a href="sync-script-css.html">External syncronous script (with css)</a></li>
|
||||||
|
<li><a href="inline-innerhtml.html">Inline script innerHtml test</a></li>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
15
test/js/inline-innerhtml.html
Normal file
15
test/js/inline-innerhtml.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Inline Script innerHTML Test</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="tst.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Inline Script innerHTML Test</h1>
|
||||||
|
<p>Before</p>
|
||||||
|
<p id="demo">some text you should never see</p>
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.getElementById("demo").innerHTML="text inserted by script";
|
||||||
|
</script>
|
||||||
|
<p>Afterwards</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -4,7 +4,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="tst.css">
|
<link rel="stylesheet" type="text/css" href="tst.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Sync script Test (css0</h1>
|
<h1>Sync script Test (css)</h1>
|
||||||
<p>Before</p>
|
<p>Before</p>
|
||||||
<script src="tst.js"></script>
|
<script src="tst.js"></script>
|
||||||
<p>Afterwards</p>
|
<p>Afterwards</p>
|
||||||
|
12
test/js/sync-script-err.html
Normal file
12
test/js/sync-script-err.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Sync script Test with bad src</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Sync script Test with bad src</h1>
|
||||||
|
<p>Before</p>
|
||||||
|
<script src="notthere.js"></script>
|
||||||
|
<script src="tst.js"></script>
|
||||||
|
<p>Afterwards</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user