다음을 통해 공유


WinJS.Utilities.QueryCollection object

Represents the result of a query selector, and provides various operations that perform actions over the elements of the collection.

Syntax

var querycollection = WinJS.Utilities.query(query, element);

Members

The QueryCollection object has these types of members:

  • Constructors
  • Methods

Constructors

The QueryCollection object has these constructors.

Constructor Description
QueryCollection

Initializes a new instance of a QueryCollection

 

Methods

The QueryCollection object has these methods.

Method Description
addClass

Adds the specified class to all the elements in the collection.

children

Creates a QueryCollection that contains the children of the specified parent element (static).

clearStyle

Clears the specified style property for all the elements in the collection.

control

Creates controls that are attached to the elements in this QueryCollection, if the ctor parameter is a function, or configures the controls that are attached to the elements in this QueryCollection, if the ctor parameter is an object.

forEach

Performs an action on each item in the QueryCollection.

get

Gets an item from the QueryCollection.

getAttribute

Gets an attribute value from the first element in the collection.

hasClass

Determines whether the specified class exists on the first element of the collection.

id

Looks up an element by ID and wraps the result in a QueryCollection.

include

Adds a set of items to this QueryCollection.

listen

Registers the listener for the specified event on all the elements in the collection.

query

Executes a query selector on all the elements in the collection and aggregates the result into a QueryCollection.

removeClass

Removes the specified class from all the elements in the collection.

removeEventListener

Unregisters the listener for the specified event on all the elements in the collection.

setAttribute

Sets an attribute value on all the items in the collection.

setStyle

Sets the specified style property for all the elements in the collection.

template

Renders a template that is bound to the given data and parented to the elements included in the QueryCollection. If the QueryCollection contains multiple elements, the template is rendered multiple times, once at each element in the QueryCollection per item of data passed.

toggleClass

Toggles (adds or removes) the specified class on all the elements in the collection. If the class is present, it is removed; if it is absent, it is added.

 

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Utilities