-
Notifications
You must be signed in to change notification settings - Fork 21.8k
Add mutation observer example to Azure AD B2C Javascript Docs #125905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
For manipulating DOM elements that are loaded by Azure AD B2C
@jamescrowley : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
Learn Build status updates of commit b540f5a: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
Thanks for your contribution @jamescrowley. Let me discuss this with the team to get a technical review and come back to you on it. |
I sent an email to the content owner today. @MicrosoftDocs/public-repo-pr-review-team |
I sent a Teams message to the content owner today. @MicrosoftDocs/public-repo-pr-review-team |
I sent an email to the content owner today. @MicrosoftDocs/public-repo-pr-review-team |
I sent a Teams message to the content owner today. @MicrosoftDocs/public-repo-pr-review-team |
I sent email to the content owner today. @MicrosoftDocs/public-repo-pr-review-team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the Azure AD B2C JavaScript documentation by adding a practical example of using mutation observers to interact with dynamically added DOM elements. The documentation previously mentioned mutation observers in passing but lacked concrete implementation guidance.
- Removes an overly long sentence that briefly mentioned mutation observers
- Adds a comprehensive explanation and code example demonstrating how to use mutation observers
- Provides practical guidance for developers who need to manipulate elements that Azure AD B2C adds dynamically
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
```javascript | ||
<script src="my-script.js" async></script> | ||
``` | ||
In either case, you may use inline scripts or an external script. If you wish to manipulate elements that Azure AD B2C dynamically adds to the template, you will need to use a mutation observer, as the elements will not be available when using deferred javascript execution or waiting for the DOMContentLoaded event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space in 'the DOMContentLoaded' - should be 'the DOMContentLoaded'.
In either case, you may use inline scripts or an external script. If you wish to manipulate elements that Azure AD B2C dynamically adds to the template, you will need to use a mutation observer, as the elements will not be available when using deferred javascript execution or waiting for the DOMContentLoaded event. | |
In either case, you may use inline scripts or an external script. If you wish to manipulate elements that Azure AD B2C dynamically adds to the template, you will need to use a mutation observer, as the elements will not be available when using deferred javascript execution or waiting for the DOMContentLoaded event. |
Copilot uses AI. Check for mistakes.
The documentation mentions mutation observers in passing but doesn't explain why or give an example of how to use them.
We probably need confirmation from the team that what I'm proposing here is considered 'supported' but this is the only way I have found to ensure we can access DOM elements that Azure AD B2C has added to the document.