Commit Graph

36 Commits

Author SHA1 Message Date
Nathan Hunzaker fe4a5b4004 Fix Chrome number input backspace and invalid input issue (#7359)
* Only re-assign defaultValue if it is different

* Do not set value if it is the same

* Properly cover defaultValue

* Use coercion to be smart about value assignment

* Add explanation of loose type checks in value assignment.

* Add test coverage for setAttribute update.

* Only apply loose value check to text inputs

* Fix case where empty switches to zero

* Handle zero case in controlled input

* Correct mistake with default value assignment after rebase

* Do not assign bad input to number input

* Only trigger number input value attribute updates on blur

* Remove reference to LinkedValueUtils

* Record new fiber tests

* Add tests for blurred number input behavior

* Replace onBlur wrapper with rule in ChangeEventPlugin

* Sift down to only number inputs

* Re-record fiber tests

* Add test case for updating attribute on uncontrolled inputs. Make related correction

* Handle uncontrolled inputs, integrate fiber

* Reorder boolean to mitigate DOM checks

* Only assign value if it is different

* Add number input browser test fixtures

During the course of the number input fix, we uncovered many edge
cases. This commit adds browser test fixtures for each of those instances.

* Address edge case preventing number precision lower than 1 place

0.0 coerces to 0, however they are not the same value when doing
string comparision. This prevented controlled number inputs from
inputing the characters `0.00`.

Also adds test cases.

* Accommodate lack of IE9 number input support

IE9 does not support number inputs. Number inputs in IE9 fallback to
traditional text inputs. This means that accessing `input.value` will
report the raw text, rather than parsing a numeric value.

This commit makes the ReactDOMInput wrapper check to see if the `type`
prop has been configured to `"number"`. In those cases, it will
perform a comparison based upon `parseFloat` instead of the raw input
value.

* Remove footnotes about IE exponent issues

With the recent IE9 fix, IE properly inserts `e` when it produces an
invalid number.

* Address exception in IE9/10 ChangeEventPlugin blur event

On blur, inputs have their values assigned. This is so that number
inputs do not conduct unexpected behavior in
Chrome/Safari. Unfortunately, there are cases where the target
instance might be undefined in IE9/10, raising an exception.

* Migrate over ReactDOMInput.js number input fixes to Fiber

Also re-record tests

* Update number fixtures to use latest components

* Add number input test case for dashes and negative numbers

* Replace trailing dash test case with replace with dash

Also run prettier
2017-03-28 11:35:23 -07:00
Kevin Lin 3e47b3002b Add 'as' keyword (#7543) (#7582)
* Add 'as' keyword (#7543)

* fix commenting to adhere to styling

* fix grammar in comment

(cherry picked from commit c85f46320e)
2016-09-15 16:32:45 -07:00
Paul Kehrer 076d7fd63a Add playsInline as an allowed HTML property (#7519)
The WHATWG has unprefixed `-webkit-playsinline` as `playsinline` (see: https://github.com/whatwg/html/pull/1444) and iOS 10 intends to use it (https://webkit.org/blog/6784/new-video-policies-for-ios/).
(cherry picked from commit 7b11aa9450)
2016-09-15 16:32:45 -07:00
Brandon Dail 7b78757c6f Add referrerPolicy to HTMLDOMPropertyConfig (#7274)
(cherry picked from commit cccef3c683)
2016-07-13 13:54:23 -07:00
Jim f98e6c1955 Properly set value and defaultValue for input and textarea (#6406)
* Have `defaultValue` reach DOM node for html input box for #4618

* Cleanup and bug fixes for merge.

(cherry picked from commit 4338c8db4b)
2016-06-14 15:48:47 -07:00
Paul O’Shannessy 37fc21f1e8 Use 0 instead of null in property config
We're using this value to check bits and null is 0 in that sense anyway. This shaves off a few bytes (though as expected, gzip is virtually unchanged)
2016-03-11 11:08:56 -08:00
April Arcus 39c597f523 add "cite" attribute to whitelist for <blockquote> elements (fixes #6084) 2016-02-22 20:58:17 -08:00
Saiichi Hashimoto 0b87d7f56f Update HTMLDOMPropertyConfig.js 2016-02-13 00:42:47 -08:00
Andreas Svensson 77a137adf9 Use removeAttribute to forcefully remove properties from the DOM, drop MUST_USE_ATTRIBUTE and manage all regular properties as attributes instead 2016-01-09 11:55:56 +01:00
Paul O’Shannessy 708e1b3f03 Sort attrs in HTMLDOMPropertyConfig 2016-01-08 17:23:25 -08:00
Rick Beerendonk bef45b0b1a Year-agnostic copyright message, like React Native uses, to prevent the need for yearly changes. 2015-12-29 20:20:32 +01:00
Jim c9c3c339b7 Merge pull request #5216 from nLight/number-in-data-attrs-2329
Allow numbers after `data-` in custom attributes fixes #2329
2015-12-16 15:37:41 -08:00
Freddy Rangel db37deb17c Autocorrect and autocapitalize should not be property
Fixes facebook/react#5436
2015-12-13 23:37:29 -08:00
Paul O’Shannessy c4f134883d Support reversed for <ol>s 2015-11-17 22:42:01 -08:00
hejld ba8c987391 Fix typos and redundant words 2015-11-17 12:39:29 +01:00
Dmitriy Rozhkov a2b471e098 Allow all characters (except astral) specified in XML specs. fixes #2329 2015-11-12 16:21:34 +01:00
Nicholas Clawson e39f51429b Allow nonce attribute 2015-11-10 10:46:30 -08:00
Paul O’Shannessy 68eb1a6fb6 Add integrity to HTML property config 2015-10-30 13:35:51 -07:00
Evan Vosberg f8b4affb87 Add non-standard property for supporting Safari mask-icon.
See also: https://developer.apple.com/library/prerelease/mac/releasenotes/General/WhatsNewInSafari/Articles/Safari_9.html#//apple_ref/doc/uid/TP40014305-CH9-SW20
2015-10-28 17:35:43 +01:00
Ben Alpert 6269ef62cf Two more fixes for document.createElement mode
Is this all of them? I hope so.

- Set text content after creating hierarchy, like the text is a child. I should've done this originally but I guessed it wouldn't matter. I was wrong (~20% perf difference in IE11).
- IE throws when setting an enum-like property to an invalid value. I tried setting every property to the string 'a' and changed the ones that threw to be MUST_USE_ATTRIBUTE. I think these are all correct -- encType is the most suspicious one based on the existing comments but I tested in IE8 and it works fine as an attribute.
2015-10-23 22:46:02 -07:00
Ben Alpert b447b40958 Use attributes to set .type
According to the internet, this should work and it appears to work fine on all the browsers I tested.
2015-10-23 12:08:10 -07:00
conorhastings bb3a326ecd add default attribute for use with track element 2015-10-22 22:47:17 -04:00
Paul O’Shannessy 659172df50 Add srcLang and kind to better support track elements 2015-10-14 12:05:56 -07:00
Robin Berjon fd682b5cac add RDFa attributes not already covered 2015-09-22 16:58:48 -04:00
Jon Tewksbury f445dd91b0 Update docs to match standard HTML attribute support 2015-09-03 22:59:29 -07:00
Espen Hovlandsdal 75805e4835 Allow results and autosave attributes (WebKit/Blink) 2015-08-21 10:10:32 +02:00
Hekar Khani be1fc794f0 Added support for more HTML attributes: summary
This attribute is used on <table> to support screen readers.
It is deprecated, so take a look at <caption> instead.
2015-08-13 22:41:37 -05:00
Joe Stein 1b5bfb516a Add wrap attribute 2015-07-13 15:00:03 -07:00
Levi Buzolic 3b2df5fd9c Add inputMode to HTML DOM Property Whitelist 2015-07-04 02:17:22 +02:00
Jan Raasch b089b427ab Add IE-only security attr to HTMLDOMPropertyConfig
See https://msdn.microsoft.com/en-us/library/ms534622(v=vs.85).aspx for an in-depth specification.

This fixes #4169.
2015-07-01 19:47:48 +02:00
Benjamin Woodruff c089eece50 Switch to using comma-dangle: always-multiline
This is a machine-generated codemod, but it's pretty safe since it was
generated by hooking into eslint's own report.

A few files had to be touched up by hand because there were existing
formatting issues with nested arrays/objects:

src/shared/utils/__tests__/OrderedMap-test.js
src/shared/utils/__tests__/Transaction-test.js
src/shared/utils/__tests__/traverseAllChildren-test.js
src/isomorphic/children/__tests__/ReactChildren-test.js
2015-06-02 16:57:26 -07:00
Wildhoney 0d060d135f Added 'is' attribute 2015-06-02 10:42:31 +01:00
Ben Alpert 52a229f168 Make DOM wrapper component using lower-level primitives
Introducing: a really lame version of composite components, right inside of ReactDOMComponent!

Now ReactDOMInput isn't an actual component. This brings us closer to exposing DOM nodes as refs.
2015-06-01 20:16:01 -07:00
Jamis Charles dc01c0e66d Added challenge, keyParams and keyType on <keygen>
Chrome allowed some of these to be 'null' (allow `node.challenge` etc),
but FF didn't work. This will tell React to use node.setAttribute() to
set these values.

Tested in FF, Chrome, Safari. <keygen> isn't supported on IE.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen
2015-05-27 11:56:23 -07:00
Stefan Dombrowski 3092454940 Add capture to supported attributes 2015-05-24 21:20:40 +02:00
Sebastian Markbage 0b063f8a09 Reorganize Src Files for Isomorphic React Package
The new folder structure is organized around major packages that are expected to ship separately in some form.

`/isomorphic`

I moved classic/modern and children utils into a directory called "isomorphic" with the main export being ReactIsomorphic. This will eventually become the "react" package.

This includes all the dependencies that you might need to create a component without dependencies on the renderer/reconciler.

The rest moves into decoupled renderers.

`/renderers/dom/client` - This is the main renderer for DOM.

`/renderers/dom/server` - This is the server-side renderer for HTML strings.

`/addons` and `/test` - Same as before for now.

You're not supposed to take on a dependency inside another package.

Shared code is organized into a "shared" directory which is intended to support all the packages in that subdirectory. Meaning that once we swap to CommonJS modules, the only time you should use `..` is to target `../shared/` or `../../shared`.

E.g. `/shared/` is common utils that are used by everything.

`/renderers/shared/` is code that is shared by all renderers, such as the main reconciliation algorithm.

Shared code will likely be copied into each package rather than referenced. This allow us to have separate state and allow inlining and deadcode elimination.
2015-05-15 18:35:22 -07:00