@@ -4,6 +4,7 @@ var repeat = require('repeat-string')
44var is = require ( 'hast-util-is-element' )
55var resolve = require ( '../util/resolve' )
66var findSelectedOptions = require ( '../util/find-selected-options' )
7+ var wrapText = require ( '../util/wrap-text' )
78
89module . exports = input
910
@@ -43,7 +44,7 @@ function input(h, node) {
4344 list in byId &&
4445 is ( byId [ list ] , 'datalist' )
4546 ) {
46- values = findSelectedOptions ( byId [ list ] , props )
47+ values = findSelectedOptions ( h , byId [ list ] , props )
4748 }
4849
4950 if ( values . length === 0 ) {
@@ -59,8 +60,8 @@ function input(h, node) {
5960 if ( type === 'image' ) {
6061 return h ( node , 'image' , {
6162 url : resolve ( h , props . src ) ,
62- title : props . title || null ,
63- alt : values [ 0 ] [ 0 ]
63+ title : ( props . title && wrapText ( h , props . title ) ) || null ,
64+ alt : wrapText ( h , values [ 0 ] [ 0 ] )
6465 } )
6566 }
6667
@@ -74,7 +75,7 @@ function input(h, node) {
7475 results . push ( value [ 1 ] ? value [ 1 ] + ' (' + value [ 0 ] + ')' : value [ 0 ] )
7576 }
7677
77- return h . augment ( node , { type : 'text' , value : results . join ( ', ' ) } )
78+ return h ( node , 'text' , wrapText ( h , results . join ( ', ' ) ) )
7879 }
7980
8081 while ( ++ index < length ) {
@@ -83,8 +84,8 @@ function input(h, node) {
8384 url = type === 'email' ? 'mailto:' + text : text
8485
8586 results . push (
86- h ( node , 'link' , { title : null , url : url } , [
87- { type : 'text' , value : value [ 1 ] || text }
87+ h ( node , 'link' , { title : null , url : wrapText ( h , url ) } , [
88+ { type : 'text' , value : wrapText ( h , value [ 1 ] || text ) }
8889 ] )
8990 )
9091
0 commit comments