Search indexing should Ignore javascript in <SCRIPT> tags

douggreen - May 11, 2008 - 16:04
Project:Drupal
Version:7.x-dev
Component:search.module
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

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.

#1

douggreen - May 11, 2008 - 17:46
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 KBIgnoredNoneNone

#2

douggreen - May 11, 2008 - 18:07

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

douggreen - May 11, 2008 - 20:41
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 KBIgnoredNoneNone

#4

lilou - September 28, 2008 - 21:51
Status:needs review» needs work

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

#5

douggreen - September 5, 2009 - 02:31
Priority:normal» critical

Is this still an issue?

#6

sreynen - September 5, 2009 - 10:02

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

klausi - September 5, 2009 - 10:14
Status:needs work» fixed

Jap, that should be fixed now.

#8

System Message - September 19, 2009 - 10:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.