You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful degradation
Status: Missing fetch error handling: The fetch examples do not handle network/HTTP failures (no .catch() or status checks), encouraging silent failures without actionable context.
The extensions can listen to this event also, example for initialization for modified part of the page:
document.addEventListener('joomla:updated',function(event){constelements=event.target.querySelectorAll('.foo-bar');// ... do something with $elements});
joomla:removed
Dispatched over the changed container before its content will be removed or replaced.
... (clipped 15 lines)
</details>
> Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a>
</details></td></tr>
<tr><td><details>
<summary><strong>Generic: Security-First Input Validation and Data Handling</strong></summary><br>
**Objective:** Ensure all data inputs are validated, sanitized, and handled securely to prevent <br>vulnerabilities<br>
**Status:** <br><a href='https://github.com/joomla/Manual/pull/580/files#diff-ad6046e7b045d02f23b5a4c8419035279df37646a68bda5fe5c80e72c4b30b1fR44-R80'><strong>Unsafe HTML injection example</strong></a>: The examples assign <code>fetch()</code> response data directly into <code>innerHTML</code> without any sanitization <br>or “trusted content only” warning, which can promote XSS-prone patterns.<br>
<details open><summary>Referred Code</summary>
```markdown
const someContainer = document.querySelector('.my-dinamic-container');
fetch('/foobar/page')
.then(function(res) {
return res.text();
})
.then(function(data) {
someContainer.innerHTML = data;
someContainer.dispatchEvent(new CustomEvent('joomla:updated', { bubbles: true });
});
The extensions can listen to this event also, example for initialization for modified part of the page:
document.addEventListener('joomla:updated',function(event){constelements=event.target.querySelectorAll('.foo-bar');// ... do something with $elements});
joomla:removed
... (clipped 16 lines)
</details>
> Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a>
</details></td></tr>
<tr><td align="center" colspan="2">
- [ ] Update <!-- /compliance --update_compliance=true -->
</td></tr></tbody></table>
<details><summary>Compliance status legend</summary>
🟢 - Fully Compliant<br>
🟡 - Partial Compliant<br>
🔴 - Not Compliant<br>
⚪ - Requires Further Human Verification<br>
🏷️ - Compliance label<br>
</details>
✅ Complete the joomla:removed table row exampleSuggestion Impact:The documentation example for removing a dynamic table row was completed by adding code to remove the row from the DOM after dispatching the `joomla:removed` event (implemented as `row.parentNode.removeChild(row);` rather than `row.remove();`).
</details>
___
**The documentation for <code>joomla:removed</code> provides an incomplete example for removing <br>a table row. It should be updated to include the code that removes the element <br>from the DOM after dispatching the event.**
### Examples:
<details>
<summary>
<a href="https://github.com/joomla/Manual/pull/580/files#diff-ad6046e7b045d02f23b5a4c8419035279df37646a68bda5fe5c80e72c4b30b1fR83-R87">docs/general-concepts/javascript/events.md [83-87]</a>
</summary>
```markdown
Example removing row of a dynamic table:
```javascript
const row = myTable.querySelector('.row-to-remove');
row.dispatchEvent(new CustomEvent('joomla:removed', { bubbles: true }));
</details>
### Solution Walkthrough:
#### Before:
```markdown
```javascript
// Example removing row of a dynamic table:
const row = myTable.querySelector('.row-to-remove');
row.dispatchEvent(new CustomEvent('joomla:removed', { bubbles: true }));
#### After:
```markdown
```javascript
// Example removing row of a dynamic table:
const row = myTable.querySelector('.row-to-remove');
row.dispatchEvent(new CustomEvent('joomla:removed', { bubbles: true }));
row.remove();
<details><summary>Suggestion importance[1-10]: 7</summary>
__
Why: The suggestion correctly identifies an incomplete code example in the documentation, which could mislead developers; fixing it is important for the quality and clarity of the new documentation.
</details></details></td><td align=center>Medium
</td></tr><tr><td rowspan=2>Possible issue</td>
<td>
<details><summary>Fix syntax errors in code example</summary>
___
**Fix two syntax errors in the <code>myshop:add-to-cart</code> JavaScript example. Add a <br>missing comma after the <code>detail</code> property and correct the closing parentheses for <br>the <code>CustomEvent</code> constructor and <code>dispatchEvent</code> call.**
[docs/general-concepts/javascript/events.md [20-25]](https://github.com/joomla/Manual/pull/580/files#diff-ad6046e7b045d02f23b5a4c8419035279df37646a68bda5fe5c80e72c4b30b1fR20-R25)
```diff
// Shop extension:
window.dispatchEvent(new CustomEvent('myshop:add-to-cart', {
- detail: {sku:'productSku', amount:10, name: 'Foo Bar'}
+ detail: {sku:'productSku', amount:10, name: 'Foo Bar'},
bubbles: true,
cancelable: true,
-});
+}));
Apply / Chat
Suggestion importance[1-10]: 5
__
Why: The suggestion correctly identifies two syntax errors in the JavaScript example code: a missing comma and incorrect closing parentheses. Fixing these makes the example code valid and runnable, which is important for documentation.
Low
✅ Fix missing parentheses in event dispatchesSuggestion Impact:Added the missing closing parentheses to both dispatchEvent(new CustomEvent(...)) calls, making the JavaScript example syntactically correct.
Why: The suggestion correctly identifies a recurring syntax error (missing closing parenthesis) in two dispatchEvent calls within a JavaScript code example. Correcting this makes the example valid, improving the quality of the documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
This is information about
joomla:updatedandjoomla:removedeventsUpdated copy of https://docs.joomla.org/J4.x:ClientSideEvents
Reference:
PR Type
Documentation
Description
Add comprehensive documentation for client-side JavaScript events
Document
joomla:updatedevent for content change notificationsDocument
joomla:removedevent for pre-removal cleanupInclude naming conventions and practical code examples
Diagram Walkthrough
File Walkthrough
events.md
Client-side JavaScript events guidedocs/general-concepts/javascript/events.md
(namespace:eventname)
joomla:updatedevent with AJAX content update examplesjoomla:removedevent with removal and table row examples