mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Demos: Fixed #3852: Add in extra directory level for href and src attributes when demos are loaded from demos/index.html.
This commit is contained in:
parent
f375f053f4
commit
bf73f8c5be
@ -150,6 +150,7 @@
|
||||
}
|
||||
|
||||
function loadDemo(path) {
|
||||
var directory = path.match(/([^\/]+)\/[^\/\.]+\.html$/)[1];
|
||||
$.get(path, function(data) {
|
||||
|
||||
data = data.replace(/<script.*>.*<\/script>/ig,""); // Remove script tags
|
||||
@ -159,6 +160,7 @@
|
||||
data = data.replace(/<\/?head.*>/ig,""); //Remove head tag
|
||||
data = data.replace(/<\/?!doctype.*>/ig,""); //Remove doctype
|
||||
data = data.replace(/<title.*>.*<\/title>/ig,""); // Remove title tags
|
||||
data = data.replace(/((href|src)=["'])(?!(http|#))/ig, "$1" + directory + "/");
|
||||
|
||||
$('#demo-frame').empty().html(data);
|
||||
$('#demo-link a').attr('href', path);
|
||||
|
Loading…
Reference in New Issue
Block a user