Quick Docs: Ignore vendor prefixes if needed #8739

Merged
merged 5 commits into from Sep 9, 2014

Projects

None yet

4 participants

@MarcelGerber
Member

For #8737.

@le717
Contributor
le717 commented Aug 17, 2014

👍 This is a very good idea.

@RaymondLim
Contributor

Triage complete.

@redmunds redmunds self-assigned this Aug 26, 2014
@redmunds redmunds commented on an outdated diff Sep 8, 2014
src/extensions/default/WebPlatformDocs/main.js
@@ -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
@redmunds
redmunds Sep 8, 2014 Contributor

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)-/.

@redmunds
Contributor
redmunds commented Sep 8, 2014

Done with initial review. RegExp needs to be more strict.

@MarcelGerber
Member

@redmunds Changed the RegExp.

@redmunds
Contributor
redmunds commented Sep 9, 2014

Looks good.

Sorry, for not mentioning it on the first pass, but please add unit tests for

  • valid vendor prefixes
  • invalid property that starts with a - but is not a vendor prefix
@MarcelGerber
Member

@redmunds Added unit tests and fixed a case where you couldn't open an Inline Editor when your cursor was on the very beginning (before the first hyphen).

@redmunds
Contributor
redmunds commented Sep 9, 2014

Thanks. Merging.

@redmunds redmunds merged commit 90c912e into adobe:master Sep 9, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@MarcelGerber MarcelGerber deleted the MarcelGerber:wp-docs-vendor-prefixes branch Sep 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment