0

I can't validate script tag with attribute nomodule. I am using odoo framework which is a python backend. It is using lxml to validate xml views or pages. I am building a view with a script tag like:

<script src="src.js" nomodule></script>

It returns an error

lxml.etree.XMLSyntaxError: Specification mandate value for attribute nomodule

However this should be valid according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script

Is there a way so that I can make the parser ignore this new attribute or I can bypass such as special data or character.

kerbrose
  • 1,095
  • 2
  • 11
  • 22

2 Answers2

1

That's possibly because XML != HTML. And as you can see in the error, it's an XML error.

Is an xml attribute without a value, valid? --> your attribute isn't valid.

CZoellner
  • 13,553
  • 3
  • 25
  • 38
1

You need to specify the attribute value always in xml. Odoo uses xml to produce html, so you need to comply with xml rules. You can do it in this case by specifying an empty value for xml attribute like this:

<script src="src.js" nomodule=””></script>
Veikko
  • 3,372
  • 2
  • 21
  • 31