diff options
| author | Lucas Galfasó | 2014-02-17 13:02:58 +0100 | 
|---|---|---|
| committer | Brian Ford | 2014-03-07 10:06:12 -0800 | 
| commit | 53ec5e13e5955830b6751019eef232bd2125c0b6 (patch) | |
| tree | 936108ba2245a0cfdd49f1996eb1ddbc2281f7c4 /src | |
| parent | 235731d32b6cf58a9b868379aab2700d7be55054 (diff) | |
| download | angular.js-53ec5e13e5955830b6751019eef232bd2125c0b6.tar.bz2 | |
fix($compile): support templates with thead and tfoot root elements
If the first element in a template is a <thead> or a <tfoot>, then
use the existing logic to handle table elements compilation.
Closes #6289
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/compile.js | 17 | 
1 files changed, 8 insertions, 9 deletions
| diff --git a/src/ng/compile.js b/src/ng/compile.js index 5b625c19..c7cd08bc 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -503,7 +503,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {        Suffix = 'Directive',        COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,        CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/, -      TABLE_CONTENT_REGEXP = /^<\s*(tr|th|td|tbody)(\s+[^>]*)?>/i; +      TABLE_CONTENT_REGEXP = /^<\s*(tr|th|td|thead|tbody|tfoot)(\s+[^>]*)?>/i;    // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes    // The assumption is that future DOM event attribute names will begin with @@ -1649,16 +1649,15 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {        template = trim(template);        if ((type = TABLE_CONTENT_REGEXP.exec(template))) {          type = type[1].toLowerCase(); -        var table = jqLite('<table>' + template + '</table>'), -            tbody = table.children('tbody'), -            leaf = /(td|th)/.test(type) && table.find('tr'); -        if (tbody.length && type !== 'tbody') { -          table = tbody; +        var table = jqLite('<table>' + template + '</table>'); +        if (/(thead|tbody|tfoot)/.test(type)) { +          return table.children(type);          } -        if (leaf && leaf.length) { -          table = leaf; +        table = table.children('tbody'); +        if (type === 'tr') { +          return table.children('tr');          } -        return table.contents(); +        return table.children('tr').contents();        }        return jqLite('<div>' +                        template + | 
