Advertisement
Guest User

Untitled

a guest
May 29th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. #Issue Symptoms:
  2.  
  3. When on node add/edit page. When uploading images only one works and we get javascript error relating to jQuery function:
  4. ```[Error] TypeError: undefined is not a function (evaluating 'jQuery().onUserExit')
  5. (anonymous function) (content_lock_init.js, line 30)```
  6.  
  7. #Issue Analysis:
  8.  
  9. It seems the issue is related to how we are handling header/footer js and alternate versions of jQuery mapped to $ and jQuery. Because the jQuery plugins are mapped to $ and jQuery variable separately by Drupal and BH versions of jquery and javascript using the wrong($/jQuery) one will return undefined for some functions.
  10.  
  11. Content lock module has 2 javascript files which are inconsistently referring to jQuery in behaviors.
  12. Additionally the files we load for header and footer get initiated in hook_init therefore this happends on every request weather or not the actually page loads. Because of when doing file upload on node edit form, they get wired during ajax request and issue appears even though we are on admin page because while we avoid loading the BH js files on admin pages, ajax request avoid this exception.
  13.  
  14. #Fix:
  15.  
  16. The fix adds the files to theme folder overriding the default ones and making sure that behaviors wired properly and correct reference to jQuery is used by the module.
  17. Additionaly the part where we add BH js files and remap Jquery is moved to page hook_preprocess_html instead of hook_init this way it hopefully only runs on full page loads and not ajax requests.
  18.  
  19. #Issues/Further concerns:
  20.  
  21. This types of issues are unpredictable and hard to anticipate as loading 2 versions of jQuery is not recommended and if we are not careful the mapping gets out of sync. It seems that we will continue to discover issues once in a while as long as we loading the header/footer js the way we do.
  22.  
  23. #Testing:
  24.  
  25. - Test addding new node
  26. - Test adding all fields on node edit
  27. - Test editing node and updating/adding all fields
  28.  
  29. #Tested:
  30. - Switching Wisywig modes. - Works
  31. - Adding fields
  32. - Topshot
  33. - Images
  34. - C-Info
  35. - C-Headline
  36. - Multiple Item Images
  37. - Inserting images via insert.
  38.  
  39. # Results
  40.  
  41. - No problems.
  42. - No JS errors.
  43.  
  44. # Files affected by fix
  45. - bnh_includes.module
  46. - content_lock_init.js new file in theme
  47. - onUserExit.js new file in theme
  48. - template.php modified in theme
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement