Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Specifying RestrictChildren and empty HtmlTargetElement results in an error #562

Closed
pranavkm opened this issue Oct 2, 2015 · 4 comments
Closed
Assignees
Milestone

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Oct 2, 2015

[RestrictChildren("div")]
[HtmlTargetElement]
public class MyTagHelper : TagHelper
{

}
<p>
    <my>
        <div></div>
    </my>
</p>

Expected: This should render MyTagHelper correctly
Actual: The <my> tag is not allowed by parent <p> tag helper. Only child tags with name(s) 'div' are allowed.

@pranavkm pranavkm added the bug label Oct 2, 2015
@NTaylorMullen
Copy link
Contributor

By design. By specifying [HtmlTargetElement] you're saying that the TagHelper applies to every tag.

@pranavkm
Copy link
Contributor Author

pranavkm commented Oct 3, 2015

We need to update the docs on that attribute to indicate it's a catch all tag helper.

@danroth27
Copy link
Member

The doc comments for HtmlTargetElementAttribute could be improved. The default constructor summary should specify what * means - you shouldn't have to read the remarks.

Also, the error message doesn't specify clearly which tag helper is causing the issue. What if you have multiple tag helpers targeting <p>?

@danroth27 danroth27 added this to the 4.0.0-rc1 milestone Oct 5, 2015
dougbu added a commit that referenced this issue Oct 23, 2015
@dougbu
Copy link
Member

dougbu commented Oct 23, 2015

1c7af0d

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

No branches or pull requests

4 participants