回答編集履歴

1

追記

2018/01/31 06:01

投稿

yambejp
yambejp

スコア114883

test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  $('body *').filter(function(){
10
10
 
11
- return ($(this).clone()).children().remove().end().text().replace(/\s/g,'');
11
+ return ($(this).clone()).children().remove().end().text().replace(/\s/g,'')!=="";
12
12
 
13
13
  }).each(function(){
14
14
 
@@ -55,3 +55,15 @@
55
55
  ```
56
56
 
57
57
  戻り:x1,x2,x5,x7,x8
58
+
59
+
60
+
61
+ 考え方:
62
+
63
+ 所定のタグについてfilterにて
64
+
65
+ - まず自分をcloneして
66
+
67
+ - その子要素を全部削除
68
+
69
+ - cloneのtext値から空白文字をすべて削除したものが空文字("")かどうかチェック