Fork me on GitHub

JSLint Error Explanations

JSLint will hurt your feelings. It's time to make them better!


ADSAFE violation: bad id

When do I get this error?

JSLint (prior to version 2013-03-18) throws the "ADSAFE violation: bad id" error when the adsafe and fragment options are set to true (they're false by default) and you pass it a fragment of HTML that includes a div element with an id attribute value that does not conform to the ADsafe rules. Here's an example:

Why do I get this error?

This error is raised when JSLint encounters code that violates the rules of the ADsafe subset of JavaScript. It is a fatal error that signifies a severe problem with ADsafe code and will have to be fixed before your ADsafe code will execute.

ADsafe widgets must be wrapped in a div element. The ADsafe widget documentation states the following:

The <div> element must have an id. The id must contain only upper case ASCII letters with a trailing _ character.

In a commit on 20th March 2013, HTML, CSS and ADsafe parsing functionality was removed from JSLint. If you rely upon this functionality, you will be unable to upgrade JSLint to a version beyond that date.

In a commit on 20th March 2013, HTML, CSS and ADsafe parsing functionality was removed from JSLint. If you rely upon this functionality, you will be unable to upgrade JSLint to a version beyond that date.


comments powered by Disqus