jupiterjs/jquerymx — Issue #93: View from an inline template does not support hyphenated types
Author: jeffrose
Created: 2011-11-17 16:22:42+00:00
State: open

Retrieving a View from an inline template fails if that the script tag has a hyphen in the type.

```html

```

Currently [jsrender](https://github.com/BorisMoore/jsrender), the replacement for jQuery Tmpl, is using a type of `text/x-jquery-tmpl` for its templates, though that is likely to change to something like `text/x-jsrender` prior to the release.

The error seems to occur with this line in **jquery.view.js**:

```javascript
suffix = el.type.match(/\/[\d\w]+$/)[0].replace(/^\//, '.');
```

Apparently the regular expression doesn't like the hyphen.

While at the end of the day, no one is forcing a developer to prepend a **x-** on their template script types, it is the standard way of denoting a MIME type extension, i.e. a MIME type that is not registered with IANA, so it seems like it should be supported.