const footer = article.querySelector('footer'); //gets the node correctly
then
comments = footer.querySelector('span[data-sigil="comments-token"]'); //doesn't capture the node
this is the fragment i'm trying to traverse (where a span element with a data-sigil="comments-token" attribite exists)
<footer class="_22rc" data-ft="{"tn":"*W"}">
<div class="_2ip_ _4b44" id="feedback_inline_2988733091416038" data-sigil="mufi-inline">
<div class="_34qc _3hxn _3myz _4b45"><a
href="/groups/2965875847035096?view=permalink&id=2988733091416038&anchor_composer=false&refid=18&_ft_=qid.6866412159452221316%3Amf_story_key.2988733091416038%3Agroup_id.2965875847035096%3Atop_level_post_id.2988733091416038%3Atl_objid.2988733091416038%3Acontent_owner_id_new.100015580839785%3Apage_id.2965875847035096%3Asrc.22%3Aphoto_attachments_list.%5B875714729624547%2C875714799624540%2C875714842957869%2C875714896291197%5D%3Aphoto_id.875714729624547%3Astory_location.6%3Astory_attachment_style.album%3Afilter.GroupStoriesByActivityEntQuery%3Atds_flgs.3%3Apage_insights.%7B%222965875847035096%22%3A%7B%22page_id%22%3A2965875847035096%2C%22page_id_type%22%3A%22group%22%2C%22actor_id%22%3A100015580839785%2C%22dm%22%3A%7B%22isShare%22%3A0%2C%22originalPostOwnerID%22%3A0%7D%2C%22psn%22%3A%22EntGroupMallPostCreationStory%22%2C%22post_context%22%3A%7B%22object_fbtype%22%3A657%2C%22publish_time%22%3A1598609550%2C%22story_name%22%3A%22EntGroupMallPostCreationStory%22%2C%22story_fbid%22%3A%5B2988733091416038%5D%7D%2C%22role%22%3A1%2C%22sl%22%3A6%7D%7D&__tn__=%2AW-R"
role="button" data-sigil="feed-ufi-trigger">
<div class="_rnk _77ke _2eo- _1e6 _4b44" id="u_0_3f" data-sigil="reactions-bling-bar">
<div class="_1w1k" data-sigil="reactions-sentence-container"><span class="_qfz _77kf">
<div class="_1g05 _77lc" style="z-index:3"><i class="img sp_t0F5GNpHI8g sx_bb89e7"
role="presentation"><u>Mi piace</u></i></div>
</span>
<div class="_1g06" aria-label="4 ha aggiunto reazioni, tra cui Mi piace">4</div>
</div>
<div class="_1fnt"><span class="_1j-c" data-sigil="comments-token">Commenti: 5</span></div>
</div>
</a></div>
<div class="_52jh _7om2 _15kk _15ks _15km _4b47 _4b46" data-sigil="ufi-inline-actions">
<div class="_52jj _15kl _3hwk _4g34"><a class="_15ko _77li touchable"
data-store="{"reaction":0,"feedbackTarget":2988733091416038,"kaiOSReactions":false}"
aria-pressed="false" role="button" data-ft="{"tn":">"}" id="u_0_3g"
data-sigil="touchable ufi-inline-like like-reaction-flyout" data-autoid="autoid_40"
data-uri="https://m.facebook.com/ufi/reaction/?ft_ent_identifier=2988733091416038&reaction_type=1&story_render_location=group&feedback_source=2&is_sponsored=0&ext=1598970363&hash=AeQxJKCaVFJm_BkK&refid=18&_ft_=qid.6866412159452221316%3Amf_story_key.2988733091416038%3Agroup_id.2965875847035096%3Atop_level_post_id.2988733091416038%3Atl_objid.2988733091416038%3Acontent_owner_id_new.100015580839785%3Apage_id.2965875847035096%3Asrc.22%3Aphoto_attachments_list.%5B875714729624547%2C875714799624540%2C875714842957869%2C875714896291197%5D%3Aphoto_id.875714729624547%3Astory_location.6%3Astory_attachment_style.album%3Afilter.GroupStoriesByActivityEntQuery%3Atds_flgs.3%3Apage_insights.%7B%222965875847035096%22%3A%7B%22page_id%22%3A2965875847035096%2C%22page_id_type%22%3A%22group%22%2C%22actor_id%22%3A100015580839785%2C%22dm%22%3A%7B%22isShare%22%3A0%2C%22originalPostOwnerID%22%3A0%7D%2C%22psn%22%3A%22EntGroupMallPostCreationStory%22%2C%22post_context%22%3A%7B%22object_fbtype%22%3A657%2C%22publish_time%22%3A1598609550%2C%22story_name%22%3A%22EntGroupMallPostCreationStory%22%2C%22story_fbid%22%3A%5B2988733091416038%5D%7D%2C%22role%22%3A1%2C%22sl%22%3A6%7D%7D&__tn__=%3E%2AW-R">Mi
piace</a>
<div class="_1ekf" role="link" tabindex="-1" data-sigil="screenreader-reactions-trigger">Vedi altre
reazioni</div>
</div>
<div class="_52jj _15kl _3hwk _4g34"><a class="_15kq _77li"
data-click="{"event":"click_comment_ufi","target_id":2988733091416038}"
href="/groups/2965875847035096?view=permalink&id=2988733091416038&fs=2&focus_composer=0&refid=18&_ft_=qid.6866412159452221316%3Amf_story_key.2988733091416038%3Agroup_id.2965875847035096%3Atop_level_post_id.2988733091416038%3Atl_objid.2988733091416038%3Acontent_owner_id_new.100015580839785%3Apage_id.2965875847035096%3Asrc.22%3Aphoto_attachments_list.%5B875714729624547%2C875714799624540%2C875714842957869%2C875714896291197%5D%3Aphoto_id.875714729624547%3Astory_location.6%3Astory_attachment_style.album%3Afilter.GroupStoriesByActivityEntQuery%3Atds_flgs.3%3Apage_insights.%7B%222965875847035096%22%3A%7B%22page_id%22%3A2965875847035096%2C%22page_id_type%22%3A%22group%22%2C%22actor_id%22%3A100015580839785%2C%22dm%22%3A%7B%22isShare%22%3A0%2C%22originalPostOwnerID%22%3A0%7D%2C%22psn%22%3A%22EntGroupMallPostCreationStory%22%2C%22post_context%22%3A%7B%22object_fbtype%22%3A657%2C%22publish_time%22%3A1598609550%2C%22story_name%22%3A%22EntGroupMallPostCreationStory%22%2C%22story_fbid%22%3A%5B2988733091416038%5D%7D%2C%22role%22%3A1%2C%22sl%22%3A6%7D%7D&__tn__=S%2AW-R"
data-ft="{"tn":"S"}"
data-sigil="feed-ufi-focus feed-ufi-trigger ufiCommentLink mufi-composer-focus">Commenta</a></div>
</div>
</div>
</footer>
The examples you gave work. See https://jsfiddle.net/zmg8sc7h/
Perhaps the article.querySelector('footer'); is finding another footer section and not the one you're expecting. Try article.querySelectorAll('footer'); or document.querySelectorAll('footer'); to see how many results you get, or try making that part more specific like document.querySelector('footer._22rc');
You might as well just select what you want directly though instead of going through two queries.
document.querySelector('footer span[data-sigil="comments-token"]');
Related
<div class="list-group bg-light no-border list-group-opt no-radius m-b-none">
<a class="list-group-item" on-tap="enterIndividual">
<div class="primary-info"
<div class="pull-left w-1x">
<img src={{avatar}} class="w-full r-3x"/>
</div>
<div class="pull-left m-l intro">
<span class="text-lg font-bold text-black m-b-sm">{{name}}</span>
<i class="fa fa-user"></i>
<div class="text-muted long-intro">
<span>{{detail}}</span>
</div>
</div>
</div>
</a>
</div>
It works well in computer,but when I tested it in my mobile,it had no react for touching.But if I use on-click instead of on-tap,it performs pretty well.So I am puzzled with this problem.Are there any requirement to use on-tap.Oh,it still has a strange point.If I touch it above a half of the div,it can work.What's the problem?
First, there are some errors in the code:
close the div.primary-info tag
a-tags are not allowed (HTML5) to contain block elements (div) - usually not a problem, but can cause some and will definitely not validate.
I guess your problem is, that the a-tag enclosing everything does not have the proper height and width. Try to give it a background and u'll see how large the a-tag is actually rendered as the tappable area.
U can simply skip the a-tag and move your event on-tag to the div.primary-info
I have an strange issue with displaying graphs in AMD Layout.
There are two widgets in which I've defined graphs and here is how it looks like - you can see that graphs in widgets go out of their area
I've tried reproduce this bug in plunker and there is nothing wrong :/
When I make a small change in browser (for example, I move the edge of the browser), graphs return to the right place -> http://recordit.co/mRmNAjH840
<div layout="row" ng-controller="GraphCtrl" layout-md="column" layout-sm="column" layout-margin="">
<section class="widget md-whiteframe-z1 ng-isolate-scope md-cyan-theme" ng-class="{'widget-overlay-title': overlayTitle}" ng-attr-layout="{{widgetLayout}}" content-padding="" flex-gt-lg="66" flex-gt-md="66">
<div class="panel-heading">Widget1<span flex=""></span>
</div>
<div class="panel-body">
<div id="chart1"></div>
</div>
</section>
<section class="widget md-whiteframe-z1 ng-isolate-scope md-cyan-theme" ng-class="{'widget-overlay-title': overlayTitle}" ng-attr-layout="{{widgetLayout}}" content-padding="" flex-gt-lg="32" flex-gt-md="32">
<div class="panel-heading">Widget2<span flex=""></span>
</div>
<div class="panel-body">
<div id="c3_combined"></div>
</div>
</section>
</div>
I'm not sure if this is related to your problem, but on IE, I have to add this CSS property manually :
svg { overflow: hidden; }
I have two simple lists that I can drag my questions to and from. Each time I drag one of the questions it changes its "Active" status to true or false:
$scope.onDrop = function ($event, $data, array) {
if ($data.Active) {
$data.Active = false;
array.push($data);
}
else if (!$data.Active) {
$data.Active = true;
array.push($data);
}
};
This works great but I need to restrict the user from being able to drag and drop into the same list as they are dragging from since that also triggers the onDrop function.
I'm using : http://angular-dragdrop.github.io/angular-dragdrop/
I have just started out with drag and drop but from what I can tell of the documentation is that I have to use the drag-channel/drop-channel attributes , however I am having a hard time understanding how they actually work.
In my markup I have two panels like so:
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Aktiva frågor
</div>
<div class="panel panel-body">
<ul class="dnd"
drag-channel="A"
drop-channel="A"
ui-on-drop="onDrop($event,$data,activeQuestions)">
<li ui-draggable="true" drag="aquestion"
on-drop-success="dropSuccessHandler($event,$index,activeQuestions)"
ng-repeat="aquestion in activeQuestions track by $index">
{{aquestion.Name}}
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Inaktiva Frågor
</div>
<div class="panel panel-body" >
<ul class="dnd"
drag-channel="B"
drop-channel="B"
ui-on-drop="onDrop($event,$data,inactiveQuestions)">
<li ui-draggable="true" drag="iquestion"
on-drop-success="dropSuccessHandler($event,$index,inactiveQuestions)"
ng-repeat="iquestion in inactiveQuestions track by $index">
{{iquestion.Name}}
</li>
</ul>
</div>
</div>
</div>
I have tried all kinds of combinations of A and B but none are working so obviously I seem to not understand the logic of them.
Or if this is not the best way to attack the problem please let me know of a better way. :)
Solved it by moving the Active logic into my code behind instead.
I'm learning AngularJs and I got to a small brick wall...
when I want to split items into tabs, my template is exactly the same for all the tabs, the only small change if the model used in the ng-repeat, as an example:
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="tier6">
<div ng-include="'partials/vehicles-6-details.html'"></div>
</div>
<div role="tabpanel" class="tab-pane fade" id="tier8">
<div ng-include="'partials/vehicles-8-details.html'"></div>
</div>
<div role="tabpanel" class="tab-pane fade" id="tier10">
<div ng-include="'partials/vehicles-10-details.html'"></div>
</div>
</div>
This way I have to create 3 exact files, where the template is:
<ul class="list-unstyled list-inline list-tier">
<li ng-repeat="tank in tankInfoLevel6" data-sortby="{{playersByTankId[tank].length}}">
<span class="badge">{{playersByTankId[tank].length}}</span>
<img ng-src="{{tankInfo[tank].image}}" alt="" class="tank-img"
pop-over title="Tank fans" fans="tanksFans[tank]" />
<br><b>{{tankInfo[tank].name_i18n}}</b>
<br>({{tankInfo[tank].type_i18n}})
</li>
</ul>
and the only change is tankInfoLevel6 by tankInfoLevel8 and tankInfoLevel10 respectively.
How can I use a simple file?
I've tried:
<div ng-include="'partials/vehicles-details.html'"
ng-init="tierTanks = tankInfoLevel6"></div>
and also with onLoad and onInclude without any good results.
The output is showing the last tab contents in all tabs, so it seems that it loads all but the last call with tankInfoLevel10 is the one that overrides all the tabs.
Is there a way to make this work neatly?
What about ng-repeat?
<div ng-repeat="tankItem in tankItems">
<div ng-include="'partials/vehicles-details.html'"></div>
</div>
In template use tankItem.
Wouldn't a directive work better here, using an attribute to pass/reference the tankItems list?
My index.html page is like as follows:
<div id="sidepanel" data-ng-controller="ListCtrl">
<li data-ng-repeat="record in records">
{{record.id}}
<input type="checkbox" data-ng-model="addwidget">
</li>
</div>
<div id="main">
<div data-ng-view></div>
</div>
for this data-ng-view i have another page recordlist.html in that i have following code:
<div data-ng-controller="ListCtrl">
<ul class="design">
<li data-ng-repeat="record in records">
<div data-ng-switch data-on="record.category">
<div data-ng-switch-when="reporting1">
<div id="{{record.id}}" data-ng-show="addwidget">{{record.description}}</div>
</div>
<div data-ng-switch-when="reporting2">
<div id="{{record.id}}" data-ng-hide="addwidget">{{record.description}}</div>
</div>
</li>
</ul>
</div>
My question is i want to show the first div when i check the checkbox & when i uncheck it i want to show the second div.When both of the data-ng-model & data-ng-hide/show are on the same page then it works fine but in my case it present on two different pages.
Is it correct ? How can i implement this. Need Help.Thanks.
The problem is that you are setting addwidget in the first controller, but is trying to use it in the second. Controllers are not singletons.
So, in this situation:
<div id="sidepanel" data-ng-controller="ListCtrl">
...
</div>
<div id="main">
<div data-ng-view>
<div data-ng-controller="ListCtrl">
</div>
</div>
</div>
You got two separated controllers and scopes. And you are setting addwidget in the first trying to read in the second.
You can either bind it to the root scope $root.addwidget or use a service share to the states.
As you have many records, binding directly to root is a problem, as all of them are going to share the same state. So you gonna need an object in the rootScope and bind the option by id $root.addwidget[record.id]. Made a pretty simplified modification here.