Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
68b8b7b4
Commit
68b8b7b4
authored
Sep 12, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added IHTMLDocument7::getElementsByClassName implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b244182b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
4 deletions
+51
-4
htmldoc.c
dlls/mshtml/htmldoc.c
+25
-4
elements.js
dlls/mshtml/tests/elements.js
+26
-0
No files found.
dlls/mshtml/htmldoc.c
View file @
68b8b7b4
...
...
@@ -3347,11 +3347,32 @@ static HRESULT WINAPI HTMLDocument7_createAttribute(IHTMLDocument7 *iface, BSTR
return
IHTMLDocument5_createAttribute
(
&
This
->
IHTMLDocument5_iface
,
bstrAttrName
,
ppAttribute
);
}
static
HRESULT
WINAPI
HTMLDocument7_getElementByClassName
(
IHTMLDocument7
*
iface
,
BSTR
v
,
IHTMLElementCollection
**
pel
)
static
HRESULT
WINAPI
HTMLDocument7_getElement
s
ByClassName
(
IHTMLDocument7
*
iface
,
BSTR
v
,
IHTMLElementCollection
**
pel
)
{
HTMLDocument
*
This
=
impl_from_IHTMLDocument7
(
iface
);
FIXME
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
v
),
pel
);
return
E_NOTIMPL
;
nsIDOMNodeList
*
nslist
;
nsAString
nsstr
;
nsresult
nsres
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
v
),
pel
);
if
(
!
This
->
doc_node
->
nsdoc
)
{
FIXME
(
"NULL nsdoc not supported
\n
"
);
return
E_NOTIMPL
;
}
nsAString_InitDepend
(
&
nsstr
,
v
);
nsres
=
nsIDOMHTMLDocument_GetElementsByClassName
(
This
->
doc_node
->
nsdoc
,
&
nsstr
,
&
nslist
);
nsAString_Finish
(
&
nsstr
);
if
(
FAILED
(
nsres
))
{
ERR
(
"GetElementByClassName failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
*
pel
=
create_collection_from_nodelist
(
This
->
doc_node
,
nslist
);
nsIDOMNodeList_Release
(
nslist
);
return
S_OK
;
}
static
HRESULT
WINAPI
HTMLDocument7_createProcessingInstruction
(
IHTMLDocument7
*
iface
,
BSTR
target
,
...
...
@@ -4091,7 +4112,7 @@ static const IHTMLDocument7Vtbl HTMLDocument7Vtbl = {
HTMLDocument7_get_characterSet
,
HTMLDocument7_createElement
,
HTMLDocument7_createAttribute
,
HTMLDocument7_getElementByClassName
,
HTMLDocument7_getElement
s
ByClassName
,
HTMLDocument7_createProcessingInstruction
,
HTMLDocument7_adoptNode
,
HTMLDocument7_put_onmssitemodejumplistitemremoved
,
...
...
dlls/mshtml/tests/elements.js
View file @
68b8b7b4
...
...
@@ -104,9 +104,35 @@ function test_head() {
next_test
();
}
function
test_getElementsByClassName
()
{
var
elems
;
document
.
body
.
innerHTML
=
'<div class="class1">'
+
'<div class="class1"></div>'
+
'<a id="class1" class="class2"></a>'
+
'</div>'
+
'<script class="class1"></script>'
;
elems
=
document
.
getElementsByClassName
(
"class1"
);
ok
(
elems
.
length
===
3
,
"elems.length = "
+
elems
.
length
);
ok
(
elems
[
0
].
tagName
===
"DIV"
,
"elems[0].tagName = "
+
elems
[
0
].
tagName
);
ok
(
elems
[
1
].
tagName
===
"DIV"
,
"elems[1].tagName = "
+
elems
[
1
].
tagName
);
ok
(
elems
[
2
].
tagName
===
"SCRIPT"
,
"elems[2].tagName = "
+
elems
[
2
].
tagName
);
elems
=
document
.
getElementsByClassName
(
"class2"
);
ok
(
elems
.
length
===
1
,
"elems.length = "
+
elems
.
length
);
ok
(
elems
[
0
].
tagName
===
"A"
,
"elems[0].tagName = "
+
elems
[
0
].
tagName
);
elems
=
document
.
getElementsByClassName
(
"classnotfound"
);
ok
(
elems
.
length
==
0
,
"elems.length = "
+
elems
.
length
);
next_test
();
}
var
tests
=
[
test_input_selection
,
test_textContent
,
test_ElementTraversal
,
test_getElementsByClassName
,
test_head
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment