Skip to content

Fix: support for using require.js in pure XML #1559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix: support for using require.js in pure XML
  • Loading branch information
sebastien committed Jul 8, 2016
commit 4469c06d69bb0428fd25e1bf1f6e0661bcf15dba
7 changes: 6 additions & 1 deletion require.js
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,9 @@ var requirejs, require, define;
* Creates the node for the load command. Only used in browser envs.
*/
req.createNode = function (config, moduleName, url) {
var node = config.xhtml ?
// We force config.xhtml if the document has no body (ie, it is
// an XML document)
var node = (config.xhtml||!document.body) ?
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
document.createElement('script');
node.type = config.scriptType || 'text/javascript';
Expand Down Expand Up @@ -1952,6 +1954,9 @@ var requirejs, require, define;
//call to the module name (which is stored on the node), hold on
//to a reference to this node, but clear after the DOM insertion.
currentlyAddingScript = node;
// Pure XML documents do not have head, so we instead get the
// root's first child.
head = head || document.rootNode.firstChild;
if (baseElement) {
head.insertBefore(node, baseElement);
} else {
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy