coldfusion - Making sure custom tag does not have subtags -
i building custom tag wrap around glyphicons.
<b:icon binding="i" />
part of glyphicon spec includes:
only use on empty elements
icon classes should used on elements contain no text content , have no child elements.
i want make sure no 1 like
<b:icon binding="i"> <cfset myvariable++> </b:icon>
is there way make sure custom tag not have inner tags?
well have 2 options can see.
first, throw exception if thistag.executionmode
other "start"
. or 1 likewise throw exception if thistag.hasendtag
true
. restrict tag usage to:
<b:icon binding="i">
and not:
<b:icon binding="i" />
because />
shorthand end-tag. less ideal, , perhaps won't accept approach.
secondly can check if there's generatedcontent
big haphazard because it's entirely possible have between starting , closing tags, careful not generate content:
<b:icon binding="i"><cfset foo="bar"></b:icon>
(note: new lines , indentation count generatedcontent
if there any).
bottom line: whilst jsp custom tags allow control of sort of thing, cannot see how can controlled cfml implementation. closest can prohibit closing tags entirely.
Comments
Post a Comment