{"issue":{"state":"closed","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/93f4664550548f6a59c647dd20b0484e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"93f4664550548f6a59c647dd20b0484e","url":"https://api.github.com/users/pyrsmk","login":"pyrsmk","id":214497},"assignee":null,"updated_at":"2011-11-15T19:49:01Z","labels":[],"comments":5,"closed_at":"2011-11-14T16:34:19Z","url":"https://api.github.com/repos/ded/domready/issues/12","body":"Hi,\r\n\r\nIt doesn't seem to work properly on Opera 9, DOM elements are not available yet on my [nut unit tests](https://github.com/pyrsmk/nut/unit) first block.\r\n\r\nCheers","html_url":"https://github.com/ded/domready/issues/12","title":"Fails on Opera 9","number":12,"id":2221214,"created_at":"2011-11-13T12:32:35Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/299a3d891ff1920b69c364d061007043?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"299a3d891ff1920b69c364d061007043","url":"https://api.github.com/users/jdalton","login":"jdalton","id":4303},"updated_at":"2011-11-15T19:49:01Z","url":"https://api.github.com/repos/ded/domready/issues/comments/2750146","body":"@pyrsmk\r\n\r\nI found the problem. It's because of this line:\r\n\r\n~~~ js\r\n , loaded = /^loade|c/.test(doc.readyState);\r\n~~~\r\n\r\nIn Opera 9-10.53 the initial `readyState` is `interactive`, just like uncached IE8, only in `domReady` IE takes a different fork avoiding the error.\r\n\r\nThe regexp `/^loade|c/.test(...)` matches the `c` in `interactive`.\r\nSomething like `/^(?:loade|c)/` would fix the issue.\r\n\r\nIf you are interested in the history of DOM ready solutions, quirks, or edge cases you might ping @dperini (or on [Twitter](https://twitter.com/#!/diegoperini)).\r\n\r\nDiego [pioneered](http://javascript.nwbox.com/IEContentLoaded/) the `doScroll()` technique used by this lib, and others like [Base2](http://code.google.com/p/base2/source/browse/trunk/src/base2/dom/events/DOMContentLoadedEvent.js#38), [jQuery](https://github.com/jquery/jquery/blob/8bc60bab5dd9747e7ae06c3fdb0c60782d346ff0/src/core.js#L925-926), [Dojo](https://github.com/dojo/dojo/blob/2b5aa2a685899b894917f3bc2de082b8ad9d9b3e/domReady.js#L40-47), [Facebook Connect](https://github.com/facebook/connect-js/blob/f3d138ee160337a9eab0f027407034d771218dbc/src/common/dom.js#L275-277), [MooTools](https://github.com/mootools/mootools-core/blob/fa1b235d742bca0b77ae9fe186c6740bd09cea3b/Source/Utilities/DOMReady.js#L52-60), [Prototype](https://github.com/sstephenson/prototype/blob/87807634992f3fde2938f482e52c5abe6b2cc67b/src/prototype/dom/event.js#L1363-1391), [qooxdoo](https://github.com/qooxdoo/qooxdoo/blob/3d202c260210662beff17bcda450c9bd92fec900/framework/source/class/qx/event/handler/Application.js#L242-256), [TinyMCE](https://github.com/tinymce/tinymce/blob/32f86e1cb181ca926e91a722c6d743b813d27412/jscripts/tiny_mce/classes/dom/EventUtils.js#L332-339), and [YUI](https://github.com/yui/yui3/blob/c64978b48fe561f13e3d68afc70d7c528946359b/src/event/js/event-ready-base-ie.js#L16-38). He geeks out on all things DOM ready, events, and selector engines ;D","id":2750146,"created_at":"2011-11-15T19:49:01Z"}}