Skip to content

Commit

Permalink
Replace 'kebab-case' to 'hyphen-case' (#2646)
Browse files Browse the repository at this point in the history
Since 'kebab-case' may be perceived as derogatory by some members of
Arabic or Asian cultures, it's better to use a culture-agnostic term
like 'hyphen-case', which in addition is more self-explanatory than the
potentially offensive term 'kebab-case', which makes no sense without
knowing the origin of the term.
  • Loading branch information
DervishD committed Apr 10, 2021
1 parent 7ab9384 commit 6d56d81
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 25 deletions.
21 changes: 13 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- added new html5shiv [`#1343`](https://github.com/Modernizr/Modernizr/pull/1343)
- Update documentation on the rationale for ignoring cookiesEnabled [`#1356`](https://github.com/Modernizr/Modernizr/pull/1356)
- Update readme.md [`#1362`](https://github.com/Modernizr/Modernizr/pull/1362)
- convert kebab-case to camelCase in testProps for browsers that don't have @supports support [`#1323`](https://github.com/Modernizr/Modernizr/pull/1323)
- `testProp()` and `testAllProps()` now accept kebab-case – updating tests... [`#4`](https://github.com/Modernizr/Modernizr/pull/4)
- convert hyphen-case to camelCase in testProps for browsers that don't have @supports support [`#1323`](https://github.com/Modernizr/Modernizr/pull/1323)
- `testProp()` and `testAllProps()` now accept hyphen-case – updating tests... [`#4`](https://github.com/Modernizr/Modernizr/pull/4)
- Fix broken link in comment [`#1353`](https://github.com/Modernizr/Modernizr/pull/1353)
- Add test for the `Beacon API` [`#1339`](https://github.com/Modernizr/Modernizr/pull/1339)
- Correct note from within `serviceworker.js` [`#1337`](https://github.com/Modernizr/Modernizr/pull/1337)
Expand Down Expand Up @@ -1265,7 +1265,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Metadata / DOC improvements: [`122f5be`](https://github.com/Modernizr/Modernizr/commit/122f5beab232242935e48e906c56e6bf21ec5aa9)
- Moving hsla test into feature-detects/css-hsla.js [`83a46d1`](https://github.com/Modernizr/Modernizr/commit/83a46d19999d16cf09b9f6eb74decc08f99a15cb)
- Moving webgl test to feature-detects/webgl.js [`9776162`](https://github.com/Modernizr/Modernizr/commit/97761626c6ff35410da1717a58442a7f06474778)
- `testProp()` and `testAllProps()` now accept kebab-case – updating tests & comments to match [`48b9c4c`](https://github.com/Modernizr/Modernizr/commit/48b9c4cff78a9a198270c9968cf6cd0647475663)
- `testProp()` and `testAllProps()` now accept hyphen-case – updating tests & comments to match [`48b9c4c`](https://github.com/Modernizr/Modernizr/commit/48b9c4cff78a9a198270c9968cf6cd0647475663)
- Ensuring ES5 tests return Booleans [`463c82e`](https://github.com/Modernizr/Modernizr/commit/463c82e6abfaf22d3befff7f20e43e04c03711c3)
- Reverting PR #874 - we don't touch any existing classes which begin `no-` (except `no-js`) [`e2cec68`](https://github.com/Modernizr/Modernizr/commit/e2cec68a42f24821a49485e93413ae0bbaf03769)
- Use "matchdep" to avoid requiring dev dependencies. [`cb03dbf`](https://github.com/Modernizr/Modernizr/commit/cb03dbf8f5b479308f52f23d41843db611155bb9)
Expand Down Expand Up @@ -1610,7 +1610,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- whitespace cleanup [`ed81590`](https://github.com/Modernizr/Modernizr/commit/ed81590845e9bcc0d6074f151535aa7e8f678562)
- remove IE6 error in cors test [`18deb41`](https://github.com/Modernizr/Modernizr/commit/18deb4130df39143ac40857e0cbc3b94a8da53df)
- making sure contextMenu test can be run in the head [`ec2630e`](https://github.com/Modernizr/Modernizr/commit/ec2630e8f527b634453ed9cb127cac1e5825f6c7)
- Add check to verify that enableClasses has been initialized. [`39fc8fa`](https://github.com/Modernizr/Modernizr/commit/39fc8faa3eefab70b5c096f9c29629cdb0bbc402)
- Add check to verify that enableClasses has been initialized.
[`39fc8fa`](https://github.com/Modernizr/Modernizr/commit/39fc8faa3eefab70b5c096f9c29629cdb0bbc402)
- fourvalues -> shorthand. bgpos detect. [`1c0f5d1`](https://github.com/Modernizr/Modernizr/commit/1c0f5d1dd5a1a093595b1fd0eff87e8e74c9a578)
- test suite fixup for Opera 12 that leaks a URL global lazily. [`ac7b9f5`](https://github.com/Modernizr/Modernizr/commit/ac7b9f5a2674f97e732e901671b1e8d79f763d40)
- rename bgpos shorthand test. [`55f041f`](https://github.com/Modernizr/Modernizr/commit/55f041ff8325ad06c136e428a3a68e940fe00737)
Expand Down Expand Up @@ -1972,7 +1973,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Use just `false` instead of `function() { return false; }` if the test already failed. [`c9cabfe`](https://github.com/Modernizr/Modernizr/commit/c9cabfeb206c838bb63e33307e94d3859c060eec)
- Added the script defer and script async attribute tests [`0c6e713`](https://github.com/Modernizr/Modernizr/commit/0c6e713edaf3396b6e7e059186d236baceefdff2)
- userdata test. more metadata. [`fdb020d`](https://github.com/Modernizr/Modernizr/commit/fdb020dc07b187096eb97175cb06ef1c557e4a79)
- https://github.com/Modernizr/Modernizr/issues/423 [`22c6779`](https://github.com/Modernizr/Modernizr/commit/22c6779d3b450c2681ba24501be5b2b2ca42e4d2)
- https://github.com/Modernizr/Modernizr/issues/423
[`22c6779`](https://github.com/Modernizr/Modernizr/commit/22c6779d3b450c2681ba24501be5b2b2ca42e4d2)
- test suite. rel path because gh-pages doesnt have my repo stuff. better anyway. minor [`6ba7dc6`](https://github.com/Modernizr/Modernizr/commit/6ba7dc6b4c4f50b8c35c8e9f45a97401fdd279f0)
- minor. fixing urls that were mangled in 18463cb [`0a4b0ed`](https://github.com/Modernizr/Modernizr/commit/0a4b0ed5b1859d3578e074090e288479721a7f96)
- make caniuse results play nice with our funky audio/video return types. [`1e82aef`](https://github.com/Modernizr/Modernizr/commit/1e82aef94a36f3fb3c5ac1e8275d4ceb3f45437f)
Expand All @@ -1992,7 +1994,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- extra note about msPrefix not being MsPrefix. thx erik. [`9ff083d`](https://github.com/Modernizr/Modernizr/commit/9ff083d5f61df29f1754270b164a6949efa1d3ad)
- adding back updated getusermedia.js test [`5efe030`](https://github.com/Modernizr/Modernizr/commit/5efe030bd4ac47b6d71a2640a933361e3d6364c6)
- temporary removal of getusermedia [`f028427`](https://github.com/Modernizr/Modernizr/commit/f028427242aab3f756c29bceb5f36162d61e64af)
- If the test added via addTest is NOT a function or Boolean Modernizr dies. [`1c2feb5`](https://github.com/Modernizr/Modernizr/commit/1c2feb5722fb0beee574bd0ea7054c883341c45a)
- If the test added via addTest is NOT a function or Boolean Modernizr dies.
[`1c2feb5`](https://github.com/Modernizr/Modernizr/commit/1c2feb5722fb0beee574bd0ea7054c883341c45a)
- version bump to 2.1pre. [`12af180`](https://github.com/Modernizr/Modernizr/commit/12af180697f1049633219134f9df59265af5c285)
- version bump to 2.0.4. now shipping this on modernizr.com [`e74d232`](https://github.com/Modernizr/Modernizr/commit/e74d232094d9c140e558e828b15448b4766b7aed)
- Changed font-face and multiple bg tests to use https:// instead of //:. Fixes 228 and 296. [`da70979`](https://github.com/Modernizr/Modernizr/commit/da70979d4da6edd85b746c852b4a3d348ede9767)
Expand All @@ -2011,10 +2014,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Removed x char from script src. [`3840357`](https://github.com/Modernizr/Modernizr/commit/384035791624c38323700bd3cb45a0d2d731de44)
- Remove random "f" character. Sorry about that. [`daf8ad4`](https://github.com/Modernizr/Modernizr/commit/daf8ad4f02c00ed29361b48c6b3cf8370ce110da)
- Amendments mentioned in #430 [`53c907f`](https://github.com/Modernizr/Modernizr/commit/53c907f21ceb518a519e58812092b699c146a5af)
- `/^[23]g$/` is the new `/^(?:2g|3g)$/`. [`3e27e8a`](https://github.com/Modernizr/Modernizr/commit/3e27e8ad8a1e8a91d0487a46d5bd9f55c091d214)
- `/^[23]g$/` is the new `/^(?:2g|3g)$/`.
[`3e27e8a`](https://github.com/Modernizr/Modernizr/commit/3e27e8ad8a1e8a91d0487a46d5bd9f55c091d214)
- output elem test rename to avoid class conflicts. (incl our test suite) [`14dbcd7`](https://github.com/Modernizr/Modernizr/commit/14dbcd747f396ee95d03d658656f05a7eab6c769)
- Exagerated font-size [`8d2e0d8`](https://github.com/Modernizr/Modernizr/commit/8d2e0d8ff081ff28fc03dc4a18c8c6b0ad05fa32)
- Do NOT cast `test` to a Boolean. Truthy/falsy values are okay and casting will break some of the built in tests that use a Boolean *object* with added properties (the audio/video tests do this). [`f8ccf69`](https://github.com/Modernizr/Modernizr/commit/f8ccf69369e9fe560e300a2096c6bb5415187913)
- Do NOT cast `test` to a Boolean. Truthy/falsy values are okay and casting will break some of the built in tests that use a Boolean *object* with added properties (the audio/video tests do this).
[`f8ccf69`](https://github.com/Modernizr/Modernizr/commit/f8ccf69369e9fe560e300a2096c6bb5415187913)
- put back return of empty string if style.cssText is undefined [`c8a6df3`](https://github.com/Modernizr/Modernizr/commit/c8a6df3224f939897d50eb40b8ce8e745261a00b)
- nokia E52 fails on undefined style from line 265. Definition of cssText (269) made more robust. [`dcfbdda`](https://github.com/Modernizr/Modernizr/commit/dcfbdda275f91d20495e74c8a152e982812bb617)
- test suite. minor. webgl may not be a pure boolean thx to recent plugin addition. [`d2d9ca5`](https://github.com/Modernizr/Modernizr/commit/d2d9ca507d4920bca7543699164166e774b78d04)
Expand Down
4 changes: 2 additions & 2 deletions src/cssToDOM.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
define(function() {
/**
* cssToDOM takes a kebab-case string and converts it to camelCase
* cssToDOM takes a hyphen-case string and converts it to camelCase
* e.g. box-sizing -> boxSizing
*
* @access private
* @function cssToDOM
* @param {string} name - String name of kebab-case prop we want to convert
* @param {string} name - String name of hyphen-case prop we want to convert
* @returns {string} The camelCase version of the supplied name
*/
function cssToDOM(name) {
Expand Down
2 changes: 1 addition & 1 deletion src/domPrefixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ define(['ModernizrProto', 'omPrefixes'], function(ModernizrProto, omPrefixes) {
* @example
*
* Modernizr._domPrefixes is exactly the same as [_prefixes](#modernizr-_prefixes), but rather
* than kebab-case properties, all properties are their Capitalized variant
* than hyphen-case properties, all properties are their Capitalized variant
*
* ```js
* Modernizr._domPrefixes === [ "Moz", "O", "ms", "Webkit" ];
Expand Down
4 changes: 2 additions & 2 deletions src/domToCSS.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
define(function() {
/**
* domToCSS takes a camelCase string and converts it to kebab-case
* domToCSS takes a camelCase string and converts it to hyphen-case
* e.g. boxSizing -> box-sizing
*
* @access private
* @function domToCSS
* @param {string} name - String name of camelCase prop we want to convert
* @returns {string} The kebab-case version of the supplied name
* @returns {string} The hyphen-case version of the supplied name
*/
function domToCSS(name) {
return name.replace(/([A-Z])/g, function(str, m1) {
Expand Down
6 changes: 3 additions & 3 deletions src/prefixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define(['ModernizrProto', 'testPropsAll', 'cssToDOM', 'atRule'], function(Modern
* @example
*
* Modernizr.prefixed takes a string css value in the DOM style camelCase (as
* opposed to the css style kebab-case) form and returns the (possibly prefixed)
* opposed to the css style hyphen-case) form and returns the (possibly prefixed)
* version of that property that the browser actually supports.
*
* For example, in older Firefox...
Expand Down Expand Up @@ -61,15 +61,15 @@ define(['ModernizrProto', 'testPropsAll', 'cssToDOM', 'atRule'], function(Modern
* var transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
* ```
*
* If you want a similar lookup, but in kebab-case, you can use [prefixedCSS](#modernizr-prefixedcss).
* If you want a similar lookup, but in hyphen-case, you can use [prefixedCSS](#modernizr-prefixedcss).
*/
var prefixed = ModernizrProto.prefixed = function(prop, obj, elem) {
if (prop.indexOf('@') === 0) {
return atRule(prop);
}

if (prop.indexOf('-') !== -1) {
// Convert kebab-case to camelCase
// Convert hyphen-case to camelCase
prop = cssToDOM(prop);
}
if (!obj) {
Expand Down
4 changes: 2 additions & 2 deletions src/prefixedCSS.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(['ModernizrProto', 'prefixed', 'domToCSS'], function(ModernizrProto, prefixed, domToCSS) {
/**
* prefixedCSS is just like [prefixed](#modernizr-prefixed), but the returned values are in
* kebab-case (e.g. `box-sizing`) rather than camelCase (boxSizing).
* hyphen-case (e.g. `box-sizing`) rather than camelCase (boxSizing).
*
* @memberOf Modernizr
* @name Modernizr.prefixedCSS
Expand All @@ -24,7 +24,7 @@ define(['ModernizrProto', 'prefixed', 'domToCSS'], function(ModernizrProto, pref
* Since it is only useful for CSS style properties, it can only be tested against
* an HTMLElement.
*
* Properties can be passed as both the DOM style camelCase or CSS style kebab-case.
* Properties can be passed as both the DOM style camelCase or CSS style hyphen-case.
*/
var prefixedCSS = ModernizrProto.prefixedCSS = function(prop) {
var prefixedProp = prefixed(prop);
Expand Down
2 changes: 1 addition & 1 deletion src/prefixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define(['ModernizrProto'], function(ModernizrProto) {
*
* Modernizr._prefixes is the internal list of prefixes that we test against
* inside of things like [prefixed](#modernizr-prefixed) and [prefixedCSS](#-code-modernizr-prefixedcss). It is simply
* an array of kebab-case vendor prefixes you can use within your code.
* an array of hyphen-case vendor prefixes you can use within your code.
*
* Some common use cases include
*
Expand Down
2 changes: 1 addition & 1 deletion src/testAllProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define(['ModernizrProto', 'testPropsAll'], function(ModernizrProto, testPropsAll
* @optionProp testAllProps
* @access public
* @function testAllProps
* @param {string} prop - String naming the property to test (either camelCase or kebab-case)
* @param {string} prop - String naming the property to test (either camelCase or hyphen-case)
* @param {string} [value] - String of the value to test
* @param {boolean} [skipValueTest=false] - Whether to skip testing that the value is supported when using non-native detection
* @returns {string|boolean} returns the string version of the property, or `false` if it is unsupported
Expand Down
2 changes: 1 addition & 1 deletion src/testProp.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(['ModernizrProto', 'testProps'], function(ModernizrProto, testProps) {
/**
* testProp() investigates whether a given style property is recognized
* Property names can be provided in either camelCase or kebab-case.
* Property names can be provided in either camelCase or hyphen-case.
*
* @memberOf Modernizr
* @name Modernizr.testProp
Expand Down
2 changes: 1 addition & 1 deletion src/testProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ define(['contains', 'mStyle', 'createElement', 'nativeTestProps', 'is', 'cssToDO
// on our modernizr element, but instead just testing undefined vs
// empty string.

// Property names can be provided in either camelCase or kebab-case.
// Property names can be provided in either camelCase or hyphen-case.

function testProps(props, prefixed, value, skipValueTest) {
skipValueTest = is(skipValueTest, 'undefined') ? false : skipValueTest;
Expand Down
2 changes: 1 addition & 1 deletion test/browser/src/cssToDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('cssToDOM', function() {
});
});

it('converts kebab to camel', function() {
it('converts hyphen to camel', function() {
expect(cssToDOM('fake-detect')).to.be.equal('fakeDetect');
});

Expand Down
2 changes: 1 addition & 1 deletion test/browser/src/domToCSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('domToCSS', function() {
});
});

it('converts kebab to camel', function() {
it('converts hyphen to camel', function() {
expect(domToCSS('fakeDetect')).to.be.equal('fake-detect');
});

Expand Down
2 changes: 1 addition & 1 deletion test/browser/src/testProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('testProps', function() {
expect(testProps(['happiness'])).to.be.equal(false);
// Everyone supports fontSize
expect(testProps(['fontSize'])).to.be.equal(true);
// kebab-case should work too
// hyphen-case should work too
});

afterEach(function() {
Expand Down

0 comments on commit 6d56d81

Please sign in to comment.