Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js

Issue 2830773002: DevTools: recognize CSSIdentifiers that start with double hyphen (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/elements/elements-css-path-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (/[a-zA-Z0-9_-]/.test(c)) 408 if (/[a-zA-Z0-9_-]/.test(c))
409 return true; 409 return true;
410 return c.charCodeAt(0) >= 0xA0; 410 return c.charCodeAt(0) >= 0xA0;
411 } 411 }
412 412
413 /** 413 /**
414 * @param {string} value 414 * @param {string} value
415 * @return {boolean} 415 * @return {boolean}
416 */ 416 */
417 function isCSSIdentifier(value) { 417 function isCSSIdentifier(value) {
418 return /^-?[a-zA-Z_][a-zA-Z0-9_-]*$/.test(value); 418 // Double hyphen prefixes are not allowed by specification, but many sites u se it.
419 return /^-{0,2}[a-zA-Z_][a-zA-Z0-9_-]*$/.test(value);
419 } 420 }
420 421
421 var prefixedOwnClassNamesArray = prefixedElementClassNames(node); 422 var prefixedOwnClassNamesArray = prefixedElementClassNames(node);
422 var needsClassNames = false; 423 var needsClassNames = false;
423 var needsNthChild = false; 424 var needsNthChild = false;
424 var ownIndex = -1; 425 var ownIndex = -1;
425 var elementIndex = -1; 426 var elementIndex = -1;
426 var siblings = parent.children(); 427 var siblings = parent.children();
427 for (var i = 0; (ownIndex === -1 || !needsNthChild) && i < siblings.length; ++ i) { 428 for (var i = 0; (ownIndex === -1 || !needsNthChild) && i < siblings.length; ++ i) {
428 var sibling = siblings[i]; 429 var sibling = siblings[i];
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 636
636 /** 637 /**
637 * @override 638 * @override
638 * @param {!SDK.DOMNode} node 639 * @param {!SDK.DOMNode} node
639 * @return {?{title: string, color: string}} 640 * @return {?{title: string, color: string}}
640 */ 641 */
641 decorate(node) { 642 decorate(node) {
642 return {title: this._title, color: this._color}; 643 return {title: this._title, color: this._color};
643 } 644 }
644 }; 645 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/elements/elements-css-path-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698