QueryCollection object

WinJS.Utilities.QueryCollection object

[This documentation is preliminary and is subject to change.]

Applies to: Metro style apps only

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:

Methods

The QueryCollection object has these methods.

MethodDescription
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.

clearStyle

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

constructor

Initializes a new instance of a QueryCollection

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.

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 supported client

Windows 8 Consumer Preview

Minimum supported server

Windows Server 8 Beta

Namespace

WinJS.Utilities

Library

Base.js

 

 

Build date: 2/10/2012

Ajouts de la communauté

AJOUTER
Afficher:
© 2016 Microsoft