Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Libraries
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Libraries
Commits
14b0d8ec
Commit
14b0d8ec
authored
Jun 17, 2006
by
Allan Sandfeld Jensen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement document.script(), sniffed in webcore-changes
svn path=/branches/KDE/3.5/kdelibs/; revision=552331
parent
fad6ab43
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
23 deletions
+26
-23
khtml/dom/html_document.cpp
khtml/dom/html_document.cpp
+7
-1
khtml/dom/html_document.h
khtml/dom/html_document.h
+6
-0
khtml/ecma/kjs_html.cpp
khtml/ecma/kjs_html.cpp
+2
-16
khtml/html/html_miscimpl.cpp
khtml/html/html_miscimpl.cpp
+8
-4
khtml/html/html_miscimpl.h
khtml/html/html_miscimpl.h
+3
-2
No files found.
khtml/dom/html_document.cpp
View file @
14b0d8ec
/**
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll@kde.org)
*
Copyright
(C) 1999 Lars Knoll (knoll@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
...
...
@@ -152,6 +152,12 @@ HTMLCollection HTMLDocument::applets() const
return
HTMLCollection
(
impl
,
HTMLCollectionImpl
::
DOC_APPLETS
);
}
HTMLCollection
HTMLDocument
::
scripts
()
const
{
if
(
!
impl
)
return
HTMLCollection
();
return
HTMLCollection
(
impl
,
HTMLCollectionImpl
::
DOC_SCRIPTS
);
}
HTMLCollection
HTMLDocument
::
links
()
const
{
if
(
!
impl
)
return
HTMLCollection
();
...
...
khtml/dom/html_document.h
View file @
14b0d8ec
...
...
@@ -177,6 +177,12 @@ public:
*/
HTMLCollection
layers
()
const
;
/**
* A collection of all the scripts in the document.
*
*/
HTMLCollection
scripts
()
const
;
/**
* A collection of all the anchor ( \c A ) elements in
* a document with a value for the \c name attribute.
...
...
khtml/ecma/kjs_html.cpp
View file @
14b0d8ec
...
...
@@ -289,22 +289,8 @@ Value KJS::HTMLDocument::tryGet(ExecState *exec, const Identifier &propertyName)
return
getHTMLCollection
(
exec
,
doc
.
layers
(),
true
);
case
Anchors
:
return
getHTMLCollection
(
exec
,
doc
.
anchors
());
case
Scripts
:
// TODO (IE-specific)
{
// Disable document.scripts unless we try to be IE-compatible
// Especially since it's not implemented, so
// if (document.scripts) shouldn't return true.
if
(
exec
->
interpreter
()
->
compatMode
()
!=
Interpreter
::
IECompat
)
return
Undefined
();
// To be implemented. Meanwhile, return an object with a length property set to 0
// This gets some code going on IE-specific pages.
// The script object isn't really simple to implement though
// (http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/script.asp)
kdDebug
(
6070
)
<<
"WARNING: KJS::HTMLDocument document.scripts called - not implemented"
<<
endl
;
Object
obj
(
new
ObjectImp
()
);
obj
.
put
(
exec
,
lengthPropertyName
,
Number
(
0
)
);
return
obj
;
}
case
Scripts
:
return
getHTMLCollection
(
exec
,
doc
.
scripts
());
case
All
:
// Disable document.all when we try to be Netscape-compatible
if
(
exec
->
interpreter
()
->
compatMode
()
==
Interpreter
::
NetscapeCompat
)
...
...
khtml/html/html_miscimpl.cpp
View file @
14b0d8ec
...
...
@@ -91,6 +91,10 @@ bool HTMLCollectionImpl::nodeMatches(NodeImpl *current, bool& deep) const
if
(
e
->
id
()
==
ID_IMG
)
check
=
true
;
break
;
case
DOC_SCRIPTS
:
if
(
e
->
id
()
==
ID_SCRIPT
)
check
=
true
;
break
;
case
DOC_FORMS
:
if
(
e
->
id
()
==
ID_FORM
)
check
=
true
;
...
...
@@ -213,7 +217,7 @@ NodeImpl *HTMLCollectionImpl::item ( unsigned long index ) const
return
NodeListImpl
::
item
(
index
);
//For table.rows, we first need to check header, then bodies, then footer.
//we pack any extra headers/footer with bodies. This matches IE, and
//we pack any extra headers/footer with bodies. This matches IE, and
//means doing the usual thing with length is right
const
HTMLTableElementImpl
*
table
=
static_cast
<
const
HTMLTableElementImpl
*>
(
m_refNode
);
...
...
@@ -396,8 +400,8 @@ NodeImpl *HTMLFormCollectionImpl::nextNamedItem( const DOMString &name ) const
}
// -------------------------------------------------------------------------
HTMLMappedNameCollectionImpl
::
HTMLMappedNameCollectionImpl
(
NodeImpl
*
_base
,
int
_type
,
const
DOMString
&
_name
)
:
HTMLCollectionImpl
(
_base
,
NodeListImpl
::
UNCACHEABLE
),
name
(
_name
)
HTMLMappedNameCollectionImpl
::
HTMLMappedNameCollectionImpl
(
NodeImpl
*
_base
,
int
_type
,
const
DOMString
&
_name
)
:
HTMLCollectionImpl
(
_base
,
NodeListImpl
::
UNCACHEABLE
),
name
(
_name
)
{
type
=
_type
;
//We pass uncacheable to collection, but need our own type internally.
}
...
...
@@ -411,7 +415,7 @@ bool HTMLMappedNameCollectionImpl::nodeMatches(NodeImpl *current, bool& deep) co
}
HTMLElementImpl
*
e
=
static_cast
<
HTMLElementImpl
*>
(
current
);
return
matchesName
(
e
,
type
,
name
);
}
...
...
khtml/html/html_miscimpl.h
View file @
14b0d8ec
...
...
@@ -57,6 +57,7 @@ public:
DOC_LAYERS
,
// all LAYERS
DOC_LINKS
,
// all A _and_ AREA elements with a value for href
DOC_ANCHORS
,
// all A elements with a value for name
DOC_SCRIPTS
,
// all SCRIPT elements
// from HTMLTable, HTMLTableSection, HTMLTableRow
TABLE_ROWS
,
// all rows in this table
TABLE_TBODIES
,
// all TBODY elements in this table
...
...
@@ -93,7 +94,7 @@ public:
}
protected:
virtual
unsigned
long
calcLength
(
NodeImpl
*
start
)
const
;
// The collection list the following elements
int
type
:
8
;
...
...
@@ -130,7 +131,7 @@ private:
};
/*
Special collection for items of given name/id under document. or window.; but using
Special collection for items of given name/id under document. or window.; but using
iteration interface
*/
class
HTMLMappedNameCollectionImpl
:
public
HTMLCollectionImpl
...
...
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