Comparing version 1.4.3 to 1.4.4
@@ -7,2 +7,26 @@ export function hasAddon(props) { | ||
} | ||
// TODO: It's better to use `Proxy` replace the `element.value`. But we still need support IE11. | ||
function cloneEvent(event, target, value) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var currentTarget = target.cloneNode(true); | ||
// click clear icon | ||
var newEvent = Object.create(event, { | ||
target: { | ||
value: currentTarget | ||
}, | ||
currentTarget: { | ||
value: currentTarget | ||
} | ||
}); | ||
// Fill data | ||
currentTarget.value = value; | ||
currentTarget.selectionStart = target.selectionStart; | ||
currentTarget.selectionEnd = target.selectionEnd; | ||
return newEvent; | ||
} | ||
export function resolveOnChange(target, e, onChange, targetValue) { | ||
@@ -26,17 +50,3 @@ if (!onChange) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var currentTarget = target.cloneNode(true); | ||
// click clear icon | ||
event = Object.create(e, { | ||
target: { | ||
value: currentTarget | ||
}, | ||
currentTarget: { | ||
value: currentTarget | ||
} | ||
}); | ||
currentTarget.value = ''; | ||
event = cloneEvent(e, target, ''); | ||
onChange(event); | ||
@@ -50,15 +60,3 @@ return; | ||
if (target.type !== 'file' && targetValue !== undefined) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var _currentTarget = target.cloneNode(true); | ||
event = Object.create(e, { | ||
target: { | ||
value: _currentTarget | ||
}, | ||
currentTarget: { | ||
value: _currentTarget | ||
} | ||
}); | ||
_currentTarget.value = targetValue; | ||
event = cloneEvent(e, target, targetValue); | ||
onChange(event); | ||
@@ -65,0 +63,0 @@ return; |
@@ -16,2 +16,26 @@ "use strict"; | ||
} | ||
// TODO: It's better to use `Proxy` replace the `element.value`. But we still need support IE11. | ||
function cloneEvent(event, target, value) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var currentTarget = target.cloneNode(true); | ||
// click clear icon | ||
var newEvent = Object.create(event, { | ||
target: { | ||
value: currentTarget | ||
}, | ||
currentTarget: { | ||
value: currentTarget | ||
} | ||
}); | ||
// Fill data | ||
currentTarget.value = value; | ||
currentTarget.selectionStart = target.selectionStart; | ||
currentTarget.selectionEnd = target.selectionEnd; | ||
return newEvent; | ||
} | ||
function resolveOnChange(target, e, onChange, targetValue) { | ||
@@ -35,17 +59,3 @@ if (!onChange) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var currentTarget = target.cloneNode(true); | ||
// click clear icon | ||
event = Object.create(e, { | ||
target: { | ||
value: currentTarget | ||
}, | ||
currentTarget: { | ||
value: currentTarget | ||
} | ||
}); | ||
currentTarget.value = ''; | ||
event = cloneEvent(e, target, ''); | ||
onChange(event); | ||
@@ -59,15 +69,3 @@ return; | ||
if (target.type !== 'file' && targetValue !== undefined) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var _currentTarget = target.cloneNode(true); | ||
event = Object.create(e, { | ||
target: { | ||
value: _currentTarget | ||
}, | ||
currentTarget: { | ||
value: _currentTarget | ||
} | ||
}); | ||
_currentTarget.value = targetValue; | ||
event = cloneEvent(e, target, targetValue); | ||
onChange(event); | ||
@@ -74,0 +72,0 @@ return; |
{ | ||
"name": "rc-input", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"description": "React input component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70188
1238