6 ms·
The question makes no sense, in that case. The verbatim question is: > Does the above trigger a request for the current page (a reload without user interaction
by just2n 13y ago
The question makes no sense, in that case. The verbatim question is:
> Does the above trigger a request for the current page (a reload without user interaction) in any of the following:
The "without user interaction" as presented describes the request for the current page, implying a programmatic reload, not "will this code run without user interaction." Of course it won't, nor will this:
function foo(){
console.log('harharhar, I won\'t ever be printed, obviously!');
}
At which point the question is really a basic/pointless JS question and has nothing to do with the concept the question is trying to address. Further, the part that manually dispatches the event doesn't quite match the spec:
> If the currently executing task is the dispatch of a resize event in response to the user resizing the browsing context
Emphasis mine. It's reasonable for an implementation to interpret this as a manually fired event does not meet the criteria and reload the page, while the same code called while actually resizing the browsing context would not.
- jaffathecake 13y agoWell, the question does make sense, and it sounds like you've understood it on 2nd reading. > Of course it won't Then your answer should have been "no". Remember, the very first example is a paragraph, and it asks you if it makes a request for an image, I don't see you getting into the same rage about that. The resize question comes later on in the quiz, where the user may have thought "of course it won't" a few times when a particular browser does actually make a request. If all "of course it won't" examples actually made a request, it'd be a pretty simple quiz, right? > It's reasonable for an implementation to interpret this as a manually fired event does not meet the criteria and reload the page Agreed, it's a grey area. But this quiz is about what browsers do, not what the spec says. It's a difficult quiz, no one's expected to get everything right. My expectations were blown apart when I tested a lot of this stuff. You got stuff wrong, that's ok, don't let it ruin your day.
- just2n 13y ago> Then your answer should have been "no". Remember, the very first example is a paragraph, and it asks you if it makes a request for an image, I don't see you getting into the same rage about that. There's a fairly huge difference between how browsers handle HTML and JS. After fully parsing HTML, the DOM tree is completely built and once resources are loaded, the page is completely rendered. It's declarative. Code is different. No JS interpreter runs a function you define until you call it. So code is parsed and then later on, independent of its parsing, can do things. When you're asking if code does something, especially in the context of an event listener, it's expected you're actually running the code, regardless of how you've presented it. The HTML equivalent would have been to have asked if opening index.html here would've caused an alert to be shown. <!-- index.html --> <a href="image.html">Click me to see a funny picture.</a> <!-- image.html --> <img src="catpic1029381859834.png"> <script> alert('I hope you like my cat!'); </script> A quiz should be testing actual understanding/knowledge, not intermixing over-literal interpretations and breaking reader expectations. And the wording on the question is still wrong, because as I pointed out, the sans-user-action point is emphasizing the page reload event, not the code itself, so the only logical interpretation is that the resize event happens. Technically, this could still very well happen without user interaction: consider gravity pulling out a display cable and causing the window to be relocated/resized by the OS. > It's a difficult quiz, no one's expected to get everything right. Incorrect. It's a deceitful quiz. The delivery is excellent sans a few load-time render issues, but the content needs work.
- jaffathecake 13y ago> No JS interpreter runs a function you define until you call it. Right, but the browser can call it, that's the possibility we're dealing with here. If I assigned the code to window.onload rather than onresize, it would be called (by the browser). With the first phase of the onresize stage, the question was "does the browser call this without user interaction?". And hey, if the question had the page in an iframe, the function would be called in IE. Since a browser is so close to actually calling the function unexpectedly, I don't think it's unreasonable. > Technically, this could still very well happen without user interaction: consider gravity pulling out a display cable and causing the window to be relocated/resized by the OS I think it's reasonable and clear that the questions deal with the code presented and there's no outside influence unless stated. The point about no user interaction is emphasis, it's implicit throughout the quiz. Otherwise the user interaction could be the user opening devtools & adding code to the page to make the request, making every answer 'yes'. > Incorrect. It's a deceitful quiz. Crikey.