- From: Becky Gibson <Becky_Gibson@notesdev.ibm.com>
- Date: Fri, 20 Jul 2007 12:29:39 -0400
- To: wai-xtech@w3.org
- Message-ID: <OF6BB00884.C02046D0-ON8525731E.005A008F-8525731E.005A9AA3@LocalDomain>
I am assuming that you obtained enable.js from [1]. You can't just call initApp() again because it sets a flag indicating that the document has been initialized so it won't run again. Below is the modified code that includes initContent. Notice that initApp() has been modified to call initContent so that initApp will still set the initialized flag but initContent can be called multiple times. When you update an element, call initContent(elementObject) to update the roles and states or you can call the setAttr() (found in enable.js) method to modify just one property. function initApp(elmRoot) { if (document.isInitialized) { return; // Avoid second initialization -- we inited early because of DOMContentLoaded } document.isInitialized = true; if ((!elmRoot) || (!elmRoot.getElementsByTagName)) { elmRoot = document.body; } initContent(elmRoot); } function initContent(elmRoot) { if (/axs /.test(elmRoot.className)) { setRolesAndStates(elmRoot); // First do root element } if (document.evaluate) { var snapAccessibleElements = document.evaluate(".//*[contains(@class, 'axs ')]", elmRoot, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = snapAccessibleElements.snapshotLength - 1; i >= 0; i--) { setRolesAndStates(snapAccessibleElements.snapshotItem(i)); } } else { var arElements = (typeof elmRoot.all != 'undefined') ? elmRoot.all : elmRoot.getElementsByTagName('*'); var iElementCount = arElements.length; for (var i = 0; i < iElementCount; i++) { if (/axs /.test(arElements[i].className)) { setRolesAndStates(arElements[i]); } } } }; [1] Becky Gibson Web Accessibility Architect IBM Emerging Internet Technologies 5 Technology Park Drive Westford, MA 01886 Voice: 978 399-6101; t/l 333-6101 Email: gibsonb@us.ibm.com blog: WebA11y wai-xtech-request@w3.org wrote on 07/20/2007 03:42:19 AM: > Hi all, > I am using this script library to add roles to an html document. The > white paper at http://www.w3. > org/WAI/PF/adaptable/HTML4/embedding-20060318.html says that I > should call the initContent method when a new element is added to > the DOM. I can't find this method in the enable.js file. Can I call > initApp with the new element reference instead? > Secondly, when I update the class attribute of an element to add > role or state information, will calling initApp again with the > element reference update the platform accessibility API information? > Thanks for any help in this regard. > Regards, > Kiran Kaja. > TCCI PU Test Services (ATL) > SAP Labs India Pvt. Ltd. > Salarpuria GR Tech Park, > 69/2 Mahadevapura, KR Puram, > Whitefield, Bangalore - 66 > Ph: +91-80-4139-9736 > Mobile: +91-9980027372 > E-mail: kiran.kaja@sap.com > This e-mail may contain trade secrets or privileged, undisclosed, or > otherwise confidential information. If you have received this e-mail > in error, you > are hereby notified that any review, copying, or distribution of it > is strictly prohibited. Please inform us immediately and destroy the > original transmittal. > Thank you for your cooperation.
Received on Friday, 20 July 2007 16:30:01 UTC