WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
30831
Web Inspector: syntax highlight inline JS and CSS in HTML resources
https://bugs.webkit.org/show_bug.cgi?id=30831
Summary
Web Inspector: syntax highlight inline JS and CSS in HTML resources
Timothy Hatcher
Reported
2009-10-27 11:43:21 PDT
We should syntax highlight <script> and <style> blocks in HTML resources.
Attachments
[PATCH] Suggested solution
(24.60 KB, patch)
2011-01-26 09:54 PST
,
Alexander Pavlov (apavlov)
yurys
: review-
Details
Formatted Diff
Diff
[PATCH] Comment addressed, added STYLE check in 2 places
(26.12 KB, patch)
2011-01-28 03:43 PST
,
Alexander Pavlov (apavlov)
yurys
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Anthony Ricaud
Comment 1
2009-10-29 17:24:02 PDT
***
Bug 19351
has been marked as a duplicate of this bug. ***
Brian Weinstein
Comment 2
2009-10-29 17:24:48 PDT
Can we do this in the inspector, or would it have to be done in the engine?
Timothy Hatcher
Comment 3
2009-10-29 19:44:41 PDT
We could do this in the Inspector.
Keishi Hattori
Comment 4
2009-10-31 04:09:07 PDT
I'll take this after I'm done with the new CSS syntax highlighter.
Alexander Pavlov (apavlov)
Comment 5
2011-01-03 15:12:30 PST
SourceHTMLTokenizer implements tokenization of the <script> tag contents with a SourceJavaScriptTokenizer, so we are good with that. We should implement a similar approach for the <style> tag and SourceCSSTokenizer.
Alexander Pavlov (apavlov)
Comment 6
2011-01-26 09:54:25 PST
Created
attachment 80204
[details]
[PATCH] Suggested solution
Yury Semikhatsky
Comment 7
2011-01-28 02:24:02 PST
Comment on
attachment 80204
[details]
[PATCH] Suggested solution View in context:
https://bugs.webkit.org/attachment.cgi?id=80204&action=review
> Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js:267 > if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
You should add a check for STYLE state here, r- for this.
Alexander Pavlov (apavlov)
Comment 8
2011-01-28 03:43:23 PST
Created
attachment 80436
[details]
[PATCH] Comment addressed, added STYLE check in 2 places
Yury Semikhatsky
Comment 9
2011-01-28 06:42:30 PST
Comment on
attachment 80436
[details]
[PATCH] Comment addressed, added STYLE check in 2 places View in context:
https://bugs.webkit.org/attachment.cgi?id=80436&action=review
> Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js:268 > // Do not tokenize script tag contents, keep lexer state although processing "<".
Please update the comment to reflect that you're skipping style tag content as well.
> Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js:322 > + if (this._condition.parseCondition === this._parseConditions.SCRIPT || this._condition.parseCondition === this._parseConditions.STYLE) {
We should be consistent in using === vs & if there is no difference in case of SCRIPT and STYLE parse conditions I'd prefer ===
Alexander Pavlov (apavlov)
Comment 10
2011-01-28 07:30:29 PST
(In reply to
comment #9
)
> (From update of
attachment 80436
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=80436&action=review
> > > Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js:268 > > // Do not tokenize script tag contents, keep lexer state although processing "<". > > Please update the comment to reflect that you're skipping style tag content as well.
Done
> > Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js:322 > > + if (this._condition.parseCondition === this._parseConditions.SCRIPT || this._condition.parseCondition === this._parseConditions.STYLE) { > > We should be consistent in using === vs & if there is no difference in case of SCRIPT and STYLE parse conditions I'd prefer ===
Alas, there is a difference. At times, we can have the ATTRIBUTE_VALUE or ATTRIBUTE flag set along with the SCRIPT or STYLE state (I have seen this break the highlighting). There is a special comment following the line quoted: "Fall through if expecting attributes", which mean this should not work if the ATTRIBUTE flag is set, so there is no point in fixing the consistency.
Alexander Pavlov (apavlov)
Comment 11
2011-01-28 07:49:18 PST
Committing to
http://svn.webkit.org/repository/webkit/trunk
... M Source/WebCore/ChangeLog M Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js M Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js Committed
r76943
Alexander Pavlov (apavlov)
Comment 12
2011-02-17 07:15:43 PST
Comment on
attachment 80436
[details]
[PATCH] Comment addressed, added STYLE check in 2 places Clearing cq? from a committed patch
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug