回答編集履歴
1
追記
answer
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
```javacript
|
4
4
|
$(function(){
|
5
5
|
$('body *').filter(function(){
|
6
|
-
return ($(this).clone()).children().remove().end().text().replace(/\s/g,'');
|
6
|
+
return ($(this).clone()).children().remove().end().text().replace(/\s/g,'')!=="";
|
7
7
|
}).each(function(){
|
8
8
|
console.log($(this).attr('id'));
|
9
9
|
});
|
@@ -26,4 +26,10 @@
|
|
26
26
|
</dl>
|
27
27
|
</body>
|
28
28
|
```
|
29
|
-
戻り:x1,x2,x5,x7,x8
|
29
|
+
戻り:x1,x2,x5,x7,x8
|
30
|
+
|
31
|
+
考え方:
|
32
|
+
所定のタグについてfilterにて
|
33
|
+
- まず自分をcloneして
|
34
|
+
- その子要素を全部削除
|
35
|
+
- cloneのtext値から空白文字をすべて削除したものが空文字("")かどうかチェック
|