Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
c9dd5d99
Commit
c9dd5d99
authored
Dec 21, 2008
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Oops, forgot to commit support.js.
parent
b850ab2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
support.js
src/support.js
+99
-0
No files found.
src/support.js
0 → 100644
View file @
c9dd5d99
(
function
(){
jQuery
.
support
=
{};
var
root
=
document
.
documentElement
,
script
=
document
.
createElement
(
"script"
),
div
=
document
.
createElement
(
"div"
),
id
=
"script"
+
(
new
Date
).
getTime
();
div
.
style
.
display
=
"none"
;
div
.
innerHTML
=
' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param></object>'
;
var
all
=
div
.
getElementsByTagName
(
"*"
),
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
// Can't get basic test support
if
(
!
all
||
!
all
.
length
||
!
a
)
{
return
;
}
jQuery
.
support
=
{
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace
:
div
.
firstChild
.
nodeType
==
3
,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody
:
!
div
.
getElementsByTagName
(
"tbody"
).
length
,
// Make sure that you can get all elements in an <object> element
// IE 7 always returns no results
objectAll
:
!!
div
.
getElementsByTagName
(
"object"
)[
0
]
.
getElementsByTagName
(
"*"
).
length
,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize
:
!!
div
.
getElementsByTagName
(
"link"
).
length
,
// Get the style information from getAttribute
// (IE uses .cssText insted)
style
:
/red/
.
test
(
a
.
getAttribute
(
"style"
)
),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized
:
a
.
getAttribute
(
"href"
)
===
"/a"
,
// Make sure that element opacity exists
// (IE uses filter instead)
opacity
:
a
.
style
.
opacity
===
"0.5"
,
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat
:
!!
a
.
style
.
cssFloat
,
// Will be defined later
scriptEval
:
false
,
noCloneEvent
:
true
};
script
.
type
=
"text/javascript"
;
try
{
script
.
appendChild
(
document
.
createTextNode
(
"window."
+
id
+
"=1;"
)
);
}
catch
(
e
){}
root
.
insertBefore
(
script
,
root
.
firstChild
);
// Make sure that the execution of code works by injecting a script
// tag with appendChild/createTextNode
// (IE doesn't support this, fails, and uses .text instead)
if
(
window
[
id
]
)
{
jQuery
.
support
.
scriptEval
=
true
;
delete
window
[
id
];
}
root
.
removeChild
(
script
);
if
(
div
.
attachEvent
&&
div
.
fireEvent
)
{
div
.
attachEvent
(
"onclick"
,
function
(){
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
jQuery
.
support
.
noCloneEvent
=
false
;
});
div
.
cloneNode
(
true
).
fireEvent
(
"onclick"
);
}
})();
var
styleFloat
=
jQuery
.
support
.
cssFloat
?
"cssFloat"
:
"styleFloat"
;
jQuery
.
props
=
{
"for"
:
"htmlFor"
,
"class"
:
"className"
,
"float"
:
styleFloat
,
cssFloat
:
styleFloat
,
styleFloat
:
styleFloat
,
readonly
:
"readOnly"
,
maxlength
:
"maxLength"
,
cellspacing
:
"cellSpacing"
,
rowspan
:
"rowSpan"
};
\ No newline at end of file
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