Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Quick Docs: Ignore vendor prefixes if needed #8739

Merged
merged 5 commits into from
Sep 9, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/extensions/default/WebPlatformDocs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ define(function (require, exports, module) {
.done(function (cssDocs) {
// Construct inline widget (if we have docs for this property)
var cssPropDetails = cssDocs.PROPERTIES["css/properties/" + cssPropName];
if (!cssPropDetails) {
cssPropName = cssPropName.replace(/^-\w+-/, ""); // remove possible vendor prefixes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This RegExp could lead to false positives if there's a typo in a css property name. For example, if property is mistyped as -border-width, then user will see info for width. RegExp should explicitly list most popular vendor prefixes such as: /^-(webkit|moz|ms|o)-/.

cssPropDetails = cssDocs.PROPERTIES["css/properties/" + cssPropName];
}
if (cssPropDetails) {
var inlineWidget = new InlineDocsViewer(cssPropName, cssPropDetails);
inlineWidget.load(hostEditor);
Expand Down