Not a bug Bug with xf:js defer

Affected version
2.0.0 RC1


Active member
Hey, I think I might have found an issue with xf:js.
<xf:js src="themehouse/dev/defer.js" defer="defer" />
works fine, but
<xf:js src="themehouse/dev/defer.js" defer />
causes all xf:js in that template not to be included in the page's source. I believe should allow for the attribute to be used without a value specified though, assuming the intent with xf:js is to pass through attributes.


XenForo developer
Staff member
There are 2 issues here.

1. For the issue as reported, this is expected. XF template syntax (for both XF1 and XF2) XML-style attributes (compared to the SGML/HTML type shown). All attributes consist of name-value pairs.

2. <xf:js> is not designed to take arbitrary attributes and does not have a direct mapping with a <script>. You'll see that the defer part doesn't doesn't get passed through to the underlying tag. If you have to have arbitrary script attributes, then you need to insert the script tag directly as needed.