Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Ivan Tyagov
renderjs
Commits
f72bcfc4
Commit
f72bcfc4
authored
Jul 25, 2013
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DOMParser compatibility with chrome.
parent
0bd5794b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
2 deletions
+46
-2
renderjs.js
renderjs.js
+46
-2
No files found.
renderjs.js
View file @
f72bcfc4
...
...
@@ -2,11 +2,55 @@
/*global $, jQuery, localStorage, jIO, window, document, DOMParser */
/*jslint evil: true, indent: 2, maxerr: 3, maxlen: 79 */
"
use strict
"
;
/*
* DOMParser HTML extension
* 2012-09-04
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */
(
function
(
DOMParser
)
{
var
DOMParser_proto
=
DOMParser
.
prototype
,
real_parseFromString
=
DOMParser_proto
.
parseFromString
;
// Firefox/Opera/IE throw errors on unsupported types
try
{
// WebKit returns null on unsupported types
if
((
new
DOMParser
()).
parseFromString
(
""
,
"
text/html
"
))
{
// text/html parsing is natively supported
return
;
}
}
catch
(
ex
)
{}
DOMParser_proto
.
parseFromString
=
function
(
markup
,
type
)
{
var
result
,
doc
,
doc_elt
,
first_elt
;
if
(
/^
\s
*text
\/
html
\s
*
(?:
;|$
)
/i
.
test
(
type
))
{
doc
=
document
.
implementation
.
createHTMLDocument
(
""
);
doc_elt
=
doc
.
documentElement
;
doc_elt
.
innerHTML
=
markup
;
first_elt
=
doc_elt
.
firstElementChild
;
if
(
doc_elt
.
childElementCount
===
1
&&
first_elt
.
localName
.
toLowerCase
()
===
"
html
"
)
{
doc
.
replaceChild
(
first_elt
,
doc_elt
);
}
result
=
doc
;
}
else
{
result
=
real_parseFromString
.
apply
(
this
,
arguments
);
}
return
result
;
};
}(
DOMParser
));
/*
* renderJs - Generic Gadget library renderer.
* http://www.renderjs.org/documentation
*/
(
function
(
document
,
window
,
$
,
DOMParser
)
{
var
gadget_model_dict
=
{},
...
...
@@ -252,7 +296,7 @@
// };
// // Give the init function the renderJS prototype for later instantiation
// renderJS.fn.init.prototype = renderJS.fn;
//
//
// jQuery.fn.extend({
// attr: function (name, value) {
// return jQuery.access(this, jQuery.attr, name, value,
...
...
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