Skip to content

Commit 33ab0d6

Browse files
committed
Warn if a function attribute element is a child of something other than <cxx-function>.
This ignores <ins> and <del> tags since I want to be able to mark that a whole attribute is inserted or removed. Fixes #6.
1 parent f0cf3e8 commit 33ab0d6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

function.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
:host(.formatted) {padding-left: 0m; text-indent:0;}
3535
</style><content></content></template>
3636
</polymer-element>
37-
<polymer-element name="cxx-attribute" constructor="CxxFunctionAttributeElement" noscript>
37+
<polymer-element name="cxx-attribute" constructor="CxxFunctionAttributeElement">
3838
<template>
3939
<style>
4040
:host {display:block; margin-top: .5em; margin-bottom: .5em;}
@@ -45,6 +45,21 @@
4545
</style>
4646
<dt>{{heading}}:</dt><dd><content></content></dd>
4747
</template>
48+
<script>
49+
Polymer('cxx-attribute', {
50+
attached: function() {
51+
var parent = this.parentNode;
52+
while (parent instanceof HTMLModElement)
53+
parent = parent.parentNode;
54+
if (!(parent instanceof CxxFunctionElement)) {
55+
console.warn('<' + this.localName +
56+
'> element must be a child of <cxx-function> ' +
57+
'(ignoring <ins> and <del>):',
58+
this)
59+
}
60+
},
61+
});
62+
</script>
4863
</polymer-element>
4964
<polymer-element name="cxx-requires" extends="cxx-attribute">
5065
<script>

0 commit comments

Comments
 (0)