mavoweb / sort

Sorting for Mavos!
0 stars 1 forks source link

Uncaught TypeError: prevNode.find is not a function #5

Open Glench opened 4 years ago

Glench commented 4 years ago

I get a JS error in the console when I try to use this plugin:

    at mavo-sort.js:226
    at Array.sort (<anonymous>)
    at Object.Mavo.Functions.sort (mavo-sort.js:142)
    at Mavo.Collection.sortDOM (mavo-sort.js:305)
    at HTMLDivElement.<anonymous> (mavo-sort.js:106)
    at HTMLSpanElement.fire (mavo0.2.0.min.js:1)
    at Object.r.type.n.element.r.Element.r.Element.<computed> (mavo0.2.0.min.js:1)
    at Function.r.type.n.$.r.<computed> [as fire] (mavo0.2.0.min.js:1)
    at Mavo.Primitive.dataChanged (mavo0.2.0.min.js:13)
    at Mavo.Primitive.dataChanged (mavo0.2.0.min.js:13)

Here's the Mavo/HTML file. To replicate, add a name and then try sending a couple messages.

<!DOCTYPE html>
<html lang="en-US" prefix="og: http://ogp.me/ns#">

    <head>
        <title>Chat Test Mavo</title>
        <style type="text/css">
            html, body {
                margin: 0;
                padding: 0;
                font-size: 13px;
                font-family: Helvetica, Arial, sans-serif;
                line-height: 1;
            }
            table {
                border-collapse: collapse;
                border-spacing: none;
            }
            div[mv-app="chatRemote"] {
                border: 1px solid #ccc;
                padding: 10px;
                margin: 10px;
            }
            .message {
                font-size: 18px;
                line-height: 1.5;
            }
            #draft {
                font-size: 18px;
                padding: 3px;
                display: inline-block;
            }
            #send {
                display: inline-block;
            }

        </style>
        <link rel="stylesheet" href="https://get.mavo.io/stable/mavo.css" />
        <script src="mavo0.2.0.min.js" charset="utf-8"></script>
        <script src="mavo-gdrive.js" charset="utf-8"></script>
        <script src="mavo-sort.js" charset="utf-8"></script>

    </head>
    <body>

        <h1>Public Mavo Chat App</h1>
        <p>Please don't post any bad content. This chat is unmoderated.</p>

        <div mv-app="chatRemote" mv-plugins="sort" mv-storage="local" 
            mv-server-push="true" mv-autosave="1" mv-bar="none" >
            <div property="message" mv-multiple mv-initial-items="0" mv-sort="timestamp">
                <div class="message">
                    <span property="name"></span>: <span property="text"></span><span property="timestamp" hidden></span>
                </div>
            </div>
        </div>

        <div mv-app="chatLocal" mv-storage="local" mv-autosave>
            Your username: <input property="name" />
            <form mv-action="add(group(name: name, text: draft, timestamp: $now), chatRemote.message); set(draft, '')">
                <input id="draft" placeholder="type message here" disabled="[len(name) = 0]" property="draft" autocomplete="off" mv-value="[if(name, '', 'Please create a name before sending a message')]" />
                <input id="send" type="button" disabled="[len(name) = 0]" value="send message" />
            </form>
        </div>

    </body>
</html>
chiotis commented 4 years ago

Same error here

Uncaught TypeError: prevNode.find is not a function
at mavo-sort.js:224
at Array.sort ()
at Object.Mavo.Functions.sort (mavo-sort.js:140)
at Collection.Mavo.Collection.sortDOM (mavo-sort.js:303)
at MutationObserver.Mavo.Observer.subtree (mavo-sort.js:77)

code is as simple as that

<ul>
	<li mv-multiple="service" mv-sort="cost" >
		<select property="type">
			<option>Domain</option>	
			<option value="Email_Account">Email Account</option>	
			<option>Hosting</option>	
			<option>Retainer</option>	
		</select>
		<input type="text" property="name">
		<input type="date" property="renewal_date">
		<input type="number" property="cost">
		<div class="mv-item-bar"></div>
	</li>
</ul>