django-unicorn icon indicating copy to clipboard operation
django-unicorn copied to clipboard

Attribute unicorn:click is not allowed here in unicron template

Open hadibeiki opened this issue 2 years ago • 2 comments

hi guys i have no attribute unicorn:click in unicorn html

</ul>
<button unicorn:click="ali">hadi</button>
<!-- Tab panes -->
<div class="bg-products1 " >
   

hadibeiki avatar Apr 15 '22 08:04 hadibeiki

Hello, I'm having a little trouble understanding what might be going on. Any chance you can make a public repo with a reproducible error, or fork this repo and add a failing test or example? Thanks!

adamghill avatar Apr 15 '22 12:04 adamghill

I just ran into this and can maybe provide some more context

Technically unicorn:click refers a attribute named click from a namespace called unicorn. So the root node should have a link to a XML schema for unicorn:* attributes :

       <div xmlns:unicorn="http://link-to-schema-listing-possible-unicorn-attributes">

IntelliJ (and presumably any strict HTML editor) will complain because there was no namespace defined for unicorn.

You can at least silence the issue by using a placeholder:

      <div xmlns:unicorn="http://www.w3.org/1999/xhtml">

And that's enough for IntelliJ to let you add "unicorn:click" as a custom attribute.


The ideal solution would be an XML schema document that defines all of the attributes that unicorn supports.

I could contribute one if that's something that the maintainers would be interested in, but it also becomes something that has to be kept up to date as attributes are added/removed, and I'm not sure if that's something the project is interested in adding.

selalipop avatar Mar 20 '23 18:03 selalipop