@@ -3,6 +3,7 @@ import "regenerator-runtime/runtime"; // needed for ``await`` support
33import  $  from  "jquery" ; 
44import  _  from  "underscore" ; 
55import  ajax  from  "../ajax/ajax" ; 
6+ import  dom  from  "../../core/dom" ; 
67import  logging  from  "../../core/logging" ; 
78import  Parser  from  "../../core/parser" ; 
89import  registry  from  "../../core/registry" ; 
@@ -867,6 +868,14 @@ const inject = {
867868        VIDEO : "data-pat-inject-rebase-src" , 
868869    } , 
869870
871+     _rebaseOptions : { 
872+         "data-pat-inject" : [ "url" ] , 
873+         "data-pat-calendar" : [ "url" ] , 
874+         "data-pat-date-picker" : [ "i18n" ] , 
875+         "data-pat-datetime-picker" : [ "i18n" ] , 
876+         "data-pat-collapsible" : [ "load-content" ] , 
877+     } , 
878+ 
870879    _rebaseHTML ( base ,  html )  { 
871880        if  ( html  ===  "" )  { 
872881            // Special case, source is none 
@@ -901,6 +910,29 @@ const inject = {
901910                    $el_ . attr ( attrName ,  value ) ; 
902911                } 
903912            } ) ; 
913+ 
914+         for  ( const  [ attr ,  opts ]  of  Object . entries ( this . _rebaseOptions ) )  { 
915+             for  ( const  el_  of  dom . querySelectorAllAndMe ( 
916+                 $page [ 0 ] , 
917+                 `[${ attr }  
918+             ) )  { 
919+                 const  val  =  el_ . getAttribute ( attr ,  false ) ; 
920+                 if  ( val )  { 
921+                     let  options  =  parser . _parse ( val ) ; 
922+                     let  changed  =  false ; 
923+                     for  ( const  opt  of  opts )  { 
924+                         if  ( options [ opt ] )  { 
925+                             options [ opt ]  =  utils . rebaseURL ( base ,  options [ opt ] ) ; 
926+                             changed  =  true ; 
927+                         } 
928+                     } 
929+                     if  ( changed )  { 
930+                         el_ . setAttribute ( attr ,  JSON . stringify ( options ) ) ; 
931+                     } 
932+                 } 
933+             } 
934+         } 
935+ 
904936        // XXX: IE8 changes the order of attributes in html. The following 
905937        // lines move data-pat-inject-rebase-src to src. 
906938        $page . find ( "[data-pat-inject-rebase-src]" ) . each ( ( id ,  el_ )  =>  { 
0 commit comments