tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
482 stars 38 forks source link

For some html tag attributes "Wrong attribute value" error is reported if value is a computed property #251

Closed dadiborn closed 1 year ago

dadiborn commented 2 years ago

As title says, there is issue with attribute like 'disabled' that throws "Wrong attribute value" error if it written like so: disabled='{isConnected}'

For this concrete attribute 'disabled' i did a hacked fix for now and here what has been done if somebody looking for temp fix: with 7Zip open 'intellij-xml.jar' (on older versions) or if it does not exist then 'platform-impl.jar' (on newer versions), those files located in ". . JetBrains\IntelliJ IDEA xxxx.x.x\lib" folder. dig into 'platform-impl.jar || intellij-xml.jar \resources\html5-schema\html5\' right click on 'applications.rnc' and select Edit, and make your top part of file look like this:

    common.attrs.interact &=
        (   common.attrs.contenteditable?
        &   common.attrs.draggable?
        &   common.attrs.disabled?
        &   common.attrs.hidden?
        &   common.attrs.spellcheck?
        &   common.attrs.autocapitalize?
        )

    common.attrs.other &= common.attrs.interact

    common.attrs.disabled =
        attribute disabled {
            string | w:string ""
        }

To original content been added: & common.attrs.disabled?

and

common.attrs.disabled = attribute disabled { string | w:string "" }

Save, Close editor, Agree with 7Zip asking to update file.

Do this at your own risk, this is absolutely not good solution. Hope to see updated plugin to see fix for all attributes :)

tomblachut commented 1 year ago

Migrated to WEB-54911 Svelte: false "Wrong attribute value" warnings when using expressions for boolean attributes