jquery/jquery-mobile — Issue #2693: Enhancement request: Tagged Script/Link in header that will execute on loadPage
Author: ahutch
Created: 2011-10-13 20:13:15+00:00
State: open

From JQM:
>The reason that the head is ignored for Ajax page content: it's just too complex. The framework would need to compare and >reconcile the contents of multiple page head elements as they are loaded into the DOM so we leave this task to the developer.

In the case that script is injected in the head on a page by page basis it is possible for me to tag that script. I already see that script within the roll=page is already executed. A small addition of code for the loadPage function could allow head scripts too.

```html

```

```javascript
var headx = html.split( /<\/?head[^>]*>/gmi )[1];
var newdiv = document.createElement('div');
newdiv.innerHTML = headx;
$('head').append(newdiv.getElementsByClassName('page_script'));
```