{"action":"created","issue":{"url":"https://api.github.com/repos/edx/edx-platform/issues/11433","repository_url":"https://api.github.com/repos/edx/edx-platform","labels_url":"https://api.github.com/repos/edx/edx-platform/issues/11433/labels{/name}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/11433/comments","events_url":"https://api.github.com/repos/edx/edx-platform/issues/11433/events","html_url":"https://github.com/edx/edx-platform/pull/11433","id":131494069,"number":11433,"title":"Pass DOM element, not jQuery object to XBlock initialisation.","user":{"login":"smarnach","id":249196,"avatar_url":"https://avatars.githubusercontent.com/u/249196?v=3","gravatar_id":"","url":"https://api.github.com/users/smarnach","html_url":"https://github.com/smarnach","followers_url":"https://api.github.com/users/smarnach/followers","following_url":"https://api.github.com/users/smarnach/following{/other_user}","gists_url":"https://api.github.com/users/smarnach/gists{/gist_id}","starred_url":"https://api.github.com/users/smarnach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarnach/subscriptions","organizations_url":"https://api.github.com/users/smarnach/orgs","repos_url":"https://api.github.com/users/smarnach/repos","events_url":"https://api.github.com/users/smarnach/events{/privacy}","received_events_url":"https://api.github.com/users/smarnach/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-02-04T22:35:59Z","updated_at":"2016-02-11T13:38:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/11433","html_url":"https://github.com/edx/edx-platform/pull/11433","diff_url":"https://github.com/edx/edx-platform/pull/11433.diff","patch_url":"https://github.com/edx/edx-platform/pull/11433.patch"},"body":"The function `initializeXBlock()` expects a DOM element, and is passed one in most cases.  However, when adding a new XBlock component in Studio, the function is passed a jQuery object, which ends up being forwarded to the actual initialisation function of the XBlock.  This is inconsistent, and led to buggy behaviour in one of our XBlocks.  This bug has been around for at least a year.\r\n\r\nThis fix tries to make the type of element passed on to XBlock implementations more consistent.\r\n\r\nI assumed that this change would be backwards compatible, since currently XBlock initialisation routines need to be able to handle either a jQuery object or a DOM element.  However, some XBlock initialisers are only ever called via the code path that wrongly uses a jQuery objects, and some of these XBlocks depend on the wrong behaviour.  I fixed the problems exposed by the edx-platform test suite, but there still might be external XBlocks that will break with this patch applied.\r\n\r\n**JIRA tickets**: [YONK-268](https://openedx.atlassian.net/browse/YONK-268)\r\n\r\n**Sandbox URL**: [LMS](http://pr11433.sandbox.opencraft.com/) [Studio](http://studio.pr11433.sandbox.opencraft.com/)\r\n\r\n**Partner information**: TBD\r\n\r\n**Reviewers**\r\n- [ ] Code: @Kelketek\r\n- [ ] Platform: (TBD)\r\n"},"comment":{"url":"https://api.github.com/repos/edx/edx-platform/issues/comments/182868129","html_url":"https://github.com/edx/edx-platform/pull/11433#issuecomment-182868129","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/11433","id":182868129,"user":{"login":"smarnach","id":249196,"avatar_url":"https://avatars.githubusercontent.com/u/249196?v=3","gravatar_id":"","url":"https://api.github.com/users/smarnach","html_url":"https://github.com/smarnach","followers_url":"https://api.github.com/users/smarnach/followers","following_url":"https://api.github.com/users/smarnach/following{/other_user}","gists_url":"https://api.github.com/users/smarnach/gists{/gist_id}","starred_url":"https://api.github.com/users/smarnach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarnach/subscriptions","organizations_url":"https://api.github.com/users/smarnach/orgs","repos_url":"https://api.github.com/users/smarnach/repos","events_url":"https://api.github.com/users/smarnach/events{/privacy}","received_events_url":"https://api.github.com/users/smarnach/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T13:38:39Z","updated_at":"2016-02-11T13:38:39Z","body":"@andy-armstrong Would you be able to review this PR?"}}