WinJS.UI.processAll function

Applies declarative control binding to all elements, starting at the specified root element.

Important  This function processes all the elements that are currently on the page. For security reasons, you should not call this function on content that has been added from an external source.


For more information about when to use this function, see Quickstart: Adding WinJS controls and styles.




  • rootElement
    Type: HTMLElement

    The element at which to start applying the binding. If this parameter is not specified, the binding is applied to the entire document.

Return value

A promise that is fulfilled when binding has been applied to all the controls.


When processing Windows Library for JavaScript controls, this method checks for a static property named isDeclarativeControlContainer. If this property exists and is set to true, this method processes the control itself but not any child controls it contains. If you create a custom control that itself creates other WinJS controls declaratively, and your control processes those controls, create a static property named isDeclarativeControlContainer on the custom control and set its value to true.


The following code shows how to use this function.

<div id="ratingControlHost" data-win-control="WinJS.UI.Rating"></div>
<script type="text/javascript">
    WinJS.UI.processAll().done(function () {
        var control = document.getElementById("ratingControlHost").winControl;
        control.averageRating = 3; 


Minimum WinJS version

WinJS 3.0



See also

Quickstart: Adding WinJS controls and styles