Skip to content

Commit ce162b5

Browse files
committed
Transfer only props that are not part of CheckboxGroup
1 parent 565fba1 commit ce162b5

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-checkbox-group",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"author": "Ziad Saab <[email protected]>",
55
"description": "Sensible checkbox groups manipulation for DOM.",
66
"main": "react-checkbox-group.js",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-checkbox-group",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"description": "Sensible checkbox groups manipulation for DOM.",
55
"main": "react-checkbox-group.js",
66
"scripts": {

react-checkbox-group.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*/
44
'use strict';
55

6+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
7+
68
var React = require('react');
79

810
module.exports = React.createClass({
@@ -22,9 +24,16 @@ module.exports = React.createClass({
2224
},
2325

2426
render: function render() {
27+
var _props = this.props;
28+
var name = _props.name;
29+
var value = _props.value;
30+
var defaultValue = _props.defaultValue;
31+
32+
var otherProps = _objectWithoutProperties(_props, ['name', 'value', 'defaultValue']);
33+
2534
return React.createElement(
2635
'div',
27-
this.props,
36+
otherProps,
2837
this.props.children
2938
);
3039
},

react-checkbox-group.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ module.exports = React.createClass({
2020
},
2121

2222
render: function() {
23+
let {name, value, defaultValue, ...otherProps} = this.props;
2324
return (
24-
<div {...this.props}>
25+
<div {...otherProps}>
2526
{this.props.children}
2627
</div>
2728
);
@@ -75,4 +76,4 @@ module.exports = React.createClass({
7576

7677
return checked;
7778
}
78-
});
79+
});

0 commit comments

Comments
 (0)