Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($compile) support templates with select content root nodes #6941

Conversation

aeharding
Copy link

Request Type: bug

How to reproduce: Create a directive with the following template:

<option>Hello there!</option>

In IE9, it will throw an error complaining about more than one node in the template.

Component(s): $compile

Impact: small

Complexity: small

This issue is related to:

Detailed Description:

Other Comments:

If the first element in a template is an or tag,
the compiler will wrap it with a tag. This satisfies IE9. Closes #6926

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#6941)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

the compiler will wrap it with a <select> tag. This satisfies IE9.

Closes angular#6926
caitp added a commit to caitp/angular.js that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes angular#6941
Closes angular#6926
@caitp
Copy link
Contributor

caitp commented Apr 2, 2014

I've got an alternative fix for this, it's going to fail jshint for a moment until I fix that. I'll add your tests that you've added to it as well, in a separate commit, those are nice. I think this fix might be preferable, because the hackish stuff in $compile is really... well, it's hackish. Simplifying it in jqLite makes a lot of sense.

caitp added a commit to caitp/angular.js that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes angular#6941
Closes angular#6926
caitp added a commit to caitp/angular.js that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes angular#6941
Closes angular#6926
caitp added a commit to caitp/angular.js that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes angular#6941
Closes angular#6926
caitp added a commit to caitp/angular.js that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes angular#6941
Closes angular#6926
caitp added a commit to caitp/angular.js that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes angular#6941
Closes angular#6926
@aeharding
Copy link
Author

I'm closing this given the awesome work done in #6962 😄

@aeharding aeharding closed this Apr 2, 2014
caitp added a commit to caitp/angular.js that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes angular#6941
Closes angular#6926
caitp added a commit that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes #6941
Closes #6958
caitp added a commit that referenced this pull request Apr 2, 2014
Previously, the jqLite constructor was limited and would be unable to circumvent many of the HTML5
spec's "allowed content" policies for various nodes. This led to complicated and gross hacks around
this in the HTML compiler.

This change refactors these hacks by simplifying them, and placing them in jqLite rather than in
$compile, in order to better support these things, and simplify code.

While the new jqLite constructor is still not even close to as robust as jQuery, it should be more
than suitable enough for the needs of the framework, while adding minimal code.

Closes #6941
Closes #6958
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom <select> directive: Transclude and replace <option>s not working in IE9
3 participants