Download & Extend

Search indexing should Ignore javascript in <SCRIPT> tags

Project:Drupal core
Version:7.x-dev
Component:search.module
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The search engine is indexing javascript inside of <SCRIPT> tags. See #257076.

The solution is to put script javascript inside an HTML comment. This is what we had to do in the 1990's when some browsers didn't support script. And I think it's still good practice.

<script><!-- --></script>

But the search engine should know that some people don't write good HTML, and should know to just skip these.

Comments

#1

Status:active» needs work

It appears that drupal_add_js inline is not doing this, and I think it should. So a first step, is to get our own HTML to write the javascript inside an HTML comment.

AttachmentSizeStatusTest resultOperations
257196.patch1.15 KBIgnored: Check issue status.NoneNone

#2

Although W3C says this works, this blog says that it doesn't. And the patch seems to break javascript on FF2. Guess it's back to just ignoring this in indexing.

#3

Status:needs work» needs review

This method (<!-- -->) does work, ignore comment #2. The attached patch fixes the problem inherent in drupal_add_js, and adds a test case.

AttachmentSizeStatusTest resultOperations
257196.patch2.68 KBIgnored: Check issue status.NoneNone

#4

Status:needs review» needs work

CNW since #158992: Inline JavaScript is XHTML invalid commit.

#5

Priority:normal» critical

Is this still an issue?

#6

Because #158992: Inline JavaScript is XHTML invalid already comments out JS (the suggested solution here), I don't believe there's anything left to do on this issue.

#7

Status:needs work» fixed

Jap, that should be fixed now.

#8

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here