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
833286f4
Commit
833286f4
authored
Sep 05, 2023
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Sep 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Implement querySelector for document fragments.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
80d629ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
htmldoc.c
dlls/mshtml/htmldoc.c
+11
-1
dom.js
dlls/mshtml/tests/dom.js
+26
-1
No files found.
dlls/mshtml/htmldoc.c
View file @
833286f4
...
...
@@ -4720,8 +4720,18 @@ static HRESULT WINAPI DocumentSelector_querySelector(IDocumentSelector *iface, B
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
v
),
pel
);
nsAString_InitDepend
(
&
nsstr
,
v
);
nsres
=
nsIDOMDocument_QuerySelector
(
This
->
dom_document
,
&
nsstr
,
&
nselem
);
if
(
This
->
dom_document
)
nsres
=
nsIDOMDocument_QuerySelector
(
This
->
dom_document
,
&
nsstr
,
&
nselem
);
else
{
nsIDOMDocumentFragment
*
frag
;
nsres
=
nsIDOMNode_QueryInterface
(
This
->
node
.
nsnode
,
&
IID_nsIDOMDocumentFragment
,
(
void
**
)
&
frag
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsres
=
nsIDOMDocumentFragment_QuerySelector
(
frag
,
&
nsstr
,
&
nselem
);
nsIDOMDocumentFragment_Release
(
frag
);
}
}
nsAString_Finish
(
&
nsstr
);
if
(
NS_FAILED
(
nsres
))
{
WARN
(
"QuerySelector failed: %08lx
\n
"
,
nsres
);
return
map_nsresult
(
nsres
);
...
...
dlls/mshtml/tests/dom.js
View file @
833286f4
...
...
@@ -244,10 +244,20 @@ sync_test("query_selector", function() {
+
'</div>'
+
'<script class="class1"></script>'
;
var
e
=
document
.
querySelector
(
"nomatch"
);
var
frag
=
document
.
createDocumentFragment
()
var
e
=
document
.
createElement
(
"div"
);
e
.
innerHTML
=
'<div class="class3"></div><a id="class3" class="class4"></a></div>'
;
frag
.
appendChild
(
e
);
var
e
=
document
.
createElement
(
"script"
);
e
.
className
=
"class3"
;
frag
.
appendChild
(
e
);
e
=
document
.
querySelector
(
"nomatch"
);
ok
(
e
===
null
,
"e = "
+
e
);
e
=
document
.
body
.
querySelector
(
"nomatch"
);
ok
(
e
===
null
,
"e = "
+
e
);
e
=
frag
.
querySelector
(
"nomatch"
);
ok
(
e
===
null
,
"e = "
+
e
);
e
=
document
.
querySelector
(
".class1"
);
ok
(
e
.
tagName
===
"DIV"
,
"e.tagName = "
+
e
.
tagName
);
...
...
@@ -255,11 +265,26 @@ sync_test("query_selector", function() {
ok
(
e
.
tagName
===
"DIV"
,
"e.tagName = "
+
e
.
tagName
);
ok
(
e
.
msMatchesSelector
(
".class1"
)
===
true
,
"msMatchesSelector returned "
+
e
.
msMatchesSelector
(
".class1"
));
ok
(
e
.
msMatchesSelector
(
".class2"
)
===
false
,
"msMatchesSelector returned "
+
e
.
msMatchesSelector
(
".class2"
));
e
=
document
.
querySelector
(
".class3"
);
ok
(
e
===
null
,
"e = "
+
e
);
e
=
document
.
body
.
querySelector
(
".class3"
);
ok
(
e
===
null
,
"e = "
+
e
);
e
=
frag
.
querySelector
(
".class3"
);
ok
(
e
.
tagName
===
"DIV"
,
"e.tagName = "
+
e
.
tagName
);
e
=
frag
.
querySelector
(
".class4"
);
ok
(
e
.
tagName
===
"A"
,
"e.tagName = "
+
e
.
tagName
);
e
=
frag
.
querySelector
(
".class1"
);
ok
(
e
===
null
,
"e = "
+
e
);
e
=
frag
.
querySelector
(
".class2"
);
ok
(
e
===
null
,
"e = "
+
e
);
e
=
document
.
querySelector
(
"a"
);
ok
(
e
.
tagName
===
"A"
,
"e.tagName = "
+
e
.
tagName
);
e
=
document
.
body
.
querySelector
(
"a"
);
ok
(
e
.
tagName
===
"A"
,
"e.tagName = "
+
e
.
tagName
);
e
=
frag
.
querySelector
(
"a"
);
ok
(
e
.
tagName
===
"A"
,
"e.tagName = "
+
e
.
tagName
);
});
sync_test
(
"compare_position"
,
function
()
{
...
...
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