{"_id":"q-en-react-8504f1740628b9865d457c3a339d2f782319aaa42fdff1af8180b77ba4b9b7a4","text":"The last two assertions in this new test don't pass because of the duck-typing check in . Not quite sure what you had in mind here. Not every object whose is a component class is a valid descriptor… right?\nThis is an intermediate step. Currently the duck typing is flawed regardless. Descriptors will probably get an inheritance chain so that instanceof ReactDescriptor works as a safer check. Only descriptors should pass. We could probably check for props too. It is expected that component classes themselves fail the test. Therefore it should also be renamed. On Feb 24, 2014, at 7:42 AM, Ben Alpert wrote:\nRight -- with the current code, returns true when passed a component class, which is wrong.\nThat's right. We should add that unit test. Out of curiosity, how did you find this? On Feb 24, 2014, at 1:51 PM, Ben Alpert wrote:\nI was adding a warning for passing a component class to renderComponent because of this Stack Overflow question:\nI think this is fixed. Not sure if we have a solid unit test to cover this."} {"_id":"q-en-react-af28cccd15a54992f5cc048710312a6aeb6577db9cc5753621e969152ef7c8f3","text":"React adds a scroll listener that tracks and caches the scroll position (I assume for some undocumented internal purpose). Additionally, the scroll listener forces a synchronous layout (see screenshot). This seems wasteful, especially considering that the values tracked are never exposed in the API. What is the scroll listener used for? Can it be removed? !\nViewportMetrics is used to normalize pageX and pageY on mouse events: . Perhaps ironically, it was created to prevent synchronous layouts during mouse event handlers.\nI wish these values (as well as the event) were somehow exposed.\n:+1:\nBTW you can obviously have this if you use a Webpack-like bundler:\nWell, is only used for IE8 and possibly other very old browsers (), so we should be able to just disable it for all other browsers and everyone is happy right? (Could still be optimized slightly for IE8... if anyone cares) Also, That makes no sense at all to me, does not take an argument, yet we get the scroll position and provide it as an argument. Instead, gets the scroll position internally and uses that? So we call twice, but only use the result once (also, this should be broken for events inside iframes, for IE8). Also2, I'm pretty sure any browsers that supports touch, also supports . cc\nI agree that we shouldn't be tracking it in other browsers if we don't need it. I don't know if there's a way to predict whether we'll have .pageX and .pageY before mouse events actually come in.\n:)\nAnother idea being just let resize/scroll set a flag, when a mouse event is created, if the flag is set, update viewport metrics. That way we only update it when needed, but could potentially cause a reflow if there are other events before it (very unlikely though I imagine).\nThis issue causes React based longer lists unusable on mobile.\nIs there any progress on this issue? I’m not sure if this is the root-cause for pages rendered with react scrolling extremely slow with firefox mobile on android (e.g. this react website ).\nIs that your site? If so, you can try commenting out the logic in refreshScrollValues to see if it makes a difference. If it does, I'm happy to prioritize and try to get it in.\nNo, that is not my site, it is an example react & fluxible page (see: ), but we have exactly the same issues with scrolling on firefox mobile. I’ve applied the changes in manually and it doesn’t solves the problem, so this issue might be unrelated to my problem. I will investigate further. Thanks for considering to prioritize this. Much appreciated."} {"_id":"q-en-react-16680cd16785bd149ce8f71ec27813f47ce0e569c64f71f4fc951f60d8a8becc","text":"I am working on a project that has strict accessibility requirements. The table I am putting some data in has to implement headers and ids attributes to meet accessibility. See W3 techniques here Unfortunately the \"headers\" attribute is being stripped out because it's not supported by React (it's not on the supported attributes list). Can you please add support for the missing standard attribute called \"headers\"?\n+1\nAs a workaround I believe on a you can grab the DOMNode with a ref and add what you need."} {"_id":"q-en-react-dd628f4e74860ad5503f70abb342c44d4f269762880b09391d2158fc46e2c2fb","text":"If we claim to support IE8, and users are testing their code locally in IE8, they might get thrown into compatibility mode by default. This will cause their webapp to blow up, and they will be confused because IE8 is a supported browser. For background, check out this thread: Users can get out of compatibility mode by adding this tag: Since the current failure is cryptic, and it's easy to detect when IE8 is in compatibility mode (), we should probably add a warning to give a hint to the user that even though they're using IE8, they're actually in compatibility mode (effectively IE7) and should add the meta tag or use one of the other various workarounds."} {"_id":"q-en-react-bda68aba5b773f0e231d8ae9f598c5dea11ff75961a86d42353566558f7ff8f7","text":"Since copy+pasting our code makes it too easy for people to XSS themselves, lets just add a comment in there about it.\nPR at - let me know if that's what you had in mind!\nMy intuition is that it makes more sense to fix the example (call a sanitization library) or to change the example completely (demonstrate something else that is safer). It looks really bad to have a security warning on the homepage of the react site. Makes it seem like our framework encourages unsafe operations, rather than a safe-by-default way of doing things.\nShould switch the demo to use a different library like markdown-js that escapes everything and doesn't support HTML:\nmarkdown-js looks good. First attempt: ,output Code licensed if someone wants to turn this into a coherent example; I've signed the CLA.\nThat's a good suggestion too :) - what are your thoughts? I'm happy to change the example to use like people have suggested above. nice usage example :+1:\nUh yea, that sounds fine to me. This behavior is definitely non-standard markdown but it's an example so not a big deal. We should probably do the same for the tutorial while we're here. And it's on cdnjs so that's all pretty easy:\nJust going to use marked instead, which I'm already familiar with and has an option to sanitize input."} {"_id":"q-en-react-795741901fb82091b7a486876f357df0a3316ec909e9dfe8a9ecdec72a57a791","text":"Calling on in a component being Shallow Rendered will result in the error being thrown. I set up a test case:\nWho would be best to answer this one?\nSeems like a valid bug report — thanks and the test case is rad. I may not be able to look at this for a while, unfortunately.\nno worries let me know if you need any more info from me. This was on React 14 beta btw (not sure if that matters)\nI have the same issue. A simpler example that throws the error:\nAny way of getting around this issue? I am currently running into it.\nSorry about the slow response from us (FB) here. I'm the principal author of the shallow render feature, but React core isn't my main gig and I've been swamped with product work. I don't have an offhand answer for you, but I've just put time on my calendar to look into this next week. Jim, Ben, Paul — if by chance one of you happened to take care of this before then, I wouldn't be mad :)\nAn update on my end. I think that my problem actually went away when I deduped my npm dependencies to remove an extra react version that was causing issues. If this error pops up again I'll let you know. Thanks for the response! On Fri, Aug 28, 2015, 9:38 PM Scott Feeney wrote:\nHmm I am still able to reproduce this issue in my test case after running npm dedupe\nJust to clarify, my previous comment wasn't supposed to mean that the issue has gone away. I think I was seeing a separate issue caused by multiple react versions that I misidentified as this issue (I hope that makes sense).\nI am getting this error, too. I'm using react v0.14.0-rc1. Looking at the code : Apparently .\nNote that shallow rendered components override to return a instead of whatever it normally returns. That still shouldn't be undefined and should have a attribute, though.\nI'm experiencing this issue too - your suggestion gets me past the initial error & on to in\nPretty sure this breaks many other things outside of , but I noticed moving to be directly above in fixed this for me.\nWe are also affected by this issue. I think shallow rendering is a really cool feature for testing, but unfortunately I can't use it for some of our components due to this bug.\nI created pull request with a fix that works for me. Can someone else verify?\nAny workaround for this issue?\n:+1: Having same issue\nJust ran into this too :/\nAny update on this? I see that 0.14.3 was released, but these kind of tests are still failing.\nI think I have to add a test to my pull request before it can be merged, but I did not get around to do it yet.\nClosing in favor of which should merge soon."} {"_id":"q-en-react-1def5d8af304d4cceb1351c6e7c9af25c0fb6336e4edda68a67920ef2caca0bc","text":"I'm trying to use the attribute as described here: Unfortunately, sometimes returns , when is called multiple times. MWE:\nThis is intended – when the component is unmounted or the ref changes, the old ref gets called with null before it's called with the new value (or the same component instance again). If you store the instance on your component, this effect should be unobservable as long as your component is mounted, but it prevents memory leaks. If you want to do something with in the ref handler, you should check if it's null.\nThanks for the information! I think this might be worth mentioning in the docs."} {"_id":"q-en-react-e67de791693db938af10b78c2ee6743684ef35b812d1374870cdb39182ae80b2","text":"Issue with the reproducible example . Full build contains non-standard iterator. Theoretical, it can be to ES in the future, it can be (or already ) to another libraries. should take into account possibility iterable numbers.\nWell, the good news is that if this is already on enough pages, then introducing iterable numbers may not be web compatible anyway. I think that this is only in DEV only code. Unfortunately a lot of pages incorrectly uses the DEV build of React.\n\"good news\""} {"_id":"q-en-react-c5fdcaf06bf83f9011e0945d502600fbda0b23da3dda3cc70ca0b979475789b1","text":"I'm still quite new to React, but I guess this is a bug in the React framework introduced in 0.14. Seems like all listeners attached with JSX are broken in native Android browser for Android LTE 4.3, when compiling code with NODEENV development. Everything works fine with NODEENV production compilation. I've tracked it down to being related to ReactErrorUtils, that in development mode do guards on events. The source code: If I simply remove that part of code after compiling the React app, the listeners starts working again. I guess this is not intentional, but instead a bug? To reproduce problem in Android LTE 4.3 (code that works in e.g. Chrome Browser): Using the pre-compiled Getting Started lib\nHm. That's unfortunate. I guess we'll try to find a feature test for this and patch it."} {"_id":"q-en-react-c2a3cc3ca43cfe1a4652396cfc14adfa6f68aff3900143c7249698f9178b404e","text":"Oddly enough, the two examples below are not equal as I thought they would be. The error is as follows: I'm assuming that is because the function as assuming an optional callback. But I would expect your code to do a typeof check, and not just a defined check. Can we change it to do a check? I can submit a PR.\nWell, the typecheck happens with that exact typecheck, just not directly in forceupdate. Here's forceUpdate: and where the invariant happens: FWIW, is not the same as due to an important distinction. The former makes a new function that is bound but it will pass along any arguments. The latter also is a new function but it explicitly doesn't pass any arguments. So the former gets the event passed along while the latter just drops it. The event isn't callable, thus the invariant. We need to do the typecheck so I guess we could discuss whether we keep it as an invariant or a warning. But it is a misuse of the API.\nTo follow up on that, the more \"equal\" thing would be: Which should throw the same error that you see with your first bind example.\nCorrect. Yes, I understand all of that. It wasn't toooo hard for me to understand what is happening. And it is a misuse of the API. So I guess, I would consider adding the argument type to the invariant to help make it clearer? Something more like: It's kind of moot. But It confused me for a second. Might confuse others also."} {"_id":"q-en-react-ebfcb743aff813e9c4529ab43570cce674092783fd3ef9a2cd7ff39596fc8553","text":"Introduction I found a bug on resolving default props when component props have property with HTMLAllCollection. React ignores value and uses default value (it should take that collection). isIE9OrLower (look at the end of topic) is simple function to test Internet Explorer in version 9 or lower. Simple use case: Chrome/Firefox/modern IE (yeah, i know....) returns HTMLAllColection (as ), but old IE returns true. HTMLAllCollection is weird collection: Source of bug and fix release: 0.14.7 file: line: 9149 code (bug): if (typeof props[propName] === 'undefined') { code (fix): if (props[propName] === undefined) { Btw, === undefined is faster than typeof === 'undefined' on Chrome and IE. Reproduction Open in Firefox / Chrome / IE10 or higher. Fiddle: Raw: Workaround Change to\nHaha, browsers suck. Want to submit a PR? It looks like we do that thing unnecessarily in a few places in the React codebase. Note that we do need to use typeof if the binding might not exist, so we need to look at each case individually to make sure the change is valid there.\nI went through the react repo configuration (build, tests execution). Fix didn't break anything, but so far I didn't find solution to make good test (phantomjs doesn't have property). (HTMLAllCollection) is probably the only exception to the typeof and is not a html standard. Any suggestions to the unit test for this fix/improvement?\nAs long as you tested it manually and it worked in IE, I think we can accept this change without a unit test.\nFixed in\nlol what even\nI can't reproduce being in IE 8 or IE 9 on Windows 7, either in standards or quirks mode. What am I missing?\nIE < 10 is fine. Problem occurs when using modern browser like Chrome, Firefox, IE = 10 or Edge. They returns . component prop as in Chrome. will compare your prop with default prop (which is ). on Chrome is so React treats it as missing value. Default prop () will be selected. the end, prop will be always set to on modern browser in this case.\nOh! Sorry I totally misread. Yes I can repro this."} {"_id":"q-en-react-32d61b30277c185f7229705afa6b94f0b47d1322e084100863712b1625ad5cd2","text":"The have this at the beginning: But there're a number of instances of JSX in the file. For example, . the note be removed or clarified? JSX be purged from the file? adding tests to this file should they be free of JSX? In certain contexts but not others?\nNormally, our style is to use jsx within tests. I think some of the tests explicitly aren't using jsx, and that's the point. Perhaps it would be better to copy-paste that message into each of the tests that doesn't use jsx, since it's easy to miss the note up at the top and having the note at the top is somewhat ambiguous.\nThanks for the feedback. Yeah, for both of those reasons I'd say :+1: to either that or splitting it into two files if that made sense to you (would help with the ease of missing it if it's just at the top and make the alternative of repeating it within the file unnecessary): .\nI'd be happy to submit a PR for either of these cases!\nI think I prefer having the inline comment copy-pasted. A little copy-pasting never hurt anyone (). I'd take a PR for this, assuming no one else objects."} {"_id":"q-en-react-7105d41f53f0318f45440b370c4bc8358501f54011301facb4e1bf93cf13e422","text":"(I am using 15rc2 because I need all the svg tags) I am rendering a foreignObject svg tag. According to I put body tag inside that tag and then whatever html I want in there. renderToString on the server leaves the body tag in place, and gives it a react-dataid. However when rendered on the client that body tag is removed. So when I look at the live elements, the body inside foreignObjects is gone, along with it's data-reactid. The server source ( ie view page source ) shows that the body tag was rendered with the missing react-dataid. The result is that you get a “Invariant Violation: Unable to find element with ID XX”, when the page updates, and somethings don't work. Removing the body from inside the foreignObject tag seems to solve the problem, but I don't know if that is an \"OK\" solution to this or if that body tag is necessary in some scenarios. But in either case this seems to be a scenario where server rendering results in different DOM/HTML then client rendering. Is this a problem, or is the body tag not supposed to there anyway? Todd\nWe never render the on the client side - only on the server side. Can you provide a jsfiddle that demonstrates the invariant violation?\nThanks for tracking down more specifically. Could be that browsers don't actually support that body usage? Or when actually parsed from markup, the body node doesn't exist (which seems likely and matches up with what we see in other situations where the browser changes markup). I won't have a chance to look into this more for a few days - it might be best to just use your alternate approach for now.\nI can remove the body tag. It seems to work ok with out it. Whats clear at this point is that if the server sends the body tag, it is not parsed into a DOM node, at least on mac with Chrome and Safari. That results in the error, since the data-reactid for the body is missing. IE doesn't support foreignObject so its not relevant there. MS Edge does, but I haven't tested it.\nIt seems so. Even without React, I can’t get Chrome (or Firefox for that matter) to make an actual node: