meteor-jade icon indicating copy to clipboard operation
meteor-jade copied to clipboard

textarea $dyn error

Open mrzafod opened this issue 10 years ago • 8 comments

Hi, I've got a strange behaviour with textarea, see:

textarea.ctr.text(class=UIClass $dyn=UIDynamic)

got console outout

While building the application:
<runJavaScript-34>:506:18: Cannot read property 'length' of undefined (compiling client\ui\ui.jade)
  at HTMLTag (<runJavaScript-34>:506:18)
  at [object Object]._.extend.visitTag (<runJavaScript-39>:299:40)
  at [object Object]._.extend.visitNode (<runJavaScript-39>:245:39)
  at [object Object]._.extend.visitBlock (<runJavaScript-39>:229:24)
  at [object Object]._.extend.visitNode (<runJavaScript-39>:239:51)
  at [object Object]._.extend.visitBlock (<runJavaScript-39>:229:24)
  at [object Object]._.extend.visitNode (<runJavaScript-39>:240:28)
  at [object Object]._.extend.visitBlock (<runJavaScript-39>:229:24)
  at [object Object]._.extend.visitNode (<runJavaScript-39>:239:51)
  at [object Object]._.extend.visitBlock (<runJavaScript-39>:229:24)
  at [object Object]._.extend.visitNode (<runJavaScript-39>:239:51)
  at [object Object]._.extend.visitBlock (<runJavaScript-39>:229:24)
  at [object Object]._.extend.compile (<runJavaScript-39>:177:10)
  at sourceHandler (<runJavaScript-39>:532:46)

but when I write

textarea.ctr.text(class=UIClass $dyn=UIDynamic)= value
//- or
textarea.ctr.text(class=UIClass $dyn=UIDynamic) Hello hello

got

Exception from Deps recompute function: Error: Illegal HTML attribute name: 0
    at Object.HTML.flattenAttributes (http://main:3000/packages/htmljs.js?5ec21160f39f2d5f6f2b3219669b6e9e4fad4298:1020:15)
    at Blaze.DOMMaterializer.def.visitTag.updateAttributes (http://main:3000/packages/blaze.js?e22f88e24055201b48b93258f0a0a8e7b8b3a415:1417:35)
    at http://main:3000/packages/blaze.js?e22f88e24055201b48b93258f0a0a8e7b8b3a415:1805:16
    at Object.Blaze.withCurrentView (http://main:3000/packages/blaze.js?e22f88e24055201b48b93258f0a0a8e7b8b3a415:2038:12)
    at viewAutorun (http://main:3000/packages/blaze.js?e22f88e24055201b48b93258f0a0a8e7b8b3a415:1804:18)
    at Deps.Computation._compute (http://main:3000/packages/deps.js?b8042fd8eaf6c998f471f7afcfaa3cd47abc4aec:214:36)
    at new Deps.Computation (http://main:3000/packages/deps.js?b8042fd8eaf6c998f471f7afcfaa3cd47abc4aec:148:10)
    at Object.Deps.autorun (http://main:3000/packages/deps.js?b8042fd8eaf6c998f471f7afcfaa3cd47abc4aec:362:11)
    at Blaze.View.autorun (http://main:3000/packages/blaze.js?e22f88e24055201b48b93258f0a0a8e7b8b3a415:1803:16)
    at Blaze.DOMMaterializer.def.visitTag (http://main:3000/packages/blaze.js?e22f88e24055201b48b93258f0a0a8e7b8b3a415:1428:46) 

it seems like textarea doesn't work with dynamic attributes or jade compiler doesn't work right with. You can simply try

//- jade
template(name='testTextarea')
    textarea.ctr.text.white.wide($dyn=testDyn)= testValue
# coffee
Template.testTextarea.helpers
    testDyn: ->
        data = {}
        data['some-attr'] = 'some-attr'
        data['someattr'] = 'some attr'
        data
    testValue: -> 'hello there!'

and you'll get an empty textarea even without classes

mrzafod avatar Aug 11 '14 10:08 mrzafod

works well with v0.2.9

mrzafod avatar Nov 13 '14 05:11 mrzafod

@mquandalle can you look into this? I have a textarea($dyn=atts) {{value}} and $dyn and no attributes are being generated and no errors are produced either. However if I change the textarea to a div attributes are generated. =\

RobertLowe avatar Feb 16 '15 07:02 RobertLowe

@RobertLowe could you please open a new issue?

mquandalle avatar Feb 16 '15 16:02 mquandalle

I'm having the same issue, works perfect for input($dyn=this)

michaelevensen avatar May 25 '15 19:05 michaelevensen

@mquandalle I can create a new issue, but I think it would really be a duplicate of this issue...

@michaelevensen if you need a workaround, use a html template and include it that way, non-optimal though sorry...

RobertLowe avatar May 25 '15 20:05 RobertLowe

any news here?

all works fine with input, but textarea($dyn=attrs) throws:

Jade syntax error: Cannot read property 'length' of undefined
<runJavaScript-58>:73:14: Cannot read property 'head' of undefined

sunstorymvp avatar Sep 05 '15 22:09 sunstorymvp

I've modified a fork of this package with a new way of writing dynamic attributes, along with a few other useful features. The fork has been released as dalgard:jade.

Would you mind trying out the new package and see if you get the same error?

The new package will be kept in sync with the original, should there be any updates, and generally be maintained until, hopefully, the two packages can be merged.

dalgard avatar Oct 14 '15 11:10 dalgard

when will this be fixed?

sangyoo91 avatar Jul 18 '16 18:07 sangyoo91