-
Notifications
You must be signed in to change notification settings - Fork 47.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started setting both props.class and props.className for DOM elements
- Loading branch information
jim
committed
Feb 4, 2016
1 parent
f2bb015
commit 1304828
Showing
5 changed files
with
123 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @providesModule getCssClassFromProps | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var warning = require('warning'); | ||
|
||
/** | ||
* Takes in an props (or an element) and returns the CSS class prop. | ||
*/ | ||
function getCssClassFromProps(props) { | ||
if (__DEV__) { | ||
getCssClassFromProps.isExecuting = true; | ||
warning( | ||
props.className == null || props.class == null || props.class === props.className, | ||
'props.className and props.class should have the same values' | ||
); | ||
} | ||
var cls = props.className || props.class; | ||
if (__DEV__) { | ||
getCssClassFromProps.isExecuting = false; | ||
} | ||
return cls; | ||
} | ||
|
||
getCssClassFromProps.isExecuting = false; | ||
|
||
module.exports = getCssClassFromProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters