Opened 2 years ago
Closed 18 months ago
#3016 closed Defect (fixed)
Remove inline javascript
| Reported by: | brettp | Owned by: | ewinslow |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.8.x |
| Component: | Core | Version: | Github Master |
| Severity: | minor | Keywords: | |
| Cc: | brett@… | Difficulty: |
Description
All javascript should be encapsulated in the elgg JS object.
Change History (8)
comment:1 Changed 2 years ago by cash
comment:2 Changed 2 years ago by ewinslow
- Owner set to ewinslow
- Status changed from new to assigned
comment:3 Changed 2 years ago by brettp
Before diving in, let's establish policies for Cash's questions about when to extend and when to register. My initial reaction is that JS potentially used on every page should extend js/elgg and add its own named spaced object to the elgg object, while JS required only for some pages (like the slidy friends picker or the pages submenu children tree thing) should use elgg_register_js().
comment:4 Changed 2 years ago by ewinslow
(In [svn:8711]) Refs #3016: Removes inline javascript from embed, file, groups, messages, profile, thewire
comment:5 Changed 2 years ago by ewinslow
(In [svn:8712]) Refs #3016: Why didn't you make it in last commit?
comment:6 Changed 2 years ago by cash
(In [svn:8812]) Refs #3016 making the final elgg.js more readable
comment:7 Changed 2 years ago by ewinslow
- Milestone changed from Elgg 1.8 to Elgg 1.8.x
I've lost motivation to do this for 1.8. Based on my scan, it looks like collections, the friendspicker, walled garden, and image cropping are the biggest offenders. If they're not broken, we can refactor later. If they're broken, we can bump the milestone again...
comment:8 Changed 18 months ago by cash
- Resolution set to fixed
- Status changed from assigned to closed
I believe we have completed this. Any other individual problems can be their own tickets.

Should it all be in the elgg JS object by way of extending elgg.js or should some of it be in separate scripts/views that are only included on the appropriate pages? When do we extend the main elgg js view and when do we use a separate script?