selecting items and handle them sequentially #55

Open
opened 2025-10-14 18:04:27 -06:00 by navan · 0 comments
Owner

Originally created by @moelfassi on 7/13/2019

Subject of the issue

this is my page:
var html =
"<div class='time_head'>time_head content1</div>"
+ "<div class='blockfix'>blockfix1</div>"
+ "<div class='blockfix'>blockfix2</div>"
+ "<div class='time_head'>time_head content2</div>"
+ "<div class='blockfix'>blockfix3</div>"
+ "<div class='blockfix'>blockfix4</div>"
+ "<div class='blockfix'>blockfix5</div>";

i need to get the results in that order like :
TIME_HEAD CONTENT1
----blockfix1
----blockfix2
TIME_HEAD CONTENT2
----blockfix3
----blockfix4

this what i tried so far:
x(html, {
head: ['.time_head'],
games: ['.blockfix']

})(function (err, obj) {
console.log(obj['head']);
console.log(obj['games']);
});

Actual behaviour

but the result is:

[ 'time_head content1', 'time_head content2' ]
[ 'blockfix1', 'blockfix2', 'blockfix3', 'blockfix4', 'blockfix5' ]

*Originally created by @moelfassi on 7/13/2019* ### Subject of the issue this is my page: `var html =` ` "<div class='time_head'>time_head content1</div>"` `+ "<div class='blockfix'>blockfix1</div>"` `+ "<div class='blockfix'>blockfix2</div>"` `+ "<div class='time_head'>time_head content2</div>"` `+ "<div class='blockfix'>blockfix3</div>"` `+ "<div class='blockfix'>blockfix4</div>"` `+ "<div class='blockfix'>blockfix5</div>";` i need to get the results in that order like : `TIME_HEAD CONTENT1` `----blockfix1` `----blockfix2` `TIME_HEAD CONTENT2` `----blockfix3` `----blockfix4` this what i tried so far: `x(html, {` ` head: ['.time_head'],` ` games: ['.blockfix']` `})(function (err, obj) {` ` console.log(obj['head']);` ` console.log(obj['games']);` `});` ### Actual behaviour but the result is: > [ 'time_head content1', 'time_head content2' ] [ 'blockfix1', 'blockfix2', 'blockfix3', 'blockfix4', 'blockfix5' ]
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/x-ray#55
No description provided.